fix(edge-stack) always show edge group selector [EE-5157] (#8639)

pull/8647/head
cmeng 2023-03-10 10:48:44 +13:00 committed by GitHub
parent 31d956dbcb
commit 0ab7987684
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 8 deletions

View File

@ -7,12 +7,13 @@ import { EdgeCheckinIntervalField } from '@/react/edge/components/EdgeCheckInInt
import { EdgeScriptForm } from '@/react/edge/components/EdgeScriptForm';
import { EdgeAsyncIntervalsForm } from '@/react/edge/components/EdgeAsyncIntervalsForm';
import { EdgeStackDeploymentTypeSelector } from '@/react/edge/edge-stacks/components/EdgeStackDeploymentTypeSelector';
import { withUIRouter } from '@/react-tools/withUIRouter';
export const componentsModule = angular
.module('portainer.edge.react.components', [])
.component(
'edgeGroupsSelector',
r2a(withReactQuery(EdgeGroupsSelector), [
r2a(withUIRouter(withReactQuery(EdgeGroupsSelector)), [
'onChange',
'value',
'error',

View File

@ -86,7 +86,6 @@ export default class CreateEdgeStackViewController {
async $onInit() {
try {
this.edgeGroups = await this.EdgeGroupService.groups();
this.noGroups = this.edgeGroups.length === 0;
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to retrieve Edge groups');
}

View File

@ -39,7 +39,7 @@
</div>
<!-- !name-input -->
<edge-groups-selector ng-if="!$ctrl.noGroups" value="$ctrl.formValues.Groups" on-change="($ctrl.onChangeGroups)" items="$ctrl.edgeGroups"></edge-groups-selector>
<edge-groups-selector value="$ctrl.formValues.Groups" on-change="($ctrl.onChangeGroups)" items="$ctrl.edgeGroups"></edge-groups-selector>
<edge-stack-deployment-type-selector
value="$ctrl.formValues.DeploymentType"

View File

@ -64,11 +64,7 @@ function InnerSelector({
}) {
const edgeGroupsQuery = useEdgeGroups();
if (!edgeGroupsQuery.data) {
return null;
}
const items = edgeGroupsQuery.data.filter(isGroupVisible);
const items = (edgeGroupsQuery.data || []).filter(isGroupVisible);
const valueGroups = _.compact(
value.map((id) => items.find((item) => item.Id === id))