summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/import_projects/store/getters.js
blob: e6eb8f523de2a3d4014a55a237ef3d9501df8add (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { __ } from '~/locale';

export const namespaceSelectOptions = state => {
  const serializedNamespaces = state.namespaces.map(({ fullPath }) => ({
    id: fullPath,
    text: fullPath,
  }));

  return [
    { text: __('Groups'), children: serializedNamespaces },
    {
      text: __('Users'),
      children: [{ id: state.defaultTargetNamespace, text: state.defaultTargetNamespace }],
    },
  ];
};

export const isImportingAnyRepo = state => state.reposBeingImported.length > 0;

export const hasProviderRepos = state => state.providerRepos.length > 0;

export const hasImportedProjects = state => state.importedProjects.length > 0;

export const hasIncompatibleRepos = state => state.incompatibleRepos.length > 0;

export const reposPathWithFilter = ({ reposPath, filter = '' }) =>
  filter ? `${reposPath}?filter=${filter}` : reposPath;
export const jobsPathWithFilter = ({ jobsPath, filter = '' }) =>
  filter ? `${jobsPath}?filter=${filter}` : jobsPath;