summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/packages_and_registries/shared/components/cleanup_policy_enabled_alert.vue
blob: d51c62e062338292cdd1a78f2692e633960826ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<script>
import { GlSprintf, GlAlert, GlLink } from '@gitlab/ui';
import { s__ } from '~/locale';
import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue';

export default {
  components: {
    GlAlert,
    GlLink,
    GlSprintf,
    LocalStorageSync,
  },
  props: {
    projectPath: {
      type: String,
      required: true,
    },
    cleanupPoliciesSettingsPath: {
      type: String,
      required: false,
      default: '',
    },
  },
  data() {
    return {
      dismissed: false,
    };
  },
  computed: {
    storageKey() {
      return `cleanup_policy_enabled_for_project_${this.projectPath}`;
    },
  },
  i18n: {
    message: s__(
      'ContainerRegistry|Cleanup policies are now available for this project. %{linkStart}Click here to get started.%{linkEnd}',
    ),
  },
};
</script>

<template>
  <local-storage-sync v-model="dismissed" :storage-key="storageKey">
    <gl-alert v-if="!dismissed" class="gl-mt-2" dismissible @dismiss="dismissed = true">
      <gl-sprintf :message="$options.i18n.message">
        <template #link="{ content }">
          <gl-link v-if="cleanupPoliciesSettingsPath" :href="cleanupPoliciesSettingsPath">{{
            content
          }}</gl-link>
        </template>
      </gl-sprintf>
    </gl-alert>
  </local-storage-sync>
</template>