Compare commits

..

3 Commits

53 changed files with 648 additions and 1742 deletions

View File

@@ -1,4 +1,4 @@
FROM jumpserver/lina-base:20250910_084112 AS stage-build
FROM jumpserver/lina-base:20250905_093747 AS stage-build
ARG VERSION
ENV VERSION=$VERSION

View File

@@ -26,7 +26,6 @@
"dependencies": {
"@babel/plugin-proposal-optional-chaining": "^7.13.12",
"@fontsource/open-sans": "^5.0.24",
"@kangc/v-md-editor": "^1.7.12",
"@traptitech/markdown-it-katex": "^3.6.0",
"@ztree/ztree_v3": "3.5.44",
"axios": "0.28.0",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 KiB

View File

@@ -1,100 +0,0 @@
<template>
<Dialog
:show-cancel="false"
:show-confirm="false"
:title="title"
:visible.sync="iVisible"
class="help-dialog"
top="1vh"
width="50%"
>
<p>{{ variablesHelpText }}</p>
<table border="1" class="help-table">
<tr>
<th>{{ $tc('Variable') }}</th>
<th>{{ $tc('Description') }}</th>
<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)">
<label class="item-label">{{ item.name }}</label>
</td>
<td><span>{{ item.label }}</span></td>
<td><span>{{ item.default }}</span></td>
</tr>
</table>
</Dialog>
</template>
<script>
import Dialog from '@/components/Dialog/index.vue'
import { copy } from '@/utils/common/index'
export default {
components: {
Dialog
},
props: {
visible: {
type: Boolean,
default: false
},
variables: {
type: Array,
default: () => []
},
variablesHelpText: {
type: String,
default() {
return this.$t('WatermarkVariableHelpText')
}
}
},
data() {
return {
title: this.$t('BuiltinVariable')
}
},
computed: {
iVisible: {
set(val) {
this.$emit('update:visible', val)
},
get() {
return this.visible
}
}
},
methods: {
onCopy(key) {
copy(key)
}
}
}
</script>
<style>
.help-dialog.dialog .el-dialog__footer {
border-top: none;
padding: 8px;
}
</style>
<style lang="scss" scoped>
.help-table {
width: 100%;
border-collapse: collapse;
border: 1px solid #dee2e6;
&::v-deep th, td {
height: 40px;
padding: 0 8px;
text-align: left;
}
&::v-deep .item-td, .item-label {
cursor: pointer;
color: var(--color-primary);
}
}
</style>

View File

@@ -5,7 +5,7 @@
v-if="action.dropdown"
v-show="action.dropdown.length > 0"
:key="action.name"
:class="[action.name, { grouped: action.grouped }]"
:class="[action.name, {grouped: action.grouped }]"
:size="action.size"
:split-button="!!action.split"
:type="action.type"
@@ -23,7 +23,7 @@
:class="action.name"
:size="size"
class="more-action"
v-bind="{ ...cleanButtonAction(action), icon: '' }"
v-bind="{...cleanButtonAction(action), icon: ''}"
>
<span class="pre-icon">
<Icon v-if="action.icon" :icon="action.icon" />
@@ -32,13 +32,13 @@
{{ action.title }}<i class="el-icon-arrow-down el-icon--right" />
</span>
</el-button>
<el-dropdown-menu slot="dropdown" style="overflow: auto; max-height: 60vh">
<el-dropdown-menu slot="dropdown" style="overflow: auto;max-height: 60vh">
<template v-for="option in action.dropdown">
<div
v-if="option.group"
:key="'group:' + option.name"
:key="'group:'+option.name"
class="dropdown-menu-title"
style="width: 130px"
style="width:130px"
>
{{ option.group }}
</div>
@@ -54,7 +54,7 @@
:command="[option, action]"
:title="option.tip"
class="dropdown-item"
v-bind="{ ...option, icon: '' }"
v-bind="{...option, icon: ''}"
>
<span v-if="actionsHasIcon(action.dropdown)" class="pre-icon">
<Icon v-if="option.icon" :icon="option.icon" />
@@ -69,10 +69,10 @@
<el-button
v-else
:key="action.name"
:class="[action.name, { grouped: action.grouped }]"
:class="[action.name, {grouped: action.grouped }]"
:size="size"
class="action-item"
v-bind="{ ...cleanButtonAction(action), icon: '' }"
v-bind="{...cleanButtonAction(action), icon: ''}"
@click="handleClick(action)"
>
<el-tooltip :content="action.tip" :disabled="!action.tip" placement="top">
@@ -228,9 +228,9 @@ export default {
<style lang="scss" scoped>
$btn-text-color: #ffffff;
$color-btn-background: #e8f7f4;
$color-btn-focus-background: #83cbba;
$color-divided: #e4e7ed;
$color-btn-background: #E8F7F4;
$color-btn-focus-background: #83CBBA;
$color-divided: #E4E7ED;
$color-drop-menu-title: #909399;
$color-drop-menu-border: #e4e7ed;
@@ -284,8 +284,6 @@ $color-drop-menu-border: #e4e7ed;
.el-button {
padding: 2px 5px;
line-height: 1.3;
font-size: 13px;
&:not(.is-plain) {
color: $btn-text-color;
@@ -321,6 +319,7 @@ $color-drop-menu-border: #e4e7ed;
// 下拉 options
.el-dropdown-menu {
::v-deep .more-batch-processing {
&:hover {
background-color: transparent !important;
}

View File

@@ -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,

View File

@@ -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
}
}

View File

@@ -1,11 +1,11 @@
<template>
<div>
<Echart
<echarts
ref="echarts"
:options="options"
:autoresize="true"
theme="light"
@finished="genSnapshot"
@finished="getDataUrl"
/>
</div>
</template>
@@ -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,
@@ -232,26 +230,12 @@ export default {
}
},
mounted() {
this.genSnapshot()
this._before = () => this.genSnapshot(true)
this._after = () => this.forceResize()
window.addEventListener('beforeprint', this._before)
window.addEventListener('afterprint', this._after)
// 兼容某些浏览器Safari触发 print 媒体切换
this._mql = window.matchMedia && window.matchMedia('print')
if (this._mql) {
const handler = e => (e.matches ? this._before() : this._after())
this._mql.addEventListener?.('change', handler)
this._mql.addListener?.(handler)
this._mql._handler = handler
}
},
beforeDestroy() {
window.removeEventListener('beforeprint', this._before)
window.removeEventListener('afterprint', this._after)
if (this._mql) {
this._mql.removeEventListener?.('change', this._mql._handler)
this._mql.removeListener?.(this._mql._handler)
setTimeout(() => {
this.getMetricData()
}, 1000)
const vm = this
window.onbeforeprint = function() {
vm.$refs.echarts.resize()
}
},
methods: {

View File

@@ -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>

View File

@@ -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: {

View File

@@ -55,7 +55,7 @@
<el-button
v-for="button in moreButtons"
v-show="!iHidden(button)"
v-show="!button.hidden"
:key="button.title"
:loading="button.loading"
size="small"
@@ -226,9 +226,6 @@ export default {
},
getFormValue() {
return this.$refs.form.getFormValue()
},
iHidden(item) {
return typeof item.hidden === 'function' ? item.hidden() : item.hidden
}
}
}

View File

@@ -19,7 +19,7 @@ export default {
props: {
value: {
type: [Array, String, Number, Boolean, Object],
default: () => []
default: () => ([])
},
multiple: {
type: Boolean,
@@ -36,7 +36,7 @@ export default {
},
computed: {
attrsWithoutValue() {
const attrs = Object.assign({ clearable: this.clearable }, this.$attrs)
const attrs = Object.assign({}, this.$attrs)
delete attrs.value
return attrs
},
@@ -50,13 +50,6 @@ export default {
const value = this.objectsToValues(this.value)
return value
}
},
clearable() {
if (this.$attrs.clearable === undefined) {
return this.multiple
} else {
return this.$attrs.clearable
}
}
},
methods: {
@@ -78,11 +71,8 @@ export default {
value = value.map(v => {
// uuid v4
const uuid = /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i
return typeof v === 'object'
? v
: this.$attrs?.allowCreate && !uuid.test(v)
? { [this.customLabelKeyName]: v }
: { pk: v }
return typeof v === 'object' ? v
: this.$attrs?.allowCreate && !uuid.test(v) ? { [this.customLabelKeyName]: v } : { pk: v }
})
if (!this.multiple) {
value = value[0]
@@ -97,13 +87,9 @@ export default {
if (!Array.isArray(val)) {
val = [val]
}
val = val.map(v => {
val = val.map((v) => {
if (v && typeof v === 'object') {
return (
v.pk ||
v.id ||
(this.$attrs?.allowCreate ? v?.[this.customLabelKeyName] + ':' + v?.value : '')
)
return v.pk || v.id || (this.$attrs?.allowCreate ? (v?.[this.customLabelKeyName] + ':' + v?.value) : '')
} else {
return v
}
@@ -117,4 +103,6 @@ export default {
}
</script>
<style scoped></style>
<style scoped>
</style>

View File

@@ -33,9 +33,6 @@
>
<i :class="[isCheckShowPassword ? 'fa-eye-slash' : 'fa-eye']" class="fa" />
</span>
<span v-if="filterTags.length > 0" class="clear-icon" @click="handleClearAll">
<i class="el-icon-circle-close" :title="$t('Clear')" />
</span>
</div>
</template>
@@ -143,11 +140,6 @@ export default {
},
handleShowPassword() {
this.isCheckShowPassword = !this.isCheckShowPassword
},
handleClearAll() {
this.filterTags = []
this.$emit('change', this.filterTags)
this.$emit('input', this.filterTags)
}
}
}
@@ -169,7 +161,7 @@ export default {
line-height: 30px;
&:hover {
border-color: #c0c4cc;
border-color: #C0C4CC;
}
& ::v-deep .el-tag {
@@ -186,7 +178,6 @@ export default {
.search-input {
flex: 1;
min-width: 150px;
& ::v-deep .el-input__inner {
max-width: 100%;
@@ -214,15 +205,4 @@ export default {
color: #999999;
}
}
.clear-icon {
display: inherit;
padding-right: 6px;
cursor: pointer;
color: #c0c4cc;
&:hover {
color: #606164;
}
}
</style>

View File

@@ -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) {

View File

@@ -1,52 +1,20 @@
<template>
<div>
<el-dialog
v-if="enabled && showModal"
:visible.sync="dialogVisible"
:title="title"
:close-on-click-modal="false"
:close-on-press-escape="false"
:show-close="false"
width="35%"
class="announcement-dialog"
center
>
<div class="announcement-content">
<div class="content-wrapper">
<MarkDown :value="announcement.content" class="markdown" />
</div>
<div v-if="announcement.link" class="link-section">
<el-link :href="announcement.link" class="link-more" target="_blank" type="info">
{{ $t('ViewMore') }}
</el-link>
<i class="fa fa-external-link icon" />
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="onModalConfirm">
{{ $t('Confirm') }}
</el-button>
</div>
</el-dialog>
<el-alert
v-if="enabled && showAlert"
:center="false"
:title="title"
class="announcement"
type="success"
@close="onAlertClose"
>
<MarkDown :value="announcement.content" class="markdown" />
<span v-if="announcement.link">
<el-link :href="announcement.link" class="link-more" target="_blank" type="info">
{{ $t('ViewMore') }}
</el-link>
<i class="fa fa-external-link icon" />
</span>
</el-alert>
</div>
<el-alert
v-if="enabled && !isViewed()"
:center="false"
:title="title"
class="announcement"
type="success"
@close="onClose"
>
<MarkDown :value="announcement.content" class="markdown" />
<span v-if="announcement.link">
<el-link :href="announcement.link" class="link-more" target="_blank" type="info">
{{ $t('ViewMore') }}
</el-link>
<i class="fa fa-external-link icon" />
</span>
</el-alert>
</template>
<script>
@@ -58,11 +26,7 @@ export default {
components: { MarkDown },
data() {
return {
viewedKey: 'AnnouncementViewed',
modalConfirmedKey: 'AnnouncementModalConfirmed',
dialogVisible: false,
modalConfirmed: false,
alertViewed: false
viewedKey: 'AnnouncementViewed'
}
},
computed: {
@@ -94,200 +58,48 @@ export default {
const start = new Date(this.announcement.date_start)
const end = new Date(this.announcement.date_end)
return now >= start && now <= end
},
showModal() {
return !this.modalConfirmed
},
showAlert() {
return this.modalConfirmed && !this.alertViewed
}
},
watch: {
enabled: {
handler(val) {
if (val) {
this.initializeState()
this.checkAndShowDialog()
}
},
immediate: true
}
},
mounted() {
this.initializeState()
this.checkAndShowDialog()
},
methods: {
initializeState() {
this.modalConfirmed = this.isModalConfirmed()
this.alertViewed = this.isAlertViewed()
},
checkAndShowDialog() {
if (this.enabled && this.showModal) {
this.dialogVisible = true
}
},
onModalConfirm() {
localStorage.setItem(this.modalConfirmedKey, this.announcement.id)
this.modalConfirmed = true
this.dialogVisible = false
this.$emit('announcement-modal-confirmed', {
id: this.announcement.id,
subject: this.announcement.subject,
confirmedAt: new Date().toISOString()
})
},
onAlertClose() {
onClose() {
localStorage.setItem(this.viewedKey, this.announcement.id)
this.alertViewed = true
this.$emit('announcement-read', {
id: this.announcement.id,
subject: this.announcement.subject,
readAt: new Date().toISOString()
})
},
isModalConfirmed() {
const confirmedId = localStorage.getItem(this.modalConfirmedKey)
return confirmedId === this.announcement.id
},
isAlertViewed() {
const viewedId = localStorage.getItem(this.viewedKey)
return viewedId === this.announcement.id
},
isViewed() {
return this.isAlertViewed()
const viewedId = localStorage.getItem(this.viewedKey)
return viewedId === this.announcement.id
}
}
}
</script>
<style lang="scss" scoped>
.announcement-dialog ::v-deep .el-dialog {
border-radius: 5px;
}
.announcement-dialog ::v-deep .el-dialog__wrapper {
backdrop-filter: blur(4px);
}
@media (max-width: 768px) {
.announcement-dialog ::v-deep .el-dialog {
width: 95% !important;
margin: 0 auto;
}
.announcement-content {
padding: 20px 25px 15px;
.content-wrapper {
padding: 15px;
}
}
.dialog-footer {
.el-button {
padding: 10px;
font-size: 14px;
}
}
}
.announcement-dialog ::v-deep .el-dialog__header {
border-radius: 8px 8px 0 0;
padding: 10px 20px 10px 20px;
.el-dialog__title {
color: black;
font-weight: 600;
}
}
.announcement-dialog ::v-deep .el-dialog__body {
padding: 0;
}
.announcement-content {
padding: 25px 30px 20px;
.link-section {
margin-top: 20px;
padding-top: 15px;
border-top: 1px solid #e4e7ed;
text-align: center;
}
}
.dialog-footer {
display: flex;
justify-content: flex-end;
align-items: center;
.el-button {
padding: 10px 20px;
font-size: 14px;
}
}
.announcement ::v-deep .el-alert__content {
width: 100%;
}
.announcement-main {
word-wrap: break-word;
white-space: pre-wrap;
}
.icon {
vertical-align: text-bottom;
color: var(--color-info) !important;
margin-left: 5px;
}
.markdown {
background-color: transparent !important;
font-size: 14px;
line-height: 1.8;
color: #2c3e50;
.link-more {
font-size: 13px;
color: #409eff !important;
text-decoration: none;
padding: 4px 8px;
border-radius: 4px;
background: rgba(64, 158, 255, 0.1);
transition: all 0.3s;
&:hover {
background: #409eff;
color: white !important;
}
font-size: 10px;
margin-left: 10px;
border-bottom: solid 1px;
color: var(--color-info) !important;
}
h1, h2, h3, h4, h5, h6 {
margin: 0 0 15px 0;
color: #303133;
font-weight: 600;
line-height: 1.4;
}
h1 {
font-size: 20px;
}
h2 {
font-size: 18px;
}
h3 {
font-size: 16px;
}
h4, h5, h6 {
font-size: 14px;
}
p {
margin-bottom: 16px;
line-height: 1.8;
color: #4b5563;
h1, h2, h3, h4, h5 {
margin-top: 0;
margin-bottom: 10px;
}
}
</style>

View File

@@ -37,4 +37,3 @@ export { default as Pagination } from './Table/Pagination'
export { default as Tooltip } from './Widgets/Tooltip'
export { default as ResourceActivity } from './Apps/ResourceActivity'
export { default as MarkDown } from './Widgets/MarkDown'
export { default as VariablesHelpTextDialog } from './Apps/VariablesHelpTextDialog'

View File

@@ -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
}
}

View File

@@ -71,7 +71,7 @@ export default {
},
async logout() {
const currentOrg = this.$store.getters.currentOrg
if (currentOrg && (currentOrg.autoEnter || currentOrg.is_system)) {
if (currentOrg.autoEnter || currentOrg.is_system) {
await this.$store.dispatch('users/setCurrentOrg', this.$store.getters.preOrg)
}
window.location.href = `${process.env.VUE_APP_LOGOUT_PATH}?next=${this.$route.fullPath}`

View File

@@ -21,7 +21,6 @@
<el-dialog
:visible.sync="isOpen"
:close-on-click-modal="true"
:close-on-press-escape="true"
:append-to-body="true"
custom-class="search-modal"
width="70%"
@@ -47,21 +46,16 @@
<div v-if="loading" class="section loading">{{ $t('Loading') }}...</div>
<template v-if="showHistory">
<div class="section-title">
<span>{{ $t('History') }}</span>
<el-link class="clear-history-btn" @click="clearHistory">
{{ $t('Clear') }}
</el-link>
</div>
<div class="section-title">{{ $t('History') }}</div>
<ul class="list">
<li
v-for="(item, index) in history"
v-for="(item, index) in filteredHistory"
:key="'h-' + index"
class="item"
@click="applyHistory(item)"
>
<i class="el-icon-time icon" />
<span class="label">{{ item.q }}</span>
<span class="label">{{ item.query }}</span>
<i class="el-icon-arrow-right go" />
</li>
</ul>
@@ -101,23 +95,9 @@
</div>
</template>
<div v-if="search && isEmpty" class="section empty">
<div v-if="!loading && isEmpty" class="section empty">
{{ $t('NoData') }}
</div>
<div v-if="!search && history.length === 0" class="section placeholder">
<div class="placeholder-content">
<div class="supported-types">
<div class="types-title">{{ $t('SupportedTypes') }}:</div>
<div class="types-list">
<span v-for="(icon, type) in iconMap" :key="type" class="type-item">
<Icon :icon="icon" class="type-icon" />
{{ $t(type) }}
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</el-dialog>
@@ -125,9 +105,9 @@
</template>
<script>
import _ from 'lodash'
import { mapGetters } from 'vuex'
import { ObjectLocalStorage } from '@/utils/common'
import { mapGetters } from 'vuex'
import _ from 'lodash'
import Icon from '@/components/Widgets/Icon/index.vue'
export default {
@@ -151,7 +131,7 @@ export default {
'UserGroup': 'user-group',
'AssetPermission': 'permission'
},
historyStore: new ObjectLocalStorage('globalSearchHistory')
historyStore: new ObjectLocalStorage('global-search-history')
}
},
computed: {
@@ -159,10 +139,14 @@ export default {
'viewRoutes'
]),
isEmpty() {
return !this.routeSuggestions.length && this.options.length === 0
return this.search && !this.routeSuggestions.length && this.options.length === 0
},
showHistory() {
return this.history.length > 0 && !this.search
return this.history.length > 0 && !this.search && this.filteredHistory.length > 0
},
filteredHistory() {
if (!this.search) return this.history
return this.history.filter(h => h.query.toLowerCase().includes(this.search.toLowerCase()))
},
shortcutText() {
return this.isMac ? '⌘K' : 'Ctrl+K'
@@ -234,7 +218,6 @@ export default {
name: item.model + 'Detail',
params: { id: item.id }
}
this.addToHistory(this.search)
this.$router.push(route)
this.closePanel()
},
@@ -278,26 +261,26 @@ export default {
this.routes = flat
},
loadHistory() {
this.history = (this.historyStore.get('list') || []).filter(i => i.q)
this.history = this.historyStore.get('list') || []
},
addToHistory(q) {
const entry = { q: q }
addToHistory(item) {
const entry = {
query: item.label || item.title || item.name,
url: item.url || item.path,
timestamp: Date.now()
}
const list = this.historyStore.get('list') || []
const next = [
entry,
...list.filter(i => i.q !== entry.q)
...list.filter(i => i.query !== entry.query)
].slice(0, 10)
this.historyStore.set('list', next)
this.history = next
},
applyHistory(h) {
this.search = h.q
this.search = h.query
this.onInput()
},
clearHistory() {
this.historyStore.set('list', [])
this.history = []
},
bindKeyboardShortcut() {
document.addEventListener('keydown', this.handleKeyboardShortcut)
},
@@ -433,7 +416,7 @@ body .v-modal {
.search-input-wrapper {
padding: 20px;
border-bottom: 1px solid #f0f0f0;
// background: #fff;
background: #fff;
.el-input {
.el-input__inner {
@@ -477,30 +460,8 @@ body .v-modal {
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
// background: #fafbfc;
border-top: 1px solid #f0f0f0;
display: flex;
align-items: center;
justify-content: space-between;
.clear-history-btn {
background: none;
border: none;
padding: 4px;
cursor: pointer;
border-radius: 4px;
transition: all 0.2s ease;
color: red;
&:hover {
background: #f5f5f5;
color: #f56c6c;
}
.clear-icon {
font-size: 14px;
color: red;
}
}
}
.list {
@@ -581,53 +542,5 @@ body .v-modal {
text-align: center;
font-size: 14px;
}
.section.placeholder {
padding: 32px 24px;
.placeholder-content {
text-align: center;
.supported-types {
margin-bottom: 24px;
.types-title {
margin-bottom: 12px;
font-size: 14px;
font-weight: 500;
color: #333;
}
.types-list {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 16px;
.type-item {
display: flex;
align-items: center;
padding: 8px 12px;
background: #f8f9fa;
border-radius: 6px;
font-size: 13px;
color: #666;
transition: all 0.2s ease;
&:hover {
background: #e9ecef;
color: #333;
}
.type-icon {
margin-right: 6px;
font-size: 14px;
color: #409eff;
}
}
}
}
}
}
</style>

View File

@@ -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')

View File

@@ -739,7 +739,3 @@ div.el-loading-parent--relative {
.margin-top-20 {
margin-top: 20px;
}
.el-message {
z-index: 999999 !important;
}

View File

@@ -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, {

View File

@@ -1,18 +1,11 @@
// 重置message防止重复点击重复弹出message弹框
import { Message as elMessage } from 'element-ui'
import { toSentenceCase } from '@/utils/common/index'
let messageDom = null
const DEFAULT_Z_INDEX = 20000
const message = options => {
// 判断弹窗是否已存在, 若存在则关闭
if (messageDom) messageDom.close()
if (typeof options === 'string') {
options = { message: options }
}
options.zIndex = options.zIndex || DEFAULT_Z_INDEX
messageDom = elMessage(options)
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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() {

View File

@@ -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: {

View File

@@ -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'
]
}
},

View File

@@ -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: {

View File

@@ -86,8 +86,6 @@ export default {
component: UploadKey
}
}
fieldsMeta['db_name']['rules'] = []
if (['mongodb', 'postgresql'].indexOf(platform) !== -1) {
fieldsMeta['db_name']['rules'] = [rules.Required]
}

View File

@@ -32,7 +32,9 @@
<script>
import Dialog from '@/components/Dialog'
import AutoDataForm from '@/components/Form/AutoDataForm'
import Select2 from '@/components/Form/FormFields/Select2'
import { DynamicInput, Switcher } from '@/components/Form/FormFields'
import DynamicWebParams from '@/views/assets/Platform/components/DynamicWebParams.vue'
export default {
components: {
@@ -100,6 +102,21 @@ export default {
commands: {
helpTextAsTip: false
}
},
'website_ping': {
steps: {
component: DynamicWebParams
}
},
'change_account_website': {
steps: {
component: DynamicWebParams
}
},
'verify_account_website': {
steps: {
component: DynamicWebParams
}
}
}
}
@@ -149,6 +166,13 @@ export default {
let component = 'el-input'
const el = {}
switch (v?.type) {
case 'choice':
component = Select2
el['multiple'] = false
el['clearable'] = false
el['value'] = v.default
el['options'] = v.choices
break
case 'list':
component = DynamicInput
break

View File

@@ -0,0 +1,390 @@
<template>
<div class="dynamic-form-list">
<div class="form-items-container">
<transition-group name="form-item" tag="div" class="form-items">
<div
v-for="(item, index) in formItems"
:key="item.id"
class="form-item"
>
<div class="form-field main-selector">
<label class="field-label">{{ $tc('Action') }}</label>
<Select2
v-model="item.action"
:options="actionOptions"
:multiple="false"
:clearable="false"
@change="onActionChange(index)"
/>
</div>
<div class="conditional-fields">
<template v-if="item.action === 'click' || item.action === 'iframe' || item.action === 'input'">
<div class="form-field">
<label class="field-label">{{ $tc('Selector') }}</label>
<el-input
v-model="item.config.selector"
:placeholder="$tc('SelectorPlaceholder')"
@input="onFieldChange(index)"
/>
</div>
</template>
<template v-if="item.action === 'sleep'">
<div class="form-field">
<label class="field-label">{{ $tc('Sleep') }}</label>
<el-input
v-model="item.config.value"
type="number"
:min="0"
@input="onFieldChange(index)"
>
<template slot="append">s</template>
</el-input>
</div>
</template>
<template v-if="item.action === 'input'">
<div class="form-field">
<label class="field-label">{{ $tc('Value') }}</label>
<Select2
v-model="item.config.value"
:options="valueOptions"
:multiple="false"
:clearable="false"
:allow-create="true"
@change="onFieldChange(index)"
/>
</div>
</template>
<template v-if="item.action === 'check'">
<div class="form-field">
<label class="field-label">{{ $tc('Check') }}</label>
<Select2
v-model="item.config.type"
:options="checkTypeOptions"
:multiple="false"
:clearable="false"
@change="onCheckTypeChange(index)"
/>
</div>
<div v-if="item.config && item.config.type" class="form-field">
<label class="field-label">
{{ getCheckFieldLabel(item.config.type) }}
</label>
<el-input
v-if="item.config.type === 'wait_for_url'"
v-model="item.config.url"
:placeholder="$tc('Address')"
@input="onFieldChange"
/>
<el-input
v-else-if="item.config.type === 'wait_for_selector'"
v-model="item.config.selector"
:placeholder="$tc('SelectorPlaceholder')"
@input="onFieldChange"
/>
<div
v-else-if="item.config.type === 'check_response'"
class="response-check-form"
>
<div class="url-row">
<label class="field-label">{{ $tc('URL') }}</label>
<el-input
v-model="item.config.url"
:placeholder="$tc('Address')"
@input="onFieldChange"
/>
</div>
<div class="method-status-row">
<div class="field-group">
<label class="field-label">{{ $tc('Method') }}</label>
<Select2
v-model="item.config.method"
:options="checkMethodOptions"
:multiple="false"
:clearable="false"
@change="onFieldChange"
/>
</div>
<div class="field-group">
<label class="field-label">{{ $tc('StatusCode') }}</label>
<el-input
v-model="item.config.status"
type="number"
:placeholder="$tc('StatusCode')"
@input="onFieldChange"
/>
</div>
</div>
<div class="url-row">
<el-tooltip
:open-delay="500"
:tabindex="-1"
placement="top"
effect="dark"
>
<div slot="content" v-sanitize="$t('ResponseExpressionTip')" class="help-tip-content" />
<label class="field-label" for="response-expression-input">
{{ $tc('ResponseExpression') }}
<i class="fa fa-question-circle-o help-tip-icon" />
</label>
</el-tooltip>
<el-input
id="response-expression-input"
v-model="item.config.body_expr"
:placeholder="$tc('ResponseExpression')"
@input="onFieldChange"
/>
</div>
</div>
</div>
</template>
</div>
<div class="form-actions">
<el-button
type="primary"
icon="el-icon-plus"
style="flex-shrink: 0;"
@click="addItem(index)"
/>
<el-button
type="danger"
icon="el-icon-minus"
:disabled="formItems.length <= 1"
@click="deleteItem(index)"
/>
</div>
</div>
</transition-group>
</div>
</div>
</template>
<script>
import Select2 from '@/components/Form/FormFields/Select2'
export default {
name: 'DynamicFormList',
components: {
Select2
},
props: {
value: {
type: Array,
default: () => []
}
},
data() {
return {
actionOptions: [
{ label: this.$t('Click'), value: 'click' },
{ label: this.$t('Input'), value: 'input' },
{ label: this.$t('Check'), value: 'check' },
{ label: this.$t('iframe'), value: 'iframe' },
{ label: this.$t('Sleep'), value: 'sleep' }
],
valueOptions: [
{ label: this.$t('LoginUsername'), value: 'login_username' },
{ label: this.$t('LoginPasswordSetting'), value: 'login_password' },
{ label: this.$t('Username'), value: 'username' },
{ label: this.$t('NewPassword'), value: 'password' }
],
checkTypeOptions: [
{ label: this.$t('WaitForURL'), value: 'wait_for_url' },
{ label: this.$t('WaitForSelector'), value: 'wait_for_selector' },
{ label: this.$t('CheckResponse'), value: 'check_response' }
],
checkMethodOptions: [
{ label: 'GET', value: 'get' },
{ label: 'POST', value: 'post' },
{ label: 'PUT', value: 'put' },
{ label: 'DELETE', value: 'delete' }
],
formItems: []
}
},
mounted() {
this.syncFromParent()
},
methods: {
getDefaultConfig(action, checkType = null) {
switch (action) {
case 'click':
case 'iframe':
return { selector: '' }
case 'input':
return { selector: '', value: '' }
case 'sleep':
return { value: 1 }
case 'check':
switch (checkType) {
case 'wait_for_url':
return { type: 'wait_for_url', url: '' }
case 'wait_for_selector':
return { type: 'wait_for_selector', selector: '' }
case 'check_response':
return { type: 'check_response', url: '', method: 'get', status: 200, body_expr: '' }
default:
return {}
}
default:
return {}
}
},
syncFromParent() {
if (this.value && Array.isArray(this.value)) {
this.formItems = this.value.map(item => {
const newItem = { ...item }
if (!newItem.config || typeof newItem.config !== 'object') {
newItem.config = this.getDefaultConfig(newItem.action, newItem.config?.type)
} else if (newItem.action === 'check' && !newItem.config.type) {
newItem.config = this.getDefaultConfig('check', 'wait_for_url')
}
return newItem
})
} else {
this.formItems = []
}
if (this.formItems.length === 0) {
this.addItem()
}
},
addItem(index = -1) {
const newItem = {
id: `item_${this.formItems.length + 1}`,
action: 'click',
config: this.getDefaultConfig('click')
}
if (index >= 0) {
this.formItems.splice(index + 1, 0, newItem)
} else {
this.formItems.push(newItem)
}
},
deleteItem(index) {
if (this.formItems.length <= 1 || index < 0 || index >= this.formItems.length) {
return
}
this.formItems.splice(index, 1)
this.emitChange()
},
onFieldChange() {
this.emitChange()
},
emitChange() {
this.$emit('input', this.formItems)
},
onActionChange(index) {
const item = this.formItems[index]
if (!item) {
return
}
item.config = this.getDefaultConfig(item.action, 'wait_for_url')
this.emitChange()
},
onCheckTypeChange(index) {
const item = this.formItems[index]
if (!item || !item.config || !item.config.type) {
return
}
item.config = this.getDefaultConfig('check', item.config.type)
this.emitChange()
},
getCheckFieldLabel(checkType) {
const labels = {
wait_for_url: this.$t('Address'),
wait_for_selector: this.$t('Selector'),
check_response: this.$t('Response')
}
return labels[checkType] || this.$t('Value')
}
}
}
</script>
<style scoped>
.form-items-container {
width: 100%;
}
.form-items {
display: flex;
flex-direction: column;
gap: 10px;
}
.form-item {
display: flex;
align-items: flex-start;
gap: 8px;
padding: 10px 15px;
background: #fbfbfb;
border: 1px solid #e4e7ed;
border-radius: 8px;
transition: all 0.2s ease;
position: relative;
}
.form-item:hover {
border-color: #c0c4cc;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.form-field {
display: flex;
flex-direction: column;
}
.main-selector {
flex: 0 0 90px;
}
.conditional-fields {
display: flex;
gap: 12px;
flex: 1;
flex-wrap: wrap;
}
.conditional-fields .form-field {
flex: 1;
min-width: 200px;
}
.field-label {
font-size: 12px;
font-weight: 500;
}
.form-actions {
display: flex;
}
.form-actions .el-button {
padding: 5px 7px;
font-size: 10px;
margin: 0 1px;
}
.el-form {
margin-right: 0 !important;
}
.response-check-form .method-status-row {
display: flex;
gap: 10px;
}
.response-check-form .field-label {
display: block;
height: 25px;
font-size: 10px;
color: #6a6a6a;
}
.help-tip-content {
white-space: pre-wrap;
word-wrap: break-word;
}
</style>

View File

@@ -32,7 +32,10 @@ export const platformFieldsMeta = (vm) => {
remove_account_enabled: {},
ping_method: {},
ping_params: {
label: ''
label: '',
el: {
title: vm.$t('setVariable')
}
},
gather_facts_method: {},
push_account_method: {},
@@ -55,7 +58,11 @@ export const platformFieldsMeta = (vm) => {
method: 'change_secret_posix'
}
},
verify_account_method: {}
verify_account_method: {
el: {
title: vm.$t('setVariable')
}
}
}
},
category_type: {

View File

@@ -141,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) => {
@@ -151,7 +151,7 @@ export default {
this.$message.warning(`${this.$t('RequiredAssetOrNode')}`)
return cb([])
}
cb([]) // 先返回空,避免输入时出现下拉闪烁
this.$axios.post('/api/v1/ops/username-hints/', {
nodes: nodes,
assets: hosts,

View File

@@ -181,7 +181,6 @@ export default {
autoComplete: true,
query: (query, cb) => {
const { hosts, nodes } = this.getSelectedNodesAndHosts()
cb([]) // 先返回空,避免输入时出现下拉闪烁
this.$axios.post('/api/v1/ops/username-hints/', {
nodes: nodes,
assets: hosts,

View File

@@ -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: {

View File

@@ -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: {

View File

@@ -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: {

View File

@@ -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: {

View File

@@ -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
}
}
}
}

View File

@@ -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
}
}
}
}

View File

@@ -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: {

View File

@@ -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: {

View File

@@ -1,9 +1,6 @@
<template>
<div>
<el-button size="mini" type="primary" icon="el-icon-setting" @click="visible = !visible"> {{
$t("Setting")
}}
</el-button>
<el-button size="mini" type="primary" icon="el-icon-setting" @click="visible = !visible"> {{ $t("Setting") }} </el-button>
<Dialog
v-if="visible"
:show-cancel="false"
@@ -24,7 +21,7 @@ import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm
import { Dialog } from '@/components'
export default {
name: 'MsgTemplate',
name: 'EmailTemplate',
components: {
GenericCreateUpdateForm,
Dialog

View File

@@ -16,8 +16,8 @@
import { IBox } from '@/components'
import { GenericCreateUpdateForm } from '@/layout/components'
import { testEmailSetting } from '@/api/settings'
import rules from '@/components/Form/DataForm/rules'
import EmailTemplate from './EmailTemplate.vue'
import rules from '@/components/Form/DataForm/rules'
export default {
name: 'Email',

View File

@@ -1,50 +0,0 @@
<template>
<div style="border: 1px solid #ccc; padding: 10px;">
<vue-markdown-editor v-model="localValue" :right-toolbar="rightToolbar" :left-toolbar="leftToolbar" height="400px" />
</div>
</template>
<script>
import VueMarkdownEditor, { xss } from '@kangc/v-md-editor'
import '@kangc/v-md-editor/lib/style/base-editor.css'
import vuepressTheme from '@kangc/v-md-editor/lib/theme/vuepress.js'
import '@kangc/v-md-editor/lib/theme/style/vuepress.css'
import Prism from 'prismjs'
VueMarkdownEditor.use(vuepressTheme, {
Prism
})
export default {
name: 'RichEditor',
components: { VueMarkdownEditor },
props: {
value: {
type: String,
default: ''
}
},
data() {
return {
localValue: this.value,
rightToolbar: 'preview sync-scroll fullscreen',
leftToolbar: 'undo redo clear | h bold italic strikethrough quote | ul ol hr | link code '
}
},
computed: {
html() {
return xss.process(VueMarkdownEditor.themeConfig.markdownParser.render(this.localValue))
}
},
watch: {
value(val) {
if (val !== this.localValue) {
this.localValue = val
}
},
localValue(val) {
this.$emit('input', val)
this.$emit('htmlChange', this.html)
}
}
}
</script>

View File

@@ -1,150 +0,0 @@
<template>
<div>
<IBox>
<GenericCreateUpdateForm
:create-success-next-route="successUrl"
:update-success-next-route="successUrl"
v-bind="$data"
/>
</IBox>
<VariablesHelpTextDialog
:variables-help-text="variablesHelpText"
:variables="variables"
:visible.sync="showHelpDialog"
/>
</div>
</template>
<script>
import { IBox } from '@/components'
import { GenericCreateUpdateForm } from '@/layout/components'
import MarkDownEditor from '@/views/settings/Msg/Email/markDownEditor.vue'
import { Select2 } from '@/components/Form/FormFields'
import VariablesHelpTextDialog from '@/components/Apps/VariablesHelpTextDialog'
import variable from '@/views/ops/Template/components/Variable.vue'
export default {
name: 'MsgTemplate',
components: {
GenericCreateUpdateForm,
IBox,
VariablesHelpTextDialog
},
data() {
const vm = this
return {
initial: {
template_name: localStorage.getItem('selectTemplateName') || 'terminal/_msg_session_sharing.html'
},
fields: [
[this.$t('Basic'), [
'template_name',
'template_content'
]]
],
fieldsMeta: {
template_name: {
label: this.$t('Name'),
helpTextFormatter: () => {
const handleClick = () => {
this.showHelpDialog = true
}
return (
<i onClick={handleClick} class='fa fa-question-circle' style='cursor: pointer'>{this.$t('Help')}</i>
)
},
component: Select2,
el: {
multiple: false,
options: []
},
on: {
input: ([event], updateForm) => {
setTimeout(() => {
vm.templates.map(item => {
if (item.template_name === event) {
this.selectTemplateName = item.template_name
localStorage.setItem('selectTemplateName', item.template_name)
this.variables = item.contexts
this.source = item.source
updateForm({
template_content: item.content.trimStart()
})
}
})
},
500
)
}
}
},
template_content: {
component: MarkDownEditor,
on: {
htmlChange: ([html]) => {
vm.html = html
}
}
}
},
templates: [],
successUrl: { name: 'Msg' },
showHelpDialog: false,
variables: [],
html: '',
source: 'original',
selectTemplateName: '',
variablesHelpText: this.$t('TemplateVariablesHelpText'),
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() } })
})
},
moreButtons: [
{
title: this.$t('Reset'),
type: 'default',
// hidden: () => this.source === 'original',
callback: (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() } })
this.$message.success(this.$t('ResetSuccessfully'))
}
)
}
}
]
}
},
computed: {
variable() {
return variable
}
},
mounted() {
this.fetchTemplates()
},
methods: {
fetchTemplates() {
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 => ({
label: item.subject,
value: item.template_name
}))
}
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -9,13 +9,12 @@
<script>
import TabPage from '@/layout/components/TabPage/index.vue'
import Email from './Email/index.vue'
import MsgTemplate from '@/views/settings/Msg/MsgTemplate/index.vue'
import Subscribe from './Subscribe/index.vue'
import SMS from './SMS/index.vue'
export default {
name: 'Index',
components: { TabPage, Email, MsgTemplate, Subscribe, SMS },
components: { TabPage, Email, Subscribe, SMS },
data() {
return {
activeMenu: 'Email',
@@ -25,11 +24,6 @@ export default {
name: 'Email',
hidden: !this.$hasPerm('settings.change_email')
},
{
title: this.$t('MsgTemplate'),
name: 'MsgTemplate',
hidden: !this.$hasPerm('settings.change_email') || !this.$store.getters.hasValidLicense
},
{
title: this.$t('SMS'),
name: 'SMS',

View File

@@ -9,7 +9,7 @@
<script>
import IBox from '@/components/Common/IBox/index.vue'
import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm/index.vue'
import WatermarkHelpDialog from '@/components/Apps/VariablesHelpTextDialog'
import WatermarkHelpDialog from './WatermarkHelpDialog.vue'
export default {
name: 'SessionSecurity',
@@ -18,21 +18,21 @@ export default {
return {
showSessionHelpDialog: false,
showConsoleHelpDialog: false,
sessionVariables: [
{ name: 'userId', label: this.$t('userId'), default: '00000000-0000-0000-0000-000000000001' },
{ name: 'name', label: this.$t('name'), default: '张三' },
{ name: 'userName', label: this.$t('userName'), default: 'zhangsan' },
{ name: 'currentTime', label: this.$t('currentTime'), default: '2025-06-01 12:00:00' },
{ name: 'assetId', label: this.$t('assetId'), default: '00000000-0000-0000-0000-000000000001' },
{ name: 'assetName', label: this.$t('assetName'), default: '服务器01' },
{ name: 'assetAddress', label: this.$t('assetAddress'), default: '192.168.1.1' }
],
consoleVariables: [
{ name: 'userId', label: this.$t('userId'), default: '00000000-0000-0000-0000-000000000001' },
{ name: 'name', label: this.$t('name'), default: '张三' },
{ name: 'userName', label: this.$t('userName'), default: 'zhangsan' },
{ name: 'currentTime', label: this.$t('currentTime'), default: '2025-06-01 12:00:00' }
],
sessionVariables: {
'userId': this.$t('userId'),
'name': this.$t('name'),
'userName': this.$t('userName'),
'currentTime': this.$t('currentTime'),
'assetId': this.$t('assetId'),
'assetName': this.$t('assetName'),
'assetAddress': this.$t('assetAddress')
},
consoleVariables: {
'userId': this.$t('userId'),
'name': this.$t('name'),
'userName': this.$t('userName'),
'currentTime': this.$t('currentTime')
},
config: {
url: '/api/v1/settings/setting/?category=security_session',
hasDetailInMsg: false,

View File

@@ -8,19 +8,17 @@
top="1vh"
width="50%"
>
<p>{{ variablesHelpText }}</p>
<p>{{ $t('WatermarkVariableHelpText') }}</p>
<table border="1" class="help-table">
<tr>
<th>{{ $tc('Variable') }}</th>
<th>{{ $tc('Description') }}</th>
<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.key)">
<label class="item-label">{{ item.key }}</label>
<tr v-for="(val, key, index) in variables" :key="index">
<td :title="$tc('ClickCopy')" class="item-td text-link" @click="onCopy(key)">
<label class="item-label">{{ key }}</label>
</td>
<td><span>{{ item.label }}</span></td>
<td><span>{{ item.example }}</span></td>
<td><span>{{ val }}</span></td>
</tr>
</table>
</Dialog>
@@ -40,14 +38,8 @@ export default {
default: false
},
variables: {
type: Array,
default: () => []
},
variablesHelpText: {
type: String,
default() {
return this.$t('WatermarkVariableHelpText')
}
type: Object,
default: () => ({})
}
},
data() {

View File

@@ -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>

View File

@@ -147,7 +147,7 @@ export default {
this.loading = true
const url = `/api/v1/tickets/comments/?ticket_id=${this.object.id}`
this.$axios.get(url).then(res => {
this.comments = res.results
this.comments = res
}).catch(err => {
this.$message.error(err)
}).finally(() => {

804
yarn.lock

File diff suppressed because it is too large Load Diff