diff options
Diffstat (limited to 'app/assets/javascripts/registry/stores')
5 files changed, 9 insertions, 1 deletions
diff --git a/app/assets/javascripts/registry/stores/actions.js b/app/assets/javascripts/registry/stores/actions.js index a2e0130e79e..2121f518a7a 100644 --- a/app/assets/javascripts/registry/stores/actions.js +++ b/app/assets/javascripts/registry/stores/actions.js @@ -20,7 +20,6 @@ export const fetchRepos = ({ commit, state }) => { export const fetchList = ({ commit }, { repo, page }) => { commit(types.TOGGLE_REGISTRY_LIST_LOADING, repo); - return axios .get(repo.tagsPath, { params: { page } }) .then(response => { @@ -40,6 +39,7 @@ export const multiDeleteItems = (_, { path, items }) => axios.delete(path, { params: { ids: items } }); export const setMainEndpoint = ({ commit }, data) => commit(types.SET_MAIN_ENDPOINT, data); +export const setIsDeleteDisabled = ({ commit }, data) => commit(types.SET_IS_DELETE_DISABLED, data); export const toggleLoading = ({ commit }) => commit(types.TOGGLE_MAIN_LOADING); // prevent babel-plugin-rewire from generating an invalid default during karma tests diff --git a/app/assets/javascripts/registry/stores/getters.js b/app/assets/javascripts/registry/stores/getters.js index f4923512578..ac90bde1b2a 100644 --- a/app/assets/javascripts/registry/stores/getters.js +++ b/app/assets/javascripts/registry/stores/getters.js @@ -1,5 +1,6 @@ export const isLoading = state => state.isLoading; export const repos = state => state.repos; +export const isDeleteDisabled = state => state.isDeleteDisabled; // prevent babel-plugin-rewire from generating an invalid default during karma tests export default () => {}; diff --git a/app/assets/javascripts/registry/stores/mutation_types.js b/app/assets/javascripts/registry/stores/mutation_types.js index 2c69bf11807..6740bfede1a 100644 --- a/app/assets/javascripts/registry/stores/mutation_types.js +++ b/app/assets/javascripts/registry/stores/mutation_types.js @@ -1,4 +1,5 @@ export const SET_MAIN_ENDPOINT = 'SET_MAIN_ENDPOINT'; +export const SET_IS_DELETE_DISABLED = 'SET_IS_DELETE_DISABLED'; export const SET_REPOS_LIST = 'SET_REPOS_LIST'; export const TOGGLE_MAIN_LOADING = 'TOGGLE_MAIN_LOADING'; diff --git a/app/assets/javascripts/registry/stores/mutations.js b/app/assets/javascripts/registry/stores/mutations.js index 8ace6657ad1..ea5925247d1 100644 --- a/app/assets/javascripts/registry/stores/mutations.js +++ b/app/assets/javascripts/registry/stores/mutations.js @@ -6,6 +6,10 @@ export default { Object.assign(state, { endpoint }); }, + [types.SET_IS_DELETE_DISABLED](state, isDeleteDisabled) { + Object.assign(state, { isDeleteDisabled }); + }, + [types.SET_REPOS_LIST](state, list) { Object.assign(state, { repos: list.map(el => ({ @@ -17,6 +21,7 @@ export default { location: el.location, name: el.path, tagsPath: el.tags_path, + projectId: el.project_id, })), }); }, diff --git a/app/assets/javascripts/registry/stores/state.js b/app/assets/javascripts/registry/stores/state.js index feeac10cbe1..724c64b4994 100644 --- a/app/assets/javascripts/registry/stores/state.js +++ b/app/assets/javascripts/registry/stores/state.js @@ -1,6 +1,7 @@ export default () => ({ isLoading: false, endpoint: '', // initial endpoint to fetch the repos list + isDeleteDisabled: false, // controls the delete buttons in the registry /** * Each object in `repos` has the following strucure: * { |