From 58a3af7eb6cf280b886725b2ba9081e0321d2cef Mon Sep 17 00:00:00 2001 From: meganrogge Date: Sun, 10 Jan 2021 15:11:52 -0800 Subject: [PATCH] update terminal notification id - check that it's updating --- .../browser/notificationsEditor.ts | 35 +++++++++++-------- .../terminal/browser/terminal.contribution.ts | 2 +- .../browser/notificationsEditorModel.ts | 5 +-- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/vs/workbench/contrib/preferences/browser/notificationsEditor.ts b/src/vs/workbench/contrib/preferences/browser/notificationsEditor.ts index bb2309cf3e5..563a21c74b9 100644 --- a/src/vs/workbench/contrib/preferences/browser/notificationsEditor.ts +++ b/src/vs/workbench/contrib/preferences/browser/notificationsEditor.ts @@ -10,10 +10,8 @@ import { dispose, Disposable, IDisposable, combinedDisposable } from 'vs/base/co import { Checkbox, ICheckboxOpts } from 'vs/base/browser/ui/checkbox/checkbox'; import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { KEYBINDING_ENTRY_TEMPLATE_ID } from 'vs/workbench/services/preferences/browser/keybindingsEditorModel'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { CONTEXT_KEYBINDINGS_EDITOR } from 'vs/workbench/contrib/preferences/common/preferences'; -import { IListVirtualDelegate, IListRenderer, IListContextMenuEvent } from 'vs/base/browser/ui/list/list'; import { IThemeService, registerThemingParticipant, IColorTheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService'; import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { listHighlightForeground, listActiveSelectionForeground, listInactiveSelectionForeground, listHoverForeground, listFocusForeground, editorBackground, foreground, listActiveSelectionBackground, listInactiveSelectionBackground, listFocusBackground, listHoverBackground } from 'vs/platform/theme/common/colorRegistry'; @@ -25,7 +23,9 @@ import { Color, RGBA } from 'vs/base/common/color'; import { WORKBENCH_BACKGROUND } from 'vs/workbench/common/theme'; import { INotificationItemEntry, INotificationsEditorPane, IListEntry, IKeybindingItemEntry, INotificationItem } from 'vs/workbench/services/preferences/common/preferences'; import { attachInputBoxStyler } from 'vs/platform/theme/common/styler'; +import { IListRenderer, IListContextMenuEvent, IListVirtualDelegate } from 'vs/base/browser/ui/list/list'; import { NotificationsEditorModel } from 'vs/workbench/services/preferences/browser/notificationsEditorModel'; +export const NOTIFICATION_ENTRY_TEMPLATE_ID = 'notification.entry.template'; const $ = DOM.$; @@ -101,7 +101,12 @@ export class NotificationsEditor extends EditorPane implements INotificationsEdi this.layoutNotificationsList(); } } - + renderElement(notificationItem: INotificationItem, index: number, template: NotificationItemTemplate): void { + template.parent.classList.toggle('odd', index % 2 === 1); + for (const column of template.columns) { + column.render(notificationItem); + } + } createEditor(parent: HTMLElement): void { const notificationsEditorElement = DOM.append(parent, $('div', { class: 'notifications-editor' })); @@ -151,7 +156,7 @@ export class NotificationsEditor extends EditorPane implements INotificationsEdi get activeNotificationEntry(): INotificationItemEntry | null { const focusedElement = this.notificationList.getFocusedElements()[0]; - return focusedElement && focusedElement.templateId === KEYBINDING_ENTRY_TEMPLATE_ID ? focusedElement : null; + return focusedElement && focusedElement.templateId === NOTIFICATION_ENTRY_TEMPLATE_ID ? focusedElement : null; } private createAriaLabelElement(parent: HTMLElement): void { @@ -282,7 +287,7 @@ export class NotificationsEditor extends EditorPane implements INotificationsEdi return; } - if (e.element.templateId === KEYBINDING_ENTRY_TEMPLATE_ID) { + if (e.element.templateId === NOTIFICATION_ENTRY_TEMPLATE_ID) { const entry = e.element; this.selectEntry(entry); } @@ -308,16 +313,18 @@ interface NotificationItemTemplate { class NotificationItemRenderer implements IListRenderer { - get templateId(): string { return KEYBINDING_ENTRY_TEMPLATE_ID; } + get templateId(): string { return NOTIFICATION_ENTRY_TEMPLATE_ID; } constructor( private notificationsEditor: NotificationsEditor, private instantiationService: IInstantiationService - ) { } + ) { + + } renderTemplate(parent: HTMLElement): NotificationItemTemplate { - parent.classList.add('keybinding-item'); + parent.classList.add('notification-item'); const neverShowAgain: NeverShowAgainColumn = this.instantiationService.createInstance(NeverShowAgainColumn, parent, this.notificationsEditor); const label: LabelColumn = this.instantiationService.createInstance(LabelColumn, parent, this.notificationsEditor); @@ -340,7 +347,7 @@ class NotificationItemRenderer implements IListRenderer(Extensions.Configuration); diff --git a/src/vs/workbench/services/preferences/browser/notificationsEditorModel.ts b/src/vs/workbench/services/preferences/browser/notificationsEditorModel.ts index 9cc030c5151..cca0db3bf7d 100644 --- a/src/vs/workbench/services/preferences/browser/notificationsEditorModel.ts +++ b/src/vs/workbench/services/preferences/browser/notificationsEditorModel.ts @@ -4,17 +4,18 @@ *--------------------------------------------------------------------------------------------*/ import { NotificationRegistry } from 'vs/platform/notification/common/notificationRegistry'; +import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { EditorModel } from 'vs/workbench/common/editor'; import { INotificationItem } from 'vs/workbench/services/preferences/common/preferences'; export class NotificationsEditorModel extends EditorModel { constructor( - // @INotificationService private readonly notificationService: INotificationService + @IStorageService private readonly storageService: IStorageService ) { super(); } get notificationItems(): INotificationItem[] { - return NotificationRegistry._notifications; + return NotificationRegistry._notifications.filter(notification => this.storageService.getBoolean(notification.id, StorageScope.GLOBAL)); } resolve(): Promise { return Promise.resolve(this); -- GitLab