-
Notifications
You must be signed in to change notification settings - Fork 910
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Alert, Operator and Proxy panel tabs (#1811)
* Add Create Alert dialog * Add Job Alerts view * Stage WIP * Add Proxy View component * Hook up proxy and operator view callbacks * Style cleanup * Add additonal columns to views
- Loading branch information
Showing
33 changed files
with
1,079 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the Source EULA. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
'use strict'; | ||
|
||
import * as sqlops from 'sqlops'; | ||
import { AgentUtils } from '../agentUtils'; | ||
|
||
export class CreateAlertData { | ||
public ownerUri: string; | ||
private _alert: sqlops.AgentAlertInfo; | ||
|
||
constructor(ownerUri:string) { | ||
this.ownerUri = ownerUri; | ||
} | ||
|
||
public async initialize() { | ||
let agentService = await AgentUtils.getAgentService(); | ||
|
||
} | ||
|
||
public async save() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the Source EULA. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
'use strict'; | ||
|
||
import * as sqlops from 'sqlops'; | ||
import { AgentUtils } from '../agentUtils'; | ||
|
||
export class CreateScheduleData { | ||
public ownerUri: string; | ||
public schedules: sqlops.AgentJobScheduleInfo[]; | ||
public selectedSchedule: sqlops.AgentJobScheduleInfo; | ||
|
||
constructor(ownerUri:string) { | ||
this.ownerUri = ownerUri; | ||
} | ||
|
||
public async initialize() { | ||
let agentService = await AgentUtils.getAgentService(); | ||
let result = await agentService.getJobSchedules(this.ownerUri); | ||
if (result && result.success) { | ||
this.schedules = result.schedules; | ||
} | ||
} | ||
|
||
public async save() { | ||
} | ||
} |
149 changes: 149 additions & 0 deletions
149
extensions/agent/client/src/dialogs/createAlertDialog.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the Source EULA. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
'use strict'; | ||
|
||
import * as sqlops from 'sqlops'; | ||
import * as vscode from 'vscode'; | ||
import { CreateAlertData } from '../data/createAlertData'; | ||
|
||
export class CreateAlertDialog { | ||
|
||
// Top level | ||
private readonly DialogTitle: string = 'Create Alert'; | ||
private readonly OkButtonText: string = 'OK'; | ||
private readonly CancelButtonText: string = 'Cancel'; | ||
private readonly GeneralTabText: string = 'Response'; | ||
private readonly ResponseTabText: string = 'Steps'; | ||
private readonly OptionsTabText: string = 'Options'; | ||
private readonly HistoryTabText: string = 'History'; | ||
|
||
// General tab strings | ||
private readonly NameTextBoxLabel: string = 'Name'; | ||
|
||
// Response tab strings | ||
private readonly ExecuteJobTextBoxLabel: string = 'Execute Job'; | ||
|
||
// Options tab strings | ||
private readonly AdditionalMessageTextBoxLabel: string = 'Additional notification message to send'; | ||
|
||
// History tab strings | ||
private readonly ResetCountTextBoxLabel: string = 'Reset Count'; | ||
|
||
// UI Components | ||
private dialog: sqlops.window.modelviewdialog.Dialog; | ||
private generalTab: sqlops.window.modelviewdialog.DialogTab; | ||
private responseTab: sqlops.window.modelviewdialog.DialogTab; | ||
private optionsTab: sqlops.window.modelviewdialog.DialogTab; | ||
private historyTab: sqlops.window.modelviewdialog.DialogTab; | ||
private schedulesTable: sqlops.TableComponent; | ||
|
||
// General tab controls | ||
private nameTextBox: sqlops.InputBoxComponent; | ||
|
||
// Response tab controls | ||
private executeJobTextBox: sqlops.InputBoxComponent; | ||
|
||
// Options tab controls | ||
private additionalMessageTextBox: sqlops.InputBoxComponent; | ||
|
||
// History tab controls | ||
private resetCountTextBox: sqlops.InputBoxComponent; | ||
|
||
private model: CreateAlertData; | ||
|
||
private _onSuccess: vscode.EventEmitter<CreateAlertData> = new vscode.EventEmitter<CreateAlertData>(); | ||
public readonly onSuccess: vscode.Event<CreateAlertData> = this._onSuccess.event; | ||
|
||
constructor(ownerUri: string) { | ||
this.model = new CreateAlertData(ownerUri); | ||
} | ||
|
||
public async showDialog() { | ||
await this.model.initialize(); | ||
this.dialog = sqlops.window.modelviewdialog.createDialog(this.DialogTitle); | ||
this.generalTab = sqlops.window.modelviewdialog.createTab(this.GeneralTabText); | ||
this.responseTab = sqlops.window.modelviewdialog.createTab(this.ResponseTabText); | ||
this.optionsTab = sqlops.window.modelviewdialog.createTab(this.OptionsTabText); | ||
this.historyTab = sqlops.window.modelviewdialog.createTab(this.HistoryTabText); | ||
|
||
this.initializeGeneralTab(); | ||
this.initializeResponseTab(); | ||
this.initializeOptionsTab(); | ||
this.initializeHistoryTab(); | ||
|
||
this.dialog.content = [this.generalTab, this.responseTab, this.optionsTab, this.historyTab]; | ||
this.dialog.okButton.onClick(async () => await this.execute()); | ||
this.dialog.cancelButton.onClick(async () => await this.cancel()); | ||
this.dialog.okButton.label = this.OkButtonText; | ||
this.dialog.cancelButton.label = this.CancelButtonText; | ||
|
||
sqlops.window.modelviewdialog.openDialog(this.dialog); | ||
} | ||
|
||
private initializeGeneralTab() { | ||
this.generalTab.registerContent(async view => { | ||
this.nameTextBox = view.modelBuilder.inputBox().component(); | ||
let formModel = view.modelBuilder.formContainer() | ||
.withFormItems([{ | ||
component: this.nameTextBox, | ||
title: this.NameTextBoxLabel | ||
}]).withLayout({ width: '100%' }).component(); | ||
|
||
await view.initializeModel(formModel); | ||
}); | ||
} | ||
|
||
private initializeResponseTab() { | ||
this.responseTab.registerContent(async view => { | ||
this.executeJobTextBox = view.modelBuilder.inputBox().component(); | ||
let formModel = view.modelBuilder.formContainer() | ||
.withFormItems([{ | ||
component: this.executeJobTextBox, | ||
title: this.ExecuteJobTextBoxLabel | ||
}]).withLayout({ width: '100%' }).component(); | ||
|
||
await view.initializeModel(formModel); | ||
}); | ||
} | ||
|
||
private initializeOptionsTab() { | ||
this.optionsTab.registerContent(async view => { | ||
this.additionalMessageTextBox = view.modelBuilder.inputBox().component(); | ||
let formModel = view.modelBuilder.formContainer() | ||
.withFormItems([{ | ||
component: this.additionalMessageTextBox, | ||
title: this.AdditionalMessageTextBoxLabel | ||
}]).withLayout({ width: '100%' }).component(); | ||
|
||
await view.initializeModel(formModel); | ||
}); | ||
} | ||
|
||
private initializeHistoryTab() { | ||
this.historyTab.registerContent(async view => { | ||
this.resetCountTextBox = view.modelBuilder.inputBox().component(); | ||
let formModel = view.modelBuilder.formContainer() | ||
.withFormItems([{ | ||
component: this.resetCountTextBox, | ||
title: this.ResetCountTextBoxLabel | ||
}]).withLayout({ width: '100%' }).component(); | ||
|
||
await view.initializeModel(formModel); | ||
}); | ||
} | ||
|
||
private async execute() { | ||
this.updateModel(); | ||
await this.model.save(); | ||
this._onSuccess.fire(this.model); | ||
} | ||
|
||
private async cancel() { | ||
} | ||
|
||
private updateModel() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.