diff options
author | ssmith <ssmith@iol.unh.edu> | 2020-06-17 11:44:30 -0400 |
---|---|---|
committer | ssmith <ssmith@iol.unh.edu> | 2020-06-23 12:26:07 -0400 |
commit | 03f767a2833293b7a0412eba9dce438a4b074b87 (patch) | |
tree | a34ebe7451ed7a81ae4a60943071125556a025f5 /src/workflow | |
parent | f96012fae9a106228ad80671a8c66476834a50db (diff) |
Quick Booking Menu Resource Availibility
Signed-off-by: Sean Smith <ssmith@iol.unh.edu>
Change-Id: I79f411af8996698d2c553185eed0221792a348d0
Diffstat (limited to 'src/workflow')
-rw-r--r-- | src/workflow/forms.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/workflow/forms.py b/src/workflow/forms.py index 4220dea..9b56f93 100644 --- a/src/workflow/forms.py +++ b/src/workflow/forms.py @@ -1,5 +1,6 @@ ############################################################################## # Copyright (c) 2018 Sawyer Bergeron, Parker Berberian, and others. +# Copyright (c) 2020 Sawyer Bergeron, Sean Smith, and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -22,7 +23,7 @@ from account.models import UserProfile from resource_inventory.models import ( OPNFVRole, Installer, - Scenario, + Scenario ) from resource_inventory.resource_manager import ResourceManager from booking.lib import get_user_items, get_user_field_opts @@ -314,8 +315,10 @@ class FormUtils: 'selectable': true, 'follow': multiple_hosts, 'multiple': false, - 'class': 'lab' + 'class': 'lab', + 'available_resources': json.dumps(lab.get_available_resources()) } + items[lab_node['id']] = lab_node neighbors[lab_node['id']] = [] labs[lab_node['id']] = lab_node @@ -331,14 +334,19 @@ class FormUtils: 'selectable': true, 'follow': false, 'multiple': multiple_hosts, - 'class': 'resource' + 'class': 'resource', + 'required_resources': json.dumps(template.get_required_resources()) } + if multiple_hosts: resource_node['values'] = [] # place to store multiple values + items[resource_node['id']] = resource_node neighbors[lab_node['id']].append(resource_node['id']) + if resource_node['id'] not in neighbors: neighbors[resource_node['id']] = [] + neighbors[resource_node['id']].append(lab_node['id']) resources[resource_node['id']] = resource_node @@ -349,6 +357,7 @@ class FormUtils: 'neighbors': neighbors, 'filter_items': items } + return context |