mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-30 09:35:39 -05:00
Adding flag to hide refresh button in dashboards. (#18964)
This commit is contained in:
@@ -1,192 +1,193 @@
|
||||
{
|
||||
"name": "sql-migration",
|
||||
"displayName": "%displayName%",
|
||||
"description": "%description%",
|
||||
"version": "0.1.14",
|
||||
"publisher": "Microsoft",
|
||||
"preview": true,
|
||||
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt",
|
||||
"icon": "images/extension.png",
|
||||
"aiKey": "AIF-37eefaf0-8022-4671-a3fb-64752724682e",
|
||||
"engines": {
|
||||
"vscode": "*",
|
||||
"azdata": ">=1.35.0"
|
||||
},
|
||||
"activationEvents": [
|
||||
"onDashboardOpen",
|
||||
"onCommand:sqlmigration.start",
|
||||
"onCommand:sqlmigration.newsupportrequest",
|
||||
"onCommand:sqlmigration.sendfeedback",
|
||||
"onCommand:sqlmigration.openNotebooks"
|
||||
],
|
||||
"capabilities": {
|
||||
"virtualWorkspaces": false,
|
||||
"untrustedWorkspaces": {
|
||||
"supported": true
|
||||
}
|
||||
},
|
||||
"main": "./out/main",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/azuredatastudio.git"
|
||||
},
|
||||
"extensionDependencies": [
|
||||
"Microsoft.mssql"
|
||||
],
|
||||
"contributes": {
|
||||
"commands": [
|
||||
{
|
||||
"command": "sqlmigration.start",
|
||||
"title": "%start-migration-command%",
|
||||
"category": "%migration-command-category%",
|
||||
"icon": "./images/migration.svg"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.newsupportrequest",
|
||||
"title": "%new-support-request-command%",
|
||||
"category": "%migration-command-category%",
|
||||
"icon": "./images/newSupportRequest.svg"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.sendfeedback",
|
||||
"title": "%send-feedback-command%",
|
||||
"category": "%migration-command-category%",
|
||||
"icon": "./images/sendFeedback.svg"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.openNotebooks",
|
||||
"title": "%migration-notebook-command-title%",
|
||||
"category": "%migration-command-category%"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.cutover",
|
||||
"title": "%complete-cutover-menu%",
|
||||
"category": "%migration-context-menu-category%"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.view.database",
|
||||
"title": "%database-details-menu%",
|
||||
"category": "%migration-context-menu-category%"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.view.target",
|
||||
"title": "%view-target-menu%",
|
||||
"category": "%migration-context-menu-category%"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.view.service",
|
||||
"title": "%view-service-menu%",
|
||||
"category": "%migration-context-menu-category%"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.copy.migration",
|
||||
"title": "%copy-migration-menu%",
|
||||
"category": "%migration-context-menu-category%"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.cancel.migration",
|
||||
"title": "%cancel-migration-menu%",
|
||||
"category": "%migration-context-menu-category%"
|
||||
},
|
||||
"name": "sql-migration",
|
||||
"displayName": "%displayName%",
|
||||
"description": "%description%",
|
||||
"version": "0.1.14",
|
||||
"publisher": "Microsoft",
|
||||
"preview": true,
|
||||
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt",
|
||||
"icon": "images/extension.png",
|
||||
"aiKey": "AIF-37eefaf0-8022-4671-a3fb-64752724682e",
|
||||
"engines": {
|
||||
"vscode": "*",
|
||||
"azdata": ">=1.35.0"
|
||||
},
|
||||
"activationEvents": [
|
||||
"onDashboardOpen",
|
||||
"onCommand:sqlmigration.start",
|
||||
"onCommand:sqlmigration.newsupportrequest",
|
||||
"onCommand:sqlmigration.sendfeedback",
|
||||
"onCommand:sqlmigration.openNotebooks"
|
||||
],
|
||||
"capabilities": {
|
||||
"virtualWorkspaces": false,
|
||||
"untrustedWorkspaces": {
|
||||
"supported": true
|
||||
}
|
||||
},
|
||||
"main": "./out/main",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/azuredatastudio.git"
|
||||
},
|
||||
"extensionDependencies": [
|
||||
"Microsoft.mssql"
|
||||
],
|
||||
"contributes": {
|
||||
"commands": [
|
||||
{
|
||||
"command": "sqlmigration.retry.migration",
|
||||
"title": "%retry-migration-menu%",
|
||||
"category": "%migration-context-menu-category%"
|
||||
}
|
||||
],
|
||||
"menu": {
|
||||
"commandPalette": [
|
||||
{
|
||||
"command": "sqlmigration.newsupportrequest",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.sendfeedback",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.cutover",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.view.database",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.view.target",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.view.service",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.copy.migration",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.cancel.migration",
|
||||
"when": "false"
|
||||
},
|
||||
"command": "sqlmigration.start",
|
||||
"title": "%start-migration-command%",
|
||||
"category": "%migration-command-category%",
|
||||
"icon": "./images/migration.svg"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.newsupportrequest",
|
||||
"title": "%new-support-request-command%",
|
||||
"category": "%migration-command-category%",
|
||||
"icon": "./images/newSupportRequest.svg"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.sendfeedback",
|
||||
"title": "%send-feedback-command%",
|
||||
"category": "%migration-command-category%",
|
||||
"icon": "./images/sendFeedback.svg"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.openNotebooks",
|
||||
"title": "%migration-notebook-command-title%",
|
||||
"category": "%migration-command-category%"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.cutover",
|
||||
"title": "%complete-cutover-menu%",
|
||||
"category": "%migration-context-menu-category%"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.view.database",
|
||||
"title": "%database-details-menu%",
|
||||
"category": "%migration-context-menu-category%"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.view.target",
|
||||
"title": "%view-target-menu%",
|
||||
"category": "%migration-context-menu-category%"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.view.service",
|
||||
"title": "%view-service-menu%",
|
||||
"category": "%migration-context-menu-category%"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.copy.migration",
|
||||
"title": "%copy-migration-menu%",
|
||||
"category": "%migration-context-menu-category%"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.cancel.migration",
|
||||
"title": "%cancel-migration-menu%",
|
||||
"category": "%migration-context-menu-category%"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.retry.migration",
|
||||
"title": "%retry-migration-menu%",
|
||||
"category": "%migration-context-menu-category%"
|
||||
}
|
||||
],
|
||||
"menu": {
|
||||
"commandPalette": [
|
||||
{
|
||||
"command": "sqlmigration.retry.migration",
|
||||
"when": "false"
|
||||
}
|
||||
]
|
||||
},
|
||||
"dashboard.tabs": [
|
||||
{
|
||||
"id": "migration-dashboard",
|
||||
"description": "%migration-dashboard-title%",
|
||||
"provider": "MSSQL",
|
||||
"title": "%migration-dashboard-title%",
|
||||
"icon": {
|
||||
"light": "./images/migration.svg",
|
||||
"dark": "./images/migration.svg"
|
||||
},
|
||||
"when": "connectionProvider == 'MSSQL' && !mssql:iscloud && mssql:engineedition != 8",
|
||||
"container": {
|
||||
"grid-container": [
|
||||
{
|
||||
"name": "",
|
||||
"row": 0,
|
||||
"col": 0,
|
||||
"widget": {
|
||||
"tasks-widget": [
|
||||
"sqlmigration.start",
|
||||
"sqlmigration.newsupportrequest",
|
||||
"sqlmigration.sendfeedback"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"row": 0,
|
||||
"col": 1,
|
||||
"rowspan": 2.5,
|
||||
"colspan": 3.5,
|
||||
"widget": {
|
||||
"modelview": {
|
||||
"id": "migration.dashboard"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/ads-extension-telemetry": "^1.1.3",
|
||||
"uuid": "^8.3.2",
|
||||
"vscode-nls": "^4.1.2"
|
||||
},
|
||||
"__metadata": {
|
||||
"publisherDisplayName": "Microsoft",
|
||||
"publisherId": "Microsoft",
|
||||
"id": "81"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/uuid": "^8.3.1"
|
||||
}
|
||||
"command": "sqlmigration.newsupportrequest",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.sendfeedback",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.cutover",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.view.database",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.view.target",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.view.service",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.copy.migration",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.cancel.migration",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "sqlmigration.retry.migration",
|
||||
"when": "false"
|
||||
}
|
||||
]
|
||||
},
|
||||
"dashboard.tabs": [
|
||||
{
|
||||
"id": "migration-dashboard",
|
||||
"description": "%migration-dashboard-title%",
|
||||
"provider": "MSSQL",
|
||||
"title": "%migration-dashboard-title%",
|
||||
"icon": {
|
||||
"light": "./images/migration.svg",
|
||||
"dark": "./images/migration.svg"
|
||||
},
|
||||
"when": "connectionProvider == 'MSSQL' && !mssql:iscloud && mssql:engineedition != 8",
|
||||
"hideRefreshTask": true,
|
||||
"container": {
|
||||
"grid-container": [
|
||||
{
|
||||
"name": "",
|
||||
"row": 0,
|
||||
"col": 0,
|
||||
"widget": {
|
||||
"tasks-widget": [
|
||||
"sqlmigration.start",
|
||||
"sqlmigration.newsupportrequest",
|
||||
"sqlmigration.sendfeedback"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"row": 0,
|
||||
"col": 1,
|
||||
"rowspan": 2.5,
|
||||
"colspan": 3.5,
|
||||
"widget": {
|
||||
"modelview": {
|
||||
"id": "migration.dashboard"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/ads-extension-telemetry": "^1.1.3",
|
||||
"uuid": "^8.3.2",
|
||||
"vscode-nls": "^4.1.2"
|
||||
},
|
||||
"__metadata": {
|
||||
"publisherDisplayName": "Microsoft",
|
||||
"publisherId": "Microsoft",
|
||||
"id": "81"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/uuid": "^8.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ export interface IDashboardTabContrib {
|
||||
isHomeTab?: boolean;
|
||||
group?: string;
|
||||
icon?: IUserFriendlyIcon;
|
||||
hideRefreshTask?: boolean;
|
||||
}
|
||||
|
||||
export interface IInsightTypeContrib {
|
||||
|
||||
@@ -83,7 +83,11 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
// tslint:disable:no-unused-variable
|
||||
private readonly homeTabTitle: string = nls.localize('home', "Home");
|
||||
private readonly homeTabId: string = 'homeTab';
|
||||
private tabToolbarActionsConfig = new Map<string, any[]>();
|
||||
private tabToolbarActionsConfig = new Map<string, {
|
||||
actions: any[],
|
||||
hideRefreshTask: boolean
|
||||
}>();
|
||||
|
||||
private tabContents = new Map<string, string>();
|
||||
|
||||
static tabName = new RawContextKey<string>('tabName', undefined);
|
||||
@@ -190,10 +194,6 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
}
|
||||
});
|
||||
|
||||
if (primary.length > 0) {
|
||||
let separator: HTMLElement = Taskbar.createTaskbarSeparator();
|
||||
tasks.push({ element: separator });
|
||||
}
|
||||
}
|
||||
return tasks;
|
||||
}
|
||||
@@ -219,8 +219,8 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
const toolbarTasks = this.tabToolbarActionsConfig.get(tabId);
|
||||
let tasks = TaskRegistry.getTasks();
|
||||
let content = [];
|
||||
if (types.isArray(toolbarTasks) && toolbarTasks.length > 0) {
|
||||
tasks = toolbarTasks.map(i => {
|
||||
if (types.isArray(toolbarTasks.actions) && toolbarTasks.actions.length > 0) {
|
||||
tasks = toolbarTasks.actions.map(i => {
|
||||
if (types.isString(i)) {
|
||||
if (tasks.some(x => x === i)) {
|
||||
return i;
|
||||
@@ -239,12 +239,29 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
|
||||
// get extension actions contributed to the page's toolbar
|
||||
const contributedTasks = this.getContributedTasks(tabId);
|
||||
if (content.length > 0 && contributedTasks.length > 0) {
|
||||
/**
|
||||
* Adding the separator before adding contributed tasks if there other
|
||||
* toolbar tasks already present in the toolbar
|
||||
*/
|
||||
const separator: HTMLElement = Taskbar.createTaskbarSeparator();
|
||||
content.push({ element: separator });
|
||||
}
|
||||
content.push(...contributedTasks);
|
||||
|
||||
const refreshAction = new RefreshWidgetAction(() => {
|
||||
this.refresh();
|
||||
}, this);
|
||||
content.push({ action: refreshAction });
|
||||
if (!toolbarTasks.hideRefreshTask) {
|
||||
/**
|
||||
* Adding the separator only when there are other actions present on the task
|
||||
*/
|
||||
if (content.length > 0) {
|
||||
const separator: HTMLElement = Taskbar.createTaskbarSeparator();
|
||||
content.push({ element: separator });
|
||||
}
|
||||
const refreshAction = new RefreshWidgetAction(() => {
|
||||
this.refresh();
|
||||
}, this);
|
||||
content.push({ action: refreshAction });
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
@@ -263,11 +280,6 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
content.push({ action: a });
|
||||
});
|
||||
|
||||
if (content.length > 0) {
|
||||
let separator: HTMLElement = Taskbar.createTaskbarSeparator();
|
||||
content.push({ element: separator });
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
@@ -442,7 +454,7 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
configs = cb.apply(this, [configs]);
|
||||
});
|
||||
|
||||
this.processTasksWidgets(configs, value.id);
|
||||
this.processTasksWidgets(configs, value.id, value.hideRefreshTask);
|
||||
|
||||
if (key === WIDGETS_CONTAINER) {
|
||||
return { id: value.id, title: value.title, container: { 'widgets-container': configs }, alwaysShow: value.alwaysShow, iconClass: value.iconClass };
|
||||
@@ -459,7 +471,7 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
* @param widgets widgets
|
||||
* @param tabId tab id
|
||||
*/
|
||||
private processTasksWidgets(widgets: WidgetConfig[], tabId: string): void {
|
||||
private processTasksWidgets(widgets: WidgetConfig[], tabId: string, hideRefreshTask?: boolean): void {
|
||||
let index;
|
||||
const allTasks = [];
|
||||
// do this in a while loop since there might be multiple tasks widgets in a tab
|
||||
@@ -473,7 +485,10 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
widgets.splice(index, 1);
|
||||
}
|
||||
} while (index !== -1);
|
||||
this.tabToolbarActionsConfig.set(tabId, allTasks);
|
||||
this.tabToolbarActionsConfig.set(tabId, {
|
||||
actions: allTasks,
|
||||
hideRefreshTask: hideRefreshTask
|
||||
});
|
||||
}
|
||||
|
||||
protected getContentType(tab: TabConfig): string {
|
||||
|
||||
@@ -65,6 +65,10 @@ const tabSchema: IJSONSchema = {
|
||||
description: localize('azdata.extension.contributes.dashboard.tab.group', "The unique identifier of the group this tab belongs to, value for home group: home."),
|
||||
type: 'string'
|
||||
},
|
||||
hideRefreshTask: {
|
||||
description: localize('azdata.extension.contributes.dashboard.tab.hideRefreshTask', "Flag used to show/hide refresh button in toolbar. By default, the value is false"),
|
||||
type: 'boolean'
|
||||
},
|
||||
icon: {
|
||||
description: localize('dazdata.extension.contributes.dashboard.tab.icon', "(Optional) Icon which is used to represent this tab in the UI. Either a file path or a themeable configuration"),
|
||||
anyOf: [{
|
||||
@@ -101,7 +105,7 @@ const tabContributionSchema: IJSONSchema = {
|
||||
ExtensionsRegistry.registerExtensionPoint<IDashboardTabContrib | IDashboardTabContrib[]>({ extensionPoint: 'dashboard.tabs', jsonSchema: tabContributionSchema }).setHandler(extensions => {
|
||||
|
||||
function handleTab(tab: IDashboardTabContrib, extension: IExtensionPointUser<any>) {
|
||||
let { description, container, provider, title, when, id, alwaysShow, isHomeTab, group, icon } = tab;
|
||||
let { description, container, provider, title, when, id, alwaysShow, isHomeTab, group, icon, hideRefreshTask } = tab;
|
||||
|
||||
// If always show is not specified, set it to true by default.
|
||||
if (!types.isBoolean(alwaysShow)) {
|
||||
@@ -155,7 +159,7 @@ ExtensionsRegistry.registerExtensionPoint<IDashboardTabContrib | IDashboardTabCo
|
||||
iconClass = createCSSRuleForIcon(icon, extension);
|
||||
}
|
||||
if (result) {
|
||||
registerTab({ description, title, container, provider, when, id, alwaysShow, publisher, isHomeTab, group, iconClass });
|
||||
registerTab({ description, title, container, provider, when, id, alwaysShow, publisher, isHomeTab, group, iconClass, hideRefreshTask });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ export interface TabConfig extends IDashboardTab {
|
||||
canClose: boolean;
|
||||
actions?: Array<Action>;
|
||||
type?: TabType;
|
||||
hideRefreshTask?: boolean;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface IDashboardTab {
|
||||
isHomeTab?: boolean;
|
||||
group?: string;
|
||||
iconClass?: string;
|
||||
hideRefreshTask?: boolean;
|
||||
}
|
||||
|
||||
export interface IDashboardTabGroup {
|
||||
|
||||
Reference in New Issue
Block a user