Skip to content

Commit

Permalink
Merge pull request #2382 from hLinx/hotfix_3.7
Browse files Browse the repository at this point in the history
Hotfix 3.7
  • Loading branch information
hLinx authored Aug 25, 2023
2 parents 3457d46 + 5d7cc4e commit 89b467a
Show file tree
Hide file tree
Showing 13 changed files with 807 additions and 21 deletions.
19 changes: 6 additions & 13 deletions src/frontend/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,27 @@
"useBuiltIns": "usage",
"corejs": {
"version": 3
},
"targets": {
"browsers": [
"Chrome >= 46",
"Firefox >= 45",
"Safari >= 10",
"Edge >= 13",
"iOS >= 10",
"Electron >= 0.36"
]
}
}
],
[
"@vue/babel-preset-jsx",
{
"compositionAPI": "native"
}
]
],
"plugins": [
"@babel/syntax-dynamic-import",
"@babel/transform-modules-commonjs",
"@babel/proposal-export-namespace-from",
"@babel/proposal-class-properties",
"@babel/syntax-jsx",
["@babel/plugin-transform-runtime", {
"regenerator": false,
"corejs": false,
"helpers": true,
"useESModules": false
}],
"@vue/transform-vue-jsx",
"module:@vue/babel-sugar-inject-h",
"lodash"
]
}
3 changes: 2 additions & 1 deletion src/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
"@blueking/ip-selector": "0.0.1-beta.124",
"@blueking/paas-login": "0.0.11",
"@blueking/user-selector": "1.0.7",
"@vue/babel-preset-jsx": "1.4.0",
"@vue/composition-api": "1.5.0",
"ace-builds": "1.23.4",
"axios": "1.4.0",
"bk-magic-vue": "2.5.4-beta.6",
"bk-magic-vue": "2.5.7",
"core-js": "3.31.1",
"cron-parser-custom": "2.13.0",
"diff": "5.0.0",
Expand Down
10 changes: 8 additions & 2 deletions src/frontend/src/components/ace-editor/default-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,26 @@ export default {
lang === 'zh-CN' ? '##### 可在脚本开始运行时调用,打印当时的时间戳及PID。' : '##### It\'s usually called when the script starts to run, prints the timestamp and PID.',
'def job_start():',
' print("[%s][PID:%s] job_start" % (_now(), os.getpid()))',
' sys.stdout.flush()',
'',
lang === 'zh-CN' ? '##### 可在脚本执行成功的逻辑分支处调用,打印当时的时间戳及PID。 ' : '##### Use this func. to combine the execution results of multiple hosts and display by group.',
'def job_success(msg):',
' print("[%s][PID:%s] job_success:[%s]" % (_now(), os.getpid(), msg))',
' sys.stdout.flush()',
' sys.exit(0)',
'',
lang === 'zh-CN' ? '##### 可在脚本执行失败的逻辑分支处调用,打印当时的时间戳及PID。' : '##### Use this func. to combine the execution results of multiple hosts and display by group.',
'def job_fail(msg):',
' print("[%s][PID:%s] job_fail:[%s]" % (_now(), os.getpid(), msg))',
' sys.exit(1)', '',
' sys.stdout.flush()',
' sys.exit(1)',
'',
'if __name__ == \'__main__\':', '',
' job_start()', '',
lang === 'zh-CN' ? '###### iJobs中执行脚本成功和失败的标准只取决于脚本最后一条执行语句的返回值' : '###### The script execution result is depends on the value of return/exit code, weather it success or failed.',
lang === 'zh-CN' ? '###### 脚本执行成功和失败的标准只取决于最后一段执行语句的返回值' : '###### The script execution result is depends on the value of return/exit code, weather it success or failed.',
lang === 'zh-CN' ? '###### 如果返回值为0,则认为此脚本执行成功,如果非0,则认为脚本执行失败' : '###### If return code is 0, means success, otherwise failed.',
lang === 'zh-CN' ? '###### Python脚本为了避免因长时间未刷新缓冲区导致标准输出异常,' : '###### In order to avoid abnormal standard output due to the buffer not being refreshed for a long time in Python scripts,',
lang === 'zh-CN' ? '###### 建议在print的下一行使用 sys.stdout.flush() 来强制将被缓存的输出信息刷新到控制台上' : '###### we recommended to use sys.stdout.flush() in the line following the print statement to forcibly flush the cached output to the console.',
lang === 'zh-CN' ? '###### 可在此处开始编写您的脚本逻辑代码' : '###### Start to writing your script code below this line',
'',
'',
Expand Down
2 changes: 2 additions & 0 deletions src/frontend/src/components/jb-edit/input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
@click.stop="">
<bk-input
ref="input"
:maxlength="maxlength"
:value="newVal"
@blur="handleInputBlur"
@change="handleInputChange"
Expand Down Expand Up @@ -89,6 +90,7 @@
type: String,
default: '',
},
maxlength: Number,
/**
* @desc 编辑操作对应的字段名称
*/
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/domain/service/task-manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default {
taskClone(params, config) {
return TaskManageSource.getDataById(params, config)
.then(({ data }) => {
data.name = `${data.name}_copy`;
data.name = `${data.name.slice(0, 55)}_copy`;
return Object.freeze(new TaskModel(data, true));
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@

.title-text {
height: 21px;
max-width: 280px;
overflow: hidden;
text-overflow: ellipsis;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
<div
v-if="props.data.name"
class="title">
(<div class="title-text">
(<div
v-bk-overflow-tips="props.data.name"
class="title-text">
{{ props.data.name }}
</div>)
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
<!--
* Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available.
*
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
*
* BK-JOB蓝鲸智云作业平台 is licensed under the MIT License.
*
* License for BK-JOB蓝鲸智云作业平台:
*
*
* Terms of the MIT License:
* ---------------------------------------------------
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
* the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
-->

<template>
<div>
<div
id="stepDetailIpListSettingBtn"
class="select-btn">
<i class="bk-icon icon-cog-shape" />
</div>
<div
ref="settingRef"
class="list-column-setting">
<div class="select-body">
<div class="title">
{{ $t('history.字段显示设置') }}
</div>
<bk-checkbox
:checked="isAllColumn"
:indeterminate="isIndeterminate"
@click.native="handleToggleAll">
{{ $t('history.全选') }}
</bk-checkbox>
<bk-checkbox-group v-model="tempAllShowColumn">
<template v-for="item in columnList">
<span
v-if="item.name === 'ipv4'"
:key="`ip_${item.name}`"
v-bk-tooltips="{
content: 'IP 与 IPv6 至少需保留一个',
disabled: tempAllShowColumn.includes('ipv6'),
}"
class="select-column">
<bk-checkbox
:checked="item.checked"
:disabled="!tempAllShowColumn.includes('ipv6')"
:value="item.name">
{{ item.label }}
</bk-checkbox>
</span>
<span
v-else-if="item.name === 'ipv6'"
:key="`ipv6_${item.name}`"
v-bk-tooltips="{
content: 'IP 与 IPv6 至少需保留一个',
disabled: tempAllShowColumn.includes('ipv4'),
}"
class="select-column">
<bk-checkbox
:checked="item.checked"
:disabled="!tempAllShowColumn.includes('ipv4')"
:value="item.name">
{{ item.label }}
</bk-checkbox>
</span>
<bk-checkbox
v-else
:key="item.name"
:checked="item.checked"
class="select-column"
:value="item.name">
{{ item.label }}
</bk-checkbox>
</template>
</bk-checkbox-group>
</div>
<div class="select-footer">
<bk-button
theme="primary"
@click="handleSubmitSetting">
{{ $t('history.确定') }}
</bk-button>
<bk-button @click="handleHideSetting">
{{ $t('history.取消') }}
</bk-button>
</div>
</div>
</div>
</template>
<script setup>
import Tippy from 'bk-magic-vue/lib/utils/tippy';
import {
computed,
onBeforeUnmount,
onMounted,
ref,
} from 'vue';

const props = defineProps({
columnList: {
type: Array,
required: true,
},
value: {
type: Array,
required: true,
},
});
const emits = defineEmits([
'change',
'close',
]);

let settingPopover;

const settingRef = ref();
const tempAllShowColumn = ref([...props.value]);

const isIndeterminate = computed(() => tempAllShowColumn.value.length !== props.columnList.length);

const isAllColumn = computed(() => tempAllShowColumn.value.length === props.columnList.length);

const handleToggleAll = () => {
if (isAllColumn.value) {
tempAllShowColumn.value = props.columnList.reduce((result, item) => {
if (item.disabled) {
result.push(item.name);
}
return result;
}, []);
} else {
tempAllShowColumn.value = props.columnList.map(item => item.name);
}
};

const handleSubmitSetting = () => {
emits('change', [...tempAllShowColumn.value]);
settingPopover.hide();
};

const handleHideSetting = () => {
settingPopover.hide();
};

onMounted(() => {
settingPopover = Tippy(document.querySelector('#stepDetailIpListSettingBtn'), {
theme: 'light step-execution-history-ip-list-setting',
arrow: true,
interactive: true,
placement: 'bottom-start',
content: settingRef.value,
animation: 'slide-toggle',
trigger: 'click',
width: '450px',
});

onBeforeUnmount(() => {
settingPopover.destroy();
settingPopover.hide();
settingPopover = null;
});
});
</script>
<style lang="postcss" scoped>
.select-btn{
width: 45px;
height: 40px;
padding: 0;
font-size: 14px;
color: #979ba5;
text-align: center;
cursor: pointer;
border-left: 1px solid #dcdee5;
}

.list-column-setting {
.select-body {
padding: 15px 22px 30px;

.title {
margin-bottom: 22px;
font-size: 16px;
color: #313238;
}
}

.select-column {
display: inline-block;
margin-top: 20px;
margin-right: 36px;
vertical-align: middle;

&:last-child {
margin-right: 0;
}
}

.select-footer {
display: flex;
height: 50px;
background: #fafbfd;
border-top: 1px solid #dbdde4;
align-items: center;
justify-content: center;

.bk-button {
margin: 0 5px;
}
}
}
</style>
Loading

0 comments on commit 89b467a

Please sign in to comment.