fix(edge/stacks): show pending envs [EE-5913] (#10051)

pull/10070/head
Chaim Lev-Ari 2023-08-16 10:22:37 +03:00 committed by GitHub
parent 55236129ea
commit dffdf6783c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 21 deletions

View File

@ -208,9 +208,12 @@ func endpointStatusInStackMatchesFilter(edgeStackStatus map[portainer.EndpointID
status, ok := edgeStackStatus[envId] status, ok := edgeStackStatus[envId]
// consider that if the env has no status in the stack it is in Pending state // 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 statusFilter == portainer.EdgeStackStatusPending {
if !ok && statusFilter == portainer.EdgeStackStatusPending { return !ok || len(status.Status) == 0
return true }
if !ok {
return false
} }
return slices.ContainsFunc(status.Status, func(s portainer.EdgeStackDeploymentStatus) bool { return slices.ContainsFunc(status.Status, func(s portainer.EdgeStackDeploymentStatus) bool {

View File

@ -72,6 +72,11 @@ angular
component: 'editEdgeStackView', component: 'editEdgeStackView',
}, },
}, },
params: {
status: {
dynamic: true,
},
},
}; };
const edgeJobs = { const edgeJobs = {

View File

@ -4,7 +4,6 @@ import { useMemo, useState } from 'react';
import { EdgeStackStatus, StatusType } from '@/react/edge/edge-stacks/types'; import { EdgeStackStatus, StatusType } from '@/react/edge/edge-stacks/types';
import { useEnvironmentList } from '@/react/portainer/environments/queries'; import { useEnvironmentList } from '@/react/portainer/environments/queries';
import { isBE } from '@/react/portainer/feature-flags/feature-flags.service';
import { useParamState } from '@/react/hooks/useParamState'; import { useParamState } from '@/react/hooks/useParamState';
import { EnvironmentId } from '@/react/portainer/environments/types'; import { EnvironmentId } from '@/react/portainer/environments/types';
@ -92,23 +91,21 @@ export function EnvironmentsDatatable() {
emptyContentLabel="No environment available." emptyContentLabel="No environment available."
disableSelect disableSelect
description={ description={
isBE && ( <div className="w-1/4">
<div className="w-1/4"> <PortainerSelect<StatusType | undefined>
<PortainerSelect<StatusType | undefined> isClearable
isClearable bindToBody
bindToBody value={statusFilter}
value={statusFilter} onChange={(e) => setStatusFilter(e ?? undefined)}
onChange={(e) => setStatusFilter(e || undefined)} options={[
options={[ { value: StatusType.Pending, label: 'Pending' },
{ value: StatusType.Pending, label: 'Pending' }, { value: StatusType.Acknowledged, label: 'Acknowledged' },
{ value: StatusType.Acknowledged, label: 'Acknowledged' }, { value: StatusType.ImagesPulled, label: 'Images pre-pulled' },
{ value: StatusType.ImagesPulled, label: 'Images pre-pulled' }, { value: StatusType.Running, label: 'Deployed' },
{ value: StatusType.Running, label: 'Deployed' }, { value: StatusType.Error, label: 'Failed' },
{ value: StatusType.Error, label: 'Failed' }, ]}
]} />
/> </div>
</div>
)
} }
/> />
); );