diff --git a/src/sql/parts/jobManagement/common/jobActions.ts b/src/sql/parts/jobManagement/common/jobActions.ts index 70b092059a..d5002c65e1 100644 --- a/src/sql/parts/jobManagement/common/jobActions.ts +++ b/src/sql/parts/jobManagement/common/jobActions.ts @@ -12,12 +12,14 @@ import Severity from 'vs/base/common/severity'; import { JobHistoryComponent } from 'sql/parts/jobManagement/views/jobHistory.component'; import { IJobManagementService } from '../common/interfaces'; import { ICommandService } from 'vs/platform/commands/common/commands'; -import { IConnectionManagementService } from '../../connection/common/connectionManagement'; +import { JobsViewComponent } from '../views/jobsView.component'; +import { AlertsViewComponent } from 'sql/parts/jobManagement/views/alertsView.component'; +import { OperatorsViewComponent } from 'sql/parts/jobManagement/views/operatorsView.component'; +import { ProxiesViewComponent } from 'sql/parts/jobManagement/views/proxiesView.component'; export enum JobActions { Run = 'run', - Stop = 'stop', - NewStep = 'newStep' + Stop = 'stop' } export interface IJobActionInfo { @@ -25,6 +27,50 @@ export interface IJobActionInfo { targetObject: any; } +// Job actions + +export class JobsRefreshAction extends Action { + public static ID = 'jobaction.refresh'; + public static LABEL = nls.localize('jobaction.refresh', "Refresh Jobs"); + + constructor( + ) { + super(JobsRefreshAction.ID, JobsRefreshAction.LABEL, 'refreshIcon'); + } + + public run(context: JobsViewComponent): TPromise { + return new TPromise((resolve, reject) => { + if (context) { + context.refreshJobs(); + resolve(true); + } else { + reject(false); + } + }); + } +} + +export class NewJobAction extends Action { + public static ID = 'jobaction.newJob'; + public static LABEL = nls.localize('jobaction.newJob', "New Job"); + + constructor( + ) { + super(NewJobAction.ID, NewJobAction.LABEL, 'newStepIcon'); + } + + public run(context: JobsViewComponent): TPromise { + return new TPromise((resolve, reject) => { + try { + context.openCreateJobDialog(); + resolve(true); + } catch (e) { + reject(e); + } + }); + } +} + export class RunJobAction extends Action { public static ID = 'jobaction.runJob'; public static LABEL = nls.localize('jobaction.run', "Run"); @@ -95,32 +141,6 @@ export class StopJobAction extends Action { } } -export class NewStepAction extends Action { - public static ID = 'jobaction.newStep'; - public static LABEL = nls.localize('jobaction.newStep', "New Step"); - - constructor( - @INotificationService private notificationService: INotificationService, - @ICommandService private _commandService: ICommandService, - @IConnectionManagementService private _connectionService - ) { - super(NewStepAction.ID, NewStepAction.LABEL, 'newStepIcon'); - } - - public run(context: JobHistoryComponent): TPromise { - let ownerUri = context.ownerUri; - let jobName = context.agentJobInfo.name; - let server = context.serverName; - let stepId = 0; - if (context.agentJobHistoryInfo && context.agentJobHistoryInfo.steps) { - stepId = context.agentJobHistoryInfo.steps.length + 1; - } - return new TPromise((resolve, reject) => { - resolve(this._commandService.executeCommand('agent.openNewStepDialog', ownerUri, jobName, server, stepId)); - }); - } -} - export class EditJobAction extends Action { public static ID = 'jobaction.editJob'; public static LABEL = nls.localize('jobaction.editJob', "Edit Job"); @@ -171,6 +191,55 @@ export class DeleteJobAction extends Action { } } +// Step Actions + +export class NewStepAction extends Action { + public static ID = 'jobaction.newStep'; + public static LABEL = nls.localize('jobaction.newStep', "New Step"); + + constructor( + @ICommandService private _commandService: ICommandService + ) { + super(NewStepAction.ID, NewStepAction.LABEL, 'newStepIcon'); + } + + public run(context: JobHistoryComponent): TPromise { + let ownerUri = context.ownerUri; + let jobName = context.agentJobInfo.name; + let server = context.serverName; + let stepId = 0; + if (context.agentJobHistoryInfo && context.agentJobHistoryInfo.steps) { + stepId = context.agentJobHistoryInfo.steps.length + 1; + } + return new TPromise((resolve, reject) => { + resolve(this._commandService.executeCommand('agent.openNewStepDialog', ownerUri, jobName, server, stepId)); + }); + } +} + +// Alert Actions + +export class NewAlertAction extends Action { + public static ID = 'jobaction.newAlert'; + public static LABEL = nls.localize('jobaction.newAlert', "New Alert"); + + constructor( + ) { + super(NewAlertAction.ID, NewAlertAction.LABEL, 'newStepIcon'); + } + + public run(context: AlertsViewComponent): TPromise { + return new TPromise((resolve, reject) => { + try { + context.openCreateAlertDialog(); + resolve(true); + } catch (e) { + reject(e); + } + }); + } +} + export class EditAlertAction extends Action { public static ID = 'jobaction.editAlert'; public static LABEL = nls.localize('jobaction.editAlert', "Edit Alert"); @@ -222,6 +291,29 @@ export class DeleteAlertAction extends Action { } } +// Operator Actions + +export class NewOperatorAction extends Action { + public static ID = 'jobaction.newOperator'; + public static LABEL = nls.localize('jobaction.newOperator', "New Operator"); + + constructor( + ) { + super(NewOperatorAction.ID, NewOperatorAction.LABEL, 'newStepIcon'); + } + + public run(context: OperatorsViewComponent): TPromise { + return new TPromise((resolve, reject) => { + try { + context.openCreateOperatorDialog(); + resolve(true); + } catch (e) { + reject(e); + } + }); + } +} + export class EditOperatorAction extends Action { public static ID = 'jobaction.editAlert'; public static LABEL = nls.localize('jobaction.editOperator', "Edit Operator"); @@ -273,6 +365,29 @@ export class DeleteOperatorAction extends Action { } +// Proxy Actions + +export class NewProxyAction extends Action { + public static ID = 'jobaction.newProxy'; + public static LABEL = nls.localize('jobaction.newProxy', "New Proxy"); + + constructor( + ) { + super(NewProxyAction.ID, NewProxyAction.LABEL, 'newStepIcon'); + } + + public run(context: ProxiesViewComponent): TPromise { + return new TPromise((resolve, reject) => { + try { + context.openCreateProxyDialog(); + resolve(true); + } catch (e) { + reject(e); + } + }); + } +} + export class EditProxyAction extends Action { public static ID = 'jobaction.editProxy'; public static LABEL = nls.localize('jobaction.editProxy', "Edit Proxy"); diff --git a/src/sql/parts/jobManagement/common/media/jobs.css b/src/sql/parts/jobManagement/common/media/jobs.css index 5a1571892f..33c6cfa5aa 100644 --- a/src/sql/parts/jobManagement/common/media/jobs.css +++ b/src/sql/parts/jobManagement/common/media/jobs.css @@ -22,7 +22,7 @@ jobhistory-component { } .job-heading-container { - height: 49px; + height: 50px; border-bottom: 3px solid #f4f4f4; display: -webkit-box; } @@ -315,3 +315,24 @@ table.jobprevruns > tbody { width : 100%; display: block; } + +.vs .action-label.icon.refreshIcon { + background-image: url('refresh.svg'); +} + +.vs-dark .action-label.icon.refreshIcon, +.hc-black .action-label.icon.refreshIcon { + background-image: url('refresh_inverse.svg'); +} + +.actionbar-container .monaco-action-bar > ul.actions-container { + padding-top: 10px; +} + +jobsview-component .actionbar-container { + height: 40px; +} + +.actionbar-container .monaco-action-bar > ul.actions-container > li.action-item { + padding-left: 20px; +} \ No newline at end of file diff --git a/src/sql/parts/jobManagement/common/media/refresh.svg b/src/sql/parts/jobManagement/common/media/refresh.svg new file mode 100644 index 0000000000..ce3d329303 --- /dev/null +++ b/src/sql/parts/jobManagement/common/media/refresh.svg @@ -0,0 +1 @@ +refresh \ No newline at end of file diff --git a/src/sql/parts/jobManagement/common/media/refresh_inverse.svg b/src/sql/parts/jobManagement/common/media/refresh_inverse.svg new file mode 100644 index 0000000000..f49e6f49b6 --- /dev/null +++ b/src/sql/parts/jobManagement/common/media/refresh_inverse.svg @@ -0,0 +1 @@ +refresh_inverse \ No newline at end of file diff --git a/src/sql/parts/jobManagement/views/alertsView.component.html b/src/sql/parts/jobManagement/views/alertsView.component.html index 73e0805949..c033e8a89a 100644 --- a/src/sql/parts/jobManagement/views/alertsView.component.html +++ b/src/sql/parts/jobManagement/views/alertsView.component.html @@ -9,9 +9,7 @@

No Alerts Available

-
-
{{RefreshText}}
-
{{NewAlertText}}
-
+ +
diff --git a/src/sql/parts/jobManagement/views/alertsView.component.ts b/src/sql/parts/jobManagement/views/alertsView.component.ts index 183d76a611..a196c0a2af 100644 --- a/src/sql/parts/jobManagement/views/alertsView.component.ts +++ b/src/sql/parts/jobManagement/views/alertsView.component.ts @@ -20,15 +20,13 @@ import { TabChild } from 'sql/base/browser/ui/panel/tab.component'; import { Table } from 'sql/base/browser/ui/table/table'; import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component'; import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces'; -import { EditAlertAction, DeleteAlertAction } from 'sql/parts/jobManagement/common/jobActions'; +import { EditAlertAction, DeleteAlertAction, NewAlertAction } from 'sql/parts/jobManagement/common/jobActions'; import { JobManagementView } from 'sql/parts/jobManagement/views/jobManagementView'; import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service'; -import { IThemeService } from 'vs/platform/theme/common/themeService'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IAction } from 'vs/base/common/actions'; import { TPromise } from 'vs/base/common/winjs.base'; - import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; @@ -42,9 +40,6 @@ export const ROW_HEIGHT: number = 45; }) export class AlertsViewComponent extends JobManagementView implements OnInit { - private NewAlertText: string = nls.localize('jobAlertToolbar-NewJob', "New Alert"); - private RefreshText: string = nls.localize('jobAlertToolbar-Refresh', "Refresh"); - private columns: Array> = [ { name: nls.localize('jobAlertColumns.name', 'Name'), field: 'name', width: 200, id: 'name' }, { name: nls.localize('jobAlertColumns.lastOccurrenceDate', 'Last Occurrence'), field: 'lastOccurrenceDate', width: 200, id: 'lastOccurrenceDate' }, @@ -67,20 +62,19 @@ export class AlertsViewComponent extends JobManagementView implements OnInit { @ViewChild('jobalertsgrid') _gridEl: ElementRef; public alerts: sqlops.AgentAlertInfo[]; + public contextAction = NewAlertAction; constructor( @Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef, @Inject(forwardRef(() => ElementRef)) private _el: ElementRef, @Inject(forwardRef(() => AgentViewComponent)) private _agentViewComponent: AgentViewComponent, @Inject(IJobManagementService) private _jobManagementService: IJobManagementService, - @Inject(IThemeService) private _themeService: IThemeService, @Inject(ICommandService) private _commandService: ICommandService, - @Inject(IInstantiationService) private _instantiationService: IInstantiationService, + @Inject(IInstantiationService) instantiationService: IInstantiationService, @Inject(forwardRef(() => CommonServiceInterface)) commonService: CommonServiceInterface, @Inject(IContextMenuService) contextMenuService: IContextMenuService, - @Inject(IKeybindingService) keybindingService: IKeybindingService - ) { - super(commonService, contextMenuService, keybindingService); + @Inject(IKeybindingService) keybindingService: IKeybindingService) { + super(commonService, contextMenuService, keybindingService, instantiationService); this._isCloud = commonService.connectionManagementService.connectionInfo.serverInfo.isCloud; } @@ -111,6 +105,8 @@ export class AlertsViewComponent extends JobManagementView implements OnInit { this.dataView = new Slick.Data.DataView(); $(this._gridEl.nativeElement).empty(); + $(this.actionBarContainer.nativeElement).empty(); + this.initActionBar(); this._table = new Table(this._gridEl.nativeElement, undefined, columns, this.options); this._table.grid.setData(this.dataView, true); @@ -166,7 +162,7 @@ export class AlertsViewComponent extends JobManagementView implements OnInit { : undefined; } - private openCreateAlertDialog() { + public openCreateAlertDialog() { let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri; this._commandService.executeCommand('agent.openCreateAlertDialog', ownerUri); } diff --git a/src/sql/parts/jobManagement/views/jobHistory.css b/src/sql/parts/jobManagement/views/jobHistory.css index 2dbf17dab6..962d272434 100644 --- a/src/sql/parts/jobManagement/views/jobHistory.css +++ b/src/sql/parts/jobManagement/views/jobHistory.css @@ -243,7 +243,6 @@ jobhistory-component > .jobhistory-heading-container > .icon.in-progress { jobhistory-component > .actionbar-container .monaco-action-bar > ul.actions-container { border-top: 3px solid #f4f4f4; - padding-top: 10px; } .vs-dark jobhistory-component > .actionbar-container .monaco-action-bar > ul.actions-container { diff --git a/src/sql/parts/jobManagement/views/jobManagementView.ts b/src/sql/parts/jobManagement/views/jobManagementView.ts index 4e65171820..8669196864 100644 --- a/src/sql/parts/jobManagement/views/jobManagementView.ts +++ b/src/sql/parts/jobManagement/views/jobManagementView.ts @@ -3,16 +3,19 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ElementRef, AfterContentChecked } from '@angular/core'; +import { ElementRef, AfterContentChecked, ViewChild } from '@angular/core'; import { Table } from 'sql/base/browser/ui/table/table'; import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component'; import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service'; -import { IAction } from 'vs/base/common/actions'; +import { IAction, Action } from 'vs/base/common/actions'; import { ResolvedKeybinding } from 'vs/base/common/keyCodes'; import { Disposable } from 'vs/base/common/lifecycle'; import { TPromise } from 'vs/base/common/winjs.base'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { Taskbar } from '../../../base/browser/ui/taskbar/taskbar'; +import { JobsRefreshAction } from 'sql/parts/jobManagement/common/jobActions'; export abstract class JobManagementView extends Disposable implements AfterContentChecked { protected isVisible: boolean = false; @@ -22,11 +25,16 @@ export abstract class JobManagementView extends Disposable implements AfterConte protected _visibilityElement: ElementRef; protected _parentComponent: AgentViewComponent; protected _table: Table; + protected _actionBar: Taskbar; + public contextAction: any; + + @ViewChild('actionbarContainer') protected actionBarContainer: ElementRef; constructor( protected _commonService: CommonServiceInterface, protected _contextMenuService: IContextMenuService, - protected _keybindingService: IKeybindingService) { + protected _keybindingService: IKeybindingService, + protected _instantiationService: IInstantiationService) { super(); } @@ -87,4 +95,16 @@ export abstract class JobManagementView extends Disposable implements AfterConte protected getCurrentTableObject(rowIndex: number): any { return undefined; } + + protected initActionBar() { + let refreshAction = this._instantiationService.createInstance(JobsRefreshAction); + let newAction: Action = this._instantiationService.createInstance(this.contextAction); + let taskbar = this.actionBarContainer.nativeElement; + this._actionBar = new Taskbar(taskbar, this._contextMenuService); + this._actionBar.context = this; + this._actionBar.setContent([ + { action: refreshAction }, + { action: newAction } + ]); + } } \ No newline at end of file diff --git a/src/sql/parts/jobManagement/views/jobsView.component.html b/src/sql/parts/jobManagement/views/jobsView.component.html index 217ccbd573..db488b549e 100644 --- a/src/sql/parts/jobManagement/views/jobsView.component.html +++ b/src/sql/parts/jobManagement/views/jobsView.component.html @@ -9,9 +9,7 @@

No Jobs Available

-
-
{{RefreshText}}
-
{{NewJobText}}
-
+ +
\ No newline at end of file diff --git a/src/sql/parts/jobManagement/views/jobsView.component.ts b/src/sql/parts/jobManagement/views/jobsView.component.ts index 2667642c29..9f2fae92ce 100644 --- a/src/sql/parts/jobManagement/views/jobsView.component.ts +++ b/src/sql/parts/jobManagement/views/jobsView.component.ts @@ -21,7 +21,7 @@ import { Table } from 'sql/base/browser/ui/table/table'; import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component'; import { RowDetailView } from 'sql/base/browser/ui/table/plugins/rowdetailview'; import { JobCacheObject } from 'sql/parts/jobManagement/common/jobManagementService'; -import { EditJobAction, DeleteJobAction } from 'sql/parts/jobManagement/common/jobActions'; +import { EditJobAction, DeleteJobAction, NewJobAction } from 'sql/parts/jobManagement/common/jobActions'; import { JobManagementUtilities } from 'sql/parts/jobManagement/common/jobManagementUtilities'; import { HeaderFilter } from 'sql/base/browser/ui/table/plugins/headerFilter.plugin'; import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces'; @@ -46,9 +46,6 @@ export const ROW_HEIGHT: number = 45; export class JobsViewComponent extends JobManagementView implements OnInit { - private NewJobText: string = nls.localize("jobsToolbar-NewJob", "New Job"); - private RefreshText: string = nls.localize("jobsToolbar-Refresh", "Refresh"); - private columns: Array> = [ { name: nls.localize('jobColumns.name', 'Name'), @@ -87,6 +84,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit { public jobs: sqlops.AgentJobInfo[]; public jobHistories: { [jobId: string]: sqlops.AgentJobHistoryInfo[]; } = Object.create(null); + public contextAction = NewJobAction; @ViewChild('jobsgrid') _gridEl: ElementRef; @@ -98,11 +96,11 @@ export class JobsViewComponent extends JobManagementView implements OnInit { @Inject(IJobManagementService) private _jobManagementService: IJobManagementService, @Inject(IThemeService) private _themeService: IThemeService, @Inject(ICommandService) private _commandService: ICommandService, - @Inject(IInstantiationService) private _instantiationService: IInstantiationService, + @Inject(IInstantiationService) instantiationService: IInstantiationService, @Inject(IContextMenuService) contextMenuService: IContextMenuService, - @Inject(IKeybindingService) keybindingService: IKeybindingService + @Inject(IKeybindingService) keybindingService: IKeybindingService, ) { - super(commonService, contextMenuService, keybindingService); + super(commonService, contextMenuService, keybindingService, instantiationService); let jobCacheObjectMap = this._jobManagementService.jobCacheObjectMap; this._serverName = commonService.connectionManagementService.connectionInfo.connectionProfile.serverName; let jobCache = jobCacheObjectMap[this._serverName]; @@ -163,9 +161,9 @@ export class JobsViewComponent extends JobManagementView implements OnInit { let filterPlugin = new HeaderFilter({}, this._themeService); this.filterPlugin = filterPlugin; - $(this._gridEl.nativeElement).empty(); - + $(this.actionBarContainer.nativeElement).empty(); + this.initActionBar(); this._table = new Table(this._gridEl.nativeElement, undefined, columns, options); this._table.grid.setData(this.dataView, true); this._table.grid.onClick.subscribe((e, args) => { @@ -844,12 +842,12 @@ export class JobsViewComponent extends JobManagementView implements OnInit { return job && job.length > 0 ? job[0] : undefined; } - private openCreateJobDialog() { + public openCreateJobDialog() { let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri; this._commandService.executeCommand('agent.openCreateJobDialog', ownerUri); } - private refreshJobs() { + public refreshJobs() { this._agentViewComponent.refresh = true; } } \ No newline at end of file diff --git a/src/sql/parts/jobManagement/views/operatorsView.component.html b/src/sql/parts/jobManagement/views/operatorsView.component.html index e36ca67a7c..ae1bca50e4 100644 --- a/src/sql/parts/jobManagement/views/operatorsView.component.html +++ b/src/sql/parts/jobManagement/views/operatorsView.component.html @@ -9,9 +9,7 @@

No Operators Available

-
-
{{RefreshText}}
-
{{NewOperatorText}}
-
+ +
diff --git a/src/sql/parts/jobManagement/views/operatorsView.component.ts b/src/sql/parts/jobManagement/views/operatorsView.component.ts index 00f93febd0..23be4c72d0 100644 --- a/src/sql/parts/jobManagement/views/operatorsView.component.ts +++ b/src/sql/parts/jobManagement/views/operatorsView.component.ts @@ -19,10 +19,9 @@ import { Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild import { Table } from 'sql/base/browser/ui/table/table'; import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component'; import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces'; -import { EditOperatorAction, DeleteOperatorAction } from 'sql/parts/jobManagement/common/jobActions'; +import { EditOperatorAction, DeleteOperatorAction, NewOperatorAction } from 'sql/parts/jobManagement/common/jobActions'; import { JobManagementView } from 'sql/parts/jobManagement/views/jobManagementView'; import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service'; -import { IThemeService } from 'vs/platform/theme/common/themeService'; import { TabChild } from 'sql/base/browser/ui/panel/tab.component'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; @@ -42,9 +41,6 @@ export const ROW_HEIGHT: number = 45; export class OperatorsViewComponent extends JobManagementView implements OnInit { - private NewOperatorText: string = nls.localize('jobOperatorToolbar-NewItem', "New Operator"); - private RefreshText: string = nls.localize('jobOperatorToolbar-Refresh', "Refresh"); - private columns: Array> = [ { name: nls.localize('jobOperatorsView.name', 'Name'), field: 'name', width: 200, id: 'name' }, { name: nls.localize('jobOperatorsView.emailAddress', 'Email Address'), field: 'emailAddress', width: 200, id: 'emailAddress' }, @@ -54,7 +50,7 @@ export class OperatorsViewComponent extends JobManagementView implements OnInit private options: Slick.GridOptions = { syncColumnCellResize: true, enableColumnReorder: false, - rowHeight: 45, + rowHeight: ROW_HEIGHT, enableCellNavigation: true, editable: false }; @@ -66,20 +62,20 @@ export class OperatorsViewComponent extends JobManagementView implements OnInit @ViewChild('operatorsgrid') _gridEl: ElementRef; public operators: sqlops.AgentOperatorInfo[]; + public contextAction = NewOperatorAction; constructor( @Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef, @Inject(forwardRef(() => ElementRef)) private _el: ElementRef, @Inject(forwardRef(() => AgentViewComponent)) private _agentViewComponent: AgentViewComponent, @Inject(IJobManagementService) private _jobManagementService: IJobManagementService, - @Inject(IThemeService) private _themeService: IThemeService, @Inject(ICommandService) private _commandService: ICommandService, - @Inject(IInstantiationService) private _instantiationService: IInstantiationService, + @Inject(IInstantiationService) instantiationService: IInstantiationService, @Inject(forwardRef(() => CommonServiceInterface)) commonService: CommonServiceInterface, @Inject(IContextMenuService) contextMenuService: IContextMenuService, @Inject(IKeybindingService) keybindingService: IKeybindingService ) { - super(commonService, contextMenuService, keybindingService); + super(commonService, contextMenuService, keybindingService, instantiationService); this._isCloud = commonService.connectionManagementService.connectionInfo.serverInfo.isCloud; } @@ -110,6 +106,8 @@ export class OperatorsViewComponent extends JobManagementView implements OnInit this.dataView = new Slick.Data.DataView(); $(this._gridEl.nativeElement).empty(); + $(this.actionBarContainer.nativeElement).empty(); + this.initActionBar(); this._table = new Table(this._gridEl.nativeElement, undefined, columns, this.options); this._table.grid.setData(this.dataView, true); @@ -163,7 +161,7 @@ export class OperatorsViewComponent extends JobManagementView implements OnInit : undefined; } - private openCreateOperatorDialog() { + public openCreateOperatorDialog() { let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri; this._commandService.executeCommand('agent.openCreateOperatorDialog', ownerUri); } diff --git a/src/sql/parts/jobManagement/views/proxiesView.component.html b/src/sql/parts/jobManagement/views/proxiesView.component.html index ffb7542964..9680518ab3 100644 --- a/src/sql/parts/jobManagement/views/proxiesView.component.html +++ b/src/sql/parts/jobManagement/views/proxiesView.component.html @@ -9,9 +9,7 @@

No Proxies Available

-
-
{{RefreshText}}
-
{{NewProxyText}}
-
+ +
diff --git a/src/sql/parts/jobManagement/views/proxiesView.component.ts b/src/sql/parts/jobManagement/views/proxiesView.component.ts index 10c8de3730..166c7451b7 100644 --- a/src/sql/parts/jobManagement/views/proxiesView.component.ts +++ b/src/sql/parts/jobManagement/views/proxiesView.component.ts @@ -19,7 +19,7 @@ import { Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild import { Table } from 'sql/base/browser/ui/table/table'; import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component'; import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces'; -import { EditProxyAction, DeleteProxyAction } from 'sql/parts/jobManagement/common/jobActions'; +import { EditProxyAction, DeleteProxyAction, NewProxyAction } from 'sql/parts/jobManagement/common/jobActions'; import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service'; import { TabChild } from 'sql/base/browser/ui/panel/tab.component'; import { JobManagementView } from 'sql/parts/jobManagement/views/jobManagementView'; @@ -28,7 +28,6 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { TPromise } from 'vs/base/common/winjs.base'; import { IAction } from 'vs/base/common/actions'; import { ICommandService } from 'vs/platform/commands/common/commands'; -import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; export const VIEW_SELECTOR: string = 'jobproxiesview-component'; @@ -63,6 +62,7 @@ export class ProxiesViewComponent extends JobManagementView implements OnInit { private _isCloud: boolean; public proxies: sqlops.AgentProxyInfo[]; + public readonly contextAction = NewProxyAction; @ViewChild('proxiesgrid') _gridEl: ElementRef; @@ -71,14 +71,13 @@ export class ProxiesViewComponent extends JobManagementView implements OnInit { @Inject(forwardRef(() => ElementRef)) private _el: ElementRef, @Inject(forwardRef(() => AgentViewComponent)) private _agentViewComponent: AgentViewComponent, @Inject(IJobManagementService) private _jobManagementService: IJobManagementService, - @Inject(IThemeService) private _themeService: IThemeService, @Inject(ICommandService) private _commandService: ICommandService, - @Inject(IInstantiationService) private _instantiationService: IInstantiationService, + @Inject(IInstantiationService) instantiationService: IInstantiationService, @Inject(forwardRef(() => CommonServiceInterface)) commonService: CommonServiceInterface, @Inject(IContextMenuService) contextMenuService: IContextMenuService, @Inject(IKeybindingService) keybindingService: IKeybindingService ) { - super(commonService, contextMenuService, keybindingService); + super(commonService, contextMenuService, keybindingService, instantiationService); this._isCloud = commonService.connectionManagementService.connectionInfo.serverInfo.isCloud; } @@ -109,6 +108,8 @@ export class ProxiesViewComponent extends JobManagementView implements OnInit { this.dataView = new Slick.Data.DataView(); $(this._gridEl.nativeElement).empty(); + $(this.actionBarContainer.nativeElement).empty(); + this.initActionBar(); this._table = new Table(this._gridEl.nativeElement, undefined, columns, this.options); this._table.grid.setData(this.dataView, true); @@ -161,7 +162,7 @@ export class ProxiesViewComponent extends JobManagementView implements OnInit { : undefined; } - private openCreateProxyDialog() { + public openCreateProxyDialog() { let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri; this._commandService.executeCommand('agent.openCreateProxyDialog', ownerUri); }