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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-16 21:25:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-16 21:25:58 +0300
commita5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch)
treefb69158581673816a8cd895f9d352dcb3c678b1e /app/assets/javascripts/packages/details/store/actions.js
parentd16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff)
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'app/assets/javascripts/packages/details/store/actions.js')
-rw-r--r--app/assets/javascripts/packages/details/store/actions.js33
1 files changed, 29 insertions, 4 deletions
diff --git a/app/assets/javascripts/packages/details/store/actions.js b/app/assets/javascripts/packages/details/store/actions.js
index 87216366c8b..a03fa8d9d63 100644
--- a/app/assets/javascripts/packages/details/store/actions.js
+++ b/app/assets/javascripts/packages/details/store/actions.js
@@ -1,6 +1,10 @@
import Api from '~/api';
-import { deprecatedCreateFlash as createFlash } from '~/flash';
-import { DELETE_PACKAGE_ERROR_MESSAGE } from '~/packages/shared/constants';
+import createFlash from '~/flash';
+import {
+ DELETE_PACKAGE_ERROR_MESSAGE,
+ DELETE_PACKAGE_FILE_ERROR_MESSAGE,
+ DELETE_PACKAGE_FILE_SUCCESS_MESSAGE,
+} from '~/packages/shared/constants';
import { FETCH_PACKAGE_VERSIONS_ERROR } from '../constants';
import * as types from './mutation_types';
@@ -16,7 +20,7 @@ export const fetchPackageVersions = ({ commit, state }) => {
}
})
.catch(() => {
- createFlash(FETCH_PACKAGE_VERSIONS_ERROR);
+ createFlash({ message: FETCH_PACKAGE_VERSIONS_ERROR, type: 'warning' });
})
.finally(() => {
commit(types.SET_LOADING, false);
@@ -29,6 +33,27 @@ export const deletePackage = ({
},
}) => {
return Api.deleteProjectPackage(project_id, id).catch(() => {
- createFlash(DELETE_PACKAGE_ERROR_MESSAGE);
+ createFlash({ message: DELETE_PACKAGE_ERROR_MESSAGE, type: 'warning' });
});
};
+
+export const deletePackageFile = (
+ {
+ state: {
+ packageEntity: { project_id, id },
+ packageFiles,
+ },
+ commit,
+ },
+ fileId,
+) => {
+ return Api.deleteProjectPackageFile(project_id, id, fileId)
+ .then(() => {
+ const filtered = packageFiles.filter((f) => f.id !== fileId);
+ commit(types.UPDATE_PACKAGE_FILES, filtered);
+ createFlash({ message: DELETE_PACKAGE_FILE_SUCCESS_MESSAGE, type: 'success' });
+ })
+ .catch(() => {
+ createFlash({ message: DELETE_PACKAGE_FILE_ERROR_MESSAGE, type: 'warning' });
+ });
+};