From 3d9517df6487cebaec8395173040d1d0b50627ff Mon Sep 17 00:00:00 2001 From: wmh <3303710797@qq.com> Date: Tue, 24 Dec 2024 15:31:07 +0800 Subject: [PATCH] =?UTF-8?q?Feature=20flag=20=E6=8E=A7=E5=88=B6=20(#1833)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webfe/package_vue/src/language/lang/en.js | 19 + webfe/package_vue/src/language/lang/zh.js | 17 + .../dev-center/app/create-module/index.vue | 7 - .../comps/deploy-detail.vue | 29 + .../processes/comps/process-operation.vue | 2104 +++++++++-------- .../create-app/default-app-type.vue | 141 +- .../package_vue/static/json/paas_static.ce.js | 4 +- .../package_vue/static/json/paas_static.ee.js | 4 +- 8 files changed, 1249 insertions(+), 1076 deletions(-) diff --git a/webfe/package_vue/src/language/lang/en.js b/webfe/package_vue/src/language/lang/en.js index 56ab31532f..0cdf110523 100644 --- a/webfe/package_vue/src/language/lang/en.js +++ b/webfe/package_vue/src/language/lang/en.js @@ -2918,4 +2918,23 @@ export default { '如果您的应用描述文件版本为 spec_version: 2,并且应用是云原生应用,请直接将描述文件转换为 specVersion: 3 后进行重新部署。': 'If your APP descriptor file version is spec_version: 2 and the application is cloud-native, please directly convert the descriptor file to specVersion: 3 and redeploy it.', '普通应用请勿使用本工具。请先将应用迁移到云原生应用,再更新描述文件版本。': 'Do not use this tool for traditional applications. Please first migrate the application to a cloud-native application and then update the descriptor file version.', 'specVersion: 3 是针对云原生应用设计的最新规范,可以定义进程服务、可观测性等所有云原生应用的功能。本工具可以帮助您将旧版描述文件转换为新版。': 'specVersion: 3 is the latest specification designed for cloud-native applications, capable of defining all cloud-native application features such as process services and observability. This tool can help you convert older descriptor files to the new version.', + '由应用描述文件 app_desc.yaml 定义': 'Defined by the application description file app_desc.yaml', + '当前值由应用描述文件定义,如果继续编辑,建议先删除应用描述文件的相关配置,否则重新部署时会覆盖填写的值。': 'The current value is defined by the application description file. If you continue to edit, please delete the relevant configurations in the file first, or your changes may be overwritten during redeployment.', + 来自应用描述文件: 'From the APP description file', + '应用描述文件中定义的环境变量无法在页面上修改,但可以在页面上添加同名变量以覆盖其值': 'The environment variables defined in the APP description file cannot be modified on the page, but you can add variables with the same name on the page to override their values.', + '环境变量已失效,因为页面上新增了同名的环境变量': 'The environment variable has become invalid because a variable with the same name was added on the page.', + 提交代码: 'Submit code', + 变更文件: 'Changed files', + 代码提交成功: 'Code submitted successfully', + 点击跳转到仓库查看: 'Click to view the repository', + 没有变更的文件: 'No changed files', + 文件名不符合规范: 'Filename does not conform to specifications', + '文件 {x} 名称不符合规范': 'The filename {x} does not conform to specifications', + '文件 {x} 等 {n} 个文件名称不符合规范': 'The filename {x} and {n} other files do not conform to specifications', + '修改的文件路径中不能包含中文,空格,以及除连接符(-),下划线(一),句号(.)外的特殊字符': 'The modified file path cannot contain Chinese characters, spaces, or special characters other than hyphens (-), underscores (_), and periods (.).', + 暂无访问控制台功能: 'Web console is currently not available', + '访问控制台可以让您进入应用进程的容器,查看线上运行的代码、进行在线调试以及执行一次性命令等操作。': 'The web console allows you to enter the container of the application process, view the code running online, perform online debugging, and execute one-time commands.', + '如需使用该功能,需要:': 'To use this feature, you need to:', + '1. 安装 BCS 套餐': '1. Install the BCS package.', + '2. 将应用集群来源修改为: BCS 集群': '2. Change the application cluster source to: BCS cluster.', }; diff --git a/webfe/package_vue/src/language/lang/zh.js b/webfe/package_vue/src/language/lang/zh.js index bf1f6a082c..079f4fd2f9 100644 --- a/webfe/package_vue/src/language/lang/zh.js +++ b/webfe/package_vue/src/language/lang/zh.js @@ -3055,4 +3055,21 @@ export default { '如果您的应用描述文件版本为 spec_version: 2,并且应用是云原生应用,请直接将描述文件转换为 specVersion: 3 后进行重新部署。': '如果您的应用描述文件版本为 spec_version: 2,并且应用是云原生应用,请直接将描述文件转换为 specVersion: 3 后进行重新部署。', '普通应用请勿使用本工具。请先将应用迁移到云原生应用,再更新描述文件版本。': '普通应用请勿使用本工具。请先将应用迁移到云原生应用,再更新描述文件版本。', 'specVersion: 3 是针对云原生应用设计的最新规范,可以定义进程服务、可观测性等所有云原生应用的功能。本工具可以帮助您将旧版描述文件转换为新版。': 'specVersion: 3 是针对云原生应用设计的最新规范,可以定义进程服务、可观测性等所有云原生应用的功能。本工具可以帮助您将旧版描述文件转换为新版。', + 来自应用描述文件: '来自应用描述文件', + '应用描述文件中定义的环境变量无法在页面上修改,但可以在页面上添加同名变量以覆盖其值': '应用描述文件中定义的环境变量无法在页面上修改,但可以在页面上添加同名变量以覆盖其值', + '环境变量已失效,因为页面上新增了同名的环境变量': '环境变量已失效,因为页面上新增了同名的环境变量', + 提交代码: '提交代码', + 变更文件: '变更文件', + 代码提交成功: '代码提交成功', + 点击跳转到仓库查看: '点击跳转到仓库查看', + 没有变更的文件: '没有变更的文件', + 文件名不符合规范: '文件名不符合规范', + '文件 {x} 名称不符合规范': '文件 {x} 名称不符合规范', + '文件 {x} 等 {n} 个文件名称不符合规范': '文件 {x} 等 {n} 个文件名称不符合规范', + '修改的文件路径中不能包含中文,空格,以及除连接符(-),下划线(一),句号(.)外的特殊字符': '修改的文件路径中不能包含中文,空格,以及除连接符(-),下划线(一),句号(.)外的特殊字符', + 暂无访问控制台功能: '暂无访问控制台功能', + '访问控制台可以让您进入应用进程的容器,查看线上运行的代码、进行在线调试以及执行一次性命令等操作。': '访问控制台可以让您进入应用进程的容器,查看线上运行的代码、进行在线调试以及执行一次性命令等操作。', + '如需使用该功能,需要:': '如需使用该功能,需要:', + '1. 安装 BCS 套餐': '1. 安装 BCS 套餐', + '2. 将应用集群来源修改为: BCS 集群': '2. 将应用集群来源修改为: BCS 集群', }; diff --git a/webfe/package_vue/src/views/dev-center/app/create-module/index.vue b/webfe/package_vue/src/views/dev-center/app/create-module/index.vue index 15b121bebb..08c170bb51 100644 --- a/webfe/package_vue/src/views/dev-center/app/create-module/index.vue +++ b/webfe/package_vue/src/views/dev-center/app/create-module/index.vue @@ -141,13 +141,6 @@ > {{ $t('蓝鲸开发框架') }} -
  • - {{ $t('蓝鲸运维开发平台') }} -
  • diff --git a/webfe/package_vue/src/views/dev-center/app/engine/cloud-deploy-manage/comps/deploy-detail.vue b/webfe/package_vue/src/views/dev-center/app/engine/cloud-deploy-manage/comps/deploy-detail.vue index 7039b4aac6..a6331c15d8 100644 --- a/webfe/package_vue/src/views/dev-center/app/engine/cloud-deploy-manage/comps/deploy-detail.vue +++ b/webfe/package_vue/src/views/dev-center/app/engine/cloud-deploy-manage/comps/deploy-detail.vue @@ -497,6 +497,19 @@ :params="logConfig.params" @refresh="refreshLogs" > + + + @@ -512,6 +525,7 @@ import { bus } from '@/common/bus'; import eventDetail from './event-detail.vue'; import dayjs from 'dayjs'; import processLog from '@/components/process-log-dialog/log.vue'; +import FunctionalDependency from '@blueking/functional-dependency/vue2/index.umd.min.js'; moment.locale('zh-cn'); // let maxReplicasNum = 0; @@ -526,6 +540,7 @@ export default { scaleDialog, eventDetail, processLog, + FunctionalDependency, }, mixins: [appBaseMixin, sidebarDiffMixin], props: { @@ -700,6 +715,7 @@ export default { logs: [], parmas: {}, }, + showFunctionalDependencyDialog: false, }; }, computed: { @@ -725,6 +741,9 @@ export default { const maxWidth = window.innerWidth * 0.8; return Math.min(defaultWidth, maxWidth); }, + platformFeature() { + return this.$store.state.platformFeature; + }, }, watch: { @@ -1471,6 +1490,11 @@ export default { * @param {Object} instance, processes */ async showInstanceConsole(instance, processes) { + // 暂无访问控制台功能 + if (!this.platformFeature.WEB_CONSOLE) { + this.showFunctionalDependencyDialog = true; + return; + } this.processRefuseDialog.isLoading = true; try { const params = { @@ -1643,6 +1667,11 @@ export default { }); } }, + + // 查看更多-访问控制台 + gotoMore() { + window.open(this.GLOBAL.DOC.WEB_CONSOLE, '_blank'); + }, }, }; diff --git a/webfe/package_vue/src/views/dev-center/app/engine/processes/comps/process-operation.vue b/webfe/package_vue/src/views/dev-center/app/engine/processes/comps/process-operation.vue index 857b1b4f47..9479e9a617 100644 --- a/webfe/package_vue/src/views/dev-center/app/engine/processes/comps/process-operation.vue +++ b/webfe/package_vue/src/views/dev-center/app/engine/processes/comps/process-operation.vue @@ -32,16 +32,28 @@
    + :class="[ + 'paasng-icon paasng-bold', + { + 'paasng-down-shape': process.name === curProcessKey, + 'paasng-right-shape': process !== curProcess || !curProcessKey, + }, + ]" + /> {{ process.name }} + > + {{ process.name }} + +
    +
    + {{ $t('自动扩缩容') }}
    -
    {{ $t('自动扩缩容') }}
    @@ -66,7 +78,7 @@ + /> {{ process.targetStatus === 'start' ? $t('启动中...') : $t('停止中...') }} @@ -111,15 +123,15 @@ slot="trigger" class="ps-icon-btn-circle operate-process-icon stop" href="javascript:;" - :class="{ 'disabled': isAppOfflined }" + :class="{ disabled: isAppOfflined }" >
    + style="margin-right: 0" + />
    @@ -129,15 +141,15 @@ v-bk-tooltips="isAppOfflined ? $t('模块已下架,不可操作') : process.operateIconTitle" class="ps-icon-btn-circle operate-process-icon on start" href="javascript:" - :class="{ 'disabled': isAppOfflined }" + :class="{ disabled: isAppOfflined }" @click="patchProcess(process, index)" > + style="margin-right: 0" + /> -
      +
      • + disabled: process.available_instance_count || process.desired_replicas, + }" + > + :disabled="!process.available_instance_count || !process.desired_replicas" + > {{ $t('扩缩容') }}
      • @@ -167,7 +184,8 @@ + @click="showRestartPopup('process', process)" + > {{ $t('重启进程') }} @@ -184,11 +202,11 @@
        - - - - - + + + + @@ -209,9 +227,11 @@ :class="instance.ready ? 'paasng-check-circle' : 'paasng-empty'" /> {{ instance.rich_status }} + > + {{ instance.rich_status }} + @@ -284,11 +310,11 @@ >
        - {{ $t('内存使用') }} {{ $t('(单位:MB)') }} + + {{ $t('内存使用') }} + {{ $t('(单位:MB)') }} +
        - +
        - +
        {{ processPlan.processType }}
        - +
        {{ processPlan.maxReplicas }}
        - -
        - {{ $t('内存:') }} {{ processPlan.memLimit }} / CPU: {{ processPlan.cpuLimit }} -
        + +
        {{ $t('内存:') }} {{ processPlan.memLimit }} / CPU: {{ processPlan.cpuLimit }}
        - +
        {{ processPlan.clusterLink }}
        -

        - {{ $t('注意:进程间访问链接地址只能用于同集群内的不同进程间通信,可在 “模块管理” 页面查看进程的集群信息。更多进程间通信的说明。请参考') }} + {{ + $t( + '注意:进程间访问链接地址只能用于同集群内的不同进程间通信,可在 “模块管理” 页面查看进程的集群信息。更多进程间通信的说明。请参考' + ) + }} + {{ $t('进程间通信') }} + > + {{ $t('进程间通信') }} +

        @@ -381,7 +418,7 @@ v-if="isLogShow" class="instance-box" > -

        {{ curProcessType.toUpperCase() }} {{ $t('进程实时日志') }}

        +

        {{ curProcessType.toUpperCase() }} {{ $t('进程实时日志') }}

        + /> + />
        @@ -453,16 +490,28 @@ >
        - - + + {{ $t('手动调节') }} + v-bk-tooltips="{ + content: $t('该环境暂不支持自动扩缩容'), + disabled: autoScalDisableConfig.ENABLE_AUTOSCALING, + }" + > {{ $t('自动调节') }} @@ -475,23 +524,40 @@ {{ curTargetReplicas }} - +
        - {{ $t('CPU 使用率') }} = - + + {{ $t('CPU 使用率') }} = + +
        - +

        - {{$t('当 CPU 使用率')}} > 85% {{$t('时,会触发扩容')}} + {{ $t('当 CPU 使用率') }} > + 85% + {{ $t('时,会触发扩容') }}

        -

        {{$t('当 CPU 使用率')}} < - {{shrinkLimit}} {{$t('时,会触发缩容')}} +

        + {{ $t('当 CPU 使用率') }} < + {{ shrinkLimit }} + {{ $t('时,会触发缩容') }}

        @@ -514,14 +580,22 @@ />
        -
        +
        - + - + @@ -570,7 +648,9 @@ {{ $t('文档:') }} {{ processRefuseDialog.title }} + > + {{ $t('文档:') }} {{ processRefuseDialog.title }} +
        @@ -584,8 +664,21 @@ :loading="logConfig.isLoading" :time-selection="chartRangeList" :params="logConfig.params" - @refresh="refreshLogs"> - + @refresh="refreshLogs" + > + + +
        @@ -602,20 +695,12 @@ import i18n from '@/language/i18n.js'; import sidebarDiffMixin from '@/mixins/sidebar-diff-mixin'; import eventDetail from '@/views/dev-center/app/engine/cloud-deploy-manage/comps/event-detail.vue'; import processLog from '@/components/process-log-dialog/log.vue'; +import FunctionalDependency from '@blueking/functional-dependency/vue2/index.umd.min.js'; let maxReplicasNum = 0; const initEndDate = moment().format('YYYY-MM-DD HH:mm:ss'); -const initStartDate = moment().subtract(1, 'hours') - .format('YYYY-MM-DD HH:mm:ss'); -// const dateTextMap = { -// '5m': '最近5分钟', -// '1h': '最近1小时', -// '3h': '最近3小时', -// '12h': '最近12小时', -// '1d': '最近1天', -// '7d': '最近7天' -// } +const initStartDate = moment().subtract(1, 'hours').format('YYYY-MM-DD HH:mm:ss'); let timeRangeCache = ''; let timeShortCutText = ''; export default { @@ -624,6 +709,7 @@ export default { chart: ECharts, eventDetail, processLog, + FunctionalDependency, }, mixins: [appBaseMixin, sidebarDiffMixin], props: { @@ -853,7 +939,9 @@ export default { theme: 'light', allowHtml: true, content: this.$t('提示信息'), - html: `${this.$t('查看动态扩缩容计算规则')}`, + html: `${this.$t('查看动态扩缩容计算规则')}`, placements: ['right'], }, autoScalDisableConfig: {}, @@ -874,6 +962,7 @@ export default { title: '', logs: [], }, + showFunctionalDependencyDialog: false, }; }, computed: { @@ -890,7 +979,7 @@ export default { return this.$store.state.envEventData; }, shrinkLimit() { - return `${((this.curTargetReplicas - 1) / this.curTargetReplicas * 85).toFixed(1)}%`; + return `${(((this.curTargetReplicas - 1) / this.curTargetReplicas) * 85).toFixed(1)}%`; }, isCloudNative() { return this.curAppInfo.application?.type === 'cloud_native'; @@ -903,9 +992,9 @@ export default { }, }, watch: { - '$route'() { + $route() { this.init(); - this.getAutoScalFlag(); // 切换路由也需要获取featureflag + this.getAutoScalFlag(); // 切换路由也需要获取featureflag }, 'processConfigDialog.visiable'(val) { if (val) { @@ -1019,17 +1108,20 @@ export default { init() { const url = `${BACKEND_URL}/api/bkapps/applications/${this.appCode}/modules/${this.curModuleId}/envs/${this.environment}/released_state/`; - this.$http.get(url).then((res) => { - if (res.offline) { - this.isAppOfflined = true; - } else { - this.isAppOfflined = false; + this.$http.get(url).then( + (res) => { + if (res.offline) { + this.isAppOfflined = true; + } else { + this.isAppOfflined = false; + } + this.getProcessList(); + }, + (res) => { + this.allProcesses = []; + this.$emit('data-ready', this.environment); } - this.getProcessList(); - }, (res) => { - this.allProcesses = []; - this.$emit('data-ready', this.environment); - }); + ); }, handlerChange(dates) { @@ -1104,9 +1196,9 @@ export default { }, /** - * 展示实例日志侧栏 - * @param {Object} instance 实例对象 - */ + * 展示实例日志侧栏 + * @param {Object} instance 实例对象 + */ showInstanceLog(instance, process) { this.curInstance = instance; this.logConfig.visiable = true; @@ -1195,11 +1287,21 @@ export default { this.curProcess = data; }, + // 查看访问控制台文档 + gotoMore() { + window.open(this.GLOBAL.DOC.WEB_CONSOLE, '_blank'); + }, + /** - * 显示进程webConsole - * @param {Object} instance, processes - */ + * 显示进程webConsole + * @param {Object} instance, processes + */ async showInstanceConsole(instance, processes) { + // 暂无访问控制台功能 + if (!this.platformFeature.WEB_CONSOLE) { + this.showFunctionalDependencyDialog = true; + return; + } this.processRefuseDialog.isLoading = true; try { const params = { @@ -1230,11 +1332,11 @@ export default { }, /** - * 图表初始化 - * @param {Object} instanceData 数据 - * @param {String} type 类型 - * @param {Object} ref 图表对象 - */ + * 图表初始化 + * @param {Object} instanceData 数据 + * @param {String} type 类型 + * @param {Object} ref 图表对象 + */ renderChartNew(instanceData, type, ref) { const series = []; let xAxisData = []; @@ -1342,7 +1444,7 @@ export default { } }); }); - limitDatas && (datas.unshift(limitDatas)); + limitDatas && datas.unshift(limitDatas); return datas; }; try { @@ -1366,9 +1468,9 @@ export default { }, /** - * 从接口获取Metric 数据 - * @param {Object} conf 配置参数 - */ + * 从接口获取Metric 数据 + * @param {Object} conf 配置参数 + */ async getInstanceMetric(conf) { this.isChartLoading = true; try { @@ -1398,11 +1500,11 @@ export default { }, /** - * 图表初始化 - * @param {Object} instanceData 数据 - * @param {String} type 类型 - * @param {Object} ref 图表对象 - */ + * 图表初始化 + * @param {Object} instanceData 数据 + * @param {String} type 类型 + * @param {Object} ref 图表对象 + */ renderChart(instanceData, type, ref) { const series = []; let xAxisData = []; @@ -1466,68 +1568,73 @@ export default { }, /** - * 图标侧栏隐藏回调处理 - */ + * 图标侧栏隐藏回调处理 + */ handlerChartHide() { - this.dateParams = Object.assign({}, { - start_time: initStartDate, - end_time: initEndDate, - }); + this.dateParams = Object.assign( + {}, + { + start_time: initStartDate, + end_time: initEndDate, + } + ); this.initDateTimeRange = [initStartDate, initEndDate]; this.isDatePickerOpen = false; this.clearChart(); }, /** - * 清空图表数据 - */ + * 清空图表数据 + */ clearChart() { const cpuRef = this.$refs.cpuLine; const memRef = this.$refs.memoryLine; - cpuRef && cpuRef.mergeOptions({ - xAxis: [ - { - data: [], - }, - ], - series: [ - { - name: '', - type: 'line', - smooth: true, - symbol: 'none', - areaStyle: { - normal: { - opacity: 0, + cpuRef && + cpuRef.mergeOptions({ + xAxis: [ + { + data: [], + }, + ], + series: [ + { + name: '', + type: 'line', + smooth: true, + symbol: 'none', + areaStyle: { + normal: { + opacity: 0, + }, }, + data: [0], }, - data: [0], - }, - ], - }); + ], + }); - memRef && memRef.mergeOptions({ - xAxis: [ - { - data: [], - }, - ], - series: [ - { - name: '', - type: 'line', - smooth: true, - symbol: 'none', - areaStyle: { - normal: { - opacity: 0, + memRef && + memRef.mergeOptions({ + xAxis: [ + { + data: [], + }, + ], + series: [ + { + name: '', + type: 'line', + smooth: true, + symbol: 'none', + areaStyle: { + normal: { + opacity: 0, + }, }, + data: [0], }, - data: [0], - }, - ], - }); + ], + }); }, // 对数据进行处理 @@ -1545,8 +1652,8 @@ export default { processesData.processes.items.forEach((processItem) => { const { type, name: processName } = processItem; - const extraInfo = extraInfos.find(item => item.type === type); - const packageInfo = packages.find(item => item.name === type); + const extraInfo = extraInfos.find((item) => item.type === type); + const packageInfo = packages.find((item) => item.name === type); const processInfo = { ...processItem, @@ -1599,8 +1706,7 @@ export default { // 日期转换 process.instances.forEach((item) => { - item.date_time = moment(item.start_time).startOf('minute') - .fromNow(); + item.date_time = moment(item.start_time).startOf('minute').fromNow(); }); // 如果有当前展开项 @@ -1714,7 +1820,7 @@ export default { } }); } else if (data.type === 'DELETED') { - this.allProcesses = this.allProcesses.filter(process => process.name !== processData.type); + this.allProcesses = this.allProcesses.filter((process) => process.name !== processData.type); } }, @@ -1723,8 +1829,7 @@ export default { const instanceData = data.object || {}; this.prevInstanceVersion = data.resource_version || 0; - instanceData.date_time = moment(instanceData.start_time).startOf('minute') - .fromNow(); + instanceData.date_time = moment(instanceData.start_time).startOf('minute').fromNow(); this.allProcesses.forEach((process) => { if (process.name === instanceData.process_type) { // 新增 @@ -1839,44 +1944,48 @@ export default { }, /** - * 显示实例指标数据 - */ + * 显示实例指标数据 + */ getInstanceChart(processes) { this.$nextTick(() => { const cpuRef = this.$refs.cpuLine; const memRef = this.$refs.memoryLine; - cpuRef && cpuRef.mergeOptions({ - xAxis: [ - { - data: [], - }, - ], - series: [], - }); + cpuRef && + cpuRef.mergeOptions({ + xAxis: [ + { + data: [], + }, + ], + series: [], + }); - memRef && memRef.mergeOptions({ - xAxis: [ - { - data: [], - }, - ], - series: [], - }); + memRef && + memRef.mergeOptions({ + xAxis: [ + { + data: [], + }, + ], + series: [], + }); - cpuRef && cpuRef.showLoading({ - text: this.$t('正在加载'), - color: '#30d878', - textColor: '#fff', - maskColor: 'rgba(255, 255, 255, 0.8)', - }); + cpuRef && + cpuRef.showLoading({ + text: this.$t('正在加载'), + color: '#30d878', + textColor: '#fff', + maskColor: 'rgba(255, 255, 255, 0.8)', + }); - memRef && memRef.showLoading({ - text: this.$t('正在加载'), - color: '#30d878', - textColor: '#fff', - maskColor: 'rgba(255, 255, 255, 0.8)', - }); + memRef && + memRef.showLoading({ + text: this.$t('正在加载'), + color: '#30d878', + textColor: '#fff', + maskColor: 'rgba(255, 255, 255, 0.8)', + }); // this.getInstanceMetric({ // cpuRef: cpuRef, @@ -1911,7 +2020,8 @@ export default { this.processConfigDialog.visiable = false; this.$store.commit('updataEnvEventData', []); this.updateProcessConfig(); - } if (this.autoscaling && autoValidate) { + } + if (this.autoscaling && autoValidate) { this.processConfigDialog.isLoading = false; this.processConfigDialog.visiable = false; this.$store.commit('updataEnvEventData', []); @@ -1937,9 +2047,12 @@ export default { // 进程实例设置 async updateProcessConfig() { // 不允许小于1或者大于最大值,如果没有改变也不允许操作 - if (!this.autoscaling && (this.processPlan.targetReplicas < 1 - || this.processPlan.targetReplicas > this.processPlan.maxReplicas - || this.processPlan.targetReplicas === this.processPlan.replicas)) { + if ( + !this.autoscaling && + (this.processPlan.targetReplicas < 1 || + this.processPlan.targetReplicas > this.processPlan.maxReplicas || + this.processPlan.targetReplicas === this.processPlan.replicas) + ) { return; } @@ -1980,14 +2093,16 @@ export default { // 进程启动和停止操作 patchProcess(process, index) { - // this.$store.commit('updataEnvEventData', []); // 停止操作 if (process.targetStatus === 'start') { process.isStopTrigger = true; - this.currentClickObj = Object.assign({}, { - operateIconTitle: process.operateIconTitle, - index, - }); + this.currentClickObj = Object.assign( + {}, + { + operateIconTitle: process.operateIconTitle, + index, + } + ); } else { // 启动操作 this.updateProcess(process, index); @@ -2005,7 +2120,6 @@ export default { } process.isActionLoading = true; - // 判断是否已经下架 if (this.isAppOfflined) { return false; @@ -2016,10 +2130,13 @@ export default { process.operateIconTitle = process.operateIconTitleCopy; } - this.currentClickObj = Object.assign({}, { - operateIconTitle: process.operateIconTitle, - index, - }); + this.currentClickObj = Object.assign( + {}, + { + operateIconTitle: process.operateIconTitle, + index, + } + ); const processType = process.name; const { targetStatus } = process; @@ -2097,41 +2214,43 @@ export default { process_type: this.curProcessType, }; } - this.$http.get(`${BACKEND_URL}/api/bkapps/applications/${this.appCode}/modules/${this.curModuleId}/envs/${this.environment}/realtimelogs/`, { params: curParams }).then((res) => { - const logInfo = res; - // 实时日志数等于上一次请求则无新日志产生 不追加 - // if(logInfo.count == countNum) return; - // countNum = logInfo.count; - // 不能用数量, 也不能用lastItemId判定(es查询出来排序可能两次之间会变, 但是lastItemId不变-时间精度只到s) - if (logInfo.count > 0) { - logInfo.results.forEach((item) => { - // 追加ID不重复日志 - if (!(item.id in this.logIds)) { - this.logIds[item.id] = undefined; - const htmlItem = this.keyLight(item); - this.logDetail.push(htmlItem); - } - }); - setTimeout(() => { - const currentHeight = $('.textarea .inner').height() + 100; - $('.textarea').scrollTop(currentHeight); - }, 0); - } - }); + this.$http + .get( + `${BACKEND_URL}/api/bkapps/applications/${this.appCode}/modules/${this.curModuleId}/envs/${this.environment}/realtimelogs/`, + { params: curParams } + ) + .then((res) => { + const logInfo = res; + // 实时日志数等于上一次请求则无新日志产生 不追加 + // if(logInfo.count == countNum) return; + // countNum = logInfo.count; + // 不能用数量, 也不能用lastItemId判定(es查询出来排序可能两次之间会变, 但是lastItemId不变-时间精度只到s) + if (logInfo.count > 0) { + logInfo.results.forEach((item) => { + // 追加ID不重复日志 + if (!(item.id in this.logIds)) { + this.logIds[item.id] = undefined; + const htmlItem = this.keyLight(item); + this.logDetail.push(htmlItem); + } + }); + setTimeout(() => { + const currentHeight = $('.textarea .inner').height() + 100; + $('.textarea').scrollTop(currentHeight); + }, 0); + } + }); }, 1000); }, // 实时日志列表 时间 | 进程名 高亮 keyLight(item) { - const text = `[${item.ts}]` + ` ${item.process_name}: ${item.message}`; + const text = + `[${item.ts}]` + + ` ${item.process_name}: ${item.message}`; return text; }, - timeFormat(time, instanceTime) { - if (time === '几秒前') return time; - return `${time} ${instanceTime}`; - }, - // 获取进程状态 tooltips 展示内容 getInstanceStateToolTips(instance) { if (!(instance.state_message && instance.state_message.length)) { @@ -2258,806 +2377,807 @@ export default { diff --git a/webfe/package_vue/src/views/dev-center/create-app/default-app-type.vue b/webfe/package_vue/src/views/dev-center/create-app/default-app-type.vue index 60653afcee..425d8d0aa5 100644 --- a/webfe/package_vue/src/views/dev-center/create-app/default-app-type.vue +++ b/webfe/package_vue/src/views/dev-center/create-app/default-app-type.vue @@ -1,4 +1,4 @@ -
        {{ $t('实例名称') }} {{ $t('状态') }} {{ $t('重启次数') }} {{ $t('创建时间') }} + {{ $t('实例名称') }}{{ $t('状态') }}{{ $t('重启次数') }}{{ $t('创建时间') }} {{ $t('操作') }}
        {{ instance.restart_count }} @@ -220,31 +240,37 @@ - + {{ $t('查看日志') }} + > + {{ $t('查看日志') }} + {{ $t('访问控制台') }} + > + {{ $t('访问控制台') }} + {{ $t('查看事件') }} + > + {{ $t('查看事件') }} + {{ $t('重启实例') }} + > + {{ $t('重启实例') }} +