Skip to content

Commit

Permalink
Merge pull request #3010 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 May 29, 2024
2 parents d3c31a5 + 1eee49d commit 456d20d
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 80 deletions.
2 changes: 1 addition & 1 deletion src/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@vue/composition-api": "1.7.2",
"ace-builds": "1.32.9",
"axios": "1.6.8",
"bk-magic-vue": "2.5.8-beta.6",
"bk-magic-vue": "2.5.8",
"core-js": "3.36.1",
"cron-parser-custom": "2.13.0",
"diff": "5.2.0",
Expand Down
31 changes: 20 additions & 11 deletions src/frontend/src/components/ace-editor/default-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,39 +39,44 @@ export default {
shell.push(
'#!/bin/bash',
'',
'anynowtime="date +\'%Y-%m-%d %H:%M:%S\'"',
'NOW="echo [\\`$anynowtime\\`][PID:$$]"',
'',
lang === 'zh-CN' ? '##### 可在脚本开始运行时调用,打印当时的时间戳及PID。' : '##### It\'s usually called when the script starts to run, prints the timestamp and PID.',
lang === 'zh-CN' ? '# 定义获取当前时间和PID的函数' : '# Define function to get current time and PID',
'function job_get_now',
'{',
' echo "[`date +\'%Y-%m-%d %H:%M:%S\'`][PID:$$]"',
'}',
'',
lang === 'zh-CN' ? '# 在脚本开始运行时调用,打印当前的时间戳及PID' : '# Call this function at the beginning of the script to print the current time and PID',
'function job_start',
'{',
' echo "`eval $NOW` job_start"',
' echo "$(job_get_now) job_start"',
'}',
'',
lang === 'zh-CN' ? '##### 可在脚本执行成功的逻辑分支处调用,打印当时的时间戳及PID。 ' : '##### Use this func. to combine the execution results of multiple hosts and display by group.',
lang === 'zh-CN' ? '# 在脚本执行成功的逻辑分支处调用,打印当前的时间戳及PID' : '# Call this function when the script execution succeeds to print the current time and PID with a success message',
'function job_success',
'{',
' MSG="$*"',
' echo "`eval $NOW` job_success:[$MSG]"',
' local msg="$*"',
' echo "$(job_get_now) job_success: [$msg]"',
' exit 0',
'}',
'',
// '#####可在脚本执行失败的逻辑分支处调用,打印当时的时间戳及PID。',
lang === 'zh-CN' ? '##### 可在脚本执行失败的逻辑分支处调用,打印当时的时间戳及PID。' : '##### Use this func. to combine the execution results of multiple hosts and display by group.',
lang === 'zh-CN' ? '# 在脚本执行失败的逻辑分支处调用,打印当前的时间戳及PID' : '# Call this function when the script execution fails to print the current time and PID with a failure message',
'function job_fail',
'{',
' MSG="$*"',
' echo "`eval $NOW` job_fail:[$MSG]"',
' local msg="$*"',
' echo "$(job_get_now) job_fail: [$msg]"',
' exit 1',
'}',
'',
lang === 'zh-CN' ? '# 在当前脚本执行时,第一行输出当前时间和进程ID,详见上面函数:job_get_now' : '# Call the job_start function to print the current time and PID',
'job_start',
'',
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' ? '###### 可在此处开始编写您的脚本逻辑代码' : '###### Start to writing your script code below this line',
'',
'',
'',
);
return shell.join('\n');
}()),
Expand Down Expand Up @@ -125,6 +130,7 @@ export default {
' exit 1',
'',
'',
'',
);
return batch.join('\n');
}()),
Expand Down Expand Up @@ -165,6 +171,7 @@ export default {
lang === 'zh-CN' ? '###### 可在此处开始编写您的脚本逻辑代码' : '###### You can start writing your script logic code here',
'',
'',
'',
);
return perl.join('\n');
}()),
Expand Down Expand Up @@ -207,6 +214,7 @@ export default {
lang === 'zh-CN' ? '###### 可在此处开始编写您的脚本逻辑代码' : '###### Start to writing your script code below this line',
'',
'',
'',
);
return python.join('\n');
}()),
Expand Down Expand Up @@ -259,6 +267,7 @@ export default {
lang === 'zh-CN' ? '###### 可在此处开始编写您的脚本逻辑代码' : '###### Start to writing your script code below this line',
'',
'',
'',
);
return powershell.join('\n');
}()),
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/css/bk-patch.css
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
vertical-align: middle;

&.bk-dialog-fullscreen {
inset: 0;
inset: 0 !important;
}

&.bk-info-box {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@
}
this.isAsyncContentLoading = true;
TaskExecuteService.fetchFileLogOfFile({
taskInstanceId: this.taskInstanceId,
stepInstanceId: this.stepInstanceId,
executeObjectType: this.taskExecuteDetail.executeObject.type,
executeObjectResourceId: this.taskExecuteDetail.executeObject.executeObjectResourceId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<script>
import TaskManageService from '@service/task-manage';
import ConfirmCron from '../../common/plan/confirm-cron';
import ConfirmCron from './render-corn/index.vue';
export default {
name: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,72 +27,73 @@

<template>
<permission-section>
<smart-action offset-target="variable-value">
<div
v-bkloading="{ isLoading }"
class="cron-job-detail"
:class="{
'is-loading': isLoading,
}">
<bk-alert :title="$t('template.同步执行方案需要重新确认定时任务的全局变量,不使用的定时任务可以直接停用。')" />
<div class="title">
<span>「{{ info.name }}」{{ $t('template.的全局变量') }}</span>
<span
v-if="!data.enable"
class="disable">{{ $t('template.已停用') }}</span>
<span
v-else-if="data.hasConfirm"
class="confirm">{{ $t('template.已确认') }}</span>
<span
v-else
class="waiting">{{ $t('template.待确认') }}</span>
</div>
<div>
<global-variable-layout v-if="!isLoading">
<global-variable
v-for="variable in info.variableValue"
:key="variable.id"
ref="variable"
:data="variable"
:readonly="readonly"
:type="variable.type" />
</global-variable-layout>
<empty v-if="isEmpty">
<p>{{ $t('template.无关联的全局变量') }}</p>
<p style="margin-top: 8px;">
{{ $t('template.已直接确认') }}
</p>
</empty>
</div>
</div>
<template
v-if="!isLoading && !isEmpty"
#action>
<bk-button
v-if="isEditing"
class="mr10"
:disabled="!data.enable"
theme="primary"
@click="handleSubmit">
{{ $t('template.确认') }}
</bk-button>
<bk-button
v-if="isEditing"
class="mr10"
:disabled="!data.enable"
@click="handleReset">
{{ $t('template.重置') }}
</bk-button>
<bk-button
<div
v-bkloading="{ isLoading }"
class="cron-job-detail"
:class="{
'is-loading': isLoading,
}">
<bk-alert :title="$t('template.同步执行方案需要重新确认定时任务的全局变量,不使用的定时任务可以直接停用。')" />
<div class="title">
<span>「{{ info.name }}」{{ $t('template.的全局变量') }}</span>
<span
v-if="!data.enable"
class="disable">{{ $t('template.已停用') }}</span>
<span
v-else-if="data.hasConfirm"
class="confirm">{{ $t('template.已确认') }}</span>
<span
v-else
class="mr10"
:disabled="!data.enable"
theme="primary"
@click="handleToggleEdit">
{{ $t('template.编辑') }}
</bk-button>
</template>
</smart-action>
class="waiting">{{ $t('template.待确认') }}</span>
</div>
<div>
<global-variable-layout v-if="!isLoading">
<global-variable
v-for="variable in info.variableValue"
:key="variable.id"
ref="variable"
:data="variable"
:readonly="readonly"
:type="variable.type" />
<div class="global-variable-edit-box">
<div class="variable-name">
<span />
</div>
<div v-if="!isLoading && !isEmpty">
<bk-button
v-if="isEditing"
class="mr10"
:disabled="!data.enable"
theme="primary"
@click="handleSubmit">
{{ $t('template.确认') }}
</bk-button>
<bk-button
v-if="isEditing"
class="mr10"
:disabled="!data.enable"
@click="handleReset">
{{ $t('template.重置') }}
</bk-button>
<bk-button
v-else
class="mr10"
:disabled="!data.enable"
theme="primary"
@click="handleToggleEdit">
{{ $t('template.编辑') }}
</bk-button>
</div>
</div>
</global-variable-layout>
<empty v-if="isEmpty">
<p>{{ $t('template.无关联的全局变量') }}</p>
<p style="margin-top: 8px;">
{{ $t('template.已直接确认') }}
</p>
</empty>
</div>
</div>
</permission-section>
</template>
<script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
import I18n from '@/i18n';
import ConfirmCron from './components/confirm-cron';
import ConfirmCron from './components/confirm-cron/index.vue';
const runStepByStep = (data, callback, finishCallback = () => {}) => {
let startIndex = 0;
Expand Down

0 comments on commit 456d20d

Please sign in to comment.