summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/stores/actions/alert.js
blob: 4c33dc195209807902410592f41993558b7dc625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import service from '../../services';
import {
  DETECT_ENVIRONMENTS_GUIDANCE_ALERT,
  DISMISS_ENVIRONMENTS_GUIDANCE_ALERT,
} from '../mutation_types';

export const detectGitlabCiFileAlerts = ({ dispatch }, content) =>
  dispatch('detectEnvironmentsGuidance', content);

export const detectEnvironmentsGuidance = ({ commit, state }, content) =>
  service.getCiConfig(state.currentProjectId, content).then((data) => {
    commit(DETECT_ENVIRONMENTS_GUIDANCE_ALERT, data?.stages);
  });

export const dismissEnvironmentsGuidance = ({ commit }) =>
  service.dismissUserCallout('web_ide_ci_environments_guidance').then(() => {
    commit(DISMISS_ENVIRONMENTS_GUIDANCE_ALERT);
  });