Skip to content

Commit

Permalink
perf: filter gateway using new params
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuler committed Sep 19, 2024
1 parent e343e0d commit 2166337
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/views/assets/Asset/AssetList/HostList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default {
row['auto_config'].ansible_enabled &&
row['auto_config'].ping_enabled,
callback: ({ row }) => {
if (row.platform.name === 'Gateway') {
if (row.platform.name.startsWith('Gateway')) {
this.GatewayVisible = true
const port = row.protocols.find(item => item.name === 'ssh').port
if (!port) {
Expand Down
2 changes: 1 addition & 1 deletion src/views/assets/Asset/AssetList/components/BaseList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export default {
row?.auto_config?.ansible_enabled &&
row?.auto_config?.ping_enabled,
callback: ({ row }) => {
if (row.platform.name === 'Gateway') {
if (row.platform.name.startsWith('Gateway')) {
this.GatewayVisible = true
const port = row.protocols.find(item => item.name === 'ssh').port
if (!port) {
Expand Down
2 changes: 1 addition & 1 deletion src/views/assets/Domain/DomainCreateUpdate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default {
domain_enabled: true
},
canSelect: (row) => {
return row.platform?.name !== 'Gateway'
return !row.platform?.name.startsWith('Gateway')
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/views/assets/Domain/DomainDetail/AssetList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
return {
tableConfig: {
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: {
columnsMeta: {
actions: {
Expand Down
6 changes: 3 additions & 3 deletions src/views/assets/Domain/DomainDetail/GatewayList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default {
data() {
return {
tableConfig: {
url: `/api/v1/assets/gateways/?domain=${this.$route.params.id}&platform=Gateway`,
url: `/api/v1/assets/gateways/?domain=${this.$route.params.id}`,
columnsExclude: [
'info', 'spec_info', 'auto_config'
],
Expand Down Expand Up @@ -174,7 +174,7 @@ export default {
name: 'GatewayAdd',
title: this.$t('Add'),
callback: function() {
this.AddGatewaySetting.AddGatewayDialogVisible = true
this.AddGatewaySetting.addGatewayDialogVisible = true
}.bind(this)
}
]
Expand All @@ -183,7 +183,7 @@ export default {
cell: '',
visible: false,
AddGatewaySetting: {
AddGatewayDialogVisible: false
addGatewayDialogVisible: false
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/views/assets/Domain/components/AddAssetDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default {
domain_enabled: true
},
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
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/views/assets/Domain/components/AddGatewayDialog.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<Dialog
v-if="setting.AddGatewayDialogVisible"
v-if="setting.addGatewayDialogVisible"
:destroy-on-close="true"
:show-cancel="false"
:show-confirm="false"
:title="$tc('AddGatewayInDomain')"
:visible.sync="setting.AddGatewayDialogVisible"
:visible.sync="setting.addGatewayDialogVisible"
after
custom-class="asset-select-dialog"
top="15vh"
Expand All @@ -31,7 +31,7 @@ export default {
setting: {
type: Object,
default: () => {
return { AddGatewayDialogVisible: false }
return { addGatewayDialogVisible: false }
}
},
object: {
Expand Down Expand Up @@ -64,7 +64,7 @@ export default {
multiple: true,
clearable: true,
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)
}
Expand All @@ -83,7 +83,7 @@ export default {
},
methods: {
onSubmitSuccess(res) {
this.setting.AddGatewayDialogVisible = false
this.setting.addGatewayDialogVisible = false
this.$emit('close', res)
}
}
Expand Down

0 comments on commit 2166337

Please sign in to comment.