diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-23 18:14:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-23 18:14:44 +0300 |
commit | 12f988e7dcb038e82144fcd159b94839044c54cb (patch) | |
tree | 7790b8ba06d120205a40004dfb560d9ccba0ea93 /app/assets/javascripts/work_items | |
parent | b286069fdfe9a02beb2a26ce73511159a372002d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/work_items')
-rw-r--r-- | app/assets/javascripts/work_items/components/work_item_detail_modal.vue | 62 | ||||
-rw-r--r-- | app/assets/javascripts/work_items/pages/create_work_item.vue | 4 |
2 files changed, 64 insertions, 2 deletions
diff --git a/app/assets/javascripts/work_items/components/work_item_detail_modal.vue b/app/assets/javascripts/work_items/components/work_item_detail_modal.vue new file mode 100644 index 00000000000..39f4100970a --- /dev/null +++ b/app/assets/javascripts/work_items/components/work_item_detail_modal.vue @@ -0,0 +1,62 @@ +<script> +import { GlModal } from '@gitlab/ui'; +import { s__ } from '~/locale'; +import workItemQuery from '../graphql/work_item.query.graphql'; +import ItemTitle from './item_title.vue'; + +export default { + components: { + GlModal, + ItemTitle, + }, + props: { + visible: { + type: Boolean, + required: true, + }, + workItemId: { + type: String, + required: false, + default: null, + }, + }, + data() { + return { + workItem: {}, + }; + }, + apollo: { + workItem: { + query: workItemQuery, + variables() { + return { + id: this.workItemId, + }; + }, + update(data) { + return data.localWorkItem; + }, + error() { + this.$emit( + 'error', + s__('WorkItem|Something went wrong when fetching the work item. Please try again.'), + ); + }, + }, + }, + computed: { + workItemTitle() { + return this.workItem?.widgets?.nodes.find( + // eslint-disable-next-line no-underscore-dangle + (widget) => widget.__typename === 'LocalTitleWidget', + )?.contentText; + }, + }, +}; +</script> + +<template> + <gl-modal hide-footer modal-id="work-item-detail-modal" :visible="visible" @hide="$emit('close')"> + <item-title class="gl-m-0!" :initial-title="workItemTitle" /> + </gl-modal> +</template> diff --git a/app/assets/javascripts/work_items/pages/create_work_item.vue b/app/assets/javascripts/work_items/pages/create_work_item.vue index 6c3bcf8f6a8..3f982a1e84e 100644 --- a/app/assets/javascripts/work_items/pages/create_work_item.vue +++ b/app/assets/javascripts/work_items/pages/create_work_item.vue @@ -74,14 +74,14 @@ export default { const { data: { localCreateWorkItem: { - workItem: { id }, + workItem: { id, type }, }, }, } = response; if (!this.isModal) { this.$router.push({ name: 'workItem', params: { id } }); } else { - this.$emit('onCreate', this.title); + this.$emit('onCreate', { id, title: this.title, type }); } } catch { this.error = s__( |