From 20aa6d75cb7bf4d69d4166d706df18e2c2ea3cdb Mon Sep 17 00:00:00 2001 From: hyunfa <1598047833@qq.com> Date: Wed, 6 Nov 2024 16:38:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20proxy=E6=89=B9=E9=87=8F=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=89=88=E6=9C=AC=20#=20Reviewed,=20transaction=20id:?= =?UTF-8?q?=2023025?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/setup-table/install-table.vue | 3 ++- frontend/src/components/setup-table/table-header.vue | 11 ++++++++++- frontend/src/i18n/en.js | 4 ++++ frontend/src/i18n/zh.js | 3 +++ frontend/src/types/index.ts | 1 + frontend/src/views/agent/agent-setup/agent-import.vue | 10 ++++++++-- frontend/src/views/agent/package/package-cols.vue | 2 +- frontend/src/views/cloud/config/netTableConfig.ts | 10 +++++++--- 8 files changed, 36 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/setup-table/install-table.vue b/frontend/src/components/setup-table/install-table.vue index 7a5914a5a2..3af74749bb 100644 --- a/frontend/src/components/setup-table/install-table.vue +++ b/frontend/src/components/setup-table/install-table.vue @@ -53,7 +53,8 @@ appendSlot: config.appendSlot, parentProp: config.parentProp, parentTip: config.parentTip, - focusRow: focusRow + focusRow: focusRow, + extraInfo: config.extraInfo || {} }" @chooseVersion="handleChooseVersion" @confirm="handleBatchConfirm(arguments, config)"> diff --git a/frontend/src/components/setup-table/table-header.vue b/frontend/src/components/setup-table/table-header.vue index 465a264129..ddc289c5e2 100644 --- a/frontend/src/components/setup-table/table-header.vue +++ b/frontend/src/components/setup-table/table-header.vue @@ -30,11 +30,13 @@ + @confirm="versionConfirm" + @cancel="handleBatchCancel"/> ({}) }) private readonly focusRow!: ISetupRow; @Prop({ type: String, default: 'light setup-tips' }) private readonly tipTheme!: string; + @Prop({ type: Object, default: () => ({}) }) private readonly extraInfo!: any; @Ref('batch') private readonly batchRef!: any; @Ref('tipSpan') private readonly tipSpan!: any; @@ -163,6 +166,7 @@ export default class TableHeader extends Vue { private tipsTrigger: 'mouseenter' | 'manual' = 'mouseenter'; private chooseVersion = ''; private versionsDialog = { + project: 'gse_agent', show: false, type: 'unified', operate: 'reinstall_batch', @@ -218,6 +222,11 @@ export default class TableHeader extends Vue { if (this.isActive) { this.versionsDialog.show = false; } else { + if (this.extraInfo.pkgType === 'gse_proxy') { + this.versionsDialog.project = 'gse_proxy'; + this.versionsDialog.title = this.$t('选择Proxy版本'); + this.versionsDialog.operate = 'Install Proxy'; + } this.versionsDialog.show = true; this.versionsDialog.versions = this.chooseVersion ? [this.chooseVersion] : []; this.isActive = true; diff --git a/frontend/src/i18n/en.js b/frontend/src/i18n/en.js index 9265c440ab..e00f654322 100644 --- a/frontend/src/i18n/en.js +++ b/frontend/src/i18n/en.js @@ -154,6 +154,10 @@ export default { 内网网卡IP: 'LAN IP', 外网网卡IP: 'WAN IP', 登录IP: 'Login IP', + Agent包版本: 'Agent package version', + Proxy包版本: 'Proxy package version', + 选择Proxy版本: 'Select Proxy version', + '选择 Agent 版本': 'Select Agent version', 数据IP: 'Data IP', 数据IP提示: 'IP address for Agent data collection, which is bound to the LAN IP by default, it can be developed separately if any special needs ', 确定: 'OK', diff --git a/frontend/src/i18n/zh.js b/frontend/src/i18n/zh.js index c9a9523b2c..8cb9d36752 100644 --- a/frontend/src/i18n/zh.js +++ b/frontend/src/i18n/zh.js @@ -155,6 +155,9 @@ export default { 外网网卡IP: '外网网卡IP', 登录IP: '登录IP', Agent包版本: 'Agent 包版本', + Proxy包版本: 'Proxy 包版本', + '选择 Agent 版本': '选择 Agent 版本', + 选择Proxy版本: '选择Proxy版本', 数据IP: '数据IP', 数据IP提示: 'Agent采集数据的IP地址, 默认绑定到内网网卡所在的IP, 如有特殊需求可单独制定', 确定: '确定', diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts index d2c1a1b4f1..cf44c253a4 100644 --- a/frontend/src/types/index.ts +++ b/frontend/src/types/index.ts @@ -316,6 +316,7 @@ export interface ISetupHead { getDefaultValue?: Function handleValueChange?: Function handleBlur?: Function + extraInfo?: any } // 文件导入配置 diff --git a/frontend/src/views/agent/agent-setup/agent-import.vue b/frontend/src/views/agent/agent-setup/agent-import.vue index 093a8a3729..2a70314a78 100644 --- a/frontend/src/views/agent/agent-setup/agent-import.vue +++ b/frontend/src/views/agent/agent-setup/agent-import.vue @@ -187,6 +187,8 @@ export default class AgentImport extends Mixins(mixin) { private loading = false; // 默认版本 private defaultVersion = ''; + // 版本列表 + private agentVersionList = [] as string[]; // 编辑head private editTableHead: { editConfig: ISetupHead[], editManualConfig: ISetupHead[] } = { editConfig: [], @@ -423,7 +425,10 @@ export default class AgentImport extends Mixins(mixin) { if (!this.isApV2(item.ap_id)) { item.version = 'stable'; } else { - item.version === '' && (item.version = this.defaultVersion); + // 无agent版本信息或者agent版本是被禁用的,则设置为默认版本(稳定版本) + if (!item.version || !this.agentVersionList.includes(item.version)) { + item.version = this.defaultVersion; + } } return item; }); @@ -444,12 +449,13 @@ export default class AgentImport extends Mixins(mixin) { * @returns {Promise} - 包含默认版本的数据 */ private async getDefaultVersion() { - const { default_version } = await AgentStore.apiGetPkgVersion({ + const { default_version, pkg_info } = await AgentStore.apiGetPkgVersion({ project: 'gse_agent', os: '', cpu_arch: '' }); this.defaultVersion = default_version; + this.agentVersionList = pkg_info.map(item => item.version); }; // agent包管理开关是否打开 private get AgentPkgShow(): Boolean { diff --git a/frontend/src/views/agent/package/package-cols.vue b/frontend/src/views/agent/package/package-cols.vue index 3f2c64f7f5..1e80218a0f 100644 --- a/frontend/src/views/agent/package/package-cols.vue +++ b/frontend/src/views/agent/package/package-cols.vue @@ -192,7 +192,7 @@ export default class PackageCols extends Mixins(HeaderRenderMixin) { } private getDisable(row: IPkgRow) { - return row.formatTags.some((item: any) => item.name === '稳定版本') + return row.formatTags.some((item: any) => item.name === '稳定版本' || item.name === 'stable version') } filter = reactive<{ [key: string]: ITabelFliter }>({ pkg_name: { diff --git a/frontend/src/views/cloud/config/netTableConfig.ts b/frontend/src/views/cloud/config/netTableConfig.ts index bd99a82ba5..d296bbb257 100644 --- a/frontend/src/views/cloud/config/netTableConfig.ts +++ b/frontend/src/views/cloud/config/netTableConfig.ts @@ -2,6 +2,7 @@ import { authentication, DHCP_FILTER_KEYS, getDefaultConfig } from '@/config/con import { ISetupHead, ISetupRow } from '@/types'; import { osDirReplace, reguFnMinInteger, reguFnSysPath, reguIp, reguIPMixins, reguIPv6 } from '@/common/form-check'; import { splitCodeArr } from '@/common/regexp'; +import { MainStore } from '@/store'; export const parentHead = [ { label: '主机IPTip', prop: 'host_ip', type: 'text', colspan: 0, required: true, tips: 'proxySetupHostIp' }, @@ -215,17 +216,20 @@ const config: ISetupHead[] = [ parentProp: 'trans_info', }, { - label: 'Agent包版本', + label: 'Proxy包版本', prop: 'version', type: 'choose', required: true, noRequiredMark: false, placeholder: window.i18n.t('请选择'), - batch: false, + batch: true, default: '', - width: 100, + width: MainStore.language === 'en' ? 170 : 120, manualProp: true, parentProp: 'install_info', + extraInfo: { + pkgType: 'gse_proxy', + } }, { label: '',