@gitlab/duo-ui 14.0.0 → 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.
Files changed (17) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/components/chat/components/duo_chat_message_tool_approval/components/base_tool_params.js +167 -5
  3. package/dist/components/chat/components/duo_chat_message_tool_approval/components/create_commit_tool_params.js +12 -18
  4. package/dist/components/chat/components/duo_chat_message_tool_approval/components/default_tool_params.js +89 -0
  5. package/dist/components/chat/components/duo_chat_message_tool_approval/components/tool_params_json_view.js +63 -0
  6. package/dist/components/chat/components/duo_chat_message_tool_approval/message_tool_approval.js +8 -40
  7. package/dist/components/chat/mock_data.js +18 -2
  8. package/package.json +1 -1
  9. package/src/components/chat/components/duo_chat_message_tool_approval/components/base_tool_params.vue +138 -10
  10. package/src/components/chat/components/duo_chat_message_tool_approval/components/create_commit_tool_params.vue +14 -16
  11. package/src/components/chat/components/duo_chat_message_tool_approval/components/default_tool_params.vue +72 -0
  12. package/src/components/chat/components/duo_chat_message_tool_approval/components/tool_params_json_view.vue +42 -0
  13. package/src/components/chat/components/duo_chat_message_tool_approval/message_tool_approval.vue +7 -99
  14. package/src/components/chat/mock_data.js +18 -0
  15. package/translations.js +23 -40
  16. package/dist/components/chat/components/duo_chat_message_tool_approval/components/issuable_tool_params.js +0 -174
  17. package/src/components/chat/components/duo_chat_message_tool_approval/components/issuable_tool_params.vue +0 -193
package/translations.js CHANGED
@@ -35,14 +35,31 @@ export default {
35
35
  'AgenticToolRejectionModal.placeholder': "Explain why you're rejecting this tool execution...",
36
36
  'AgenticToolRejectionModal.submitText': 'Submit Rejection',
37
37
  'AgenticToolRejectionModal.title': 'Provide Rejection Reason',
38
- 'BaseToolParams.ACCORDION_TITLE': 'Read description',
38
+ 'BaseToolParams.ExpandDescriptionTitle': 'Read description',
39
+ 'BaseToolParams.ExpandJsonViewTitle': 'See request parameters as JSON',
40
+ 'BaseToolParams.confidentialLabel': 'Confidential',
41
+ 'BaseToolParams.dismissalReasonLabel': 'Dismissal reason',
42
+ 'BaseToolParams.dueDateLabel': 'Due date',
43
+ 'BaseToolParams.epicLabel': 'Epic',
44
+ 'BaseToolParams.groupLabel': 'Group',
45
+ 'BaseToolParams.healthStatusLabel': 'Health status',
46
+ 'BaseToolParams.issueLabel': 'Issue',
47
+ 'BaseToolParams.labelsLabel': 'Labels',
48
+ 'BaseToolParams.mergeRequestLabel': 'Merge request',
49
+ 'BaseToolParams.projectLabel': 'Project',
50
+ 'BaseToolParams.sourceBranchLabel': 'Source branch',
51
+ 'BaseToolParams.startDateLabel': 'Start date',
52
+ 'BaseToolParams.stateLabel': 'State',
53
+ 'BaseToolParams.targetBranchLabel': 'Target branch',
54
+ 'BaseToolParams.typeLabel': 'Type',
55
+ 'BaseToolParams.vulnerabilityLabel': 'Vulnerability',
56
+ 'BaseToolParams.workItemLabel': 'Work item',
39
57
  'CreateCommitToolParams.actionWithNoContent': 'This action does not have any content.',
40
58
  'CreateCommitToolParams.actionsCountMessage': null,
41
59
  'CreateCommitToolParams.chmodFileActionLabel': 'Change permissions for file %{filePath}',
42
60
  'CreateCommitToolParams.commitSummaryAutoBranchMessage':
43
- 'Create a commit in a new auto-created branch and project %{project}.',
44
- 'CreateCommitToolParams.commitSummaryMessage':
45
- 'Create a commit in the branch %{branch} and project %{project}.',
61
+ 'Create a commit in a new auto-created branch.',
62
+ 'CreateCommitToolParams.commitSummaryMessage': 'Create a commit in the branch %{branch}.',
46
63
  'CreateCommitToolParams.createFileActionLabel': 'Create file %{filePath}',
47
64
  'CreateCommitToolParams.deleteFileActionLabel': 'Delete file %{filePath}',
48
65
  'CreateCommitToolParams.expandFileChanges': 'Expand file changes',
@@ -119,31 +136,8 @@ export default {
119
136
  'DuoRecentCollapsable.viewAllText': 'View All',
120
137
  'GlDuoChat.chatDisclamer': 'Responses may be inaccurate. Verify before use.',
121
138
  'GlDuoChat.chatHistoryTitle': 'Chat history',
122
- 'IssuableToolParams.ASSIGN_LABELS_MESSAGE': 'Assign the labels <code>%{labels}</code>.',
123
- 'IssuableToolParams.BRANCH_MESSAGE':
124
- 'From branch <code>%{sourceBranch}</code> to branch <code>%{targetBranch}</code>.',
125
- 'IssuableToolParams.CONFIDENTIAL_MESSAGE': 'Set as confidential.',
126
- 'IssuableToolParams.CREATE_EPIC': 'Create an epic in group <code>%{groupId}</code>.',
127
- 'IssuableToolParams.CREATE_ISSUE': 'Open an issue in project <code>%{project}</code>.',
128
- 'IssuableToolParams.CREATE_MERGE_REQUEST':
129
- 'Open a merge request in project <code>%{project}</code>.',
130
- 'IssuableToolParams.CREATE_WORK_ITEM':
131
- 'Create a work item with type <em>"%{typeName}"</em> in %{workItemParentType} <code>%{workItemParentId}</code>.',
132
- 'IssuableToolParams.ISSUE_LABEL': 'issue',
133
- 'IssuableToolParams.MERGE_REQUEST_LABEL': 'merge request',
134
139
  'IssuableToolParams.NOTE_ACCORDION_TITLE': "Read note's content",
135
- 'IssuableToolParams.NOTE_MESSAGE':
136
- 'Post a note on %{noteParentLabel} <code>%{noteParentIid}</code>.',
137
140
  'IssuableToolParams.TITLE_MESSAGE': 'Set the title "<em>%{title}</em>".',
138
- 'IssuableToolParams.UPDATE_EPIC':
139
- 'Update epic <code>%{epicId}</code> in group <code>%{groupId}</code>.',
140
- 'IssuableToolParams.UPDATE_ISSUE':
141
- 'Update issue <code>%{issueIid}</code> in project <code>%{project}</code>.',
142
- 'IssuableToolParams.UPDATE_MERGE_REQUEST':
143
- 'Update merge request <code>%{mergeRequestIid}</code> in project <code>%{project}</code>.',
144
- 'IssuableToolParams.UPDATE_WORK_ITEM':
145
- 'Update work item <code>%{workItemIid}</code> in %{workItemParentType} <code>%{workItemParentId}</code>.',
146
- 'IssuableToolParams.WORK_ITEM_LABEL': 'work item',
147
141
  'MessageToolApproval.approveAllText': 'Always approve this tool',
148
142
  'MessageToolApproval.approveSessionText': 'Approve for session',
149
143
  'MessageToolApproval.approveText': 'Approve',
@@ -151,14 +145,6 @@ export default {
151
145
  'MessageToolApproval.cancelText': 'Cancel',
152
146
  'MessageToolApproval.collapseButtonCollapsed': 'Display tool details',
153
147
  'MessageToolApproval.collapseButtonExpanded': 'Hide tool details',
154
- 'MessageToolApproval.createCommit': 'Duo wants to push a commit.',
155
- 'MessageToolApproval.createEpic': 'Duo wants to create an epic.',
156
- 'MessageToolApproval.createIssue': 'Duo wants to open an issue.',
157
- 'MessageToolApproval.createIssueNote': 'Duo wants to post a note on an issue.',
158
- 'MessageToolApproval.createMergeRequest': 'Duo wants to create a merge request.',
159
- 'MessageToolApproval.createMergeRequestNote': 'Duo wants to post a note on a merge request.',
160
- 'MessageToolApproval.createWorkItem': 'Duo wants to create a work item.',
161
- 'MessageToolApproval.createWorkItemNote': 'Duo wants to post a note on a work item.',
162
148
  'MessageToolApproval.denialReasonLabel': 'Rejection reason',
163
149
  'MessageToolApproval.denialReasonPlaceholder':
164
150
  "Tell Duo why you're rejecting this tool execution...",
@@ -167,17 +153,13 @@ export default {
167
153
  'MessageToolApproval.multiToolTitle': 'Duo wants to execute %{count} tools.',
168
154
  'MessageToolApproval.noParametersText': 'No parameters will be sent with this request.',
169
155
  'MessageToolApproval.parametersText': 'Request parameters',
170
- 'MessageToolApproval.runCommand': 'Duo wants to run a command.',
171
- 'MessageToolApproval.runGitCommand': 'Duo wants to run a git command.',
172
156
  'MessageToolApproval.toolApprovalDescription':
173
157
  'GitLab Duo Agentic Chat wants to execute a tool. Do you want to proceed?',
174
158
  'MessageToolApproval.toolLabel': 'Tool:',
175
159
  'MessageToolApproval.toolStatusApproved': 'Approved',
176
160
  'MessageToolApproval.toolStatusPending': 'Pending',
177
161
  'MessageToolApproval.toolUnknown': 'Unknown',
178
- 'MessageToolApproval.updateEpic': 'Duo wants to update an epic.',
179
- 'MessageToolApproval.updateIssue': 'Duo wants to update an issue.',
180
- 'MessageToolApproval.updateWorkItem': 'Duo wants to update a work item.',
162
+ No: 'No',
181
163
  'RunCommandToolParams.ACCORDION_TITLE': 'Expand command output',
182
164
  'WebAgenticDuoChat.agenticChatEmptyStateGreeting': 'Hello, I’m %{agentName}!',
183
165
  'WebAgenticDuoChat.chatCancelLabel': 'Cancel',
@@ -223,4 +205,5 @@ export default {
223
205
  'WebDuoChat.copySessionIdTooltip': 'Copy Chat Session ID (%{id})',
224
206
  'WebDuoChat.overLimitCharacterCountMessage': null,
225
207
  'WebDuoChat.remainingCharacterCountMessage': null,
208
+ Yes: 'Yes',
226
209
  };
@@ -1,174 +0,0 @@
1
- import { translate, sprintf } from '../../../../../utils/i18n';
2
- import { APPROVAL_TOOL_NAMES } from '../../../constants';
3
- import BaseToolParams from './base_tool_params';
4
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
-
6
- const NOTE_MESSAGE = translate('IssuableToolParams.NOTE_MESSAGE', 'Post a note on %{noteParentLabel} <code>%{noteParentIid}</code>.');
7
- var script = {
8
- name: 'IssuableToolParams',
9
- components: {
10
- BaseToolParams
11
- },
12
- props: {
13
- toolName: {
14
- type: String,
15
- required: true,
16
- validator: toolName => Object.values(APPROVAL_TOOL_NAMES).includes(toolName)
17
- },
18
- toolParams: {
19
- type: Object,
20
- required: true
21
- }
22
- },
23
- computed: {
24
- project() {
25
- var _this$toolParams, _this$toolParams2;
26
- return ((_this$toolParams = this.toolParams) === null || _this$toolParams === void 0 ? void 0 : _this$toolParams.projectPath) || ((_this$toolParams2 = this.toolParams) === null || _this$toolParams2 === void 0 ? void 0 : _this$toolParams2.projectId);
27
- },
28
- title() {
29
- var _this$toolParams3;
30
- return (_this$toolParams3 = this.toolParams) === null || _this$toolParams3 === void 0 ? void 0 : _this$toolParams3.title;
31
- },
32
- labels() {
33
- var _this$toolParams4;
34
- return (_this$toolParams4 = this.toolParams) === null || _this$toolParams4 === void 0 ? void 0 : _this$toolParams4.labels;
35
- },
36
- description() {
37
- var _this$toolParams5, _this$toolParams6;
38
- return ((_this$toolParams5 = this.toolParams) === null || _this$toolParams5 === void 0 ? void 0 : _this$toolParams5.description) || ((_this$toolParams6 = this.toolParams) === null || _this$toolParams6 === void 0 ? void 0 : _this$toolParams6.body);
39
- },
40
- sourceBranch() {
41
- var _this$toolParams7;
42
- return (_this$toolParams7 = this.toolParams) === null || _this$toolParams7 === void 0 ? void 0 : _this$toolParams7.sourceBranch;
43
- },
44
- targetBranch() {
45
- var _this$toolParams8;
46
- return (_this$toolParams8 = this.toolParams) === null || _this$toolParams8 === void 0 ? void 0 : _this$toolParams8.targetBranch;
47
- },
48
- confidential() {
49
- var _this$toolParams9;
50
- return (_this$toolParams9 = this.toolParams) === null || _this$toolParams9 === void 0 ? void 0 : _this$toolParams9.confidential;
51
- },
52
- workItemParentType() {
53
- var _this$toolParams0, _this$toolParams1;
54
- if ((_this$toolParams0 = this.toolParams) !== null && _this$toolParams0 !== void 0 && _this$toolParams0.projectId) {
55
- return 'project';
56
- }
57
- if ((_this$toolParams1 = this.toolParams) !== null && _this$toolParams1 !== void 0 && _this$toolParams1.groupId) {
58
- return 'group';
59
- }
60
- return 'resource';
61
- },
62
- workItemParentId() {
63
- var _this$toolParams10, _this$toolParams11, _this$toolParams12;
64
- return ((_this$toolParams10 = this.toolParams) === null || _this$toolParams10 === void 0 ? void 0 : _this$toolParams10.url) || ((_this$toolParams11 = this.toolParams) === null || _this$toolParams11 === void 0 ? void 0 : _this$toolParams11.groupId) || ((_this$toolParams12 = this.toolParams) === null || _this$toolParams12 === void 0 ? void 0 : _this$toolParams12.projectId);
65
- },
66
- noteParentIid() {
67
- var _this$toolParams13, _this$toolParams14, _this$toolParams15, _this$toolParams16;
68
- return ((_this$toolParams13 = this.toolParams) === null || _this$toolParams13 === void 0 ? void 0 : _this$toolParams13.issueIid) || ((_this$toolParams14 = this.toolParams) === null || _this$toolParams14 === void 0 ? void 0 : _this$toolParams14.mergeRequestIid) || ((_this$toolParams15 = this.toolParams) === null || _this$toolParams15 === void 0 ? void 0 : _this$toolParams15.workItemIid) || ((_this$toolParams16 = this.toolParams) === null || _this$toolParams16 === void 0 ? void 0 : _this$toolParams16.url);
69
- },
70
- noteParentLabel() {
71
- switch (this.toolName) {
72
- case APPROVAL_TOOL_NAMES.createMergeRequestNote:
73
- return this.$options.i18n.MERGE_REQUEST_LABEL;
74
- case APPROVAL_TOOL_NAMES.createWorkItemNote:
75
- return this.$options.i18n.WORK_ITEM_LABEL;
76
- case APPROVAL_TOOL_NAMES.createIssueNote:
77
- return this.$options.i18n.ISSUE_LABEL;
78
- default:
79
- return '';
80
- }
81
- },
82
- isNote() {
83
- return [APPROVAL_TOOL_NAMES.createMergeRequestNote, APPROVAL_TOOL_NAMES.createWorkItemNote, APPROVAL_TOOL_NAMES.createIssueNote].includes(this.toolName);
84
- },
85
- message() {
86
- let message = this.$options.i18n[this.toolName] || '';
87
- const labelsMessage = this.$options.i18n.ASSIGN_LABELS_MESSAGE;
88
- const branchMessage = this.$options.i18n.BRANCH_MESSAGE;
89
- const confidentialMessage = this.$options.i18n.CONFIDENTIAL_MESSAGE;
90
- if (this.title) {
91
- message = `${message} ${this.$options.i18n.TITLE_MESSAGE}`;
92
- }
93
- if (this.sourceBranch && this.targetBranch) {
94
- message = `${message} ${branchMessage}`;
95
- }
96
- if (this.labels) {
97
- message = `${message} ${labelsMessage}`;
98
- }
99
- if (this.confidential) {
100
- message = `${message} ${confidentialMessage}`;
101
- }
102
- return sprintf(message, {
103
- project: this.project,
104
- workItemParentType: this.workItemParentType,
105
- workItemParentId: this.workItemParentId,
106
- noteParentLabel: this.noteParentLabel,
107
- noteParentIid: this.noteParentIid,
108
- ...this.toolParams
109
- });
110
- },
111
- accordionTitle() {
112
- return this.isNote ? this.$options.i18n.NOTE_ACCORDION_TITLE : '';
113
- }
114
- },
115
- i18n: {
116
- [APPROVAL_TOOL_NAMES.createIssue]: translate('IssuableToolParams.CREATE_ISSUE', 'Open an issue in project <code>%{project}</code>.'),
117
- [APPROVAL_TOOL_NAMES.updateIssue]: translate('IssuableToolParams.UPDATE_ISSUE', 'Update issue <code>%{issueIid}</code> in project <code>%{project}</code>.'),
118
- [APPROVAL_TOOL_NAMES.createEpic]: translate('IssuableToolParams.CREATE_EPIC', 'Create an epic in group <code>%{groupId}</code>.'),
119
- [APPROVAL_TOOL_NAMES.updateEpic]: translate('IssuableToolParams.UPDATE_EPIC', 'Update epic <code>%{epicId}</code> in group <code>%{groupId}</code>.'),
120
- [APPROVAL_TOOL_NAMES.createWorkItem]: translate('IssuableToolParams.CREATE_WORK_ITEM', 'Create a work item with type <em>"%{typeName}"</em> in %{workItemParentType} <code>%{workItemParentId}</code>.'),
121
- [APPROVAL_TOOL_NAMES.updateWorkItem]: translate('IssuableToolParams.UPDATE_WORK_ITEM', 'Update work item <code>%{workItemIid}</code> in %{workItemParentType} <code>%{workItemParentId}</code>.'),
122
- [APPROVAL_TOOL_NAMES.createMergeRequest]: translate('IssuableToolParams.CREATE_MERGE_REQUEST', 'Open a merge request in project <code>%{project}</code>.'),
123
- [APPROVAL_TOOL_NAMES.updateMergeRequest]: translate('IssuableToolParams.UPDATE_MERGE_REQUEST', 'Update merge request <code>%{mergeRequestIid}</code> in project <code>%{project}</code>.'),
124
- [APPROVAL_TOOL_NAMES.createMergeRequestNote]: NOTE_MESSAGE,
125
- [APPROVAL_TOOL_NAMES.createWorkItemNote]: NOTE_MESSAGE,
126
- [APPROVAL_TOOL_NAMES.createIssueNote]: NOTE_MESSAGE,
127
- TITLE_MESSAGE: translate('IssuableToolParams.TITLE_MESSAGE', 'Set the title "<em>%{title}</em>".'),
128
- BRANCH_MESSAGE: translate('IssuableToolParams.BRANCH_MESSAGE', 'From branch <code>%{sourceBranch}</code> to branch <code>%{targetBranch}</code>.'),
129
- ASSIGN_LABELS_MESSAGE: translate('IssuableToolParams.ASSIGN_LABELS_MESSAGE', 'Assign the labels <code>%{labels}</code>.'),
130
- CONFIDENTIAL_MESSAGE: translate('IssuableToolParams.CONFIDENTIAL_MESSAGE', 'Set as confidential.'),
131
- MERGE_REQUEST_LABEL: translate('IssuableToolParams.MERGE_REQUEST_LABEL', 'merge request'),
132
- ISSUE_LABEL: translate('IssuableToolParams.ISSUE_LABEL', 'issue'),
133
- WORK_ITEM_LABEL: translate('IssuableToolParams.WORK_ITEM_LABEL', 'work item'),
134
- NOTE_ACCORDION_TITLE: translate('IssuableToolParams.NOTE_ACCORDION_TITLE', "Read note's content")
135
- }
136
- };
137
-
138
- /* script */
139
- const __vue_script__ = script;
140
-
141
- /* template */
142
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('base-tool-params',{attrs:{"message":_vm.message,"description":_vm.description,"custom-accordion-title":_vm.accordionTitle}})};
143
- var __vue_staticRenderFns__ = [];
144
-
145
- /* style */
146
- const __vue_inject_styles__ = undefined;
147
- /* scoped */
148
- const __vue_scope_id__ = undefined;
149
- /* module identifier */
150
- const __vue_module_identifier__ = undefined;
151
- /* functional template */
152
- const __vue_is_functional_template__ = false;
153
- /* style inject */
154
-
155
- /* style inject SSR */
156
-
157
- /* style inject shadow dom */
158
-
159
-
160
-
161
- const __vue_component__ = __vue_normalize__(
162
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
163
- __vue_inject_styles__,
164
- __vue_script__,
165
- __vue_scope_id__,
166
- __vue_is_functional_template__,
167
- __vue_module_identifier__,
168
- false,
169
- undefined,
170
- undefined,
171
- undefined
172
- );
173
-
174
- export default __vue_component__;
@@ -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>