mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 01:25:38 -05:00
Port/welcomeflag (#10254)
* Put new welcome page behind preview features flag (#10099) * import correct welcome page (#10117) Co-authored-by: Anthony Dresser <andresse@microsoft.com>
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { localize } from 'vs/nls';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
|
||||
export abstract class AbstractEnablePreviewFeatures implements IWorkbenchContribution {
|
||||
|
||||
private static ENABLE_PREVIEW_FEATURES_SHOWN = 'workbench.enablePreviewFeaturesShown';
|
||||
|
||||
constructor(
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@IHostService private readonly hostService: IHostService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService
|
||||
) { }
|
||||
|
||||
protected handlePreviewFeatures(): void {
|
||||
let previewFeaturesEnabled = this.configurationService.getValue('workbench')['enablePreviewFeatures'];
|
||||
if (previewFeaturesEnabled || this.storageService.get(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, StorageScope.GLOBAL)) {
|
||||
return;
|
||||
}
|
||||
Promise.all([
|
||||
this.hostService.hasFocus,
|
||||
this.getWindowCount()
|
||||
]).then(async ([focused, count]) => {
|
||||
if (!focused && count > 1) {
|
||||
return null;
|
||||
}
|
||||
await this.configurationService.updateValue('workbench.enablePreviewFeatures', false);
|
||||
|
||||
const enablePreviewFeaturesNotice = localize('enablePreviewFeatures.notice', "Preview features are required in order for extensions to be fully supported and for some actions to be available. Would you like to enable preview features?");
|
||||
this.notificationService.prompt(
|
||||
Severity.Info,
|
||||
enablePreviewFeaturesNotice,
|
||||
[{
|
||||
label: localize('enablePreviewFeatures.yes', "Yes"),
|
||||
run: () => {
|
||||
this.configurationService.updateValue('workbench.enablePreviewFeatures', true).catch(e => onUnexpectedError(e));
|
||||
this.storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.GLOBAL);
|
||||
}
|
||||
}, {
|
||||
label: localize('enablePreviewFeatures.no', "No"),
|
||||
run: () => {
|
||||
this.configurationService.updateValue('workbench.enablePreviewFeatures', false).catch(e => onUnexpectedError(e));
|
||||
}
|
||||
}, {
|
||||
label: localize('enablePreviewFeatures.never', "No, don't show again"),
|
||||
run: () => {
|
||||
this.configurationService.updateValue('workbench.enablePreviewFeatures', false).catch(e => onUnexpectedError(e));
|
||||
this.storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.GLOBAL);
|
||||
},
|
||||
isSecondary: true
|
||||
}]
|
||||
);
|
||||
}).catch(e => onUnexpectedError(e));
|
||||
}
|
||||
|
||||
protected abstract getWindowCount(): Promise<number>;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { AbstractEnablePreviewFeatures } from 'sql/workbench/contrib/welcome/gettingStarted/browser/abstractEnablePreviewFeatures';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
export class BrowserEnablePreviewFeatures extends AbstractEnablePreviewFeatures {
|
||||
|
||||
constructor(
|
||||
@IStorageService storageService: IStorageService,
|
||||
@INotificationService notificationService: INotificationService,
|
||||
@IHostService hostService: IHostService,
|
||||
@IConfigurationService configurationService: IConfigurationService
|
||||
) {
|
||||
super(storageService, notificationService, hostService, configurationService);
|
||||
|
||||
this.handlePreviewFeatures();
|
||||
}
|
||||
|
||||
protected async getWindowCount(): Promise<number> {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { BrowserEnablePreviewFeatures } from 'sql/workbench/contrib/welcome/gettingStarted/browser/enablePreviewFeatures';
|
||||
|
||||
Registry
|
||||
.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(BrowserEnablePreviewFeatures, LifecyclePhase.Eventually);
|
||||
@@ -0,0 +1,30 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { AbstractEnablePreviewFeatures } from 'sql/workbench/contrib/welcome/gettingStarted/browser/abstractEnablePreviewFeatures';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IElectronService } from 'vs/platform/electron/node/electron';
|
||||
|
||||
export class NativeEnablePreviewFeatures extends AbstractEnablePreviewFeatures {
|
||||
|
||||
constructor(
|
||||
@IStorageService storageService: IStorageService,
|
||||
@INotificationService notificationService: INotificationService,
|
||||
@IHostService hostService: IHostService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IElectronService private readonly electronService: IElectronService
|
||||
) {
|
||||
super(storageService, notificationService, hostService, configurationService);
|
||||
|
||||
this.handlePreviewFeatures();
|
||||
}
|
||||
|
||||
protected getWindowCount(): Promise<number> {
|
||||
return this.electronService.getWindowCount();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { NativeEnablePreviewFeatures } from 'sql/workbench/contrib/welcome/gettingStarted/electron-browser/enablePreviewFeatures';
|
||||
|
||||
Registry
|
||||
.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(NativeEnablePreviewFeatures, LifecyclePhase.Eventually);
|
||||
@@ -0,0 +1,76 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { escape } from 'vs/base/common/strings';
|
||||
import { localize } from 'vs/nls';
|
||||
|
||||
export default () => `
|
||||
<div class="welcomePageContainer2">
|
||||
<div class="welcomePage2">
|
||||
<div class="title">
|
||||
<h1 class="caption">${escape(localize('welcomePage.azdata', "Azure Data Studio"))}</h1>
|
||||
<p class="subtitle detail"></p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="splash">
|
||||
<div class="section start">
|
||||
<h2 class="caption">${escape(localize('welcomePage.start', "Start"))}</h2>
|
||||
<ul>
|
||||
<li><a href="command:registeredServers.addConnection">${escape(localize('welcomePage.newConnection', "New connection"))}</a></li>
|
||||
<li><a href="command:workbench.action.files.newUntitledFile">${escape(localize('welcomePage.newQuery', "New query"))}</a></li>
|
||||
<li><a href="command:notebook.command.new">${escape(localize('welcomePage.newNotebook', "New notebook"))}</a></li>
|
||||
<li class="mac-only"><a href="command:workbench.action.files.openLocalFileFolder">${escape(localize('welcomePage.openFileMac', "Open file"))}</a></li>
|
||||
<li class="windows-only linux-only"><a href="command:workbench.action.files.openFile">${escape(localize('welcomePage.openFileLinuxPC', "Open file"))}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section deploy">
|
||||
<h2 class="caption">${escape(localize('welcomePage.deploy', "Deploy"))}</h2>
|
||||
<ul>
|
||||
<li><a href="command:azdata.resource.deploy">${escape(localize('welcomePage.newDeployment', "New Deployment…"))}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section recent">
|
||||
<h2 class="caption">${escape(localize('welcomePage.recent', "Recent"))}</h2>
|
||||
<ul class="list">
|
||||
<!-- Filled programmatically -->
|
||||
<li class="moreRecent"><a href="command:workbench.action.openRecent">${escape(localize('welcomePage.moreRecent', "More..."))}</a><span class="path detail if_shortcut" data-command="workbench.action.openRecent">(<span class="shortcut" data-command="workbench.action.openRecent"></span>)</span></li>
|
||||
</ul>
|
||||
<p class="none detail">${escape(localize('welcomePage.noRecentFolders', "No recent folders"))}</p>
|
||||
</div>
|
||||
<div class="section help">
|
||||
<h2 class="caption">${escape(localize('welcomePage.help', "Help"))}</h2>
|
||||
<ul>
|
||||
<li><a href="https://aka.ms/get-started-azdata">${escape(localize('welcomePage.gettingStarted', "Getting started"))}</a></li>
|
||||
<li><a href="https://aka.ms/azuredatastudio">${escape(localize('welcomePage.productDocumentation', "Documentation"))}</a></li>
|
||||
<li><a href="https://github.com/Microsoft/azuredatastudio/issues/new/choose">${escape(localize('welcomePage.reportIssue', "Report issue or feature request"))}</a></li>
|
||||
<li><a href="https://github.com/Microsoft/azuredatastudio">${escape(localize('welcomePage.gitHubRepository', "GitHub repository"))}</a></li>
|
||||
<li><a href="https://aka.ms/azuredatastudio-releasenotes">${escape(localize('welcomePage.releaseNotes', "Release notes"))}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<p class="showOnStartup"><input type="checkbox" id="showOnStartup" class="checkbox"> <label class="caption" for="showOnStartup">${escape(localize('welcomePage.showOnStartup', "Show welcome page on startup"))}</label></p>
|
||||
</div>
|
||||
<div class="commands">
|
||||
<div class="section customize">
|
||||
<h2 class="caption">${escape(localize('welcomePage.customize', "Customize"))}</h2>
|
||||
<div class="list">
|
||||
<div class="item selectTheme"><button data-href="command:workbench.view.extensions"><h3 class="caption">${escape(localize('welcomePage.extensions', "Extensions"))}</h3> <span class="detail">${escape(localize('welcomePage.extensionDescription', "Download extensions that you need, including the SQL Server Admin pack and more"))}</span></button></div>
|
||||
<div class="item selectTheme"><button data-href="command:workbench.action.openGlobalKeybindings"><h3 class="caption">${escape(localize('welcomePage.keyboardShortcut', "Keyboard Shortcuts"))}</h3> <span class="detail">${escape(localize('welcomePage.keyboardShortcutDescription', "Find your favorite commands and customize them"))}</span></button></div>
|
||||
<div class="item selectTheme"><button data-href="command:workbench.action.selectTheme"><h3 class="caption">${escape(localize('welcomePage.colorTheme', "Color theme"))}</h3> <span class="detail">${escape(localize('welcomePage.colorThemeDescription', "Make the editor and your code look the way you love"))}</span></button></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section learn">
|
||||
<h2 class="caption">${escape(localize('welcomePage.learn', "Learn"))}</h2>
|
||||
<div class="list">
|
||||
<div class="item showCommands"><button data-href="command:workbench.action.showCommands"><h3 class="caption">${escape(localize('welcomePage.showCommands', "Find and run all commands"))}</h3> <span class="detail">${escape(localize('welcomePage.showCommandsDescription', "Rapidly access and search commands from the Command Palette ({0})"))
|
||||
.replace('{0}', '<span class="shortcut" data-command="workbench.action.showCommands"></span>')}</span></button></div>
|
||||
<div class="item showInterfaceOverview"><button data-href="https://aka.ms/azdata-blog"><h3 class="caption">${escape(localize('welcomePage.azdataBlog', "Discover what's new in the latest release"))}</h3> <span class="detail">${escape(localize('welcomePage.azdataBlogDescription', "New monthly blog posts each month showcasing our new features"))}</span></button></div>
|
||||
<div class="item showInteractivePlayground"><button data-href="https://twitter.com/azuredatastudio"><h3 class="caption">${escape(localize('welcomePage.followTwitter', "Follow us on Twitter"))}</h3> <span class="detail">${escape(localize('welcomePage.followTwitterDescription', "Keep up to date with how the community is using Azure Data Studio and to talk directly with the engineers."))}</span></button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
Reference in New Issue
Block a user