|
26 | 26 | :title="$t('message.newContainer')" |
27 | 27 | :visible.sync="dialogVisible" |
28 | 28 | width="50%" |
29 | | - v-on:close="closeEdit" |
30 | | - :before-close="handleClose"> |
| 29 | + v-on:close="closeEdit"> |
31 | 30 | <el-form ref="form" :model="form" label-width="150px" class="genTable" label-position='left'> |
32 | 31 | <el-form-item :label="$t('message.containerName')"> |
33 | 32 | <el-input v-model="form.containerName"></el-input> |
|
59 | 58 | :file-list = "fileList" |
60 | 59 | :on-success="onSuccess" |
61 | 60 | :action="`${requestUrl}/container/jarUpload`" |
| 61 | + :headers="headersObj" |
62 | 62 | multiple> |
63 | 63 | <i class="el-icon-upload"></i> |
64 | 64 | <div class="el-upload__text">Drag the file here, or <em>click on Upload</em></div> |
|
79 | 79 |
|
80 | 80 | <script> |
81 | 81 | import baseUrl from '../../main'; |
| 82 | + import {Message} from "element-ui"; |
82 | 83 |
|
83 | 84 | let ws; |
84 | 85 | export default { |
|
104 | 105 | containerList:[], |
105 | 106 | logs:[], |
106 | 107 | requestUrl :"", |
107 | | - fileList: [] |
| 108 | + fileList: [], |
| 109 | +
|
| 110 | + headersObj: { |
| 111 | + Power_jwt: undefined, |
| 112 | + AppId: undefined |
| 113 | + } |
108 | 114 | } |
109 | 115 | }, |
110 | 116 | methods: { |
111 | 117 | onSubmit() { |
| 118 | + const that = this |
112 | 119 | // 接口参数 |
113 | 120 | let data = { |
114 | 121 | appId:this.appId, |
|
124 | 131 | data.sourceInfo = this.sourceInfo; |
125 | 132 | data.sourceType = 'FatJar' |
126 | 133 | } |
127 | | - this.axios.post("container/save",data).then(()=>{ |
128 | | - let appId = window.localStorage.getItem("Power_appId"); |
129 | | - this.axios.get("/container/list?appId=" + appId).then(res => { |
130 | | - this.$message.info(this.$t('message.success')); |
131 | | - // 恢复默认表单 |
132 | | - this.dialogVisible = false; |
133 | | - this.form.containerName = ''; |
134 | | - this.gitForm = {}; |
135 | | - this.sourceInfo = ''; |
136 | | - this.id = ''; |
137 | | - // 刷新容器表单 |
138 | | - this.containerList = res; |
139 | | - }); |
| 134 | + this.axios.post("container/save",data).then(res=>{ |
| 135 | + console.log('container save result:' + JSON.stringify(res)) |
| 136 | +
|
| 137 | + Message.success("SUCCESS"); |
| 138 | + // 恢复默认表单 |
| 139 | + that.dialogVisible = false; |
| 140 | + that.form.containerName = ''; |
| 141 | + that.gitForm = {}; |
| 142 | + that.sourceInfo = ''; |
| 143 | + that.id = ''; |
| 144 | +
|
| 145 | + that.listContainers() |
140 | 146 | }); |
141 | 147 | }, |
142 | 148 | // 文件上传成功后 修改来源信息 |
|
145 | 151 | }, |
146 | 152 | deleteItem(item,index){ |
147 | 153 | let appId = window.localStorage.getItem("Power_appId"); |
148 | | - this.flyio.get("/container/delete?containerId="+ item.id+'&appId='+appId).then(res => { |
| 154 | + this.axios.get("/container/delete?containerId="+ item.id+'&appId='+appId).then(res => { |
149 | 155 | console.log(res); |
150 | 156 | this.containerList.splice(index,1); |
151 | 157 | this.$message.info(this.$t('message.success')); |
|
194 | 200 | }, |
195 | 201 | listOfItem(item){ |
196 | 202 | let appId = window.localStorage.getItem("Power_appId"); |
197 | | - this.flyio.get("/container/listDeployedWorker?containerId="+ item.id+'&appId='+appId).then(res => { |
| 203 | + this.axios.get("/container/listDeployedWorker?containerId="+ item.id+'&appId='+appId).then(res => { |
198 | 204 | if(res.data.data){ |
199 | 205 | this.logs = res.data.data.split('\n'); |
200 | 206 | this.arrangeTitle = this.$t('message.deployedWorkerList'); |
|
215 | 221 | }else { |
216 | 222 | this.requestUrl = baseUrl; |
217 | 223 | } |
218 | | - } |
| 224 | + }, |
| 225 | +
|
| 226 | + listContainers() { |
| 227 | + let appId = window.localStorage.getItem("Power_appId"); |
| 228 | + this.axios.get("/container/list?appId=" + appId).then(res => { |
| 229 | + console.log(res); |
| 230 | + if(res.data.success){ |
| 231 | + this.containerList = res.data.data; |
| 232 | + } |
| 233 | + }); |
| 234 | + } |
219 | 235 | }, |
220 | 236 | mounted() { |
221 | 237 | this.calculateRequestUrl(); |
| 238 | + this.listContainers(); |
222 | 239 |
|
223 | | - let appId = window.localStorage.getItem("Power_appId"); |
224 | | - this.flyio.get("/container/list?appId=" + appId).then(res => { |
225 | | - console.log(res); |
226 | | - if(res.data.success){ |
227 | | - this.containerList = res.data.data; |
228 | | - } |
229 | | - }); |
| 240 | + this.headersObj.AppId = window.localStorage.getItem("Power_appId") |
| 241 | + this.headersObj.Power_jwt = window.localStorage.getItem("Power_jwt") |
230 | 242 | } |
231 | 243 | } |
232 | 244 | </script> |
|
0 commit comments