mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-09 18:47:43 +00:00
perf: support options
This commit is contained in:
parent
7c5c5f966d
commit
d8a6fd96ce
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="filters" class="quick-filter">
|
<div v-if="filters || summary" :class="isExpand ? 'expand': 'shrink' " class="quick-filter">
|
||||||
<div v-show="isExpand" class="quick-filter-wrap">
|
<div v-show="isExpand" class="quick-filter-wrap">
|
||||||
<div class="quick-filter-zone">
|
<div v-show="filters" class="quick-filter-zone">
|
||||||
<div v-for="category in filters" :key="category.label" class="item-zone">
|
<div v-for="category in filters" :key="category.label" class="item-zone">
|
||||||
<h5>{{ category.label }}</h5>
|
<h5>{{ category.label }}</h5>
|
||||||
<div class="filter-options">
|
<div class="filter-options">
|
||||||
@ -11,6 +11,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="summary-zone">
|
||||||
|
<span v-for="item of summary" :key="item.title">
|
||||||
|
<SummaryCard :body="item.body" :title="item.title" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="expand-bar-wrap">
|
<div class="expand-bar-wrap">
|
||||||
<div class="expand-bar" @click="toggle">
|
<div class="expand-bar" @click="toggle">
|
||||||
@ -22,13 +27,46 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import SummaryCard from '@/views/dashboard/components/SummaryCard.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'QuickFilter',
|
name: 'QuickFilter',
|
||||||
|
components: { SummaryCard },
|
||||||
props: {
|
props: {
|
||||||
filters: {
|
filters: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => []
|
default: () => []
|
||||||
},
|
},
|
||||||
|
summary: {
|
||||||
|
type: Array,
|
||||||
|
default: () => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
title: '最近一周发现',
|
||||||
|
body: {
|
||||||
|
route: { name: `SessionList`, params: { activeMenu: 'OnlineList' }},
|
||||||
|
count: 10,
|
||||||
|
disabled: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '最近一月发现',
|
||||||
|
body: {
|
||||||
|
route: { name: `SessionList`, params: { activeMenu: 'OnlineList' }},
|
||||||
|
count: 321,
|
||||||
|
disabled: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '待确认',
|
||||||
|
body: {
|
||||||
|
count: 544,
|
||||||
|
disabled: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
expand: {
|
expand: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
@ -54,56 +92,71 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
.quick-filter-zone {
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-start;
|
|
||||||
|
|
||||||
h5 {
|
|
||||||
font-weight: 600;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-size: 12px;
|
|
||||||
margin-bottom: .5rem;
|
|
||||||
line-height: 1.2;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item-zone {
|
|
||||||
margin-right: 30px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item {
|
|
||||||
display: inline-block;
|
|
||||||
margin-right: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
background-color: #f5f7fa;
|
|
||||||
color: #303133;
|
|
||||||
font-size: 12px;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: var(--color-primary);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ul {
|
|
||||||
list-style: none outside none;
|
|
||||||
margin-block-start: 0;
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.quick-filter {
|
.quick-filter {
|
||||||
|
background: white;
|
||||||
|
padding: 10px 10px 10px 20px;
|
||||||
|
margin-bottom: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
place-content: stretch flex-end;
|
place-content: stretch flex-end;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-content: stretch;
|
align-content: stretch;
|
||||||
}
|
box-shadow: 0 1px 1px 0 rgba(54, 58, 80, .32);
|
||||||
|
|
||||||
.quick-filter-wrap {
|
&.shrink {
|
||||||
display: inline-block;
|
background: inherit;
|
||||||
width: calc(100% - 25px);
|
padding: 0;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-filter-wrap {
|
||||||
|
display: inline-block;
|
||||||
|
width: calc(100% - 70px);
|
||||||
|
|
||||||
|
.summary-zone {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-filter-zone {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
|
||||||
|
h5 {
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-size: 12px;
|
||||||
|
margin-bottom: .5rem;
|
||||||
|
line-height: 1.2;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-zone {
|
||||||
|
margin-right: 30px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
color: #303133;
|
||||||
|
font-size: 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: var(--color-primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
list-style: none outside none;
|
||||||
|
margin-block-start: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-options {
|
.filter-options {
|
||||||
@ -112,18 +165,19 @@ export default {
|
|||||||
|
|
||||||
.expand-bar-wrap {
|
.expand-bar-wrap {
|
||||||
margin: auto 0;
|
margin: auto 0;
|
||||||
}
|
min-width: 60px;
|
||||||
|
|
||||||
.expand-bar {
|
.expand-bar {
|
||||||
text-align: center;
|
float: right;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
i {
|
i {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
|
||||||
&.shrink {
|
&.shrink {
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,15 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
const vm = this
|
const vm = this
|
||||||
return {
|
return {
|
||||||
|
config: {
|
||||||
|
title: this.$t('RealTimeData'),
|
||||||
|
tip: this.$t('RealTimeData')
|
||||||
|
},
|
||||||
|
counter: {
|
||||||
|
total_count_online_sessions: '.',
|
||||||
|
total_count_online_users: '.',
|
||||||
|
total_count_today_failed_sessions: '.'
|
||||||
|
},
|
||||||
showDeleteAccountDialog: false,
|
showDeleteAccountDialog: false,
|
||||||
gatherAccounts: {},
|
gatherAccounts: {},
|
||||||
treeSetting: {
|
treeSetting: {
|
||||||
@ -215,3 +224,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style lang='scss' scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
@update="handleAssetBulkUpdate"
|
@update="handleAssetBulkUpdate"
|
||||||
/>
|
/>
|
||||||
<GatewayDialog
|
<GatewayDialog
|
||||||
:cell="GatewayCell"
|
:cell="gatewayCell"
|
||||||
:port="GatewayPort"
|
:port="gatewayPort"
|
||||||
:visible.sync="GatewayVisible"
|
:visible.sync="gatewayVisible"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -113,9 +113,9 @@ export default {
|
|||||||
const extraQuery = this.$route.params?.extraQuery || {}
|
const extraQuery = this.$route.params?.extraQuery || {}
|
||||||
return {
|
return {
|
||||||
showPlatform: false,
|
showPlatform: false,
|
||||||
GatewayPort: 0,
|
gatewayPort: 0,
|
||||||
GatewayCell: '',
|
gatewayCell: '',
|
||||||
GatewayVisible: false,
|
gatewayVisible: false,
|
||||||
defaultConfig: {
|
defaultConfig: {
|
||||||
url: '/api/v1/assets/hosts/',
|
url: '/api/v1/assets/hosts/',
|
||||||
permissions: {
|
permissions: {
|
||||||
@ -216,13 +216,13 @@ export default {
|
|||||||
row?.auto_config?.ping_enabled,
|
row?.auto_config?.ping_enabled,
|
||||||
callback: ({ row }) => {
|
callback: ({ row }) => {
|
||||||
if (row.platform.name === 'Gateway') {
|
if (row.platform.name === 'Gateway') {
|
||||||
this.GatewayVisible = true
|
this.gatewayVisible = true
|
||||||
const port = row.protocols.find(item => item.name === 'ssh').port
|
const port = row.protocols.find(item => item.name === 'ssh').port
|
||||||
if (!port) {
|
if (!port) {
|
||||||
return this.$message.error(this.$tc('BadRequestErrorMsg'))
|
return this.$message.error(this.$tc('BadRequestErrorMsg'))
|
||||||
} else {
|
} else {
|
||||||
this.GatewayPort = port
|
this.gatewayPort = port
|
||||||
this.GatewayCell = row.id
|
this.gatewayCell = row.id
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$axios.post(
|
this.$axios.post(
|
||||||
|
Loading…
Reference in New Issue
Block a user