mirror of https://github.com/portainer/portainer
				
				
				
			fix(edge-stack) always show edge group selector [EE-5157] (#8638)
							parent
							
								
									17517d7521
								
							
						
					
					
						commit
						a7d1a20dfb
					
				| 
						 | 
				
			
			@ -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',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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');
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue