mirror of
https://github.com/jumpserver/lina.git
synced 2025-07-20 10:09:04 +00:00
perf: Update status action to handle multiple accounts
This commit is contained in:
parent
ef063898ca
commit
ac40823319
@ -1,5 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<RemoveAccount
|
||||||
|
v-if="showDeleteAccountDialog"
|
||||||
|
:accounts="gatherAccounts"
|
||||||
|
:visible.sync="showDeleteAccountDialog"
|
||||||
|
/>
|
||||||
<DeleteDialog
|
<DeleteDialog
|
||||||
v-if="deleteDialog.visible"
|
v-if="deleteDialog.visible"
|
||||||
:account="deleteDialog.account"
|
:account="deleteDialog.account"
|
||||||
@ -22,12 +27,14 @@ import AssetTreeTable from '@/components/Apps/AssetTreeTable/index.vue'
|
|||||||
import DeleteDialog from '@/views/accounts/AccountDiscover/DeleteDialog.vue'
|
import DeleteDialog from '@/views/accounts/AccountDiscover/DeleteDialog.vue'
|
||||||
import { gatherAccountHeaderActions, gatherAccountTableConfig } from '@/views/accounts/const'
|
import { gatherAccountHeaderActions, gatherAccountTableConfig } from '@/views/accounts/const'
|
||||||
import AccountDiscoverDialog from '@/views/assets/Asset/AssetList/components/AccountDiscoverDialog.vue'
|
import AccountDiscoverDialog from '@/views/assets/Asset/AssetList/components/AccountDiscoverDialog.vue'
|
||||||
|
import RemoveAccount from '@/components/Apps/AccountListTable/RemoveAccount.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
AssetTreeTable,
|
AssetTreeTable,
|
||||||
DeleteDialog,
|
DeleteDialog,
|
||||||
AccountDiscoverDialog
|
AccountDiscoverDialog,
|
||||||
|
RemoveAccount
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -64,8 +64,8 @@ export const gatherAccountTableConfig = (vm, url) => {
|
|||||||
formatterArgs: {
|
formatterArgs: {
|
||||||
confirm: ({ row }) => {
|
confirm: ({ row }) => {
|
||||||
vm.$axios.put(
|
vm.$axios.put(
|
||||||
`/api/v1/accounts/gathered-accounts/${row.id}/status/`,
|
`/api/v1/accounts/gathered-accounts/status/`,
|
||||||
{ status: 'confirmed' }
|
{ status: 'confirmed', ids: [row.id] }
|
||||||
).then(res => {
|
).then(res => {
|
||||||
row.status = 'confirmed'
|
row.status = 'confirmed'
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
@ -74,8 +74,8 @@ export const gatherAccountTableConfig = (vm, url) => {
|
|||||||
},
|
},
|
||||||
ignore: ({ row }) => {
|
ignore: ({ row }) => {
|
||||||
vm.$axios.put(
|
vm.$axios.put(
|
||||||
`/api/v1/accounts/gathered-accounts/${row.id}/status/`,
|
`/api/v1/accounts/gathered-accounts/status/`,
|
||||||
{ status: 'ignored' }
|
{ status: 'ignored', ids: [row.id] }
|
||||||
).then(res => {
|
).then(res => {
|
||||||
row.status = 'ignored'
|
row.status = 'ignored'
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
@ -121,7 +121,7 @@ export const gatherAccountHeaderActions = (vm) => {
|
|||||||
extraMoreActions: [
|
extraMoreActions: [
|
||||||
{
|
{
|
||||||
name: 'SyncSelected',
|
name: 'SyncSelected',
|
||||||
title: vm.$t('ConfirmSelected'),
|
title: vm.$t('SyncSelected'),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
icon: 'fa fa-check',
|
icon: 'fa fa-check',
|
||||||
can: ({ selectedRows }) => {
|
can: ({ selectedRows }) => {
|
||||||
@ -131,9 +131,9 @@ export const gatherAccountHeaderActions = (vm) => {
|
|||||||
const ids = selectedRows.map(v => {
|
const ids = selectedRows.map(v => {
|
||||||
return v.id
|
return v.id
|
||||||
})
|
})
|
||||||
vm.$axios.post(
|
vm.$axios.put(
|
||||||
`/api/v1/accounts/gathered-accounts/sync-accounts/`,
|
`/api/v1/accounts/gathered-accounts/status/`,
|
||||||
{ gathered_account_ids: ids }
|
{ ids: ids, status: 'confirmed' }
|
||||||
).then(() => {
|
).then(() => {
|
||||||
vm.$message.success(vm.$tc('SyncSuccessMsg'))
|
vm.$message.success(vm.$tc('SyncSuccessMsg'))
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
Loading…
Reference in New Issue
Block a user