debian-mirror-gitlab/app/assets/javascripts/ide/lib/alerts/index.js
2021-06-08 01:23:25 +05:30

20 lines
703 B
JavaScript

import { leftSidebarViews } from '../../constants';
import EnvironmentsMessage from './environments.vue';
const alerts = [
{
key: Symbol('ALERT_ENVIRONMENT'),
show: (state, file) =>
state.currentActivityView === leftSidebarViews.commit.name &&
file.path === '.gitlab-ci.yml' &&
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);