perf: filter gateway using new params

This commit is contained in:
ibuler
2024-09-19 11:01:48 +08:00
committed by 老广
parent 8545fc6136
commit e26befabc3
7 changed files with 13 additions and 13 deletions

View File

@@ -61,7 +61,7 @@ export default {
row['auto_config'].ansible_enabled && row['auto_config'].ansible_enabled &&
row['auto_config'].ping_enabled, row['auto_config'].ping_enabled,
callback: ({ row }) => { callback: ({ row }) => {
if (row.platform.name === 'Gateway') { if (row.platform.name.startsWith('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) {

View File

@@ -191,7 +191,7 @@ export default {
row?.auto_config?.ansible_enabled && row?.auto_config?.ansible_enabled &&
row?.auto_config?.ping_enabled, row?.auto_config?.ping_enabled,
callback: ({ row }) => { callback: ({ row }) => {
if (row.platform.name === 'Gateway') { if (row.platform.name.startsWith('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) {

View File

@@ -30,7 +30,7 @@ export default {
domain_enabled: true domain_enabled: true
}, },
canSelect: (row) => { canSelect: (row) => {
return row.platform?.name !== 'Gateway' return !row.platform?.name.startsWith('Gateway')
} }
} }
}, },

View File

@@ -25,7 +25,7 @@ export default {
return { return {
tableConfig: { tableConfig: {
category: 'all', category: 'all',
url: `/api/v1/assets/assets/?domain=${this.$route.params.id}&exclude_platform=Gateway`, url: `/api/v1/assets/assets/?domain=${this.$route.params.id}&is_gateway=0`,
tableConfig: { tableConfig: {
columnsMeta: { columnsMeta: {
actions: { actions: {

View File

@@ -39,7 +39,7 @@ export default {
data() { data() {
return { return {
tableConfig: { tableConfig: {
url: `/api/v1/assets/gateways/?domain=${this.$route.params.id}&platform=Gateway`, url: `/api/v1/assets/gateways/?domain=${this.$route.params.id}`,
columnsExclude: [ columnsExclude: [
'info', 'spec_info', 'auto_config' 'info', 'spec_info', 'auto_config'
], ],
@@ -174,7 +174,7 @@ export default {
name: 'GatewayAdd', name: 'GatewayAdd',
title: this.$t('Add'), title: this.$t('Add'),
callback: function() { callback: function() {
this.AddGatewaySetting.AddGatewayDialogVisible = true this.AddGatewaySetting.addGatewayDialogVisible = true
}.bind(this) }.bind(this)
} }
] ]
@@ -183,7 +183,7 @@ export default {
cell: '', cell: '',
visible: false, visible: false,
AddGatewaySetting: { AddGatewaySetting: {
AddGatewayDialogVisible: false addGatewayDialogVisible: false
} }
} }
}, },

View File

@@ -68,7 +68,7 @@ export default {
domain_enabled: true domain_enabled: true
}, },
canSelect: (row) => { canSelect: (row) => {
return row.platform?.name !== 'Gateway' && this.object.assets.map(item => item.id).indexOf(row.id) === -1 return !row.platform?.name.startsWith('Gateway') && this.object.assets.map(item => item.id).indexOf(row.id) === -1
} }
} }
} }

View File

@@ -1,11 +1,11 @@
<template> <template>
<Dialog <Dialog
v-if="setting.AddGatewayDialogVisible" v-if="setting.addGatewayDialogVisible"
:destroy-on-close="true" :destroy-on-close="true"
:show-cancel="false" :show-cancel="false"
:show-confirm="false" :show-confirm="false"
:title="$tc('AddGatewayInDomain')" :title="$tc('AddGatewayInDomain')"
:visible.sync="setting.AddGatewayDialogVisible" :visible.sync="setting.addGatewayDialogVisible"
after after
custom-class="asset-select-dialog" custom-class="asset-select-dialog"
top="15vh" top="15vh"
@@ -31,7 +31,7 @@ export default {
setting: { setting: {
type: Object, type: Object,
default: () => { default: () => {
return { AddGatewayDialogVisible: false } return { addGatewayDialogVisible: false }
} }
}, },
object: { object: {
@@ -64,7 +64,7 @@ export default {
multiple: true, multiple: true,
clearable: true, clearable: true,
ajax: { ajax: {
url: '/api/v1/assets/assets/?domain_enabled=true&platform=Gateway' url: '/api/v1/assets/assets/?domain_enabled=true&is_gateway=1'
}, },
disabledValues: this.object.gateways.map(item => item.id) disabledValues: this.object.gateways.map(item => item.id)
} }
@@ -83,7 +83,7 @@ export default {
}, },
methods: { methods: {
onSubmitSuccess(res) { onSubmitSuccess(res) {
this.setting.AddGatewayDialogVisible = false this.setting.addGatewayDialogVisible = false
this.$emit('close', res) this.$emit('close', res)
} }
} }