Skip to content

Commit

Permalink
Merge remote-tracking branch 'hLinx/3.5.x' into 3.5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jsonwan committed Sep 26, 2022
2 parents c9d81f2 + f288246 commit 31c2fbf
Show file tree
Hide file tree
Showing 50 changed files with 808 additions and 204 deletions.
16 changes: 12 additions & 4 deletions src/frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
<bk-popover
theme="light site-header-dropdown"
style="margin-right: 8px;"
:arrow="false">
:arrow="false"
:tippy-options="{ hideOnClick: false }">
<div class="flag-box">
<Icon
id="siteLocal"
Expand All @@ -58,7 +59,11 @@
</div>
</div>
</bk-popover>
<bk-popover theme="light site-header-dropdown" style="margin-right: 14px;" :arrow="false">
<bk-popover
theme="light site-header-dropdown"
style="margin-right: 14px;"
:arrow="false"
:tippy-options="{ hideOnClick: false }">
<div class="flag-box">
<Icon id="siteHelp" type="help-document-fill" />
</div>
Expand All @@ -68,7 +73,10 @@
<div class="item" @click="handleLocationFeedback">{{ $t('问题反馈') }}</div>
</div>
</bk-popover>
<bk-popover theme="light site-header-dropdown" :arrow="false">
<bk-popover
theme="light site-header-dropdown"
:arrow="false"
:tippy-options="{ hideOnClick: false }">
<div class="user-flag">
<span style="margin-right: 5px;">{{ currentUser.username }}</span>
<i class="bk-icon icon-down-shape" />
Expand Down Expand Up @@ -207,7 +215,7 @@
handleToggleLang (lang) {
Cookie.set('blueking_language', lang, {
expires: 3600,
domain: window.location.hostname.replace(/.*(\.[^.]+\.[^.]+$)/, '$1'),
domain: window.location.hostname.replace(/^[^.]+(.*)$/, '$1'),
});
setLocale(lang);
},
Expand Down
1 change: 1 addition & 0 deletions src/frontend/src/components/ace-editor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@
if (this.readonly) {
this.editor.setValue(Base64.decode(value));
this.editor.clearSelection();
this.syntaxCheck(value);
}
// 外部传入空置直接清空编辑器
if (value === '' && this.content !== '') {
Expand Down
37 changes: 24 additions & 13 deletions src/frontend/src/components/jb-edit/tag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,15 @@
class="tag-shortcurt-box"
@click.stop="">
<div class="shortcurt-action-btn">
<Icon type="copy" @click="handleCopy" />
<Icon type="paste" class="paste-btn" @click="handlePaste" />
<Icon
v-bk-tooltips="$t('复制')"
type="copy"
@click="handleCopy" />
<Icon
v-bk-tooltips="$t('粘贴')"
type="paste"
class="paste-btn"
@click="handlePaste" />
</div>
</div>
<div v-else class="tag-normal-box">
Expand Down Expand Up @@ -233,6 +240,7 @@
return;
}
copyMemo = _.cloneDeep(this.localValue);
console.log('form copyMemocopyMemo = ', copyMemo);
execCopy(this.text);
},
/**
Expand All @@ -246,12 +254,10 @@
});
return;
}
this.localValue = [
...new Set([
...this.localValue,
...copyMemo,
]),
];
this.localValue = _.uniqBy([
...this.localValue,
...copyMemo,
], _ => _.id);
this.triggerRemote();
},
},
Expand Down Expand Up @@ -285,11 +291,17 @@
cursor: pointer;
border-radius: 2px;

&.shortcurt:hover {
background: #e1e2e6;
&.shortcurt {
.render-value-box {
padding-left: 4px;
}

.shortcurt-action-btn {
display: flex;
&:hover {
background: #e1e2e6;

.shortcurt-action-btn {
display: flex;
}
}
}

Expand All @@ -305,7 +317,6 @@
.render-value-box {
display: flex;
height: 30px;
padding-left: 4px;
line-height: 30px;
align-items: center;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@
@input="handleInputChange"
@keydown="handleInputKeydown" />
</div>
<div
<!-- <div
v-if="focused"
v-once
style="margin-top: 4px; font-size: 12px; line-height: 22px; color: #c4c6cc;">
{{ inputTips }}
</div>
</div> -->
</div>
<div class="search-nextfix">
<i
Expand Down
10 changes: 10 additions & 0 deletions src/frontend/src/components/render-list/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
<div
ref="renderList"
class="jb-render-list"
:class="{
'table-empty': data.length < 1,
}"
v-test="{ type: 'data', value: 'table' }"
v-bkloading="{ isLoading }">
<bk-table
Expand Down Expand Up @@ -144,6 +147,7 @@
selectNums: 0,
params: {},
pagination: {
showTotalCount: true,
count: 0,
current: 1,
limit: 10,
Expand Down Expand Up @@ -536,6 +540,12 @@
</script>
<style lang="postcss">
.jb-render-list {
&.table-empty {
.bk-table-fixed-right {
bottom: 0 !important;
}
}

.bk-table-pagination-wrapper {
background: #fff;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,30 +96,31 @@
handler (newData) {
this.isReadonly = newData[this.scriptSourceField] !== TaskStepModel.scriptStep.TYPE_SOURCE_LOCAL;
this.lang = formatScriptTypeValue(newData[this.languageField]);
if (this.isReadonly) {
this.rules = [];
} else {
this.rules = [
{
required: true,
message: I18n.t('脚本内容必填'),
trigger: 'change',
},
{
validator: value => ScriptManageService.getScriptValidation({
content: value,
scriptType: newData[this.languageField],
}).then((data) => {
// 高危语句报错状态需要全局保存
const dangerousContent = _.find(data, _ => _.isDangerous);
this.$store.commit('setScriptCheckError', dangerousContent);
return true;
}),
message: I18n.t('脚本内容检测失败'),
trigger: 'blur',
},
];

const rules = [
{
validator: value => ScriptManageService.getScriptValidation({
content: value,
scriptType: newData[this.languageField],
}).then((data) => {
// 高危语句报错状态需要全局保存
const dangerousContent = _.find(data, _ => _.isDangerous);
this.$store.commit('setScriptCheckError', dangerousContent);
return true;
}),
message: I18n.t('脚本内容检测失败'),
trigger: 'blur',
},
];

if (!this.isReadonly) {
rules.unshift({
required: true,
message: I18n.t('脚本内容必填'),
trigger: 'change',
});
}
this.rules = rules;
},
deep: true,
immediate: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
</bk-option>
</bk-select>
<bk-select
ref="scriptSelect"
:placeholder="$t('选择引用脚本')"
style="width: 375px;"
:value="formData[scriptVersionIdField]"
Expand Down Expand Up @@ -250,13 +251,24 @@
this.$refs.scriptId.clearValidator();
}
},
// 需要同步的脚本默认展开脚本列表
scriptListDisplay () {
if (this.scriptListDisplay.length > 1 && !this.hasShowScriptSelect) {
setTimeout(() => {
this.hasShowScriptSelect = true;
this.$refs.scriptSelect.$el.querySelector('.bk-select-name').click();
}, 30);
}
},
},
created () {
this.scriptListMemo = [];
this.publicScriptListMemo = [];
this.initScriptContent();
this.fetchScriptList();
this.fetchPublicScriptList();

this.hasShowScriptSelect = false;
},
methods: {
/**
Expand Down
11 changes: 11 additions & 0 deletions src/frontend/src/domain/model/script/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@ export default class Script extends BaseModel {
return !this.version;
}

/**
* @desc 是否可禁用
* @returns { Boolean }
*/
get isBanable () {
return [
Script.STATUS_ONLINE,
Script.STATUS_OFFLINE,
].includes(this.status);
}

/**
* @desc tag 显示文本
* @returns { String }
Expand Down
10 changes: 8 additions & 2 deletions src/frontend/src/i18n/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,11 @@ export default {
'作业平台的核心功能包括面向服务器操作系统的命令执行、文件分发,以及将多个操作组合成作业流程,并支持设置定时执行。': 'The core functions of the Job include command execution for server operating systems, file distribution, and combining multiple operations into job processes, and support for setting up timed execution.',
申请业务权限: 'Apply Business Permission',
'申请已有业务权限 / 创建新的业务': 'Apply for business permission or Create one',
'不同团队在作业平台上的资源以“业务”分隔,而“业务”是统一由配置平台进行创建和管理的,你可以选择 申请已有业务的权限,亦或是 新建 一个全新的业务。': 'The resources of different teams on the job platform are separated by "Business", which is created and managed by the CMDB platform, and you can choose to request the permission of an existing business or create a new one.',
'不同团队在作业平台上的资源以“业务”分隔,而“业务”是统一由配置平台进行创建和管理的,你可以选择': 'The resources of different teams on the job platform are separated by "Business", which is created and managed by the CMDB platform, and you can choose to ',
申请已有业务的权限: 'Apply Business Permission',
',亦或是': ' or ',
' 新建 ': 'create now.',
'一个全新的业务。': '',
开始使用作业平台: 'Getting Started with Job',
作业平台的目标服务器信息同样来自: 'The target host of the job platform also comes from the ',
配置平台: 'CMDB',
Expand Down Expand Up @@ -557,5 +561,7 @@ export default {
立即查看: 'here',
了解更多细节: '',
管理脚本各个版本的内容和状态: 'Manage the versions of script',

复制: 'Copy',
粘贴: 'Paste',
快速执行详情: 'Quick Launch Details',
};
4 changes: 2 additions & 2 deletions src/frontend/src/layout-new.vue
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@
<div slot="title">{{ $t('安全.menuGroup') }}</div>
<div slot="flod-title">{{ $t('安全.flodTitle') }}</div>
<jb-item index="dangerousRuleManage">
<Icon type="job-white-list" />
<Icon type="gaoweiyujujiance" />
{{ $t('高危语句规则') }}
</jb-item>
<jb-item index="detectRecords">
<Icon type="job-setting" />
<Icon type="lanjiejilu" />
{{ $t('检测记录') }}
</jb-item>
</jb-item-group>
Expand Down
2 changes: 2 additions & 0 deletions src/frontend/src/utils/assist/script-error-confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const sacnDialog = (resolve, reject) => {
</div>
</div>
))(h),
closeFn: handleCancel,
});
};

Expand Down Expand Up @@ -109,6 +110,7 @@ const preventDialog = (resolve, reject) => {
</div>
</div>
))(h),
closeFn: handleClose,
});
};

Expand Down
10 changes: 5 additions & 5 deletions src/frontend/src/views/account-manage/index/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
label="ID"
prop="id"
key="id"
sortable
sortable="custom"
width="80"
align="left" />
<bk-table-column
Expand All @@ -65,31 +65,31 @@
prop="alias"
key="alias"
min-width="180"
sortable
sortable="custom"
align="left" />
<bk-table-column
v-if="allRenderColumnMap.account"
:label="$t('account.账号名称.colHead')"
prop="account"
key="account"
min-width="180"
sortable
sortable="custom"
align="left" />
<bk-table-column
v-if="allRenderColumnMap.categoryName"
:label="$t('account.账号用途.colHead')"
prop="categoryName"
key="categoryName"
width="120"
sortable
sortable="custom"
align="left" />
<bk-table-column
v-if="allRenderColumnMap.typeName"
:label="$t('account.账号类型.colHead')"
prop="typeName"
key="typeName"
width="120"
sortable
sortable="custom"
align="left" />
<bk-table-column
v-if="allRenderColumnMap.creator"
Expand Down
Loading

0 comments on commit 31c2fbf

Please sign in to comment.