diff options
Diffstat (limited to 'app/assets/javascripts/releases')
8 files changed, 58 insertions, 38 deletions
diff --git a/app/assets/javascripts/releases/components/app_edit_new.vue b/app/assets/javascripts/releases/components/app_edit_new.vue index 965b9fa09d6..ff92cdd42c6 100644 --- a/app/assets/javascripts/releases/components/app_edit_new.vue +++ b/app/assets/javascripts/releases/components/app_edit_new.vue @@ -13,6 +13,7 @@ import { isSameOriginUrl, getParameterByName } from '~/lib/utils/url_utility'; import { __ } from '~/locale'; import MilestoneCombobox from '~/milestones/components/milestone_combobox.vue'; import { BACK_URL_PARAM } from '~/releases/constants'; +import { putCreateReleaseNotification } from '~/releases/release_notification_service'; import MarkdownField from '~/vue_shared/components/markdown/field.vue'; import AssetLinksForm from './asset_links_form.vue'; import ConfirmDeleteModal from './confirm_delete_modal.vue'; @@ -49,6 +50,7 @@ export default { 'newMilestonePath', 'manageMilestonesPath', 'projectId', + 'projectPath', 'groupId', 'groupMilestonesAvailable', 'tagNotes', @@ -150,6 +152,7 @@ export default { submitForm() { if (!this.isFormSubmissionDisabled) { this.saveRelease(); + putCreateReleaseNotification(this.projectPath, this.release.name); } }, }, @@ -161,7 +164,7 @@ export default { <gl-sprintf :message=" __( - '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}.', + 'Releases are based on Git tags. We recommend tags that use semantic versioning, for example %{codeStart}1.0.0%{codeEnd}, %{codeStart}2.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 1b360b79b0c..9f200856db3 100644 --- a/app/assets/javascripts/releases/components/app_index.vue +++ b/app/assets/javascripts/releases/components/app_index.vue @@ -244,21 +244,19 @@ export default { </script> <template> <div class="gl-display-flex gl-flex-direction-column gl-mt-3"> - <div class="gl-align-self-end gl-mb-3"> + <releases-empty-state v-if="shouldRenderEmptyState" /> + <div v-else class="gl-align-self-end gl-mb-3"> <releases-sort :value="sort" class="gl-mr-2" @input="onSortChanged" /> <gl-button v-if="newReleasePath" :href="newReleasePath" - :aria-describedby="shouldRenderEmptyState && 'releases-description'" category="primary" variant="confirm" >{{ $options.i18n.newRelease }}</gl-button > </div> - <releases-empty-state v-if="shouldRenderEmptyState" /> - <release-block v-for="(release, index) in releases" :key="getReleaseKey(release, index)" diff --git a/app/assets/javascripts/releases/components/app_show.vue b/app/assets/javascripts/releases/components/app_show.vue index 7147cfa01c8..544f2de5132 100644 --- a/app/assets/javascripts/releases/components/app_show.vue +++ b/app/assets/javascripts/releases/components/app_show.vue @@ -1,6 +1,7 @@ <script> import { createAlert } from '~/flash'; import { s__ } from '~/locale'; +import { popCreateReleaseNotification } from '~/releases/release_notification_service'; import oneReleaseQuery from '../graphql/queries/one_release.query.graphql'; import { convertGraphQLRelease } from '../util'; import ReleaseBlock from './release_block.vue'; @@ -49,6 +50,9 @@ export default { }, }, }, + mounted() { + popCreateReleaseNotification(this.fullPath); + }, methods: { showFlash(error) { createAlert({ diff --git a/app/assets/javascripts/releases/components/evidence_block.vue b/app/assets/javascripts/releases/components/evidence_block.vue index 6d415471b14..2118c26fd81 100644 --- a/app/assets/javascripts/releases/components/evidence_block.vue +++ b/app/assets/javascripts/releases/components/evidence_block.vue @@ -67,12 +67,13 @@ export default { <gl-link v-gl-tooltip class="d-flex align-items-center monospace" - :title="__('Download evidence JSON')" - :download="evidenceTitle(index)" + target="_blank" + :title="__('Open evidence JSON in new tab')" :href="evidenceUrl(index)" > <gl-icon name="review-list" class="align-middle gl-mr-3" /> <span>{{ evidenceTitle(index) }}</span> + <gl-icon name="external-link" class="gl-ml-2 gl-flex-shrink-0 gl-flex-grow-0" /> </gl-link> <expand-button> diff --git a/app/assets/javascripts/releases/components/release_block_assets.vue b/app/assets/javascripts/releases/components/release_block_assets.vue index 1761f4360d1..cc28980a6bf 100644 --- a/app/assets/javascripts/releases/components/release_block_assets.vue +++ b/app/assets/javascripts/releases/components/release_block_assets.vue @@ -121,7 +121,7 @@ export default { <gl-icon :name="section.iconName" class="gl-mr-2 gl-flex-shrink-0 gl-flex-grow-0" /> {{ link.name }} <gl-icon - v-if="link.external" + v-if="section.title" v-gl-tooltip name="external-link" :aria-label="$options.externalLinkTooltipText" diff --git a/app/assets/javascripts/releases/components/releases_empty_state.vue b/app/assets/javascripts/releases/components/releases_empty_state.vue index 800497c186a..ae94bd6872e 100644 --- a/app/assets/javascripts/releases/components/releases_empty_state.vue +++ b/app/assets/javascripts/releases/components/releases_empty_state.vue @@ -1,44 +1,33 @@ <script> -import { GlEmptyState, GlLink } from '@gitlab/ui'; -import { __ } from '~/locale'; +import { GlEmptyState } from '@gitlab/ui'; +import { s__ } from '~/locale'; export default { name: 'ReleasesEmptyState', components: { GlEmptyState, - GlLink, - }, - inject: { - documentationPath: { - default: '', - }, - illustrationPath: { - default: '', - }, }, + inject: ['documentationPath', 'illustrationPath', 'newReleasePath'], i18n: { - emptyStateTitle: __('Getting started with releases'), - emptyStateText: __( - "Releases are based on Git tags and mark specific points in a project's development history. They can contain information about the type of changes and can also deliver binaries, like compiled versions of your software.", + emptyStateTitle: s__('Release|Getting started with releases'), + emptyStateText: s__( + "Release|Releases are based on Git tags and mark specific points in a project's development history. They can contain information about the type of changes and can also deliver binaries, like compiled versions of your software.", ), - releasesDocumentation: __('Releases documentation'), - moreInformation: __('More information'), + releasesDocumentation: s__('Release|Learn more about releases'), + moreInformation: s__('Release|More information'), + newRelease: s__('Release|Create a new release'), }, }; </script> <template> - <gl-empty-state :title="$options.i18n.emptyStateTitle" :svg-path="illustrationPath"> - <template #description> - <span id="releases-description"> - {{ $options.i18n.emptyStateText }} - <gl-link - :href="documentationPath" - :aria-label="$options.i18n.releasesDocumentation" - target="_blank" - > - {{ $options.i18n.moreInformation }} - </gl-link> - </span> - </template> - </gl-empty-state> + <gl-empty-state + class="gl-layout-w-limited" + :title="$options.i18n.emptyStateTitle" + :description="$options.i18n.emptyStateText" + :svg-path="illustrationPath" + :primary-button-link="newReleasePath" + :primary-button-text="$options.i18n.newRelease" + :secondary-button-link="documentationPath" + :secondary-button-text="$options.i18n.releasesDocumentation" + /> </template> diff --git a/app/assets/javascripts/releases/release_notification_service.js b/app/assets/javascripts/releases/release_notification_service.js new file mode 100644 index 00000000000..a4f926d7561 --- /dev/null +++ b/app/assets/javascripts/releases/release_notification_service.js @@ -0,0 +1,23 @@ +import { s__, sprintf } from '~/locale'; +import { createAlert, VARIANT_SUCCESS } from '~/flash'; + +const createReleaseSessionKey = (projectPath) => `createRelease:${projectPath}`; + +export const putCreateReleaseNotification = (projectPath, releaseName) => { + window.sessionStorage.setItem(createReleaseSessionKey(projectPath), releaseName); +}; + +export const popCreateReleaseNotification = (projectPath) => { + const key = createReleaseSessionKey(projectPath); + const createdRelease = window.sessionStorage.getItem(key); + + if (createdRelease) { + createAlert({ + message: sprintf(s__('Release|Release %{createdRelease} has been successfully created.'), { + createdRelease, + }), + variant: VARIANT_SUCCESS, + }); + window.sessionStorage.removeItem(key); + } +}; diff --git a/app/assets/javascripts/releases/stores/modules/edit_new/mutations.js b/app/assets/javascripts/releases/stores/modules/edit_new/mutations.js index f80e75501c9..ccd168aafc9 100644 --- a/app/assets/javascripts/releases/stores/modules/edit_new/mutations.js +++ b/app/assets/javascripts/releases/stores/modules/edit_new/mutations.js @@ -40,6 +40,7 @@ export default { [types.UPDATE_RELEASE_TAG_NAME](state, tagName) { state.release.tagName = tagName; + state.existingRelease = null; }, [types.UPDATE_RELEASE_TAG_MESSAGE](state, tagMessage) { state.release.tagMessage = tagMessage; @@ -118,6 +119,7 @@ export default { state.fetchError = error; state.isFetchingTagNotes = false; state.tagNotes = ''; + state.existingRelease = null; }, [types.UPDATE_INCLUDE_TAG_NOTES](state, includeTagNotes) { state.includeTagNotes = includeTagNotes; |