4 <div class="col-md-6 col-sm-12">
5 <div class="ibox float-e-margins">
6 <div class="ibox-title">
7 <h5 class="text-success">Step</h5>
8 <div class="ibox-tools" style="height: 25px;">
9 <button class="btn btn-success " type="button" id="new-step"> <span class="bold">New Step</span></button>
10 <a class="collapse-link" >
11 <i class="fa fa-chevron-up" v-on:click.stop='collapseBox'></i>
15 <div class="ibox-content" style="border: 1px solid #cec8c8">
16 <form class="form-horizontal">
18 <div class="form-group">
19 <label class="col-md-2 control-label">Name:</label>
20 <div class="col-md-5"><input type="text" class="form-control" id="name"></div>
22 <div class="form-group">
23 <label class="col-md-2 control-label">Service:</label>
24 <div class="col-md-4">
25 <select class="form-control" id="service">
27 <option v-for='service in dataService' v-bind:value='service'>{{service}}</option>
31 <div class="form-group">
32 <label class="col-md-2 control-label">Action:</label>
33 <div class="col-md-4">
34 <select class="form-control" id="action">
36 <option v-for='action in dataAction' v-bind:value='action.name'>{{action.name}}</option>
41 <div class="row" id="parameter">
42 <div class="form-group" v-for='(param, index) in dataParam'>
43 <label class="col-md-2 control-label" v-bind:title="param.description">{{ param.name }}
45 <div class="col-md-5">
46 <input type="text" class="form-control" v-bind:placeholder="param.description" v-bind:id="'par'+index">
54 <div class="col-md-6 col-sm-12">
55 <div class="ibox float-e-margins">
56 <div class="ibox-title">
57 <h5 class="text-success">StepList</h5>
58 <div class="ibox-tools">
59 <a class="collapse-link">
60 <i class="fa fa-chevron-up" v-on:click.stop='collapseBox'></i>
64 <div class="ibox-content" id="step-list" style="border: 1px solid #cec8c8">
65 <div v-for='(step, index) in stepList' class='ibox'>
66 <div class="ibox-title step">
67 <h5>Step{{index + 1}} {{step.name}} </h5>
68 <div class="ibox-tools">
69 <a class="collapse-link">
70 <i class="fa fa-chevron-up" v-on:click.stop='collapseBox'></i>
72 <a class="close-link" v-on:click='removeStep(index)'>
73 <i class="fa fa-times"></i>
77 <div class="ibox-content">
79 <label class="control-label"><span style='padding-right: 20px;'>Service:</span> {{ step.service }}</label>
82 <label class="control-label"><span style='padding-right: 20px;'>Action:</span> {{ step.action }}</label>
84 <div class="param row">
85 <label class="control-label">
86 <span style='padding-right: 20px;'>Parameter:</span>
87 <span v-for='param in step.params'>{{param.key}} = {{param.value}} ; </span>
108 mounted: function() {
109 this.getServiceList();
111 $("#service").change(function(){
112 self.selectService();
114 $("#action").change(function(){
117 $('#new-step').click(function(){
122 getServiceList: function(){
123 console.log("get serviceList!");
126 url: this.global.SERVER_ADDR + "service/list",
129 success: function(data){
130 console.log("ajax success!");
131 if(data['code'] == 200){
132 self.dataService = [];
133 self.dataService = data['result'];
138 getServiceContent: function(name){
141 url: this.global.SERVER_ADDR + "service/content",
147 success: function(data){
148 if(data['code'] == 200){
149 self.dataAction = [];
150 self.dataAction = data['result']['actions'];
155 getParams: function(name){
156 for(var i in this.dataAction){
157 if(this.dataAction[i].name == name){
159 this.dataParam = this.dataAction[i].params;
164 selectService: function(event){
165 var selectedName = $("#service").val();
166 this.getServiceContent(selectedName);
168 selectAction: function(event){
169 var selectedName = $("#action").val();
170 if(selectedName=="") {
174 this.getParams(selectedName);
175 if(this.dataParam==undefined) this.dataParam = [];
178 var ser = $("#service").val();
179 var act = $("#action").val();
180 var na = $("#name").val();
181 if(ser==""||act==""||na==""){
182 alert('Not completed!');
185 var parCount = this.dataParam.length;
187 for(var i=0; i<parCount; ++i){
188 var temp = $('#par'+i).val();
190 alert('Not completed!');
193 var name = this.dataParam[i].name;
194 par.push({key: name, value: temp});
196 this.stepList.push({name: na, service: ser, action: act, params: par});
198 $("#service").val("");
199 this.dataAction = [];
202 removeStep: function(index) {
203 this.stepList.splice(index, 1);
205 collapseBox: function(event) {
206 console.log("collapse");
207 var ele = event.target;
210 var ibox = $(ele).closest('div.ibox');
211 var content = ibox.children('.ibox-content');
212 content.slideToggle(200);
213 $(ele).toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
217 stepList: function() {
218 this.$emit('stepList', this.stepList);