private getDefaultFilterConfiguration()

in services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts [271:298]


  private getDefaultFilterConfiguration(data): void {
    const users = [], projects = [], shapes = [], statuses = [],
      resources = [], endpoints = [], gpuTypes = [], gpuCounts = [];

    data && data.forEach((item: any) => {
      if (item.user && users.indexOf(item.user) === -1) users.push(item.user);
      if (item.endpoint && endpoints.indexOf(item.endpoint) === -1) endpoints.push(item.endpoint);
      if (item.status && statuses.indexOf(item.status.toLowerCase()) === -1) statuses.push(item.status.toLowerCase());
      if (item.project && projects.indexOf(item.project) === -1) projects.push(item.project);
      if (item.shape && shapes.indexOf(item.shape) === -1) shapes.push(item.shape);
      if (item.gpu_type && gpuTypes.indexOf(item.gpu_type) === -1) gpuTypes.push(item.gpu_type);
      if (item.gpu_count && gpuCounts.indexOf(`GPU count: ${item.gpu_count}`) === -1) gpuCounts.push(`GPU count: ${item.gpu_count}`);
      if (item.computational_resources) {
        item.computational_resources.map((resource: any) => {
          if (resources.indexOf(resource.status) === -1) resources.push(resource.status);
          resources.sort(SortUtils.statusSort);
        });
      }
    });

    this.filterConfiguration = new ManagementConfigModel(
      users,
      '',
      projects,
      [...shapes, ...gpuTypes, ...gpuCounts],
      statuses, resources, endpoints
    );
  }