debian-mirror-gitlab/app/assets/javascripts/import_projects/store/getters.js

30 lines
969 B
JavaScript
Raw Normal View History

2019-09-04 21:01:54 +05:30
import { __ } from '~/locale';
2019-07-07 11:18:12 +05:30
export const namespaceSelectOptions = state => {
const serializedNamespaces = state.namespaces.map(({ fullPath }) => ({
id: fullPath,
text: fullPath,
}));
return [
2019-09-04 21:01:54 +05:30
{ text: __('Groups'), children: serializedNamespaces },
2019-07-07 11:18:12 +05:30
{
2019-09-04 21:01:54 +05:30
text: __('Users'),
2019-07-07 11:18:12 +05:30
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;
2019-12-21 20:55:43 +05:30
2020-06-23 00:09:42 +05:30
export const hasIncompatibleRepos = state => state.incompatibleRepos.length > 0;
2019-12-21 20:55:43 +05:30
export const reposPathWithFilter = ({ reposPath, filter = '' }) =>
filter ? `${reposPath}?filter=${filter}` : reposPath;
export const jobsPathWithFilter = ({ jobsPath, filter = '' }) =>
filter ? `${jobsPath}?filter=${filter}` : jobsPath;