mirror of
https://github.com/jumpserver/lina.git
synced 2025-11-09 11:19:11 +00:00
Compare commits
71 Commits
repr@v3@a9
...
v4.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56aa3caa83 | ||
|
|
19b1dc0dbc | ||
|
|
77ef172a23 | ||
|
|
4596887bf1 | ||
|
|
0a3dc30c85 | ||
|
|
51d24bc8e5 | ||
|
|
1b15a4d043 | ||
|
|
7d3f818242 | ||
|
|
4e26f18d77 | ||
|
|
b22613617a | ||
|
|
e971cbf4a8 | ||
|
|
4672abae35 | ||
|
|
ba36d72602 | ||
|
|
4bfbbba4c5 | ||
|
|
ea038ce43a | ||
|
|
e16b19666c | ||
|
|
c7f5409eb6 | ||
|
|
fdbd7d2222 | ||
|
|
ddbaeeafea | ||
|
|
efb0e9dacb | ||
|
|
f6f8301ad5 | ||
|
|
9a63ae63d4 | ||
|
|
1e007ccda3 | ||
|
|
d1d0b06b53 | ||
|
|
5fb70d2f24 | ||
|
|
b54a95430f | ||
|
|
4d8b4c45af | ||
|
|
a6d642df60 | ||
|
|
2e74f1522f | ||
|
|
fe615e0314 | ||
|
|
09f734e6fc | ||
|
|
3117046342 | ||
|
|
b68aecb5cc | ||
|
|
1c9b155d97 | ||
|
|
75b1be9864 | ||
|
|
615c3c1cf4 | ||
|
|
4d82231af4 | ||
|
|
c6cf6571b6 | ||
|
|
8ea990d070 | ||
|
|
f4a32170d5 | ||
|
|
073508675e | ||
|
|
1d6ca0a93a | ||
|
|
36aea652d6 | ||
|
|
1a42ce90ab | ||
|
|
31a401b55d | ||
|
|
582a84178d | ||
|
|
9b9f7c936c | ||
|
|
2a6100957f | ||
|
|
16606d6a27 | ||
|
|
0a612f50e6 | ||
|
|
fe36fa9390 | ||
|
|
ba109900ec | ||
|
|
ec7768267f | ||
|
|
cc58b374ab | ||
|
|
04ffbb8fd6 | ||
|
|
49880f6739 | ||
|
|
e6f98d58c4 | ||
|
|
fd1f16d43c | ||
|
|
968b2415b1 | ||
|
|
776090d6ba | ||
|
|
3a37952288 | ||
|
|
62b8fc0e3b | ||
|
|
b2028869cb | ||
|
|
5277a725f8 | ||
|
|
f137788c1a | ||
|
|
f7d17c8de7 | ||
|
|
feea70b0be | ||
|
|
04696ef3d6 | ||
|
|
1731f4f788 | ||
|
|
6f25d93909 | ||
|
|
46461ec324 |
@@ -1,28 +0,0 @@
|
||||
name: LLM Code Review
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize]
|
||||
|
||||
jobs:
|
||||
llm-code-review:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: fit2cloud/LLM-CodeReview-Action@main
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.FIT2CLOUDRD_LLM_CODE_REVIEW_TOKEN }}
|
||||
OPENAI_API_KEY: ${{ secrets.ALIYUN_LLM_API_KEY }}
|
||||
LANGUAGE: English
|
||||
OPENAI_API_ENDPOINT: https://dashscope.aliyuncs.com/compatible-mode/v1
|
||||
MODEL: qwen2-1.5b-instruct
|
||||
PROMPT: "Please check the following code differences for any irregularities, potential issues, or optimization suggestions, and provide your answers in English."
|
||||
top_p: 1
|
||||
temperature: 1
|
||||
# max_tokens: 10000
|
||||
MAX_PATCH_LENGTH: 10000
|
||||
IGNORE_PATTERNS: "/node_modules,*.md,/dist,/.github"
|
||||
FILE_PATTERNS: "*.java,*.go,*.py,*.vue,*.ts,*.js,*.css,*.scss,*.html"
|
||||
28
.github/workflows/llm-code-review.yml
vendored
28
.github/workflows/llm-code-review.yml
vendored
@@ -1,28 +0,0 @@
|
||||
name: LLM Code Review
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize]
|
||||
|
||||
jobs:
|
||||
llm-code-review:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: fit2cloud/LLM-CodeReview-Action@main
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.FIT2CLOUDRD_LLM_CODE_REVIEW_TOKEN }}
|
||||
OPENAI_API_KEY: ${{ secrets.ALIYUN_LLM_API_KEY }}
|
||||
LANGUAGE: English
|
||||
OPENAI_API_ENDPOINT: https://dashscope.aliyuncs.com/compatible-mode/v1
|
||||
MODEL: qwen2-1.5b-instruct
|
||||
PROMPT: "Please check the following code differences for any irregularities, potential issues, or optimization suggestions, and provide your answers in English."
|
||||
top_p: 1
|
||||
temperature: 1
|
||||
# max_tokens: 10000
|
||||
MAX_PATCH_LENGTH: 10000
|
||||
IGNORE_PATTERNS: "/node_modules,*.md,/dist,/.github"
|
||||
FILE_PATTERNS: "*.java,*.go,*.py,*.vue,*.ts,*.js,*.css,*.scss,*.html"
|
||||
@@ -53,7 +53,7 @@ export function createJob(form) {
|
||||
})
|
||||
}
|
||||
|
||||
export function stopJob(form) {
|
||||
export function StopJob(form) {
|
||||
return request({
|
||||
url: '/api/v1/ops/job-executions/stop/',
|
||||
method: 'post',
|
||||
@@ -71,10 +71,3 @@ export function JobUploadFile(form) {
|
||||
})
|
||||
}
|
||||
|
||||
export function auditUpdateJob(id, form) {
|
||||
return request({
|
||||
url: `/api/v1/audits/jobs/${id}/`,
|
||||
method: 'patch',
|
||||
data: form
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
:visible.sync="visible"
|
||||
class="dialog-content"
|
||||
v-bind="$attrs"
|
||||
width="740px"
|
||||
width="600px"
|
||||
@confirm="visible = false"
|
||||
v-on="$listeners"
|
||||
>
|
||||
@@ -52,21 +52,11 @@
|
||||
<el-row :gutter="24" style="margin: 0 auto;">
|
||||
<el-col :md="24" :sm="24" style="display: flex; align-items: center; margin-bottom: 20px;">
|
||||
<el-input
|
||||
v-if="subTypeSelected !== 'face'"
|
||||
v-model="secretValue"
|
||||
:placeholder="inputPlaceholder"
|
||||
:show-password="showPassword"
|
||||
@keyup.enter.native="handleConfirm"
|
||||
/>
|
||||
|
||||
<iframe
|
||||
v-if="isFaceCaptureVisible && subTypeSelected ==='face' && faceCaptureUrl"
|
||||
:src="faceCaptureUrl"
|
||||
allow="camera"
|
||||
sandbox="allow-scripts allow-same-origin"
|
||||
style="width: 100%; height: 800px;border: none;"
|
||||
/>
|
||||
|
||||
<span v-if="subTypeSelected === 'sms'" style="margin: -1px 0 0 20px;">
|
||||
<el-button
|
||||
:disabled="smsBtnDisabled"
|
||||
@@ -82,24 +72,9 @@
|
||||
</el-row>
|
||||
<el-row :gutter="24" style="margin: 10px auto;">
|
||||
<el-col :md="24" :sm="24">
|
||||
<el-button
|
||||
v-if="subTypeSelected!=='face'"
|
||||
class="confirm-btn"
|
||||
size="mini"
|
||||
type="primary"
|
||||
@click="handleConfirm"
|
||||
>
|
||||
<el-button class="confirm-btn" size="mini" type="primary" @click="handleConfirm">
|
||||
{{ this.$t('Confirm') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="subTypeSelected==='face'&&!isFaceCaptureVisible"
|
||||
class="confirm-btn"
|
||||
size="mini"
|
||||
type="primary"
|
||||
@click="handleFaceCapture"
|
||||
>
|
||||
开始人脸识别
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
@@ -138,10 +113,7 @@ export default {
|
||||
visible: false,
|
||||
callback: null,
|
||||
cancel: null,
|
||||
processing: false,
|
||||
isFaceCaptureVisible: false,
|
||||
faceToken: null,
|
||||
faceCaptureUrl: null
|
||||
processing: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -157,10 +129,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
handleSubTypeChange(val) {
|
||||
if (val !== 'face') {
|
||||
this.isFaceCaptureVisible = false
|
||||
}
|
||||
|
||||
this.inputPlaceholder = this.subTypeChoices.filter(item => item.name === val)[0]?.placeholder
|
||||
this.smsWidth = val === 'sms' ? 6 : 0
|
||||
},
|
||||
@@ -224,29 +192,6 @@ export default {
|
||||
this.$message.error(this.$tc('FailedToSendVerificationCode'))
|
||||
})
|
||||
},
|
||||
startFaceCapture() {
|
||||
const url = '/api/v1/authentication/face/context/'
|
||||
this.$axios.post(url).then(data => {
|
||||
const token = data['token']
|
||||
this.faceCaptureUrl = '/facelive/capture?token=' + token
|
||||
this.isFaceCaptureVisible = true
|
||||
|
||||
const timer = setInterval(() => {
|
||||
this.$axios.get(url + `?token=${token}`).then(data => {
|
||||
if (data['is_finished']) {
|
||||
clearInterval(timer)
|
||||
this.isFaceCaptureVisible = false
|
||||
this.handleConfirm()
|
||||
}
|
||||
})
|
||||
}, 1000)
|
||||
}).catch(() => {
|
||||
this.$message.error(this.$tc('FailedToStartFaceCapture'))
|
||||
})
|
||||
},
|
||||
handleFaceCapture() {
|
||||
this.startFaceCapture()
|
||||
},
|
||||
handleConfirm() {
|
||||
if (this.confirmTypeRequired === 'relogin') {
|
||||
return this.logout()
|
||||
@@ -269,8 +214,6 @@ export default {
|
||||
})
|
||||
}).catch((err) => {
|
||||
this.$message.error(err.message || this.$tc('ConfirmFailed'))
|
||||
this.faceCaptureUrl = null
|
||||
this.isFaceCaptureVisible = false
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -278,21 +221,21 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dialog-content ::v-deep .el-dialog__footer {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.dialog-content ::v-deep .el-dialog {
|
||||
padding: 8px;
|
||||
|
||||
.el-dialog__body {
|
||||
padding-top: 30px;
|
||||
padding-bottom: 30px;
|
||||
.dialog-content ::v-deep .el-dialog__footer {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
width: 100%;
|
||||
line-height: 20px;
|
||||
}
|
||||
.dialog-content ::v-deep .el-dialog {
|
||||
padding: 8px;
|
||||
|
||||
.el-dialog__body {
|
||||
padding-top: 30px;
|
||||
padding-bottom: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
width: 100%;
|
||||
line-height: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
<template>
|
||||
<AutoDataForm
|
||||
ref="AutoDataForm"
|
||||
class="variable-add"
|
||||
:submit-btn-text="submitBtnText"
|
||||
v-bind="$data"
|
||||
@submit="confirm"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AutoDataForm from '@/components/Form/AutoDataForm/index.vue'
|
||||
|
||||
export default {
|
||||
name: 'VariableCreateForm',
|
||||
components: {
|
||||
AutoDataForm
|
||||
},
|
||||
props: {
|
||||
variable: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
submitBtnText: this.$t('Confirm'),
|
||||
url: '/api/v1/ops/variables/',
|
||||
form: Object.assign({ 'on_invalid': 'error' }, this.variable || {}),
|
||||
fields: [
|
||||
['', ['name', 'var_name', 'type', 'text_default_value', 'select_default_value', 'extra_args', 'tips', 'required']]
|
||||
],
|
||||
fieldsMeta: {
|
||||
text_default_value: {
|
||||
label: this.$t('DefaultValue'),
|
||||
hidden: (formValue) => {
|
||||
return formValue.type !== 'text'
|
||||
},
|
||||
el: {
|
||||
type: 'input'
|
||||
}
|
||||
},
|
||||
select_default_value: {
|
||||
label: this.$t('DefaultValue'),
|
||||
hidden: (formValue) => {
|
||||
return formValue.type !== 'select'
|
||||
},
|
||||
el: { type: 'input' }
|
||||
},
|
||||
extra_args: {
|
||||
hidden: (formValue) => {
|
||||
return formValue.type !== 'select'
|
||||
},
|
||||
el: { type: 'textarea', rows: 4, placeholder: this.$t('ExtraArgsPlaceholder') },
|
||||
rules: [
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
try {
|
||||
const lines = value.split('\n')
|
||||
const regex = /^[^:]+:[^:]+$/
|
||||
for (const line of lines) {
|
||||
if (!regex.test(line.trim())) {
|
||||
callback(new Error(this.$t('ExtraArgsFormatError')))
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
callback(new Error(this.$t('ExtraArgsFormatError')))
|
||||
}
|
||||
callback()
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
hasSaveContinue: false,
|
||||
method: 'get'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
confirm(form) {
|
||||
if (this.variable?.name) {
|
||||
this.$emit('edit', form)
|
||||
} else {
|
||||
this.$emit('add', form)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
.variable-add {
|
||||
::v-deep .el-form-item {
|
||||
margin-bottom: 5px;
|
||||
|
||||
.help-block {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .form-group-header {
|
||||
.hr-line-dashed {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,74 +0,0 @@
|
||||
<template>
|
||||
<AutoDataForm
|
||||
ref="AutoDataForm"
|
||||
class="variable-set"
|
||||
:submit-btn-text="submitBtnText"
|
||||
v-bind="$data"
|
||||
:fields="fields"
|
||||
@submit="confirm"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AutoDataForm from '@/components/Form/AutoDataForm/index.vue'
|
||||
|
||||
export default {
|
||||
name: 'VariableSetForm',
|
||||
components: {
|
||||
AutoDataForm
|
||||
},
|
||||
props: {
|
||||
formData: {
|
||||
type: Array,
|
||||
default: () => ([])
|
||||
},
|
||||
queryParam: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
submitBtnText: this.$t('Confirm'),
|
||||
// 防止缓存form remoteMeta
|
||||
url: `/api/v1/ops/variables/form-data/?t=${new Date().getTime()}&` + this.queryParam,
|
||||
form: {},
|
||||
hasSaveContinue: false,
|
||||
method: 'get',
|
||||
hasReset: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
fields() {
|
||||
return [['', this.formData.map(item => item.var_name)]]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
confirm(form) {
|
||||
this.$emit('confirm', form)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
.variable-set {
|
||||
::v-deep .el-form-item {
|
||||
margin-bottom: 5px;
|
||||
|
||||
.help-block {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .form-group-header {
|
||||
.hr-line-dashed {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -78,7 +78,7 @@ export default {
|
||||
formatterData = data
|
||||
}
|
||||
return (
|
||||
<span style={{ whiteSpace: 'pre-wrap', wordBreak: 'break-word', lineHeight: '1.2' }}>{formatterData}</span>
|
||||
<span style={{ whiteSpace: 'pre-wrap', lineHeight: '1.2' }}>{formatterData}</span>
|
||||
)
|
||||
}
|
||||
if (this.value instanceof Array) {
|
||||
@@ -92,7 +92,7 @@ export default {
|
||||
)
|
||||
}
|
||||
return (
|
||||
<span style='white-space: pre-wrap;' title={this.displayValue}>{this.displayValue}</span>
|
||||
<span title={this.displayValue}>{this.displayValue}</span>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ export default {
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:value', val)
|
||||
this.$emit('input', val)
|
||||
this.$emit('change', val)
|
||||
}
|
||||
},
|
||||
iOptions() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div :class="showSetting ? 'show-setting' : 'hide-setting'">
|
||||
<div v-if="!loading" :class="showSetting ? 'show-setting' : 'hide-setting'">
|
||||
<div v-for="(item, index) in items" :key="item.name" class="protocol-item">
|
||||
<el-input
|
||||
v-model="item.port"
|
||||
@@ -114,7 +114,8 @@ export default {
|
||||
name: '',
|
||||
items: [],
|
||||
currentProtocol: {},
|
||||
showDialog: false
|
||||
showDialog: false,
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -143,8 +144,10 @@ export default {
|
||||
watch: {
|
||||
choices: {
|
||||
handler(value, oldValue) {
|
||||
this.loading = true
|
||||
setTimeout(() => {
|
||||
this.setDefaultItems(value)
|
||||
this.loading = false
|
||||
},)
|
||||
},
|
||||
deep: true,
|
||||
|
||||
@@ -39,22 +39,6 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
html:lang(en) .quick-actions ::v-deep button {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
html:lang(ja) .quick-actions ::v-deep button {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
html:lang(zh-tw) .quick-actions ::v-deep button {
|
||||
width: 65px;
|
||||
}
|
||||
|
||||
html:lang(zh-cn) .quick-actions ::v-deep button {
|
||||
width: 65px;
|
||||
}
|
||||
|
||||
.quick-actions ::v-deep table {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -74,6 +58,7 @@ export default {
|
||||
.quick-actions ::v-deep button {
|
||||
padding: 4px 5px;
|
||||
font-size: 13px;
|
||||
width: 65px;
|
||||
|
||||
span {
|
||||
overflow: hidden;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
v-if="showColumnSettingPopover"
|
||||
:cancel-title="$tc('RestoreDefault')"
|
||||
:destroy-on-close="true"
|
||||
:title="$tc('ListPreference')"
|
||||
:title="$tc('TableSetting')"
|
||||
:visible.sync="showColumnSettingPopover"
|
||||
top="10%"
|
||||
width="50%"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
@select="selectStrategy.onSelect"
|
||||
v-on="$listeners"
|
||||
@selection-change="selectStrategy.onSelectionChange"
|
||||
@select-all="handleSelectAll($event, canSelect)"
|
||||
@select-all="selectStrategy.onSelectAll($event, canSelect)"
|
||||
@sort-change="onSortChange"
|
||||
>
|
||||
<!--TODO 不用jsx写, 感觉template逻辑有点不清晰了-->
|
||||
@@ -1106,12 +1106,6 @@ export default {
|
||||
this.page = val
|
||||
this.getList()
|
||||
},
|
||||
handleSelectAll(e, canSelect) {
|
||||
this.loading = true
|
||||
this.selectStrategy.onSelectAll(e, canSelect, () => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 切换某一行的选中状态,如果使用了第二个参数,则是设置这一行选中与否
|
||||
*
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
* 多选策略接口
|
||||
*/
|
||||
class StrategyAbstract {
|
||||
cachedSelectedData = []
|
||||
|
||||
constructor(elDataTable) {
|
||||
this.elDataTable = elDataTable
|
||||
// 绑定this后可直接在template中使用
|
||||
@@ -36,14 +34,12 @@ class StrategyNormal extends StrategyAbstract {
|
||||
onSelectionChange(val) {
|
||||
this.elDataTable.selected = val
|
||||
}
|
||||
|
||||
/**
|
||||
* toggleRowSelection和clearSelection的表现与el-table一致
|
||||
*/
|
||||
toggleRowSelection(...args) {
|
||||
return this.elTable.toggleRowSelection(...args)
|
||||
}
|
||||
|
||||
clearSelection() {
|
||||
return this.elTable.clearSelection()
|
||||
}
|
||||
@@ -54,12 +50,12 @@ class StrategyNormal extends StrategyAbstract {
|
||||
*/
|
||||
class StrategyPersistSelection extends StrategyAbstract {
|
||||
/**
|
||||
* el-table 的 selection-change 事件不适用于开启跨页保存的情况。
|
||||
* 比如,当开启 persistSelection时,发生以下两个场景:
|
||||
* el-table的selection-change事件不适用于开启跨页保存的情况。
|
||||
* 比如,当开启persistSelection时,发生以下两个场景:
|
||||
* 1. 用户点击翻页
|
||||
* 2. 用户点击行首的切换全选项按钮,清空当前页多选项数据
|
||||
* 其中场景 1 应该保持 selected 不变;而场景 2 只应该从 selected 移除当前页所有行,保留其他页面的多选状态。
|
||||
* 但 el-table 的 selection-change 事件在两个场景中无差别发生,所以这里不处理这个事件
|
||||
* 其中场景1应该保持selected不变;而场景2只应该从selected移除当前页所有行,保留其他页面的多选状态。
|
||||
* 但el-table的selection-change事件在两个场景中无差别发生,所以这里不处理这个事件
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -67,108 +63,53 @@ class StrategyPersistSelection extends StrategyAbstract {
|
||||
*/
|
||||
onSelect(selection, row) {
|
||||
const isChosen = selection.indexOf(row) > -1
|
||||
|
||||
this.toggleRowSelection(row, isChosen)
|
||||
}
|
||||
/**
|
||||
* 用户切换当前页的多选
|
||||
*/
|
||||
onSelectAll(selection, selectable = () => true, callback) {
|
||||
const { id, selected, data } = this.elDataTable
|
||||
|
||||
const selectedIds = new Set(selected.map(r => r[id]))
|
||||
|
||||
// 获取当前所有已选择的项
|
||||
const selectedRows = data.filter(r => selection.includes(r))
|
||||
|
||||
// 判断是否已全选
|
||||
const isSelected = data.every(r => selectable(r) && selectedRows.includes(r))
|
||||
|
||||
const rowsToSelect = []
|
||||
const rowsToDeselect = []
|
||||
|
||||
data.forEach(r => {
|
||||
onSelectAll(selection, selectable = () => true) {
|
||||
const isSelected = !!selection.length
|
||||
this.elDataTable.data.forEach(r => {
|
||||
if (selectable(r)) {
|
||||
const isRowSelected = selectedIds.has(r[id])
|
||||
|
||||
if (isSelected && !isRowSelected) {
|
||||
rowsToSelect.push(r)
|
||||
} else if (!isSelected && isRowSelected) {
|
||||
rowsToDeselect.push(r)
|
||||
}
|
||||
this.toggleRowSelection(r, isSelected)
|
||||
}
|
||||
})
|
||||
|
||||
if (isSelected) {
|
||||
rowsToSelect.forEach(row => {
|
||||
selected.push(row)
|
||||
selectedIds.add(row[id])
|
||||
})
|
||||
rowsToDeselect.forEach(row => {
|
||||
this.elDataTable.toggleRowSelection(row, true)
|
||||
})
|
||||
} else {
|
||||
rowsToDeselect.forEach(row => {
|
||||
const index = selected.findIndex(item => item[id] === row[id])
|
||||
if (index !== -1) {
|
||||
selected.splice(index, 1)
|
||||
}
|
||||
selectedIds.delete(row[id])
|
||||
})
|
||||
rowsToSelect.forEach(row => {
|
||||
this.elDataTable.toggleRowSelection(row, false)
|
||||
})
|
||||
}
|
||||
|
||||
// this.elTable.selected = Array.from(selectedIds).map(id => {
|
||||
// return data.find(r => r[id] === id)
|
||||
// })
|
||||
|
||||
callback()
|
||||
}
|
||||
/**
|
||||
* toggleRowSelection 和 clearSelection 管理 elDataTable 的 selected 数组
|
||||
* 记得最后要将状态同步到 el-table 中
|
||||
* toggleRowSelection和clearSelection管理elDataTable的selected数组
|
||||
* 记得最后要将状态同步到el-table中
|
||||
*/
|
||||
toggleRowSelection(row, isSelected) {
|
||||
const { id, selected } = this.elDataTable
|
||||
const foundIndex = selected.findIndex(r => r[id] === row[id])
|
||||
|
||||
if (typeof isSelected === 'undefined') {
|
||||
isSelected = foundIndex <= -1
|
||||
}
|
||||
|
||||
if (isSelected && foundIndex === -1) {
|
||||
selected.push(row)
|
||||
} else if (!isSelected && foundIndex > -1) {
|
||||
selected.splice(foundIndex, 1)
|
||||
}
|
||||
|
||||
this.elDataTable.$emit('toggle-row-selection', isSelected, row)
|
||||
this.updateElTableSelection()
|
||||
}
|
||||
|
||||
clearSelection() {
|
||||
this.elDataTable.selected = []
|
||||
this.updateElTableSelection()
|
||||
}
|
||||
|
||||
/**
|
||||
* 将selected状态同步到el-table中
|
||||
*/
|
||||
updateElTableSelection() {
|
||||
const { data, id, selected } = this.elDataTable
|
||||
|
||||
// 历史勾选的行已经不在当前页了,所以要将当前页的行数据和selected合并
|
||||
const mergeData = _.uniqWith([...data, ...selected], _.isEqual)
|
||||
|
||||
mergeData.forEach(r => {
|
||||
const isSelected = !!selected.find(r2 => r[id] === r2[id])
|
||||
|
||||
if (!this.elTable) {
|
||||
return
|
||||
}
|
||||
|
||||
this.elTable.toggleRowSelection(r, isSelected)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ export default {
|
||||
{
|
||||
name: 'actionSetting',
|
||||
icon: 'system-setting',
|
||||
tip: this.$t('ListPreference'),
|
||||
tip: this.$t('TableSetting'),
|
||||
has: this.hasColumnSetting,
|
||||
callback: this.handleTableSettingClick.bind(this)
|
||||
},
|
||||
|
||||
@@ -24,9 +24,6 @@ export default {
|
||||
},
|
||||
isDisplay(row) {
|
||||
return true
|
||||
},
|
||||
callback({ row }) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,11 +49,10 @@ export default {
|
||||
methods: {
|
||||
onChange(val) {
|
||||
this.$axios.patch(this.patchUrl, this.patchData).then(res => {
|
||||
this.formatterArgs.callback(this.row)
|
||||
this.$message.success(this.$t('UpdateSuccessMsg'))
|
||||
this.$message.success(this.$t('updateSuccessMsg'))
|
||||
}).catch(err => {
|
||||
this.value = !val
|
||||
this.$message.error(this.$t('UpdateErrorMsg' + ' ' + err))
|
||||
this.$message.error(this.$t('updateErrorMsg' + ' ' + err))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,10 +202,9 @@ export default {
|
||||
label: current.label,
|
||||
value: valueDecode
|
||||
}
|
||||
|
||||
if (curChildren.length > 0) {
|
||||
for (const item of curChildren) {
|
||||
if (valueDecode === String(item.value)) {
|
||||
if (valueDecode === item.value) {
|
||||
searchFieldOption.valueLabel = item.label
|
||||
break
|
||||
}
|
||||
@@ -235,10 +234,12 @@ export default {
|
||||
delete routeFilter.search
|
||||
}
|
||||
const asFilterTags = _.cloneDeep(this.filterTags)
|
||||
this.filterTags = {
|
||||
...asFilterTags,
|
||||
...routeFilter
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.filterTags = {
|
||||
...asFilterTags,
|
||||
...routeFilter
|
||||
}
|
||||
}, 100)
|
||||
},
|
||||
getValueLabel(key, value) {
|
||||
for (const field of this.options) {
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
import VueCookie from 'vue-cookie'
|
||||
import store from '@/store'
|
||||
|
||||
export function getLangCode(withInternalCode = false) {
|
||||
export function getLangCode() {
|
||||
const cookieLang = VueCookie.get('django_language')
|
||||
let lang = cookieLang || navigator.language.toLowerCase()
|
||||
if (withInternalCode) {
|
||||
const languages = store.getters.publicSettings['LANGUAGES']
|
||||
for (const langObj of languages) {
|
||||
if (langObj['other_codes'].indexOf(lang) > -1) {
|
||||
lang = langObj['code']
|
||||
break
|
||||
}
|
||||
}
|
||||
const browserLang = navigator.systemLanguage || navigator.language || navigator.userLanguage
|
||||
let lang = cookieLang || browserLang || 'en'
|
||||
lang = lang.replace('-', '_')
|
||||
if (lang !== 'zh_hant') {
|
||||
lang = lang.slice(0, 2)
|
||||
}
|
||||
return lang
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ export default {
|
||||
<style lang="scss" scoped>
|
||||
.app-main {
|
||||
background-color: #f3f3f4;
|
||||
height: 100vh !important;
|
||||
height: 100% !important;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
overflow: auto;
|
||||
|
||||
@@ -71,7 +71,7 @@ export default {
|
||||
},
|
||||
async logout() {
|
||||
const currentOrg = this.$store.getters.currentOrg
|
||||
if (currentOrg.autoEnter || currentOrg.is_system) {
|
||||
if (currentOrg.autoEnter) {
|
||||
await this.$store.dispatch('users/setCurrentOrg', this.$store.getters.preOrg)
|
||||
}
|
||||
window.location.href = `${process.env.VUE_APP_LOGOUT_PATH}?next=${this.$route.fullPath}`
|
||||
|
||||
@@ -25,6 +25,7 @@ export default {
|
||||
return {
|
||||
langCookeName: 'django_language', // 后端Django需要的COOKIE KEY
|
||||
supportLanguages: [],
|
||||
currentLangCode: '',
|
||||
defaultLang: {
|
||||
title: 'English',
|
||||
code: 'en',
|
||||
@@ -40,25 +41,41 @@ export default {
|
||||
}, {})
|
||||
},
|
||||
currentLang() {
|
||||
const lang = getLangCode(true)
|
||||
return this.supportedLangMapper[lang] || this.defaultLang
|
||||
const lang = this.supportedLangMapper[this.currentLangCode] || this.defaultLang
|
||||
return lang
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.currentLangCode = getLangCode()
|
||||
this.supportLanguages = store.getters.publicSettings['LANGUAGES'].map(item => {
|
||||
let code = item.code.replace('-', '_')
|
||||
if (code !== 'zh_hant') {
|
||||
code = code.slice(0, 2)
|
||||
}
|
||||
return {
|
||||
title: item.name,
|
||||
code: item.code,
|
||||
code: code,
|
||||
cookieCode: item.code
|
||||
}
|
||||
})
|
||||
this.changeMomentLang()
|
||||
},
|
||||
methods: {
|
||||
changeLang() {
|
||||
if (this.currentLang.code !== this.$i18n.locale) {
|
||||
this.changeLangTo(this.currentLang)
|
||||
}
|
||||
},
|
||||
changeMomentLang() {
|
||||
const lang = getLangCode()
|
||||
this.$moment.locale(lang)
|
||||
document.documentElement.lang = lang
|
||||
if (this.currentLang.code.indexOf('en') > -1) {
|
||||
this.$moment.locale('en')
|
||||
} else if (this.currentLang.code.indexOf('ja') > -1) {
|
||||
this.$moment.locale('ja')
|
||||
} else if (this.currentLang.code.indexOf('zh_hant') > -1) {
|
||||
this.$moment.locale('zh-tw')
|
||||
} else {
|
||||
this.$moment.locale('zh-cn')
|
||||
}
|
||||
},
|
||||
changeLangTo(item) {
|
||||
this.$axios.get(`/core/i18n/${item.cookieCode}/`).then(() => {
|
||||
|
||||
@@ -116,6 +116,7 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
height: calc(100vh - 50px);
|
||||
overflow-y: hidden;
|
||||
overflow-x: hidden;
|
||||
|
||||
|
||||
@@ -80,5 +80,15 @@ export default [
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'job-execution-log',
|
||||
name: 'JobExecutionLog',
|
||||
component: () => import('@/views/audits/JobExecutionLogList'),
|
||||
meta: {
|
||||
title: i18n.t('JobExecutionLog'),
|
||||
icon: 'task',
|
||||
permissions: ['audits.view_joblog']
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -3,7 +3,6 @@ import i18n from '@/i18n/i18n'
|
||||
|
||||
import SessionRoutes from './sessions'
|
||||
import LogRoutes from './audits'
|
||||
import JobRoutes from './jobs'
|
||||
import empty from '@/layout/empty'
|
||||
import store from '@/store'
|
||||
|
||||
@@ -55,18 +54,6 @@ export default {
|
||||
permissions: []
|
||||
},
|
||||
children: LogRoutes
|
||||
},
|
||||
{
|
||||
path: '/audit/jobs',
|
||||
component: empty,
|
||||
redirect: '',
|
||||
name: 'AuditsJobs',
|
||||
meta: {
|
||||
title: i18n.t('JobsAudit'),
|
||||
icon: 'job',
|
||||
permissions: ['audits.view_joblog']
|
||||
},
|
||||
children: JobRoutes
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
import i18n from '@/i18n/i18n'
|
||||
import empty from '@/layout/empty'
|
||||
|
||||
export default [
|
||||
{
|
||||
path: 'job-list',
|
||||
name: 'JobList',
|
||||
component: empty,
|
||||
redirect: {
|
||||
name: 'JobList'
|
||||
},
|
||||
meta: {
|
||||
title: i18n.t('JobList'),
|
||||
icon: 'task',
|
||||
permissions: ['audits.view_joblog']
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'AuditJobList',
|
||||
component: () => import('@/views/audits/JobPeriodTaskList'),
|
||||
meta: {
|
||||
title: i18n.t('JobList'),
|
||||
permissions: []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'job-execution-log',
|
||||
name: 'JobExecutionLog',
|
||||
component: empty,
|
||||
redirect: {
|
||||
name: 'AuditJobExecutionLog'
|
||||
},
|
||||
meta: {
|
||||
title: i18n.t('JobExecutionLog'),
|
||||
icon: 'history',
|
||||
permissions: ['audits.view_joblog']
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'AuditJobExecutionLog',
|
||||
component: () => import('@/views/audits/JobExecutionLogList'),
|
||||
meta: {
|
||||
title: i18n.t('JobExecutionLog'),
|
||||
permissions: ['audits.view_joblog']
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -2,6 +2,7 @@ import i18n from '@/i18n/i18n'
|
||||
import empty from '@/layout/empty'
|
||||
import XPackRoutes from './xpack'
|
||||
|
||||
const globalSubmenu = () => import('@/layout/globalOrg.vue')
|
||||
export default [
|
||||
{
|
||||
path: 'assets',
|
||||
@@ -293,11 +294,12 @@ export default [
|
||||
},
|
||||
{
|
||||
path: 'platforms',
|
||||
component: empty,
|
||||
component: globalSubmenu,
|
||||
meta: {
|
||||
permissions: ['assets.view_platform'],
|
||||
resource: 'platform',
|
||||
icon: 'platform'
|
||||
icon: 'platform',
|
||||
disableOrgsChange: true
|
||||
},
|
||||
redirect: '',
|
||||
children: [
|
||||
|
||||
@@ -71,11 +71,10 @@ const mutations = {
|
||||
state.consoleOrgs = state.consoleOrgs.filter(i => i.id !== org.id)
|
||||
},
|
||||
SET_CURRENT_ORG(state, org) {
|
||||
// 系统组织不设置成 Pre org
|
||||
const currentOrg = state.currentOrg
|
||||
if (currentOrg && !currentOrg.autoEnter && !currentOrg.is_system) {
|
||||
state.preOrg = currentOrg
|
||||
setPreOrgLocal(state.username, currentOrg)
|
||||
// 系统组织和全局组织不设置成 Pre org
|
||||
if (!state.currentOrg?.autoEnter && !state.currentOrg?.is_root) {
|
||||
state.preOrg = state.currentOrg
|
||||
setPreOrgLocal(state.username, state.currentOrg)
|
||||
}
|
||||
state.currentOrg = org
|
||||
saveCurrentOrgLocal(state.username, org)
|
||||
@@ -145,7 +144,6 @@ const actions = {
|
||||
const systemOrg = {
|
||||
id: orgUtil.SYSTEM_ORG_ID,
|
||||
name: 'SystemSetting',
|
||||
is_system: true,
|
||||
autoEnter: new Date().getTime()
|
||||
}
|
||||
commit('SET_CURRENT_ORG', systemOrg)
|
||||
|
||||
@@ -42,13 +42,8 @@ export function getCurrentOrgLocal(username) {
|
||||
|
||||
export function saveCurrentOrgLocal(username, org) {
|
||||
const key = CURRENT_ORG_KEY + ':' + username
|
||||
if (org) {
|
||||
localStorage.setItem(key, JSON.stringify(org))
|
||||
VueCookie.set('X-JMS-ORG', org.id)
|
||||
} else {
|
||||
localStorage.removeItem(key)
|
||||
VueCookie.delete('X-JMS-ORG')
|
||||
}
|
||||
localStorage.setItem(key, JSON.stringify(org))
|
||||
VueCookie.set('X-JMS-ORG', org.id)
|
||||
}
|
||||
|
||||
export function setPreOrgLocal(username, org) {
|
||||
|
||||
@@ -222,32 +222,16 @@ export function download(downloadUrl, filename) {
|
||||
const iframe = document.createElement('iframe')
|
||||
iframe.style.display = 'none'
|
||||
document.body.appendChild(iframe)
|
||||
const timeout = 1000 * 60 * 30
|
||||
|
||||
const a = document.createElement('a')
|
||||
a.href = downloadUrl
|
||||
if (filename) {
|
||||
fetch(downloadUrl)
|
||||
.then(response => response.blob())
|
||||
.then(blob => {
|
||||
const url = URL.createObjectURL(blob)
|
||||
const a = iframe.contentWindow.document.createElement('a')
|
||||
a.href = url
|
||||
a.download = filename
|
||||
iframe.contentWindow.document.body.appendChild(a)
|
||||
a.click()
|
||||
setTimeout(() => {
|
||||
URL.revokeObjectURL(url)
|
||||
document.body.removeChild(iframe)
|
||||
}, timeout) // If you can't download it in half an hour, don't download it.
|
||||
})
|
||||
.catch(() => {
|
||||
document.body.removeChild(iframe)
|
||||
})
|
||||
} else {
|
||||
iframe.src = downloadUrl
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(iframe)
|
||||
}, timeout) // If you can't download it in half an hour, don't download it.
|
||||
a.download = filename
|
||||
}
|
||||
iframe.contentWindow.document.body.appendChild(a)
|
||||
a.click()
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(iframe)
|
||||
}, 1000 * 60 * 30) // If you can't download it in half an hour, don't download it.
|
||||
}
|
||||
|
||||
export function diffObject(object, base) {
|
||||
|
||||
@@ -17,7 +17,7 @@ function getPropOrg() {
|
||||
if (defaultOrg) {
|
||||
return defaultOrg
|
||||
}
|
||||
return orgs.filter(item => !item['is_root'] && !item['is_system'])[0]
|
||||
return orgs.filter(item => !item['is_root'] && item.id !== SYSTEM_ORG_ID)[0]
|
||||
}
|
||||
|
||||
async function change2PropOrg() {
|
||||
|
||||
@@ -89,18 +89,10 @@ function ifBadRequest({ response, error }) {
|
||||
}
|
||||
}
|
||||
|
||||
export function logout() {
|
||||
window.location.href = `${process.env.VUE_APP_LOGOUT_PATH}?next=${router.fullPath}`
|
||||
}
|
||||
|
||||
export function flashErrorMsg({ response, error }) {
|
||||
if (!response.config.disableFlashErrorMsg) {
|
||||
const responseErrorMsg = getErrorResponseMsg(error)
|
||||
const msg = responseErrorMsg || error.message
|
||||
|
||||
if (response.status === 403 && msg === 'CSRF Failed: CSRF token missing.') {
|
||||
setTimeout(() => { logout() }, 1000)
|
||||
}
|
||||
message({
|
||||
message: msg,
|
||||
type: 'error',
|
||||
|
||||
@@ -8,10 +8,7 @@ import orgs from '@/api/orgs'
|
||||
import { getPropView, isViewHasOrgs } from '@/utils/jms'
|
||||
|
||||
const whiteList = ['/login', process.env.VUE_APP_LOGIN_PATH] // no redirect whitelist
|
||||
const autoEnterOrgs = [
|
||||
'00000000-0000-0000-0000-000000000001',
|
||||
'00000000-0000-0000-0000-000000000000'
|
||||
]
|
||||
const autoEnterOrgs = ['00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000000']
|
||||
|
||||
function reject(msg) {
|
||||
return new Promise((resolve, reject) => reject(msg))
|
||||
@@ -173,24 +170,19 @@ export async function startup({ to, from, next }) {
|
||||
if (store.getters.inited) {
|
||||
return true
|
||||
}
|
||||
await store.dispatch('app/init')
|
||||
|
||||
try {
|
||||
await store.dispatch('app/init')
|
||||
|
||||
// set page title
|
||||
// await getOpenPublicSetting({ to, from, next })
|
||||
await getPublicSetting({ to, from, next }, true)
|
||||
await checkLogin({ to, from, next })
|
||||
await onI18nLoaded()
|
||||
await getPublicSetting({ to, from, next }, false)
|
||||
await changeCurrentViewIfNeed({ to, from, next })
|
||||
await changeCurrentOrgIfNeed({ to, from, next })
|
||||
await generatePageRoutes({ to, from, next })
|
||||
await checkUserFirstLogin({ to, from, next })
|
||||
await store.dispatch('assets/getAssetCategories')
|
||||
} catch (e) {
|
||||
Vue.$log.error('Startup error: ', e)
|
||||
}
|
||||
// set page title
|
||||
// await getOpenPublicSetting({ to, from, next })
|
||||
await getPublicSetting({ to, from, next }, true)
|
||||
await checkLogin({ to, from, next })
|
||||
await onI18nLoaded()
|
||||
await getPublicSetting({ to, from, next }, false)
|
||||
await changeCurrentViewIfNeed({ to, from, next })
|
||||
await changeCurrentOrgIfNeed({ to, from, next })
|
||||
await generatePageRoutes({ to, from, next })
|
||||
await checkUserFirstLogin({ to, from, next })
|
||||
await store.dispatch('assets/getAssetCategories')
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const moment = require('moment')
|
||||
import { getLangCode } from '@/i18n/utils'
|
||||
import store from '@/store'
|
||||
|
||||
function getTimeUnits(u) {
|
||||
const units = {
|
||||
@@ -9,7 +8,7 @@ function getTimeUnits(u) {
|
||||
'm': '分',
|
||||
's': '秒'
|
||||
}
|
||||
if (getLangCode(true) === 'zh-hans') {
|
||||
if (getLangCode() === 'zh') {
|
||||
return units[u]
|
||||
} else {
|
||||
return u
|
||||
@@ -125,8 +124,3 @@ export function formatDate(inputTime) {
|
||||
// return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second
|
||||
return y + '-' + m + '-' + d + 'T' + h + ':' + minute + ':' + second
|
||||
}
|
||||
|
||||
export function getDefaultExpiredDays() {
|
||||
const years = store.getters.publicSettings.DEFAULT_EXPIRED_YEARS
|
||||
return getDayFuture(years * 365, new Date()).toISOString()
|
||||
}
|
||||
|
||||
@@ -66,8 +66,7 @@ export const getChangeSecretFields = () => {
|
||||
is_periodic,
|
||||
accounts: {
|
||||
label: i18n.t('Accounts'),
|
||||
component: TagInput,
|
||||
helpText: i18n.t('ChangeSecretAccountHelpText')
|
||||
component: TagInput
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,10 @@ import InputWithUnit from '@/components/Form/FormFields/InputWithUnit.vue'
|
||||
import store from '@/store'
|
||||
|
||||
const validatorInterval = (rule, value, callback) => {
|
||||
// value只能是 null 或者 >=1
|
||||
if (value === null || (!isNaN(value) && Number(value) >= 1)) {
|
||||
callback()
|
||||
} else {
|
||||
callback(new Error(i18n.t('EnsureThisValueIsGreaterThanOrEqualTo1')))
|
||||
if (isNaN(parseInt(value, 10)) || parseInt(value) < 1) {
|
||||
return callback(new Error(i18n.t('EnsureThisValueIsGreaterThanOrEqualTo1')))
|
||||
}
|
||||
callback()
|
||||
}
|
||||
|
||||
export const crontab = {
|
||||
|
||||
@@ -76,20 +76,14 @@ export default {
|
||||
},
|
||||
callbacks: {
|
||||
change: function(val) {
|
||||
this.updateTaskData({ 'sync_ip_type': val })
|
||||
}.bind(this)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('ReleaseAssets'),
|
||||
type: 'switch',
|
||||
attrs: {
|
||||
model: this.object.task.release_assets,
|
||||
disabled: !this.hasEditPerm()
|
||||
},
|
||||
callbacks: {
|
||||
change: function(val) {
|
||||
this.updateTaskData({ 'release_assets': val })
|
||||
this.$axios.patch(
|
||||
`/api/v1/xpack/cloud/sync-instance-tasks/${this.object.task.id}/`,
|
||||
{ 'sync_ip_type': val }
|
||||
).then(res => {
|
||||
this.$message.success(this.$t('UpdateSuccessMsg'))
|
||||
}).catch(err => {
|
||||
this.$message.error(this.$t('UpdateErrorMsg' + ' ' + err))
|
||||
})
|
||||
}.bind(this)
|
||||
}
|
||||
}
|
||||
@@ -203,16 +197,6 @@ export default {
|
||||
methods: {
|
||||
hasEditPerm() {
|
||||
return this.$hasPerm('xpack.change_account') && this.$hasPerm('xpack.change_syncinstancetask')
|
||||
},
|
||||
updateTaskData(data) {
|
||||
this.$axios.patch(
|
||||
`/api/v1/xpack/cloud/sync-instance-tasks/${this.object.task.id}/`,
|
||||
data
|
||||
).then(res => {
|
||||
this.$message.success(this.$tc('UpdateSuccessMsg'))
|
||||
}).catch(err => {
|
||||
this.$message.error(this.$tc('UpdateErrorMsg' + ' ' + err))
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ export default {
|
||||
url: '/api/v1/assets/domains/',
|
||||
columnsExclude: ['gateway'],
|
||||
columnsExtra: ['gateways'],
|
||||
columns: ['name', 'assets_amount', 'gateways', 'labels', 'comment', 'actions'],
|
||||
columns: ['name', 'assets_amount', 'gateways', 'comment', 'actions'],
|
||||
columnsShow: {
|
||||
min: ['name', 'actions'],
|
||||
default: ['name', 'assets_amount', 'gateways', 'comment', 'actions']
|
||||
|
||||
@@ -122,7 +122,7 @@ export default {
|
||||
},
|
||||
onCanSetting() {
|
||||
const filterField = Object.keys(this.remoteMeta)
|
||||
this.canSetting = filterField.includes(this.method) && this.$hasPerm('assets.change_platform')
|
||||
this.canSetting = filterField.includes(this.method)
|
||||
this.$emit('canSetting', this.canSetting)
|
||||
return this.canSetting
|
||||
},
|
||||
|
||||
@@ -27,7 +27,6 @@ export default {
|
||||
}
|
||||
},
|
||||
data() {
|
||||
const canEdit = !this.object['internal'] && this.$hasPerm('assets.change_platform')
|
||||
return {
|
||||
loading: true,
|
||||
initial: {
|
||||
@@ -36,14 +35,14 @@ export default {
|
||||
}
|
||||
},
|
||||
url: `/api/v1/assets/platforms/`,
|
||||
disabled: !canEdit,
|
||||
disabled: this.object.internal,
|
||||
hasReset: false,
|
||||
hasDetailInMsg: false,
|
||||
submitMethod: () => 'patch',
|
||||
fields: [['', ['automation']]],
|
||||
fieldsMeta: platformFieldsMeta(this),
|
||||
onSubmit: this.submit,
|
||||
canSubmit: canEdit,
|
||||
canSubmit: !this.object.internal,
|
||||
defaultOptions: {},
|
||||
afterGetFormValue: (obj) => {
|
||||
updateAutomationParams(this, obj)
|
||||
@@ -66,7 +65,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
submit(validValues) {
|
||||
if (!this.canSubmit || !this.isSystemAdmin) {
|
||||
if (!this.$hasPerm('assets.change_platform') || !this.isSystemAdmin) {
|
||||
return this.$message.error(this.$tc('NoPermission'))
|
||||
}
|
||||
this.$axios.patch(`${this.url}${this.object.id}/`, validValues).then(() => {
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
v-if="protocolChoices"
|
||||
v-model="object.protocols"
|
||||
:choices="protocolChoices"
|
||||
:readonly="!canEdit"
|
||||
:readonly="object['internal']"
|
||||
/>
|
||||
<el-button
|
||||
v-if="canEdit"
|
||||
v-if="!object.internal"
|
||||
size="small"
|
||||
style="margin-top: 10px"
|
||||
type="primary"
|
||||
@@ -71,8 +71,7 @@ export default {
|
||||
],
|
||||
|
||||
protocolChoices: null,
|
||||
constraints: {},
|
||||
canEdit: !this.object['internal'] && this.$hasPerm('assets.change_platform')
|
||||
constraints: {}
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
@@ -104,7 +103,7 @@ export default {
|
||||
attrs: {
|
||||
label: this.$t('Update'),
|
||||
model: object['domain_enabled'],
|
||||
disabled: !this.canEdit || this.constraints['domain_enabled'] === false
|
||||
disabled: object['internal'] || this.constraints['domain_enabled'] === false
|
||||
},
|
||||
callbacks: Object.freeze({
|
||||
change: (val) => {
|
||||
@@ -121,7 +120,7 @@ export default {
|
||||
type: 'switch',
|
||||
attrs: {
|
||||
model: object['su_enabled'],
|
||||
disabled: !this.canEdit || this.constraints['su_enabled'] === false
|
||||
disabled: object['internal'] || this.constraints['su_enabled'] === false
|
||||
},
|
||||
callbacks: Object.freeze({
|
||||
change: (val) => {
|
||||
@@ -137,8 +136,7 @@ export default {
|
||||
title: this.$t('SyncProtocolToAsset'),
|
||||
attrs: {
|
||||
type: 'primary',
|
||||
label: this.$t('Sync'),
|
||||
disabled: !this.canEdit
|
||||
label: this.$t('Sync')
|
||||
},
|
||||
callbacks: Object.freeze({
|
||||
click: () => {
|
||||
|
||||
@@ -42,7 +42,7 @@ function updatePlatformProtocols(vm, platformType, updateForm, isPlatformChanged
|
||||
'username_selector': setting.username_selector
|
||||
})
|
||||
}
|
||||
vm.iConfig.fieldsMeta.protocols.el.choices = platformProtocols
|
||||
vm.iConfig.fieldsMeta.protocols.el.choices = platformProtocols.map(item => ({ name: item.name, port: item.port }))
|
||||
updateForm({ protocols: [] })
|
||||
}), 100)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<GenericListPage ref="ListPage" :header-actions="headerActions" :table-config="tableConfig" />
|
||||
<GenericListPage :header-actions="headerActions" :table-config="tableConfig" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
import GenericListPage from '@/layout/components/GenericListPage'
|
||||
import { ActionsFormatter } from '@/components/Table/TableFormatters'
|
||||
import { openTaskPage } from '@/utils/jms'
|
||||
import { stopJob } from '@/api/ops'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -46,20 +45,6 @@ export default {
|
||||
callback: ({ row }) => {
|
||||
openTaskPage(row.task_id)
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('Stop'),
|
||||
name: 'stop',
|
||||
can: ({ row }) => {
|
||||
return !row.is_finished
|
||||
},
|
||||
type: 'danger',
|
||||
callback: ({ row }) => {
|
||||
stopJob({ task_id: row.task_id }).then(() => {
|
||||
this.$refs.ListPage.reloadTable()
|
||||
this.$message.success(this.$t('StopJobMsg'))
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<GenericListPage ref="ListPage" :header-actions="headerActions" :table-config="tableConfig" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script type="text/jsx">
|
||||
import GenericListPage from '@/layout/components/GenericListPage'
|
||||
import { SwitchFormatter } from '@/components/Table/TableFormatters'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
GenericListPage
|
||||
},
|
||||
data() {
|
||||
const vm = this
|
||||
return {
|
||||
tableConfig: {
|
||||
url: '/api/v1/audits/jobs/',
|
||||
columnsShow: {
|
||||
min: ['name', 'material'],
|
||||
default: [
|
||||
'name', 'material', 'type', 'crontab', 'interval', 'created_by', 'is_periodic_display', 'is_periodic'
|
||||
]
|
||||
},
|
||||
columns: [
|
||||
'name', 'args', 'material', 'type', 'crontab', 'interval', 'date_last_run', 'summary',
|
||||
'created_by', 'is_periodic_display', 'is_periodic'
|
||||
],
|
||||
columnsMeta: {
|
||||
actions: {
|
||||
has: false
|
||||
},
|
||||
name: {
|
||||
formatter: (row) => row.name
|
||||
},
|
||||
material: {
|
||||
width: '200px',
|
||||
label: this.$t('Command')
|
||||
},
|
||||
summary: {
|
||||
width: '130px',
|
||||
label: `${this.$t('Success')}/${this.$t('Total')}`,
|
||||
formatter: (row) => {
|
||||
return <div>
|
||||
<span Class='text-primary'>{row.summary.success}</span>/
|
||||
<span>{row.summary.total}</span>
|
||||
</div>
|
||||
}
|
||||
},
|
||||
is_periodic_display: {
|
||||
width: '100px',
|
||||
label: this.$t('Periodic')
|
||||
},
|
||||
is_periodic: {
|
||||
width: '140px',
|
||||
label: `${this.$t('Enable')}/${this.$t('Disable')}`,
|
||||
formatter: SwitchFormatter,
|
||||
formatterArgs: {
|
||||
isDisplay(row) {
|
||||
return row.is_periodic
|
||||
},
|
||||
getPatchUrl(row) {
|
||||
return `/api/v1/audits/jobs/${row.id}/`
|
||||
},
|
||||
getPatchData(row) {
|
||||
return {
|
||||
is_periodic: !row.is_periodic
|
||||
}
|
||||
},
|
||||
callback() {
|
||||
vm.$refs.ListPage.reloadTable()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
hasLeftActions: false,
|
||||
hasImport: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@@ -52,7 +52,6 @@ export default {
|
||||
title: this.$tc('Select'),
|
||||
name: 'select',
|
||||
can: true,
|
||||
type: 'primary',
|
||||
callback: ({ row }) => {
|
||||
this.$emit('select', row)
|
||||
this.iVisible = false
|
||||
|
||||
@@ -8,12 +8,6 @@
|
||||
:visible.sync="showOpenAdhocSaveDialog"
|
||||
/>
|
||||
<VariableHelpDialog :visible.sync="showHelpDialog" />
|
||||
<SetVariableDialog
|
||||
:form-data="variableFormData"
|
||||
:query-param="variableQueryParam"
|
||||
:visible.sync="showSetVariableDialog"
|
||||
@submit="onSubmitVariable"
|
||||
/>
|
||||
<AssetTreeTable ref="TreeTable" :tree-setting="treeSetting">
|
||||
<template slot="table">
|
||||
<div class="transition-box" style="width: calc(100% - 17px);">
|
||||
@@ -49,8 +43,7 @@ import Page from '@/layout/components/Page'
|
||||
import AdhocOpenDialog from './AdhocOpenDialog.vue'
|
||||
import AdhocSaveDialog from './AdhocSaveDialog.vue'
|
||||
import VariableHelpDialog from './VariableHelpDialog.vue'
|
||||
import SetVariableDialog from '@/views/ops/Template/components/SetVariableDialog.vue'
|
||||
import { createJob, getJob, getTaskDetail, stopJob } from '@/api/ops'
|
||||
import { createJob, getJob, getTaskDetail, StopJob } from '@/api/ops'
|
||||
|
||||
export default {
|
||||
name: 'CommandExecution',
|
||||
@@ -58,7 +51,6 @@ export default {
|
||||
VariableHelpDialog,
|
||||
AdhocSaveDialog,
|
||||
AdhocOpenDialog,
|
||||
SetVariableDialog,
|
||||
AssetTreeTable,
|
||||
Page,
|
||||
QuickJobTerm,
|
||||
@@ -78,7 +70,6 @@ export default {
|
||||
showHelpDialog: false,
|
||||
showOpenAdhocDialog: false,
|
||||
showOpenAdhocSaveDialog: false,
|
||||
showSetVariableDialog: false,
|
||||
DataZTree: 0,
|
||||
runas: '',
|
||||
runasPolicy: 'skip',
|
||||
@@ -102,10 +93,6 @@ export default {
|
||||
type: 'primary'
|
||||
},
|
||||
callback: () => {
|
||||
if (this.variableFormData.length !== 0) {
|
||||
this.showSetVariableDialog = true
|
||||
return
|
||||
}
|
||||
this.execute()
|
||||
}
|
||||
},
|
||||
@@ -310,9 +297,7 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
iShowTree: true,
|
||||
variableFormData: [],
|
||||
variableQueryParam: ''
|
||||
iShowTree: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -323,13 +308,6 @@ export default {
|
||||
return this.$refs.TreeTable.$refs.TreeList.$refs.AutoDataZTree.$refs.AutoDataZTree.$refs.dataztree.$refs.ztree
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
command(iNew, iOld) {
|
||||
if (iNew === '') {
|
||||
this.variableFormData = []
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.enableWS()
|
||||
this.initData()
|
||||
@@ -361,10 +339,6 @@ export default {
|
||||
}
|
||||
},
|
||||
onSelectAdhoc(adhoc) {
|
||||
this.variableFormData = adhoc?.variable.map((data) => {
|
||||
return data.form_data
|
||||
})
|
||||
this.variableQueryParam = 'adhoc=' + adhoc.id
|
||||
this.command = adhoc.args
|
||||
},
|
||||
enableWS() {
|
||||
@@ -458,6 +432,7 @@ export default {
|
||||
this.$message.error(this.$tc('RequiredRunas'))
|
||||
return
|
||||
}
|
||||
|
||||
const data = {
|
||||
assets: hosts,
|
||||
nodes: nodes,
|
||||
@@ -472,9 +447,6 @@ export default {
|
||||
if (this.chdir) {
|
||||
data.chdir = this.chdir
|
||||
}
|
||||
if (this.parameters) {
|
||||
data.parameters = this.parameters
|
||||
}
|
||||
createJob(data).then(res => {
|
||||
this.executionInfo.timeCost = 0
|
||||
this.executionInfo.status = { value: 'running', label: this.$t('Running') }
|
||||
@@ -486,9 +458,9 @@ export default {
|
||||
})
|
||||
},
|
||||
stop() {
|
||||
stopJob({ task_id: this.currentTaskId }).then(() => {
|
||||
StopJob({ task_id: this.currentTaskId }).then(() => {
|
||||
this.xterm.write('\x1b[31m' +
|
||||
this.$tc('StopLogOutput').replace('currentTaskId', this.currentTaskId) + '\x1b[0m')
|
||||
this.$tc('StopLogOutput').replace('currentTaskId', this.currentTaskId) + '\x1b[0m')
|
||||
this.xterm.write(this.wrapperError(''))
|
||||
this.getTaskStatus()
|
||||
}).catch((e) => {
|
||||
@@ -504,11 +476,6 @@ export default {
|
||||
}
|
||||
this.toolbar.left.run.isVisible = this.executionInfo.status.value === 'running'
|
||||
this.toolbar.left.stop.isVisible = this.executionInfo.status.value !== 'running'
|
||||
},
|
||||
onSubmitVariable(parameters) {
|
||||
this.parameters = parameters
|
||||
this.showSetVariableDialog = false
|
||||
this.execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,14 +28,11 @@ export default {
|
||||
columnsShow: {
|
||||
min: ['material', 'actions'],
|
||||
default: [
|
||||
'id', 'material', 'job_type', 'is_finished', 'is_success',
|
||||
'id', 'job', 'material', 'job_type', 'is_finished', 'is_success',
|
||||
'time_cost', 'date_created', 'actions'
|
||||
]
|
||||
},
|
||||
columnsMeta: {
|
||||
material: {
|
||||
width: '500px'
|
||||
},
|
||||
id: {
|
||||
formatter(row) {
|
||||
return row.id.slice(0, 8)
|
||||
@@ -47,7 +44,6 @@ export default {
|
||||
}
|
||||
},
|
||||
is_finished: {
|
||||
width: '100px',
|
||||
formatter: (row) => {
|
||||
if (row.is_finished) {
|
||||
return <i Class='fa fa-check text-primary'/>
|
||||
@@ -56,7 +52,6 @@ export default {
|
||||
}
|
||||
},
|
||||
is_success: {
|
||||
width: '100px',
|
||||
formatter: (row) => {
|
||||
if (!row.is_finished) {
|
||||
return <i Class='fa fa fa-spinner fa-spin'/>
|
||||
|
||||
@@ -535,7 +535,7 @@ export default {
|
||||
|
||||
.empty-file-tip {
|
||||
position: absolute;
|
||||
right: calc(50% - 230px);
|
||||
right: 20%;
|
||||
top: 50%;
|
||||
font-size: 18px;
|
||||
color: #c5c9cc;
|
||||
|
||||
@@ -3,25 +3,14 @@
|
||||
<el-col :md="16" :sm="24">
|
||||
<AutoDetailCard :fields="detailFields" :object="object" :url="url" />
|
||||
</el-col>
|
||||
<el-col :md="8" :sm="24">
|
||||
<IBox :title="$tc('Variable')">
|
||||
<Variable
|
||||
:value.sync="object.variable"
|
||||
@input="updateVariable"
|
||||
/>
|
||||
</IBox>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script type="text/jsx">
|
||||
import AutoDetailCard from '@/components/Cards/DetailCard/auto'
|
||||
import Variable from '@/views/ops/Template/components/Variable.vue'
|
||||
import { IBox } from '@/components'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
IBox, Variable,
|
||||
AutoDetailCard
|
||||
},
|
||||
props: {
|
||||
@@ -48,15 +37,7 @@ export default {
|
||||
return this.object.name
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateVariable() {
|
||||
const url = `/api/v1/ops/jobs/${this.object.id}/`
|
||||
this.$axios.patch(url, { variable: this.object.variable }).then(() => {
|
||||
this.$message.success(this.$tc('UpdateSuccessMsg'))
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -13,8 +13,6 @@ import i18n from '@/i18n/i18n'
|
||||
import VariableHelpDialog from '@/views/ops/Adhoc/VariableHelpDialog.vue'
|
||||
import { Required } from '@/components/Form/DataForm/rules'
|
||||
import { crontab, interval } from '@/views/accounts/const'
|
||||
import LoadTemplateLink from '@/views/ops/Job/components/LoadTemplateLink.vue'
|
||||
import Variable from '@/views/ops/Template/components/Variable'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -29,8 +27,8 @@ export default {
|
||||
url: '/api/v1/ops/jobs/',
|
||||
fields: [
|
||||
[this.$t('Basic'), ['name', 'type', 'instant']],
|
||||
[this.$t('Asset'), ['assets', 'nodes', 'runas', 'runas_policy']],
|
||||
[this.$t('Task'), ['module', 'argsLoadFromTemplate', 'args', 'playbook', 'variable', 'chdir', 'timeout', 'parameters']],
|
||||
[this.$t('Task'), ['module', 'args', 'playbook', 'chdir', 'timeout']],
|
||||
[this.$t('Asset'), ['assets', 'runas', 'runas_policy']],
|
||||
[this.$t('Plan'), ['run_after_save', 'is_periodic', 'interval', 'crontab']],
|
||||
[this.$t('Other'), ['comment']]
|
||||
],
|
||||
@@ -90,27 +88,13 @@ export default {
|
||||
return { label: item.name, value: item.id }
|
||||
}
|
||||
}
|
||||
},
|
||||
on: {
|
||||
change: ([event], updateForm) => {
|
||||
this.queryParam = `playbook=${event.pk}`
|
||||
this.$axios.get(`/api/v1/ops/playbooks/${event.pk}/`,
|
||||
).then(data => {
|
||||
data?.variable.map(item => {
|
||||
delete item.job
|
||||
delete item.playbook
|
||||
delete item.id
|
||||
return item
|
||||
})
|
||||
updateForm({ variable: data.variable })
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
assets: {
|
||||
type: 'assetSelect',
|
||||
component: AssetSelect,
|
||||
label: this.$t('Asset'),
|
||||
rules: [Required],
|
||||
el: {
|
||||
baseUrl: '/api/v1/perms/users/self/assets/',
|
||||
baseNodeUrl: '/api/v1/perms/users/self/nodes/',
|
||||
@@ -118,38 +102,6 @@ export default {
|
||||
value: []
|
||||
}
|
||||
},
|
||||
nodes: {
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '/api/v1/perms/users/self/nodes/',
|
||||
filterOption: (item) => {
|
||||
if (item.value !== 'favorite') {
|
||||
return item
|
||||
}
|
||||
},
|
||||
transformOption: (item) => {
|
||||
return { label: item.full_value || item.name, value: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
argsLoadFromTemplate: {
|
||||
label: this.$t('Templates'),
|
||||
hidden: (formValue) => {
|
||||
return formValue.type !== 'adhoc'
|
||||
},
|
||||
component: LoadTemplateLink,
|
||||
on: {
|
||||
change: ([event], updateForm) => {
|
||||
updateForm({
|
||||
args: event.args,
|
||||
module: event.module.value,
|
||||
variable: event.variable
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
args: {
|
||||
rules: [Required],
|
||||
hidden: (formValue) => {
|
||||
@@ -173,9 +125,6 @@ export default {
|
||||
]
|
||||
}
|
||||
},
|
||||
variable: {
|
||||
component: Variable
|
||||
},
|
||||
timeout: {
|
||||
helpText: i18n.t('TimeoutHelpText')
|
||||
},
|
||||
@@ -193,7 +142,7 @@ export default {
|
||||
run_after_save: {
|
||||
type: 'checkbox',
|
||||
hidden: (formValue) => {
|
||||
return true
|
||||
return this.instantTask
|
||||
}
|
||||
},
|
||||
is_periodic: {
|
||||
@@ -202,34 +151,11 @@ export default {
|
||||
return this.instantTask
|
||||
}
|
||||
},
|
||||
parameters: {
|
||||
hidden: () => {
|
||||
return true
|
||||
}
|
||||
},
|
||||
interval,
|
||||
crontab
|
||||
},
|
||||
createSuccessNextRoute: { name: 'JobManagement' },
|
||||
updateSuccessNextRoute: { name: 'JobManagement' },
|
||||
cleanFormValue: (data) => {
|
||||
Object.assign(data, { periodic_variable: this.periodicVariableValue })
|
||||
return data
|
||||
},
|
||||
moreButtons: [
|
||||
{
|
||||
title: this.$t('ExecuteAfterSaving'),
|
||||
callback: (value, form, btn) => {
|
||||
form.value.run_after_save = true
|
||||
const parameters = form.value.variable.reduce((acc, item) => {
|
||||
acc[item.var_name] = item.default_value
|
||||
return acc
|
||||
}, {})
|
||||
form.value['parameters'] = parameters
|
||||
this.submitForm(form, btn)
|
||||
}
|
||||
}
|
||||
]
|
||||
updateSuccessNextRoute: { name: 'JobManagement' }
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -266,16 +192,7 @@ export default {
|
||||
this.ready = true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm(form, btn) {
|
||||
form.validate((valid) => {
|
||||
if (valid) {
|
||||
btn.loading = true
|
||||
}
|
||||
})
|
||||
this.$refs.form.$refs.createUpdateForm.$refs.form.$refs.dataForm.submitForm('form', false)
|
||||
}
|
||||
}
|
||||
methods: {}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -1,16 +1,129 @@
|
||||
<template>
|
||||
<div>
|
||||
<BaseJob />
|
||||
<GenericListTable :header-actions="headerActions" :table-config="tableConfig" />
|
||||
<JobRunDialog v-if="showJobRunDialog" :item="item" :visible.sync="showJobRunDialog" @submit="runJob" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseJob from './BaseJob'
|
||||
import JobRunDialog from '@/views/ops/Job/JobRunDialog'
|
||||
import GenericListTable from '@/layout/components/GenericListTable'
|
||||
|
||||
import { openTaskPage } from '@/utils/jms'
|
||||
import { ActionsFormatter, DateFormatter, DetailFormatter } from '@/components/Table/TableFormatters'
|
||||
|
||||
export default {
|
||||
name: 'Adhoc',
|
||||
components: {
|
||||
BaseJob
|
||||
GenericListTable,
|
||||
JobRunDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
item: {},
|
||||
tableConfig: {
|
||||
url: '/api/v1/ops/jobs/?type=adhoc',
|
||||
columnsShow: {
|
||||
min: ['name', 'actions'],
|
||||
default: [
|
||||
'name', 'type', 'asset_amount', 'average_time_cost',
|
||||
'summary', 'date_last_run', 'actions'
|
||||
]
|
||||
},
|
||||
columns: [
|
||||
'name', 'type', 'summary', 'average_time_cost', 'asset_amount',
|
||||
'date_last_run', 'comment', 'date_updated', 'date_created', 'actions'
|
||||
],
|
||||
columnsMeta: {
|
||||
name: {
|
||||
width: '140px',
|
||||
formatter: DetailFormatter,
|
||||
formatterArgs: {
|
||||
can: true,
|
||||
getRoute: ({ row }) => ({
|
||||
name: 'JobDetail',
|
||||
params: { id: row.id }
|
||||
})
|
||||
}
|
||||
},
|
||||
type: {
|
||||
width: '96px',
|
||||
formatter: (row) => {
|
||||
return row.type.label
|
||||
}
|
||||
},
|
||||
comment: {
|
||||
width: '240px'
|
||||
},
|
||||
summary: {
|
||||
label: this.$t('Summary'),
|
||||
formatter: (row) => {
|
||||
return row.summary['success'] + '/' + row.summary['total']
|
||||
}
|
||||
},
|
||||
average_time_cost: {
|
||||
formatter: (row) => {
|
||||
return row.average_time_cost.toFixed(2) + 's'
|
||||
}
|
||||
},
|
||||
asset_amount: {
|
||||
label: this.$t('AssetsOfNumber'),
|
||||
formatter: (row) => {
|
||||
return row.assets.length
|
||||
}
|
||||
},
|
||||
date_last_run: {
|
||||
width: '140px',
|
||||
formatter: DateFormatter
|
||||
},
|
||||
actions: {
|
||||
formatter: ActionsFormatter,
|
||||
formatterArgs: {
|
||||
hasUpdate: true,
|
||||
canUpdate: this.$hasPerm('ops.change_job') && !this.$store.getters.currentOrgIsRoot,
|
||||
updateRoute: 'JobUpdate',
|
||||
hasDelete: true,
|
||||
canDelete: this.$hasPerm('ops.delete_job'),
|
||||
hasClone: false,
|
||||
extraActions: [
|
||||
{
|
||||
title: this.$t('Run'),
|
||||
name: 'run',
|
||||
can: this.$hasPerm('ops.add_jobexecution') && !this.$store.getters.currentOrgIsRoot,
|
||||
callback: ({ row }) => {
|
||||
if (row?.use_parameter_define && row?.parameters_define) {
|
||||
const params = JSON.parse(row.parameters_define)
|
||||
if (Object.keys(params).length > 0) {
|
||||
this.item = row
|
||||
this.showJobRunDialog = true
|
||||
}
|
||||
} else {
|
||||
this.runJob(row)
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
createRoute: 'JobCreate',
|
||||
hasRefresh: true,
|
||||
hasExport: false,
|
||||
hasImport: false
|
||||
},
|
||||
showJobRunDialog: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
runJob(row, parameters) {
|
||||
this.$axios.post('/api/v1/ops/job-executions/', {
|
||||
job: row.id,
|
||||
parameters: parameters
|
||||
}).then((resp) => {
|
||||
openTaskPage(resp.task_id)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<GenericListTable :header-actions="headerActions" :table-config="tableConfig" />
|
||||
<JobRunDialog v-if="showJobRunDialog" :item="item" :visible.sync="showJobRunDialog" @submit="runJob" />
|
||||
<SetVariableDialog
|
||||
v-if="showVariableDialog"
|
||||
:form-data="formData"
|
||||
:query-param="'job=' + item.id"
|
||||
:visible.sync="showVariableDialog"
|
||||
@submit="runJobWithParams"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import JobRunDialog from '@/views/ops/Job/JobRunDialog'
|
||||
import GenericListTable from '@/layout/components/GenericListTable'
|
||||
import SetVariableDialog from '@/views/ops/Template/components/SetVariableDialog.vue'
|
||||
import { openTaskPage } from '@/utils/jms'
|
||||
import { ActionsFormatter, DateFormatter, DetailFormatter } from '@/components/Table/TableFormatters'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
GenericListTable,
|
||||
JobRunDialog,
|
||||
SetVariableDialog
|
||||
},
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
default: 'adhoc'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
item: {},
|
||||
tableConfig: {
|
||||
url: `/api/v1/ops/jobs/?type=${this.type}`,
|
||||
columnsShow: {
|
||||
min: ['name', 'actions'],
|
||||
default: [
|
||||
'name', 'type', 'asset_amount', 'average_time_cost',
|
||||
'summary', 'date_last_run', 'actions'
|
||||
]
|
||||
},
|
||||
columns: [
|
||||
'name', 'type', 'summary', 'average_time_cost', 'asset_amount',
|
||||
'date_last_run', 'comment', 'date_updated', 'date_created', 'actions'
|
||||
],
|
||||
columnsMeta: {
|
||||
name: {
|
||||
width: '140px',
|
||||
formatter: DetailFormatter,
|
||||
formatterArgs: {
|
||||
can: true,
|
||||
getRoute: ({ row }) => ({
|
||||
name: 'JobDetail',
|
||||
params: { id: row.id }
|
||||
})
|
||||
}
|
||||
},
|
||||
type: {
|
||||
width: '96px',
|
||||
formatter: (row) => {
|
||||
return row.type.label
|
||||
}
|
||||
},
|
||||
comment: {
|
||||
width: '240px'
|
||||
},
|
||||
summary: {
|
||||
label: this.$t('Summary'),
|
||||
formatter: (row) => {
|
||||
return row.summary['success'] + '/' + row.summary['total']
|
||||
}
|
||||
},
|
||||
average_time_cost: {
|
||||
formatter: (row) => {
|
||||
return row.average_time_cost.toFixed(2) + 's'
|
||||
}
|
||||
},
|
||||
asset_amount: {
|
||||
label: this.$t('AssetsOfNumber'),
|
||||
formatter: (row) => {
|
||||
return row.assets.length
|
||||
}
|
||||
},
|
||||
date_last_run: {
|
||||
width: '140px',
|
||||
formatter: DateFormatter
|
||||
},
|
||||
actions: {
|
||||
formatter: ActionsFormatter,
|
||||
formatterArgs: {
|
||||
hasUpdate: true,
|
||||
canUpdate: this.$hasPerm('ops.change_job') && !this.$store.getters.currentOrgIsRoot,
|
||||
updateRoute: 'JobUpdate',
|
||||
hasDelete: true,
|
||||
canDelete: this.$hasPerm('ops.delete_job'),
|
||||
hasClone: false,
|
||||
extraActions: [
|
||||
{
|
||||
title: this.$t('Run'),
|
||||
name: 'run',
|
||||
order: 5,
|
||||
type: 'primary',
|
||||
can: this.$hasPerm('ops.add_jobexecution') && !this.$store.getters.currentOrgIsRoot,
|
||||
callback: ({ row }) => {
|
||||
this.item = row
|
||||
if (row?.use_parameter_define && row?.parameters_define) {
|
||||
const params = JSON.parse(row.parameters_define)
|
||||
if (Object.keys(params).length > 0) {
|
||||
this.showJobRunDialog = true
|
||||
}
|
||||
} else if (row?.variable?.length) {
|
||||
this.showVariableDialog = true
|
||||
} else {
|
||||
this.runJob(row)
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
createRoute: () => {
|
||||
return {
|
||||
name: 'JobCreate',
|
||||
query: {
|
||||
type: this.type
|
||||
}
|
||||
}
|
||||
},
|
||||
hasRefresh: true,
|
||||
hasExport: false,
|
||||
hasImport: false
|
||||
},
|
||||
showJobRunDialog: false,
|
||||
showVariableDialog: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formData() {
|
||||
return this.item.variable.map((data) => {
|
||||
return data.form_data
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
runJob(row, parameters) {
|
||||
this.$axios.post('/api/v1/ops/job-executions/', {
|
||||
job: row.id,
|
||||
parameters: parameters
|
||||
}).then((resp) => {
|
||||
this.showVariableDialog = false
|
||||
openTaskPage(resp.task_id)
|
||||
})
|
||||
},
|
||||
runJobWithParams(parameters) {
|
||||
this.runJob(this.item, parameters)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,41 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<AdhocOpenDialog v-if="showOpenAdhocDialog" :visible.sync="showOpenAdhocDialog" @select="onSelectAdhoc" />
|
||||
<el-link :underline="false" type="default" @click="onClick()">
|
||||
{{ $t('LoadTemplate') }}
|
||||
</el-link>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AdhocOpenDialog from '@/views/ops/Adhoc/AdhocOpenDialog'
|
||||
|
||||
export default {
|
||||
name: 'LoadTemplateLink',
|
||||
components: {
|
||||
AdhocOpenDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showOpenAdhocDialog: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClick() {
|
||||
this.showOpenAdhocDialog = true
|
||||
},
|
||||
onSelectAdhoc(adhoc) {
|
||||
adhoc?.variable.map(item => {
|
||||
delete item.id
|
||||
delete item.job
|
||||
delete item.adhoc
|
||||
return item
|
||||
})
|
||||
this.$emit('change', adhoc)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@@ -1,16 +1,136 @@
|
||||
<template>
|
||||
<div>
|
||||
<BaseJob :type="'playbook'" />
|
||||
<GenericListTable :header-actions="headerActions" :table-config="tableConfig" />
|
||||
<JobRunDialog v-if="showJobRunDialog" :item="item" :visible.sync="showJobRunDialog" @submit="runJob" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseJob from './BaseJob'
|
||||
import JobRunDialog from '@/views/ops/Job/JobRunDialog'
|
||||
import GenericListTable from '@/layout/components/GenericListTable'
|
||||
|
||||
import { openTaskPage } from '@/utils/jms'
|
||||
import { ActionsFormatter, DateFormatter, DetailFormatter } from '@/components/Table/TableFormatters'
|
||||
|
||||
export default {
|
||||
name: 'PlayBook',
|
||||
components: {
|
||||
BaseJob
|
||||
GenericListTable,
|
||||
JobRunDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
item: {},
|
||||
tableConfig: {
|
||||
url: '/api/v1/ops/jobs/?type=playbook',
|
||||
columnsShow: {
|
||||
min: ['name', 'actions'],
|
||||
default: [
|
||||
'name', 'type', 'asset_amount', 'average_time_cost',
|
||||
'summary', 'date_last_run', 'actions'
|
||||
]
|
||||
},
|
||||
columns: [
|
||||
'name', 'type', 'summary', 'average_time_cost', 'asset_amount',
|
||||
'date_last_run', 'comment', 'date_updated', 'date_created', 'actions'
|
||||
],
|
||||
columnsMeta: {
|
||||
name: {
|
||||
width: '140px',
|
||||
formatter: DetailFormatter,
|
||||
formatterArgs: {
|
||||
can: true,
|
||||
getRoute: ({ row }) => ({
|
||||
name: 'JobDetail',
|
||||
params: { id: row.id }
|
||||
})
|
||||
}
|
||||
},
|
||||
type: {
|
||||
width: '96px',
|
||||
formatter: (row) => {
|
||||
return row.type.label
|
||||
}
|
||||
},
|
||||
comment: {
|
||||
width: '240px'
|
||||
},
|
||||
summary: {
|
||||
label: this.$t('Summary'),
|
||||
formatter: (row) => {
|
||||
return row.summary['success'] + '/' + row.summary['total']
|
||||
}
|
||||
},
|
||||
average_time_cost: {
|
||||
formatter: (row) => {
|
||||
return row.average_time_cost.toFixed(2) + 's'
|
||||
}
|
||||
},
|
||||
asset_amount: {
|
||||
label: this.$t('AssetsOfNumber'),
|
||||
formatter: (row) => {
|
||||
return row.assets.length
|
||||
}
|
||||
},
|
||||
date_last_run: {
|
||||
width: '140px',
|
||||
formatter: DateFormatter
|
||||
},
|
||||
actions: {
|
||||
formatter: ActionsFormatter,
|
||||
formatterArgs: {
|
||||
hasUpdate: true,
|
||||
canUpdate: this.$hasPerm('ops.change_job') && !this.$store.getters.currentOrgIsRoot,
|
||||
updateRoute: 'JobUpdate',
|
||||
hasDelete: true,
|
||||
canDelete: this.$hasPerm('ops.delete_job'),
|
||||
hasClone: false,
|
||||
extraActions: [
|
||||
{
|
||||
title: this.$t('Run'),
|
||||
name: 'run',
|
||||
can: this.$hasPerm('ops.add_jobexecution') && !this.$store.getters.currentOrgIsRoot,
|
||||
callback: ({ row }) => {
|
||||
if (row?.use_parameter_define && row?.parameters_define) {
|
||||
const params = JSON.parse(row.parameters_define)
|
||||
if (Object.keys(params).length > 0) {
|
||||
this.item = row
|
||||
this.showJobRunDialog = true
|
||||
}
|
||||
} else {
|
||||
this.runJob(row)
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
hasRefresh: true,
|
||||
hasExport: false,
|
||||
hasImport: false,
|
||||
createRoute: () => {
|
||||
return {
|
||||
name: 'JobCreate',
|
||||
query: {
|
||||
type: 'playbook'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
showJobRunDialog: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
runJob(row, parameters) {
|
||||
this.$axios.post('/api/v1/ops/job-executions/', {
|
||||
job: row.id,
|
||||
parameters: parameters
|
||||
}).then((resp) => {
|
||||
openTaskPage(resp.task_id)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,29 +1,16 @@
|
||||
<template>
|
||||
<el-row :gutter="20">
|
||||
<el-col :md="16" :sm="24">
|
||||
<AutoDetailCard :excludes="excludes" :object="object" :url="url" />
|
||||
</el-col>
|
||||
<el-col :md="8" :sm="24">
|
||||
<IBox :title="$tc('Variable')">
|
||||
<Variable
|
||||
:value.sync="object.variable"
|
||||
:disable-edit="disableEdit"
|
||||
@input="updateVariable"
|
||||
/>
|
||||
</IBox>
|
||||
<AutoDetailCard :fields="detailFields" :object="object" :url="url" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script type="text/jsx">
|
||||
import AutoDetailCard from '@/components/Cards/DetailCard/auto'
|
||||
import Variable from '@/views/ops/Template/components/Variable'
|
||||
import { IBox } from '@/components'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
IBox,
|
||||
Variable,
|
||||
AutoDetailCard
|
||||
},
|
||||
props: {
|
||||
@@ -34,9 +21,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
url: `/api/v1/ops/adhocs/${this.object.id}/`,
|
||||
excludes: ['variable'],
|
||||
disableEdit: this.object.creator !== this.$store.state.users.profile.id
|
||||
url: `/api/v1/ops/adhocs/${this.object.id}/`
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -44,14 +29,7 @@ export default {
|
||||
return this.object.name
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateVariable() {
|
||||
const url = `/api/v1/ops/adhocs/${this.object.id}/`
|
||||
this.$axios.patch(url, { variable: this.object.variable }).then(() => {
|
||||
this.$message.success(this.$tc('UpdateSuccessMsg'))
|
||||
})
|
||||
}
|
||||
}
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<script>
|
||||
import { GenericCreateUpdatePage } from '@/layout/components'
|
||||
import CodeEditor from '@/components/Form/FormFields/CodeEditor'
|
||||
import Variable from '@/views/ops/Template/components/Variable'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -15,7 +14,7 @@ export default {
|
||||
return {
|
||||
url: '/api/v1/ops/adhocs/',
|
||||
fields: [
|
||||
[this.$t('Basic'), ['name', 'scope', 'module', 'args', 'variable', 'comment']]
|
||||
[this.$t('Basic'), ['name', 'module', 'args', 'comment', 'scope']]
|
||||
],
|
||||
initial: {
|
||||
module: 'shell',
|
||||
@@ -24,9 +23,6 @@ export default {
|
||||
fieldsMeta: {
|
||||
args: {
|
||||
component: CodeEditor
|
||||
},
|
||||
variable: {
|
||||
component: Variable
|
||||
}
|
||||
},
|
||||
createSuccessNextRoute: {
|
||||
@@ -34,16 +30,6 @@ export default {
|
||||
},
|
||||
updateSuccessNextRoute: {
|
||||
name: 'Template'
|
||||
},
|
||||
cleanFormValue(value) {
|
||||
const isClone = this?.$route?.query.clone_from !== undefined
|
||||
if (isClone) {
|
||||
value?.variable.map((item) => {
|
||||
delete item.id
|
||||
delete item.adhoc
|
||||
})
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,29 +13,13 @@ export default {
|
||||
return {
|
||||
url: '/api/v1/ops/playbooks/',
|
||||
fields: [
|
||||
[this.$t('Basic'), ['name', 'scope', 'comment', 'variable']]
|
||||
[this.$t('Basic'), ['name', 'comment', 'scope']]
|
||||
],
|
||||
fieldsMeta: {
|
||||
variable: {
|
||||
hidden: () => true
|
||||
}
|
||||
},
|
||||
createSuccessNextRoute: {
|
||||
name: 'Template'
|
||||
},
|
||||
updateSuccessNextRoute: {
|
||||
name: 'Template'
|
||||
},
|
||||
cleanFormValue(value) {
|
||||
const isClone = this?.$route?.query.clone_from !== undefined
|
||||
if (isClone) {
|
||||
value?.variable.map((item) => {
|
||||
delete item.id
|
||||
delete item.playbook
|
||||
delete item.job
|
||||
})
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
:title="$tc('NewFile')"
|
||||
:visible.sync="iVisible"
|
||||
top="1vh"
|
||||
width="40%"
|
||||
width="20%"
|
||||
@confirm="onConfirm"
|
||||
>
|
||||
<el-form>
|
||||
@@ -45,8 +45,7 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
onConfirm() {
|
||||
this.$emit('confirm', this.name)
|
||||
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
return {
|
||||
url: `/api/v1/ops/playbooks/${this.object.id}/`,
|
||||
excludes: [
|
||||
'variable', 'path', 'create_method', 'vcs_url'
|
||||
'path', 'create_method', 'vcs_url'
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -34,13 +34,6 @@
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div style="display: flex;margin-top:10px;justify-content: space-between" />
|
||||
<el-form ref="form" label-position="left" label-width="30px">
|
||||
<div class="form-content">
|
||||
<el-form-item label="" prop="variable">
|
||||
<Variable :value.sync="variables" :disable-edit.sync="disableEdit" @input="setVariable" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
</TreeTable>
|
||||
@@ -53,15 +46,13 @@ import CodeEditor from '@/components/Form/FormFields/CodeEditor'
|
||||
import item from '@/layout/components/NavLeft/Item'
|
||||
import NewNodeDialog from '@/views/ops/Template/Playbook/PlaybookDetail/Editor/NewNodeDialog.vue'
|
||||
import { renameFile } from '@/api/ops'
|
||||
import Variable from '@/views/ops/Template/components/Variable'
|
||||
|
||||
export default {
|
||||
name: 'CommandExecution',
|
||||
components: {
|
||||
NewNodeDialog,
|
||||
TreeTable,
|
||||
CodeEditor,
|
||||
Variable
|
||||
CodeEditor
|
||||
},
|
||||
props: {
|
||||
object: {
|
||||
@@ -155,8 +146,7 @@ export default {
|
||||
},
|
||||
iShowTree: true,
|
||||
activeEditorId: '',
|
||||
openedEditor: {},
|
||||
variables: []
|
||||
openedEditor: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -177,7 +167,6 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.variables = this.object?.variable
|
||||
this.onOpenEditor({ id: 'main.yml', name: 'main.yml' })
|
||||
},
|
||||
methods: {
|
||||
@@ -297,15 +286,6 @@ export default {
|
||||
},
|
||||
hasChange(editor) {
|
||||
return editor.value !== editor.originValue
|
||||
},
|
||||
setVariable(variables) {
|
||||
if (this.disableEdit) {
|
||||
return
|
||||
}
|
||||
this.$axios.patch(`/api/v1/ops/playbooks/${this.object.id}/`,
|
||||
{ variable: variables }).catch(err => {
|
||||
this.$message.error(this.$tc('UpdateErrorMsg') + ' ' + err)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
<template>
|
||||
<Dialog
|
||||
v-if="iVisible"
|
||||
:destroy-on-close="true"
|
||||
:show-cancel="false"
|
||||
:show-confirm="false"
|
||||
:title="$tc('AddVariable')"
|
||||
:visible.sync="iVisible"
|
||||
width="800px"
|
||||
>
|
||||
<VariableCreateForm
|
||||
:variable="variable"
|
||||
@add="addVariable"
|
||||
@edit="editVariable"
|
||||
/>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Dialog from '@/components/Dialog'
|
||||
import VariableCreateForm from '@/components/Apps/VariableCreateUpdateForm'
|
||||
|
||||
export default {
|
||||
name: 'AddVariableDialog',
|
||||
components: {
|
||||
Dialog,
|
||||
VariableCreateForm
|
||||
},
|
||||
props: {
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
variable: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
variables: {
|
||||
type: Array,
|
||||
default: () => ([])
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
iVisible: {
|
||||
get() {
|
||||
return this.visible
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:visible', val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addVariable(variable) {
|
||||
const i = this.variables.findIndex(item => item.name === variable.name || item.var_name === variable.var_name)
|
||||
if (i !== -1) {
|
||||
this.variables.splice(i, 1)
|
||||
}
|
||||
this.variables.push(variable)
|
||||
this.iVisible = false
|
||||
},
|
||||
editVariable(form) {
|
||||
const i = this.variables.findIndex(item => item.var_name === this.variable.var_name)
|
||||
this.variables.splice(i, 1, form)
|
||||
const count = this.variables.filter(value => value.var_name === form.var_name || value.name === form.name).length
|
||||
// 不允许有相同的变量名
|
||||
if (count > 1) {
|
||||
this.variables.splice(i, 1)
|
||||
}
|
||||
this.iVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,66 +0,0 @@
|
||||
<template>
|
||||
<Dialog
|
||||
v-if="iVisible"
|
||||
:destroy-on-close="true"
|
||||
:show-cancel="false"
|
||||
:show-confirm="false"
|
||||
:title="$tc('setVariable')"
|
||||
:visible.sync="iVisible"
|
||||
width="800px"
|
||||
>
|
||||
<VariableSetForm
|
||||
:form-data="formData"
|
||||
:query-param="queryParam"
|
||||
@confirm="handleConfirm"
|
||||
/>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Dialog from '@/components/Dialog'
|
||||
import VariableSetForm from '@/components/Apps/VariableSetForm'
|
||||
|
||||
export default {
|
||||
name: 'SetVariableDialog',
|
||||
components: {
|
||||
Dialog,
|
||||
VariableSetForm
|
||||
},
|
||||
props: {
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
formData: {
|
||||
type: Array,
|
||||
default: () => ([])
|
||||
},
|
||||
queryParam: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
iVisible: {
|
||||
get() {
|
||||
return this.visible
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:visible', val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleConfirm(variable) {
|
||||
this.$emit('submit', variable)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,183 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="variables el-data-table">
|
||||
<el-table :data="variables" class="el-table--fit el-table--border">
|
||||
<el-table-column show-overflow-tooltip :label="$tc('Name')" prop="name" />
|
||||
<el-table-column show-overflow-tooltip :label="$tc('VariableName')" prop="var_name" />
|
||||
<el-table-column show-overflow-tooltip :label="$tc('DefaultValue')" prop="default_value" />
|
||||
<el-table-column
|
||||
v-if="!disableEdit"
|
||||
:label="$tc('Actions')"
|
||||
align="center"
|
||||
class-name="buttons"
|
||||
fixed="right"
|
||||
width="135"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<el-button icon="el-icon-minus" size="mini" type="danger" @click="removeVariable(scope.row)" />
|
||||
<el-button
|
||||
:disabled="!!scope.row.template"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
type="primary"
|
||||
@click="onEditClick(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div v-if="!disableEdit" class="actions">
|
||||
<el-button size="mini" type="primary" @click="onAddClick">
|
||||
{{ $t('Add') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<AddVariableDialog
|
||||
:variable="variable"
|
||||
:variables="variables"
|
||||
:visible.sync="addVariableDialogVisible"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddVariableDialog from './AddVariableDialog'
|
||||
|
||||
export default {
|
||||
name: 'Variable',
|
||||
components: {
|
||||
AddVariableDialog
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
type: [Array],
|
||||
default: () => []
|
||||
},
|
||||
disableEdit: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
variable: {},
|
||||
initial: false,
|
||||
addVariableDialogVisible: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
variables: {
|
||||
get() {
|
||||
return this.value
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:value', val)
|
||||
this.$emit('change', val)
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
variables: {
|
||||
handler(newVal, oldVal) {
|
||||
if (oldVal === undefined) return
|
||||
if (newVal.length > 0 || !this.initial) {
|
||||
newVal.map((item) => {
|
||||
item.default_value = item.text_default_value || item.select_default_value
|
||||
})
|
||||
this.$emit('input', newVal)
|
||||
}
|
||||
if (newVal) {
|
||||
this.initial = true
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
removeVariable(variable) {
|
||||
this.variables = this.variables.filter((item) => {
|
||||
if (variable.id && item.id) {
|
||||
return item.id !== variable.id
|
||||
} else if (variable.var_name && item.var_name) {
|
||||
return item.var_name !== variable.var_name
|
||||
} else {
|
||||
return variable.name !== item.name
|
||||
}
|
||||
})
|
||||
},
|
||||
onEditClick(variable) {
|
||||
this.variable = variable
|
||||
setTimeout(() => {
|
||||
this.addVariableDialogVisible = true
|
||||
})
|
||||
},
|
||||
onAddClick() {
|
||||
this.variable = null
|
||||
setTimeout(() => {
|
||||
this.addVariableDialogVisible = true
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-data-table ::v-deep .el-table {
|
||||
.table {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.el-table__row {
|
||||
&.selected-row {
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
& > td {
|
||||
line-height: 1.5;
|
||||
padding: 6px 0;
|
||||
font-size: 13px;
|
||||
border-right: none;
|
||||
|
||||
* {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.el-checkbox {
|
||||
vertical-align: super;
|
||||
}
|
||||
|
||||
& > div > span {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.el-table__header > thead > tr > th {
|
||||
padding: 6px 0;
|
||||
background-color: #ffffff;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
border-right: none;
|
||||
|
||||
.cell {
|
||||
white-space: nowrap !important;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
&:hover {
|
||||
border-right: 2px solid #EBEEF5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.el-data-table ::v-deep .el-table .el-table__header > thead > tr .is-sortable {
|
||||
padding: 5px 0;
|
||||
|
||||
.cell {
|
||||
padding-top: 3px !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -11,6 +11,7 @@
|
||||
<script>
|
||||
import { GenericCreateUpdatePage } from '@/layout/components'
|
||||
import AssetSelect from '@/components/Apps/AssetSelect'
|
||||
import { getDayFuture } from '@/utils/time'
|
||||
import AccountFormatter from './components/AccountFormatter'
|
||||
import { AllAccount } from '../const'
|
||||
import ProtocolsSelect from '@/components/Form/FormFields/AllOrSpec.vue'
|
||||
@@ -31,6 +32,9 @@ export default {
|
||||
}
|
||||
return {
|
||||
initial: {
|
||||
is_active: true,
|
||||
date_start: new Date().toISOString(),
|
||||
date_expired: getDayFuture(25550, new Date()).toISOString(),
|
||||
nodes: nodesInitial,
|
||||
assets: assetsInitial,
|
||||
accounts: [AllAccount]
|
||||
|
||||
@@ -50,7 +50,7 @@ export default {
|
||||
columnsExtra: ['action'],
|
||||
columns: [
|
||||
'name', 'users_amount', 'user_groups_amount', 'assets_amount', 'nodes_amount',
|
||||
'accounts', 'labels', 'is_valid', 'is_expired', 'from_ticket', 'is_active', 'actions'
|
||||
'accounts', 'is_valid', 'is_expired', 'from_ticket', 'is_active', 'actions'
|
||||
],
|
||||
columnsShow: {
|
||||
min: ['name', 'actions'],
|
||||
|
||||
@@ -18,12 +18,6 @@
|
||||
style="margin-top: 15px"
|
||||
type="info"
|
||||
/>
|
||||
<QuickActions
|
||||
:title="$tc('BiometricFeatures')"
|
||||
type="warning"
|
||||
:actions="biometricFeaturesActions"
|
||||
style="margin-top: 15px"
|
||||
/>
|
||||
<IBox :title="$tc('InformationModification')" fa="fa-edit">
|
||||
<table>
|
||||
<tr>
|
||||
@@ -82,21 +76,6 @@ export default {
|
||||
url: `/api/v1/users/profile/`,
|
||||
showPasswordDialog: false,
|
||||
currentEdit: '',
|
||||
biometricFeaturesActions: [
|
||||
{
|
||||
title: this.$t('FacialFeatures'),
|
||||
attrs: {
|
||||
type: 'primary',
|
||||
label: this.$store.state.users.profile.is_face_code_set ? this.$t('Unbind') : this.$t('Bind')
|
||||
},
|
||||
callbacks: {
|
||||
click: () => {
|
||||
const next_url = this.$store.state.users.profile.is_face_code_set ? '/core/auth/profile/face/disable/' : '/core/auth/profile/face/enable/'
|
||||
window.open(next_url, '_self')
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
authQuickActions: [
|
||||
{
|
||||
title: this.$t('WeComOAuth'),
|
||||
|
||||
@@ -32,21 +32,13 @@ export default {
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
columnsMeta: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
columnsExclude: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableConfig: {
|
||||
url: this.url,
|
||||
columnsExclude: ['terminal', ...this.columnsExclude],
|
||||
columnsExclude: ['terminal'],
|
||||
columnsShow: this.columnsShow,
|
||||
columnsMeta: {
|
||||
id: {
|
||||
@@ -145,8 +137,7 @@ export default {
|
||||
hasUpdate: false,
|
||||
extraActions: this.extraActions
|
||||
}
|
||||
},
|
||||
...this.columnsMeta
|
||||
}
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<BaseList :extra-actions="extraActions" :url="url" :columns-meta="columnsMeta" :columns-exclude="columnsExclude" />
|
||||
<BaseList :extra-actions="extraActions" :url="url" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -42,13 +42,7 @@ export default {
|
||||
download(`/api/v1/terminal/sessions/${row.id}/replay/download/`)
|
||||
}
|
||||
}
|
||||
],
|
||||
columnsExclude: ['has_command'],
|
||||
columnsMeta: {
|
||||
command_amount: {
|
||||
label: this.$t('CommandsTotal')
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<BaseList :extra-actions="extraActions" :url="url" :columns-meta="columnsMeta" :columns-exclude="columnsExclude" />
|
||||
<BaseList :extra-actions="extraActions" :url="url" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -100,14 +100,12 @@ export default {
|
||||
window.open(monitorUrl, '_blank', 'height=600, width=850, top=400, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')
|
||||
}
|
||||
}
|
||||
],
|
||||
columnsExclude: ['has_command'],
|
||||
columnsMeta: {
|
||||
command_amount: {
|
||||
label: this.$t('CommandsTotal')
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
@@ -12,9 +12,6 @@ import { GenericCreateUpdateForm } from '@/layout/components'
|
||||
import IBox from '@/components/IBox/index.vue'
|
||||
import { openTaskPage } from '@/utils/jms'
|
||||
import store from '@/store'
|
||||
import HashiCorpKV from './HCP.vue'
|
||||
import AzureKV from './Azure.vue'
|
||||
import AwsSM from './Aws.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -28,6 +25,24 @@ export default {
|
||||
hasReset: false,
|
||||
helpText: this.$t('VaultHelpText'),
|
||||
moreButtons: [
|
||||
{
|
||||
title: this.$t('Test'),
|
||||
loading: false,
|
||||
disabled: !store.getters.publicSettings['VAULT_ENABLED'],
|
||||
callback: function(value, form, btn) {
|
||||
btn.loading = true
|
||||
vm.$axios.post(
|
||||
'/api/v1/settings/vault/testing/',
|
||||
value
|
||||
).then(res => {
|
||||
vm.$message.success(res['msg'])
|
||||
}).catch(() => {
|
||||
vm.$log.error('err occur')
|
||||
}).finally(() => {
|
||||
btn.loading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('Sync'),
|
||||
loading: false,
|
||||
@@ -47,9 +62,17 @@ export default {
|
||||
}
|
||||
}
|
||||
],
|
||||
encryptedFields: ['VAULT_HCP_TOKEN'],
|
||||
fields: [
|
||||
[this.$t('Basic'), ['VAULT_ENABLED', 'VAULT_BACKEND', 'HISTORY_ACCOUNT_CLEAN_LIMIT']],
|
||||
[this.$t('Provider'), ['HCP', 'AZURE', 'AWS']]
|
||||
[this.$t('Backend'),
|
||||
[
|
||||
'VAULT_ENABLED',
|
||||
'VAULT_HCP_HOST',
|
||||
'VAULT_HCP_TOKEN',
|
||||
'VAULT_HCP_MOUNT_POINT'
|
||||
]
|
||||
],
|
||||
[this.$t('History'), ['HISTORY_ACCOUNT_CLEAN_LIMIT']]
|
||||
],
|
||||
fieldsMeta: {
|
||||
HISTORY_ACCOUNT_CLEAN_LIMIT: {
|
||||
@@ -60,32 +83,21 @@ export default {
|
||||
VAULT_ENABLED: {
|
||||
disabled: true
|
||||
},
|
||||
VAULT_BACKEND: {
|
||||
label: this.$t('Provider'),
|
||||
VAULT_HCP_HOST: {
|
||||
hidden: (formValue) => {
|
||||
return !formValue.VAULT_ENABLED || formValue['VAULT_BACKEND'] === 'local'
|
||||
},
|
||||
disabled: true
|
||||
},
|
||||
HCP: {
|
||||
label: this.$t('HashicorpVault'),
|
||||
component: HashiCorpKV,
|
||||
hidden: (formValue) => {
|
||||
return !formValue.VAULT_ENABLED || formValue['VAULT_BACKEND'] !== 'hcp'
|
||||
return !formValue.VAULT_ENABLED
|
||||
}
|
||||
},
|
||||
AZURE: {
|
||||
label: this.$t('AzureKeyVault'),
|
||||
component: AzureKV,
|
||||
VAULT_HCP_TOKEN: {
|
||||
hidden: (formValue) => {
|
||||
return !formValue.VAULT_ENABLED || formValue['VAULT_BACKEND'] !== 'azure'
|
||||
return !formValue.VAULT_ENABLED
|
||||
}
|
||||
},
|
||||
AWS: {
|
||||
label: this.$t('AmazonSecretsManager'),
|
||||
component: AwsSM,
|
||||
VAULT_HCP_MOUNT_POINT: {
|
||||
helpText: this.$t('VaultHCPMountPoint'),
|
||||
helpTextAsTip: true,
|
||||
hidden: (formValue) => {
|
||||
return !formValue.VAULT_ENABLED || formValue['VAULT_BACKEND'] !== 'aws'
|
||||
return !formValue.VAULT_ENABLED
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1,60 +0,0 @@
|
||||
<template>
|
||||
<BaseKV :config="$data" :title="$tc('AmazonSecretsManager')" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseKV from './Base.vue'
|
||||
|
||||
export default {
|
||||
name: 'AmazonSecretsManager',
|
||||
components: {
|
||||
BaseKV
|
||||
},
|
||||
data() {
|
||||
const vm = this
|
||||
return {
|
||||
url: `/api/v1/settings/setting/?category=aws_sm`,
|
||||
hasDetailInMsg: false,
|
||||
visible: false,
|
||||
moreButtons: [
|
||||
{
|
||||
title: this.$t('Test'),
|
||||
loading: false,
|
||||
callback: function(value, form, btn) {
|
||||
btn.loading = true
|
||||
vm.$axios.post(
|
||||
'/api/v1/settings/vault/aws/testing/',
|
||||
value
|
||||
).then(res => {
|
||||
vm.$message.success(res['msg'])
|
||||
}).catch(() => {
|
||||
vm.$log.error('err occur')
|
||||
}).finally(() => { btn.loading = false })
|
||||
}
|
||||
}
|
||||
],
|
||||
encryptedFields: ['VAULT_AWS_ACCESS_SECRET_KEY'],
|
||||
fields: [
|
||||
[this.$t('AccountStorage'),
|
||||
[
|
||||
'VAULT_AWS_REGION_NAME',
|
||||
'VAULT_AWS_ACCESS_KEY_ID',
|
||||
'VAULT_AWS_ACCESS_SECRET_KEY'
|
||||
]
|
||||
]
|
||||
],
|
||||
fieldsMeta: {
|
||||
},
|
||||
submitMethod() {
|
||||
return 'patch'
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,61 +0,0 @@
|
||||
<template>
|
||||
<BaseKV :config="$data" :title="$tc('AzureKeyVault')" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseKV from './Base.vue'
|
||||
|
||||
export default {
|
||||
name: 'AzureKV',
|
||||
components: {
|
||||
BaseKV
|
||||
},
|
||||
data() {
|
||||
const vm = this
|
||||
return {
|
||||
url: `/api/v1/settings/setting/?category=azure_kv`,
|
||||
hasDetailInMsg: false,
|
||||
visible: false,
|
||||
moreButtons: [
|
||||
{
|
||||
title: this.$t('Test'),
|
||||
loading: false,
|
||||
callback: function(value, form, btn) {
|
||||
btn.loading = true
|
||||
vm.$axios.post(
|
||||
'/api/v1/settings/vault/azure/testing/',
|
||||
value
|
||||
).then(res => {
|
||||
vm.$message.success(res['msg'])
|
||||
}).catch(() => {
|
||||
vm.$log.error('err occur')
|
||||
}).finally(() => { btn.loading = false })
|
||||
}
|
||||
}
|
||||
],
|
||||
encryptedFields: ['VAULT_AZURE_CLIENT_SECRET'],
|
||||
fields: [
|
||||
[this.$t('AccountStorage'),
|
||||
[
|
||||
'VAULT_AZURE_HOST',
|
||||
'VAULT_AZURE_CLIENT_ID',
|
||||
'VAULT_AZURE_CLIENT_SECRET',
|
||||
'VAULT_AZURE_TENANT_ID'
|
||||
]
|
||||
]
|
||||
],
|
||||
fieldsMeta: {
|
||||
},
|
||||
submitMethod() {
|
||||
return 'patch'
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,63 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button size="mini" type="primary" icon="el-icon-setting" @click="visible=true">{{ $t('Setting') }}</el-button>
|
||||
<Dialog
|
||||
v-if="visible"
|
||||
:destroy-on-close="true"
|
||||
:show-cancel="false"
|
||||
:show-confirm="false"
|
||||
:title="title"
|
||||
:visible.sync="visible"
|
||||
width="70%"
|
||||
@confirm="onConfirm()"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<GenericCreateUpdateForm ref="form" v-bind="iConfig" @submitSuccess="submitSuccess" />
|
||||
</Dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Dialog from '@/components/Dialog/index.vue'
|
||||
import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm/index.vue'
|
||||
|
||||
export default {
|
||||
name: 'Base',
|
||||
components: {
|
||||
Dialog,
|
||||
GenericCreateUpdateForm
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
config: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
iConfig() {
|
||||
return this.config
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onConfirm() {
|
||||
},
|
||||
submitSuccess(res) {
|
||||
this.$emit('input', !!res[this.enableField])
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,64 +0,0 @@
|
||||
<template>
|
||||
<BaseKV :config="$data" :title="$tc('HashicorpVault')" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseKV from './Base.vue'
|
||||
|
||||
export default {
|
||||
name: 'HashiCorpKV',
|
||||
components: {
|
||||
BaseKV
|
||||
},
|
||||
data() {
|
||||
const vm = this
|
||||
return {
|
||||
url: `/api/v1/settings/setting/?category=hcp`,
|
||||
hasDetailInMsg: false,
|
||||
visible: false,
|
||||
moreButtons: [
|
||||
{
|
||||
title: this.$t('Test'),
|
||||
loading: false,
|
||||
callback: function(value, form, btn) {
|
||||
btn.loading = true
|
||||
vm.$axios.post(
|
||||
'/api/v1/settings/vault/hcp/testing/',
|
||||
value
|
||||
).then(res => {
|
||||
vm.$message.success(res['msg'])
|
||||
}).catch(() => {
|
||||
vm.$log.error('err occur')
|
||||
}).finally(() => { btn.loading = false })
|
||||
}
|
||||
}
|
||||
],
|
||||
encryptedFields: ['VAULT_HCP_TOKEN'],
|
||||
fields: [
|
||||
[this.$t('AccountStorage'),
|
||||
[
|
||||
'VAULT_HCP_HOST',
|
||||
'VAULT_HCP_TOKEN',
|
||||
'VAULT_HCP_MOUNT_POINT'
|
||||
]
|
||||
]
|
||||
],
|
||||
fieldsMeta: {
|
||||
VAULT_HCP_MOUNT_POINT: {
|
||||
helpText: this.$t('VaultHCPMountPoint'),
|
||||
helpTextAsTip: true
|
||||
}
|
||||
},
|
||||
submitMethod() {
|
||||
return 'patch'
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -9,7 +9,7 @@
|
||||
<script>
|
||||
import TabPage from '@/layout/components/TabPage/index.vue'
|
||||
import Announcement from './Announcement.vue'
|
||||
import Vault from './Vault/index.vue'
|
||||
import Vault from './Vault.vue'
|
||||
import Ticket from './Ticket.vue'
|
||||
import Ops from './Ops.vue'
|
||||
import Chat from './Chat.vue'
|
||||
|
||||
@@ -114,8 +114,8 @@ export default {
|
||||
}
|
||||
return [
|
||||
{
|
||||
key: this.$t('SerialNumber'),
|
||||
value: this.licenseData?.serial_no || ''
|
||||
key: this.$t('SubscriptionID'),
|
||||
value: this.licenseData.subscription_id
|
||||
},
|
||||
{
|
||||
key: this.$t('Corporation'),
|
||||
@@ -133,6 +133,10 @@ export default {
|
||||
key: this.$t('Edition'),
|
||||
value: this.licenseData.edition
|
||||
},
|
||||
{
|
||||
key: this.$t('SerialNumber'),
|
||||
value: this.licenseData?.serial_no || ''
|
||||
},
|
||||
{
|
||||
key: this.$t('Comment'),
|
||||
value: this.licenseData?.remark || ''
|
||||
|
||||
@@ -48,6 +48,11 @@ export default {
|
||||
EMAIL_HOST_PASSWORD: {
|
||||
component: UpdateToken
|
||||
},
|
||||
EMAIL_HOST_USER: {
|
||||
rules: [
|
||||
rules.EmailCheck
|
||||
]
|
||||
},
|
||||
EMAIL_CUSTOM_USER_CREATED_BODY: {
|
||||
el: {
|
||||
type: 'textarea',
|
||||
|
||||
@@ -23,13 +23,13 @@ export default {
|
||||
'SECURITY_WATERMARK_ENABLED',
|
||||
'SECURITY_SESSION_SHARE',
|
||||
'SESSION_EXPIRE_AT_BROWSER_CLOSE',
|
||||
'VIEW_ASSET_ONLINE_SESSION_INFO',
|
||||
'SECURITY_MAX_IDLE_TIME',
|
||||
'SECURITY_MAX_SESSION_TIME'
|
||||
]
|
||||
]
|
||||
],
|
||||
fieldsMeta: {}
|
||||
fieldsMeta: {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,14 +84,6 @@ const components_ee = [
|
||||
{
|
||||
'title': 'Xrdp',
|
||||
'components': ['xrdp', 'jms_xrdp']
|
||||
},
|
||||
{
|
||||
'title': 'Nec',
|
||||
'components': ['nec', 'jms_nec']
|
||||
},
|
||||
{
|
||||
'title': 'Facelive',
|
||||
'components': ['facelive', 'jms_facelive']
|
||||
}
|
||||
]
|
||||
all_components.push(...components_ce)
|
||||
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
[
|
||||
this.$t('Port'),
|
||||
[
|
||||
'http_port', 'https_port', 'ssh_port', 'rdp_port','vnc_port'
|
||||
'http_port', 'https_port', 'ssh_port', 'rdp_port'
|
||||
]
|
||||
],
|
||||
[
|
||||
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
min: ['name', 'actions'],
|
||||
default: [
|
||||
'name', 'host', 'actions',
|
||||
'http_port', 'https_port', 'ssh_port', 'rdp_port', 'vnc_port',
|
||||
'http_port', 'https_port', 'ssh_port', 'rdp_port',
|
||||
'mysql_port', 'mariadb_port', 'postgresql_port',
|
||||
'redis_port', 'sqlserver_port', 'oracle_port_range', 'is_active'
|
||||
]
|
||||
|
||||
@@ -90,7 +90,7 @@ export default {
|
||||
omnidb: 'OmniDB',
|
||||
guacamole: 'Guacamole',
|
||||
lion: 'Lion',
|
||||
xrdp: 'Xrdp',
|
||||
xrdp: 'XRDP',
|
||||
razor: 'Razor',
|
||||
core: 'Core',
|
||||
celery: 'Celery',
|
||||
@@ -99,9 +99,7 @@ export default {
|
||||
chen: 'Chen',
|
||||
kael: 'Kael',
|
||||
video_worker: 'Video-Worker',
|
||||
panda: 'Panda',
|
||||
nec: 'Nec',
|
||||
facelive: 'Facelive'
|
||||
panda: 'Panda'
|
||||
}
|
||||
return nameMapper[this.componentMetric.type]
|
||||
},
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
v-model="requestForm.accounts"
|
||||
:assets="requestForm.assets"
|
||||
:nodes="requestForm.nodes"
|
||||
:oid="requestForm.oid"
|
||||
:show-add-template="false"
|
||||
style="width: 50% !important"
|
||||
/>
|
||||
@@ -83,7 +82,6 @@ export default {
|
||||
assets: this.object.apply_assets?.map(i => i.id),
|
||||
accounts: this.object.apply_accounts,
|
||||
actions: this.object.apply_actions,
|
||||
oid: this.object.org_id,
|
||||
apply_date_expired: this.object.apply_date_expired,
|
||||
apply_date_start: this.object.apply_date_start
|
||||
},
|
||||
|
||||
@@ -14,7 +14,7 @@ export default {
|
||||
return {
|
||||
tableConfig: {
|
||||
url: '/api/v1/users/groups/',
|
||||
columns: ['name', 'users_amount', 'comment', 'actions', 'labels'],
|
||||
columns: ['name', 'users_amount', 'comment', 'actions'],
|
||||
columnsShow: {
|
||||
default: ['name', 'users_amount', 'comment', 'actions'],
|
||||
min: ['name', 'action']
|
||||
|
||||
@@ -9,7 +9,6 @@ import rules from '@/components/Form/DataForm/rules'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { Select2 } from '@/components'
|
||||
import store from '@/store'
|
||||
import { MFASystemSetting, MFALevel } from '../const'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -45,7 +44,10 @@ export default {
|
||||
}
|
||||
},
|
||||
mfa_level: {
|
||||
disabled: false
|
||||
disabled: false,
|
||||
tips: {
|
||||
2: this.$t('forceEnableMFAHelpText')
|
||||
}
|
||||
},
|
||||
email: {
|
||||
rules: [
|
||||
@@ -174,7 +176,6 @@ export default {
|
||||
if (obj?.id) {
|
||||
obj.org_roles = obj.org_roles?.map(({ id }) => id)
|
||||
obj.system_roles = obj.system_roles?.map(({ id }) => id)
|
||||
obj.mfa_level.value = this.initial.mfa_level || obj.mfa_level.value
|
||||
}
|
||||
return obj
|
||||
},
|
||||
@@ -192,9 +193,6 @@ export default {
|
||||
if (value.source !== 'local') {
|
||||
delete value.need_update_password
|
||||
}
|
||||
if ([MFALevel.allUsers, MFALevel.onlyAdminUsers].indexOf(value.mfa_level) > -1) {
|
||||
delete value.mfa_level
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
@@ -233,26 +231,11 @@ export default {
|
||||
this.initial.org_roles = roles.filter(role => role.name === 'OrgUser').map(role => role.id)
|
||||
},
|
||||
disableMFAFieldIfNeed(user) {
|
||||
let options = null
|
||||
let mfa_level = null
|
||||
// SECURITY_MFA_AUTH 0 不开启 1 全局开启 2 管理员开启
|
||||
const securityMFAAuth = store.getters.publicSettings['SECURITY_MFA_AUTH']
|
||||
const adminUserIsNeed = (user?.is_superuser || user?.is_org_admin) && this.$route.meta.action === 'update' &&
|
||||
securityMFAAuth === MFASystemSetting.onlyAdminUsers
|
||||
if (securityMFAAuth === MFASystemSetting.allUsers) {
|
||||
options = [{ 'value': MFALevel.allUsers, 'label': this.$t('MFAAllUsers') }]
|
||||
mfa_level = MFALevel.allUsers
|
||||
}
|
||||
if (securityMFAAuth === MFASystemSetting.onlyAdminUsers && adminUserIsNeed) {
|
||||
options = [{
|
||||
'value': MFALevel.onlyAdminUsers,
|
||||
'label': this.$t('MFAOnlyAdminUsers')
|
||||
}]
|
||||
mfa_level = MFALevel.onlyAdminUsers
|
||||
}
|
||||
if (mfa_level !== null && options !== null) {
|
||||
this.fieldsMeta['mfa_level'].options = options
|
||||
this.initial.mfa_level = mfa_level
|
||||
store.getters.publicSettings['SECURITY_MFA_AUTH'] === 2
|
||||
if (store.getters.publicSettings['SECURITY_MFA_AUTH'] === 1 || adminUserIsNeed) {
|
||||
this.fieldsMeta['mfa_level'].disabled = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,6 @@ import { createSourceIdCache } from '@/api/common'
|
||||
import { getDayFuture } from '@/utils/time'
|
||||
import InviteUsersDialog from './components/InviteUsersDialog'
|
||||
import AmountFormatter from '@/components/Table/TableFormatters/AmountFormatter.vue'
|
||||
import store from '@/store'
|
||||
import { MFASystemSetting } from '../const'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -67,17 +65,7 @@ export default {
|
||||
}
|
||||
},
|
||||
mfa_level: {
|
||||
width: '130px',
|
||||
formatter: (row) => {
|
||||
const securityMFAAuth = store.getters.publicSettings['SECURITY_MFA_AUTH']
|
||||
if (securityMFAAuth === MFASystemSetting.allUsers) {
|
||||
return this.$t('MFAAllUsers')
|
||||
} else if (securityMFAAuth === MFASystemSetting.onlyAdminUsers && (row?.is_superuser || row?.is_org_admin)) {
|
||||
return this.$t('MFAOnlyAdminUsers')
|
||||
} else {
|
||||
return row['mfa_level'].label
|
||||
}
|
||||
}
|
||||
width: '130px'
|
||||
},
|
||||
source: {
|
||||
width: '120px',
|
||||
|
||||
@@ -100,13 +100,3 @@ export const userJSONSelectMeta = (vm, withoutOrgRole = false) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
export const MFALevel = {
|
||||
allUsers: 3,
|
||||
onlyAdminUsers: 4
|
||||
}
|
||||
|
||||
export const MFASystemSetting = {
|
||||
notEnable: 0,
|
||||
allUsers: 1,
|
||||
onlyAdminUsers: 2
|
||||
}
|
||||
|
||||
@@ -74,11 +74,6 @@ module.exports = {
|
||||
target: 'http://127.0.0.1:4200',
|
||||
changeOrigin: true
|
||||
},
|
||||
'/facelive/': {
|
||||
target: 'http://localhost:9999',
|
||||
changeOrigin: true,
|
||||
ws: true
|
||||
},
|
||||
'^/(core|static|media)/': {
|
||||
target: process.env.VUE_APP_CORE_HOST || 'http://127.0.0.1:8080',
|
||||
changeOrigin: true
|
||||
@@ -86,7 +81,8 @@ module.exports = {
|
||||
},
|
||||
after: require('./mock/mock-server.js')
|
||||
},
|
||||
css: {},
|
||||
css: {
|
||||
},
|
||||
configureWebpack: {
|
||||
// provide the app's title in webpack's name field, so that
|
||||
// it can be accessed in index.html to inject the correct title.
|
||||
@@ -94,8 +90,7 @@ module.exports = {
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve('src'),
|
||||
elementCss: resolve(
|
||||
'node_modules/element-ui/lib/theme-chalk/index.css'),
|
||||
elementCss: resolve('node_modules/element-ui/lib/theme-chalk/index.css'),
|
||||
elementLocale: resolve('node_modules/element-ui/lib/locale/lang/en.js')
|
||||
},
|
||||
extensions: ['.vue', '.js', '.json']
|
||||
@@ -153,7 +148,7 @@ module.exports = {
|
||||
.end()
|
||||
|
||||
config
|
||||
// https://webpack.js.org/configuration/devtool/#development
|
||||
// https://webpack.js.org/configuration/devtool/#development
|
||||
.when(process.env.NODE_ENV === 'development',
|
||||
config => config.devtool('cheap-source-map')
|
||||
)
|
||||
@@ -164,11 +159,10 @@ module.exports = {
|
||||
config
|
||||
.plugin('ScriptExtHtmlWebpackPlugin')
|
||||
.after('html')
|
||||
.use('script-ext-html-webpack-plugin', [
|
||||
{
|
||||
// `runtime` must same as runtimeChunk name. default is `runtime`
|
||||
inline: /runtime\..*\.js$/
|
||||
}])
|
||||
.use('script-ext-html-webpack-plugin', [{
|
||||
// `runtime` must same as runtimeChunk name. default is `runtime`
|
||||
inline: /runtime\..*\.js$/
|
||||
}])
|
||||
.end()
|
||||
config
|
||||
.optimization.splitChunks({
|
||||
|
||||
@@ -4466,9 +4466,9 @@ element-ui@2.15.14:
|
||||
throttle-debounce "^1.0.1"
|
||||
|
||||
elliptic@^6.5.3, elliptic@^6.5.4:
|
||||
version "6.6.0"
|
||||
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.6.0.tgz#5919ec723286c1edf28685aa89261d4761afa210"
|
||||
integrity sha512-dpwoQcLc/2WLQvJvLRHKZ+f9FgOdjnq11rurqwekGQygGPsYSK29OMMD2WalatiqQ+XGFDglTNixpPfI+lpaAA==
|
||||
version "6.5.4"
|
||||
resolved "https://registry.npmmirror.com/elliptic/-/elliptic-6.5.4.tgz"
|
||||
integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==
|
||||
dependencies:
|
||||
bn.js "^4.11.9"
|
||||
brorand "^1.1.0"
|
||||
|
||||
Reference in New Issue
Block a user