|
@@ -51,6 +51,15 @@
|
|
|
></app-deploy-control-key>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
+ <!-- custom param -->
|
|
|
+ <template v-for="cont in customOptions">
|
|
|
+ <el-form-item :key="cont.key" :label="`${cont.name}:`">
|
|
|
+ <app-deploy-control-key
|
|
|
+ v-model="modalForm.control.custom[cont.key]"
|
|
|
+ :key-type="cont.type"
|
|
|
+ ></app-deploy-control-key>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
</el-form>
|
|
|
<div slot="footer">
|
|
|
<el-button type="danger" @click="cancel" plain>取消</el-button>
|
|
@@ -64,7 +73,7 @@
|
|
|
<script>
|
|
|
import { DEPLOY_CONTROL_KEYS } from "@/constants/enumerate";
|
|
|
import { clearData } from "@/plugins/utils";
|
|
|
-import { appDeployInsertOrUpdate } from "../api";
|
|
|
+import { appDeployInsertOrUpdate, appDeployCustomParams } from "../api";
|
|
|
import AppDeployControlKey from "./AppDeployControlKey.vue";
|
|
|
|
|
|
const initModalForm = {
|
|
@@ -73,11 +82,13 @@ const initModalForm = {
|
|
|
name: "",
|
|
|
mode: "",
|
|
|
ipAllow: "",
|
|
|
- control: {},
|
|
|
+ control: {
|
|
|
+ custom: {},
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
export default {
|
|
|
- name: "modify-app",
|
|
|
+ name: "modify-app-deploy",
|
|
|
components: { AppDeployControlKey },
|
|
|
props: {
|
|
|
instance: {
|
|
@@ -123,9 +134,18 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
+ customOptions: [],
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ async getCustomParams() {
|
|
|
+ if (this.customOptions.length) return;
|
|
|
+ const res = await appDeployCustomParams(this.instance.appId);
|
|
|
+ this.customOptions = res || [];
|
|
|
+ this.customOptions.forEach((item) => {
|
|
|
+ item.type = item.type.toLowerCase();
|
|
|
+ });
|
|
|
+ },
|
|
|
initData(val) {
|
|
|
this.modalForm = this.$objAssign(initModalForm, val);
|
|
|
|
|
@@ -140,9 +160,21 @@ export default {
|
|
|
});
|
|
|
this.modalForm.control = control;
|
|
|
|
|
|
+ const customVals = val.control?.custom || {};
|
|
|
+ let custom = {};
|
|
|
+ this.customOptions.forEach((cont) => {
|
|
|
+ const defaultVal = cont.type === "number" ? undefined : null;
|
|
|
+ custom[cont.key] =
|
|
|
+ customVals[cont.key] || customVals[cont.key] === 0
|
|
|
+ ? customVals[cont.key]
|
|
|
+ : defaultVal;
|
|
|
+ });
|
|
|
+ this.modalForm.control.custom = custom;
|
|
|
+
|
|
|
this.$refs.modalFormComp.clearValidate();
|
|
|
},
|
|
|
- visibleChange() {
|
|
|
+ async visibleChange() {
|
|
|
+ await this.getCustomParams();
|
|
|
this.initData(this.instance);
|
|
|
},
|
|
|
cancel() {
|