@gitlab/ui 101.2.0 → 101.3.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 +14 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.js +8 -15
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.js +11 -6
- package/dist/components/experimental/duo/chat/components/duo_chat_context/mock_context_data.js +44 -6
- package/dist/components/experimental/duo/chat/components/duo_chat_context/utils.js +27 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/tokens/build/js/tokens.dark.js +571 -572
- package/dist/tokens/build/js/tokens.js +571 -572
- package/dist/tokens/css/tokens.css +943 -944
- package/dist/tokens/css/tokens.dark.css +943 -944
- package/dist/tokens/js/tokens.dark.js +571 -572
- package/dist/tokens/js/tokens.js +571 -572
- package/dist/tokens/json/tokens.dark.json +3034 -3034
- package/dist/tokens/json/tokens.json +3034 -3034
- package/dist/tokens/scss/_tokens.dark.scss +943 -944
- package/dist/tokens/scss/_tokens.scss +943 -944
- package/dist/tokens/scss/_tokens_custom_properties.scss +1 -2
- package/dist/tokens/tailwind/tokens.cjs +1 -2
- package/dist/tokens/tokens_story.js +1 -1
- package/dist/tokens/tokens_table.js +4 -6
- package/package.json +3 -6
- package/src/components/base/broadcast_message/broadcast_message.scss +9 -0
- package/src/components/base/card/card.scss +8 -7
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.md +35 -0
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.vue +17 -24
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.vue +19 -13
- package/src/components/experimental/duo/chat/components/duo_chat_context/mock_context_data.js +44 -6
- package/src/components/experimental/duo/chat/components/duo_chat_context/utils.js +31 -0
- package/src/tokens/build/css/tokens.css +943 -944
- package/src/tokens/build/css/tokens.dark.css +943 -944
- package/src/tokens/build/js/tokens.dark.js +571 -572
- package/src/tokens/build/js/tokens.js +571 -572
- package/src/tokens/build/json/tokens.dark.json +3034 -3034
- package/src/tokens/build/json/tokens.json +3034 -3034
- package/src/tokens/build/scss/_tokens.dark.scss +943 -944
- package/src/tokens/build/scss/_tokens.scss +943 -944
- package/src/tokens/build/scss/_tokens_custom_properties.scss +1 -2
- package/src/tokens/build/tailwind/tokens.cjs +1 -2
- package/src/tokens/tokens_story.vue +7 -7
- package/src/tokens/tokens_table.vue +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [101.3.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v101.2.1...v101.3.0) (2024-10-31)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlCard:** Update design tokens ([b5ac971](https://gitlab.com/gitlab-org/gitlab-ui/commit/b5ac97157bb723232090aa0c8b2665c62ee29ee0))
|
|
7
|
+
|
|
8
|
+
## [101.2.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v101.2.0...v101.2.1) (2024-10-30)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **GlBroadcastMessage:** Fix link color in content ([1e7b459](https://gitlab.com/gitlab-org/gitlab-ui/commit/1e7b459e7e2e34bb3091eec1d763d92b548e9765))
|
|
14
|
+
|
|
1
15
|
# [101.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v101.1.0...v101.2.0) (2024-10-30)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import GlDuoChatContextItemPopover from '../duo_chat_context_item_popover/duo_chat_context_item_popover';
|
|
2
2
|
import GlTruncate from '../../../../../../utilities/truncate/truncate';
|
|
3
3
|
import GlIcon from '../../../../../../base/icon/icon';
|
|
4
|
-
import { categoryValidator, contextItemValidator,
|
|
5
|
-
import
|
|
4
|
+
import { categoryValidator, contextItemValidator, getContextItemSecondaryText, getContextItemIcon, getContextItemSource } from '../utils';
|
|
5
|
+
import GlBadge from '../../../../../../base/badge/badge';
|
|
6
6
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
7
7
|
|
|
8
8
|
var script = {
|
|
9
9
|
name: 'GlDuoChatContextItemMenuSearchItem',
|
|
10
10
|
components: {
|
|
11
|
+
GlBadge,
|
|
11
12
|
GlTruncate,
|
|
12
13
|
GlIcon,
|
|
13
14
|
GlDuoChatContextItemPopover
|
|
@@ -30,21 +31,13 @@ var script = {
|
|
|
30
31
|
return ((_this$contextItem$met = this.contextItem.metadata) === null || _this$contextItem$met === void 0 ? void 0 : _this$contextItem$met.title) || '';
|
|
31
32
|
},
|
|
32
33
|
secondaryText() {
|
|
33
|
-
|
|
34
|
-
case CONTEXT_ITEM_CATEGORY_FILE:
|
|
35
|
-
return this.contextItem.metadata.relativePath;
|
|
36
|
-
case CONTEXT_ITEM_CATEGORY_ISSUE:
|
|
37
|
-
return formatIssueId(this.contextItem.metadata.iid);
|
|
38
|
-
case CONTEXT_ITEM_CATEGORY_MERGE_REQUEST:
|
|
39
|
-
return formatMergeRequestId(this.contextItem.metadata.iid);
|
|
40
|
-
case CONTEXT_ITEM_CATEGORY_LOCAL_GIT:
|
|
41
|
-
return formatGitItemSecondaryText(this.contextItem);
|
|
42
|
-
default:
|
|
43
|
-
return '';
|
|
44
|
-
}
|
|
34
|
+
return getContextItemSecondaryText(this.contextItem);
|
|
45
35
|
},
|
|
46
36
|
icon() {
|
|
47
37
|
return getContextItemIcon(this.contextItem, this.category);
|
|
38
|
+
},
|
|
39
|
+
itemSource() {
|
|
40
|
+
return getContextItemSource(this.contextItem);
|
|
48
41
|
}
|
|
49
42
|
}
|
|
50
43
|
};
|
|
@@ -53,7 +46,7 @@ var script = {
|
|
|
53
46
|
const __vue_script__ = script;
|
|
54
47
|
|
|
55
48
|
/* template */
|
|
56
|
-
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"},[_c('div',{staticClass:"gl-flex gl-items-center"},[_c('gl-icon',{staticClass:"gl-mr-2 gl-shrink-0",attrs:{"name":_vm.icon,"data-testid":"category-icon"}}),_vm._v(" "),_c('gl-truncate',{staticClass:"gl-min-w-0",attrs:{"text":_vm.title,"data-testid":"item-title"}}),_vm._v(" "),_c('gl-icon',{staticClass:"gl-ml-2 gl-shrink-0 gl-cursor-pointer gl-text-secondary",attrs:{"id":("info-icon-" + (_vm.contextItem.id)),"name":"information-o","size":12}}),_vm._v(" "),_c('gl-duo-chat-context-item-popover',{attrs:{"context-item":_vm.contextItem,"target":("info-icon-" + (_vm.contextItem.id)),"placement":"left"}})],1),_vm._v(" "),(_vm.secondaryText)?_c('div',{staticClass:"gl-mt-1 gl-shrink-0 gl-whitespace-nowrap gl-text-secondary",attrs:{"data-testid":"item-secondary-text"}},[_c('gl-truncate',{attrs:{"text":_vm.secondaryText}})],1):_vm._e()])};
|
|
49
|
+
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"},[_c('div',{staticClass:"gl-flex gl-items-center"},[_c('gl-icon',{staticClass:"gl-mr-2 gl-shrink-0",attrs:{"name":_vm.icon,"data-testid":"category-icon"}}),_vm._v(" "),_c('gl-truncate',{staticClass:"gl-min-w-0",attrs:{"text":_vm.title,"data-testid":"item-title"}}),_vm._v(" "),_c('gl-icon',{staticClass:"gl-ml-2 gl-shrink-0 gl-cursor-pointer gl-text-secondary",attrs:{"id":("info-icon-" + (_vm.contextItem.id)),"name":"information-o","size":12}}),_vm._v(" "),_c('gl-duo-chat-context-item-popover',{attrs:{"context-item":_vm.contextItem,"target":("info-icon-" + (_vm.contextItem.id)),"placement":"left"}})],1),_vm._v(" "),(_vm.secondaryText)?_c('div',{staticClass:"gl-align-items-center gl-mt-1 gl-flex gl-shrink-0 gl-whitespace-nowrap gl-text-secondary",attrs:{"data-testid":"item-secondary-text"}},[(_vm.itemSource)?_c('gl-badge',{staticClass:"gl-mr-1",attrs:{"variant":"neutral","data-testid":"context-item-source"}},[_vm._v(_vm._s(_vm.itemSource))]):_vm._e(),_vm._v(" "),_c('gl-truncate',{staticClass:"gl-min-w-0",attrs:{"position":"middle","text":_vm.secondaryText}})],1):_vm._e()])};
|
|
57
50
|
var __vue_staticRenderFns__ = [];
|
|
58
51
|
|
|
59
52
|
/* style */
|
|
@@ -3,13 +3,15 @@ import GlIcon from '../../../../../../base/icon/icon';
|
|
|
3
3
|
import GlPopover from '../../../../../../base/popover/popover';
|
|
4
4
|
import GlTruncate from '../../../../../../utilities/truncate/truncate';
|
|
5
5
|
import { translate } from '../../../../../../../utils/i18n';
|
|
6
|
-
import { CONTEXT_ITEM_CATEGORY_ISSUE, CONTEXT_ITEM_CATEGORY_MERGE_REQUEST, CONTEXT_ITEM_CATEGORY_FILE
|
|
7
|
-
import { formatMergeRequestId, formatIssueId,
|
|
6
|
+
import { CONTEXT_ITEM_CATEGORY_ISSUE, CONTEXT_ITEM_CATEGORY_MERGE_REQUEST, CONTEXT_ITEM_CATEGORY_FILE } from '../constants';
|
|
7
|
+
import { formatMergeRequestId, formatIssueId, getContextItemIcon, getContextItemTypeLabel, getContextItemSecondaryText, getContextItemSource } from '../utils';
|
|
8
|
+
import GlBadge from '../../../../../../base/badge/badge';
|
|
8
9
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
9
10
|
|
|
10
11
|
var script = {
|
|
11
12
|
name: 'DuoChatContextItemPopover',
|
|
12
13
|
components: {
|
|
14
|
+
GlBadge,
|
|
13
15
|
GlTruncate,
|
|
14
16
|
GlAlert,
|
|
15
17
|
GlIcon,
|
|
@@ -64,9 +66,6 @@ var script = {
|
|
|
64
66
|
var _this$filePath;
|
|
65
67
|
return (_this$filePath = this.filePath) === null || _this$filePath === void 0 ? void 0 : _this$filePath.split('/');
|
|
66
68
|
},
|
|
67
|
-
gitDetails() {
|
|
68
|
-
return this.contextItem.category === CONTEXT_ITEM_CATEGORY_LOCAL_GIT ? formatGitItemSecondaryText(this.contextItem) : null;
|
|
69
|
-
},
|
|
70
69
|
isEnabled() {
|
|
71
70
|
return this.contextItem.metadata.enabled !== false;
|
|
72
71
|
},
|
|
@@ -78,6 +77,12 @@ var script = {
|
|
|
78
77
|
},
|
|
79
78
|
itemTypeLabel() {
|
|
80
79
|
return getContextItemTypeLabel(this.contextItem);
|
|
80
|
+
},
|
|
81
|
+
secondaryText() {
|
|
82
|
+
return getContextItemSecondaryText(this.contextItem);
|
|
83
|
+
},
|
|
84
|
+
itemSource() {
|
|
85
|
+
return getContextItemSource(this.contextItem);
|
|
81
86
|
}
|
|
82
87
|
},
|
|
83
88
|
methods: {
|
|
@@ -89,7 +94,7 @@ var script = {
|
|
|
89
94
|
const __vue_script__ = script;
|
|
90
95
|
|
|
91
96
|
/* template */
|
|
92
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-popover',{attrs:{"target":_vm.target,"triggers":"hover focus","placement":_vm.placement,"title":_vm.title,"custom-class":"gl-duo-chat-item-popover"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',[_c('div',{staticClass:"gl-heading-3 gl-mb-1 gl-mt-2 gl-leading-1",attrs:{"data-testid":"chat-context-popover-title"}},[_vm._v("\n "+_vm._s(_vm.title)+"\n ")]),_vm._v(" "),(_vm.itemTypeLabel)?_c('div',{staticClass:"gl-font-normal gl-text-subtle"},[
|
|
97
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-popover',{attrs:{"target":_vm.target,"triggers":"hover focus","placement":_vm.placement,"title":_vm.title,"custom-class":"gl-duo-chat-item-popover"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',[_c('div',{staticClass:"gl-heading-3 gl-mb-1 gl-mt-2 gl-leading-1",attrs:{"data-testid":"chat-context-popover-title"}},[_vm._v("\n "+_vm._s(_vm.title)+"\n ")]),_vm._v(" "),(_vm.itemTypeLabel)?_c('div',{staticClass:"gl-flex gl-items-center gl-font-normal gl-text-subtle"},[_c('gl-truncate',{staticClass:"gl-min-w-0",attrs:{"text":_vm.itemTypeLabel}})],1):_vm._e()])]},proxy:true}])},[_vm._v(" "),_c('div',[(_vm.secondaryText)?_c('div',{staticClass:"gl-flex gl-items-center"},[_c('gl-icon',{staticClass:"gl-mr-1 gl-shrink-0",attrs:{"name":_vm.iconName,"size":12,"variant":"subtle"}}),_vm._v(" "),(_vm.itemSource)?_c('gl-badge',{staticClass:"gl-mr-1"},[_vm._v(_vm._s(_vm.itemSource))]):_vm._e(),_vm._v(" "),_c('gl-truncate',{staticClass:"gl-min-w-0",attrs:{"text":_vm.secondaryText}})],1):(_vm.filePath)?_c('div',[_c('gl-icon',{attrs:{"name":"document","size":12,"variant":"subtle"}}),_vm._v(" "),_c('span',{staticClass:"gl-break-all"},[_vm._v(_vm._s(_vm.contextItem.metadata.project))]),_vm._v(" "),_vm._l((_vm.filePathArray),function(pathPart,index){return _c('span',{key:pathPart,staticClass:"gl-break-all"},[_vm._v(_vm._s(pathPart)+_vm._s(index + 1 < _vm.filePathArray.length ? '/' : ''))])})],2):_c('div',[(_vm.iconName)?_c('gl-icon',{attrs:{"name":_vm.iconName,"size":12,"variant":"subtle"}}):_vm._e(),_vm._v(" "),_c('span',{staticClass:"gl-break-all"},[_vm._v(_vm._s(_vm.contextItem.metadata.project))]),_vm._v(" "),(_vm.id)?_c('span',{staticClass:"gl-break-all"},[_vm._v(_vm._s(_vm.formattedId))]):_vm._e()],1),_vm._v(" "),(!_vm.isEnabled)?_c('gl-alert',{staticClass:"gl-mb-1 gl-mt-3 gl-p-4 gl-text-sm",attrs:{"variant":"danger","data-testid":"chat-context-popover-disabled","dismissible":false,"show-icon":false}},[_vm._v("\n "+_vm._s(_vm.disabledMessage)+"\n ")]):_vm._e()],1)])};
|
|
93
98
|
var __vue_staticRenderFns__ = [];
|
|
94
99
|
|
|
95
100
|
/* style */
|
package/dist/components/experimental/duo/chat/components/duo_chat_context/mock_context_data.js
CHANGED
|
@@ -39,6 +39,9 @@ const MOCK_CONTEXT_ITEM_FILE = {
|
|
|
39
39
|
metadata: {
|
|
40
40
|
enabled: true,
|
|
41
41
|
title: 'strawberry.ts',
|
|
42
|
+
secondaryText: 'src/plants/strawberry.ts',
|
|
43
|
+
subTypeLabel: 'Project file',
|
|
44
|
+
icon: 'document',
|
|
42
45
|
project: 'example/garden',
|
|
43
46
|
relativePath: 'src/plants/strawberry.ts'
|
|
44
47
|
}
|
|
@@ -49,6 +52,9 @@ const MOCK_CONTEXT_ITEM_FILE_DISABLED = {
|
|
|
49
52
|
metadata: {
|
|
50
53
|
enabled: false,
|
|
51
54
|
title: 'motorbike.cs',
|
|
55
|
+
secondaryText: '/src/VehicleFoo/motorbike.cs',
|
|
56
|
+
subTypeLabel: 'Project file',
|
|
57
|
+
icon: 'document',
|
|
52
58
|
project: 'example/vehicles',
|
|
53
59
|
relativePath: '/src/VehicleFoo/motorbike.cs'
|
|
54
60
|
}
|
|
@@ -59,6 +65,9 @@ const mockFiles = [MOCK_CONTEXT_ITEM_FILE, {
|
|
|
59
65
|
metadata: {
|
|
60
66
|
enabled: true,
|
|
61
67
|
title: 'potato.ts',
|
|
68
|
+
secondaryText: '/src/plants/potato.ts',
|
|
69
|
+
subTypeLabel: 'Project file',
|
|
70
|
+
icon: 'document',
|
|
62
71
|
project: 'example/garden',
|
|
63
72
|
relativePath: '/src/plants/potato.ts'
|
|
64
73
|
}
|
|
@@ -69,7 +78,9 @@ const MOCK_CONTEXT_ITEM_ISSUE = {
|
|
|
69
78
|
metadata: {
|
|
70
79
|
enabled: true,
|
|
71
80
|
title: 'Implement watering schedule',
|
|
72
|
-
|
|
81
|
+
secondaryText: 'example/garden#1234',
|
|
82
|
+
subTypeLabel: 'Issue',
|
|
83
|
+
icon: 'issues',
|
|
73
84
|
iid: 1234
|
|
74
85
|
}
|
|
75
86
|
};
|
|
@@ -80,7 +91,9 @@ const MOCK_CONTEXT_ITEM_ISSUE_DISABLED = {
|
|
|
80
91
|
enabled: false,
|
|
81
92
|
disabledReasons: ['This foo is not available to bar', 'Lorem something something wow?'],
|
|
82
93
|
title: `Fix vehicle colours and make them look real nice and colourful won't that be wonderful wow this issue title is really long I sure hope it's gonna wrap OK`,
|
|
83
|
-
|
|
94
|
+
secondaryText: 'example/vehicle#91011',
|
|
95
|
+
subTypeLabel: 'Issue',
|
|
96
|
+
icon: 'issues',
|
|
84
97
|
iid: 91011
|
|
85
98
|
}
|
|
86
99
|
};
|
|
@@ -90,7 +103,9 @@ const mockIssues = [MOCK_CONTEXT_ITEM_ISSUE, {
|
|
|
90
103
|
metadata: {
|
|
91
104
|
enabled: true,
|
|
92
105
|
title: 'Refactor plant growth rates',
|
|
93
|
-
|
|
106
|
+
secondaryText: 'example/garden#5678',
|
|
107
|
+
subTypeLabel: 'Issue',
|
|
108
|
+
icon: 'issues',
|
|
94
109
|
iid: 5678
|
|
95
110
|
}
|
|
96
111
|
}, MOCK_CONTEXT_ITEM_ISSUE_DISABLED];
|
|
@@ -100,7 +115,9 @@ const MOCK_CONTEXT_ITEM_MERGE_REQUEST = {
|
|
|
100
115
|
metadata: {
|
|
101
116
|
enabled: true,
|
|
102
117
|
title: 'Improve database performance',
|
|
103
|
-
|
|
118
|
+
secondaryText: 'example/garden!1122',
|
|
119
|
+
subTypeLabel: 'Merge request',
|
|
120
|
+
icon: 'merge-request',
|
|
104
121
|
iid: 1122
|
|
105
122
|
}
|
|
106
123
|
};
|
|
@@ -111,7 +128,9 @@ const MOCK_CONTEXT_ITEM_MERGE_REQUEST_DISABLED = {
|
|
|
111
128
|
enabled: false,
|
|
112
129
|
disabledReasons: ['This foo is not available to bar', 'Lorem something something wow?'],
|
|
113
130
|
title: 'Fix broken layout at small viewports',
|
|
114
|
-
|
|
131
|
+
secondaryText: 'example/vehicle!5566',
|
|
132
|
+
subTypeLabel: 'Merge request',
|
|
133
|
+
icon: 'merge-request',
|
|
115
134
|
iid: 5566
|
|
116
135
|
}
|
|
117
136
|
};
|
|
@@ -122,7 +141,9 @@ const mockMergeRequests = [MOCK_CONTEXT_ITEM_MERGE_REQUEST, {
|
|
|
122
141
|
enabled: false,
|
|
123
142
|
disabledReasons: ['This foo is not available to bar', 'Lorem something something wow?'],
|
|
124
143
|
title: 'Add vehicle registration details',
|
|
125
|
-
|
|
144
|
+
secondaryText: 'example/vehicle!3344',
|
|
145
|
+
subTypeLabel: 'Merge request',
|
|
146
|
+
icon: 'merge-request',
|
|
126
147
|
iid: 3344
|
|
127
148
|
}
|
|
128
149
|
}, MOCK_CONTEXT_ITEM_MERGE_REQUEST_DISABLED];
|
|
@@ -132,6 +153,10 @@ const MOCK_CONTEXT_ITEM_GIT_DIFF = {
|
|
|
132
153
|
metadata: {
|
|
133
154
|
enabled: true,
|
|
134
155
|
title: 'Current working changes',
|
|
156
|
+
secondaryText: 'main',
|
|
157
|
+
subType: 'local_git',
|
|
158
|
+
subTypeLabel: 'Local Git repository diff',
|
|
159
|
+
icon: 'comparison',
|
|
135
160
|
commitId: 'main',
|
|
136
161
|
repositoryName: 'example/garden',
|
|
137
162
|
gitType: 'diff'
|
|
@@ -143,6 +168,10 @@ const MOCK_CONTEXT_ITEM_GIT_COMMIT = {
|
|
|
143
168
|
metadata: {
|
|
144
169
|
enabled: true,
|
|
145
170
|
title: 'fix: some bug fix commit',
|
|
171
|
+
secondaryText: '20f8caf94cb8f5e5f9dbd1a9ac32702321de201b',
|
|
172
|
+
subType: 'local_git',
|
|
173
|
+
subTypeLabel: 'Local Git repository commit',
|
|
174
|
+
icon: 'commit',
|
|
146
175
|
commitId: '20f8caf94cb8f5e5f9dbd1a9ac32702321de201b',
|
|
147
176
|
repositoryName: 'example/garden',
|
|
148
177
|
gitType: 'commit'
|
|
@@ -154,6 +183,9 @@ const mockGitItems = [MOCK_CONTEXT_ITEM_GIT_DIFF, {
|
|
|
154
183
|
metadata: {
|
|
155
184
|
enabled: true,
|
|
156
185
|
title: 'Diff from default branch',
|
|
186
|
+
secondaryText: 'main',
|
|
187
|
+
subTypeLabel: 'Local Git repository diff',
|
|
188
|
+
icon: 'comparison',
|
|
157
189
|
commitId: 'main',
|
|
158
190
|
repositoryName: 'example/garden',
|
|
159
191
|
gitType: 'diff'
|
|
@@ -164,6 +196,9 @@ const mockGitItems = [MOCK_CONTEXT_ITEM_GIT_DIFF, {
|
|
|
164
196
|
metadata: {
|
|
165
197
|
enabled: true,
|
|
166
198
|
title: 'feat: add cool new feature',
|
|
199
|
+
secondaryText: '32b9b56b6de75b32909986755fbc470f20fb6fc0',
|
|
200
|
+
subTypeLabel: 'Local Git repository commit',
|
|
201
|
+
icon: 'commit',
|
|
167
202
|
commitId: '32b9b56b6de75b32909986755fbc470f20fb6fc0',
|
|
168
203
|
repositoryName: 'example/garden',
|
|
169
204
|
gitType: 'commit'
|
|
@@ -174,6 +209,9 @@ const mockGitItems = [MOCK_CONTEXT_ITEM_GIT_DIFF, {
|
|
|
174
209
|
metadata: {
|
|
175
210
|
enabled: true,
|
|
176
211
|
title: 'fix: stop foo from bar when baz because customers ding',
|
|
212
|
+
secondaryText: '775d7efdce25c1af48c55abcadbefd1f181b92ce',
|
|
213
|
+
subTypeLabel: 'Local Git repository commit',
|
|
214
|
+
icon: 'commit',
|
|
177
215
|
commitId: '775d7efdce25c1af48c55abcadbefd1f181b92ce',
|
|
178
216
|
repositoryName: 'example/garden',
|
|
179
217
|
gitType: 'commit'
|
|
@@ -24,6 +24,9 @@ function formatMergeRequestId(iid) {
|
|
|
24
24
|
if (!iid) return '';
|
|
25
25
|
return `!${iid}`;
|
|
26
26
|
}
|
|
27
|
+
function getContextItemSource(contextItem) {
|
|
28
|
+
return contextItem.metadata.repositoryName || contextItem.metadata.project || null;
|
|
29
|
+
}
|
|
27
30
|
function getGitItemIcon(contextItem) {
|
|
28
31
|
const iconMap = {
|
|
29
32
|
[CONTEXT_ITEM_LOCAL_GIT_COMMIT]: 'commit',
|
|
@@ -42,6 +45,9 @@ function getContextItemIcon(contextItem) {
|
|
|
42
45
|
let category = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
43
46
|
icon: null
|
|
44
47
|
};
|
|
48
|
+
if (contextItem.metadata.icon) {
|
|
49
|
+
return contextItem.metadata.icon;
|
|
50
|
+
}
|
|
45
51
|
if (contextItem.category === CONTEXT_ITEM_CATEGORY_LOCAL_GIT) {
|
|
46
52
|
const gitIcon = getGitItemIcon(contextItem);
|
|
47
53
|
if (gitIcon) return gitIcon;
|
|
@@ -58,6 +64,9 @@ function getContextItemIcon(contextItem) {
|
|
|
58
64
|
return iconMap[contextItem.category] || null;
|
|
59
65
|
}
|
|
60
66
|
function getContextItemTypeLabel(contextItem) {
|
|
67
|
+
if (contextItem.metadata.subTypeLabel) {
|
|
68
|
+
return contextItem.metadata.subTypeLabel;
|
|
69
|
+
}
|
|
61
70
|
if (contextItem.category === CONTEXT_ITEM_CATEGORY_LOCAL_GIT) {
|
|
62
71
|
switch (contextItem.metadata.gitType) {
|
|
63
72
|
case CONTEXT_ITEM_LOCAL_GIT_DIFF:
|
|
@@ -91,6 +100,23 @@ function formatGitItemSecondaryText(contextItem) {
|
|
|
91
100
|
const separator = commitId ? ' - ' : '';
|
|
92
101
|
return `${repositoryName}${separator}${commitId || ''}`;
|
|
93
102
|
}
|
|
103
|
+
function getContextItemSecondaryText(contextItem) {
|
|
104
|
+
if (contextItem.metadata.secondaryText) {
|
|
105
|
+
return contextItem.metadata.secondaryText;
|
|
106
|
+
}
|
|
107
|
+
switch (contextItem.category) {
|
|
108
|
+
case CONTEXT_ITEM_CATEGORY_FILE:
|
|
109
|
+
return contextItem.metadata.relativePath;
|
|
110
|
+
case CONTEXT_ITEM_CATEGORY_ISSUE:
|
|
111
|
+
return formatIssueId(contextItem.metadata.iid);
|
|
112
|
+
case CONTEXT_ITEM_CATEGORY_MERGE_REQUEST:
|
|
113
|
+
return formatMergeRequestId(contextItem.metadata.iid);
|
|
114
|
+
case CONTEXT_ITEM_CATEGORY_LOCAL_GIT:
|
|
115
|
+
return formatGitItemSecondaryText(contextItem);
|
|
116
|
+
default:
|
|
117
|
+
return '';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
94
120
|
|
|
95
121
|
/**
|
|
96
122
|
* Calculates a new index within a range. If the new index would fall out of bounds, wraps to the start/end of the range.
|
|
@@ -103,4 +129,4 @@ function wrapIndex(currentIndex, step, totalLength) {
|
|
|
103
129
|
return (currentIndex + step + totalLength) % totalLength;
|
|
104
130
|
}
|
|
105
131
|
|
|
106
|
-
export { categoriesValidator, categoryValidator, contextItemValidator, contextItemsValidator, formatGitItemSecondaryText, formatIssueId, formatMergeRequestId, getContextItemIcon, getContextItemTypeLabel, wrapIndex };
|
|
132
|
+
export { categoriesValidator, categoryValidator, contextItemValidator, contextItemsValidator, formatGitItemSecondaryText, formatIssueId, formatMergeRequestId, getContextItemIcon, getContextItemSecondaryText, getContextItemSource, getContextItemTypeLabel, wrapIndex };
|