diff --git a/frontend/src/common/form-check.ts b/frontend/src/common/form-check.ts
index 54dbc08c7..7ba6d7c9b 100644
--- a/frontend/src/common/form-check.ts
+++ b/frontend/src/common/form-check.ts
@@ -137,3 +137,9 @@ export function regrLengthCheck(val, max = 32, min = 0) {
const len = val.replace(/[\u0391-\uFFE5]/g, 'aa').length;
return len >= min && len <= max;
}
+
+export function osDirReplace(str: string, filler = '/'): string {
+ const value = str.trim().replace(/[/\\]+/ig, '/');
+ const pathArr = value.split('/').filter((item: string) => !!item);
+ return pathArr.join(filler);
+}
diff --git a/frontend/src/components/setup-table/install-input-type.vue b/frontend/src/components/setup-table/install-input-type.vue
index 7d318326f..9690964df 100644
--- a/frontend/src/components/setup-table/install-input-type.vue
+++ b/frontend/src/components/setup-table/install-input-type.vue
@@ -316,7 +316,10 @@ export default class InputType extends Mixins(emitter) {
public handleBlur(value: IValue, event?: Event) {
this.isFocus = false;
this.handleEmitBlur(value, event);
- this.dispatch('step-verify-input', 'verify-blur', this.inputValue);
+ // 优化 - 兼容需要对值做修改之后再进行校验情况
+ this.$nextTick(() => {
+ this.dispatch('step-verify-input', 'verify-blur', this.inputValue);
+ });
}
/**
* 文件变更时事件
diff --git a/frontend/src/components/setup-table/install-table.vue b/frontend/src/components/setup-table/install-table.vue
index 12614ef03..f00a59051 100644
--- a/frontend/src/components/setup-table/install-table.vue
+++ b/frontend/src/components/setup-table/install-table.vue
@@ -160,7 +160,7 @@
fileInfo: getCellFileInfo(row, config)
}"
@focus="handleCellFocus(arguments, { row, config, rowIndex, colIndex })"
- @blur="handleCellBlur"
+ @blur="handleCellBlur(arguments, { row, config, rowIndex, colIndex })"
@input="handleCellValueInput(arguments, row, config)"
@change="handleCellValueChange(row, config)"
@upload-change="handleCellUploadChange($event, row)">
@@ -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];
}
@@ -1076,7 +1081,7 @@ export default class SetupTable extends Vue {
: new Array(`${row[config.prop]}`.length).fill('*')
.join('');
}
- private handleCellFocus(arg: any[], cell: {
+ public handleCellFocus(arg: any[], cell: {
row: ISetupRow
config: ISetupHead
rowIndex: number
@@ -1101,7 +1106,16 @@ export default class SetupTable extends Vue {
}
}
}
- private handleCellBlur() {
+ public handleCellBlur(arg: any[], cell: {
+ row: ISetupRow
+ config: ISetupHead
+ rowIndex: number
+ colIndex: number
+ }) {
+ const { row, config } = cell;
+ if (config.handleBlur) {
+ config.handleBlur(row, config);
+ }
this.$set(this, 'focusRow', {});
this.popoverEl && this.popoverEl.tipsHide();
this.popoverEl = null;
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/types/index.ts b/frontend/src/types/index.ts
index e4f72b0f1..5b9768ae7 100644
--- a/frontend/src/types/index.ts
+++ b/frontend/src/types/index.ts
@@ -304,6 +304,7 @@ export interface ISetupHead {
getCurrentType?: Function
getDefaultValue?: Function
handleValueChange?: Function
+ handleBlur?: Function
}
// 文件导入配置
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/components/sideslider-content-edit.vue b/frontend/src/views/cloud/components/sideslider-content-edit.vue
index 20bb8566b..b681ccf0b 100644
--- a/frontend/src/views/cloud/components/sideslider-content-edit.vue
+++ b/frontend/src/views/cloud/components/sideslider-content-edit.vue
@@ -71,7 +71,7 @@
required
:desc="descDataPathTip"
:rules="rules.path">
-
+ pathInputBlur(value, 'data_path')" />