blob: f203a259b16034db82dac42db335c0a80d1d3914 (
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
31
32
33
34
35
36
37
38
39
40
41
|
import { isMatch } from 'lodash';
import { __, s__, sprintf } from '~/locale';
import { getDisplayName } from '../utils';
export const hasProjects = (state) => Boolean(state.projects) && state.projects.length > 0;
export const isProjectInvalid = (state, getters) =>
Boolean(state.selectedProject) &&
getters.hasProjects &&
!state.projects.some((project) => isMatch(state.selectedProject, project));
export const dropdownLabel = (state, getters) => {
if (state.selectedProject !== null) {
return getDisplayName(state.selectedProject);
}
if (!getters.hasProjects) {
return s__('ErrorTracking|No projects available');
}
return s__('ErrorTracking|Select project');
};
export const invalidProjectLabel = (state) => {
if (state.selectedProject) {
return sprintf(
__('Project "%{name}" is no longer available. Select another project to continue.'),
{
name: state.selectedProject.name,
},
);
}
return '';
};
export const projectSelectionLabel = (state) => {
if (state.token) {
return s__(
'ErrorTracking|Click Connect to reestablish the connection to Sentry and activate the dropdown.',
);
}
return s__('ErrorTracking|To enable project selection, enter a valid Auth Token.');
};
|