-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3422 from hLinx/feature_3.11
Feature 3.11
- Loading branch information
Showing
20 changed files
with
149 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
src/frontend/src/components/task-step/script/strategy/window-interpreter.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<template> | ||
<bk-form-item | ||
class="form-item-content" | ||
error-display-type="normal" | ||
:label="t('解释器')" | ||
:property="field" | ||
:required="isCustom" | ||
:rules="rules"> | ||
<bk-checkbox | ||
v-model="isCustom" | ||
@change="handleCustomChange"> | ||
<span | ||
v-bk-tooltips="t('使用目标机器指定路径下的解释器运行本脚本(仅对Windows有效)')" | ||
class="tips"> | ||
{{ t('自定义windows解释器路径') }} | ||
</span> | ||
</bk-checkbox> | ||
<div | ||
v-if="isCustom" | ||
style="margin-top: 8px"> | ||
<bk-input | ||
class="form-item-content" | ||
:placeholder="t('输入目标机器上的自定义解释器软件路径,如:D:\\Software\\python3\\python.exe。请勿指定命令行选项。')" | ||
:value="formData[field]" | ||
@change="handleChange" /> | ||
</div> | ||
</bk-form-item> | ||
</template> | ||
<script setup> | ||
import { ref, watch } from 'vue'; | ||
import { useI18n } from '@/i18n'; | ||
const props = defineProps({ | ||
field: { | ||
type: String, | ||
required: true, | ||
}, | ||
formData: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}); | ||
const emits = defineEmits(['on-change']); | ||
const { t } = useI18n(); | ||
const isCustom = ref(false); | ||
const rules = [ | ||
{ | ||
validator: (value) => { | ||
if (!isCustom.value) { | ||
return true; | ||
} | ||
return /^[a-zA-Z]:\\(?:[^<>:"/\\|?*\r\n]+\\)*[^<>:"/\\|?*\r\n]*$/.test(value) && /\.exe$/.test(value); | ||
}, | ||
message: t('解释器路径有误,需为合法的文件路径、且以 .exe 结尾。'), | ||
trigger: 'blur', | ||
}, | ||
]; | ||
watch(() => props.formData, () => { | ||
if (props.formData[props.field] !== undefined) { | ||
isCustom.value = true; | ||
} | ||
}, { | ||
immediate: true, | ||
}); | ||
const handleCustomChange = (custom) => { | ||
emits('on-change', props.field, custom ? '' : undefined); | ||
}; | ||
const handleChange = (value) => { | ||
emits('on-change', props.field, value); | ||
}; | ||
</script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters