diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /app/assets/javascripts/releases | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) | |
download | gitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'app/assets/javascripts/releases')
27 files changed, 103 insertions, 56 deletions
diff --git a/app/assets/javascripts/releases/components/app_edit_new.vue b/app/assets/javascripts/releases/components/app_edit_new.vue index a8c7b7c857a..aecd0d6371e 100644 --- a/app/assets/javascripts/releases/components/app_edit_new.vue +++ b/app/assets/javascripts/releases/components/app_edit_new.vue @@ -22,7 +22,7 @@ export default { TagField, }, computed: { - ...mapState('detail', [ + ...mapState('editNew', [ 'isFetchingRelease', 'isUpdatingRelease', 'fetchError', @@ -36,13 +36,13 @@ export default { 'groupId', 'groupMilestonesAvailable', ]), - ...mapGetters('detail', ['isValid', 'isExistingRelease']), + ...mapGetters('editNew', ['isValid', 'isExistingRelease']), showForm() { return Boolean(!this.isFetchingRelease && !this.fetchError && this.release); }, releaseTitle: { get() { - return this.$store.state.detail.release.name; + return this.$store.state.editNew.release.name; }, set(title) { this.updateReleaseTitle(title); @@ -50,7 +50,7 @@ export default { }, releaseNotes: { get() { - return this.$store.state.detail.release.description; + return this.$store.state.editNew.release.description; }, set(notes) { this.updateReleaseNotes(notes); @@ -58,7 +58,7 @@ export default { }, releaseMilestones: { get() { - return this.$store.state.detail.release.milestones; + return this.$store.state.editNew.release.milestones; }, set(milestones) { this.updateReleaseMilestones(milestones); @@ -93,7 +93,7 @@ export default { this.$el.querySelector('input:enabled, button:enabled').focus(); }, methods: { - ...mapActions('detail', [ + ...mapActions('editNew', [ 'initializeRelease', 'saveRelease', 'updateReleaseTitle', @@ -114,7 +114,7 @@ export default { <gl-sprintf :message=" __( - 'Releases are based on Git tags. We recommend tags that use semantic versioning, for example %{codeStart}v1.0%{codeEnd}, %{codeStart}v2.0-pre%{codeEnd}.', + 'Releases are based on Git tags. We recommend tags that use semantic versioning, for example %{codeStart}v1.0.0%{codeEnd}, %{codeStart}v2.1.0-pre%{codeEnd}.', ) " > diff --git a/app/assets/javascripts/releases/components/app_index.vue b/app/assets/javascripts/releases/components/app_index.vue index 32183e454c8..262b5614d65 100644 --- a/app/assets/javascripts/releases/components/app_index.vue +++ b/app/assets/javascripts/releases/components/app_index.vue @@ -20,7 +20,7 @@ export default { ReleasesSort, }, computed: { - ...mapState('list', [ + ...mapState('index', [ 'documentationPath', 'illustrationPath', 'newReleasePath', @@ -46,7 +46,7 @@ export default { window.addEventListener('popstate', this.fetchReleases); }, methods: { - ...mapActions('list', { + ...mapActions('index', { fetchReleasesStoreAction: 'fetchReleases', }), fetchReleases() { diff --git a/app/assets/javascripts/releases/components/app_show.vue b/app/assets/javascripts/releases/components/app_show.vue index 9ef38503c10..c38e93d420b 100644 --- a/app/assets/javascripts/releases/components/app_show.vue +++ b/app/assets/javascripts/releases/components/app_show.vue @@ -1,5 +1,8 @@ <script> -import { mapState, mapActions } from 'vuex'; +import createFlash from '~/flash'; +import { s__ } from '~/locale'; +import oneReleaseQuery from '../queries/one_release.query.graphql'; +import { convertGraphQLRelease } from '../util'; import ReleaseBlock from './release_block.vue'; import ReleaseSkeletonLoader from './release_skeleton_loader.vue'; @@ -9,21 +12,58 @@ export default { ReleaseBlock, ReleaseSkeletonLoader, }, - computed: { - ...mapState('detail', ['isFetchingRelease', 'fetchError', 'release']), + inject: { + fullPath: { + default: '', + }, + tagName: { + default: '', + }, }, - created() { - this.fetchRelease(); + apollo: { + release: { + query: oneReleaseQuery, + variables() { + return { + fullPath: this.fullPath, + tagName: this.tagName, + }; + }, + update(data) { + if (data.project?.release) { + return convertGraphQLRelease(data.project.release); + } + + return null; + }, + result(result) { + // Handle the case where the query succeeded but didn't return any data + if (!result.error && !this.release) { + this.showFlash( + new Error(`No release found in project "${this.fullPath}" with tag "${this.tagName}"`), + ); + } + }, + error(error) { + this.showFlash(error); + }, + }, }, methods: { - ...mapActions('detail', ['fetchRelease']), + showFlash(error) { + createFlash({ + message: s__('Release|Something went wrong while getting the release details.'), + captureError: true, + error, + }); + }, }, }; </script> <template> <div class="gl-mt-3"> - <release-skeleton-loader v-if="isFetchingRelease" /> + <release-skeleton-loader v-if="$apollo.queries.release.loading" /> - <release-block v-else-if="!fetchError" :release="release" /> + <release-block v-else-if="release" :release="release" /> </div> </template> diff --git a/app/assets/javascripts/releases/components/asset_links_form.vue b/app/assets/javascripts/releases/components/asset_links_form.vue index cfcb9f6978d..b9601428850 100644 --- a/app/assets/javascripts/releases/components/asset_links_form.vue +++ b/app/assets/javascripts/releases/components/asset_links_form.vue @@ -26,14 +26,14 @@ export default { }, directives: { GlTooltip: GlTooltipDirective }, computed: { - ...mapState('detail', ['release', 'releaseAssetsDocsPath']), - ...mapGetters('detail', ['validationErrors']), + ...mapState('editNew', ['release', 'releaseAssetsDocsPath']), + ...mapGetters('editNew', ['validationErrors']), }, created() { this.ensureAtLeastOneLink(); }, methods: { - ...mapActions('detail', [ + ...mapActions('editNew', [ 'addEmptyAssetLink', 'updateAssetLinkUrl', 'updateAssetLinkName', diff --git a/app/assets/javascripts/releases/components/release_block_header.vue b/app/assets/javascripts/releases/components/release_block_header.vue index 356fc0f3bf3..89bc314db89 100644 --- a/app/assets/javascripts/releases/components/release_block_header.vue +++ b/app/assets/javascripts/releases/components/release_block_header.vue @@ -1,9 +1,13 @@ <script> import { GlTooltipDirective, GlLink, GlBadge, GlButton, GlIcon } from '@gitlab/ui'; import { setUrlParams } from '~/lib/utils/url_utility'; +import { __ } from '~/locale'; import { BACK_URL_PARAM } from '~/releases/constants'; export default { + i18n: { + editButton: __('Edit this release'), + }, name: 'ReleaseBlockHeader', components: { GlLink, @@ -69,7 +73,8 @@ export default { variant="default" icon="pencil" class="gl-mr-3 js-edit-button ml-2 pb-2" - :title="__('Edit this release')" + :title="$options.i18n.editButton" + :aria-label="$options.i18n.editButton" :href="editLink" /> </div> diff --git a/app/assets/javascripts/releases/components/release_block_milestone_info.vue b/app/assets/javascripts/releases/components/release_block_milestone_info.vue index cf4a6e07af7..de10b210ecd 100644 --- a/app/assets/javascripts/releases/components/release_block_milestone_info.vue +++ b/app/assets/javascripts/releases/components/release_block_milestone_info.vue @@ -179,7 +179,7 @@ export default { /> <issuable-stats v-if="showMergeRequestStats" - :label="__('Merge Requests')" + :label="__('Merge requests')" :total="mergeRequestCounts.total" :merged="mergeRequestCounts.merged" :closed="mergeRequestCounts.closed" diff --git a/app/assets/javascripts/releases/components/releases_pagination_graphql.vue b/app/assets/javascripts/releases/components/releases_pagination_graphql.vue index 7d024c47fb9..13cbf95b9af 100644 --- a/app/assets/javascripts/releases/components/releases_pagination_graphql.vue +++ b/app/assets/javascripts/releases/components/releases_pagination_graphql.vue @@ -7,13 +7,13 @@ export default { name: 'ReleasesPaginationGraphql', components: { GlKeysetPagination }, computed: { - ...mapState('list', ['graphQlPageInfo']), + ...mapState('index', ['graphQlPageInfo']), showPagination() { return this.graphQlPageInfo.hasPreviousPage || this.graphQlPageInfo.hasNextPage; }, }, methods: { - ...mapActions('list', ['fetchReleases']), + ...mapActions('index', ['fetchReleases']), onPrev(before) { historyPushState(buildUrlWithCurrentLocation(`?before=${before}`)); this.fetchReleases({ before }); diff --git a/app/assets/javascripts/releases/components/releases_pagination_rest.vue b/app/assets/javascripts/releases/components/releases_pagination_rest.vue index 24abb0f4498..5e97a5a0450 100644 --- a/app/assets/javascripts/releases/components/releases_pagination_rest.vue +++ b/app/assets/javascripts/releases/components/releases_pagination_rest.vue @@ -7,10 +7,10 @@ export default { name: 'ReleasesPaginationRest', components: { TablePagination }, computed: { - ...mapState('list', ['restPageInfo']), + ...mapState('index', ['restPageInfo']), }, methods: { - ...mapActions('list', ['fetchReleases']), + ...mapActions('index', ['fetchReleases']), onChangePage(page) { historyPushState(buildUrlWithCurrentLocation(`?page=${page}`)); this.fetchReleases({ page }); diff --git a/app/assets/javascripts/releases/components/releases_sort.vue b/app/assets/javascripts/releases/components/releases_sort.vue index c8e6e0e4996..4988904a2cd 100644 --- a/app/assets/javascripts/releases/components/releases_sort.vue +++ b/app/assets/javascripts/releases/components/releases_sort.vue @@ -10,7 +10,7 @@ export default { GlSortingItem, }, computed: { - ...mapState('list', { + ...mapState('index', { orderBy: (state) => state.sorting.orderBy, sort: (state) => state.sorting.sort, }), @@ -26,7 +26,7 @@ export default { }, }, methods: { - ...mapActions('list', ['setSorting']), + ...mapActions('index', ['setSorting']), onDirectionChange() { const sort = this.isSortAscending ? DESCENDING_ORDER : ASCENDING_ODER; this.setSorting({ sort }); diff --git a/app/assets/javascripts/releases/components/tag_field.vue b/app/assets/javascripts/releases/components/tag_field.vue index ed8d6e62926..f4c0fd5e9ce 100644 --- a/app/assets/javascripts/releases/components/tag_field.vue +++ b/app/assets/javascripts/releases/components/tag_field.vue @@ -9,7 +9,7 @@ export default { TagFieldNew, }, computed: { - ...mapGetters('detail', ['isExistingRelease']), + ...mapGetters('editNew', ['isExistingRelease']), }, }; </script> diff --git a/app/assets/javascripts/releases/components/tag_field_existing.vue b/app/assets/javascripts/releases/components/tag_field_existing.vue index 3345bbecf6e..11945fbaf3d 100644 --- a/app/assets/javascripts/releases/components/tag_field_existing.vue +++ b/app/assets/javascripts/releases/components/tag_field_existing.vue @@ -8,7 +8,7 @@ export default { name: 'TagFieldExisting', components: { GlFormGroup, GlFormInput, FormFieldContainer }, computed: { - ...mapState('detail', ['release']), + ...mapState('editNew', ['release']), inputId() { return uniqueId('tag-name-input-'); }, diff --git a/app/assets/javascripts/releases/components/tag_field_new.vue b/app/assets/javascripts/releases/components/tag_field_new.vue index 21360a5c6cb..9df646ca798 100644 --- a/app/assets/javascripts/releases/components/tag_field_new.vue +++ b/app/assets/javascripts/releases/components/tag_field_new.vue @@ -27,8 +27,8 @@ export default { }; }, computed: { - ...mapState('detail', ['projectId', 'release', 'createFrom']), - ...mapGetters('detail', ['validationErrors']), + ...mapState('editNew', ['projectId', 'release', 'createFrom']), + ...mapGetters('editNew', ['validationErrors']), tagName: { get() { return this.release.tagName; @@ -62,7 +62,7 @@ export default { }, }, methods: { - ...mapActions('detail', ['updateReleaseTagName', 'updateCreateFrom']), + ...mapActions('editNew', ['updateReleaseTagName', 'updateCreateFrom']), markInputAsDirty() { this.isInputDirty = true; }, diff --git a/app/assets/javascripts/releases/mount_edit.js b/app/assets/javascripts/releases/mount_edit.js index 1232d55847b..fad0451ceef 100644 --- a/app/assets/javascripts/releases/mount_edit.js +++ b/app/assets/javascripts/releases/mount_edit.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import Vuex from 'vuex'; import ReleaseEditNewApp from './components/app_edit_new.vue'; import createStore from './stores'; -import createDetailModule from './stores/modules/detail'; +import createEditNewModule from './stores/modules/edit_new'; Vue.use(Vuex); @@ -11,7 +11,7 @@ export default () => { const store = createStore({ modules: { - detail: createDetailModule(el.dataset), + editNew: createEditNewModule(el.dataset), }, }); diff --git a/app/assets/javascripts/releases/mount_index.js b/app/assets/javascripts/releases/mount_index.js index a9538cbc9e5..0b453467c13 100644 --- a/app/assets/javascripts/releases/mount_index.js +++ b/app/assets/javascripts/releases/mount_index.js @@ -1,8 +1,8 @@ import Vue from 'vue'; import Vuex from 'vuex'; -import ReleaseListApp from './components/app_index.vue'; +import ReleaseIndexApp from './components/app_index.vue'; import createStore from './stores'; -import createListModule from './stores/modules/list'; +import createIndexModule from './stores/modules/index'; Vue.use(Vuex); @@ -13,7 +13,7 @@ export default () => { el, store: createStore({ modules: { - list: createListModule(el.dataset), + index: createIndexModule(el.dataset), }, featureFlags: { graphqlReleaseData: Boolean(gon.features?.graphqlReleaseData), @@ -21,6 +21,6 @@ export default () => { graphqlMilestoneStats: Boolean(gon.features?.graphqlMilestoneStats), }, }), - render: (h) => h(ReleaseListApp), + render: (h) => h(ReleaseIndexApp), }); }; diff --git a/app/assets/javascripts/releases/mount_new.js b/app/assets/javascripts/releases/mount_new.js index d85f4cf77d5..b358a27f06d 100644 --- a/app/assets/javascripts/releases/mount_new.js +++ b/app/assets/javascripts/releases/mount_new.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import Vuex from 'vuex'; import ReleaseEditNewApp from './components/app_edit_new.vue'; import createStore from './stores'; -import createDetailModule from './stores/modules/detail'; +import createEditNewModule from './stores/modules/edit_new'; Vue.use(Vuex); @@ -11,7 +11,7 @@ export default () => { const store = createStore({ modules: { - detail: createDetailModule(el.dataset), + editNew: createEditNewModule(el.dataset), }, }); diff --git a/app/assets/javascripts/releases/mount_show.js b/app/assets/javascripts/releases/mount_show.js index f3ed7d6c5ff..7272880197a 100644 --- a/app/assets/javascripts/releases/mount_show.js +++ b/app/assets/javascripts/releases/mount_show.js @@ -1,26 +1,28 @@ import Vue from 'vue'; -import Vuex from 'vuex'; +import VueApollo from 'vue-apollo'; +import createDefaultClient from '~/lib/graphql'; import ReleaseShowApp from './components/app_show.vue'; -import createStore from './stores'; -import createDetailModule from './stores/modules/detail'; -Vue.use(Vuex); +Vue.use(VueApollo); + +const apolloProvider = new VueApollo({ + defaultClient: createDefaultClient(), +}); export default () => { const el = document.getElementById('js-show-release-page'); - const store = createStore({ - modules: { - detail: createDetailModule(el.dataset), - }, - featureFlags: { - graphqlIndividualReleasePage: Boolean(gon.features?.graphqlIndividualReleasePage), - }, - }); + if (!el) return false; + + const { projectPath, tagName } = el.dataset; return new Vue({ el, - store, + apolloProvider, + provide: { + fullPath: projectPath, + tagName, + }, render: (h) => h(ReleaseShowApp), }); }; diff --git a/app/assets/javascripts/releases/stores/modules/detail/actions.js b/app/assets/javascripts/releases/stores/modules/edit_new/actions.js index 5fa002706c6..8dc2083dd2b 100644 --- a/app/assets/javascripts/releases/stores/modules/detail/actions.js +++ b/app/assets/javascripts/releases/stores/modules/edit_new/actions.js @@ -43,7 +43,7 @@ export const fetchRelease = ({ commit, state, rootState }) => { }) .catch((error) => { commit(types.RECEIVE_RELEASE_ERROR, error); - createFlash(s__('Release|Something went wrong while getting the release details')); + createFlash(s__('Release|Something went wrong while getting the release details.')); }); } @@ -54,7 +54,7 @@ export const fetchRelease = ({ commit, state, rootState }) => { }) .catch((error) => { commit(types.RECEIVE_RELEASE_ERROR, error); - createFlash(s__('Release|Something went wrong while getting the release details')); + createFlash(s__('Release|Something went wrong while getting the release details.')); }); }; diff --git a/app/assets/javascripts/releases/stores/modules/detail/getters.js b/app/assets/javascripts/releases/stores/modules/edit_new/getters.js index 831037c8861..831037c8861 100644 --- a/app/assets/javascripts/releases/stores/modules/detail/getters.js +++ b/app/assets/javascripts/releases/stores/modules/edit_new/getters.js diff --git a/app/assets/javascripts/releases/stores/modules/detail/index.js b/app/assets/javascripts/releases/stores/modules/edit_new/index.js index e1b7e69accc..e1b7e69accc 100644 --- a/app/assets/javascripts/releases/stores/modules/detail/index.js +++ b/app/assets/javascripts/releases/stores/modules/edit_new/index.js diff --git a/app/assets/javascripts/releases/stores/modules/detail/mutation_types.js b/app/assets/javascripts/releases/stores/modules/edit_new/mutation_types.js index 1b2f5f33f02..1b2f5f33f02 100644 --- a/app/assets/javascripts/releases/stores/modules/detail/mutation_types.js +++ b/app/assets/javascripts/releases/stores/modules/edit_new/mutation_types.js diff --git a/app/assets/javascripts/releases/stores/modules/detail/mutations.js b/app/assets/javascripts/releases/stores/modules/edit_new/mutations.js index cf282f9ab2c..cf282f9ab2c 100644 --- a/app/assets/javascripts/releases/stores/modules/detail/mutations.js +++ b/app/assets/javascripts/releases/stores/modules/edit_new/mutations.js diff --git a/app/assets/javascripts/releases/stores/modules/detail/state.js b/app/assets/javascripts/releases/stores/modules/edit_new/state.js index 315d07ac664..315d07ac664 100644 --- a/app/assets/javascripts/releases/stores/modules/detail/state.js +++ b/app/assets/javascripts/releases/stores/modules/edit_new/state.js diff --git a/app/assets/javascripts/releases/stores/modules/list/actions.js b/app/assets/javascripts/releases/stores/modules/index/actions.js index f1add54626a..f1add54626a 100644 --- a/app/assets/javascripts/releases/stores/modules/list/actions.js +++ b/app/assets/javascripts/releases/stores/modules/index/actions.js diff --git a/app/assets/javascripts/releases/stores/modules/list/index.js b/app/assets/javascripts/releases/stores/modules/index/index.js index d5ca191153a..d5ca191153a 100644 --- a/app/assets/javascripts/releases/stores/modules/list/index.js +++ b/app/assets/javascripts/releases/stores/modules/index/index.js diff --git a/app/assets/javascripts/releases/stores/modules/list/mutation_types.js b/app/assets/javascripts/releases/stores/modules/index/mutation_types.js index 669168efb88..669168efb88 100644 --- a/app/assets/javascripts/releases/stores/modules/list/mutation_types.js +++ b/app/assets/javascripts/releases/stores/modules/index/mutation_types.js diff --git a/app/assets/javascripts/releases/stores/modules/list/mutations.js b/app/assets/javascripts/releases/stores/modules/index/mutations.js index e1aaa2e2a19..e1aaa2e2a19 100644 --- a/app/assets/javascripts/releases/stores/modules/list/mutations.js +++ b/app/assets/javascripts/releases/stores/modules/index/mutations.js diff --git a/app/assets/javascripts/releases/stores/modules/list/state.js b/app/assets/javascripts/releases/stores/modules/index/state.js index 164a496d450..164a496d450 100644 --- a/app/assets/javascripts/releases/stores/modules/list/state.js +++ b/app/assets/javascripts/releases/stores/modules/index/state.js |