2020-10-24 23:57:45 +05:30
|
|
|
import { s__ } from '~/locale';
|
|
|
|
import { PackageType, TrackingCategories } from './constants';
|
|
|
|
|
|
|
|
export const packageTypeToTrackCategory = type =>
|
|
|
|
// eslint-disable-next-line @gitlab/require-i18n-strings
|
|
|
|
`UI::${TrackingCategories[type]}`;
|
|
|
|
|
|
|
|
export const beautifyPath = path => (path ? path.split('/').join(' / ') : '');
|
|
|
|
|
|
|
|
export const getPackageTypeLabel = packageType => {
|
|
|
|
switch (packageType) {
|
|
|
|
case PackageType.CONAN:
|
|
|
|
return s__('PackageType|Conan');
|
|
|
|
case PackageType.MAVEN:
|
|
|
|
return s__('PackageType|Maven');
|
|
|
|
case PackageType.NPM:
|
|
|
|
return s__('PackageType|NPM');
|
|
|
|
case PackageType.NUGET:
|
|
|
|
return s__('PackageType|NuGet');
|
|
|
|
case PackageType.PYPI:
|
2021-01-03 14:25:43 +05:30
|
|
|
return s__('PackageType|PyPI');
|
2020-10-24 23:57:45 +05:30
|
|
|
case PackageType.COMPOSER:
|
|
|
|
return s__('PackageType|Composer');
|
2021-02-22 17:27:13 +05:30
|
|
|
case PackageType.GENERIC:
|
|
|
|
return s__('PackageType|Generic');
|
2020-10-24 23:57:45 +05:30
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getCommitLink = ({ project_path: projectPath, pipeline = {} }, isGroup = false) => {
|
|
|
|
if (isGroup) {
|
|
|
|
return `/${projectPath}/commit/${pipeline.sha}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return `../commit/${pipeline.sha}`;
|
|
|
|
};
|