blob: ac4eeb0386fd667793c608d4d9b721f14fffafad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import { isDefaultCiConfig } from '~/lib/utils/common_utils';
import { leftSidebarViews } from '../../constants';
import EnvironmentsMessage from './environments.vue';
const alerts = [
{
key: Symbol('ALERT_ENVIRONMENT'),
show: (state, file) =>
state.currentActivityView === leftSidebarViews.commit.name &&
isDefaultCiConfig(file.path) &&
state.environmentsGuidanceAlertDetected &&
!state.environmentsGuidanceAlertDismissed,
props: { variant: 'tip' },
dismiss: ({ dispatch }) => dispatch('dismissEnvironmentsGuidance'),
message: EnvironmentsMessage,
},
];
export const findAlertKeyToShow = (...args) => alerts.find((x) => x.show(...args))?.key;
export const getAlert = (key) => alerts.find((x) => x.key === key);
|