Commit 80d2b143 authored by Florie Guibert's avatar Florie Guibert

Replace DeprecatedModal with GlModal for boards

Review feedback
parent 0331a4aa
<script>
import { GlModal } from '@gitlab/ui';
import { __ } from '~/locale';
import { __, s__ } from '~/locale';
import { deprecatedCreateFlash as Flash } from '~/flash';
import { visitUrl } from '~/lib/utils/url_utility';
import boardsStore from '~/boards/stores/boards_store';
......@@ -19,22 +19,24 @@ const boardDefaults = {
hide_closed_list: false,
};
const newFormType = 'new';
const deleteFormType = 'delete';
const editFormType = 'edit';
const formType = {
new: 'new',
delete: 'delete',
edit: 'edit',
};
export default {
i18n: {
[newFormType]: { title: __('Create new board'), btnText: __('Create board') },
[deleteFormType]: { title: __('Delete board'), btnText: __('Delete') },
[editFormType]: { title: __('Edit board'), btnText: __('Save changes') },
scopeModalTitle: __('Board scope'),
[formType.new]: { title: s__('Board|Create new board'), btnText: s__('Board|Create board') },
[formType.delete]: { title: s__('Board|Delete board'), btnText: __('Delete') },
[formType.edit]: { title: s__('Board|Edit board'), btnText: __('Save changes') },
scopeModalTitle: s__('Board|Board scope'),
cancelButtonText: __('Cancel'),
deleteErrorMessage: __('Failed to delete board. Please try again.'),
deleteErrorMessage: s__('Board|Failed to delete board. Please try again.'),
saveErrorMessage: __('Unable to save your changes. Please try again.'),
deleteConfirmationMessage: __('Are you sure you want to delete this board?'),
deleteConfirmationMessage: s__('Board|Are you sure you want to delete this board?'),
titleFieldLabel: __('Title'),
titleFieldPlaceholder: __('Enter board name'),
titleFieldPlaceholder: s__('Board|Enter board name'),
},
components: {
BoardScope: () => import('ee_component/boards/components/board_scope.vue'),
......@@ -90,13 +92,13 @@ export default {
},
computed: {
isNewForm() {
return this.currentPage === newFormType;
return this.currentPage === formType.new;
},
isDeleteForm() {
return this.currentPage === deleteFormType;
return this.currentPage === formType.delete;
},
isEditForm() {
return this.currentPage === editFormType;
return this.currentPage === formType.edit;
},
buttonText() {
return this.$options.i18n[this.currentPage].btnText;
......@@ -130,6 +132,7 @@ export default {
{
variant: this.buttonKind,
disabled: this.submitDisabled,
loading: this.isLoading,
'data-qa-selector': 'save_changes_button',
},
],
......@@ -155,6 +158,7 @@ export default {
boardsStore
.deleteBoard(this.currentBoard)
.then(() => {
this.isLoading = false;
visitUrl(boardsStore.rootPath);
})
.catch(() => {
......@@ -176,6 +180,7 @@ export default {
return resp.data ? resp.data : resp;
})
.then(data => {
this.isLoading = false;
visitUrl(data.board_path);
})
.catch(() => {
......
......@@ -3677,9 +3677,6 @@ msgstr ""
msgid "Are you sure you want to delete this SSH key?"
msgstr ""
msgid "Are you sure you want to delete this board?"
msgstr ""
msgid "Are you sure you want to delete this device? This action cannot be undone."
msgstr ""
......@@ -4480,9 +4477,6 @@ msgstr ""
msgid "Blog"
msgstr ""
msgid "Board scope"
msgstr ""
msgid "Board scope affects which issues are displayed for anyone who visits this board"
msgstr ""
......@@ -4537,6 +4531,30 @@ msgstr ""
msgid "Boards|View scope"
msgstr ""
msgid "Board|Are you sure you want to delete this board?"
msgstr ""
msgid "Board|Board scope"
msgstr ""
msgid "Board|Create board"
msgstr ""
msgid "Board|Create new board"
msgstr ""
msgid "Board|Delete board"
msgstr ""
msgid "Board|Edit board"
msgstr ""
msgid "Board|Enter board name"
msgstr ""
msgid "Board|Failed to delete board. Please try again."
msgstr ""
msgid "Board|Load more issues"
msgstr ""
......@@ -7937,9 +7955,6 @@ msgstr ""
msgid "Create and provide your GitHub %{link_start}Personal Access Token%{link_end}. You will need to select the %{code_open}repo%{code_close} scope, so we can display a list of your public and private repositories which are available to import."
msgstr ""
msgid "Create board"
msgstr ""
msgid "Create branch"
msgstr ""
......@@ -7997,9 +8012,6 @@ msgstr ""
msgid "Create new Value Stream"
msgstr ""
msgid "Create new board"
msgstr ""
msgid "Create new branch"
msgstr ""
......@@ -8920,9 +8932,6 @@ msgstr ""
msgid "Delete badge"
msgstr ""
msgid "Delete board"
msgstr ""
msgid "Delete comment"
msgstr ""
......@@ -10056,9 +10065,6 @@ msgstr ""
msgid "Edit application"
msgstr ""
msgid "Edit board"
msgstr ""
msgid "Edit comment"
msgstr ""
......@@ -10473,9 +10479,6 @@ msgstr ""
msgid "Enter at least three characters to search"
msgstr ""
msgid "Enter board name"
msgstr ""
msgid "Enter domain"
msgstr ""
......@@ -11484,9 +11487,6 @@ msgstr ""
msgid "Failed to create wiki"
msgstr ""
msgid "Failed to delete board. Please try again."
msgstr ""
msgid "Failed to deploy to"
msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment