Skip to content

Commit

Permalink
fix: request workloads just when target route is data stream (#1881)
Browse files Browse the repository at this point in the history
  • Loading branch information
aloisio-m-bastian authored Nov 6, 2024
1 parent 73c18c2 commit b3ceeb9
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/router/hooks/guards/domainsLimitGuard.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ export async function domainsLimitGuard({ to, accountStore }) {
return true
}

const workloads = await listWorkloadsService({
fields: 'id',
ordering: 'id',
page: 1,
pageSize: 1
})

const isMaxDomainsReached = workloads.count >= 3000
const isCreateOrEditDataStream =
to.name === 'create-data-stream' || to.name === 'edit-data-stream'
if (isCreateOrEditDataStream && isMaxDomainsReached) {
return '/'
if (isCreateOrEditDataStream) {
const workloads = await listWorkloadsService({
fields: 'id',
ordering: 'id',
page: 1,
pageSize: 1
})
const isMaxDomainsReached = workloads.count >= 3000
if (isMaxDomainsReached) {
return '/'
}
}
}

0 comments on commit b3ceeb9

Please sign in to comment.