feat: Add title while linking the linear issue (#9529)

This commit is contained in:
Muhsin Keloth
2024-05-23 13:32:41 +05:30
committed by GitHub
parent 0c4c561313
commit f83af33b87
6 changed files with 39 additions and 12 deletions

View File

@@ -19,10 +19,11 @@ class LinearAPI extends ApiClient {
return axios.post(`${this.url}/create_issue`, data);
}
link_issue(conversationId, issueId) {
link_issue(conversationId, issueId, title) {
return axios.post(`${this.url}/link_issue`, {
issue_id: issueId,
conversation_id: conversationId,
title: title,
});
}

View File

@@ -117,6 +117,10 @@ const props = defineProps({
type: [Number, String],
required: true,
},
title: {
type: String,
default: null,
},
});
const emit = defineEmits(['close']);
@@ -218,7 +222,7 @@ const createIssue = async () => {
isCreating.value = true;
const response = await LinearAPI.createIssue(payload);
const { id: issueId } = response.data;
await LinearAPI.link_issue(props.conversationId, issueId);
await LinearAPI.link_issue(props.conversationId, issueId, props.title);
useAlert(t('INTEGRATION_SETTINGS.LINEAR.ADD_OR_LINK.CREATE_SUCCESS'));
onClose();
} catch (error) {

View File

@@ -25,30 +25,35 @@
<div v-if="selectedTabIndex === 0" class="flex flex-col px-8 pb-4">
<create-issue
:account-id="accountId"
:conversation-id="conversationId"
:conversation-id="conversation.id"
:title="title"
@close="onClose"
/>
</div>
<div v-else class="flex flex-col px-8 pb-4">
<link-issue :conversation-id="conversationId" @close="onClose" />
<link-issue
:conversation-id="conversation.id"
:title="title"
@close="onClose"
/>
</div>
</div>
</div>
</template>
<script setup>
import { useI18n } from 'dashboard/composables/useI18n';
import { ref } from 'vue';
import { computed, ref } from 'vue';
import LinkIssue from './LinkIssue.vue';
import CreateIssue from './CreateIssue.vue';
defineProps({
const props = defineProps({
accountId: {
type: [Number, String],
required: true,
},
conversationId: {
type: [Number, String],
conversation: {
type: Object,
required: true,
},
});
@@ -57,6 +62,14 @@ const { t } = useI18n();
const selectedTabIndex = ref(0);
const title = computed(() => {
const { meta: { sender: { name = null } = {} } = {} } = props.conversation;
return t('INTEGRATION_SETTINGS.LINEAR.LINK.LINK_TITLE', {
conversationId: props.conversation.id,
name,
});
});
const emits = defineEmits(['close']);
const tabs = ref([

View File

@@ -56,6 +56,10 @@ const props = defineProps({
type: [Number, String],
required: true,
},
title: {
type: String,
default: null,
},
});
const emits = defineEmits(['close']);
@@ -113,7 +117,7 @@ const linkIssue = async () => {
const { id: issueId } = selectedOption.value;
try {
isLinking.value = true;
await LinearAPI.link_issue(props.conversationId, issueId);
await LinearAPI.link_issue(props.conversationId, issueId, props.title);
useAlert(t('INTEGRATION_SETTINGS.LINEAR.LINK.LINK_SUCCESS'));
searchQuery.value = '';
issues.value = [];

View File

@@ -30,7 +30,7 @@
class="!items-start [&>div]:!top-12"
>
<create-or-link-issue
:conversation-id="conversationId"
:conversation="conversation"
:account-id="currentAccountId"
@close="closePopup"
/>
@@ -63,6 +63,10 @@ const shouldShowPopup = ref(false);
const currentAccountId = getters.getCurrentAccountId;
const conversation = computed(() =>
getters.getConversationById.value(props.conversationId)
);
const tooltipText = computed(() => {
return linkedIssue.value === null
? t('INTEGRATION_SETTINGS.LINEAR.ADD_OR_LINK_BUTTON')
@@ -86,7 +90,7 @@ const unlinkIssue = async linkId => {
linkedIssue.value = null;
useAlert(t('INTEGRATION_SETTINGS.LINEAR.UNLINK.SUCCESS'));
} catch (error) {
useAlert(t('INTEGRATION_SETTINGS.LINEAR.UNLINK.DELETE_ERROR'));
useAlert(t('INTEGRATION_SETTINGS.LINEAR.UNLINK.ERROR'));
}
};

View File

@@ -217,7 +217,8 @@
"LOADING": "Loading",
"ERROR": "There was an error fetching the linear issues, please try again",
"LINK_SUCCESS": "Issue linked successfully",
"LINK_ERROR": "There was an error linking the issue, please try again"
"LINK_ERROR": "There was an error linking the issue, please try again",
"LINK_TITLE": "#%{conversationId}: %{name}"
},
"ADD_OR_LINK": {
"TITLE": "Create/link linear issue",