diff options
author | Parker Berberian <pberberian@iol.unh.edu> | 2019-05-22 17:35:52 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2019-05-22 17:35:52 +0000 |
commit | 2e353a7c9fdc1439bb5b0999a6bb67e27ed2d46b (patch) | |
tree | 88ee597da2644fbdea6187930622bde4db168eb5 /src/workflow/models.py | |
parent | 9fc3d1a8be7f01b69e45181e8e38cc1063b56c66 (diff) | |
parent | a21c6044461097a8551efd7bbcae2cd4d466fb07 (diff) |
Merge "Make steps possible to hide/show"
Diffstat (limited to 'src/workflow/models.py')
-rw-r--r-- | src/workflow/models.py | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/src/workflow/models.py b/src/workflow/models.py index bf5751d..25d7e84 100644 --- a/src/workflow/models.py +++ b/src/workflow/models.py @@ -158,12 +158,52 @@ class BookingAuthManager(): return False +class WorkflowStepStatus(object): + UNTOUCHED = 0 + INVALID = 100 + VALID = 200 + + class WorkflowStep(object): template = 'bad_request.html' title = "Generic Step" description = "You were led here by mistake" short_title = "error" metastep = None + # phasing out metastep: + + valid = WorkflowStepStatus.UNTOUCHED + message = "" + + enabled = True + + def cleanup(self): + raise Exception("WorkflowStep subclass of type " + str(type(self)) + " has no concrete implemented cleanup() method") + + def enable(self): + if not self.enabled: + self.enabled = True + + def disable(self): + if self.enabled: + self.cleanup() + self.enabled = False + + def set_invalid(self, message, code=WorkflowStepStatus.INVALID): + self.valid = code + self.message = message + + def set_valid(self, message, code=WorkflowStepStatus.VALID): + self.valid = code + self.message = message + + def to_json(self): + return { + 'title': self.short_title, + 'enabled': self.enabled, + 'valid': self.valid, + 'message': self.message, + } def __init__(self, id, repo=None): self.repo = repo @@ -205,6 +245,8 @@ class Confirmation_Step(WorkflowStep): title = "Confirm Changes" description = "Does this all look right?" + short_title = "confirm" + def get_context(self): context = super(Confirmation_Step, self).get_context() context['form'] = ConfirmationForm() @@ -245,12 +287,6 @@ class Confirmation_Step(WorkflowStep): pass -class Workflow(): - - steps = [] - active_index = 0 - - class Repository(): EDIT = "editing" @@ -271,6 +307,7 @@ class Repository(): CONFIG_MODELS = "configuration bundle models" OPNFV_MODELS = "opnfv configuration models" SESSION_USER = "session owner user account" + SESSION_MANAGER = "session manager for current session" VALIDATED_MODEL_GRB = "valid grb config model instance in db" VALIDATED_MODEL_CONFIG = "valid config model instance in db" VALIDATED_MODEL_BOOKING = "valid booking model instance in db" |