TSGops -image (Light version of ADSWeb) (#17768)

* rough changes for adsweb-lite

* commit id of latest quality

* fix for aria label

* distro commit id changes

* merged latest changes distro id

* python path changes + quality name change

* Hide container views/settings/panel for ADSWeb

* undo unintentional change

* No python prompt changes for tsgops-image

* distro id changed for tsgops quality name

* changed quality name to tsgops

* changed name to tsgops-image

* python address change

* unintended changes undo

* correct python installation path for tsgops

* enable preview features tsgops

* no prompt for tsgops-lite image

* revert preview feature change

* Fixes for few comments

* removed extra line

* add deleted line

* Addressed comments

* Addressed final comments

* eslint error fix

* fix

Co-authored-by: Monica Gupta <mogupt@microsoft.com>
This commit is contained in:
Monica Gupta
2022-02-02 16:57:59 -08:00
committed by GitHub
parent 644d24ca13
commit 8685137c27
8 changed files with 186 additions and 40 deletions

View File

@@ -36,6 +36,7 @@ export const FILE_QUERY_EDITOR_TYPEID = 'workbench.editorInput.fileQueryInput';
export const RESOURCE_VIEWER_TYPEID = 'workbench.editorInput.resourceViewerInput';
export const JUPYTER_PROVIDER_ID = 'jupyter';
export const TSGOPS_WEB_QUALITY = 'tsgops-image';
// The version of the notebook file format that we support
export const NBFORMAT = 4;

View File

@@ -0,0 +1,59 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ICommandService } from 'vs/platform/commands/common/commands';
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchActionRegistry, Extensions as WorkbenchActionExtensions } from 'vs/workbench/common/actions';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { HideActivityBarViewContainers, HideSettings, HidePanel } from 'sql/workbench/contrib/tsgops/browser/tsgopsActions';
import { IWorkbenchContribution, Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
import product from 'vs/platform/product/common/product';
import { TSGOPS_WEB_QUALITY } from 'sql/workbench/common/constants';
export class ADSWebLite implements IWorkbenchContribution {
constructor(
@ICommandService private commandService: ICommandService,
) {
void this.createTSGOpsImage();
}
private async createTSGOpsImage(): Promise<void> {
await this.commandService.executeCommand('workbench.action.hideSettings');
await this.commandService.executeCommand('workbench.action.hidePanel');
await this.commandService.executeCommand('workbench.action.hideActivityBarViewContainers');
}
}
if (product.quality === TSGOPS_WEB_QUALITY) {
// Global Actions
const actionRegistry = Registry.as<IWorkbenchActionRegistry>(WorkbenchActionExtensions.WorkbenchActions);
actionRegistry.registerWorkbenchAction(
SyncActionDescriptor.create(
HideActivityBarViewContainers,
HideActivityBarViewContainers.ID,
HideActivityBarViewContainers.LABEL
),
HideActivityBarViewContainers.LABEL
);
actionRegistry.registerWorkbenchAction(
SyncActionDescriptor.create(
HideSettings,
HideSettings.ID,
HideSettings.LABEL
),
HideSettings.LABEL
);
actionRegistry.registerWorkbenchAction(
SyncActionDescriptor.create(
HidePanel,
HidePanel.ID,
HidePanel.LABEL
),
HidePanel.LABEL
);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
.registerWorkbenchContribution(ADSWebLite, LifecyclePhase.Restored);
}

View File

@@ -0,0 +1,64 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { Action } from 'vs/base/common/actions';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService';
export class HidePanel extends Action {
static readonly ID = 'workbench.action.hidePanel';
static readonly LABEL = localize('hidePanel', "Hide the panel");
constructor(
id: string = HidePanel.ID,
label: string = HidePanel.LABEL,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
) {
super(id, label);
}
override async run(): Promise<void> {
this.layoutService.setPanelHidden(true);
}
}
export class HideSettings extends Action {
static readonly ID = 'workbench.action.hideSettings';
static readonly LABEL = localize('hideSettings', "Hide the settings icon");
constructor(
id: string = HideSettings.ID,
label: string = HideSettings.LABEL,
) {
super(id, label);
}
override async run(): Promise<void> {
let allActionItems = Array.from(document.getElementsByClassName('action-item icon'));
let manageElement = allActionItems.filter((el) => el.getAttribute('aria-label') === 'Manage');
manageElement[0].parentNode.removeChild(manageElement[0]);
}
}
export class HideActivityBarViewContainers extends Action {
static readonly ID = 'workbench.action.hideActivityBarViewContainers';
static readonly LABEL = localize('hideActivityBarViewContainers', "Hide the extension viewlet");
constructor(
id: string = HideActivityBarViewContainers.ID,
label: string = HideActivityBarViewContainers.LABEL,
@IActivityBarService private readonly activityBarService: IActivityBarService,
) {
super(id, label);
}
override async run(): Promise<void> {
let viewsToHide = ['workbench.view.search', 'workbench.view.explorer', 'workbench.view.scm', 'workbench.view.extensions'];
for (let j = 0; j < viewsToHide.length; j++) {
this.activityBarService.hideViewContainer(viewsToHide[j]);
}
}
}