@gitlab/duo-ui 13.10.8 → 14.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/components/chat/components/duo_chat_header/web_duo_chat_header.js +3 -3
- package/dist/components/chat/components/duo_chat_message_tool_approval/components/base_tool_params.js +167 -5
- package/dist/components/chat/components/duo_chat_message_tool_approval/components/create_commit_tool_params.js +12 -18
- package/dist/components/chat/components/duo_chat_message_tool_approval/components/default_tool_params.js +89 -0
- package/dist/components/chat/components/duo_chat_message_tool_approval/components/tool_params_json_view.js +63 -0
- package/dist/components/chat/components/duo_chat_message_tool_approval/message_tool_approval.js +8 -40
- package/dist/components/chat/mock_data.js +18 -2
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/package.json +2 -2
- package/src/components/chat/components/duo_chat_header/web_duo_chat_header.vue +25 -24
- package/src/components/chat/components/duo_chat_message_tool_approval/components/base_tool_params.vue +138 -10
- package/src/components/chat/components/duo_chat_message_tool_approval/components/create_commit_tool_params.vue +14 -16
- package/src/components/chat/components/duo_chat_message_tool_approval/components/default_tool_params.vue +72 -0
- package/src/components/chat/components/duo_chat_message_tool_approval/components/tool_params_json_view.vue +42 -0
- package/src/components/chat/components/duo_chat_message_tool_approval/message_tool_approval.vue +7 -99
- package/src/components/chat/mock_data.js +18 -0
- package/translations.js +24 -41
- package/dist/components/chat/components/duo_chat_message_tool_approval/components/issuable_tool_params.js +0 -174
- package/src/components/chat/components/duo_chat_message_tool_approval/components/issuable_tool_params.vue +0 -193
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { sprintf, translate } from '../../../../../utils/i18n';
|
|
3
|
-
import { APPROVAL_TOOL_NAMES } from '../../../constants';
|
|
4
|
-
import BaseToolParams from './base_tool_params.vue';
|
|
5
|
-
|
|
6
|
-
const NOTE_MESSAGE = translate(
|
|
7
|
-
'IssuableToolParams.NOTE_MESSAGE',
|
|
8
|
-
'Post a note on %{noteParentLabel} <code>%{noteParentIid}</code>.'
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
name: 'IssuableToolParams',
|
|
13
|
-
components: {
|
|
14
|
-
BaseToolParams,
|
|
15
|
-
},
|
|
16
|
-
props: {
|
|
17
|
-
toolName: {
|
|
18
|
-
type: String,
|
|
19
|
-
required: true,
|
|
20
|
-
validator: (toolName) => Object.values(APPROVAL_TOOL_NAMES).includes(toolName),
|
|
21
|
-
},
|
|
22
|
-
toolParams: {
|
|
23
|
-
type: Object,
|
|
24
|
-
required: true,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
computed: {
|
|
28
|
-
project() {
|
|
29
|
-
return this.toolParams?.projectPath || this.toolParams?.projectId;
|
|
30
|
-
},
|
|
31
|
-
title() {
|
|
32
|
-
return this.toolParams?.title;
|
|
33
|
-
},
|
|
34
|
-
labels() {
|
|
35
|
-
return this.toolParams?.labels;
|
|
36
|
-
},
|
|
37
|
-
description() {
|
|
38
|
-
return this.toolParams?.description || this.toolParams?.body;
|
|
39
|
-
},
|
|
40
|
-
sourceBranch() {
|
|
41
|
-
return this.toolParams?.sourceBranch;
|
|
42
|
-
},
|
|
43
|
-
targetBranch() {
|
|
44
|
-
return this.toolParams?.targetBranch;
|
|
45
|
-
},
|
|
46
|
-
confidential() {
|
|
47
|
-
return this.toolParams?.confidential;
|
|
48
|
-
},
|
|
49
|
-
workItemParentType() {
|
|
50
|
-
if (this.toolParams?.projectId) {
|
|
51
|
-
return 'project';
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (this.toolParams?.groupId) {
|
|
55
|
-
return 'group';
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return 'resource';
|
|
59
|
-
},
|
|
60
|
-
workItemParentId() {
|
|
61
|
-
return this.toolParams?.url || this.toolParams?.groupId || this.toolParams?.projectId;
|
|
62
|
-
},
|
|
63
|
-
noteParentIid() {
|
|
64
|
-
return (
|
|
65
|
-
this.toolParams?.issueIid ||
|
|
66
|
-
this.toolParams?.mergeRequestIid ||
|
|
67
|
-
this.toolParams?.workItemIid ||
|
|
68
|
-
this.toolParams?.url
|
|
69
|
-
);
|
|
70
|
-
},
|
|
71
|
-
noteParentLabel() {
|
|
72
|
-
switch (this.toolName) {
|
|
73
|
-
case APPROVAL_TOOL_NAMES.createMergeRequestNote:
|
|
74
|
-
return this.$options.i18n.MERGE_REQUEST_LABEL;
|
|
75
|
-
case APPROVAL_TOOL_NAMES.createWorkItemNote:
|
|
76
|
-
return this.$options.i18n.WORK_ITEM_LABEL;
|
|
77
|
-
case APPROVAL_TOOL_NAMES.createIssueNote:
|
|
78
|
-
return this.$options.i18n.ISSUE_LABEL;
|
|
79
|
-
default:
|
|
80
|
-
return '';
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
isNote() {
|
|
84
|
-
return [
|
|
85
|
-
APPROVAL_TOOL_NAMES.createMergeRequestNote,
|
|
86
|
-
APPROVAL_TOOL_NAMES.createWorkItemNote,
|
|
87
|
-
APPROVAL_TOOL_NAMES.createIssueNote,
|
|
88
|
-
].includes(this.toolName);
|
|
89
|
-
},
|
|
90
|
-
message() {
|
|
91
|
-
let message = this.$options.i18n[this.toolName] || '';
|
|
92
|
-
const labelsMessage = this.$options.i18n.ASSIGN_LABELS_MESSAGE;
|
|
93
|
-
const branchMessage = this.$options.i18n.BRANCH_MESSAGE;
|
|
94
|
-
const confidentialMessage = this.$options.i18n.CONFIDENTIAL_MESSAGE;
|
|
95
|
-
|
|
96
|
-
if (this.title) {
|
|
97
|
-
message = `${message} ${this.$options.i18n.TITLE_MESSAGE}`;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (this.sourceBranch && this.targetBranch) {
|
|
101
|
-
message = `${message} ${branchMessage}`;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (this.labels) {
|
|
105
|
-
message = `${message} ${labelsMessage}`;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (this.confidential) {
|
|
109
|
-
message = `${message} ${confidentialMessage}`;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return sprintf(message, {
|
|
113
|
-
project: this.project,
|
|
114
|
-
workItemParentType: this.workItemParentType,
|
|
115
|
-
workItemParentId: this.workItemParentId,
|
|
116
|
-
noteParentLabel: this.noteParentLabel,
|
|
117
|
-
noteParentIid: this.noteParentIid,
|
|
118
|
-
...this.toolParams,
|
|
119
|
-
});
|
|
120
|
-
},
|
|
121
|
-
accordionTitle() {
|
|
122
|
-
return this.isNote ? this.$options.i18n.NOTE_ACCORDION_TITLE : '';
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
i18n: {
|
|
126
|
-
[APPROVAL_TOOL_NAMES.createIssue]: translate(
|
|
127
|
-
'IssuableToolParams.CREATE_ISSUE',
|
|
128
|
-
'Open an issue in project <code>%{project}</code>.'
|
|
129
|
-
),
|
|
130
|
-
[APPROVAL_TOOL_NAMES.updateIssue]: translate(
|
|
131
|
-
'IssuableToolParams.UPDATE_ISSUE',
|
|
132
|
-
'Update issue <code>%{issueIid}</code> in project <code>%{project}</code>.'
|
|
133
|
-
),
|
|
134
|
-
[APPROVAL_TOOL_NAMES.createEpic]: translate(
|
|
135
|
-
'IssuableToolParams.CREATE_EPIC',
|
|
136
|
-
'Create an epic in group <code>%{groupId}</code>.'
|
|
137
|
-
),
|
|
138
|
-
[APPROVAL_TOOL_NAMES.updateEpic]: translate(
|
|
139
|
-
'IssuableToolParams.UPDATE_EPIC',
|
|
140
|
-
'Update epic <code>%{epicId}</code> in group <code>%{groupId}</code>.'
|
|
141
|
-
),
|
|
142
|
-
[APPROVAL_TOOL_NAMES.createWorkItem]: translate(
|
|
143
|
-
'IssuableToolParams.CREATE_WORK_ITEM',
|
|
144
|
-
'Create a work item with type <em>"%{typeName}"</em> in %{workItemParentType} <code>%{workItemParentId}</code>.'
|
|
145
|
-
),
|
|
146
|
-
[APPROVAL_TOOL_NAMES.updateWorkItem]: translate(
|
|
147
|
-
'IssuableToolParams.UPDATE_WORK_ITEM',
|
|
148
|
-
'Update work item <code>%{workItemIid}</code> in %{workItemParentType} <code>%{workItemParentId}</code>.'
|
|
149
|
-
),
|
|
150
|
-
[APPROVAL_TOOL_NAMES.createMergeRequest]: translate(
|
|
151
|
-
'IssuableToolParams.CREATE_MERGE_REQUEST',
|
|
152
|
-
'Open a merge request in project <code>%{project}</code>.'
|
|
153
|
-
),
|
|
154
|
-
[APPROVAL_TOOL_NAMES.updateMergeRequest]: translate(
|
|
155
|
-
'IssuableToolParams.UPDATE_MERGE_REQUEST',
|
|
156
|
-
'Update merge request <code>%{mergeRequestIid}</code> in project <code>%{project}</code>.'
|
|
157
|
-
),
|
|
158
|
-
[APPROVAL_TOOL_NAMES.createMergeRequestNote]: NOTE_MESSAGE,
|
|
159
|
-
[APPROVAL_TOOL_NAMES.createWorkItemNote]: NOTE_MESSAGE,
|
|
160
|
-
[APPROVAL_TOOL_NAMES.createIssueNote]: NOTE_MESSAGE,
|
|
161
|
-
TITLE_MESSAGE: translate(
|
|
162
|
-
'IssuableToolParams.TITLE_MESSAGE',
|
|
163
|
-
'Set the title "<em>%{title}</em>".'
|
|
164
|
-
),
|
|
165
|
-
BRANCH_MESSAGE: translate(
|
|
166
|
-
'IssuableToolParams.BRANCH_MESSAGE',
|
|
167
|
-
'From branch <code>%{sourceBranch}</code> to branch <code>%{targetBranch}</code>.'
|
|
168
|
-
),
|
|
169
|
-
ASSIGN_LABELS_MESSAGE: translate(
|
|
170
|
-
'IssuableToolParams.ASSIGN_LABELS_MESSAGE',
|
|
171
|
-
'Assign the labels <code>%{labels}</code>.'
|
|
172
|
-
),
|
|
173
|
-
CONFIDENTIAL_MESSAGE: translate(
|
|
174
|
-
'IssuableToolParams.CONFIDENTIAL_MESSAGE',
|
|
175
|
-
'Set as confidential.'
|
|
176
|
-
),
|
|
177
|
-
MERGE_REQUEST_LABEL: translate('IssuableToolParams.MERGE_REQUEST_LABEL', 'merge request'),
|
|
178
|
-
ISSUE_LABEL: translate('IssuableToolParams.ISSUE_LABEL', 'issue'),
|
|
179
|
-
WORK_ITEM_LABEL: translate('IssuableToolParams.WORK_ITEM_LABEL', 'work item'),
|
|
180
|
-
NOTE_ACCORDION_TITLE: translate(
|
|
181
|
-
'IssuableToolParams.NOTE_ACCORDION_TITLE',
|
|
182
|
-
"Read note's content"
|
|
183
|
-
),
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
</script>
|
|
187
|
-
<template>
|
|
188
|
-
<base-tool-params
|
|
189
|
-
:message="message"
|
|
190
|
-
:description="description"
|
|
191
|
-
:custom-accordion-title="accordionTitle"
|
|
192
|
-
/>
|
|
193
|
-
</template>
|