Skip to content

Commit

Permalink
feat: 2.0 Proxy 支持配置临时文件传输路径 (closed TencentBlueKing#1757)
Browse files Browse the repository at this point in the history
  • Loading branch information
GONGONGONG committed Aug 29, 2023
1 parent f28e949 commit 4c7526b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
11 changes: 8 additions & 3 deletions frontend/src/components/setup-table/install-table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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];
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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: '',
Expand All @@ -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 });
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/views/cloud/config/netTableConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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节点探测',
Expand Down

0 comments on commit 4c7526b

Please sign in to comment.