aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorSébastien Determe <sebastien.determe@intl.att.com>2019-03-11 12:56:00 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-11 12:56:00 +0000
commit42c3e43bca2dbfbe7b5b62bbfeb5b60282378a6b (patch)
tree0463a2eb8f17b217b3e5a7f5cfe64bc7f73cc897 /src/main
parent91b5e92c03065cafda1e3e4deb5c00baad6c5120 (diff)
parent50f71fb4c0baa044127c0b886a8378bee857cdc9 (diff)
Merge "Rework the UI Menu"
Diffstat (limited to 'src/main')
-rw-r--r--src/main/resources/META-INF/resources/designer/index.html1
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js71
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/app.js15
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/menuHandler.js81
4 files changed, 93 insertions, 75 deletions
diff --git a/src/main/resources/META-INF/resources/designer/index.html b/src/main/resources/META-INF/resources/designer/index.html
index 0d87e2693..e30d7245b 100644
--- a/src/main/resources/META-INF/resources/designer/index.html
+++ b/src/main/resources/META-INF/resources/designer/index.html
@@ -181,5 +181,6 @@
<!-- dialog box ctl end -->
<script src="scripts/aOnBoot.js"></script>
<script src="scripts/propertyController.js"></script>
+ <script src="scripts/menuHandler.js"></script>
</body>
diff --git a/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js b/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
index cdbca2fe4..c7ffdb3f4 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
@@ -201,32 +201,13 @@ app
});
return def.promise;
};
- this.checkPermittedActionCd = function(permittedActionCd, menuText,
- actionCd) {
-
- if (permittedActionCd.indexOf(actionCd) > -1) {
- document.getElementById(menuText).classList.remove('ThisLink');
- } else {
- document.getElementById(menuText).classList.add('ThisLink');
- }
- };
this.processActionResponse = function(modelName, pars) {
// populate control name (prefix and uuid here)
- var controlNamePrefix = pars.controlNamePrefix;
- var controlNameUuid = pars.controlNameUuid;
- deploymentId = pars.deploymentId;
- typeID = pars.typeId;
var headerText = "Closed Loop Modeler - " + modelName;
- if (controlNameUuid != null) {
- headerText = headerText + " [" + controlNamePrefix
- + controlNameUuid + "]";
- }
- document.getElementById("modeler_name").textContent = headerText;
- document.getElementById("templa_name").textContent = ("Template Used - " + selected_template);
- setStatus(pars)
+ setStatus();
disableBPMNAddSVG(pars);
- this.enableDisableMenuOptions(pars);
+ enableDisableMenuOptions();
};
this.processRefresh = function(pars) {
@@ -237,7 +218,7 @@ app
typeID = newPars.typeId;
deploymentId = newPars.deploymentId;
setStatus(newPars);
- this.enableDisableMenuOptions(newPars);
+ enableDisableMenuOptions();
}
function setStatus() {
@@ -297,49 +278,13 @@ app
checkIfElementType(name)
});
}
- this.enableDisableMenuOptions = function(pars) {
-
- var permittedActionCd = pars.permittedActionCd;
+ enableDisableMenuOptions = function() {
+ //var status = getStatus();
+ var status = "DESIGN";
// dropdown options - always true
- document.getElementById('Open CL').classList.remove('ThisLink');
- if (readMOnly) {
- // enable model options
- document.getElementById('Properties CL').classList
- .remove('ThisLink');
- document.getElementById('Close Model').classList
- .remove('ThisLink');
- // disable models options
- document.getElementById('Save CL').classList.add('ThisLink');
- document.getElementById('Revert Model Changes').classList
- .add('ThisLink');
- } else {
- // enable menu options
- document.getElementById('Save CL').classList.remove('ThisLink');
- document.getElementById('Properties CL').classList
- .remove('ThisLink');
- document.getElementById('Revert Model Changes').classList
- .remove('ThisLink');
- document.getElementById('Close Model').classList
- .remove('ThisLink');
- document.getElementById('Validation Test').classList
- .remove('ThisLink');
- document.getElementById('Refresh Status').classList
- .remove('ThisLink');
- }
+ enableDefaultMenu();
// enable/disable menu options based on permittedActionCd
// list
- this.checkPermittedActionCd(permittedActionCd, 'Validation Test',
- 'TEST');
- this.checkPermittedActionCd(permittedActionCd, 'Submit', 'SUBMIT');
- this.checkPermittedActionCd(permittedActionCd, 'Resubmit',
- 'RESUBMIT');
- this.checkPermittedActionCd(permittedActionCd, 'Update', 'UPDATE');
- this.checkPermittedActionCd(permittedActionCd, 'Stop', 'STOP');
- this
- .checkPermittedActionCd(permittedActionCd, 'Restart', 'RESTART');
- this.checkPermittedActionCd(permittedActionCd, 'Delete', 'DELETE');
- this.checkPermittedActionCd(permittedActionCd, 'Deploy', 'DEPLOY');
- this.checkPermittedActionCd(permittedActionCd, 'UnDeploy',
- 'UNDEPLOY');
+ enableActionMenu(status);
}
} ]);
diff --git a/src/main/resources/META-INF/resources/designer/scripts/app.js b/src/main/resources/META-INF/resources/designer/scripts/app.js
index 100dda361..1794cb769 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/app.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/app.js
@@ -269,12 +269,8 @@ function($scope, $rootScope, $timeout, dialogs) {
} else if (name == "Save CL") {
$rootScope.isNewClosed = false;
$scope.cldsPerformAction("SAVE");
- } else if (name == "Validation Test") {
- $scope.cldsPerformAction("TEST");
} else if (name == "Submit") {
$scope.cldsConfirmPerformAction("SUBMIT");
- } else if (name == "Resubmit") {
- $scope.cldsConfirmPerformAction("RESUBMIT");
} else if (name == "Update") {
$scope.cldsConfirmPerformAction("UPDATE");
} else if (name == "Delete") {
@@ -319,17 +315,12 @@ function($scope, $rootScope, $timeout, dialogs) {
name : "Close Model"
} ],
"Manage" : [ {
- link : "/cldsTestActivate",
- name : "Validation Test"
- }, {
link : "/cldsSubmit",
name : "Submit"
}, {
- link : "/cldsResubmit",
- name : "Resubmit"
- }, {
- link : "/cldsUpdate",
- name : "Update"
+ // disabled for Dublin since Policy doesn't support updating in this release
+ // link : "/cldsUpdate",
+ // name : "Update"
}, {
link : "/cldsStop",
name : "Stop"
diff --git a/src/main/resources/META-INF/resources/designer/scripts/menuHandler.js b/src/main/resources/META-INF/resources/designer/scripts/menuHandler.js
new file mode 100644
index 000000000..43c9275f4
--- /dev/null
+++ b/src/main/resources/META-INF/resources/designer/scripts/menuHandler.js
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+
+function enableActionMenu(status) {
+ var actionMap = '{"DESIGN": ["Submit","Delete"],"RUNNING": ["Stop","UnDeploy"],"SUBMITTED": ["Submit","Delete","Deploy"],"DEPLOYED": ["UnDeploy","Stop"],"UNDEPLOY": ["Deploy","Submit","Restart","Delete"],"STOPPED":["UnDeploy","Restart"]}';
+ var actionMapJson = JSON.parse(actionMap);
+ var actionArr = actionMapJson[status];
+ disableAllActionMenu();
+ if (actionArr != null && actionArr.length > 0) {
+ for (var i=0; i < actionArr.length; i++) {
+ document.getElementById(actionArr[i]).classList
+ .remove('ThisLink');
+ }
+ }
+}
+
+function disableAllActionMenu() {
+ var allActions = ["Submit","Stop","Restart","Delete","Deploy","UnDeploy"];
+ for (var i=0; i < allActions.length; i++) {
+ document.getElementById(allActions[i]).classList
+ .add('ThisLink');
+ }
+}
+
+function enableAllActionMenu() {
+ var allActions = ["Submit","Stop","Restart","Delete","Deploy","UnDeploy"];
+ for (var i=0; i < allActions.length; i++) {
+ document.getElementById(allActions[i]).classList
+ .remove('ThisLink');
+ }
+}
+
+function enableDefaultMenu() {
+ document.getElementById('Open CL').classList.remove('ThisLink');
+ document.getElementById('Wiki').classList.remove('ThisLink');
+ document.getElementById('Contact Us').classList.remove('ThisLink');
+ if (readMOnly) {
+ // enable model options
+ document.getElementById('Properties CL').classList
+ .remove('ThisLink');
+ document.getElementById('Close Model').classList
+ .remove('ThisLink');
+ // disable models options
+ document.getElementById('Save CL').classList.add('ThisLink');
+ document.getElementById('Revert Model Changes').classList
+ .add('ThisLink');
+ } else {
+ // enable menu options
+ document.getElementById('Save CL').classList.remove('ThisLink');
+ document.getElementById('Properties CL').classList
+ .remove('ThisLink');
+ document.getElementById('Revert Model Changes').classList
+ .remove('ThisLink');
+ document.getElementById('Close Model').classList
+ .remove('ThisLink');
+ document.getElementById('Refresh Status').classList
+ .remove('ThisLink');
+ }
+}
+