diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-05 12:07:43 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-05 12:07:43 +0000 |
commit | 872319738757edc0483346c75a2407f7019b963f (patch) | |
tree | d5953edec6184dda1f53c5994c3ebcebc9e815a2 /app/assets/javascripts/registry | |
parent | 8f764d21b0011056e1492d92afe3bd40b847b9f7 (diff) | |
download | gitlab-ce-872319738757edc0483346c75a2407f7019b963f.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/registry')
7 files changed, 111 insertions, 0 deletions
diff --git a/app/assets/javascripts/registry/settings/components/registry_settings_app.vue b/app/assets/javascripts/registry/settings/components/registry_settings_app.vue new file mode 100644 index 00000000000..b2c700b817c --- /dev/null +++ b/app/assets/javascripts/registry/settings/components/registry_settings_app.vue @@ -0,0 +1,43 @@ +<script> +import { mapState } from 'vuex'; +import { s__, sprintf } from '~/locale'; + +export default { + components: {}, + computed: { + ...mapState({ + helpPagePath: 'helpPagePath', + }), + + helpText() { + return sprintf( + s__( + 'PackageRegistry|Read more about the %{helpLinkStart}Container Registry tag retention policies%{helpLinkEnd}', + ), + { + helpLinkStart: `<a href="${this.helpPagePath}" target="_blank">`, + helpLinkEnd: '</a>', + }, + false, + ); + }, + }, +}; +</script> + +<template> + <div> + <p> + {{ s__('PackageRegistry|Tag retention policies are designed to:') }} + </p> + <ul> + <li>{{ s__('PackageRegistry|Keep and protect the images that matter most.') }}</li> + <li> + {{ + s__("PackageRegistry|Automatically remove extra images that aren't designed to be kept.") + }} + </li> + </ul> + <p ref="help-link" v-html="helpText"></p> + </div> +</template> diff --git a/app/assets/javascripts/registry/settings/registry_settings_bundle.js b/app/assets/javascripts/registry/settings/registry_settings_bundle.js new file mode 100644 index 00000000000..2938178ea86 --- /dev/null +++ b/app/assets/javascripts/registry/settings/registry_settings_bundle.js @@ -0,0 +1,24 @@ +import Vue from 'vue'; +import Translate from '~/vue_shared/translate'; +import store from './stores/'; +import RegistrySettingsApp from './components/registry_settings_app.vue'; + +Vue.use(Translate); + +export default () => { + const el = document.getElementById('js-registry-settings'); + if (!el) { + return null; + } + store.dispatch('setInitialState', el.dataset); + return new Vue({ + el, + store, + components: { + RegistrySettingsApp, + }, + render(createElement) { + return createElement('registry-settings-app', {}); + }, + }); +}; diff --git a/app/assets/javascripts/registry/settings/stores/actions.js b/app/assets/javascripts/registry/settings/stores/actions.js new file mode 100644 index 00000000000..f2c469d4edb --- /dev/null +++ b/app/assets/javascripts/registry/settings/stores/actions.js @@ -0,0 +1,6 @@ +import * as types from './mutation_types'; + +export const setInitialState = ({ commit }, data) => commit(types.SET_INITIAL_STATE, data); + +// to avoid eslint error until more actions are added to the store +export default () => {}; diff --git a/app/assets/javascripts/registry/settings/stores/index.js b/app/assets/javascripts/registry/settings/stores/index.js new file mode 100644 index 00000000000..91a35aac149 --- /dev/null +++ b/app/assets/javascripts/registry/settings/stores/index.js @@ -0,0 +1,16 @@ +import Vue from 'vue'; +import Vuex from 'vuex'; +import * as actions from './actions'; +import mutations from './mutations'; +import state from './state'; + +Vue.use(Vuex); + +export const createStore = () => + new Vuex.Store({ + state, + actions, + mutations, + }); + +export default createStore(); diff --git a/app/assets/javascripts/registry/settings/stores/mutation_types.js b/app/assets/javascripts/registry/settings/stores/mutation_types.js new file mode 100644 index 00000000000..8a0f519eabd --- /dev/null +++ b/app/assets/javascripts/registry/settings/stores/mutation_types.js @@ -0,0 +1,4 @@ +export const SET_INITIAL_STATE = 'SET_INITIAL_STATE'; + +// to avoid eslint error until more actions are added to the store +export default () => {}; diff --git a/app/assets/javascripts/registry/settings/stores/mutations.js b/app/assets/javascripts/registry/settings/stores/mutations.js new file mode 100644 index 00000000000..4f32e11ed52 --- /dev/null +++ b/app/assets/javascripts/registry/settings/stores/mutations.js @@ -0,0 +1,8 @@ +import * as types from './mutation_types'; + +export default { + [types.SET_INITIAL_STATE](state, initialState) { + state.helpPagePath = initialState.helpPagePath; + state.registrySettingsEndpoint = initialState.registrySettingsEndpoint; + }, +}; diff --git a/app/assets/javascripts/registry/settings/stores/state.js b/app/assets/javascripts/registry/settings/stores/state.js new file mode 100644 index 00000000000..4c0439458b6 --- /dev/null +++ b/app/assets/javascripts/registry/settings/stores/state.js @@ -0,0 +1,10 @@ +export default () => ({ + /* + * Help page path to generate the link + */ + helpPagePath: '', + /* + * Settings endpoint to call to fetch and update the settings + */ + registrySettingsEndpoint: '', +}); |