Skip to content

Commit 8fa79ca

Browse files
committed
Hide filesystem/workspaces UI if not available
1 parent dd51bf9 commit 8fa79ca

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

front_end/panels/sources/SourcesPanel.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,11 @@ export class SourcesPanel extends UI.Panel.Panel implements UI.ContextMenu.Provi
213213
constructor() {
214214
super('sources');
215215

216-
new UI.DropTarget.DropTarget(
216+
if (Root.Runtime.Runtime.isDescriptorEnabled({experiment: undefined, condition: Root.Runtime.ConditionName.NOT_SOURCES_HIDE_ADD_FOLDER})) {
217+
new UI.DropTarget.DropTarget(
217218
this.element, [UI.DropTarget.Type.Folder], i18nString(UIStrings.dropWorkspaceFolderHere),
218219
this.handleDrop.bind(this));
220+
}
219221

220222
this.workspace = Workspace.Workspace.WorkspaceImpl.instance();
221223
this.togglePauseAction =

front_end/panels/sources/SourcesView.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export class SourcesView extends Common.ObjectWrapper.eventMixin<EventTypes, typ
147147
const shortcuts = [
148148
{actionId: 'quickOpen.show', description: i18nString(UIStrings.openFile)},
149149
{actionId: 'commandMenu.show', description: i18nString(UIStrings.runCommand)},
150-
{actionId: 'sources.add-folder-to-workspace', description: i18nString(UIStrings.dropInAFolderToAddToWorkspace)},
150+
{actionId: 'sources.add-folder-to-workspace', description: i18nString(UIStrings.dropInAFolderToAddToWorkspace), condition: Root.Runtime.ConditionName.NOT_SOURCES_HIDE_ADD_FOLDER},
151151
];
152152

153153
const element = document.createElement('div');
@@ -158,6 +158,10 @@ export class SourcesView extends Common.ObjectWrapper.eventMixin<EventTypes, typ
158158

159159
for (let i = 0; i < shortcuts.length; i++) {
160160
const shortcut = shortcuts[i];
161+
const {condition} = shortcut;
162+
if (condition !== undefined && !Root.Runtime.Runtime.isDescriptorEnabled({experiment: undefined, condition})) {
163+
continue;
164+
}
161165
const shortcutKeyText = UI.ShortcutRegistry.ShortcutRegistry.instance().shortcutTitleForAction(shortcut.actionId);
162166
const listItemElement = list.createChild('div');
163167
UI.ARIAUtils.markAsListitem(listItemElement);
@@ -181,9 +185,10 @@ export class SourcesView extends Common.ObjectWrapper.eventMixin<EventTypes, typ
181185
}
182186
}
183187

184-
element.appendChild(
185-
UI.XLink.XLink.create('https://developer.chrome.com/docs/devtools/workspaces/', 'Learn more about Workspaces'));
186-
188+
if (Root.Runtime.Runtime.isDescriptorEnabled({experiment: undefined, condition: Root.Runtime.ConditionName.NOT_SOURCES_HIDE_ADD_FOLDER})) {
189+
element.appendChild(
190+
UI.XLink.XLink.create('https://developer.chrome.com/docs/devtools/workspaces/', 'Learn more about Workspaces'));
191+
}
187192
return element;
188193
}
189194

front_end/panels/sources/sources-meta.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ UI.ViewManager.registerViewExtension({
459459
const Sources = await loadSourcesModule();
460460
return Sources.SourcesNavigator.FilesNavigatorView.instance();
461461
},
462+
condition: Root.Runtime.ConditionName.NOT_SOURCES_HIDE_ADD_FOLDER,
462463
});
463464

464465
UI.ViewManager.registerViewExtension({

0 commit comments

Comments
 (0)