mirror of
https://github.com/jumpserver/lina.git
synced 2025-11-08 19:02:40 +00:00
Compare commits
1 Commits
v4.10.10
...
revert-519
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ed853e19a |
@@ -61,14 +61,13 @@ export function stopJob(form) {
|
||||
})
|
||||
}
|
||||
|
||||
export function JobUploadFile(form, config = {}) {
|
||||
export function JobUploadFile(form) {
|
||||
return request({
|
||||
url: '/api/v1/ops/jobs/upload/',
|
||||
method: 'post',
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
timeout: 60 * 60 * 1000,
|
||||
data: form,
|
||||
...config
|
||||
data: form
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { BASE_URL } from '@/utils/common/index'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
active: {
|
||||
@@ -43,16 +41,6 @@ export default {
|
||||
},
|
||||
handleExpand() {
|
||||
this.$emit('expand-full')
|
||||
},
|
||||
async openWebsite() {
|
||||
let url = `${BASE_URL}/?_=${Date.now()}`
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
url = url.replace('9528', '5173')
|
||||
}
|
||||
|
||||
const newUrl = new URL(url)
|
||||
window.open(newUrl.toString(), '_blank')
|
||||
return url
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +109,11 @@ export default {
|
||||
},
|
||||
connectivity: connectivityMeta,
|
||||
comment: { ...this.comment }
|
||||
},
|
||||
tableAttrs: {
|
||||
rowClassName({ row }) {
|
||||
return !row.is_active ? 'row_disabled' : ''
|
||||
}
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
|
||||
@@ -25,7 +25,6 @@ export default {
|
||||
},
|
||||
data() {
|
||||
const [key, value] = toM2MJsonParams(this.object.assets)
|
||||
const org_id = this.object.org_id || this.$store.getters.currentOrg.id
|
||||
return {
|
||||
config: {
|
||||
headerActions: {
|
||||
@@ -34,7 +33,7 @@ export default {
|
||||
hasExport: false
|
||||
},
|
||||
tableConfig: {
|
||||
url: `/api/v1/assets/assets/?${key}=${value}&oid=${org_id}`,
|
||||
url: `/api/v1/assets/assets/?${key}=${value}`,
|
||||
columns: ['name', 'address', 'platform', 'type', 'is_active'],
|
||||
columnsShow: {
|
||||
min: ['name', 'address'],
|
||||
|
||||
@@ -25,7 +25,6 @@ export default {
|
||||
},
|
||||
data() {
|
||||
const [key, value] = toM2MJsonParams(this.object.users)
|
||||
const org_id = this.object.org_id || this.$store.getters.currentOrg.id
|
||||
return {
|
||||
config: {
|
||||
headerActions: {
|
||||
@@ -34,7 +33,7 @@ export default {
|
||||
hasExport: false
|
||||
},
|
||||
tableConfig: {
|
||||
url: `/api/v1/users/users/?${key}=${value}&oid=${org_id}`,
|
||||
url: `/api/v1/users/users/?${key}=${value}`,
|
||||
columns: [
|
||||
'name', 'username', 'email', 'groups', 'system_roles',
|
||||
'org_roles', 'source', 'is_valid'
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<th>{{ $tc('Example') }}</th>
|
||||
</tr>
|
||||
<tr v-for="(item, index) in variables" :key="index">
|
||||
<td :title="$tc('ClickCopy')" class="item-td text-link" @click="onCopy(item.name)">
|
||||
<td :title="$tc('ClickCopy')" class="item-td text-link" @click="onCopy(item.key)">
|
||||
<label class="item-label">{{ item.name }}</label>
|
||||
</td>
|
||||
<td><span>{{ item.label }}</span></td>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<Echart
|
||||
<echarts
|
||||
ref="echarts"
|
||||
:options="options"
|
||||
:autoresize="true"
|
||||
@@ -12,10 +12,9 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import * as echarts from 'echarts'
|
||||
import { mix } from '@/utils/theme/color'
|
||||
import Echart from '@/components/Dashboard/Echart.vue'
|
||||
|
||||
export default {
|
||||
components: { Echart },
|
||||
components: {},
|
||||
props: {
|
||||
datesMetrics: {
|
||||
type: Array,
|
||||
|
||||
@@ -34,32 +34,18 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (!window._echarts) {
|
||||
window._echarts = {
|
||||
total: new Set(),
|
||||
finished: new Set()
|
||||
}
|
||||
}
|
||||
// 唯一 id,避免重复计数
|
||||
this._chartId = `chart_${Date.now()}_${Math.random().toString(36).slice(2)}`
|
||||
window._echarts.total.add(this._chartId)
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (window._echarts) {
|
||||
window._echarts.total.delete(this._chartId)
|
||||
window._echarts.finished.delete(this._chartId)
|
||||
// 可选:当没有图表时清理全局对象
|
||||
if (window._echarts.total.size === 0) {
|
||||
delete window._echarts
|
||||
delete window.echartsFinished
|
||||
}
|
||||
if (!window.totalCharts) {
|
||||
window.totalCharts = 0
|
||||
}
|
||||
window.totalCharts++
|
||||
},
|
||||
methods: {
|
||||
onFinished() {
|
||||
if (!window._echarts) return
|
||||
window._echarts.finished.add(this._chartId)
|
||||
if (window._echarts.finished.size === window._echarts.total.size) {
|
||||
if (!window.finishedCharts) {
|
||||
window.finishedCharts = 0
|
||||
}
|
||||
window.finishedCharts++
|
||||
if (window.finishedCharts === window.totalCharts) {
|
||||
window.echartsFinished = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<Echart
|
||||
<echarts
|
||||
ref="echarts"
|
||||
:options="options"
|
||||
:autoresize="true"
|
||||
@@ -14,11 +14,9 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import * as echarts from 'echarts'
|
||||
import { mix } from '@/utils/theme/color'
|
||||
import Echart from '@/components/Dashboard/Echart.vue'
|
||||
|
||||
export default {
|
||||
name: 'LoginMetric',
|
||||
components: { Echart },
|
||||
props: {
|
||||
range: {
|
||||
type: String,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<Echart
|
||||
<echarts
|
||||
ref="echarts"
|
||||
:options="options"
|
||||
:autoresize="true"
|
||||
@@ -13,10 +13,8 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import * as echarts from 'echarts'
|
||||
import { mix } from '@/utils/theme/color'
|
||||
import Echart from '@/components/Dashboard/Echart.vue'
|
||||
|
||||
export default {
|
||||
components: { Echart },
|
||||
props: {
|
||||
colors: {
|
||||
type: Array,
|
||||
@@ -37,15 +35,14 @@ export default {
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
return {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
options() {
|
||||
const seriesList = []
|
||||
const labels = this.data.map(item => item.label)
|
||||
const total = _.sumBy(this.data, function(i) {
|
||||
return i.total
|
||||
})
|
||||
const total = _.sumBy(this.data, function(i) { return i.total })
|
||||
for (let i = 0, len = this.data.length; i < len; i++) {
|
||||
const current = this.data[i]
|
||||
let num = (current.total / total) * 100
|
||||
@@ -180,8 +177,8 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.echarts {
|
||||
width: 100%;
|
||||
height: 72px;
|
||||
}
|
||||
.echarts {
|
||||
width: 100%;
|
||||
height: 72px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<Echart
|
||||
<echarts
|
||||
ref="echarts"
|
||||
:autoresize="true"
|
||||
:options="options"
|
||||
@@ -13,15 +13,12 @@ import 'echarts/lib/chart/line'
|
||||
import 'echarts/lib/component/legend'
|
||||
|
||||
import Decimal from 'decimal.js'
|
||||
import Echart from '@/components/Dashboard/Echart.vue'
|
||||
|
||||
export default {
|
||||
components: { Echart },
|
||||
props: {
|
||||
config: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
}
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
ref="dataForm"
|
||||
:fields="totalFields"
|
||||
:form="iForm"
|
||||
:server-errors="serverErrors"
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
>
|
||||
@@ -66,8 +65,7 @@ export default {
|
||||
totalFields: [],
|
||||
loading: true,
|
||||
groups: [],
|
||||
errors: {},
|
||||
serverErrors: {}
|
||||
errors: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -105,8 +103,6 @@ export default {
|
||||
this.generateColumns()
|
||||
this.$emit('afterGenerateColumns', this.totalFields)
|
||||
this.cleanFormValue()
|
||||
// 初始化时清空错误
|
||||
this.serverErrors = {}
|
||||
this.loading = false
|
||||
},
|
||||
generateColumns() {
|
||||
@@ -143,56 +139,15 @@ export default {
|
||||
cleanFormValue() {
|
||||
this._cleanFormValue(this.iForm, this.remoteMeta)
|
||||
},
|
||||
_getElFormInstance() {
|
||||
try {
|
||||
return this.$refs?.dataForm?.$refs?.form?.$refs?.elForm || null
|
||||
} catch (e) {
|
||||
return null
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @description 仅清理 UI 的错误展示,不触发表单内容重建
|
||||
*/
|
||||
clearAllFieldErrors() {
|
||||
const elForm = this._getElFormInstance()
|
||||
if (elForm && Array.isArray(elForm.fields)) {
|
||||
elForm.fields.forEach((item) => {
|
||||
item.validateMessage = ''
|
||||
item.validateState = ''
|
||||
})
|
||||
}
|
||||
// 不修改 totalFields/attrs,避免触发 content 重建导致输入丢失
|
||||
this.serverErrors = {}
|
||||
},
|
||||
setFieldError(name, error) {
|
||||
error = (error || '').toString().replace(/[。.]+$/, '')
|
||||
const elForm = this._getElFormInstance()
|
||||
if (elForm && Array.isArray(elForm.fields)) {
|
||||
const item = elForm.fields.find(f => f.prop === name)
|
||||
if (item) {
|
||||
item.validateMessage = error
|
||||
item.validateState = error ? 'error' : ''
|
||||
}
|
||||
error = error.replace(/[。.]+$/, '')
|
||||
const field = this.totalFields.find((v) => v.prop === name)
|
||||
if (!field) {
|
||||
return
|
||||
}
|
||||
// 不写入 totalFields,避免触发 innerContent 变化导致表单值被覆盖
|
||||
this.$set(this.serverErrors, name, error)
|
||||
},
|
||||
setErrors(errors) {
|
||||
const mapped = {}
|
||||
Object.entries(errors || {}).forEach(([k, v]) => {
|
||||
let msg = v
|
||||
if (Array.isArray(v)) msg = v.join('; ')
|
||||
else if (typeof v === 'object' && v !== null) msg = JSON.stringify(v)
|
||||
mapped[k] = String(msg || '')
|
||||
})
|
||||
this.serverErrors = mapped
|
||||
const elForm = this._getElFormInstance()
|
||||
if (elForm && Array.isArray(elForm.fields)) {
|
||||
elForm.fields.forEach((item) => {
|
||||
const msg = mapped[item.prop] || ''
|
||||
item.validateMessage = msg
|
||||
item.validateState = msg ? 'error' : ''
|
||||
})
|
||||
if (typeof error === 'string') {
|
||||
field.el.errors = error
|
||||
field.attrs.error = error
|
||||
}
|
||||
},
|
||||
groupHidden(group, i) {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
:prop="prop"
|
||||
:rules="_show && Array.isArray(data.rules) ? data.rules : []"
|
||||
v-bind="data.attrs"
|
||||
:error="errorText"
|
||||
>
|
||||
<template v-if="data.label" #label>
|
||||
<span :title="data.label">
|
||||
@@ -153,10 +152,6 @@ export default {
|
||||
props: {
|
||||
// eslint-disable-next-line vue/require-default-prop
|
||||
data: Object,
|
||||
serverErrors: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
prop: {
|
||||
type: String,
|
||||
default() {
|
||||
@@ -194,11 +189,6 @@ export default {
|
||||
classes() {
|
||||
return 'el-form-item-' + this.data.prop + ' ' + (this.data.attrs?.class || '')
|
||||
},
|
||||
errorText() {
|
||||
const fromAttrs = this.data?.attrs?.error
|
||||
const fromServer = this.serverErrors ? this.serverErrors[this.data.prop] : ''
|
||||
return fromAttrs || fromServer || ''
|
||||
},
|
||||
listeners() {
|
||||
const {
|
||||
data: {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
:is="item.type === GROUP ? 'render-form-group' : 'render-form-item'"
|
||||
:key="item.id"
|
||||
:data="item"
|
||||
:server-errors="serverErrors"
|
||||
:disabled="disabled || item.disabled"
|
||||
:item-value="value[item.id]"
|
||||
:options="options[item.id]"
|
||||
@@ -48,10 +47,6 @@ export default {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
serverErrors: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
:label-width="labelWidth"
|
||||
:style="{ '--label-width': labelWidth }"
|
||||
v-bind="$attrs"
|
||||
:server-errors="serverErrors"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<!-- slot 透传 -->
|
||||
@@ -122,10 +121,6 @@ export default {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
serverErrors: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
fields: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
<el-button
|
||||
:type="item.el && item.el.type"
|
||||
class="start-stop-btn"
|
||||
:disabled="item.disabled"
|
||||
size="mini"
|
||||
@click="item.callback()"
|
||||
>
|
||||
|
||||
@@ -244,12 +244,10 @@ export default {
|
||||
delete routeFilter.search
|
||||
}
|
||||
const asFilterTags = _.cloneDeep(this.filterTags)
|
||||
setTimeout(() => {
|
||||
this.filterTags = {
|
||||
...asFilterTags,
|
||||
...routeFilter
|
||||
}
|
||||
}, 100)
|
||||
this.filterTags = {
|
||||
...asFilterTags,
|
||||
...routeFilter
|
||||
}
|
||||
},
|
||||
getValueLabel(key, value) {
|
||||
for (const field of this.options) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
class="left"
|
||||
>
|
||||
<span v-if="component === 'AutoDataZTree'" class="title">
|
||||
{{ title }}
|
||||
{{ $t('AssetTree') }}
|
||||
</span>
|
||||
<component
|
||||
:is="component"
|
||||
@@ -111,13 +111,6 @@ export default {
|
||||
headerActions: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
title: {
|
||||
// eslint-disable-next-line vue/require-prop-type-constructor
|
||||
type: String,
|
||||
default() {
|
||||
return this.$t('AssetTree')
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -221,7 +221,7 @@ export default {
|
||||
|
||||
.dialog-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
justify-content: end;
|
||||
align-items: center;
|
||||
|
||||
.el-button {
|
||||
|
||||
@@ -6,7 +6,6 @@ import ptBrLocale from 'elementui-lts/lib/locale/lang/pt-br'
|
||||
import esLocale from 'elementui-lts/lib/locale/lang/es'
|
||||
import ruLocale from 'elementui-lts/lib/locale/lang/ru-RU'
|
||||
import koLocale from 'elementui-lts/lib/locale/lang/ko'
|
||||
import viLocale from 'elementui-lts/lib/locale/lang/vi'
|
||||
import zh from './zh.json'
|
||||
import zhHant from './zh_hant.json'
|
||||
import en from './en.json'
|
||||
@@ -40,9 +39,6 @@ const messages = {
|
||||
},
|
||||
ko: {
|
||||
...koLocale
|
||||
},
|
||||
vi: {
|
||||
...viLocale
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -225,9 +225,24 @@ export default {
|
||||
default(error, method, vm) {
|
||||
const response = error.response
|
||||
const data = response.data
|
||||
if (response.status === 400 && data && typeof data === 'object') {
|
||||
// 覆盖式设置错误映射,避免触发表单内容重建
|
||||
this.$refs.form.setErrors(data)
|
||||
if (response.status === 400) {
|
||||
for (const key of Object.keys(data)) {
|
||||
let err = ''
|
||||
let errorTips = data[key]
|
||||
if (errorTips instanceof Array) {
|
||||
errorTips = _.filter(errorTips, (item) => Object.keys(item).length > 0)
|
||||
for (const i of errorTips) {
|
||||
if (i instanceof Object) {
|
||||
err += i?.port?.join(',')
|
||||
} else {
|
||||
err += i
|
||||
}
|
||||
}
|
||||
} else {
|
||||
err = errorTips
|
||||
}
|
||||
this.$refs.form.setFieldError(key, err)
|
||||
}
|
||||
}
|
||||
this.$emit('performError', data)
|
||||
}
|
||||
|
||||
@@ -137,15 +137,14 @@ export default {
|
||||
this.$emit('submitError', error)
|
||||
const response = error.response
|
||||
const data = response.data
|
||||
// 不要逐个设置字段的 attrs.error 或改动 fields 引用。
|
||||
// 这样会触发表单 content 重建,导致用户已输入的内容被覆盖/清空,
|
||||
// 且可能出现只能显示一个字段错误的现象。
|
||||
// 这里改为使用 AutoDataForm 暴露的 setErrors(errors) 覆盖式设置:
|
||||
// - 直接同步到 UI 的 el-form-item.validateMessage
|
||||
// - 支持同时显示多个字段错误
|
||||
// - 不修改 fields/attrs 引用,避免输入丢失
|
||||
if (response.status === 400 && data && typeof data === 'object') {
|
||||
this.$refs.form.setErrors(data)
|
||||
if (response.status === 400) {
|
||||
for (const key of Object.keys(data)) {
|
||||
let value = data[key]
|
||||
if (value instanceof Array) {
|
||||
value = value.join(';')
|
||||
}
|
||||
this.$refs.form.setFieldError(key, value)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
10
src/main.js
10
src/main.js
@@ -25,7 +25,6 @@ import xss from '@/utils/secure'
|
||||
import ElTableTooltipPatch from '@/utils/vue/elTableTooltipPatch.js'
|
||||
import VSanitize from 'v-sanitize'
|
||||
import moment from 'moment'
|
||||
|
||||
moment.locale('zh-cn')
|
||||
|
||||
/**
|
||||
@@ -36,11 +35,10 @@ moment.locale('zh-cn')
|
||||
* Currently MockJs will be used in the production environment,
|
||||
* please remove it before going online ! ! !
|
||||
*/
|
||||
// 使用 mockXHR 无法使用 axios 中的 onUploadProgress 回调函数
|
||||
// if (process.env.NODE_ENV === 'development') {
|
||||
// const { mockXHR } = require('../mock')
|
||||
// mockXHR()
|
||||
// }
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const { mockXHR } = require('../mock')
|
||||
mockXHR()
|
||||
}
|
||||
|
||||
// set ElementUI lang to EN
|
||||
ElementUI.Tooltip.props.openDelay.default = 1000
|
||||
|
||||
@@ -34,9 +34,7 @@ export default [
|
||||
name: 'UserLoginACLList',
|
||||
component: () => import('@/views/acls/UserLoginACL/UserLoginACLList.vue'),
|
||||
meta: {
|
||||
title: i18n.t('UserLoginACLs'),
|
||||
menuTitle: i18n.t('UserLogin'),
|
||||
activeMenu: ''
|
||||
title: i18n.t('UserLoginACLs'), menuTitle: i18n.t('UserLogin'), activeMenu: ''
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -76,7 +74,7 @@ export default [
|
||||
},
|
||||
name: 'CmdACL',
|
||||
meta: {
|
||||
title: i18n.t('CommandFilterACLs'),
|
||||
title: i18n.t('CommandFilterACLs',),
|
||||
menuTitle: i18n.t('CommandFilter'),
|
||||
app: 'acls',
|
||||
resource: 'commandfilteracl'
|
||||
@@ -138,11 +136,7 @@ export default [
|
||||
path: '',
|
||||
name: 'AssetACLList',
|
||||
component: () => import('@/views/acls/AssetLoginACL/AssetLoginAclList.vue'),
|
||||
meta: {
|
||||
title: i18n.t('AssetACLs'),
|
||||
activeMenu: '',
|
||||
menuTitle: i18n.t('AssetConnect')
|
||||
}
|
||||
meta: { title: i18n.t('AssetACLs'), activeMenu: '', menuTitle: i18n.t('AssetConnect') }
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
@@ -167,53 +161,6 @@ export default [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'data-masking-rules',
|
||||
component: empty,
|
||||
redirect: {
|
||||
name: 'DataMaskingRuleList'
|
||||
},
|
||||
name: 'DataMaskingRules',
|
||||
meta: {
|
||||
title: i18n.t('DataMasking'),
|
||||
licenseRequired: true,
|
||||
app: 'acls',
|
||||
resource: 'datamaskingrule'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'DataMaskingRuleList',
|
||||
component: () => import('@/views/acls/DataMaskingRule/DataMaskingRuleList.vue'),
|
||||
meta: {
|
||||
title: i18n.t('DataMasking'),
|
||||
activeMenu: '',
|
||||
menuTitle: i18n.t('DataMasking')
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
name: 'DataMaskingRuleCreate',
|
||||
component: () => import('@/views/acls/DataMaskingRule/DataMaskingRuleCreateUpdate.vue'),
|
||||
hidden: true,
|
||||
meta: { title: '', activeMenu: '' }
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
name: 'DataMaskingRuleDetail',
|
||||
component: () => import('@/views/acls/DataMaskingRule/DataMaskingRuleDetail/index'),
|
||||
hidden: true,
|
||||
meta: { title: i18n.t('AssetACLDetail'), activeMenu: '' }
|
||||
},
|
||||
{
|
||||
path: ':id/update',
|
||||
name: 'DataMaskingRuleUpdate',
|
||||
component: () => import('@/views/acls/DataMaskingRule/DataMaskingRuleCreateUpdate.vue'),
|
||||
hidden: true,
|
||||
meta: { title: '', activeMenu: '' }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'cmd-groups',
|
||||
component: empty,
|
||||
@@ -290,11 +237,7 @@ export default [
|
||||
path: '',
|
||||
name: 'ConnectMethodACLList',
|
||||
component: () => import('@/views/acls/ConnectMethodACL/ConnectMethodAclList.vue'),
|
||||
meta: {
|
||||
title: i18n.t('ConnectMethodACLs'),
|
||||
activeMenu: '',
|
||||
menuTitle: i18n.t('ConnectMethod')
|
||||
}
|
||||
meta: { title: i18n.t('ConnectMethodACLs'), activeMenu: '', menuTitle: i18n.t('ConnectMethod') }
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
|
||||
@@ -28,7 +28,7 @@ export default [
|
||||
component: () => import('@/views/reports/audits/Dashboard.vue'), // Parent router-view
|
||||
name: 'AuditsReport',
|
||||
meta: {
|
||||
permissions: ['rbac.view_audit'],
|
||||
permissions: ['rbac.view_audits'],
|
||||
expanded: true,
|
||||
icon: 'user-o',
|
||||
title: i18n.t('AuditsReport')
|
||||
|
||||
@@ -739,7 +739,3 @@ div.el-loading-parent--relative {
|
||||
.margin-top-20 {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.el-message {
|
||||
z-index: 999999 !important;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// 鼠标可移入tooltip功能
|
||||
import { Table } from 'elementui-lts'
|
||||
import { getCell, getColumnByCell } from 'elementui-lts/packages/table/src/util'
|
||||
import { getStyle, hasClass } from 'elementui-lts/src/utils/dom'
|
||||
import { Table } from 'element-ui'
|
||||
import { getCell, getColumnByCell } from 'element-ui/packages/table/src/util'
|
||||
import { getStyle, hasClass } from 'element-ui/src/utils/dom'
|
||||
import { copy } from '../common/index'
|
||||
|
||||
Object.assign(Table.components.TableBody.methods, {
|
||||
|
||||
@@ -107,10 +107,6 @@ export default {
|
||||
data.secret = data[secretType]
|
||||
delete data[secretType]
|
||||
}
|
||||
|
||||
if (data.ssh_key_change_strategy === 'add') {
|
||||
data.ssh_key_change_strategy = this.initial.ssh_key_change_strategy
|
||||
}
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
handleConfirm() {
|
||||
this.$message.warning(this.$tc('ProcessingMessage'))
|
||||
const url = `/api/v1/accounts/gathered-accounts/${this.account.id}/`
|
||||
this.$axios.delete(url, {
|
||||
params: {
|
||||
|
||||
@@ -117,10 +117,6 @@ export default {
|
||||
data.secret = data[secretType]
|
||||
delete data[secretType]
|
||||
}
|
||||
|
||||
if (data.ssh_key_change_strategy === 'add') {
|
||||
data.ssh_key_change_strategy = this.initial.ssh_key_change_strategy
|
||||
}
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import i18n from '@/i18n/i18n'
|
||||
|
||||
const accountExistCache = new Map()
|
||||
|
||||
async function checkAccountExist(username, asset) {
|
||||
@@ -9,10 +8,9 @@ async function checkAccountExist(username, asset) {
|
||||
}
|
||||
const url = `/api/v1/accounts/accounts/?username=${encodeURIComponent(username)}&asset=${asset}`
|
||||
const data = await this.$axios.get(url)
|
||||
const results = data
|
||||
const isExist = results.length > 0
|
||||
accountExistCache.set(cacheKey, isExist)
|
||||
return isExist
|
||||
const result = data.length > 0
|
||||
accountExistCache.set(cacheKey, result)
|
||||
return result
|
||||
}
|
||||
|
||||
async function checkAccountsExist() {
|
||||
|
||||
@@ -141,9 +141,9 @@ export default {
|
||||
},
|
||||
async handleCommon(cmd, payload) {
|
||||
let rows = this.rows
|
||||
this.processing = true
|
||||
if (this.rows.length === 0) {
|
||||
rows = [this.row]
|
||||
this.processing = true
|
||||
}
|
||||
if (!payload) {
|
||||
payload = {}
|
||||
|
||||
@@ -18,13 +18,16 @@ export default {
|
||||
return {
|
||||
initial: {},
|
||||
fields: [
|
||||
[this.$t('Basic'), ['name']],
|
||||
[this.$t('Basic'), ['name', 'priority']],
|
||||
[this.$t('Users'), ['users']],
|
||||
[this.$t('ConnectMethod'), ['connect_methods']],
|
||||
[this.$t('Action'), ['action', 'reviewers']],
|
||||
[this.$t('Other'), ['is_active', 'comment']]
|
||||
],
|
||||
fieldsMeta: {
|
||||
priority: {
|
||||
rules: [rules.Required]
|
||||
},
|
||||
assets: assetJSONSelectMeta(this),
|
||||
users: userJSONSelectMeta(this, true),
|
||||
connect_methods: {
|
||||
|
||||
@@ -34,7 +34,7 @@ export default {
|
||||
key: this.$t('Reviewer'),
|
||||
value: this.object.reviewers.map(item => item.name).join(', ')
|
||||
},
|
||||
'date_created', 'created_by', 'comment'
|
||||
'priority', 'date_created', 'created_by', 'comment'
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -17,31 +17,8 @@ export default {
|
||||
columnsShow: {
|
||||
min: ['name', 'actions'],
|
||||
default: [
|
||||
'name', 'is_active', 'comment', 'actions'
|
||||
'name', 'priority', 'is_active', 'comment', 'actions'
|
||||
]
|
||||
},
|
||||
columnsMeta: {
|
||||
'connect_methods': {
|
||||
width: '240px',
|
||||
formatter: (row) => {
|
||||
const methods = Array.isArray(row.connect_methods) ? row.connect_methods : []
|
||||
const colors = ['success', 'warning', 'info', 'danger']
|
||||
|
||||
return (
|
||||
<div style='display: flex; flex-wrap: wrap; gap: 4px;'>
|
||||
{methods.map((item, idx) => (
|
||||
<el-tag
|
||||
key={idx}
|
||||
size='small'
|
||||
type={colors[idx % colors.length]}
|
||||
>
|
||||
{item}
|
||||
</el-tag>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
headerActions: {
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
<template>
|
||||
<GenericCreateUpdatePage v-bind="$data" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage'
|
||||
import { userJSONSelectMeta } from '@/views/users/const'
|
||||
import { assetJSONSelectMeta } from '@/views/assets/const'
|
||||
import AccountFormatter from '@/views/perms/AssetPermission/components/AccountFormatter.vue'
|
||||
|
||||
export default {
|
||||
name: 'DataMaskingRuleCreateUpdate',
|
||||
components: {
|
||||
GenericCreateUpdatePage
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
initial: {
|
||||
accounts: ['@ALL']
|
||||
},
|
||||
fields: [
|
||||
[this.$t('Basic'), ['name', 'priority']],
|
||||
[this.$t('Users'), ['users']],
|
||||
[this.$t('Asset'), ['assets']],
|
||||
[this.$t('Accounts'), ['accounts']],
|
||||
[this.$t('Rules'), ['fields_pattern', 'masking_method', 'mask_pattern']],
|
||||
[this.$t('Other'), ['is_active', 'comment']]
|
||||
],
|
||||
fieldsMeta: {
|
||||
assets: assetJSONSelectMeta(this),
|
||||
users: userJSONSelectMeta(this),
|
||||
accounts: {
|
||||
component: AccountFormatter,
|
||||
el: {
|
||||
showAddTemplate: false,
|
||||
enableVirtualAccount: false,
|
||||
value: ['@ALL'],
|
||||
assets: []
|
||||
},
|
||||
hidden: (formValue) => {
|
||||
const ids = formValue.assets?.ids
|
||||
this.fieldsMeta.accounts.el.assets = ids || []
|
||||
}
|
||||
},
|
||||
fields_pattern: {
|
||||
helpTip: this.$t('DataMaskingFieldsPatternHelpTip')
|
||||
},
|
||||
mask_pattern: {
|
||||
hidden: (formValue) => {
|
||||
return !['fixed_char'].includes(formValue.masking_method)
|
||||
}
|
||||
}
|
||||
},
|
||||
url: '/api/v1/acls/data-masking-rules/'
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@@ -1,39 +0,0 @@
|
||||
<template>
|
||||
<TwoCol>
|
||||
<AutoDetailCard :fields="detailFields" :object="object" :url="url" />
|
||||
</TwoCol>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AutoDetailCard from '@/components/Cards/DetailCard/auto'
|
||||
import TwoCol from '@/layout/components/Page/TwoColPage.vue'
|
||||
|
||||
export default {
|
||||
name: 'Detail',
|
||||
components: {
|
||||
TwoCol,
|
||||
AutoDetailCard
|
||||
},
|
||||
props: {
|
||||
object: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
url: `/api/v1/acls/data-masking-rules/${this.object.id}/`,
|
||||
detailFields: [
|
||||
'name', 'fields_pattern', 'masking_method', 'mask_pattern',
|
||||
'priority', 'date_created', 'created_by', 'comment'
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,51 +0,0 @@
|
||||
<template>
|
||||
<GenericDetailPage :active-menu.sync="config.activeMenu" :object.sync="instance" v-bind="config" v-on="$listeners">
|
||||
<keep-alive>
|
||||
<component :is="config.activeMenu" :object="instance" />
|
||||
</keep-alive>
|
||||
</GenericDetailPage>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { GenericDetailPage } from '@/layout/components'
|
||||
import Detail from './Detail.vue'
|
||||
import UserJsonTab from '@/components/Apps/ManyJsonTabs/UserJsonTab.vue'
|
||||
import AssetJsonTab from '@/components/Apps/ManyJsonTabs/AssetJsonTab.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
GenericDetailPage,
|
||||
Detail,
|
||||
UserJsonTab,
|
||||
AssetJsonTab
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
instance: {},
|
||||
config: {
|
||||
url: `/api/v1/acls/data-masking-rules/`,
|
||||
activeMenu: 'Detail',
|
||||
submenu: [
|
||||
{
|
||||
title: this.$t('Basic'),
|
||||
name: 'Detail'
|
||||
},
|
||||
{
|
||||
title: this.$t('MenuUsers'),
|
||||
name: 'UserJsonTab'
|
||||
},
|
||||
{
|
||||
title: this.$t('Assets'),
|
||||
name: 'AssetJsonTab'
|
||||
}
|
||||
],
|
||||
hasRightSide: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,35 +0,0 @@
|
||||
<template>
|
||||
<GenericListPage :header-actions="headerActions" :help-tip="helpMsg" :table-config="tableConfig" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { GenericListPage } from '@/layout/components'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
GenericListPage
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
helpMsg: this.$t('DataMaskingRuleHelpHelpMsg'),
|
||||
tableConfig: {
|
||||
url: '/api/v1/acls/data-masking-rules/',
|
||||
columnsExclude: ['users', 'assets', 'accounts', 'rules', 'reviewers', 'action'],
|
||||
columnsShow: {
|
||||
min: ['name', 'actions'],
|
||||
default: [
|
||||
'name', 'priority', 'is_active', 'comment', 'actions'
|
||||
]
|
||||
}
|
||||
},
|
||||
updateRoute: 'DataMaskingRuleUpdate',
|
||||
headerActions: {
|
||||
createRoute: 'DataMaskingRuleCreate',
|
||||
hasRefresh: true,
|
||||
hasExport: false,
|
||||
hasImport: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -31,7 +31,7 @@ export default {
|
||||
id: 'connect-asset',
|
||||
display_name: this.$t('AssetACLs'),
|
||||
name: 'AssetACLList',
|
||||
comment: this.$t('DataMaskingRuleHelpHelpText'),
|
||||
comment: this.$t('AssetLoginACLHelpText'),
|
||||
icon: 'assets',
|
||||
edition: 'enterprise',
|
||||
tags: ['asset']
|
||||
|
||||
@@ -181,10 +181,10 @@ export default {
|
||||
try {
|
||||
const res = await this.$axios.get(this.tableConfig.url)
|
||||
|
||||
if (res) {
|
||||
if (res && res.results) {
|
||||
this.transObject = {
|
||||
...this.object,
|
||||
gateways: res.map(item => {
|
||||
gateways: res.results.map(item => {
|
||||
return {
|
||||
name: item.name,
|
||||
id: item.id
|
||||
|
||||
@@ -20,37 +20,38 @@
|
||||
:assets="classifiedAssets"
|
||||
@submit="onConfirmRunAsset"
|
||||
/>
|
||||
<div class="job-container">
|
||||
<div class="select-assets">
|
||||
<SelectJobAssetDialog @change="handleSelectAssets" />
|
||||
</div>
|
||||
<div class="transition-box" style="width: calc(100% - 17px);">
|
||||
<CodeEditor
|
||||
v-if="ready"
|
||||
:options="cmOptions"
|
||||
:toolbar="toolbar"
|
||||
:value.sync="command"
|
||||
style="margin-bottom: 20px"
|
||||
/>
|
||||
<span v-if="executionInfo.status" style="float: right" />
|
||||
<div class="xterm-container">
|
||||
<QuickJobTerm
|
||||
ref="xterm"
|
||||
:show-tool-bar="true"
|
||||
:select-assets="selectAssets"
|
||||
:xterm-config="xtermConfig"
|
||||
:execution-info="executionInfo"
|
||||
@view-assets="viewConfirmRunAssets"
|
||||
<AssetTreeTable ref="TreeTable" :tree-setting="treeSetting">
|
||||
<template slot="table">
|
||||
<div class="transition-box" style="width: calc(100% - 17px);">
|
||||
<CodeEditor
|
||||
v-if="ready"
|
||||
:options="cmOptions"
|
||||
:toolbar="toolbar"
|
||||
:value.sync="command"
|
||||
style="margin-bottom: 20px"
|
||||
/>
|
||||
<span v-if="executionInfo.status" style="float: right" />
|
||||
<div class="xterm-container">
|
||||
<QuickJobTerm
|
||||
ref="xterm"
|
||||
:show-tool-bar="true"
|
||||
:select-assets="selectAssets"
|
||||
:xterm-config="xtermConfig"
|
||||
:execution-info="executionInfo"
|
||||
@view-assets="viewConfirmRunAssets"
|
||||
/>
|
||||
</div>
|
||||
<div style="display: flex;margin-top:10px;justify-content: space-between" />
|
||||
</div>
|
||||
<div style="display: flex;margin-top:10px;justify-content: space-between" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</AssetTreeTable>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import $ from '@/utils/jquery-vendor.js'
|
||||
import _isequal from 'lodash.isequal'
|
||||
import AssetTreeTable from '@/components/Apps/AssetTreeTable'
|
||||
import QuickJobTerm from '@/views/ops/Adhoc/components/QuickJobTerm.vue'
|
||||
import CodeEditor from '@/components/Form/FormFields/CodeEditor'
|
||||
import Page from '@/layout/components/Page'
|
||||
@@ -60,16 +61,15 @@ import VariableHelpDialog from './VariableHelpDialog.vue'
|
||||
import ConfirmRunAssetsDialog from './components/ConfirmRunAssetsDialog.vue'
|
||||
import SetVariableDialog from '@/views/ops/Template/components/SetVariableDialog.vue'
|
||||
import { createJob, getJob, getTaskDetail, stopJob } from '@/api/ops'
|
||||
import SelectJobAssetDialog from './components/SelectJobAssetDialog.vue'
|
||||
|
||||
export default {
|
||||
name: 'CommandExecution',
|
||||
components: {
|
||||
SelectJobAssetDialog,
|
||||
VariableHelpDialog,
|
||||
AdhocSaveDialog,
|
||||
AdhocOpenDialog,
|
||||
SetVariableDialog,
|
||||
AssetTreeTable,
|
||||
Page,
|
||||
QuickJobTerm,
|
||||
CodeEditor,
|
||||
@@ -91,6 +91,7 @@ export default {
|
||||
showOpenAdhocSaveDialog: false,
|
||||
showSetVariableDialog: false,
|
||||
showConfirmRunAssetsDialog: false,
|
||||
DataZTree: 0,
|
||||
runas: '',
|
||||
runasPolicy: 'skip',
|
||||
chdir: '',
|
||||
@@ -108,7 +109,7 @@ export default {
|
||||
align: 'left',
|
||||
icon: 'fa fa-play',
|
||||
tip: this.$t('RunCommand'),
|
||||
disabled: this.$store.getters.currentOrgIsRoot,
|
||||
isVisible: this.$store.getters.currentOrgIsRoot,
|
||||
el: {
|
||||
type: 'primary'
|
||||
},
|
||||
@@ -140,7 +141,7 @@ export default {
|
||||
align: 'left',
|
||||
value: '',
|
||||
placeholder: this.$tc('EnterRunUser'),
|
||||
tip: this.$tc('RunasHelpText'),
|
||||
// tip: this.$tc('RunasHelpText'),
|
||||
el: {
|
||||
autoComplete: true,
|
||||
query: (query, cb) => {
|
||||
@@ -294,6 +295,30 @@ export default {
|
||||
lineWrapping: true,
|
||||
mode: 'shell'
|
||||
},
|
||||
treeSetting: {
|
||||
treeUrl: '/api/v1/perms/users/self/nodes/children-with-assets/tree/',
|
||||
searchUrl: '/api/v1/perms/users/self/assets/tree/',
|
||||
showRefresh: true,
|
||||
showMenu: false,
|
||||
showSearch: true,
|
||||
notShowBuiltinTree: true,
|
||||
check: {
|
||||
enable: true
|
||||
},
|
||||
view: {
|
||||
dblClickExpand: false,
|
||||
showLine: true
|
||||
},
|
||||
callback: {
|
||||
onCheck: function(_event, treeId, treeNode) {
|
||||
const treeObj = $.fn.zTree.getZTreeObj(treeId)
|
||||
if (treeNode.checked) {
|
||||
treeObj.expandNode(treeNode, true, false, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
iShowTree: true,
|
||||
variableFormData: [],
|
||||
variableQueryParam: '',
|
||||
classifiedAssets: {
|
||||
@@ -303,7 +328,6 @@ export default {
|
||||
},
|
||||
selectAssets: [],
|
||||
selectNodes: [],
|
||||
selectHosts: [],
|
||||
lastRequestPayload: null
|
||||
}
|
||||
},
|
||||
@@ -311,6 +335,9 @@ export default {
|
||||
xterm() {
|
||||
return this.$refs.xterm.xterm
|
||||
},
|
||||
ztree() {
|
||||
return this.$refs.TreeTable.$refs.TreeList.$refs.AutoDataZTree.$refs.AutoDataZTree.$refs.dataztree.$refs.ztree
|
||||
},
|
||||
isRunning() {
|
||||
return this.executionInfo.status.value === 'running'
|
||||
}
|
||||
@@ -330,9 +357,6 @@ export default {
|
||||
async initData() {
|
||||
this.recoverStatus()
|
||||
},
|
||||
handleSelectAssets(assets) {
|
||||
this.selectHosts = assets
|
||||
},
|
||||
recoverStatus() {
|
||||
if (this.$route.query.taskId) {
|
||||
this.currentTaskId = this.$route.query.taskId
|
||||
@@ -408,6 +432,13 @@ export default {
|
||||
msg = JSON.stringify({ task: this.currentTaskId })
|
||||
this.ws.send(msg)
|
||||
},
|
||||
getSelectedNodes() {
|
||||
return this.ztree.getCheckedNodes().filter(node => {
|
||||
const status = node.getCheckStatus()
|
||||
return node.id !== 'search' && status.half === false
|
||||
})
|
||||
},
|
||||
|
||||
setCostTimeInterval() {
|
||||
this.toolbar.left.run.icon = 'fa fa-spinner fa-spin'
|
||||
this.toolbar.left.run.isVisible = true
|
||||
@@ -417,8 +448,17 @@ export default {
|
||||
},
|
||||
|
||||
getSelectedNodesAndHosts() {
|
||||
const hosts = this.selectHosts
|
||||
const nodes = []
|
||||
const hosts = this.getSelectedNodes().filter((item) => {
|
||||
return item.meta.type !== 'node'
|
||||
}).map(function(node) {
|
||||
return node.id
|
||||
})
|
||||
|
||||
const nodes = this.getSelectedNodes().filter((item) => {
|
||||
return item.meta.type === 'node'
|
||||
}).map(function(node) {
|
||||
return node.meta.data.id
|
||||
})
|
||||
return { hosts, nodes }
|
||||
},
|
||||
shouldReRequest(payload) {
|
||||
@@ -430,7 +470,8 @@ export default {
|
||||
execute() {
|
||||
// const size = 'rows=' + this.xterm.rows + '&cols=' + this.xterm.cols
|
||||
const { hosts, nodes } = this.getSelectedNodesAndHosts()
|
||||
if (this.selectHosts.length === 0) {
|
||||
|
||||
if (hosts.length === 0 && nodes.length === 0) {
|
||||
this.$message.error(this.$tc('RequiredAssetOrNode'))
|
||||
return
|
||||
}
|
||||
@@ -531,13 +572,6 @@ export default {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$container-bg-color: #f7f7f7;
|
||||
.job-container {
|
||||
display: flex;
|
||||
|
||||
.select-assets {
|
||||
width: 23.6%;
|
||||
}
|
||||
}
|
||||
|
||||
.transition-box {
|
||||
display: flex;
|
||||
@@ -557,7 +591,7 @@ $container-bg-color: #f7f7f7;
|
||||
|
||||
& ::v-deep .xterm {
|
||||
height: calc(100% - 8px);
|
||||
overflow-y: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -574,21 +608,51 @@ $container-bg-color: #f7f7f7;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.el-tree {
|
||||
background-color: inherit !important;
|
||||
}
|
||||
|
||||
.mini {
|
||||
margin-right: 5px;
|
||||
width: 12px !important;
|
||||
}
|
||||
|
||||
.auto-data-ztree {
|
||||
overflow: auto;
|
||||
/*border-right: solid 1px red;*/
|
||||
}
|
||||
|
||||
.vue-codemirror-wrap ::v-deep .CodeMirror {
|
||||
width: 600px;
|
||||
height: 100px;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
|
||||
.tree-box {
|
||||
margin-right: 2px;
|
||||
border: 1px solid #e0e0e0;
|
||||
|
||||
::v-deep .ztree {
|
||||
.level0 {
|
||||
.node_name {
|
||||
max-width: 100px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.output {
|
||||
padding-left: 30px;
|
||||
background-color: rgb(247 247 247);
|
||||
border: solid 1px #f3f3f3;;
|
||||
}
|
||||
|
||||
.tree-table-content {
|
||||
::v-deep .left {
|
||||
padding-top: 4px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,378 +0,0 @@
|
||||
<template>
|
||||
<div class="asset-select">
|
||||
<el-card>
|
||||
<div slot="header" class="clearfix">
|
||||
<span>已选资产({{ selectAssets.length }})</span>
|
||||
<el-button
|
||||
v-if="selectAssets.length > 0"
|
||||
style="float: right; padding: 3px 0"
|
||||
type="text"
|
||||
@click="handleClick"
|
||||
>
|
||||
请选择资产
|
||||
</el-button>
|
||||
</div>
|
||||
<div
|
||||
v-if="selectAssets.length === 0"
|
||||
class="empty-assets"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
aria-label="Select assets"
|
||||
@click=" handleClick()"
|
||||
>
|
||||
<i class="icon el-icon-plus" />
|
||||
<span class="title">请选择资产</span>
|
||||
<span class="subtitle">点击添加</span>
|
||||
</div>
|
||||
<div v-else class="asset-list">
|
||||
<div
|
||||
v-for="group in groupedAssets"
|
||||
:key="group.key"
|
||||
class="platform-group"
|
||||
>
|
||||
<div class="platform-group-header">
|
||||
<el-checkbox
|
||||
:indeterminate="isPlatformIndeterminate(group)"
|
||||
:value="isPlatformAllSelected(group)"
|
||||
@change="val => togglePlatformAll(group, val)"
|
||||
>
|
||||
<span class="platform-title">
|
||||
<img
|
||||
v-if="group.assets.length"
|
||||
:src="getPlatformLogo(group.assets[0])"
|
||||
class="platform-icon"
|
||||
>
|
||||
{{ group.platformName }} ({{ group.assets.length }})
|
||||
</span>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
<el-checkbox-group
|
||||
v-model="selectAssets"
|
||||
class="platform-group-assets"
|
||||
@change="onCheckboxChange"
|
||||
>
|
||||
<el-checkbox
|
||||
v-for="item in group.assets"
|
||||
:key="item.id"
|
||||
:label="item.id"
|
||||
>
|
||||
<span
|
||||
:title="item.name"
|
||||
class="asset-name"
|
||||
>{{ item.name }}</span>
|
||||
<i
|
||||
class="el-icon-minus asset-remove-icon"
|
||||
title="移除"
|
||||
@click.stop="removeAsset(item)"
|
||||
/>
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<AssetSelectDialog
|
||||
v-if="dialogVisible"
|
||||
ref="dialog"
|
||||
:base-node-url="baseNodeUrl"
|
||||
:base-url="baseUrl"
|
||||
:tree-setting="treeSetting"
|
||||
:tree-url-query="treeUrlQuery"
|
||||
:value="selectAssets"
|
||||
:visible.sync="dialogVisible"
|
||||
v-bind="$attrs"
|
||||
@cancel="handleCancel"
|
||||
@confirm="handleConfirm"
|
||||
v-on="$listeners"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AssetSelectDialog from '@/components/Apps/AssetSelect/dialog.vue'
|
||||
import { loadPlatformIcon } from '@/utils/jms/index'
|
||||
|
||||
export default {
|
||||
componentName: 'SelectJobAssetDialog',
|
||||
components: { AssetSelectDialog },
|
||||
props: {
|
||||
baseUrl: {
|
||||
type: String,
|
||||
default: '/api/v1/perms/users/self/assets/'
|
||||
},
|
||||
defaultPageSize: {
|
||||
type: Number,
|
||||
default: 10
|
||||
},
|
||||
baseNodeUrl: {
|
||||
type: String,
|
||||
default: '/api/v1/perms/users/self/nodes/'
|
||||
},
|
||||
treeUrlQuery: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
}
|
||||
},
|
||||
value: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
treeSetting: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
disabled: {
|
||||
type: [Boolean, Function],
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
selectAssetRows: [],
|
||||
selectAssets: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
groupedAssets() {
|
||||
const map = {}
|
||||
this.selectAssetRows.forEach(a => {
|
||||
const key = a?.type?.value || 'unknown'
|
||||
const name = a?.type?.label || a?.type?.value || 'Unknown'
|
||||
if (!map[key]) {
|
||||
map[key] = { key, platformName: name, assets: [] }
|
||||
}
|
||||
map[key].assets.push(a)
|
||||
})
|
||||
return Object.values(map)
|
||||
.map(g => {
|
||||
g.assets = g.assets.slice().sort((x, y) => (x.name || '').localeCompare(y.name || ''))
|
||||
return g
|
||||
})
|
||||
.sort((a, b) => a.platformName.localeCompare(b.platformName))
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClick() {
|
||||
this.dialogVisible = true
|
||||
},
|
||||
handleConfirm(valueSelected, rowsAdd) {
|
||||
if (valueSelected === undefined) {
|
||||
return
|
||||
}
|
||||
this.$emit('change', valueSelected)
|
||||
rowsAdd.forEach(item => {
|
||||
if (!this.selectAssetRows.find(i => i.id === item.id)) {
|
||||
this.selectAssetRows.push(item)
|
||||
}
|
||||
})
|
||||
// 移除已经取消选择的资产
|
||||
this.selectAssetRows = this.selectAssetRows.filter(r => valueSelected.includes(r.id))
|
||||
this.selectAssets = valueSelected
|
||||
this.dialogVisible = false
|
||||
},
|
||||
handleCancel() {
|
||||
this.dialogVisible = false
|
||||
},
|
||||
getPlatformLogo(platform) {
|
||||
return loadPlatformIcon(platform.name, platform.type.value)
|
||||
},
|
||||
onCheckboxChange(value) {
|
||||
this.selectAssets = value
|
||||
this.$emit('change', value)
|
||||
},
|
||||
isPlatformAllSelected(group) {
|
||||
return group.assets.length > 0 && group.assets.every(a => this.selectAssets.includes(a.id))
|
||||
},
|
||||
isPlatformIndeterminate(group) {
|
||||
const selected = group.assets.filter(a => this.selectAssets.includes(a.id)).length
|
||||
return selected > 0 && selected < group.assets.length
|
||||
},
|
||||
togglePlatformAll(group, checked) {
|
||||
const ids = group.assets.map(a => a.id)
|
||||
if (checked) {
|
||||
const merged = new Set(this.selectAssets.concat(ids))
|
||||
this.selectAssets = Array.from(merged)
|
||||
} else {
|
||||
this.selectAssets = this.selectAssets.filter(id => !ids.includes(id))
|
||||
}
|
||||
this.$emit('change', this.selectAssets)
|
||||
},
|
||||
removeAsset(asset) {
|
||||
this.selectAssets = this.selectAssets.filter(id => id !== asset.id)
|
||||
this.selectAssetRows = this.selectAssetRows.filter(r => r.id !== asset.id)
|
||||
this.$emit('change', this.selectAssets)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.asset-select {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
color: var(--color-border);
|
||||
|
||||
::v-deep {
|
||||
.el-card {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.el-card__body {
|
||||
height: calc(100vh - 200px);
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
padding: 10px 16px;
|
||||
}
|
||||
|
||||
.el-checkbox {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
padding: 3px 0;
|
||||
margin-right: 0;
|
||||
align-items: center;
|
||||
|
||||
.asset-remove-icon {
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
cursor: pointer;
|
||||
font-weight: normal;
|
||||
transition: opacity .15s ease;
|
||||
margin-left: auto;
|
||||
color: var(--color-danger);
|
||||
}
|
||||
|
||||
.el-checkbox__label {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
padding-right: 20px;
|
||||
padding-left: 3px;
|
||||
}
|
||||
|
||||
.el-checkbox__label:hover .asset-remove-icon {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.asset-list {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.asset-name {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 180px;
|
||||
}
|
||||
|
||||
.platform-group {
|
||||
margin-bottom: 8px;
|
||||
padding: 6px 8px;
|
||||
}
|
||||
|
||||
.platform-group-header {
|
||||
padding-bottom: 4px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.platform-title {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
color: #a2aabd;
|
||||
font-weight: 800;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.platform-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.platform-group-assets {
|
||||
padding-left: 15px;
|
||||
margin-left: 3px;
|
||||
border-left: 2px solid var(--color-border);
|
||||
}
|
||||
|
||||
.select-asset-button {
|
||||
position: relative;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%); /* 让中心点对齐 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.el-select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.page ::v-deep .page-heading {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.el-dialog__wrapper ::v-deep .el-dialog__body {
|
||||
padding: 0 0 0 3px;
|
||||
}
|
||||
|
||||
.empty-assets {
|
||||
border: 2px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
padding: 56px 16px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: border-color .2s, background-color .25s, color .2s;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
height: 100%;
|
||||
background: #fff;
|
||||
|
||||
.icon {
|
||||
font-size: 42px;
|
||||
line-height: 1;
|
||||
margin-bottom: 14px;
|
||||
color: #c0c4cc;
|
||||
transition: color .2s;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 12px;
|
||||
opacity: .75;
|
||||
}
|
||||
}
|
||||
|
||||
.empty-assets:hover:not(.is-disabled) {
|
||||
border-color: var(--color-primary);
|
||||
background: #f5f9ff;
|
||||
color: var(--color-primary);
|
||||
|
||||
.icon {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.empty-assets.is-disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: .55;
|
||||
background: #fafafa;
|
||||
|
||||
.disabled-tip {
|
||||
color: #c0c4cc;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -10,142 +10,136 @@
|
||||
{{ tip }}
|
||||
</span>
|
||||
</el-alert>
|
||||
<div class="job-container">
|
||||
<div class="select-assets">
|
||||
<SelectJobAssetDialog @change="handleSelectAssets" />
|
||||
</div>
|
||||
<div class="transition-box" style="width: calc(100% - 17px);">
|
||||
<div class="upload_input">
|
||||
<el-button
|
||||
:disabled="runButton.disabled"
|
||||
:type="runButton.el&&runButton.el.type"
|
||||
size="small"
|
||||
style="display: inline-block; padding: 6px 10px"
|
||||
@click="runButton.callback()"
|
||||
>
|
||||
<i :class="runButton.icon" style="margin-right: 4px;" />{{ runButton.name }}
|
||||
</el-button>
|
||||
</div>
|
||||
<span style="color: red">*</span>
|
||||
<div class="upload_input">{{ $t('Account') }}:</div>
|
||||
<div class="upload_input">
|
||||
<el-autocomplete
|
||||
v-model="runAsInput.value"
|
||||
:fetch-suggestions="runAsInput.el.query"
|
||||
:placeholder="runAsInput.placeholder"
|
||||
size="mini"
|
||||
style="display: inline-block; margin: 0 2px"
|
||||
@change="runAsInput.callback(runAsInput.value)"
|
||||
@select="runAsInput.callback(runAsInput.value)"
|
||||
/>
|
||||
</div>
|
||||
<div class="upload_input">{{ $t('UploadDir') }}:</div>
|
||||
<div class="upload_input">
|
||||
<el-input
|
||||
v-if="dstPathInput.type==='input'"
|
||||
v-model="dstPath"
|
||||
:placeholder="dstPathInput.placeholder"
|
||||
size="mini"
|
||||
@change="dstPathInput.callback(dstPathInput.value)"
|
||||
>
|
||||
<template slot="prepend">/tmp/</template>
|
||||
</el-input>
|
||||
</div>
|
||||
<div
|
||||
class="file-uploader"
|
||||
>
|
||||
<el-card>
|
||||
<el-upload
|
||||
v-if="ready"
|
||||
ref="upload"
|
||||
:auto-upload="false"
|
||||
:on-change="onFileChange"
|
||||
:value.sync="uploadFileList"
|
||||
action=""
|
||||
drag
|
||||
multiple
|
||||
|
||||
<AssetTreeTable ref="AssetTreeTable" :tree-setting="treeSetting">
|
||||
<template slot="table">
|
||||
<div class="transition-box" style="width: calc(100% - 17px);">
|
||||
<div class="upload_input">
|
||||
<el-button
|
||||
:disabled="runButton.disabled"
|
||||
:type="runButton.el&&runButton.el.type"
|
||||
size="small"
|
||||
style="display: inline-block; padding: 6px 10px"
|
||||
@click="runButton.callback()"
|
||||
>
|
||||
<i class="el-icon-upload" />
|
||||
<div class="el-upload__text" style="margin-bottom: 10px;padding: 0 5px 0 5px ">
|
||||
{{ $t('DragUploadFileInfo') }}
|
||||
</div>
|
||||
<span>
|
||||
{{ $t('UploadFileLthHelpText', {limit: sizeLimitMb}) }}
|
||||
</span>
|
||||
<div slot="file" slot-scope="{file}">
|
||||
<li class="el-upload-list__item is-ready" tabindex="0">
|
||||
<a :style="sameFileStyle(file)" class="el-upload-list__item-name">
|
||||
<i class="el-icon-document" />{{ file.name }}
|
||||
<i style="color: #1ab394;float: right;font-weight:normal">
|
||||
{{ formatFileSize(file.size) }}
|
||||
<i class="el-icon-close" @click="removeFile(file)" />
|
||||
</i>
|
||||
</a>
|
||||
</li>
|
||||
</div>
|
||||
<div
|
||||
v-if="uploadFileList.length === 0"
|
||||
slot="tip"
|
||||
class="empty-file-tip"
|
||||
>
|
||||
{{ $tc('NoFiles') }}
|
||||
</div>
|
||||
</el-upload>
|
||||
<el-progress
|
||||
v-if="showProgress"
|
||||
:percentage="progressLength"
|
||||
<i :class="runButton.icon" style="margin-right: 4px;" />{{ runButton.name }}
|
||||
</el-button>
|
||||
</div>
|
||||
<span style="color: red">*</span>
|
||||
<div class="upload_input">{{ $t('Account') }}:</div>
|
||||
<div class="upload_input">
|
||||
<el-autocomplete
|
||||
v-model="runAsInput.value"
|
||||
:fetch-suggestions="runAsInput.el.query"
|
||||
:placeholder="runAsInput.placeholder"
|
||||
size="mini"
|
||||
style="display: inline-block; margin: 0 2px"
|
||||
@change="runAsInput.callback(runAsInput.value)"
|
||||
@select="runAsInput.callback(runAsInput.value)"
|
||||
/>
|
||||
<div v-if="showProgress" class="status-info">
|
||||
<span class="left">{{ speedText }}</span>
|
||||
<span class="right">{{ loadedSize }} / {{ totalSize }}</span>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
<div style="margin-bottom: 5px;font-weight: bold; display: inline-block">{{ $tc('Output') }}:</div>
|
||||
<span v-if="executionInfo.status && summary && !showProgress" style="float: right">
|
||||
<span>
|
||||
<span><b>{{ $tc('Status') }}: </b></span>
|
||||
<span
|
||||
v-if="executionInfo.status==='timeout'"
|
||||
class="status_warning"
|
||||
>{{ $tc('Timeout') }}</span>
|
||||
<span v-else>
|
||||
<span class="status_success">{{ $tc('Success') + ': ' + summary.success }}</span>
|
||||
<span class="status_warning">{{ $tc('Skip') + ': ' + summary.skip }}</span>
|
||||
<span class="status_danger">{{ $tc('Failed') + ': ' + summary.failed }}</span>
|
||||
</div>
|
||||
<div class="upload_input">{{ $t('UploadDir') }}:</div>
|
||||
<div class="upload_input">
|
||||
<el-input
|
||||
v-if="dstPathInput.type==='input'"
|
||||
v-model="dstPath"
|
||||
:placeholder="dstPathInput.placeholder"
|
||||
size="mini"
|
||||
@change="dstPathInput.callback(dstPathInput.value)"
|
||||
>
|
||||
<template slot="prepend">/tmp/</template>
|
||||
</el-input>
|
||||
</div>
|
||||
<div
|
||||
class="file-uploader"
|
||||
>
|
||||
<el-card>
|
||||
<el-upload
|
||||
v-if="ready"
|
||||
ref="upload"
|
||||
:auto-upload="false"
|
||||
:on-change="onFileChange"
|
||||
:value.sync="uploadFileList"
|
||||
action=""
|
||||
drag
|
||||
multiple
|
||||
>
|
||||
<i class="el-icon-upload" />
|
||||
<div class="el-upload__text" style="margin-bottom: 10px;padding: 0 5px 0 5px ">
|
||||
{{ $t('DragUploadFileInfo') }}
|
||||
</div>
|
||||
<span>
|
||||
{{ $t('UploadFileLthHelpText', {limit: SizeLimitMb}) }}
|
||||
</span>
|
||||
<div slot="file" slot-scope="{file}">
|
||||
<li class="el-upload-list__item is-ready" tabindex="0">
|
||||
<a :style="sameFileStyle(file)" class="el-upload-list__item-name">
|
||||
<i class="el-icon-document" />{{ file.name }}
|
||||
<i style="color: #1ab394;float: right;font-weight:normal">
|
||||
{{ formatFileSize(file.size) }}
|
||||
<i class="el-icon-close" @click="removeFile(file)" />
|
||||
</i>
|
||||
</a>
|
||||
</li>
|
||||
</div>
|
||||
<div
|
||||
v-if="uploadFileList.length === 0"
|
||||
slot="tip"
|
||||
class="empty-file-tip"
|
||||
>
|
||||
{{ $tc('NoFiles') }}
|
||||
</div>
|
||||
</el-upload>
|
||||
<el-progress v-if="ShowProgress" :percentage="progressLength" />
|
||||
|
||||
</el-card>
|
||||
</div>
|
||||
<div style="margin-bottom: 5px;font-weight: bold; display: inline-block">{{ $tc('Output') }}:</div>
|
||||
<span v-if="executionInfo.status && summary" style="float: right">
|
||||
<span>
|
||||
<span><b>{{ $tc('Status') }}: </b></span>
|
||||
<span
|
||||
v-if="executionInfo.status==='timeout'"
|
||||
class="status_warning"
|
||||
>{{ $tc('Timeout') }}</span>
|
||||
<span v-else>
|
||||
<span class="status_success">{{ $tc('Success') + ': ' + summary.success }}</span>
|
||||
<span class="status_warning">{{ $tc('Skip') + ': ' + summary.skip }}</span>
|
||||
<span class="status_danger">{{ $tc('Failed') + ': ' + summary.failed }}</span>
|
||||
</span>
|
||||
</span>
|
||||
<span>
|
||||
<span><b>{{ $tc('TimeDelta') }}: </b></span>
|
||||
<span>{{ executionInfo.timeCost }}</span>
|
||||
</span>
|
||||
</span>
|
||||
<span>
|
||||
<span><b>{{ $tc('TimeDelta') }}: </b></span>
|
||||
<span>{{ executionInfo.timeCost }}</span>
|
||||
</span>
|
||||
</span>
|
||||
<div class="output">
|
||||
<Term
|
||||
ref="xterm"
|
||||
:show-tool-bar="true"
|
||||
:xterm-config="xtermConfig"
|
||||
/>
|
||||
<div style="height: 2px" />
|
||||
<div class="output">
|
||||
<Term
|
||||
ref="xterm"
|
||||
:show-tool-bar="true"
|
||||
:xterm-config="xtermConfig"
|
||||
/>
|
||||
<div style="height: 2px" />
|
||||
</div>
|
||||
<div style="display: flex; margin-top:10px; justify-content: space-between" />
|
||||
</div>
|
||||
<div style="display: flex; margin-top:10px; justify-content: space-between" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</AssetTreeTable>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AssetTreeTable from '@/components/Apps/AssetTreeTable'
|
||||
import Term from '@/components/Widgets/Term'
|
||||
import Page from '@/layout/components/Page'
|
||||
import { createJob, getTaskDetail, JobUploadFile } from '@/api/ops'
|
||||
import { formatFileSize } from '@/utils/common/index'
|
||||
import store from '@/store'
|
||||
import SelectJobAssetDialog from '@/views/ops/Adhoc/components/SelectJobAssetDialog.vue'
|
||||
|
||||
export default {
|
||||
name: 'FileTransfer',
|
||||
components: {
|
||||
SelectJobAssetDialog,
|
||||
AssetTreeTable,
|
||||
Page,
|
||||
Term
|
||||
},
|
||||
@@ -160,6 +154,7 @@ export default {
|
||||
cancel: 0
|
||||
},
|
||||
xtermConfig: {},
|
||||
DataZTree: 0,
|
||||
runas: '',
|
||||
dstPath: '',
|
||||
runButton: {
|
||||
@@ -214,11 +209,27 @@ export default {
|
||||
this.chdir = val
|
||||
}
|
||||
},
|
||||
treeSetting: {
|
||||
treeUrl: '/api/v1/perms/users/self/nodes/children-with-assets/tree/',
|
||||
searchUrl: '/api/v1/perms/users/self/assets/tree/',
|
||||
notShowBuiltinTree: true,
|
||||
showRefresh: true,
|
||||
showMenu: false,
|
||||
showSearch: true,
|
||||
check: {
|
||||
enable: true
|
||||
},
|
||||
view: {
|
||||
dblClickExpand: false,
|
||||
showLine: true
|
||||
}
|
||||
},
|
||||
iShowTree: true,
|
||||
progressLength: 0,
|
||||
showProgress: false,
|
||||
ShowProgress: false,
|
||||
upload_interval: null,
|
||||
uploadFileList: [],
|
||||
sizeLimitMb: store.getters.publicSettings['FILE_UPLOAD_SIZE_LIMIT_MB'],
|
||||
SizeLimitMb: store.getters.publicSettings['FILE_UPLOAD_SIZE_LIMIT_MB'],
|
||||
summary: {
|
||||
'success': 0,
|
||||
'failed': 0,
|
||||
@@ -228,16 +239,15 @@ export default {
|
||||
this.$tc('FileTransferBootStepHelpTips1'),
|
||||
this.$tc('FileTransferBootStepHelpTips2'),
|
||||
this.$tc('FileTransferBootStepHelpTips3')
|
||||
],
|
||||
speedText: '',
|
||||
loadedSize: '',
|
||||
totalSize: '',
|
||||
selectHosts: []
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
xterm() {
|
||||
return this.$refs.xterm.xterm
|
||||
},
|
||||
ztree() {
|
||||
return this.$refs.AssetTreeTable.$refs.TreeList.$refs.AutoDataZTree.$refs.AutoDataZTree.$refs.dataztree.$refs.ztree
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -291,7 +301,8 @@ export default {
|
||||
if (this.executionInfo.status === 'success') {
|
||||
this.$message.success(this.$tc('RunSucceed'))
|
||||
clearInterval(this.upload_interval)
|
||||
this.showProgress = false
|
||||
this.progressLength = 100
|
||||
this.ShowProgress = true
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -304,6 +315,13 @@ export default {
|
||||
msg = JSON.stringify({ task: this.currentTaskId })
|
||||
this.ws.send(msg)
|
||||
},
|
||||
getSelectedNodes() {
|
||||
return this.ztree.getCheckedNodes().filter(node => {
|
||||
const status = node.getCheckStatus()
|
||||
return node.id !== 'search' && status.half === false
|
||||
})
|
||||
},
|
||||
|
||||
setCostTimeInterval() {
|
||||
this.runButton.icon = 'fa fa-spinner fa-spin'
|
||||
this.runButton.disabled = true
|
||||
@@ -312,8 +330,17 @@ export default {
|
||||
}, 1000)
|
||||
},
|
||||
getSelectedNodesAndHosts() {
|
||||
const hosts = this.selectHosts
|
||||
const nodes = []
|
||||
const hosts = this.getSelectedNodes().filter((item) => {
|
||||
return item.meta.type !== 'node'
|
||||
}).map(function(node) {
|
||||
return node.id
|
||||
})
|
||||
|
||||
const nodes = this.getSelectedNodes().filter((item) => {
|
||||
return item.meta.type === 'node'
|
||||
}).map(function(node) {
|
||||
return node.meta.data.id
|
||||
})
|
||||
return { hosts, nodes }
|
||||
},
|
||||
truncateFileName(fullName) {
|
||||
@@ -339,7 +366,7 @@ export default {
|
||||
return ''
|
||||
},
|
||||
isFileExceedsLimit(file) {
|
||||
const isGtLimit = file.size / 1024 / 1024 > this.sizeLimitMb
|
||||
const isGtLimit = file.size / 1024 / 1024 > this.SizeLimitMb
|
||||
if (isGtLimit) {
|
||||
this.$message.error(this.$tc('FileSizeExceedsLimit'))
|
||||
}
|
||||
@@ -354,9 +381,6 @@ export default {
|
||||
this.uploadFileList.splice(this.uploadFileList.indexOf(file), 1)
|
||||
this.handleSameFile(this.uploadFileList)
|
||||
},
|
||||
formatSpeed(bps) {
|
||||
return `${this.formatFileSize(bps)}/s`
|
||||
},
|
||||
execute() {
|
||||
const { hosts, nodes } = this.getSelectedNodesAndHosts()
|
||||
for (const file of this.uploadFileList) {
|
||||
@@ -402,10 +426,8 @@ export default {
|
||||
createJob(data).then(res => {
|
||||
this.progressLength = 0
|
||||
this.executionInfo.timeCost = 0
|
||||
this.showProgress = true
|
||||
this.speedText = ''
|
||||
this.ShowProgress = true
|
||||
const form = new FormData()
|
||||
const start = Date.now()
|
||||
for (const file of this.uploadFileList) {
|
||||
form.append('files', file.raw)
|
||||
form.append('job_id', res.id)
|
||||
@@ -415,59 +437,31 @@ export default {
|
||||
clearInterval(this.upload_interval)
|
||||
return
|
||||
}
|
||||
this.progressLength += 1
|
||||
}, 100)
|
||||
JobUploadFile(form, {
|
||||
onUploadProgress: (e) => {
|
||||
if (!e.total) return
|
||||
const percent = Math.floor((e.loaded / e.total) * 100)
|
||||
this.progressLength = Math.min(percent, 100)
|
||||
this.loadedSize = formatFileSize(e.loaded)
|
||||
this.totalSize = formatFileSize(e.total)
|
||||
const elapsedSec = (Date.now() - start) / 1000
|
||||
if (elapsedSec > 0) {
|
||||
const speed = e.loaded / elapsedSec
|
||||
this.speedText = this.formatSpeed(speed)
|
||||
}
|
||||
}
|
||||
}).then(res => {
|
||||
JobUploadFile(form).then(res => {
|
||||
this.executionInfo.status = 'running'
|
||||
this.currentTaskId = res.task_id
|
||||
this.xtermConfig = { taskId: this.currentTaskId, type: 'shortcut_cmd' }
|
||||
this.setCostTimeInterval()
|
||||
this.writeExecutionOutput()
|
||||
}).catch((error) => {
|
||||
this.$message.error(this.$tc('Error'), error)
|
||||
}).catch(() => {
|
||||
this.execute_stop()
|
||||
})
|
||||
})
|
||||
},
|
||||
execute_stop() {
|
||||
this.progressLength = 0
|
||||
this.showProgress = false
|
||||
this.ShowProgress = false
|
||||
this.runButton.disabled = false
|
||||
clearInterval(this.upload_interval)
|
||||
this.runButton.icon = 'fa fa-play'
|
||||
},
|
||||
handleSelectAssets(assets) {
|
||||
this.selectHosts = assets
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.job-container {
|
||||
display: flex;
|
||||
|
||||
.select-assets {
|
||||
width: 23.6%;
|
||||
}
|
||||
}
|
||||
|
||||
.transition-box {
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.mini-button {
|
||||
width: 12px;
|
||||
float: right;
|
||||
@@ -479,11 +473,19 @@ export default {
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.el-tree {
|
||||
background-color: inherit !important;
|
||||
}
|
||||
|
||||
.mini {
|
||||
margin-right: 5px;
|
||||
width: 12px !important;
|
||||
}
|
||||
|
||||
.auto-data-ztree {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.vue-codemirror-wrap ::v-deep .CodeMirror {
|
||||
width: 600px;
|
||||
height: 100px;
|
||||
@@ -494,6 +496,11 @@ export default {
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.tree-box {
|
||||
margin-right: 2px;
|
||||
border: 1px solid #e0e0e0;
|
||||
}
|
||||
|
||||
.status_success {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
@@ -561,14 +568,6 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.el-progress-bar {
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.el-progress__text {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,11 +580,4 @@ export default {
|
||||
.output ::v-deep #terminal {
|
||||
border: dashed 1px #d9d9d9;
|
||||
}
|
||||
|
||||
.status-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -189,7 +189,8 @@ export const realChoices = [
|
||||
},
|
||||
{
|
||||
label: AccountLabelMapper[ExcludeAccount],
|
||||
value: ExcludeAccount
|
||||
value: ExcludeAccount,
|
||||
tip: i18n.t('ExcludeAccountTip')
|
||||
},
|
||||
{
|
||||
label: AccountLabelMapper[NoneAccount],
|
||||
|
||||
@@ -20,8 +20,7 @@ export default {
|
||||
hasExport: false,
|
||||
hasImport: false,
|
||||
hasBulkDelete: false,
|
||||
hasCreate: true,
|
||||
canCreate: true
|
||||
hasCreate: true
|
||||
},
|
||||
tableConfig: {
|
||||
hasSelection: true,
|
||||
@@ -42,12 +41,6 @@ export default {
|
||||
date_created: {
|
||||
label: this.$t('DateCreated'),
|
||||
formatter: DateFormatter
|
||||
},
|
||||
actions: {
|
||||
formatterArgs: {
|
||||
canUpdate: true,
|
||||
canClone: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ export default {
|
||||
},
|
||||
callbacks: {
|
||||
click: function() {
|
||||
this.$router.push({ name: 'SSHKeyList', query: { tab: 'SSHKeyList' } })
|
||||
this.$router.push({ name: 'SSHKeyList', query: { tab: 'SSHKey' } })
|
||||
}.bind(this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<div class="chart-container-title">
|
||||
<div class="chart-container-title-text">{{ $t('TaskExecutionTrends') }}</div>
|
||||
<div class="chart">
|
||||
<Echart
|
||||
<echarts
|
||||
:options="ExecutionMetricsOptions"
|
||||
:autoresize="true"
|
||||
/>
|
||||
@@ -52,7 +52,6 @@ import BaseReport from '../base/BaseReport.vue'
|
||||
import SummaryCountCard from '@/components/Dashboard/SummaryCountCard.vue'
|
||||
import SwitchDate from '@/components/Dashboard/SwitchDate.vue'
|
||||
import * as echarts from 'echarts'
|
||||
import Echart from '@/components/Dashboard/Echart.vue'
|
||||
import AccountSummary from '@/views/reports/pam/ChangeSecret/AccountSummary.vue'
|
||||
import RiskSummary from '@/views/reports/pam/Dashboard/RiskSummary.vue'
|
||||
|
||||
@@ -62,8 +61,7 @@ export default {
|
||||
AccountSummary,
|
||||
SwitchDate,
|
||||
SummaryCountCard,
|
||||
BaseReport,
|
||||
Echart
|
||||
BaseReport
|
||||
},
|
||||
props: {
|
||||
nav: {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="chart-container-title">
|
||||
<div class="chart-container-title-text">{{ $t('AccountCreationSourceDistribution') }}</div>
|
||||
<div class="chart">
|
||||
<Echart
|
||||
<echarts
|
||||
:options="SourceOptions"
|
||||
:autoresize="true"
|
||||
/>
|
||||
@@ -31,7 +31,7 @@
|
||||
<div class="chart-container-title">
|
||||
<div class="chart-container-title-text">{{ $t('AccountConnectivityStatusDistribution') }}</div>
|
||||
<div class="chart">
|
||||
<Echart
|
||||
<echarts
|
||||
:options="ConnectivityOptions"
|
||||
:autoresize="true"
|
||||
/>
|
||||
@@ -42,7 +42,7 @@
|
||||
<div class="chart-container-title">
|
||||
<div class="chart-container-title-text">{{ $t('AccountPasswordChangeTrends') }}</div>
|
||||
<div class="chart">
|
||||
<Echart
|
||||
<echarts
|
||||
:options="ChangeSecretOptions"
|
||||
:autoresize="true"
|
||||
/>
|
||||
@@ -70,7 +70,6 @@
|
||||
import BaseReport from '../base/BaseReport.vue'
|
||||
import SummaryCountCard from '@/components/Dashboard/SummaryCountCard.vue'
|
||||
import * as echarts from 'echarts'
|
||||
import Echart from '@/components/Dashboard/Echart.vue'
|
||||
import { mixColors } from '@/views/reports/const'
|
||||
import RankTable from '@/views/reports/users/components/RankTable.vue'
|
||||
|
||||
@@ -78,8 +77,7 @@ export default {
|
||||
components: {
|
||||
RankTable,
|
||||
SummaryCountCard,
|
||||
BaseReport,
|
||||
Echart
|
||||
BaseReport
|
||||
},
|
||||
props: {
|
||||
nav: {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<div class="chart-container-title">
|
||||
<div class="chart-container-title-text">{{ $t('DistributionOfAssetLoginMethods') }}</div>
|
||||
<div class="chart">
|
||||
<Echart
|
||||
<echarts
|
||||
:options="LoginEntryOptions"
|
||||
:autoresize="true"
|
||||
/>
|
||||
@@ -40,7 +40,7 @@
|
||||
<div class="chart-container-title">
|
||||
<div class="chart-container-title-text">{{ $t('RemoteLoginProtocolUsageDistribution') }}</div>
|
||||
<div class="chart">
|
||||
<Echart
|
||||
<echarts
|
||||
:options="LoginProtocolOptions"
|
||||
:autoresize="true"
|
||||
/>
|
||||
@@ -52,7 +52,7 @@
|
||||
<div class="chart-container-title">
|
||||
<div class="chart-container-title-text">{{ $t('OperatingSystemDistributionOfLoginAssets') }}</div>
|
||||
<div class="chart">
|
||||
<Echart
|
||||
<echarts
|
||||
:options="LoginOSOptions"
|
||||
:autoresize="true"
|
||||
/>
|
||||
@@ -64,7 +64,7 @@
|
||||
<div class="chart-container-title">
|
||||
<div class="chart-container-title-text">{{ $t('AssetLoginTrends') }}</div>
|
||||
<div class="chart">
|
||||
<Echart
|
||||
<echarts
|
||||
ref="loginTrend"
|
||||
:options="loginTrendOptions"
|
||||
:autoresize="true"
|
||||
@@ -83,7 +83,6 @@ import BaseReport from '@/views/reports/base/BaseReport.vue'
|
||||
import SummaryCountCard from '@/components/Dashboard/SummaryCountCard.vue'
|
||||
import UserAssetActivity from '@/views/reports/console/UserAssetActivity.vue'
|
||||
import * as echarts from 'echarts'
|
||||
import Echart from '@/components/Dashboard/Echart.vue'
|
||||
import { mixColors } from '@/views/reports/const'
|
||||
|
||||
export default {
|
||||
@@ -91,8 +90,7 @@ export default {
|
||||
UserAssetActivity,
|
||||
SummaryCountCard,
|
||||
BaseReport,
|
||||
SwitchDate,
|
||||
Echart
|
||||
SwitchDate
|
||||
},
|
||||
props: {
|
||||
nav: {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="chart-container-title">
|
||||
<div class="chart-container-title-text">{{ $t('AssetTypeDistribution') }}</div>
|
||||
<div class="chart">
|
||||
<Echart
|
||||
<echarts
|
||||
:options="AssetTypeOptions"
|
||||
:autoresize="true"
|
||||
/>
|
||||
@@ -31,7 +31,7 @@
|
||||
<div class="chart-container-title">
|
||||
<div class="chart-container-title-text">{{ $t('WeeklyGrowthTrend') }}</div>
|
||||
<div class="chart">
|
||||
<Echart
|
||||
<echarts
|
||||
:options="AddedAssetOptions"
|
||||
:autoresize="true"
|
||||
/>
|
||||
@@ -47,14 +47,12 @@
|
||||
import BaseReport from '../base/BaseReport.vue'
|
||||
import SummaryCountCard from '@/components/Dashboard/SummaryCountCard.vue'
|
||||
import * as echarts from 'echarts'
|
||||
import Echart from '@/components/Dashboard/Echart.vue'
|
||||
import { mixColors } from '@/views/reports/const'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SummaryCountCard,
|
||||
BaseReport,
|
||||
Echart
|
||||
BaseReport
|
||||
},
|
||||
props: {
|
||||
nav: {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
{{ description }}
|
||||
</div>
|
||||
</div>
|
||||
<span v-if="!nav && url && showReportExportBtn" class="export-btn">
|
||||
<span v-if="!nav && url" class="export-btn">
|
||||
<el-button type="text" @click="openNewWindow">
|
||||
<i class="fa fa-external-link" style="font-size: 15px;" />
|
||||
{{ $t('Export') }}
|
||||
@@ -42,7 +42,6 @@
|
||||
<script>
|
||||
import Logo from '@/layout/components/NavLeft/Logo'
|
||||
import RightAction from './RightAction.vue'
|
||||
import store from '@/store'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -85,9 +84,6 @@ export default {
|
||||
computed: {
|
||||
isDescription() {
|
||||
return this.description && this.description.trim() !== ''
|
||||
},
|
||||
showReportExportBtn() {
|
||||
return store.getters.hasValidLicense
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -65,13 +65,7 @@ export default {
|
||||
}
|
||||
const days = this.getDaysParam()
|
||||
this.$message.success(this.$t('EMailReport') + '...')
|
||||
this.$axios.post(`/core/reports/send-mail/?chart=${this.name}&days=${days}`,).then((res) => {
|
||||
if (res.error) {
|
||||
this.$message.error(res.error)
|
||||
} else {
|
||||
this.$message.success(res.message)
|
||||
}
|
||||
}).catch(error => {
|
||||
this.$axios.post(`/core/reports/send-mail/?chart=${this.name}&days=${days}`,).catch(error => {
|
||||
this.$message.error(this.$t('Failed') + ': ' + error.message)
|
||||
})
|
||||
},
|
||||
|
||||
@@ -52,20 +52,17 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async getMetricData() {
|
||||
setTimeout(() => {
|
||||
const url = `/api/v1/index/?dates_metrics=1&days=${this.days}`
|
||||
this.$axios.get(url).then(data => {
|
||||
const activeUsers = data?.dates_metrics_total_count_active_users
|
||||
const activeAssets = data?.dates_metrics_total_count_active_assets
|
||||
this.lineChartConfig.datesMetrics = data.dates_metrics_date
|
||||
if (activeUsers.length > 0) {
|
||||
this.lineChartConfig.primaryData = activeUsers
|
||||
}
|
||||
if (activeAssets.length > 0) {
|
||||
this.lineChartConfig.secondaryData = activeAssets
|
||||
}
|
||||
})
|
||||
}, 500)
|
||||
const url = `/api/v1/index/?dates_metrics=1&days=${this.days}`
|
||||
const data = await this.$axios.get(url)
|
||||
const activeUsers = data?.dates_metrics_total_count_active_users
|
||||
const activeAssets = data?.dates_metrics_total_count_active_assets
|
||||
this.lineChartConfig.datesMetrics = data.dates_metrics_date
|
||||
if (activeUsers.length > 0) {
|
||||
this.lineChartConfig.primaryData = activeUsers
|
||||
}
|
||||
if (activeAssets.length > 0) {
|
||||
this.lineChartConfig.secondaryData = activeAssets
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,20 +60,17 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async getMetricData() {
|
||||
setTimeout(() => {
|
||||
const url = `/api/v1/accounts/change-secret-dashboard/?daily_success_and_failure_metrics=1&days=${this.days}`
|
||||
this.$axios.get(url).then(data => {
|
||||
const success = data?.dates_metrics_total_count_success
|
||||
const failed = data?.dates_metrics_total_count_failed
|
||||
this.lineChartConfig.datesMetrics = data?.dates_metrics_date
|
||||
if (success.length > 0) {
|
||||
this.lineChartConfig.primaryData = success
|
||||
}
|
||||
if (failed.length > 0) {
|
||||
this.lineChartConfig.secondaryData = failed
|
||||
}
|
||||
})
|
||||
}, 500)
|
||||
const url = `/api/v1/accounts/change-secret-dashboard/?daily_success_and_failure_metrics=1&days=${this.days}`
|
||||
const data = await this.$axios.get(url)
|
||||
const success = data?.dates_metrics_total_count_success
|
||||
const failed = data?.dates_metrics_total_count_failed
|
||||
this.lineChartConfig.datesMetrics = data?.dates_metrics_date
|
||||
if (success.length > 0) {
|
||||
this.lineChartConfig.primaryData = success
|
||||
}
|
||||
if (failed.length > 0) {
|
||||
this.lineChartConfig.secondaryData = failed
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<div class="chart-content">
|
||||
<!-- eslint-disable-next-line -->
|
||||
<Echart ref="chartRef" :options="chartOption" :autoresize="true"/>
|
||||
<echarts ref="chartRef" :options="chartOption" :autoresize="true" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -14,7 +14,6 @@
|
||||
<script>
|
||||
import Title from '@/components/Dashboard/Title.vue'
|
||||
import * as echarts from 'echarts'
|
||||
import Echart from '@/components/Dashboard/Echart.vue'
|
||||
import 'echarts/lib/chart/pie'
|
||||
import 'echarts/lib/component/tooltip'
|
||||
import 'echarts/lib/component/title'
|
||||
@@ -22,7 +21,7 @@ import 'echarts/lib/component/legend'
|
||||
|
||||
export default {
|
||||
name: 'MissionSummery',
|
||||
components: { Title, Echart },
|
||||
components: { Title },
|
||||
data() {
|
||||
return {
|
||||
config: {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<div class="chart-container-title">
|
||||
<div class="chart-container-title-text">{{ $t('UserModificationTrends') }}</div>
|
||||
<div class="chart">
|
||||
<Echart
|
||||
<echarts
|
||||
:options="UserModificationOptions"
|
||||
:autoresize="true"
|
||||
/>
|
||||
@@ -55,15 +55,13 @@ import BaseReport from '../base/BaseReport.vue'
|
||||
import SummaryCountCard from '@/components/Dashboard/SummaryCountCard.vue'
|
||||
import { mixColors } from '@/views/reports/const'
|
||||
import * as echarts from 'echarts'
|
||||
import Echart from '@/components/Dashboard/Echart.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SummaryCountCard,
|
||||
RankTable,
|
||||
BaseReport,
|
||||
SwitchDate,
|
||||
Echart
|
||||
SwitchDate
|
||||
},
|
||||
props: {
|
||||
nav: {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<TreeTable
|
||||
ref="CommandTreeTable"
|
||||
v-loading="loading"
|
||||
:title="title"
|
||||
:header-actions="headerActions"
|
||||
:table-config="tableConfig"
|
||||
:tree-setting="treeSetting"
|
||||
@@ -40,7 +39,6 @@ export default {
|
||||
const dateFrom = getDaysAgo(7).toISOString()
|
||||
const dateTo = this.$moment(getDayEnd()).add(1, 'day').toISOString()
|
||||
return {
|
||||
title: this.$t('CommandStorage'),
|
||||
loading: true,
|
||||
tableConfig: {
|
||||
url: '/api/v1/terminal/commands/',
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
v-if="visible"
|
||||
:show-cancel="false"
|
||||
:show-confirm="false"
|
||||
:title="$tc('EmailTemplate')"
|
||||
:title="$tc('Msg Template')"
|
||||
:visible.sync="visible"
|
||||
width="70%"
|
||||
@confirm="onConfirm()"
|
||||
|
||||
@@ -43,7 +43,6 @@ export default {
|
||||
},
|
||||
localValue(val) {
|
||||
this.$emit('input', val)
|
||||
this.$emit('htmlChange', this.html)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,16 +34,18 @@ export default {
|
||||
const vm = this
|
||||
return {
|
||||
initial: {
|
||||
template_name: localStorage.getItem('selectTemplateName') || 'terminal/_msg_session_sharing.html'
|
||||
EMAIL_TEMPLATE_NAME: localStorage.getItem('selectTemplateName') || 'terminal/_msg_session_sharing.html'
|
||||
},
|
||||
helpText: this.$t('EmailHelpText'),
|
||||
encryptedFields: ['EMAIL_HOST_PASSWORD'],
|
||||
fields: [
|
||||
[this.$t('Basic'), [
|
||||
'template_name',
|
||||
'template_content'
|
||||
'EMAIL_TEMPLATE_NAME',
|
||||
'EMAIL_TEMPLATE_CONTENT'
|
||||
]]
|
||||
],
|
||||
fieldsMeta: {
|
||||
template_name: {
|
||||
EMAIL_TEMPLATE_NAME: {
|
||||
label: this.$t('Name'),
|
||||
helpTextFormatter: () => {
|
||||
const handleClick = () => {
|
||||
@@ -68,7 +70,7 @@ export default {
|
||||
this.variables = item.contexts
|
||||
this.source = item.source
|
||||
updateForm({
|
||||
template_content: item.content.trimStart()
|
||||
EMAIL_TEMPLATE_CONTENT: item.content.trimStart()
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -78,28 +80,19 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
template_content: {
|
||||
component: MarkDownEditor,
|
||||
on: {
|
||||
htmlChange: ([html]) => {
|
||||
vm.html = html
|
||||
}
|
||||
}
|
||||
EMAIL_TEMPLATE_CONTENT: {
|
||||
component: MarkDownEditor
|
||||
}
|
||||
},
|
||||
templates: [],
|
||||
successUrl: { name: 'Msg' },
|
||||
showHelpDialog: false,
|
||||
variables: [],
|
||||
html: '',
|
||||
source: 'original',
|
||||
selectTemplateName: '',
|
||||
variablesHelpText: this.$t('TemplateVariablesHelpText'),
|
||||
variablesHelpText: '您可以选择一个模板在模板内容中使用 {{ key }} 读取内置变量,注意:只支持 {{ }} 语法,其他语法不支持。例如 {% if title %}',
|
||||
hasSaveContinue: false,
|
||||
onPerformError() {
|
||||
},
|
||||
performSubmit(validValues) {
|
||||
validValues['render_html'] = vm.html
|
||||
return this.$axios['patch']('/api/v1/notifications/templates/edit/', validValues).then(res => {
|
||||
this.$router.push({ name: 'Msg', query: { t: new Date().getTime() } })
|
||||
})
|
||||
@@ -110,6 +103,7 @@ export default {
|
||||
type: 'default',
|
||||
// hidden: () => this.source === 'original',
|
||||
callback: (value, form, btn) => {
|
||||
console.log(value, form, btn)
|
||||
return this.$axios['post']('/api/v1/notifications/templates/reset/', { template_name: this.selectTemplateName }).then(
|
||||
() => {
|
||||
this.$router.push({ name: 'Msg', query: { t: new Date().getTime() } })
|
||||
@@ -134,7 +128,7 @@ export default {
|
||||
this.$axios.get('/api/v1/notifications/templates/').then(data => {
|
||||
if (data.length > 0) {
|
||||
this.templates = data
|
||||
this.fieldsMeta.template_name.el.options = data.map(item => ({
|
||||
this.fieldsMeta.EMAIL_TEMPLATE_NAME.el.options = data.map(item => ({
|
||||
label: item.subject,
|
||||
value: item.template_name
|
||||
}))
|
||||
|
||||
@@ -93,9 +93,7 @@ export default {
|
||||
this.$axios.patch(
|
||||
`/api/v1/notifications/system-msg-subscription/${sub.id}/`,
|
||||
{ receive_backends: backends }
|
||||
).then(() => {
|
||||
this.$message.success(this.$t('UpdateSuccessMsg'))
|
||||
}).catch(err => {
|
||||
).catch(err => {
|
||||
this.$log.error(err)
|
||||
})
|
||||
},
|
||||
|
||||
@@ -26,7 +26,7 @@ export default {
|
||||
hidden: !this.$hasPerm('settings.change_email')
|
||||
},
|
||||
{
|
||||
title: this.$t('MsgTemplate'),
|
||||
title: this.$t('Msg Template'),
|
||||
name: 'MsgTemplate',
|
||||
hidden: !this.$hasPerm('settings.change_email') || !this.$store.getters.hasValidLicense
|
||||
},
|
||||
|
||||
@@ -50,25 +50,20 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async initialSelect() {
|
||||
try {
|
||||
const commandOptions = await getAllCommandStorage()
|
||||
const replayOptions = await getAllReplayStorage()
|
||||
|
||||
if (commandOptions) {
|
||||
commandOptions.forEach(item => {
|
||||
this.fieldsMeta.command_storage.options.push({ label: item.name, value: item.name })
|
||||
})
|
||||
}
|
||||
if (replayOptions) {
|
||||
replayOptions.forEach(item => {
|
||||
if (item.type.value === 'sftp') return
|
||||
this.fieldsMeta.replay_storage.options.push({ label: item.name, value: item.name })
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
const commandOptions = await getAllCommandStorage()
|
||||
commandOptions.forEach(item => {
|
||||
this.fieldsMeta.command_storage.options.push({ label: item.name, value: item.name })
|
||||
})
|
||||
const replayOptions = await getAllReplayStorage()
|
||||
replayOptions.forEach(item => {
|
||||
if (item.type.value === 'sftp') return
|
||||
this.fieldsMeta.replay_storage.options.push({ label: item.name, value: item.name })
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
@@ -41,6 +41,7 @@ export default {
|
||||
name: 'connect',
|
||||
icon: 'fa-desktop',
|
||||
type: 'primary',
|
||||
plain: true,
|
||||
can: ({ row }) => row.is_active,
|
||||
callback: ({ row }) => {
|
||||
const oid = this.$store.getters.currentOrg ? this.$store.getters.currentOrg.id : ''
|
||||
|
||||
Reference in New Issue
Block a user