Skip to content

Commit

Permalink
Merge pull request #3131 from hLinx/hotfix_3.9.x
Browse files Browse the repository at this point in the history
Hotfix 3.9.x
  • Loading branch information
hLinx authored Jul 18, 2024
2 parents 57e70f0 + 95c4b77 commit a4bc6db
Show file tree
Hide file tree
Showing 190 changed files with 5,158 additions and 3,395 deletions.
1,361 changes: 0 additions & 1,361 deletions src/frontend/i18n/en.json

This file was deleted.

1,361 changes: 0 additions & 1,361 deletions src/frontend/i18n/zh-cn.json

This file was deleted.

82 changes: 82 additions & 0 deletions src/frontend/language.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// const fs = require('fs');
// const path = require('path');
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

const recur = async (target) => {
const state = fs.statSync(target);
if (state.isFile()) {
if (/local.js$/.test(target)) {
console.log(`JAVASCRIPT: ${target}`);
const distDir = path.join(path.dirname(target), 'language');
const stats = fs.statSync(distDir);
if (!stats.isDirectory()) {
await fs.mkdirSync(distDir);
}


const data = await import(target);

const { message, namespace } = data.default;
const znData = {};
const enData = {};
console.log('data = ', data);
Object.keys(message).forEach((key) => {
if (typeof message[key] === 'string') {
znData[key] = key;
enData[key] = message[key];
} else if (typeof message[key] === 'object') {
Object.keys(message[key]).forEach((key2) => {
znData[`${key}_${key2}`] = key;
enData[`${key}_${key2}`] = message[key][key2];
});
}
});
fs.writeFileSync(
path.join(distDir, 'index.js'),
`
import zhCN from './zh.json';
import enUS from './en.json';
export default {
${namespace}: {
'zh-CN': zhCN,
'en-US': enUS,
}
}
`,
);
fs.writeFileSync(path.join(distDir, 'zh.json'), JSON.stringify(znData, null, 2));
fs.writeFileSync(path.join(distDir, 'en.json'), JSON.stringify(enData, null, 2));
console.log('lang = ', znData, enData, '\n');
}
} else if (state.isDirectory()) {
const dirList = fs.readdirSync(target);
dirList.forEach((item) => {
recur(path.join(target, item));
});
}
};

recur(path.join(path.dirname(fileURLToPath(import.meta.url)), './src/views'));

const { default: message } = await import(path.join(path.dirname(fileURLToPath(import.meta.url)), './src/i18n/local.js'));


const znData = {};
const enData = {};
Object.keys(message).forEach((key) => {
if (typeof message[key] === 'string') {
znData[key] = key;
enData[key] = message[key];
} else if (typeof message[key] === 'object') {
Object.keys(message[key]).forEach((key2) => {
znData[`${key}_${key2}`] = key;
enData[`${key}_${key2}`] = message[key][key2];
});
}
});

fs.writeFileSync(path.join(path.join(path.dirname(fileURLToPath(import.meta.url)), 'src/i18n/language'), 'zh.json'), JSON.stringify(znData, null, 2));
fs.writeFileSync(path.join(path.join(path.dirname(fileURLToPath(import.meta.url)), 'src/i18n/language'), 'en.json'), JSON.stringify(enData, null, 2));
4 changes: 2 additions & 2 deletions src/frontend/src/common/fully-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ const IpSelector = createIpSelector({
functionDesc: i18n.t('功能开启后,即可以基于配置平台的业务容器拓扑,对容器管理平台纳管的容器实例进行脚本指令执行和文件分发'),
guideTitle: i18n.t('如需使用该功能,须具备以下条件:'),
guideDescList: [
i18n.t('1. 部署容器管理平台(BCS)并开启容器拓扑同步至配置平台(CC)'),
i18n.t('2. 联系作业平台管理员打开容器执行功能'),
i18n.t('1_部署容器管理平台(BCS)并开启容器拓扑同步至配置平台(CC)'),
i18n.t('2_联系作业平台管理员打开容器执行功能'),
],
},
},
Expand Down
101 changes: 52 additions & 49 deletions src/frontend/src/components/ace-editor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,38 @@
</div>
<div
v-if="tips"
v-bk-overflow-tips="{ content: tips }"
class="jb-ace-tips">
<icon
style="margin-right: 4px;"
type="info" />
{{ tips }}
</div>
<div
class="jb-ace-action"
:style="{ height: `${tabHeight}px` }">
<slot name="action" />
<template v-if="!readonly && !isFullScreen">
<icon
v-bk-tooltips="$t('上传脚本')"
type="upload"
@click="handleUploadScript" />
<icon
v-bk-tooltips="$t('历史缓存')"
type="history"
@click.stop="handleShowHistory" />
</template>
<icon
v-if="!isFullScreen"
v-bk-tooltips="$t('全屏')"
type="full-screen"
@click="handleFullScreen" />
<icon
v-if="isFullScreen"
v-bk-tooltips="$t('还原')"
type="un-full-screen"
@click="handleExitFullScreen" />
</div>
</div>
<div class="jb-ace-main">
<div class="ace-edit-content">
Expand All @@ -70,31 +96,6 @@
<slot name="side" />
</div>
</div>
<div
class="jb-ace-action"
:style="{ height: `${tabHeight}px` }">
<slot name="action" />
<template v-if="!readonly && !isFullScreen">
<icon
v-bk-tooltips="$t('上传脚本')"
type="upload"
@click="handleUploadScript" />
<icon
v-bk-tooltips="$t('历史缓存')"
type="history"
@click.stop="handleShowHistory" />
</template>
<icon
v-if="!isFullScreen"
v-bk-tooltips="$t('全屏')"
type="full-screen"
@click="handleFullScreen" />
<icon
v-if="isFullScreen"
v-bk-tooltips="$t('还原')"
type="un-full-screen"
@click="handleExitFullScreen" />
</div>
<div
v-if="isShowHistoryPanel"
ref="historyPanel"
Expand Down Expand Up @@ -582,9 +583,9 @@
},
/**
* @desc 缓存脚本内容
* @param {String} type 缓存类型(自动缓存、手动换粗
* @param {String} type 缓存类型(自动缓存、手动缓存
*/
pushLocalStorage(type = I18n.t('自动保存')) {
pushLocalStorage(type = I18n.t('自动保存'), isAuto = true) {
// 当前脚本内容为空不缓存
if (!this.content) {
return;
Expand All @@ -597,7 +598,7 @@
}
if (historyList.length > 0) {
// 最新缓存内容和上一次缓存内容相同不缓存
if (historyList[0].content === this.value) {
if (historyList[0].content === this.value && isAuto) {
return;
}
}
Expand Down Expand Up @@ -707,7 +708,7 @@
* @desc 手动缓存脚本内容
*/
handleSaveHistory: _.debounce(function () {
this.pushLocalStorage(I18n.t('手动保存'));
this.pushLocalStorage(I18n.t('手动保存'), false);
this.messageSuccess(I18n.t('已成功保存到历史缓存!'));
this.handleShowHistory();
}, 300),
Expand Down Expand Up @@ -799,7 +800,7 @@
display: flex;
flex-direction: column;
width: 100%;
/* stylelint-disable selector-class-pattern */
/* stylelint-disable-next-line selector-class-pattern */
.ace_editor {
padding-right: 14px;
overflow: unset;
Expand Down Expand Up @@ -906,35 +907,22 @@
}

.jb-ace-tips{
display: flex;
align-items: center;
height: 40px;
padding-left: 18px;
overflow: hidden;
font-size: 12px;
line-height: 40px;
color: #979BA5;
}

.jb-ace-main {
display: flex;
background: #272822;

.ace-edit-content {
flex: 1;
overflow: hidden;
}

.bk-loading {
background: "rgba(0, 0, 0, 80%)" !important;
}
text-overflow: ellipsis;
white-space: nowrap;
}

.jb-ace-action {
position: absolute;
top: 0;
right: 0;
z-index: 1;
display: flex;
align-items: center;
padding-right: 9px;
margin-left: auto;
font-size: 16px;
line-height: 1;
color: #c4c6cc;
Expand All @@ -945,6 +933,21 @@
}
}

.jb-ace-main {
display: flex;
background: #272822;

.ace-edit-content {
flex: 1;
overflow: hidden;
}

.bk-loading {
background: "rgba(0, 0, 0, 80%)" !important;
}
}


.jb-ace-history-panel {
position: absolute;
top: 40px;
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/components/app-select/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@
border: none;
outline: none;

&:placeholder {
&::placeholder {
color: #c4c6cc;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/src/components/jb-edit/host.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@
} = this.localValue.executeObjectsInfo || {};
const strs = [];
if (hostList.length > 0) {
strs.push(`<span class="number strong">${hostList.length}</span>${I18n.t('台主机.result')}`);
strs.push(`<span class="number strong">${hostList.length}</span>${I18n.t('台主机_result')}`);
}
if (nodeList.length > 0) {
strs.push(`<span class="number strong">${nodeList.length}</span>${I18n.t('个节点.result')}`);
strs.push(`<span class="number strong">${nodeList.length}</span>${I18n.t('个节点_result')}`);
}
if (dynamicGroupList.length > 0) {
strs.push(`<span class="number strong">${dynamicGroupList.length}</span>${I18n.t('个分组.result')}`);
strs.push(`<span class="number strong">${dynamicGroupList.length}</span>${I18n.t('个分组_result')}`);
}
return strs.length > 0 ? strs.join('\n') : '--';
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
{{ $t('新建作业') }}
</bk-button>
<bk-button @click="handleGoImportTemplate">
{{ $t('导入作业.guide') }}
{{ $t('导入作业_guide') }}
</bk-button>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/components/render-list/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
v-if="selectNums > 0"
class="jb-table-select-tips">
<!-- eslint-disable-next-line max-len -->
<span>{{ $t('已选择.select') }}<span class="number strong">{{ selectNums }}</span>{{ $t('条.total') }}</span>
<span>{{ $t('已选择_select') }}<span class="number strong">{{ selectNums }}</span>{{ $t('条_total') }}</span>
<span
class="action-clear"
@click="handleClearAllSelect">,{{ $t('清除所有勾选') }}</span>
Expand Down
8 changes: 6 additions & 2 deletions src/frontend/src/components/scroll-faker/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
};
},
created() {
this.calcScroller = _.throttle(this.eventCalcScroller, 100);
this.calcScroller = _.throttle(this.eventCalcScroller, 300);
this.handleContentScroll = _.throttle(this.eventContentScroll, 30);
this.handleVerticalScroll = _.throttle(this.eventVerticalScroll, 30);
this.handleHorizontalScroll = _.throttle(this.eventHorizontalScroll, 30);
Expand Down Expand Up @@ -293,6 +293,8 @@
.scroll-faker {
position: relative;
height: 100%;
max-width: inherit;
max-height: inherit;

&:hover {
& > .scrollbar-vertical,
Expand All @@ -317,7 +319,9 @@
}

& > .scroll-faker-content {
height: 100%;
height: inherit;
max-width: inherit;
max-height: inherit;
overflow: scroll scroll;

&::-webkit-scrollbar {
Expand Down
Loading

0 comments on commit a4bc6db

Please sign in to comment.