@@ -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 @@
/>
-
@@ -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 @@
-
+
@@ -8,67 +8,58 @@
id="choose-cluster"
class="form-group-dir"
>
-
+
diff --git a/webfe/package_vue/static/json/paas_static.ce.js b/webfe/package_vue/static/json/paas_static.ce.js
index 6781a715d8..ab4bddbbfc 100644
--- a/webfe/package_vue/static/json/paas_static.ce.js
+++ b/webfe/package_vue/static/json/paas_static.ce.js
@@ -298,7 +298,9 @@ export const PLATFORM_CONFIG = {
// 监控仪表盘指引
MONITORING_METRICS_GUIDE: DOCS_URL_PREFIX + '/topics/paas/monitoring/metrics',
// 应用描述文件介绍
- APP_DESC_CNATIVE: DOCS_URL_PREFIX + '/topics/paas/app_desc_cnative'
+ APP_DESC_CNATIVE: DOCS_URL_PREFIX + '/topics/paas/app_desc_cnative',
+ // 访问控制台
+ WEB_CONSOLE: DOCS_URL_PREFIX + '/topics/paas/webconsole'
},
CONFIG: {
diff --git a/webfe/package_vue/static/json/paas_static.ee.js b/webfe/package_vue/static/json/paas_static.ee.js
index 6e98d09a32..c1af5274a5 100644
--- a/webfe/package_vue/static/json/paas_static.ee.js
+++ b/webfe/package_vue/static/json/paas_static.ee.js
@@ -298,7 +298,9 @@ export const PLATFORM_CONFIG = {
// 监控仪表盘指引
MONITORING_METRICS_GUIDE: DOCS_URL_PREFIX + '/topics/paas/monitoring/metrics',
// 应用描述文件介绍
- APP_DESC_CNATIVE: DOCS_URL_PREFIX + '/topics/paas/app_desc_cnative'
+ APP_DESC_CNATIVE: DOCS_URL_PREFIX + '/topics/paas/app_desc_cnative',
+ // 访问控制台
+ WEB_CONSOLE: DOCS_URL_PREFIX + '/topics/paas/webconsole'
},
CONFIG: {