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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/registry/explorer/stores')
-rw-r--r--app/assets/javascripts/registry/explorer/stores/actions.js119
-rw-r--r--app/assets/javascripts/registry/explorer/stores/getters.js18
-rw-r--r--app/assets/javascripts/registry/explorer/stores/index.js16
-rw-r--r--app/assets/javascripts/registry/explorer/stores/mutation_types.js10
-rw-r--r--app/assets/javascripts/registry/explorer/stores/mutations.js54
-rw-r--r--app/assets/javascripts/registry/explorer/stores/state.js10
6 files changed, 0 insertions, 227 deletions
diff --git a/app/assets/javascripts/registry/explorer/stores/actions.js b/app/assets/javascripts/registry/explorer/stores/actions.js
deleted file mode 100644
index c1883095097..00000000000
--- a/app/assets/javascripts/registry/explorer/stores/actions.js
+++ /dev/null
@@ -1,119 +0,0 @@
-import axios from '~/lib/utils/axios_utils';
-import createFlash from '~/flash';
-import Api from '~/api';
-import * as types from './mutation_types';
-import {
- FETCH_IMAGES_LIST_ERROR_MESSAGE,
- DEFAULT_PAGE,
- DEFAULT_PAGE_SIZE,
- FETCH_TAGS_LIST_ERROR_MESSAGE,
- FETCH_IMAGE_DETAILS_ERROR_MESSAGE,
-} from '../constants/index';
-import { pathGenerator } from '../utils';
-
-export const setInitialState = ({ commit }, data) => commit(types.SET_INITIAL_STATE, data);
-export const setShowGarbageCollectionTip = ({ commit }, data) =>
- commit(types.SET_SHOW_GARBAGE_COLLECTION_TIP, data);
-
-export const receiveImagesListSuccess = ({ commit }, { data, headers }) => {
- commit(types.SET_IMAGES_LIST_SUCCESS, data);
- commit(types.SET_PAGINATION, headers);
-};
-
-export const receiveTagsListSuccess = ({ commit }, { data, headers }) => {
- commit(types.SET_TAGS_LIST_SUCCESS, data);
- commit(types.SET_TAGS_PAGINATION, headers);
-};
-
-export const requestImagesList = (
- { commit, dispatch, state },
- { pagination = {}, name = null } = {},
-) => {
- commit(types.SET_MAIN_LOADING, true);
- const { page = DEFAULT_PAGE, perPage = DEFAULT_PAGE_SIZE } = pagination;
-
- return axios
- .get(state.config.endpoint, { params: { page, per_page: perPage, name } })
- .then(({ data, headers }) => {
- dispatch('receiveImagesListSuccess', { data, headers });
- })
- .catch(() => {
- createFlash({ message: FETCH_IMAGES_LIST_ERROR_MESSAGE });
- })
- .finally(() => {
- commit(types.SET_MAIN_LOADING, false);
- });
-};
-
-export const requestTagsList = ({ commit, dispatch, state: { imageDetails } }, pagination = {}) => {
- commit(types.SET_MAIN_LOADING, true);
- const tagsPath = pathGenerator(imageDetails);
-
- const { page = DEFAULT_PAGE, perPage = DEFAULT_PAGE_SIZE } = pagination;
- return axios
- .get(tagsPath, { params: { page, per_page: perPage } })
- .then(({ data, headers }) => {
- dispatch('receiveTagsListSuccess', { data, headers });
- })
- .catch(() => {
- createFlash({ message: FETCH_TAGS_LIST_ERROR_MESSAGE });
- })
- .finally(() => {
- commit(types.SET_MAIN_LOADING, false);
- });
-};
-
-export const requestImageDetailsAndTagsList = ({ dispatch, commit }, id) => {
- commit(types.SET_MAIN_LOADING, true);
- return Api.containerRegistryDetails(id)
- .then(({ data }) => {
- commit(types.SET_IMAGE_DETAILS, data);
- dispatch('requestTagsList');
- })
- .catch(() => {
- createFlash({ message: FETCH_IMAGE_DETAILS_ERROR_MESSAGE });
- commit(types.SET_MAIN_LOADING, false);
- });
-};
-
-export const requestDeleteTag = ({ commit, dispatch, state }, { tag }) => {
- commit(types.SET_MAIN_LOADING, true);
- return axios
- .delete(tag.destroy_path)
- .then(() => {
- dispatch('setShowGarbageCollectionTip', true);
-
- return dispatch('requestTagsList', state.tagsPagination);
- })
- .finally(() => {
- commit(types.SET_MAIN_LOADING, false);
- });
-};
-
-export const requestDeleteTags = ({ commit, dispatch, state }, { ids }) => {
- commit(types.SET_MAIN_LOADING, true);
-
- const tagsPath = pathGenerator(state.imageDetails, '/bulk_destroy');
-
- return axios
- .delete(tagsPath, { params: { ids } })
- .then(() => {
- dispatch('setShowGarbageCollectionTip', true);
- return dispatch('requestTagsList', state.tagsPagination);
- })
- .finally(() => {
- commit(types.SET_MAIN_LOADING, false);
- });
-};
-
-export const requestDeleteImage = ({ commit }, image) => {
- commit(types.SET_MAIN_LOADING, true);
- return axios
- .delete(image.destroy_path)
- .then(() => {
- commit(types.UPDATE_IMAGE, { ...image, deleting: true });
- })
- .finally(() => {
- commit(types.SET_MAIN_LOADING, false);
- });
-};
diff --git a/app/assets/javascripts/registry/explorer/stores/getters.js b/app/assets/javascripts/registry/explorer/stores/getters.js
deleted file mode 100644
index 7b5d1bd6da3..00000000000
--- a/app/assets/javascripts/registry/explorer/stores/getters.js
+++ /dev/null
@@ -1,18 +0,0 @@
-export const dockerBuildCommand = state => {
- /* eslint-disable @gitlab/require-i18n-strings */
- return `docker build -t ${state.config.repositoryUrl} .`;
-};
-
-export const dockerPushCommand = state => {
- /* eslint-disable @gitlab/require-i18n-strings */
- return `docker push ${state.config.repositoryUrl}`;
-};
-
-export const dockerLoginCommand = state => {
- /* eslint-disable @gitlab/require-i18n-strings */
- return `docker login ${state.config.registryHostUrlWithPort}`;
-};
-
-export const showGarbageCollection = state => {
- return state.showGarbageCollectionTip && state.config.isAdmin;
-};
diff --git a/app/assets/javascripts/registry/explorer/stores/index.js b/app/assets/javascripts/registry/explorer/stores/index.js
deleted file mode 100644
index 18e3351ed13..00000000000
--- a/app/assets/javascripts/registry/explorer/stores/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import * as actions from './actions';
-import * as getters from './getters';
-import mutations from './mutations';
-import state from './state';
-
-Vue.use(Vuex);
-
-export const createStore = () =>
- new Vuex.Store({
- state,
- getters,
- actions,
- mutations,
- });
diff --git a/app/assets/javascripts/registry/explorer/stores/mutation_types.js b/app/assets/javascripts/registry/explorer/stores/mutation_types.js
deleted file mode 100644
index 5dd0cec52eb..00000000000
--- a/app/assets/javascripts/registry/explorer/stores/mutation_types.js
+++ /dev/null
@@ -1,10 +0,0 @@
-export const SET_INITIAL_STATE = 'SET_INITIAL_STATE';
-
-export const SET_IMAGES_LIST_SUCCESS = 'SET_PACKAGE_LIST_SUCCESS';
-export const UPDATE_IMAGE = 'UPDATE_IMAGE';
-export const SET_PAGINATION = 'SET_PAGINATION';
-export const SET_MAIN_LOADING = 'SET_MAIN_LOADING';
-export const SET_TAGS_PAGINATION = 'SET_TAGS_PAGINATION';
-export const SET_TAGS_LIST_SUCCESS = 'SET_TAGS_LIST_SUCCESS';
-export const SET_SHOW_GARBAGE_COLLECTION_TIP = 'SET_SHOW_GARBAGE_COLLECTION_TIP';
-export const SET_IMAGE_DETAILS = 'SET_IMAGE_DETAILS';
diff --git a/app/assets/javascripts/registry/explorer/stores/mutations.js b/app/assets/javascripts/registry/explorer/stores/mutations.js
deleted file mode 100644
index 5bdb431ad2e..00000000000
--- a/app/assets/javascripts/registry/explorer/stores/mutations.js
+++ /dev/null
@@ -1,54 +0,0 @@
-import * as types from './mutation_types';
-import { parseIntPagination, normalizeHeaders, parseBoolean } from '~/lib/utils/common_utils';
-import { IMAGE_DELETE_SCHEDULED_STATUS, IMAGE_FAILED_DELETED_STATUS } from '../constants/index';
-
-export default {
- [types.SET_INITIAL_STATE](state, config) {
- state.config = {
- ...config,
- expirationPolicy: config.expirationPolicy ? JSON.parse(config.expirationPolicy) : undefined,
- isGroupPage: parseBoolean(config.isGroupPage),
- isAdmin: parseBoolean(config.isAdmin),
- };
- },
-
- [types.SET_IMAGES_LIST_SUCCESS](state, images) {
- state.images = images.map(i => ({
- ...i,
- status: undefined,
- deleting: i.status === IMAGE_DELETE_SCHEDULED_STATUS,
- failedDelete: i.status === IMAGE_FAILED_DELETED_STATUS,
- }));
- },
-
- [types.UPDATE_IMAGE](state, image) {
- const index = state.images.findIndex(i => i.id === image.id);
- state.images.splice(index, 1, { ...image });
- },
-
- [types.SET_TAGS_LIST_SUCCESS](state, tags) {
- state.tags = tags;
- },
-
- [types.SET_MAIN_LOADING](state, isLoading) {
- state.isLoading = isLoading;
- },
-
- [types.SET_SHOW_GARBAGE_COLLECTION_TIP](state, showGarbageCollectionTip) {
- state.showGarbageCollectionTip = showGarbageCollectionTip;
- },
-
- [types.SET_PAGINATION](state, headers) {
- const normalizedHeaders = normalizeHeaders(headers);
- state.pagination = parseIntPagination(normalizedHeaders);
- },
-
- [types.SET_TAGS_PAGINATION](state, headers) {
- const normalizedHeaders = normalizeHeaders(headers);
- state.tagsPagination = parseIntPagination(normalizedHeaders);
- },
-
- [types.SET_IMAGE_DETAILS](state, details) {
- state.imageDetails = details;
- },
-};
diff --git a/app/assets/javascripts/registry/explorer/stores/state.js b/app/assets/javascripts/registry/explorer/stores/state.js
deleted file mode 100644
index 66ee56eb47b..00000000000
--- a/app/assets/javascripts/registry/explorer/stores/state.js
+++ /dev/null
@@ -1,10 +0,0 @@
-export default () => ({
- isLoading: false,
- showGarbageCollectionTip: false,
- config: {},
- images: [],
- imageDetails: {},
- tags: [],
- pagination: {},
- tagsPagination: {},
-});