diff --git a/frontend/src/components/setup-table/install-table.vue b/frontend/src/components/setup-table/install-table.vue index 12614ef03..624193de4 100644 --- a/frontend/src/components/setup-table/install-table.vue +++ b/frontend/src/components/setup-table/install-table.vue @@ -195,6 +195,8 @@ import { Context } from 'vm'; import { IFileInfo, IKeysMatch, ISetupHead, ISetupRow, ITabelFliter, ISetupParent } from '@/types'; import { getDefaultConfig, passwordFillText } from '@/config/config'; import { splitCodeArr } from '@/common/regexp'; +import { IAp } from '@/types/config/config'; +import { ICloudSource } from '@/types/cloud/cloud'; interface IFilterRow { [key: string]: ITabelFliter @@ -239,6 +241,9 @@ export default class SetupTable extends Vue { @Prop({ type: String, default: '' }) private readonly localMark!: string; @Prop({ type: Function }) private readonly beforeDelete!: Function; @Prop({ type: Number }) private readonly bkCloudId!: number; + @Prop({ type: Array }) private readonly aps!: IAp[]; + @Prop({ type: Array }) private readonly clouds!: ICloudSource[]; + @Prop() private readonly arbitrary!: any; // 可以是任意值, 用来在config文件里做为必要的一些参数 @Ref('tableBody') private readonly tableBody!: any; @Ref('scrollPlace') private readonly scrollPlace!: any; @@ -269,10 +274,10 @@ export default class SetupTable extends Vue { return AgentStore.fetchPwd; } private get cloudList() { - return AgentStore.cloudList; + return this.clouds || AgentStore.cloudList; } private get apList() { - return AgentStore.apList; + return this.aps || AgentStore.apList; } private get channelList() { return AgentStore.channelList; @@ -386,7 +391,7 @@ export default class SetupTable extends Vue { private addPropToData(row: ISetupRow | any, config: ISetupHead) { const prop = config.prop as keyof ISetupRow; if (typeof config.getDefaultValue === 'function') { - row[prop] = config.getDefaultValue(row); + row[prop] = config.getDefaultValue.call(this, row); } else { row[prop] = isEmpty(row[prop]) && !isEmpty(config.default) ? config.default : row[prop]; } diff --git a/frontend/src/types/config/config.ts b/frontend/src/types/config/config.ts index d7bf76cfc..c6e74d0c4 100644 --- a/frontend/src/types/config/config.ts +++ b/frontend/src/types/config/config.ts @@ -60,6 +60,7 @@ export interface IAp extends IApParams { ap_type: string is_enabled: boolean is_default: boolean + file_cache_dirs: string // nginx_path: null | string } diff --git a/frontend/src/views/cloud/cloud-manager-add/cloud-manager-setup.vue b/frontend/src/views/cloud/cloud-manager-add/cloud-manager-setup.vue index 64f6e3274..2c89e8bc4 100644 --- a/frontend/src/views/cloud/cloud-manager-add/cloud-manager-setup.vue +++ b/frontend/src/views/cloud/cloud-manager-add/cloud-manager-setup.vue @@ -33,6 +33,9 @@ :class="{ 'cloud-setup-table': isManual }" local-mark="proxy_setup`" :col-setting="false" + :aps="apList" + :bk-cloud-id="id" + :arbitrary="apId" :setup-info="formData.bkCloudSetupInfo" :key="net.active" :before-delete="handleBeforeDeleteRow" @@ -246,11 +249,6 @@ export default class CloudManagerSetup extends Mixins(formLabelMixin, FilterIpMi */ private initTableData() { const defaultAp = this.apList.find(item => item.is_default); - let dataPath = ''; - if (defaultAp) { - const { linux = {} } = defaultAp.agent_config || {}; - dataPath = linux.data_path; - } const table = []; const initRow = { inner_ip: '', @@ -259,7 +257,7 @@ export default class CloudManagerSetup extends Mixins(formLabelMixin, FilterIpMi auth_type: '', prove: '', retention: -1, - data_path: dataPath, + data_path: defaultAp?.file_cache_dirs || '', }; // 默认给两行数据 table.push({ ...initRow }); diff --git a/frontend/src/views/cloud/config/netTableConfig.ts b/frontend/src/views/cloud/config/netTableConfig.ts index 553fee4af..86b27b41d 100644 --- a/frontend/src/views/cloud/config/netTableConfig.ts +++ b/frontend/src/views/cloud/config/netTableConfig.ts @@ -168,6 +168,9 @@ const config: ISetupHead[] = [ manualProp: true, parentProp: 'trans_info', rules: [reguFnSysPath()], + getDefaultValue(): string { + return this.apList?.find(ap => ap.id === this.arbitrary)?.file_cache_dirs || ''; + }, }, { label: 'BT节点探测',