Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/ide/lib/alerts/index.js')
-rw-r--r--app/assets/javascripts/ide/lib/alerts/index.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/assets/javascripts/ide/lib/alerts/index.js b/app/assets/javascripts/ide/lib/alerts/index.js
new file mode 100644
index 00000000000..c9db9779b1f
--- /dev/null
+++ b/app/assets/javascripts/ide/lib/alerts/index.js
@@ -0,0 +1,20 @@
+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);