2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 define(['angular'], function(angular) {
23 var DashboardController = ["$scope", "$http", "Uri", function($scope, $http, Uri) {
25 $http.get(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance"))
26 .success(function(data) {
27 $scope.UrnDataMap = data;
30 //enable saveRow button
31 $scope.enableButton=function(urnData)
33 document.getElementById("btn_" + urnData.urnname + "_key").disabled = false;
36 $scope.enableAddRowBtn=function()
38 if(document.getElementById("new_key").value.trim().length >0)
39 document.getElementById("addRow_BTN").disabled = false;
41 document.getElementById("addRow_BTN").disabled = true;
45 $scope.addNewRow = function()
47 var newKey = document.getElementById("new_key").value.trim();
48 var newValue = document.getElementById("new_value").value.trim();
51 for (var i=0;i<$scope.UrnDataMap.length;i++)
53 var n = $scope.UrnDataMap[i].urnname.localeCompare(newKey);
61 alert("URN Name already exists, please check the KEY!");
68 var temp = newKey + "|" + newValue;
70 $http.put(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance"), temp);
72 document.getElementById("new_key").value = "";
73 document.getElementById("new_value").value = "";
78 //this.enableAddRowBtn;
79 document.getElementById("addRow_BTN").disabled = true;
81 $http.get(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance"))
82 .success(function(data) {
83 $scope.UrnDataMap = data;
89 $scope.retrieveData = function() {
91 $http.get(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance"))
92 .success(function(data) {
93 $scope.UrnDataMap = data;
97 $scope.SaveRow = function(user)
99 $http.post(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance"), user);
101 document.getElementById("btn_" + user.urnname + "_key").disabled = true;
102 document.getElementById(user.urnname + "_status").style.display = "";
103 this.enableAddRowBtn;
105 $http.get(Uri.appUri("plugin://urnMap-plugin/:engine/process-instance"))
106 .success(function(data) {
107 $scope.UrnDataMap = data;
113 var Configuration = ['ViewsProvider', function(ViewsProvider) {
115 ViewsProvider.registerDefaultView('cockpit.dashboard', {
116 id: 'process-definitions',
117 label: 'Deployed Processes',
118 url: 'plugin://urnMap-plugin/static/app/dashboard.html',
119 controller: DashboardController,
120 // make sure we have a higher priority than the default plugin
127 var ngModule = angular.module('cockpit.plugin.urnMap-plugin', []);
129 ngModule.config(Configuration);