@codingame/monaco-vscode-notifications-service-override 2.1.4 → 2.2.0-next.2
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/notifications.js +5 -7
- package/package.json +3 -4
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsActions.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsCenter.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsList.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsToasts.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsActions.js +0 -215
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsAlerts.js +0 -75
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCenter.js +0 -309
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsList.js +0 -228
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsStatus.js +0 -220
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsToasts.js +0 -435
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsViewer.js +0 -438
|
@@ -1,438 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { clearNode, $, EventType, addDisposableListener, EventHelper, isEventLike } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
-
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
4
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
5
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
6
|
-
import { ButtonBar } from 'vscode/vscode/vs/base/browser/ui/button/button';
|
|
7
|
-
import { ActionBar } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionbar';
|
|
8
|
-
import { toAction, Separator, ActionRunner } from 'vscode/vscode/vs/base/common/actions';
|
|
9
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
10
|
-
import { DisposableStore, dispose, Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
11
|
-
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
|
|
12
|
-
import { NotificationViewItem, ChoiceAction } from 'vscode/vscode/vs/workbench/common/notifications';
|
|
13
|
-
import { ConfigureNotificationAction, ClearNotificationAction, ExpandNotificationAction, CollapseNotificationAction } from './notificationsActions.js';
|
|
14
|
-
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
15
|
-
import { ProgressBar } from 'vscode/vscode/vs/base/browser/ui/progressbar/progressbar';
|
|
16
|
-
import { isNotificationSource, NotificationsFilter, Severity, INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
|
|
17
|
-
import { isNonEmptyArray } from 'vscode/vscode/vs/base/common/arrays';
|
|
18
|
-
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
19
|
-
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
20
|
-
import { DropdownMenuActionViewItem } from 'vscode/vscode/vs/base/browser/ui/dropdown/dropdownActionViewItem';
|
|
21
|
-
import { DomEmitter } from 'vscode/vscode/vs/base/browser/event';
|
|
22
|
-
import { Gesture, EventType as EventType$1 } from 'vscode/vscode/vs/base/browser/touch';
|
|
23
|
-
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
24
|
-
import { defaultProgressBarStyles, defaultButtonStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
|
|
25
|
-
import { StandardKeyboardEvent } from 'vscode/vscode/vs/base/browser/keyboardEvent';
|
|
26
|
-
|
|
27
|
-
var NotificationRenderer_1, NotificationTemplateRenderer_1;
|
|
28
|
-
class NotificationsListDelegate {
|
|
29
|
-
static { this.ROW_HEIGHT = 42; }
|
|
30
|
-
static { this.LINE_HEIGHT = 22; }
|
|
31
|
-
constructor(container) {
|
|
32
|
-
this.offsetHelper = this.createOffsetHelper(container);
|
|
33
|
-
}
|
|
34
|
-
createOffsetHelper(container) {
|
|
35
|
-
const offsetHelper = document.createElement('div');
|
|
36
|
-
offsetHelper.classList.add('notification-offset-helper');
|
|
37
|
-
container.appendChild(offsetHelper);
|
|
38
|
-
return offsetHelper;
|
|
39
|
-
}
|
|
40
|
-
getHeight(notification) {
|
|
41
|
-
if (!notification.expanded) {
|
|
42
|
-
return NotificationsListDelegate.ROW_HEIGHT;
|
|
43
|
-
}
|
|
44
|
-
let expandedHeight = NotificationsListDelegate.ROW_HEIGHT;
|
|
45
|
-
const preferredMessageHeight = this.computePreferredHeight(notification);
|
|
46
|
-
const messageOverflows = NotificationsListDelegate.LINE_HEIGHT < preferredMessageHeight;
|
|
47
|
-
if (messageOverflows) {
|
|
48
|
-
const overflow = preferredMessageHeight - NotificationsListDelegate.LINE_HEIGHT;
|
|
49
|
-
expandedHeight += overflow;
|
|
50
|
-
}
|
|
51
|
-
if (notification.source || isNonEmptyArray(notification.actions && notification.actions.primary)) {
|
|
52
|
-
expandedHeight += NotificationsListDelegate.ROW_HEIGHT;
|
|
53
|
-
}
|
|
54
|
-
if (expandedHeight === NotificationsListDelegate.ROW_HEIGHT) {
|
|
55
|
-
notification.collapse(true );
|
|
56
|
-
}
|
|
57
|
-
return expandedHeight;
|
|
58
|
-
}
|
|
59
|
-
computePreferredHeight(notification) {
|
|
60
|
-
let actions = 0;
|
|
61
|
-
if (!notification.hasProgress) {
|
|
62
|
-
actions++;
|
|
63
|
-
}
|
|
64
|
-
if (notification.canCollapse) {
|
|
65
|
-
actions++;
|
|
66
|
-
}
|
|
67
|
-
if (isNonEmptyArray(notification.actions && notification.actions.secondary)) {
|
|
68
|
-
actions++;
|
|
69
|
-
}
|
|
70
|
-
this.offsetHelper.style.width = `${450 - ((10 + 30 + (actions * 30) - (Math.max(actions - 1, 0) * 4)) )}px`;
|
|
71
|
-
const renderedMessage = NotificationMessageRenderer.render(notification.message);
|
|
72
|
-
this.offsetHelper.appendChild(renderedMessage);
|
|
73
|
-
const preferredHeight = Math.max(this.offsetHelper.offsetHeight, this.offsetHelper.scrollHeight);
|
|
74
|
-
clearNode(this.offsetHelper);
|
|
75
|
-
return preferredHeight;
|
|
76
|
-
}
|
|
77
|
-
getTemplateId(element) {
|
|
78
|
-
if (element instanceof NotificationViewItem) {
|
|
79
|
-
return NotificationRenderer.TEMPLATE_ID;
|
|
80
|
-
}
|
|
81
|
-
throw new Error('unknown element type: ' + element);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
class NotificationMessageRenderer {
|
|
85
|
-
static render(message, actionHandler) {
|
|
86
|
-
const messageContainer = document.createElement('span');
|
|
87
|
-
for (const node of message.linkedText.nodes) {
|
|
88
|
-
if (typeof node === 'string') {
|
|
89
|
-
messageContainer.appendChild(document.createTextNode(node));
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
let title = node.title;
|
|
93
|
-
if (!title && node.href.startsWith('command:')) {
|
|
94
|
-
title = ( localizeWithPath(
|
|
95
|
-
'vs/workbench/browser/parts/notifications/notificationsViewer',
|
|
96
|
-
'executeCommand',
|
|
97
|
-
"Click to execute command '{0}'",
|
|
98
|
-
node.href.substr('command:'.length)
|
|
99
|
-
));
|
|
100
|
-
}
|
|
101
|
-
else if (!title) {
|
|
102
|
-
title = node.href;
|
|
103
|
-
}
|
|
104
|
-
const anchor = $('a', { href: node.href, title, tabIndex: 0 }, node.label);
|
|
105
|
-
if (actionHandler) {
|
|
106
|
-
const handleOpen = (e) => {
|
|
107
|
-
if (isEventLike(e)) {
|
|
108
|
-
EventHelper.stop(e, true);
|
|
109
|
-
}
|
|
110
|
-
actionHandler.callback(node.href);
|
|
111
|
-
};
|
|
112
|
-
const onClick = actionHandler.toDispose.add(( new DomEmitter(anchor, EventType.CLICK))).event;
|
|
113
|
-
const onKeydown = actionHandler.toDispose.add(( new DomEmitter(anchor, EventType.KEY_DOWN))).event;
|
|
114
|
-
const onSpaceOrEnter = Event.chain(onKeydown, $ => $.filter(e => {
|
|
115
|
-
const event = ( new StandardKeyboardEvent(e));
|
|
116
|
-
return event.equals(10 ) || event.equals(3 );
|
|
117
|
-
}));
|
|
118
|
-
actionHandler.toDispose.add(Gesture.addTarget(anchor));
|
|
119
|
-
const onTap = actionHandler.toDispose.add(( new DomEmitter(anchor, EventType$1.Tap))).event;
|
|
120
|
-
Event.any(onClick, onTap, onSpaceOrEnter)(handleOpen, null, actionHandler.toDispose);
|
|
121
|
-
}
|
|
122
|
-
messageContainer.appendChild(anchor);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return messageContainer;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
let NotificationRenderer = class NotificationRenderer {
|
|
129
|
-
static { NotificationRenderer_1 = this; }
|
|
130
|
-
static { this.TEMPLATE_ID = 'notification'; }
|
|
131
|
-
constructor(actionRunner, contextMenuService, instantiationService, notificationService) {
|
|
132
|
-
this.actionRunner = actionRunner;
|
|
133
|
-
this.contextMenuService = contextMenuService;
|
|
134
|
-
this.instantiationService = instantiationService;
|
|
135
|
-
this.notificationService = notificationService;
|
|
136
|
-
}
|
|
137
|
-
get templateId() {
|
|
138
|
-
return NotificationRenderer_1.TEMPLATE_ID;
|
|
139
|
-
}
|
|
140
|
-
renderTemplate(container) {
|
|
141
|
-
const data = Object.create(null);
|
|
142
|
-
data.toDispose = ( new DisposableStore());
|
|
143
|
-
data.container = document.createElement('div');
|
|
144
|
-
data.container.classList.add('notification-list-item');
|
|
145
|
-
data.mainRow = document.createElement('div');
|
|
146
|
-
data.mainRow.classList.add('notification-list-item-main-row');
|
|
147
|
-
data.icon = document.createElement('div');
|
|
148
|
-
data.icon.classList.add('notification-list-item-icon', 'codicon');
|
|
149
|
-
data.message = document.createElement('div');
|
|
150
|
-
data.message.classList.add('notification-list-item-message');
|
|
151
|
-
const that = this;
|
|
152
|
-
const toolbarContainer = document.createElement('div');
|
|
153
|
-
toolbarContainer.classList.add('notification-list-item-toolbar-container');
|
|
154
|
-
data.toolbar = ( new ActionBar(toolbarContainer, {
|
|
155
|
-
ariaLabel: ( localizeWithPath(
|
|
156
|
-
'vs/workbench/browser/parts/notifications/notificationsViewer',
|
|
157
|
-
'notificationActions',
|
|
158
|
-
"Notification Actions"
|
|
159
|
-
)),
|
|
160
|
-
actionViewItemProvider: action => {
|
|
161
|
-
if (action instanceof ConfigureNotificationAction) {
|
|
162
|
-
return data.toDispose.add(( new DropdownMenuActionViewItem(action, {
|
|
163
|
-
getActions() {
|
|
164
|
-
const actions = [];
|
|
165
|
-
const source = { id: action.notification.sourceId, label: action.notification.source };
|
|
166
|
-
if (isNotificationSource(source)) {
|
|
167
|
-
const isSourceFiltered = that.notificationService.getFilter(source) === NotificationsFilter.ERROR;
|
|
168
|
-
actions.push(toAction({
|
|
169
|
-
id: source.id,
|
|
170
|
-
label: isSourceFiltered ? ( localizeWithPath(
|
|
171
|
-
'vs/workbench/browser/parts/notifications/notificationsViewer',
|
|
172
|
-
'turnOnNotifications',
|
|
173
|
-
"Turn On Notifications from '{0}'",
|
|
174
|
-
source.label
|
|
175
|
-
)) : ( localizeWithPath(
|
|
176
|
-
'vs/workbench/browser/parts/notifications/notificationsViewer',
|
|
177
|
-
'turnOffNotifications',
|
|
178
|
-
"Turn Off Notifications from '{0}'",
|
|
179
|
-
source.label
|
|
180
|
-
)),
|
|
181
|
-
run: () => that.notificationService.setFilter({ ...source, filter: isSourceFiltered ? NotificationsFilter.OFF : NotificationsFilter.ERROR })
|
|
182
|
-
}));
|
|
183
|
-
if (action.notification.actions?.secondary?.length) {
|
|
184
|
-
actions.push(( new Separator()));
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
if (Array.isArray(action.notification.actions?.secondary)) {
|
|
188
|
-
actions.push(...action.notification.actions.secondary);
|
|
189
|
-
}
|
|
190
|
-
return actions;
|
|
191
|
-
},
|
|
192
|
-
}, this.contextMenuService, {
|
|
193
|
-
actionRunner: this.actionRunner,
|
|
194
|
-
classNames: action.class
|
|
195
|
-
})));
|
|
196
|
-
}
|
|
197
|
-
return undefined;
|
|
198
|
-
},
|
|
199
|
-
actionRunner: this.actionRunner
|
|
200
|
-
}));
|
|
201
|
-
data.toDispose.add(data.toolbar);
|
|
202
|
-
data.detailsRow = document.createElement('div');
|
|
203
|
-
data.detailsRow.classList.add('notification-list-item-details-row');
|
|
204
|
-
data.source = document.createElement('div');
|
|
205
|
-
data.source.classList.add('notification-list-item-source');
|
|
206
|
-
data.buttonsContainer = document.createElement('div');
|
|
207
|
-
data.buttonsContainer.classList.add('notification-list-item-buttons-container');
|
|
208
|
-
container.appendChild(data.container);
|
|
209
|
-
data.container.appendChild(data.detailsRow);
|
|
210
|
-
data.detailsRow.appendChild(data.source);
|
|
211
|
-
data.detailsRow.appendChild(data.buttonsContainer);
|
|
212
|
-
data.container.appendChild(data.mainRow);
|
|
213
|
-
data.mainRow.appendChild(data.icon);
|
|
214
|
-
data.mainRow.appendChild(data.message);
|
|
215
|
-
data.mainRow.appendChild(toolbarContainer);
|
|
216
|
-
data.progress = ( new ProgressBar(container, defaultProgressBarStyles));
|
|
217
|
-
data.toDispose.add(data.progress);
|
|
218
|
-
data.renderer = this.instantiationService.createInstance(NotificationTemplateRenderer, data, this.actionRunner);
|
|
219
|
-
data.toDispose.add(data.renderer);
|
|
220
|
-
return data;
|
|
221
|
-
}
|
|
222
|
-
renderElement(notification, index, data) {
|
|
223
|
-
data.renderer.setInput(notification);
|
|
224
|
-
}
|
|
225
|
-
disposeTemplate(templateData) {
|
|
226
|
-
dispose(templateData.toDispose);
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
NotificationRenderer = NotificationRenderer_1 = ( __decorate([
|
|
230
|
-
( __param(1, IContextMenuService)),
|
|
231
|
-
( __param(2, IInstantiationService)),
|
|
232
|
-
( __param(3, INotificationService))
|
|
233
|
-
], NotificationRenderer));
|
|
234
|
-
let NotificationTemplateRenderer = class NotificationTemplateRenderer extends Disposable {
|
|
235
|
-
static { NotificationTemplateRenderer_1 = this; }
|
|
236
|
-
static { this.SEVERITIES = [Severity.Info, Severity.Warning, Severity.Error]; }
|
|
237
|
-
constructor(template, actionRunner, openerService, instantiationService, keybindingService, contextMenuService) {
|
|
238
|
-
super();
|
|
239
|
-
this.template = template;
|
|
240
|
-
this.actionRunner = actionRunner;
|
|
241
|
-
this.openerService = openerService;
|
|
242
|
-
this.instantiationService = instantiationService;
|
|
243
|
-
this.keybindingService = keybindingService;
|
|
244
|
-
this.contextMenuService = contextMenuService;
|
|
245
|
-
this.inputDisposables = this._register(( new DisposableStore()));
|
|
246
|
-
if (!NotificationTemplateRenderer_1.closeNotificationAction) {
|
|
247
|
-
NotificationTemplateRenderer_1.closeNotificationAction = instantiationService.createInstance(ClearNotificationAction, ClearNotificationAction.ID, ClearNotificationAction.LABEL);
|
|
248
|
-
NotificationTemplateRenderer_1.expandNotificationAction = instantiationService.createInstance(ExpandNotificationAction, ExpandNotificationAction.ID, ExpandNotificationAction.LABEL);
|
|
249
|
-
NotificationTemplateRenderer_1.collapseNotificationAction = instantiationService.createInstance(CollapseNotificationAction, CollapseNotificationAction.ID, CollapseNotificationAction.LABEL);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
setInput(notification) {
|
|
253
|
-
this.inputDisposables.clear();
|
|
254
|
-
this.render(notification);
|
|
255
|
-
}
|
|
256
|
-
render(notification) {
|
|
257
|
-
this.template.container.classList.toggle('expanded', notification.expanded);
|
|
258
|
-
this.inputDisposables.add(addDisposableListener(this.template.container, EventType.MOUSE_UP, e => {
|
|
259
|
-
if (e.button === 1 ) {
|
|
260
|
-
EventHelper.stop(e, true);
|
|
261
|
-
}
|
|
262
|
-
}));
|
|
263
|
-
this.inputDisposables.add(addDisposableListener(this.template.container, EventType.AUXCLICK, e => {
|
|
264
|
-
if (!notification.hasProgress && e.button === 1 ) {
|
|
265
|
-
EventHelper.stop(e, true);
|
|
266
|
-
notification.close();
|
|
267
|
-
}
|
|
268
|
-
}));
|
|
269
|
-
this.renderSeverity(notification);
|
|
270
|
-
const messageOverflows = this.renderMessage(notification);
|
|
271
|
-
this.renderSecondaryActions(notification, messageOverflows);
|
|
272
|
-
this.renderSource(notification);
|
|
273
|
-
this.renderButtons(notification);
|
|
274
|
-
this.renderProgress(notification);
|
|
275
|
-
this.inputDisposables.add(notification.onDidChangeContent(event => {
|
|
276
|
-
switch (event.kind) {
|
|
277
|
-
case 0 :
|
|
278
|
-
this.renderSeverity(notification);
|
|
279
|
-
break;
|
|
280
|
-
case 3 :
|
|
281
|
-
this.renderProgress(notification);
|
|
282
|
-
break;
|
|
283
|
-
case 1 :
|
|
284
|
-
this.renderMessage(notification);
|
|
285
|
-
break;
|
|
286
|
-
}
|
|
287
|
-
}));
|
|
288
|
-
}
|
|
289
|
-
renderSeverity(notification) {
|
|
290
|
-
NotificationTemplateRenderer_1.SEVERITIES.forEach(severity => {
|
|
291
|
-
if (notification.severity !== severity) {
|
|
292
|
-
this.template.icon.classList.remove(...ThemeIcon.asClassNameArray(this.toSeverityIcon(severity)));
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
this.template.icon.classList.add(...ThemeIcon.asClassNameArray(this.toSeverityIcon(notification.severity)));
|
|
296
|
-
}
|
|
297
|
-
renderMessage(notification) {
|
|
298
|
-
clearNode(this.template.message);
|
|
299
|
-
this.template.message.appendChild(NotificationMessageRenderer.render(notification.message, {
|
|
300
|
-
callback: link => this.openerService.open(( URI.parse(link)), { allowCommands: true }),
|
|
301
|
-
toDispose: this.inputDisposables
|
|
302
|
-
}));
|
|
303
|
-
const messageOverflows = notification.canCollapse && !notification.expanded && this.template.message.scrollWidth > this.template.message.clientWidth;
|
|
304
|
-
if (messageOverflows) {
|
|
305
|
-
this.template.message.title = this.template.message.textContent + '';
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
this.template.message.removeAttribute('title');
|
|
309
|
-
}
|
|
310
|
-
return messageOverflows;
|
|
311
|
-
}
|
|
312
|
-
renderSecondaryActions(notification, messageOverflows) {
|
|
313
|
-
const actions = [];
|
|
314
|
-
if (isNonEmptyArray(notification.actions?.secondary)) {
|
|
315
|
-
const configureNotificationAction = this.instantiationService.createInstance(ConfigureNotificationAction, ConfigureNotificationAction.ID, ConfigureNotificationAction.LABEL, notification);
|
|
316
|
-
actions.push(configureNotificationAction);
|
|
317
|
-
this.inputDisposables.add(configureNotificationAction);
|
|
318
|
-
}
|
|
319
|
-
let showExpandCollapseAction = false;
|
|
320
|
-
if (notification.canCollapse) {
|
|
321
|
-
if (notification.expanded) {
|
|
322
|
-
showExpandCollapseAction = true;
|
|
323
|
-
}
|
|
324
|
-
else if (notification.source) {
|
|
325
|
-
showExpandCollapseAction = true;
|
|
326
|
-
}
|
|
327
|
-
else if (messageOverflows) {
|
|
328
|
-
showExpandCollapseAction = true;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
if (showExpandCollapseAction) {
|
|
332
|
-
actions.push(notification.expanded ? NotificationTemplateRenderer_1.collapseNotificationAction : NotificationTemplateRenderer_1.expandNotificationAction);
|
|
333
|
-
}
|
|
334
|
-
if (!notification.hasProgress) {
|
|
335
|
-
actions.push(NotificationTemplateRenderer_1.closeNotificationAction);
|
|
336
|
-
}
|
|
337
|
-
this.template.toolbar.clear();
|
|
338
|
-
this.template.toolbar.context = notification;
|
|
339
|
-
actions.forEach(action => this.template.toolbar.push(action, { icon: true, label: false, keybinding: this.getKeybindingLabel(action) }));
|
|
340
|
-
}
|
|
341
|
-
renderSource(notification) {
|
|
342
|
-
if (notification.expanded && notification.source) {
|
|
343
|
-
this.template.source.textContent = ( localizeWithPath(
|
|
344
|
-
'vs/workbench/browser/parts/notifications/notificationsViewer',
|
|
345
|
-
'notificationSource',
|
|
346
|
-
"Source: {0}",
|
|
347
|
-
notification.source
|
|
348
|
-
));
|
|
349
|
-
this.template.source.title = notification.source;
|
|
350
|
-
}
|
|
351
|
-
else {
|
|
352
|
-
this.template.source.textContent = '';
|
|
353
|
-
this.template.source.removeAttribute('title');
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
renderButtons(notification) {
|
|
357
|
-
clearNode(this.template.buttonsContainer);
|
|
358
|
-
const primaryActions = notification.actions ? notification.actions.primary : undefined;
|
|
359
|
-
if (notification.expanded && isNonEmptyArray(primaryActions)) {
|
|
360
|
-
const that = this;
|
|
361
|
-
const actionRunner = new (class extends ActionRunner {
|
|
362
|
-
async runAction(action) {
|
|
363
|
-
that.actionRunner.run(action, notification);
|
|
364
|
-
if (!(action instanceof ChoiceAction) || !action.keepOpen) {
|
|
365
|
-
notification.close();
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
})();
|
|
369
|
-
const buttonToolbar = this.inputDisposables.add(( new ButtonBar(this.template.buttonsContainer)));
|
|
370
|
-
for (let i = 0; i < primaryActions.length; i++) {
|
|
371
|
-
const action = primaryActions[i];
|
|
372
|
-
const options = {
|
|
373
|
-
title: true,
|
|
374
|
-
secondary: i > 0,
|
|
375
|
-
...defaultButtonStyles
|
|
376
|
-
};
|
|
377
|
-
const dropdownActions = action instanceof ChoiceAction ? action.menu : undefined;
|
|
378
|
-
const button = this.inputDisposables.add(dropdownActions ?
|
|
379
|
-
buttonToolbar.addButtonWithDropdown({
|
|
380
|
-
...options,
|
|
381
|
-
contextMenuProvider: this.contextMenuService,
|
|
382
|
-
actions: dropdownActions,
|
|
383
|
-
actionRunner
|
|
384
|
-
}) :
|
|
385
|
-
buttonToolbar.addButton(options));
|
|
386
|
-
button.label = action.label;
|
|
387
|
-
this.inputDisposables.add(button.onDidClick(e => {
|
|
388
|
-
if (e) {
|
|
389
|
-
EventHelper.stop(e, true);
|
|
390
|
-
}
|
|
391
|
-
actionRunner.run(action);
|
|
392
|
-
}));
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
renderProgress(notification) {
|
|
397
|
-
if (!notification.hasProgress) {
|
|
398
|
-
this.template.progress.stop().hide();
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
const state = notification.progress.state;
|
|
402
|
-
if (state.infinite) {
|
|
403
|
-
this.template.progress.infinite().show();
|
|
404
|
-
}
|
|
405
|
-
else if (typeof state.total === 'number' || typeof state.worked === 'number') {
|
|
406
|
-
if (typeof state.total === 'number' && !this.template.progress.hasTotal()) {
|
|
407
|
-
this.template.progress.total(state.total);
|
|
408
|
-
}
|
|
409
|
-
if (typeof state.worked === 'number') {
|
|
410
|
-
this.template.progress.setWorked(state.worked).show();
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
else {
|
|
414
|
-
this.template.progress.done().hide();
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
toSeverityIcon(severity) {
|
|
418
|
-
switch (severity) {
|
|
419
|
-
case Severity.Warning:
|
|
420
|
-
return Codicon.warning;
|
|
421
|
-
case Severity.Error:
|
|
422
|
-
return Codicon.error;
|
|
423
|
-
}
|
|
424
|
-
return Codicon.info;
|
|
425
|
-
}
|
|
426
|
-
getKeybindingLabel(action) {
|
|
427
|
-
const keybinding = this.keybindingService.lookupKeybinding(action.id);
|
|
428
|
-
return keybinding ? keybinding.getLabel() : null;
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
NotificationTemplateRenderer = NotificationTemplateRenderer_1 = ( __decorate([
|
|
432
|
-
( __param(2, IOpenerService)),
|
|
433
|
-
( __param(3, IInstantiationService)),
|
|
434
|
-
( __param(4, IKeybindingService)),
|
|
435
|
-
( __param(5, IContextMenuService))
|
|
436
|
-
], NotificationTemplateRenderer));
|
|
437
|
-
|
|
438
|
-
export { NotificationRenderer, NotificationTemplateRenderer, NotificationsListDelegate };
|