mirror of https://github.com/portainer/portainer
fix(edge-stack) always show edge group selector [EE-5157] (#8639)
parent
31d956dbcb
commit
0ab7987684
|
@ -7,12 +7,13 @@ import { EdgeCheckinIntervalField } from '@/react/edge/components/EdgeCheckInInt
|
||||||
import { EdgeScriptForm } from '@/react/edge/components/EdgeScriptForm';
|
import { EdgeScriptForm } from '@/react/edge/components/EdgeScriptForm';
|
||||||
import { EdgeAsyncIntervalsForm } from '@/react/edge/components/EdgeAsyncIntervalsForm';
|
import { EdgeAsyncIntervalsForm } from '@/react/edge/components/EdgeAsyncIntervalsForm';
|
||||||
import { EdgeStackDeploymentTypeSelector } from '@/react/edge/edge-stacks/components/EdgeStackDeploymentTypeSelector';
|
import { EdgeStackDeploymentTypeSelector } from '@/react/edge/edge-stacks/components/EdgeStackDeploymentTypeSelector';
|
||||||
|
import { withUIRouter } from '@/react-tools/withUIRouter';
|
||||||
|
|
||||||
export const componentsModule = angular
|
export const componentsModule = angular
|
||||||
.module('portainer.edge.react.components', [])
|
.module('portainer.edge.react.components', [])
|
||||||
.component(
|
.component(
|
||||||
'edgeGroupsSelector',
|
'edgeGroupsSelector',
|
||||||
r2a(withReactQuery(EdgeGroupsSelector), [
|
r2a(withUIRouter(withReactQuery(EdgeGroupsSelector)), [
|
||||||
'onChange',
|
'onChange',
|
||||||
'value',
|
'value',
|
||||||
'error',
|
'error',
|
||||||
|
|
|
@ -86,7 +86,6 @@ export default class CreateEdgeStackViewController {
|
||||||
async $onInit() {
|
async $onInit() {
|
||||||
try {
|
try {
|
||||||
this.edgeGroups = await this.EdgeGroupService.groups();
|
this.edgeGroups = await this.EdgeGroupService.groups();
|
||||||
this.noGroups = this.edgeGroups.length === 0;
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Unable to retrieve Edge groups');
|
this.Notifications.error('Failure', err, 'Unable to retrieve Edge groups');
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- !name-input -->
|
<!-- !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
|
<edge-stack-deployment-type-selector
|
||||||
value="$ctrl.formValues.DeploymentType"
|
value="$ctrl.formValues.DeploymentType"
|
||||||
|
|
|
@ -64,11 +64,7 @@ function InnerSelector({
|
||||||
}) {
|
}) {
|
||||||
const edgeGroupsQuery = useEdgeGroups();
|
const edgeGroupsQuery = useEdgeGroups();
|
||||||
|
|
||||||
if (!edgeGroupsQuery.data) {
|
const items = (edgeGroupsQuery.data || []).filter(isGroupVisible);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const items = edgeGroupsQuery.data.filter(isGroupVisible);
|
|
||||||
|
|
||||||
const valueGroups = _.compact(
|
const valueGroups = _.compact(
|
||||||
value.map((id) => items.find((item) => item.Id === id))
|
value.map((id) => items.find((item) => item.Id === id))
|
||||||
|
|
Loading…
Reference in New Issue