From a27cc6c0e59416fe6a9e1ffd0ceabab8863927ca Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Wed, 16 Aug 2023 10:22:41 +0300 Subject: [PATCH] fix(edge/stacks): show pending envs [EE-5913] (#10052) --- api/http/handler/endpoints/filter.go | 9 +++-- app/edge/__module.js | 5 +++ .../EnvironmentsDatatable.tsx | 33 +++++++++---------- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/api/http/handler/endpoints/filter.go b/api/http/handler/endpoints/filter.go index 8d008fcc7..a0006a48d 100644 --- a/api/http/handler/endpoints/filter.go +++ b/api/http/handler/endpoints/filter.go @@ -208,9 +208,12 @@ func endpointStatusInStackMatchesFilter(edgeStackStatus map[portainer.EndpointID status, ok := edgeStackStatus[envId] // consider that if the env has no status in the stack it is in Pending state - // workaround because Stack.Status[EnvId].Details.Pending is never set to True in the codebase - if !ok && statusFilter == portainer.EdgeStackStatusPending { - return true + if statusFilter == portainer.EdgeStackStatusPending { + return !ok || len(status.Status) == 0 + } + + if !ok { + return false } return slices.ContainsFunc(status.Status, func(s portainer.EdgeStackDeploymentStatus) bool { diff --git a/app/edge/__module.js b/app/edge/__module.js index a6e659d65..90ab30890 100644 --- a/app/edge/__module.js +++ b/app/edge/__module.js @@ -72,6 +72,11 @@ angular component: 'editEdgeStackView', }, }, + params: { + status: { + dynamic: true, + }, + }, }; const edgeJobs = { diff --git a/app/react/edge/edge-stacks/ItemView/EnvironmentsDatatable/EnvironmentsDatatable.tsx b/app/react/edge/edge-stacks/ItemView/EnvironmentsDatatable/EnvironmentsDatatable.tsx index 37e2b61fc..bb5287b0e 100644 --- a/app/react/edge/edge-stacks/ItemView/EnvironmentsDatatable/EnvironmentsDatatable.tsx +++ b/app/react/edge/edge-stacks/ItemView/EnvironmentsDatatable/EnvironmentsDatatable.tsx @@ -4,7 +4,6 @@ import { useMemo, useState } from 'react'; import { EdgeStackStatus, StatusType } from '@/react/edge/edge-stacks/types'; import { useEnvironmentList } from '@/react/portainer/environments/queries'; -import { isBE } from '@/react/portainer/feature-flags/feature-flags.service'; import { useParamState } from '@/react/hooks/useParamState'; import { EnvironmentId } from '@/react/portainer/environments/types'; @@ -92,23 +91,21 @@ export function EnvironmentsDatatable() { emptyContentLabel="No environment available." disableSelect description={ - isBE && ( -
- - isClearable - bindToBody - value={statusFilter} - onChange={(e) => setStatusFilter(e || undefined)} - options={[ - { value: StatusType.Pending, label: 'Pending' }, - { value: StatusType.Acknowledged, label: 'Acknowledged' }, - { value: StatusType.ImagesPulled, label: 'Images pre-pulled' }, - { value: StatusType.Running, label: 'Deployed' }, - { value: StatusType.Error, label: 'Failed' }, - ]} - /> -
- ) +
+ + isClearable + bindToBody + value={statusFilter} + onChange={(e) => setStatusFilter(e ?? undefined)} + options={[ + { value: StatusType.Pending, label: 'Pending' }, + { value: StatusType.Acknowledged, label: 'Acknowledged' }, + { value: StatusType.ImagesPulled, label: 'Images pre-pulled' }, + { value: StatusType.Running, label: 'Deployed' }, + { value: StatusType.Error, label: 'Failed' }, + ]} + /> +
} /> );