@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
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
# [14.1.0](https://gitlab.com/gitlab-org/duo-ui/compare/v14.0.0...v14.1.0) (2025-11-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Do not display commit message accordion when no message is present ([bb35d4d](https://gitlab.com/gitlab-org/duo-ui/commit/bb35d4deb4ca541d9df974bb860c5f5211ccab2f))
|
|
7
|
+
* Fix collapse chevron alignment ([3e3603c](https://gitlab.com/gitlab-org/duo-ui/commit/3e3603c2f7647333397aeb9ea373faeace9ea9d1))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* Improve tool approval params visualization ([0893a90](https://gitlab.com/gitlab-org/duo-ui/commit/0893a9047ba7999d271559fc88eb2193ce15fc71))
|
|
13
|
+
|
|
14
|
+
# [14.0.0](https://gitlab.com/gitlab-org/duo-ui/compare/v13.10.8...v14.0.0) (2025-11-18)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **DuoChat:** Move session ID menu to top bar ([4ec2077](https://gitlab.com/gitlab-org/duo-ui/commit/4ec207736c526534031b450302a06628d3b34b9d))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### BREAKING CHANGES
|
|
23
|
+
|
|
24
|
+
* **DuoChat:** The session ID dropdown menu has been
|
|
25
|
+
moved from the main header section to the top
|
|
26
|
+
header bar in drawer view.
|
|
27
|
+
|
|
1
28
|
## [13.10.8](https://gitlab.com/gitlab-org/duo-ui/compare/v13.10.7...v13.10.8) (2025-11-14)
|
|
2
29
|
|
|
3
30
|
|
|
@@ -12,7 +12,7 @@ const i18n = {
|
|
|
12
12
|
CHAT_BACK_TO_CHAT_TOOLTIP: translate('WebDuoChat.chatBackToChatToolTip', 'Back to chat'),
|
|
13
13
|
CHAT_TITLE: translate('WebDuoChat.chatTitle', 'GitLab Duo Chat'),
|
|
14
14
|
CHAT_DROPDOWN_MORE_OPTIONS: translate('WebDuoChat.chatDropdownMoreOptions', 'More options'),
|
|
15
|
-
CHAT_COPY_TOOLTIP: translate('WebDuoChat.copySessionIdTooltip', 'Copy
|
|
15
|
+
CHAT_COPY_TOOLTIP: translate('WebDuoChat.copySessionIdTooltip', 'Copy Chat Session ID (%{id})'),
|
|
16
16
|
CHAT_COPY_SUCCESS_TOAST: translate('WebDuoChat.copySessionIdSuccessToast', 'Session ID copied to clipboard'),
|
|
17
17
|
CHAT_COPY_FAILED_TOAST: translate('WebDuoChat.copySessionIdFailedToast', 'Could not copy session ID')
|
|
18
18
|
};
|
|
@@ -158,11 +158,11 @@ var script = {
|
|
|
158
158
|
const __vue_script__ = script;
|
|
159
159
|
|
|
160
160
|
/* template */
|
|
161
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('header',{staticClass:"gl-border-b gl-shrink-0 gl-p-0",attrs:{"data-testid":"chat-header"}},[(!_vm.showStudioHeader)?_c('div',{staticClass:"gl-flex gl-w-full gl-items-center gl-px-4 gl-py-3",attrs:{"data-testid":"chat-top-header"}},[(_vm.subtitle)?_c('h4',{staticClass:"gl-mb-0 gl-max-w-17/20 gl-flex-1 gl-shrink-0 gl-overflow-hidden gl-truncate gl-text-ellipsis gl-whitespace-nowrap gl-pr-3 gl-text-sm gl-font-normal gl-text-subtle",attrs:{"data-testid":"chat-subtitle"}},[_vm._v("\n "+_vm._s(_vm.subtitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('
|
|
161
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('header',{staticClass:"gl-border-b gl-shrink-0 gl-p-0",attrs:{"data-testid":"chat-header"}},[(!_vm.showStudioHeader)?_c('div',{staticClass:"gl-flex gl-w-full gl-items-center gl-px-4 gl-py-3",attrs:{"data-testid":"chat-top-header"}},[(_vm.subtitle)?_c('h4',{staticClass:"gl-mb-0 gl-max-w-17/20 gl-flex-1 gl-shrink-0 gl-overflow-hidden gl-truncate gl-text-ellipsis gl-whitespace-nowrap gl-pr-3 gl-text-sm gl-font-normal gl-text-subtle",attrs:{"data-testid":"chat-subtitle"}},[_vm._v("\n "+_vm._s(_vm.subtitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-ml-auto gl-flex gl-gap-3"},[(_vm.sessionId)?_c('gl-disclosure-dropdown',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip",value:(_vm.showSessionDropdownTooltip),expression:"showSessionDropdownTooltip"}],attrs:{"icon":"ellipsis_v","category":"tertiary","text-sr-only":"","size":"small","toggle-text":_vm.$options.i18n.CHAT_DROPDOWN_MORE_OPTIONS,"items":_vm.sessionIdItems,"no-caret":""},on:{"shown":_vm.showSessionDropdown,"hidden":_vm.hideSessionDropdown}}):_vm._e(),_vm._v(" "),_c('gl-button',{attrs:{"category":"tertiary","variant":"default","icon":"close","size":"small","data-testid":"chat-close-button","aria-label":_vm.$options.i18n.CHAT_CLOSE_LABEL},on:{"click":function($event){return _vm.$emit('close')}}})],1)]):_vm._e(),_vm._v(" "),(_vm.showSubheader)?_c('div',{staticClass:"drawer-title gl-border-t gl-flex gl-items-center gl-justify-start gl-gap-4 gl-px-4 gl-py-3",attrs:{"data-testid":"chat-subheader"}},[_c('div',{staticClass:"gl-flex gl-grow gl-gap-3"},[_c('gl-avatar',{staticClass:"gl-shrink-0",attrs:{"size":32,"entity-name":_vm.title,"shape":"circle"}}),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-flex-col gl-justify-center"},[_c('h3',{staticClass:"gl-my-0 gl-line-clamp-1 gl-text-[0.875rem] gl-text-default"},[_vm._v(_vm._s(_vm.title))]),_vm._v(" "),(_vm.agentHandler)?_c('p',{staticClass:"gl-my-0 gl-text-[0.75rem] gl-text-subtle"},[_vm._v("\n "+_vm._s(_vm.agentHandler)+"\n ")]):_vm._e()])],1),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-gap-3"},[(
|
|
162
162
|
_vm.isMultithreaded && (_vm.activeThreadId || _vm.currentView === _vm.VIEW_TYPES.LIST || _vm.hasManyAgents)
|
|
163
163
|
)?[(_vm.hasManyAgents)?_c('gl-disclosure-dropdown',{attrs:{"title":_vm.$options.i18n.CHAT_NEW_TOOLTIP,"toggle-text":_vm.$options.i18n.CHAT_NEW_TOOLTIP,"items":_vm.agents,"data-testid":"chat-new-button","variant":"confirm","category":"tertiary","size":"small","icon":"duo-chat-new","text-sr-only":"","aria-label":_vm.$options.i18n.CHAT_NEW_LABEL,"no-caret":""},on:{"action":_vm.startNewChat},scopedSlots:_vm._u([{key:"list-item",fn:function(ref){
|
|
164
164
|
var item = ref.item;
|
|
165
|
-
return [_c('duo-chat-header-agent-item',{attrs:{"agent":item}})]}}],null,false,1406306174)}):_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],attrs:{"title":_vm.$options.i18n.CHAT_NEW_TOOLTIP,"data-testid":"chat-new-button","variant":"confirm","category":"tertiary","size":"small","icon":"duo-chat-new","aria-label":_vm.$options.i18n.CHAT_NEW_LABEL},on:{"click":_vm.startNewChat}})]:_vm._e(),_vm._v(" "),(_vm.isMultithreaded && _vm.activeThreadId && _vm.currentView === _vm.VIEW_TYPES.LIST)?_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],attrs:{"title":_vm.$options.i18n.CHAT_BACK_TO_CHAT_TOOLTIP,"data-testid":"go-back-to-chat-button","category":"tertiary","size":"small","icon":"go-back","aria-label":_vm.$options.i18n.CHAT_BACK_TO_CHAT_TOOLTIP},on:{"click":function($event){return _vm.$emit('go-back-to-chat')}}}):_vm._e()
|
|
165
|
+
return [_c('duo-chat-header-agent-item',{attrs:{"agent":item}})]}}],null,false,1406306174)}):_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],attrs:{"title":_vm.$options.i18n.CHAT_NEW_TOOLTIP,"data-testid":"chat-new-button","variant":"confirm","category":"tertiary","size":"small","icon":"duo-chat-new","aria-label":_vm.$options.i18n.CHAT_NEW_LABEL},on:{"click":_vm.startNewChat}})]:_vm._e(),_vm._v(" "),(_vm.isMultithreaded && _vm.activeThreadId && _vm.currentView === _vm.VIEW_TYPES.LIST)?_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],attrs:{"title":_vm.$options.i18n.CHAT_BACK_TO_CHAT_TOOLTIP,"data-testid":"go-back-to-chat-button","category":"tertiary","size":"small","icon":"go-back","aria-label":_vm.$options.i18n.CHAT_BACK_TO_CHAT_TOOLTIP},on:{"click":function($event){return _vm.$emit('go-back-to-chat')}}}):_vm._e()],2)]):_vm._e(),_vm._v(" "),_vm._t("subheader"),_vm._v(" "),(_vm.error)?_c('gl-alert',{key:"error",staticClass:"!gl-pl-9",attrs:{"dismissible":false,"variant":"danger","role":"alert","data-testid":"chat-error"}},[_c('span',{directives:[{name:"safe-html",rawName:"v-safe-html",value:(_vm.error),expression:"error"}]})]):_vm._e()],2)};
|
|
166
166
|
var __vue_staticRenderFns__ = [];
|
|
167
167
|
|
|
168
168
|
/* style */
|
|
@@ -1,14 +1,131 @@
|
|
|
1
|
-
import { GlAccordion, GlAccordionItem, GlSafeHtmlDirective } from '@gitlab/ui';
|
|
1
|
+
import { GlAccordion, GlAccordionItem, GlBadge, GlSafeHtmlDirective } from '@gitlab/ui';
|
|
2
2
|
import { translate } from '../../../../../utils/i18n';
|
|
3
3
|
import PreBlock from './pre_block';
|
|
4
|
+
import ToolParamsJsonView from './tool_params_json_view';
|
|
4
5
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
5
6
|
|
|
7
|
+
const projectLabel = translate('BaseToolParams.projectLabel', 'Project');
|
|
8
|
+
const groupLabel = translate('BaseToolParams.groupLabel', 'Group');
|
|
9
|
+
const issueLabel = translate('BaseToolParams.issueLabel', 'Issue');
|
|
10
|
+
const mergeRequestLabel = translate('BaseToolParams.mergeRequestLabel', 'Merge request');
|
|
11
|
+
const workItemLabel = translate('BaseToolParams.workItemLabel', 'Work item');
|
|
12
|
+
const epicLabel = translate('BaseToolParams.epicLabel', 'Epic');
|
|
13
|
+
const sourceBranchLabel = translate('BaseToolParams.sourceBranchLabel', 'Source branch');
|
|
14
|
+
const targetBranchLabel = translate('BaseToolParams.targetBranchLabel', 'Target branch');
|
|
15
|
+
const startDateLabel = translate('BaseToolParams.startDateLabel', 'Start date');
|
|
16
|
+
const dueDateLabel = translate('BaseToolParams.dueDateLabel', 'Due date');
|
|
17
|
+
const healthStatusLabel = translate('BaseToolParams.healthStatusLabel', 'Health status');
|
|
18
|
+
const labelsLabel = translate('BaseToolParams.labelsLabel', 'Labels');
|
|
19
|
+
const vulnerabilityLabel = translate('BaseToolParams.vulnerabilityLabel', 'Vulnerability');
|
|
20
|
+
const dismissalReasonLabel = translate('BaseToolParams.dismissalReasonLabel', 'Dismissal reason');
|
|
21
|
+
const stateLabel = translate('BaseToolParams.stateLabel', 'State');
|
|
22
|
+
const confidentialLabel = translate('BaseToolParams.confidentialLabel', 'Confidential');
|
|
23
|
+
const typeLabel = translate('BaseToolParams.typeLabel', 'Type');
|
|
24
|
+
const metadataProperties = {
|
|
25
|
+
projectId: {
|
|
26
|
+
icon: 'project',
|
|
27
|
+
label: projectLabel
|
|
28
|
+
},
|
|
29
|
+
projectPath: {
|
|
30
|
+
icon: 'project',
|
|
31
|
+
label: projectLabel
|
|
32
|
+
},
|
|
33
|
+
projectFullPath: {
|
|
34
|
+
icon: 'project',
|
|
35
|
+
label: projectLabel
|
|
36
|
+
},
|
|
37
|
+
groupId: {
|
|
38
|
+
icon: 'group',
|
|
39
|
+
label: groupLabel
|
|
40
|
+
},
|
|
41
|
+
groupPath: {
|
|
42
|
+
icon: 'group',
|
|
43
|
+
label: groupLabel
|
|
44
|
+
},
|
|
45
|
+
issueId: {
|
|
46
|
+
icon: 'issues',
|
|
47
|
+
label: issueLabel
|
|
48
|
+
},
|
|
49
|
+
issueIid: {
|
|
50
|
+
icon: 'issues',
|
|
51
|
+
label: issueLabel
|
|
52
|
+
},
|
|
53
|
+
mergeRequestId: {
|
|
54
|
+
icon: 'merge-request',
|
|
55
|
+
label: mergeRequestLabel
|
|
56
|
+
},
|
|
57
|
+
mergeRequestIid: {
|
|
58
|
+
icon: 'merge-request',
|
|
59
|
+
label: mergeRequestLabel
|
|
60
|
+
},
|
|
61
|
+
workItemIid: {
|
|
62
|
+
icon: 'work-items',
|
|
63
|
+
label: workItemLabel
|
|
64
|
+
},
|
|
65
|
+
epicIid: {
|
|
66
|
+
icon: 'epics',
|
|
67
|
+
label: epicLabel
|
|
68
|
+
},
|
|
69
|
+
sourceBranch: {
|
|
70
|
+
icon: 'branch',
|
|
71
|
+
label: sourceBranchLabel
|
|
72
|
+
},
|
|
73
|
+
targetBranch: {
|
|
74
|
+
icon: 'branch',
|
|
75
|
+
label: targetBranchLabel
|
|
76
|
+
},
|
|
77
|
+
url: {
|
|
78
|
+
icon: 'external-link',
|
|
79
|
+
type: 'url'
|
|
80
|
+
},
|
|
81
|
+
startDate: {
|
|
82
|
+
icon: 'calendar',
|
|
83
|
+
label: startDateLabel
|
|
84
|
+
},
|
|
85
|
+
dueDate: {
|
|
86
|
+
icon: 'calendar',
|
|
87
|
+
label: dueDateLabel
|
|
88
|
+
},
|
|
89
|
+
healthStatus: {
|
|
90
|
+
icon: 'status-health',
|
|
91
|
+
label: healthStatusLabel
|
|
92
|
+
},
|
|
93
|
+
state: {
|
|
94
|
+
label: stateLabel,
|
|
95
|
+
icon: value => value === 'opened' ? 'status_open' : 'status_closed'
|
|
96
|
+
},
|
|
97
|
+
labels: {
|
|
98
|
+
icon: 'labels',
|
|
99
|
+
label: labelsLabel
|
|
100
|
+
},
|
|
101
|
+
addLabelIds: {
|
|
102
|
+
icon: 'labels',
|
|
103
|
+
label: labelsLabel
|
|
104
|
+
},
|
|
105
|
+
confidential: {
|
|
106
|
+
icon: value => value ? 'eye-slash' : 'eye',
|
|
107
|
+
label: confidentialLabel
|
|
108
|
+
},
|
|
109
|
+
typeName: {
|
|
110
|
+
icon: value => `work-item-${value.toLowerCase()}`,
|
|
111
|
+
label: typeLabel
|
|
112
|
+
},
|
|
113
|
+
vulnerabilityId: {
|
|
114
|
+
label: vulnerabilityLabel
|
|
115
|
+
},
|
|
116
|
+
dismissalReason: {
|
|
117
|
+
icon: 'information',
|
|
118
|
+
label: dismissalReasonLabel
|
|
119
|
+
}
|
|
120
|
+
};
|
|
6
121
|
var script = {
|
|
7
122
|
name: 'BaseToolParams',
|
|
8
123
|
components: {
|
|
9
124
|
GlAccordion,
|
|
10
125
|
GlAccordionItem,
|
|
11
|
-
|
|
126
|
+
GlBadge,
|
|
127
|
+
PreBlock,
|
|
128
|
+
ToolParamsJsonView
|
|
12
129
|
},
|
|
13
130
|
directives: {
|
|
14
131
|
SafeHtml: GlSafeHtmlDirective
|
|
@@ -24,19 +141,64 @@ var script = {
|
|
|
24
141
|
required: false,
|
|
25
142
|
default: ''
|
|
26
143
|
},
|
|
144
|
+
toolParams: {
|
|
145
|
+
type: Object,
|
|
146
|
+
required: false,
|
|
147
|
+
default: () => {}
|
|
148
|
+
},
|
|
27
149
|
customAccordionTitle: {
|
|
28
150
|
type: String,
|
|
29
151
|
required: false,
|
|
30
152
|
default: ''
|
|
153
|
+
},
|
|
154
|
+
withJsonView: {
|
|
155
|
+
type: Boolean,
|
|
156
|
+
required: false,
|
|
157
|
+
default: false
|
|
31
158
|
}
|
|
32
159
|
},
|
|
33
160
|
computed: {
|
|
34
161
|
accordionTitle() {
|
|
35
|
-
return this.customAccordionTitle || this.$options.i18n.
|
|
162
|
+
return this.customAccordionTitle || this.$options.i18n.DESCRIPTION_ACCORDION_TITLE;
|
|
163
|
+
},
|
|
164
|
+
metadataProperties() {
|
|
165
|
+
const toolParams = this.toolParams || {};
|
|
166
|
+
return Object.entries(metadataProperties).filter(_ref => {
|
|
167
|
+
let [property] = _ref;
|
|
168
|
+
return toolParams[property];
|
|
169
|
+
}).map(_ref2 => {
|
|
170
|
+
let [property, styles] = _ref2;
|
|
171
|
+
return {
|
|
172
|
+
key: property,
|
|
173
|
+
value: toolParams[property],
|
|
174
|
+
...styles
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
},
|
|
178
|
+
hasMetadataProperties() {
|
|
179
|
+
return this.metadataProperties.length > 0;
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
methods: {
|
|
183
|
+
formatPropertyValue(value) {
|
|
184
|
+
if (Array.isArray(value)) {
|
|
185
|
+
return value.join(', ');
|
|
186
|
+
}
|
|
187
|
+
if (typeof value === 'boolean') {
|
|
188
|
+
return value ? translate('Yes', 'Yes') : translate('No', 'No');
|
|
189
|
+
}
|
|
190
|
+
return value;
|
|
191
|
+
},
|
|
192
|
+
processPropertyIcon(icon, propertyValue) {
|
|
193
|
+
if (typeof icon === 'function') {
|
|
194
|
+
return icon(propertyValue);
|
|
195
|
+
}
|
|
196
|
+
return icon;
|
|
36
197
|
}
|
|
37
198
|
},
|
|
38
199
|
i18n: {
|
|
39
|
-
|
|
200
|
+
DESCRIPTION_ACCORDION_TITLE: translate('BaseToolParams.ExpandDescriptionTitle', 'Read description'),
|
|
201
|
+
EXPAND_JSON_VIEW_TITLE: translate('BaseToolParams.ExpandJsonViewTitle', 'See request parameters as JSON')
|
|
40
202
|
}
|
|
41
203
|
};
|
|
42
204
|
|
|
@@ -44,7 +206,7 @@ var script = {
|
|
|
44
206
|
const __vue_script__ = script;
|
|
45
207
|
|
|
46
208
|
/* template */
|
|
47
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-flex gl-flex-col"},[(_vm.message)?_c('div',{directives:[{name:"safe-html",rawName:"v-safe-html",value:(_vm.message),expression:"message"}]}):_vm._t("default"),_vm._v(" "),(_vm.description)?_c('gl-accordion',{staticClass:"-gl-ml-2
|
|
209
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-flex gl-flex-col gl-gap-3"},[(_vm.hasMetadataProperties)?_c('div',{staticClass:"gl-flex gl-flex-wrap gl-gap-2"},_vm._l((_vm.metadataProperties),function(property){return _c('span',{key:property.key,staticClass:"gl-overflow-hidden"},[(property.type == 'url')?_c('gl-badge',{attrs:{"icon":property.icon,"href":property.value,"title":property.value}},[_c('span',{staticClass:"gl-truncate"},[_vm._v("\n "+_vm._s(property.value)+"\n ")])]):_c('gl-badge',{attrs:{"icon":_vm.processPropertyIcon(property.icon, property.value)}},[_vm._v("\n "+_vm._s(property.label)+": "+_vm._s(_vm.formatPropertyValue(property.value))+"\n ")])],1)}),0):_vm._e(),_vm._v(" "),(_vm.message)?_c('div',{directives:[{name:"safe-html",rawName:"v-safe-html",value:(_vm.message),expression:"message"}]}):_vm._t("default"),_vm._v(" "),(_vm.message || _vm.description)?_c('gl-accordion',{staticClass:"-gl-ml-2",attrs:{"header-level":3}},[(_vm.description)?_c('gl-accordion-item',{staticClass:"gl-mb-3",attrs:{"title":_vm.accordionTitle}},[_c('pre-block',[_vm._v(_vm._s(_vm.description))])],1):_vm._e(),_vm._v(" "),(_vm.withJsonView)?_c('gl-accordion-item',{attrs:{"title":_vm.$options.i18n.EXPAND_JSON_VIEW_TITLE}},[_c('tool-params-json-view',{attrs:{"tool-params":_vm.toolParams}})],1):_vm._e()],1):(!_vm.message && !_vm.description && _vm.withJsonView)?_c('tool-params-json-view',{attrs:{"tool-params":_vm.toolParams}}):_vm._e()],2)};
|
|
48
210
|
var __vue_staticRenderFns__ = [];
|
|
49
211
|
|
|
50
212
|
/* style */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GlSprintf, GlAccordion, GlAccordionItem } from '@gitlab/ui';
|
|
2
2
|
import { createPatch } from 'diff';
|
|
3
3
|
import { sprintf, translatePlural, translate } from '../../../../../utils/i18n';
|
|
4
|
+
import BaseToolParams from './base_tool_params';
|
|
4
5
|
import PreBlock from './pre_block';
|
|
5
6
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
6
7
|
|
|
@@ -11,6 +12,7 @@ var script = {
|
|
|
11
12
|
GlSprintf,
|
|
12
13
|
GlAccordion,
|
|
13
14
|
GlAccordionItem,
|
|
15
|
+
BaseToolParams,
|
|
14
16
|
PreBlock
|
|
15
17
|
},
|
|
16
18
|
props: {
|
|
@@ -20,25 +22,17 @@ var script = {
|
|
|
20
22
|
}
|
|
21
23
|
},
|
|
22
24
|
computed: {
|
|
23
|
-
project() {
|
|
24
|
-
var _this$toolParams, _this$toolParams2;
|
|
25
|
-
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) || '';
|
|
26
|
-
},
|
|
27
25
|
branch() {
|
|
28
|
-
var _this$
|
|
29
|
-
return (_this$
|
|
30
|
-
},
|
|
31
|
-
startBranch() {
|
|
32
|
-
var _this$toolParams4;
|
|
33
|
-
return ((_this$toolParams4 = this.toolParams) === null || _this$toolParams4 === void 0 ? void 0 : _this$toolParams4.startBranch) || '';
|
|
26
|
+
var _this$toolParams;
|
|
27
|
+
return (_this$toolParams = this.toolParams) === null || _this$toolParams === void 0 ? void 0 : _this$toolParams.branch;
|
|
34
28
|
},
|
|
35
29
|
commitMessage() {
|
|
36
|
-
var _this$
|
|
37
|
-
return (_this$
|
|
30
|
+
var _this$toolParams2;
|
|
31
|
+
return (_this$toolParams2 = this.toolParams) === null || _this$toolParams2 === void 0 ? void 0 : _this$toolParams2.commitMessage;
|
|
38
32
|
},
|
|
39
33
|
actions() {
|
|
40
|
-
var _this$
|
|
41
|
-
return ((_this$
|
|
34
|
+
var _this$toolParams3;
|
|
35
|
+
return ((_this$toolParams3 = this.toolParams) === null || _this$toolParams3 === void 0 ? void 0 : _this$toolParams3.actions) || [];
|
|
42
36
|
},
|
|
43
37
|
actionsCount() {
|
|
44
38
|
return this.actions.length;
|
|
@@ -109,8 +103,8 @@ var script = {
|
|
|
109
103
|
}
|
|
110
104
|
},
|
|
111
105
|
i18n: {
|
|
112
|
-
COMMIT_SUMMARY_MESSAGE: translate('CreateCommitToolParams.commitSummaryMessage', 'Create a commit in the branch %{branch}
|
|
113
|
-
COMMIT_SUMMARY_AUTO_BRANCH_MESSAGE: translate('CreateCommitToolParams.commitSummaryAutoBranchMessage', 'Create a commit in a new auto-created branch
|
|
106
|
+
COMMIT_SUMMARY_MESSAGE: translate('CreateCommitToolParams.commitSummaryMessage', 'Create a commit in the branch %{branch}.'),
|
|
107
|
+
COMMIT_SUMMARY_AUTO_BRANCH_MESSAGE: translate('CreateCommitToolParams.commitSummaryAutoBranchMessage', 'Create a commit in a new auto-created branch.'),
|
|
114
108
|
READ_COMMIT_MESSAGE: translate('CreateCommitToolParams.readCommitMessage', 'Read commit message'),
|
|
115
109
|
CREATE_FILE_ACTION_LABEL: translate('CreateCommitToolParams.createFileActionLabel', 'Create file %{filePath}'),
|
|
116
110
|
UPDATE_FILE_ACTION_LABEL: translate('CreateCommitToolParams.updateFileActionLabel', 'Update file %{filePath}'),
|
|
@@ -127,9 +121,9 @@ var script = {
|
|
|
127
121
|
const __vue_script__ = script;
|
|
128
122
|
|
|
129
123
|
/* template */
|
|
130
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('
|
|
124
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('base-tool-params',{attrs:{"tool-params":_vm.toolParams}},[_c('div',[_c('gl-sprintf',{attrs:{"message":_vm.branch
|
|
131
125
|
? _vm.$options.i18n.COMMIT_SUMMARY_MESSAGE
|
|
132
|
-
: _vm.$options.i18n.COMMIT_SUMMARY_AUTO_BRANCH_MESSAGE},scopedSlots:_vm._u([
|
|
126
|
+
: _vm.$options.i18n.COMMIT_SUMMARY_AUTO_BRANCH_MESSAGE},scopedSlots:_vm._u([(_vm.branch)?{key:"branch",fn:function(){return [_c('code',[_vm._v(_vm._s(_vm.branch))])]},proxy:true}:null],null,true)}),_vm._v("\n "+_vm._s(_vm.actionsCountMessage)+"\n ")],1),_vm._v(" "),_c('gl-accordion',{staticClass:"-gl-ml-2",attrs:{"header-level":3}},[(_vm.commitMessage)?_c('gl-accordion-item',{staticClass:"gl-mb-3",attrs:{"title":_vm.$options.i18n.READ_COMMIT_MESSAGE}},[_c('pre-block',[_vm._v(_vm._s(_vm.commitMessage))])],1):_vm._e(),_vm._v(" "),(_vm.actionsCount)?_c('gl-accordion-item',{attrs:{"title":_vm.$options.i18n.EXPAND_CHANGES}},[_c('gl-accordion',{attrs:{"header-level":4}},_vm._l((_vm.actions),function(action,index){return _c('gl-accordion-item',{key:index,staticClass:"gl-mb-3",attrs:{"title":_vm.getActionTitle(action)}},[_c('pre-block',{staticClass:"language-diff"},[_vm._v(_vm._s(_vm.getActionContent(action)))])],1)}),1)],1):_vm._e()],1)],1)};
|
|
133
127
|
var __vue_staticRenderFns__ = [];
|
|
134
128
|
|
|
135
129
|
/* style */
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { sprintf, translate } 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
|
+
var script = {
|
|
7
|
+
name: 'DefaultToolParams',
|
|
8
|
+
components: {
|
|
9
|
+
BaseToolParams
|
|
10
|
+
},
|
|
11
|
+
props: {
|
|
12
|
+
toolName: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: false,
|
|
15
|
+
default: ''
|
|
16
|
+
},
|
|
17
|
+
toolParams: {
|
|
18
|
+
type: Object,
|
|
19
|
+
required: true
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
computed: {
|
|
23
|
+
title() {
|
|
24
|
+
var _this$toolParams;
|
|
25
|
+
return (_this$toolParams = this.toolParams) === null || _this$toolParams === void 0 ? void 0 : _this$toolParams.title;
|
|
26
|
+
},
|
|
27
|
+
description() {
|
|
28
|
+
var _this$toolParams2, _this$toolParams3, _this$toolParams4;
|
|
29
|
+
return ((_this$toolParams2 = this.toolParams) === null || _this$toolParams2 === void 0 ? void 0 : _this$toolParams2.description) || ((_this$toolParams3 = this.toolParams) === null || _this$toolParams3 === void 0 ? void 0 : _this$toolParams3.body) || ((_this$toolParams4 = this.toolParams) === null || _this$toolParams4 === void 0 ? void 0 : _this$toolParams4.comment);
|
|
30
|
+
},
|
|
31
|
+
isNote() {
|
|
32
|
+
return [APPROVAL_TOOL_NAMES.createMergeRequestNote, APPROVAL_TOOL_NAMES.createWorkItemNote, APPROVAL_TOOL_NAMES.createIssueNote].includes(this.toolName);
|
|
33
|
+
},
|
|
34
|
+
message() {
|
|
35
|
+
const message = this.title ? this.$options.i18n.TITLE_MESSAGE : '';
|
|
36
|
+
return sprintf(message, {
|
|
37
|
+
...this.toolParams
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
accordionTitle() {
|
|
41
|
+
return this.isNote ? this.$options.i18n.NOTE_ACCORDION_TITLE : '';
|
|
42
|
+
},
|
|
43
|
+
displayRawOutput() {
|
|
44
|
+
return !this.message;
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
i18n: {
|
|
48
|
+
TITLE_MESSAGE: translate('IssuableToolParams.TITLE_MESSAGE', 'Set the title "<em>%{title}</em>".'),
|
|
49
|
+
NOTE_ACCORDION_TITLE: translate('IssuableToolParams.NOTE_ACCORDION_TITLE', "Read note's content")
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/* script */
|
|
54
|
+
const __vue_script__ = script;
|
|
55
|
+
|
|
56
|
+
/* template */
|
|
57
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('base-tool-params',{attrs:{"with-json-view":"","tool-params":_vm.toolParams,"message":_vm.message,"description":_vm.description,"custom-accordion-title":_vm.accordionTitle}})],1)};
|
|
58
|
+
var __vue_staticRenderFns__ = [];
|
|
59
|
+
|
|
60
|
+
/* style */
|
|
61
|
+
const __vue_inject_styles__ = undefined;
|
|
62
|
+
/* scoped */
|
|
63
|
+
const __vue_scope_id__ = undefined;
|
|
64
|
+
/* module identifier */
|
|
65
|
+
const __vue_module_identifier__ = undefined;
|
|
66
|
+
/* functional template */
|
|
67
|
+
const __vue_is_functional_template__ = false;
|
|
68
|
+
/* style inject */
|
|
69
|
+
|
|
70
|
+
/* style inject SSR */
|
|
71
|
+
|
|
72
|
+
/* style inject shadow dom */
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
const __vue_component__ = __vue_normalize__(
|
|
77
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
78
|
+
__vue_inject_styles__,
|
|
79
|
+
__vue_script__,
|
|
80
|
+
__vue_scope_id__,
|
|
81
|
+
__vue_is_functional_template__,
|
|
82
|
+
__vue_module_identifier__,
|
|
83
|
+
false,
|
|
84
|
+
undefined,
|
|
85
|
+
undefined,
|
|
86
|
+
undefined
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
export default __vue_component__;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { translate } from '../../../../../utils/i18n';
|
|
2
|
+
import PreBlock from './pre_block';
|
|
3
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
4
|
+
|
|
5
|
+
var script = {
|
|
6
|
+
name: 'ToolParamsJsonView',
|
|
7
|
+
components: {
|
|
8
|
+
PreBlock
|
|
9
|
+
},
|
|
10
|
+
props: {
|
|
11
|
+
toolParams: {
|
|
12
|
+
type: Object,
|
|
13
|
+
required: true
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
computed: {
|
|
17
|
+
hasToolParams() {
|
|
18
|
+
return Object.keys(this.toolParams || {}).length > 0;
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
i18n: {
|
|
22
|
+
REQUEST_TEXT: translate('MessageToolApproval.parametersText', 'Request parameters'),
|
|
23
|
+
NO_PARAMETERS_TEXT: translate('MessageToolApproval.noParametersText', 'No parameters will be sent with this request.')
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/* script */
|
|
28
|
+
const __vue_script__ = script;
|
|
29
|
+
|
|
30
|
+
/* template */
|
|
31
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('figure',{staticClass:"gl-m-0 gl-flex gl-flex-col gl-gap-2"},[_c('figcaption',{staticClass:"gl-text-subtle"},[_vm._v("\n "+_vm._s(_vm.$options.i18n.REQUEST_TEXT)+"\n ")]),_vm._v(" "),(_vm.hasToolParams)?_c('pre-block',{staticClass:"language-json",attrs:{"data-testid":"tool-parameters"}},[_vm._v(_vm._s(JSON.stringify(_vm.toolParams, null, 2)))]):_c('span',{staticClass:"gl-text-sm gl-text-gray-500",attrs:{"data-testid":"no-parameters-message"}},[_vm._v("\n "+_vm._s(_vm.$options.i18n.NO_PARAMETERS_TEXT)+"\n ")])],1)};
|
|
32
|
+
var __vue_staticRenderFns__ = [];
|
|
33
|
+
|
|
34
|
+
/* style */
|
|
35
|
+
const __vue_inject_styles__ = undefined;
|
|
36
|
+
/* scoped */
|
|
37
|
+
const __vue_scope_id__ = undefined;
|
|
38
|
+
/* module identifier */
|
|
39
|
+
const __vue_module_identifier__ = undefined;
|
|
40
|
+
/* functional template */
|
|
41
|
+
const __vue_is_functional_template__ = false;
|
|
42
|
+
/* style inject */
|
|
43
|
+
|
|
44
|
+
/* style inject SSR */
|
|
45
|
+
|
|
46
|
+
/* style inject shadow dom */
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
const __vue_component__ = __vue_normalize__(
|
|
51
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
52
|
+
__vue_inject_styles__,
|
|
53
|
+
__vue_script__,
|
|
54
|
+
__vue_scope_id__,
|
|
55
|
+
__vue_is_functional_template__,
|
|
56
|
+
__vue_module_identifier__,
|
|
57
|
+
false,
|
|
58
|
+
undefined,
|
|
59
|
+
undefined,
|
|
60
|
+
undefined
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
export default __vue_component__;
|
package/dist/components/chat/components/duo_chat_message_tool_approval/message_tool_approval.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { GlButton, GlCard, GlFormTextarea, GlFormGroup, GlBadge, GlDropdown, GlDropdownItem } from '@gitlab/ui';
|
|
2
|
+
import startCase from 'lodash/startCase';
|
|
3
|
+
import capitalize from 'lodash/capitalize';
|
|
2
4
|
import { translate } from '../../../../utils/i18n';
|
|
3
5
|
import { convertKeysToCamelCase } from '../../../../utils/object';
|
|
4
6
|
import { APPROVAL_TOOL_NAMES, acceptedApproveToolPayloads } from '../../constants';
|
|
5
7
|
import CreateCommitToolParams from './components/create_commit_tool_params';
|
|
6
|
-
import
|
|
8
|
+
import DefaultToolParams from './components/default_tool_params';
|
|
7
9
|
import RunCommandToolParams from './components/run_command_tool_params';
|
|
8
|
-
import PreBlock from './components/pre_block';
|
|
9
10
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
10
11
|
|
|
11
12
|
const PROCESSING_STATE = {
|
|
@@ -27,26 +28,9 @@ const i18n = {
|
|
|
27
28
|
APPROVING_TEXT: translate('MessageToolApproval.approvingText', 'Approving...'),
|
|
28
29
|
DENY_TEXT: translate('MessageToolApproval.denyText', 'Deny'),
|
|
29
30
|
DENYING_TEXT: translate('MessageToolApproval.denyingText', 'Denying...'),
|
|
30
|
-
NO_PARAMETERS_TEXT: translate('MessageToolApproval.noParametersText', 'No parameters will be sent with this request.'),
|
|
31
|
-
REQUEST_TEXT: translate('MessageToolApproval.parametersText', 'Request parameters'),
|
|
32
31
|
DENIAL_REASON_LABEL: translate('MessageToolApproval.denialReasonLabel', 'Rejection reason'),
|
|
33
32
|
DENIAL_REASON_PLACEHOLDER: translate('MessageToolApproval.denialReasonPlaceholder', "Tell Duo why you're rejecting this tool execution..."),
|
|
34
33
|
CANCEL_TEXT: translate('MessageToolApproval.cancelText', 'Cancel'),
|
|
35
|
-
TOOL_APPROVAL_TITLES: {
|
|
36
|
-
[APPROVAL_TOOL_NAMES.createCommit]: translate('MessageToolApproval.createCommit', 'Duo wants to push a commit.'),
|
|
37
|
-
[APPROVAL_TOOL_NAMES.createIssue]: translate('MessageToolApproval.createIssue', 'Duo wants to open an issue.'),
|
|
38
|
-
[APPROVAL_TOOL_NAMES.updateIssue]: translate('MessageToolApproval.updateIssue', 'Duo wants to update an issue.'),
|
|
39
|
-
[APPROVAL_TOOL_NAMES.createEpic]: translate('MessageToolApproval.createEpic', 'Duo wants to create an epic.'),
|
|
40
|
-
[APPROVAL_TOOL_NAMES.updateEpic]: translate('MessageToolApproval.updateEpic', 'Duo wants to update an epic.'),
|
|
41
|
-
[APPROVAL_TOOL_NAMES.createWorkItem]: translate('MessageToolApproval.createWorkItem', 'Duo wants to create a work item.'),
|
|
42
|
-
[APPROVAL_TOOL_NAMES.updateWorkItem]: translate('MessageToolApproval.updateWorkItem', 'Duo wants to update a work item.'),
|
|
43
|
-
[APPROVAL_TOOL_NAMES.createMergeRequest]: translate('MessageToolApproval.createMergeRequest', 'Duo wants to create a merge request.'),
|
|
44
|
-
[APPROVAL_TOOL_NAMES.createIssueNote]: translate('MessageToolApproval.createIssueNote', 'Duo wants to post a note on an issue.'),
|
|
45
|
-
[APPROVAL_TOOL_NAMES.createMergeRequestNote]: translate('MessageToolApproval.createMergeRequestNote', 'Duo wants to post a note on a merge request.'),
|
|
46
|
-
[APPROVAL_TOOL_NAMES.createWorkItemNote]: translate('MessageToolApproval.createWorkItemNote', 'Duo wants to post a note on a work item.'),
|
|
47
|
-
[APPROVAL_TOOL_NAMES.runCommand]: translate('MessageToolApproval.runCommand', 'Duo wants to run a command.'),
|
|
48
|
-
[APPROVAL_TOOL_NAMES.runGitCommand]: translate('MessageToolApproval.runGitCommand', 'Duo wants to run a git command.')
|
|
49
|
-
},
|
|
50
34
|
[TOOL_STATUS.Pending]: translate('MessageToolApproval.toolStatusPending', 'Pending'),
|
|
51
35
|
[TOOL_STATUS.Approved]: translate('MessageToolApproval.toolStatusApproved', 'Approved'),
|
|
52
36
|
TOGGLE_PARAMS_BUTTON_EXPAND: translate('MessageToolApproval.collapseButtonCollapsed', 'Display tool details'),
|
|
@@ -55,17 +39,6 @@ const i18n = {
|
|
|
55
39
|
};
|
|
56
40
|
const TOOL_PARAMS_VIEW_COMPONENTS = {
|
|
57
41
|
[APPROVAL_TOOL_NAMES.createCommit]: 'CreateCommitToolParams',
|
|
58
|
-
[APPROVAL_TOOL_NAMES.createIssue]: 'IssuableToolParams',
|
|
59
|
-
[APPROVAL_TOOL_NAMES.updateIssue]: 'IssuableToolParams',
|
|
60
|
-
[APPROVAL_TOOL_NAMES.createEpic]: 'IssuableToolParams',
|
|
61
|
-
[APPROVAL_TOOL_NAMES.updateEpic]: 'IssuableToolParams',
|
|
62
|
-
[APPROVAL_TOOL_NAMES.createMergeRequest]: 'IssuableToolParams',
|
|
63
|
-
[APPROVAL_TOOL_NAMES.updateMergeRequest]: 'IssuableToolParams',
|
|
64
|
-
[APPROVAL_TOOL_NAMES.createWorkItem]: 'IssuableToolParams',
|
|
65
|
-
[APPROVAL_TOOL_NAMES.updateWorkItem]: 'IssuableToolParams',
|
|
66
|
-
[APPROVAL_TOOL_NAMES.createMergeRequestNote]: 'IssuableToolParams',
|
|
67
|
-
[APPROVAL_TOOL_NAMES.createWorkItemNote]: 'IssuableToolParams',
|
|
68
|
-
[APPROVAL_TOOL_NAMES.createIssueNote]: 'IssuableToolParams',
|
|
69
42
|
[APPROVAL_TOOL_NAMES.runCommand]: 'RunCommandToolParams',
|
|
70
43
|
[APPROVAL_TOOL_NAMES.runGitCommand]: 'RunCommandToolParams'
|
|
71
44
|
};
|
|
@@ -80,9 +53,8 @@ var script = {
|
|
|
80
53
|
GlDropdown,
|
|
81
54
|
GlDropdownItem,
|
|
82
55
|
CreateCommitToolParams,
|
|
83
|
-
|
|
84
|
-
RunCommandToolParams
|
|
85
|
-
PreBlock
|
|
56
|
+
DefaultToolParams,
|
|
57
|
+
RunCommandToolParams
|
|
86
58
|
},
|
|
87
59
|
props: {
|
|
88
60
|
messages: {
|
|
@@ -166,7 +138,7 @@ var script = {
|
|
|
166
138
|
}
|
|
167
139
|
|
|
168
140
|
// Single tool: show specific tool message
|
|
169
|
-
return
|
|
141
|
+
return capitalize(startCase(this.toolName));
|
|
170
142
|
},
|
|
171
143
|
toolStatusLabel() {
|
|
172
144
|
return i18n[this.approvalStatus];
|
|
@@ -280,7 +252,7 @@ var script = {
|
|
|
280
252
|
return convertKeysToCamelCase(obj);
|
|
281
253
|
},
|
|
282
254
|
getToolParamsComponent(toolName) {
|
|
283
|
-
return TOOL_PARAMS_VIEW_COMPONENTS[toolName];
|
|
255
|
+
return TOOL_PARAMS_VIEW_COMPONENTS[toolName] || 'DefaultToolParams';
|
|
284
256
|
}
|
|
285
257
|
},
|
|
286
258
|
i18n,
|
|
@@ -291,11 +263,7 @@ var script = {
|
|
|
291
263
|
const __vue_script__ = script;
|
|
292
264
|
|
|
293
265
|
/* template */
|
|
294
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-card',{staticClass:"gl-w-full",class:{ 'message-tool-approval-collapsed': _vm.collapsed },attrs:{"header-class":{ 'message-tool-approval-collapsed-header': _vm.collapsed },"body-class":{ 'gl-hidden': _vm.collapsed }},scopedSlots:_vm._u([{key:"header",fn:function(){return [_c('div',{staticClass:"gl-flex gl-items-center gl-justify-between gl-gap-3"},[_c('span',[(_vm.collapsible)?_c('gl-button',_vm._b({attrs:{"variant":"default","category":"tertiary","size":"small","data-testid":"toggle-details-button"},on:{"click":function($event){_vm.collapsed = !_vm.collapsed;}}},'gl-button',_vm.collapseButtonProps,false)):_vm._e(),_vm._v(" "),_c('span',[_vm._v("\n "+_vm._s(_vm.toolApprovalTitle)+"\n ")])],1),_vm._v(" "),_c('gl-badge',{attrs:{"variant":_vm.toolStatusVariant}},[_vm._v("\n "+_vm._s(_vm.toolStatusLabel)+"\n ")])],1)]},proxy:true},(!_vm.isApproved)?{key:"footer",fn:function(){return [(!_vm.showDenialReason)?_c('div',{staticClass:"gl-flex gl-gap-2"},[(_vm.showSplitButton)?_c('gl-dropdown',{attrs:{"variant":"confirm","size":"small","split":"","text":_vm.primaryApprovalOption.text,"disabled":_vm.buttonsDisabled || _vm.primaryApprovalOption.disabled,"loading":_vm.isApproving,"data-testid":"approve-dropdown"},on:{"click":_vm.handlePrimaryApprove}},_vm._l((_vm.additionalApprovalOptions),function(option){return _c('gl-dropdown-item',{key:option.type,attrs:{"disabled":option.disabled,"data-testid":"approve-dropdown-item"},on:{"click":function($event){return _vm.handleDropdownSelection(option)}}},[_vm._v("\n "+_vm._s(option.text)+"\n ")])}),1):_c('gl-button',{attrs:{"variant":"confirm","size":"small","data-testid":"approve-tool-inline","disabled":_vm.buttonsDisabled || _vm.primaryApprovalOption.disabled,"loading":_vm.isApproving},on:{"click":_vm.handlePrimaryApprove}},[_vm._v("\n "+_vm._s(_vm.primaryApprovalOption.text)+"\n ")]),_vm._v(" "),_c('gl-button',{attrs:{"size":"small","data-testid":"deny-tool-inline","disabled":_vm.buttonsDisabled,"loading":_vm.isDenying},on:{"click":_vm.handleDeny}},[_vm._v("\n "+_vm._s(_vm.denyButtonText)+"\n ")])],1):_c('div',[_c('gl-form-group',{staticClass:"gl-mb-3",attrs:{"label":_vm.$options.i18n.DENIAL_REASON_LABEL,"label-for":"inline-rejection-reason","optional":true}},[_c('gl-form-textarea',{attrs:{"id":"inline-rejection-reason","placeholder":_vm.$options.i18n.DENIAL_REASON_PLACEHOLDER,"rows":2,"no-resize":true,"submit-on-enter":false,"disabled":_vm.buttonsDisabled,"data-testid":"denial-reason-textarea","autofocus":""},on:{"submit":_vm.submitDenial},model:{value:(_vm.denialReason),callback:function ($$v) {_vm.denialReason=$$v;},expression:"denialReason"}})],1),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-gap-3"},[_c('gl-button',{attrs:{"size":"small","data-testid":"submit-denial","variant":"confirm","disabled":_vm.buttonsDisabled,"loading":_vm.isDenying},on:{"click":_vm.submitDenial}},[_vm._v("\n "+_vm._s(_vm.denyButtonText)+"\n ")]),_vm._v(" "),_c('gl-button',{attrs:{"size":"small","data-testid":"cancel-denial","disabled":_vm.buttonsDisabled},on:{"click":_vm.cancelDenial}},[_vm._v("\n "+_vm._s(_vm.$options.i18n.CANCEL_TEXT)+"\n ")])],1)],1)]},proxy:true}:null],null,true)},[_vm._v(" "),_vm._l((_vm.messages),function(toolMsg,index){return _c('div',{key:toolMsg.id || index},[
|
|
295
|
-
toolMsg.tool_info &&
|
|
296
|
-
toolMsg.tool_info.args &&
|
|
297
|
-
Object.keys(toolMsg.tool_info.args).length > 0
|
|
298
|
-
)?_c('pre-block',{attrs:{"data-testid":"tool-parameters"}},[_vm._v(_vm._s(JSON.stringify(toolMsg.tool_info.args, null, 2)))]):_c('span',{staticClass:"gl-text-sm gl-text-gray-500",attrs:{"data-testid":"no-parameters-message"}},[_vm._v("\n "+_vm._s(_vm.$options.i18n.NO_PARAMETERS_TEXT)+"\n ")])],1)],1)})],2)};
|
|
266
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-card',{staticClass:"gl-w-full",class:{ 'message-tool-approval-collapsed': _vm.collapsed },attrs:{"header-class":{ 'message-tool-approval-collapsed-header': _vm.collapsed },"body-class":{ 'gl-hidden': _vm.collapsed }},scopedSlots:_vm._u([{key:"header",fn:function(){return [_c('div',{staticClass:"gl-flex gl-items-center gl-justify-between gl-gap-3"},[_c('span',{staticClass:"gl-inline-flex gl-items-center gl-gap-2"},[(_vm.collapsible)?_c('gl-button',_vm._b({attrs:{"variant":"default","category":"tertiary","size":"small","data-testid":"toggle-details-button"},on:{"click":function($event){_vm.collapsed = !_vm.collapsed;}}},'gl-button',_vm.collapseButtonProps,false)):_vm._e(),_vm._v(" "),_c('span',[_vm._v("\n "+_vm._s(_vm.toolApprovalTitle)+"\n ")])],1),_vm._v(" "),_c('gl-badge',{attrs:{"variant":_vm.toolStatusVariant}},[_vm._v("\n "+_vm._s(_vm.toolStatusLabel)+"\n ")])],1)]},proxy:true},(!_vm.isApproved)?{key:"footer",fn:function(){return [(!_vm.showDenialReason)?_c('div',{staticClass:"gl-flex gl-gap-2"},[(_vm.showSplitButton)?_c('gl-dropdown',{attrs:{"variant":"confirm","size":"small","split":"","text":_vm.primaryApprovalOption.text,"disabled":_vm.buttonsDisabled || _vm.primaryApprovalOption.disabled,"loading":_vm.isApproving,"data-testid":"approve-dropdown"},on:{"click":_vm.handlePrimaryApprove}},_vm._l((_vm.additionalApprovalOptions),function(option){return _c('gl-dropdown-item',{key:option.type,attrs:{"disabled":option.disabled,"data-testid":"approve-dropdown-item"},on:{"click":function($event){return _vm.handleDropdownSelection(option)}}},[_vm._v("\n "+_vm._s(option.text)+"\n ")])}),1):_c('gl-button',{attrs:{"variant":"confirm","size":"small","data-testid":"approve-tool-inline","disabled":_vm.buttonsDisabled || _vm.primaryApprovalOption.disabled,"loading":_vm.isApproving},on:{"click":_vm.handlePrimaryApprove}},[_vm._v("\n "+_vm._s(_vm.primaryApprovalOption.text)+"\n ")]),_vm._v(" "),_c('gl-button',{attrs:{"size":"small","data-testid":"deny-tool-inline","disabled":_vm.buttonsDisabled,"loading":_vm.isDenying},on:{"click":_vm.handleDeny}},[_vm._v("\n "+_vm._s(_vm.denyButtonText)+"\n ")])],1):_c('div',[_c('gl-form-group',{staticClass:"gl-mb-3",attrs:{"label":_vm.$options.i18n.DENIAL_REASON_LABEL,"label-for":"inline-rejection-reason","optional":true}},[_c('gl-form-textarea',{attrs:{"id":"inline-rejection-reason","placeholder":_vm.$options.i18n.DENIAL_REASON_PLACEHOLDER,"rows":2,"no-resize":true,"submit-on-enter":false,"disabled":_vm.buttonsDisabled,"data-testid":"denial-reason-textarea","autofocus":""},on:{"submit":_vm.submitDenial},model:{value:(_vm.denialReason),callback:function ($$v) {_vm.denialReason=$$v;},expression:"denialReason"}})],1),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-gap-3"},[_c('gl-button',{attrs:{"size":"small","data-testid":"submit-denial","variant":"confirm","disabled":_vm.buttonsDisabled,"loading":_vm.isDenying},on:{"click":_vm.submitDenial}},[_vm._v("\n "+_vm._s(_vm.denyButtonText)+"\n ")]),_vm._v(" "),_c('gl-button',{attrs:{"size":"small","data-testid":"cancel-denial","disabled":_vm.buttonsDisabled},on:{"click":_vm.cancelDenial}},[_vm._v("\n "+_vm._s(_vm.$options.i18n.CANCEL_TEXT)+"\n ")])],1)],1)]},proxy:true}:null],null,true)},[_vm._v(" "),_vm._l((_vm.messages),function(toolMsg,index){return _c('div',{key:toolMsg.id || index},[_c(_vm.getToolParamsComponent(toolMsg.tool_info && toolMsg.tool_info.name),_vm._b({tag:"component",class:['gl-leading-20', { 'gl-border-t gl-mt-3 gl-border-gray-100 gl-pt-3': index > 0 }],attrs:{"tool-name":toolMsg.tool_info && toolMsg.tool_info.name,"tool-params":_vm.convertKeysToCamelCase((toolMsg.tool_info && toolMsg.tool_info.args) || {}),"tool-response":toolMsg.tool_info && toolMsg.tool_info.tool_response,"working-directory":_vm.workingDirectory}},'component',_vm.convertKeysToCamelCase((toolMsg.tool_info && toolMsg.tool_info.args) || {}),false))],1)})],2)};
|
|
299
267
|
var __vue_staticRenderFns__ = [];
|
|
300
268
|
|
|
301
269
|
/* style */
|