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

alert.js « mutations « stores « ide « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bb2d33a836bf9b7b9f83a1f62d378ce34956a93f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import {
  DETECT_ENVIRONMENTS_GUIDANCE_ALERT,
  DISMISS_ENVIRONMENTS_GUIDANCE_ALERT,
} from '../mutation_types';

export default {
  [DETECT_ENVIRONMENTS_GUIDANCE_ALERT](state, stages) {
    if (!stages) {
      return;
    }
    const hasEnvironments = stages?.nodes?.some((stage) =>
      stage.groups.nodes.some((group) => group.jobs.nodes.some((job) => job.environment)),
    );
    const hasParsedCi = Array.isArray(stages.nodes);

    state.environmentsGuidanceAlertDetected = !hasEnvironments && hasParsedCi;
  },
  [DISMISS_ENVIRONMENTS_GUIDANCE_ALERT](state) {
    state.environmentsGuidanceAlertDismissed = true;
  },
};