Welcome to mirror list, hosted at ThFree Co, Russian Federation.

getters.js « store « import_projects « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b76c52beea2be7ff88be3d1907bdc8e015392d75 (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
30
import { STATUSES } from '../constants';
import { isProjectImportable, isIncompatible } from '../utils';

export const isLoading = state => state.isLoadingRepos || state.isLoadingNamespaces;

export const isImportingAnyRepo = state =>
  state.repositories.some(repo =>
    [STATUSES.SCHEDULING, STATUSES.SCHEDULED, STATUSES.STARTED].includes(
      repo.importedProject?.importStatus,
    ),
  );

export const hasIncompatibleRepos = state => state.repositories.some(isIncompatible);

export const hasImportableRepos = state => state.repositories.some(isProjectImportable);

export const importAllCount = state => state.repositories.filter(isProjectImportable).length;

export const getImportTarget = state => repoId => {
  if (state.customImportTargets[repoId]) {
    return state.customImportTargets[repoId];
  }

  const repo = state.repositories.find(r => r.importSource.id === repoId);

  return {
    newName: repo.importSource.sanitizedName,
    targetNamespace: state.defaultTargetNamespace,
  };
};