rebuild GUI structure(only changed modules' name)
[vnfsdk/refrepo.git] / catalog / src / main / webapp / catalog / js / template / tmDetailUtil.js
1 /*
2  * Copyright 2016-2017 ZTE Corporation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 var tmDetailUtil = {};
17 tmDetailUtil.timer = null;
18
19 tmDetailUtil.nameRender = function(obj) {
20     return '<a href="#" onclick="vm.nodesDetail.$showDetails('
21     + '\'block\',\'' + obj.aData.id + '\', \'' + obj.aData.name + '\',\'' + vm.nodesTab.nodesList.tempId + '\')">' + obj.aData.name + '</a>';
22 }
23
24 tmDetailUtil.inputsRender = function(obj) {
25         var inputs = obj.aData.inputs;
26         var result = "";
27         //if(inputs && inputs.length) {
28         //      var optionHtml = "";
29         //      for(var i=0;i<inputs.length;i++) {
30         //              optionHtml += '<option>' + inputs[i].name + '</option>';
31         //      }
32         //      result = '<select>' + optionHtml + '</select>';
33         //}
34         result = JSON.stringify(inputs);
35         return result;
36 }
37
38 tmDetailUtil.outputsRender = function(obj) {
39         var outputs = obj.aData.outputs;
40         var result = "";
41         //if(inputs && inputs.length) {
42         //      var optionHtml = "";
43         //      for(var i=0;i<inputs.length;i++) {
44         //              optionHtml += '<option>' + inputs[i].name + '</option>';
45         //      }
46         //      result = '<select>' + optionHtml + '</select>';
47         //}
48         result = JSON.stringify(outputs);
49         return result;
50 }
51
52 tmDetailUtil.initSteps = function() {
53         $.ajax({
54                 type : "GET",
55                 url : vm.executionTab.$queryEventsInfoUrl,
56                 data : "json",
57                 success : function(data) {
58                         console.log("initSteps");
59                         if (data) {
60                                 var step = $(".step");
61                     if (step.getStep().length == 0) {
62                         vm.executionTab.steps = [{title : "start"}, {title : "install VM"}, {title : "execute"}, {title : "complete"}];
63                         step.loadStep({
64                             size : "large",
65                             color : "blue",
66                             steps : vm.executionTab.steps
67                         });
68                     }
69                         }
70                 }
71         });
72 }