mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Remove "client" folder in Agent extension (#1820)
* Remove "client" folder in Agent extension * Alert dialog cleanups
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
"activationEvents": [
|
||||
"*"
|
||||
],
|
||||
"main": "./client/out/main",
|
||||
"main": "./out/main",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/sqlopsstudio.git"
|
||||
@@ -46,5 +46,9 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha-junit-reporter": "^1.17.0",
|
||||
"mocha-multi-reporters": "^1.1.7"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ export class CreateJobData {
|
||||
private _ownerUri: string;
|
||||
private _jobCategories: string[];
|
||||
private _operators: string[];
|
||||
private _agentService: sqlops.AgentServicesProvider;
|
||||
private _defaultOwner: string;
|
||||
private _jobCompletionActionConditions: sqlops.CategoryValue[];
|
||||
|
||||
@@ -39,7 +38,7 @@ export class CreateJobData {
|
||||
public jobSchedules: sqlops.AgentJobScheduleInfo[];
|
||||
public alerts: sqlops.AgentAlertInfo[];
|
||||
|
||||
constructor(ownerUri: string) {
|
||||
constructor(ownerUri: string, private _agentService: sqlops.AgentServicesProvider = null) {
|
||||
this._ownerUri = ownerUri;
|
||||
}
|
||||
|
||||
25
extensions/agent/src/data/createOperatorData.ts
Normal file
25
extensions/agent/src/data/createOperatorData.ts
Normal file
@@ -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 CreateOperatorData {
|
||||
public ownerUri: string;
|
||||
private _alert: sqlops.AgentOperatorInfo;
|
||||
|
||||
constructor(ownerUri:string) {
|
||||
this.ownerUri = ownerUri;
|
||||
}
|
||||
|
||||
public async initialize() {
|
||||
let agentService = await AgentUtils.getAgentService();
|
||||
|
||||
}
|
||||
|
||||
public async save() {
|
||||
}
|
||||
}
|
||||
25
extensions/agent/src/data/createProxyData.ts
Normal file
25
extensions/agent/src/data/createProxyData.ts
Normal file
@@ -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 CreateProxyData {
|
||||
public ownerUri: string;
|
||||
private _alert: sqlops.AgentProxyInfo;
|
||||
|
||||
constructor(ownerUri:string) {
|
||||
this.ownerUri = ownerUri;
|
||||
}
|
||||
|
||||
public async initialize() {
|
||||
let agentService = await AgentUtils.getAgentService();
|
||||
|
||||
}
|
||||
|
||||
public async save() {
|
||||
}
|
||||
}
|
||||
222
extensions/agent/src/dialogs/createAlertDialog.ts
Normal file
222
extensions/agent/src/dialogs/createAlertDialog.ts
Normal file
@@ -0,0 +1,222 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* 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 { AgentUtils } from '../agentUtils';
|
||||
import { CreateAlertData } from '../data/createAlertData';
|
||||
|
||||
export class CreateAlertDialog {
|
||||
|
||||
// Top level
|
||||
private static readonly DialogTitle: string = 'Create Alert';
|
||||
private static readonly OkButtonText: string = 'OK';
|
||||
private static readonly CancelButtonText: string = 'Cancel';
|
||||
private static readonly GeneralTabText: string = 'General';
|
||||
private static readonly ResponseTabText: string = 'Response';
|
||||
private static readonly OptionsTabText: string = 'Options';
|
||||
|
||||
// General tab strings
|
||||
private static readonly NameLabel: string = 'Name';
|
||||
private static readonly TypeLabel: string = 'Type';
|
||||
private static readonly DatabaseLabel: string = 'Database name';
|
||||
private static readonly ErrorNumberLabel: string = 'Error number';
|
||||
private static readonly SeverityrLabel: string = 'Severity';
|
||||
private static readonly AlertTypeSqlServerEventString: string = 'SQL Server event alert';
|
||||
private static readonly AlertTypePerformanceConditionString: string = 'SQL Server performance condition alert';
|
||||
private static readonly AlertTypeWmiEventString: string = 'WMI event alert';
|
||||
private static readonly AlertSeverity001Label: string = '001 - Miscellaneous System Information';
|
||||
private static readonly AlertSeverity002Label: string = '002 - Reserved';
|
||||
private static readonly AlertSeverity003Label: string = '003 - Reserved';
|
||||
private static readonly AlertSeverity004Label: string = '004 - Reserved';
|
||||
private static readonly AlertSeverity005Label: string = '005 - Reserved';
|
||||
private static readonly AlertSeverity006Label: string = '006 - Reserved';
|
||||
private static readonly AlertSeverity007Label: string = '007 - Notification: Status Information';
|
||||
private static readonly AlertSeverity008Label: string = '008 - Notification: User Intervention Required';
|
||||
private static readonly AlertSeverity009Label: string = '009 - User Defined';
|
||||
private static readonly AlertSeverity010Label: string = '010 - Information';
|
||||
private static readonly AlertSeverity011Label: string = '011 - Specified Database Object Not Found';
|
||||
private static readonly AlertSeverity012Label: string = '012 - Unused';
|
||||
private static readonly AlertSeverity013Label: string = '013 - User Transaction Syntax Error';
|
||||
private static readonly AlertSeverity014Label: string = '014 - Insufficient Permission';
|
||||
private static readonly AlertSeverity015Label: string = '015 - Syntax Error in SQL Statements';
|
||||
private static readonly AlertSeverity016Label: string = '016 - Miscellaneous User Error';
|
||||
private static readonly AlertSeverity017Label: string = '017 - Insufficient Resources';
|
||||
private static readonly AlertSeverity018Label: string = '018 - Nonfatal Internal Error';
|
||||
private static readonly AlertSeverity019Label: string = '019 - Fatal Error in Resource';
|
||||
private static readonly AlertSeverity020Label: string = '020 - Fatal Error in Current Process';
|
||||
private static readonly AlertSeverity021Label: string = '021 - Fatal Error in Database Processes';
|
||||
private static readonly AlertSeverity022Label: string = '022 - Fatal Error: Table Integrity Suspect';
|
||||
private static readonly AlertSeverity023Label: string = '023 - Fatal Error: Database Integrity Suspect';
|
||||
private static readonly AlertSeverity024Label: string = '024 - Fatal Error: Hardware Error';
|
||||
private static readonly AlertSeverity025Label: string = '025 - Fatal Error';
|
||||
|
||||
private static readonly AlertTypes: string[] = [
|
||||
CreateAlertDialog.AlertTypeSqlServerEventString,
|
||||
CreateAlertDialog.AlertTypePerformanceConditionString,
|
||||
CreateAlertDialog.AlertTypeWmiEventString
|
||||
];
|
||||
|
||||
private static readonly AlertSeverities: string[] = [
|
||||
CreateAlertDialog.AlertSeverity001Label,
|
||||
CreateAlertDialog.AlertSeverity002Label,
|
||||
CreateAlertDialog.AlertSeverity003Label,
|
||||
CreateAlertDialog.AlertSeverity004Label,
|
||||
CreateAlertDialog.AlertSeverity005Label,
|
||||
CreateAlertDialog.AlertSeverity006Label,
|
||||
CreateAlertDialog.AlertSeverity007Label,
|
||||
CreateAlertDialog.AlertSeverity008Label,
|
||||
CreateAlertDialog.AlertSeverity009Label,
|
||||
CreateAlertDialog.AlertSeverity010Label,
|
||||
CreateAlertDialog.AlertSeverity011Label,
|
||||
CreateAlertDialog.AlertSeverity012Label,
|
||||
CreateAlertDialog.AlertSeverity013Label,
|
||||
CreateAlertDialog.AlertSeverity014Label,
|
||||
CreateAlertDialog.AlertSeverity015Label,
|
||||
CreateAlertDialog.AlertSeverity016Label,
|
||||
CreateAlertDialog.AlertSeverity017Label,
|
||||
CreateAlertDialog.AlertSeverity018Label,
|
||||
CreateAlertDialog.AlertSeverity019Label,
|
||||
CreateAlertDialog.AlertSeverity020Label,
|
||||
CreateAlertDialog.AlertSeverity021Label,
|
||||
CreateAlertDialog.AlertSeverity022Label,
|
||||
CreateAlertDialog.AlertSeverity023Label,
|
||||
CreateAlertDialog.AlertSeverity024Label,
|
||||
CreateAlertDialog.AlertSeverity025Label
|
||||
];
|
||||
|
||||
// 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;
|
||||
|
||||
// General tab controls
|
||||
private nameTextBox: sqlops.InputBoxComponent;
|
||||
private typeDropDown: sqlops.DropDownComponent;
|
||||
private severityDropDown: sqlops.DropDownComponent;
|
||||
private databaseDropDown: sqlops.DropDownComponent;
|
||||
private raiseAlertMessageCheckBox: sqlops.CheckBoxComponent;
|
||||
private raiseAlertMessageTextBox: 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(public ownerUri: string) {
|
||||
this.model = new CreateAlertData(ownerUri);
|
||||
}
|
||||
|
||||
public async showDialog() {
|
||||
|
||||
let databases = await AgentUtils.getDatabases(this.ownerUri);
|
||||
await this.model.initialize();
|
||||
this.dialog = sqlops.window.modelviewdialog.createDialog(CreateAlertDialog.DialogTitle);
|
||||
this.generalTab = sqlops.window.modelviewdialog.createTab(CreateAlertDialog.GeneralTabText);
|
||||
this.responseTab = sqlops.window.modelviewdialog.createTab(CreateAlertDialog.ResponseTabText);
|
||||
this.optionsTab = sqlops.window.modelviewdialog.createTab(CreateAlertDialog.OptionsTabText);
|
||||
|
||||
this.initializeGeneralTab(databases);
|
||||
this.initializeResponseTab();
|
||||
this.initializeOptionsTab();
|
||||
|
||||
this.dialog.content = [this.generalTab, this.responseTab, this.optionsTab];
|
||||
this.dialog.okButton.onClick(async () => await this.execute());
|
||||
this.dialog.cancelButton.onClick(async () => await this.cancel());
|
||||
this.dialog.okButton.label = CreateAlertDialog.OkButtonText;
|
||||
this.dialog.cancelButton.label = CreateAlertDialog.CancelButtonText;
|
||||
|
||||
sqlops.window.modelviewdialog.openDialog(this.dialog);
|
||||
}
|
||||
|
||||
private initializeGeneralTab(databases: string[]) {
|
||||
this.generalTab.registerContent(async view => {
|
||||
|
||||
this.nameTextBox = view.modelBuilder.inputBox().component();
|
||||
|
||||
// this.enabledCheckBox = view.modelBuilder.checkBox()
|
||||
// .withProperties({
|
||||
// label: this.EnabledCheckboxLabel
|
||||
// }).component();
|
||||
|
||||
this.databaseDropDown = view.modelBuilder.dropDown()
|
||||
.withProperties({
|
||||
value: databases[0],
|
||||
values: databases,
|
||||
title: CreateAlertDialog.DatabaseLabel
|
||||
}).component();
|
||||
|
||||
let formModel = view.modelBuilder.formContainer()
|
||||
.withFormItems([{
|
||||
component: this.nameTextBox,
|
||||
title: CreateAlertDialog.NameLabel
|
||||
}, {
|
||||
component: this.databaseDropDown,
|
||||
title: CreateAlertDialog.DatabaseLabel
|
||||
}]).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 async execute() {
|
||||
this.updateModel();
|
||||
await this.model.save();
|
||||
this._onSuccess.fire(this.model);
|
||||
}
|
||||
|
||||
private async cancel() {
|
||||
}
|
||||
|
||||
private updateModel() {
|
||||
}
|
||||
}
|
||||
149
extensions/agent/src/dialogs/createOperatorDialog.ts
Normal file
149
extensions/agent/src/dialogs/createOperatorDialog.ts
Normal file
@@ -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 { CreateOperatorData } from '../data/createOperatorData';
|
||||
|
||||
export class CreateOperatorDialog {
|
||||
|
||||
// Top level
|
||||
private readonly DialogTitle: string = 'Create Operator';
|
||||
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: CreateOperatorData;
|
||||
|
||||
private _onSuccess: vscode.EventEmitter<CreateOperatorData> = new vscode.EventEmitter<CreateOperatorData>();
|
||||
public readonly onSuccess: vscode.Event<CreateOperatorData> = this._onSuccess.event;
|
||||
|
||||
constructor(ownerUri: string) {
|
||||
this.model = new CreateOperatorData(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() {
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,12 @@
|
||||
|
||||
import * as sqlops from 'sqlops';
|
||||
import * as vscode from 'vscode';
|
||||
import { CreateAlertData } from '../data/createAlertData';
|
||||
import { CreateProxyData } from '../data/createProxyData';
|
||||
|
||||
export class CreateAlertDialog {
|
||||
export class CreateProxyDialog {
|
||||
|
||||
// Top level
|
||||
private readonly DialogTitle: string = 'Create Alert';
|
||||
private readonly DialogTitle: string = 'Create Proxy';
|
||||
private readonly OkButtonText: string = 'OK';
|
||||
private readonly CancelButtonText: string = 'Cancel';
|
||||
private readonly GeneralTabText: string = 'Response';
|
||||
@@ -52,13 +52,13 @@ export class CreateAlertDialog {
|
||||
// History tab controls
|
||||
private resetCountTextBox: sqlops.InputBoxComponent;
|
||||
|
||||
private model: CreateAlertData;
|
||||
private model: CreateProxyData;
|
||||
|
||||
private _onSuccess: vscode.EventEmitter<CreateAlertData> = new vscode.EventEmitter<CreateAlertData>();
|
||||
public readonly onSuccess: vscode.Event<CreateAlertData> = this._onSuccess.event;
|
||||
private _onSuccess: vscode.EventEmitter<CreateProxyData> = new vscode.EventEmitter<CreateProxyData>();
|
||||
public readonly onSuccess: vscode.Event<CreateProxyData> = this._onSuccess.event;
|
||||
|
||||
constructor(ownerUri: string) {
|
||||
this.model = new CreateAlertData(ownerUri);
|
||||
this.model = new CreateProxyData(ownerUri);
|
||||
}
|
||||
|
||||
public async showDialog() {
|
||||
21
extensions/agent/src/test/agent.test.ts
Normal file
21
extensions/agent/src/test/agent.test.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
import * as sqlops from 'sqlops';
|
||||
import { CreateJobData } from '../data/createJobData';
|
||||
import { TestAgentService } from './testAgentService';
|
||||
|
||||
const testOwnerUri = 'agent://testuri';
|
||||
|
||||
suite('Agent extension', () => {
|
||||
test('Create Job Data', async () => {
|
||||
let testAgentService = new TestAgentService();
|
||||
let data = new CreateJobData(testOwnerUri, testAgentService);
|
||||
data.save();
|
||||
});
|
||||
});
|
||||
102
extensions/agent/src/test/testAgentService.ts
Normal file
102
extensions/agent/src/test/testAgentService.ts
Normal file
@@ -0,0 +1,102 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
import * as sqlops from 'sqlops';
|
||||
|
||||
export class TestAgentService implements sqlops.AgentServicesProvider {
|
||||
handle?: number;
|
||||
readonly providerId: string = 'Test Provider';
|
||||
|
||||
// Job management methods
|
||||
getJobs(ownerUri: string): Thenable<sqlops.AgentJobsResult> {
|
||||
return undefined;
|
||||
}
|
||||
getJobHistory(ownerUri: string, jobId: string): Thenable<sqlops.AgentJobHistoryResult> {
|
||||
return undefined;
|
||||
}
|
||||
jobAction(ownerUri: string, jobName: string, action: string): Thenable<sqlops.ResultStatus> {
|
||||
return undefined;
|
||||
}
|
||||
createJob(ownerUri: string, jobInfo: sqlops.AgentJobInfo): Thenable<sqlops.CreateAgentJobResult> {
|
||||
return undefined;
|
||||
}
|
||||
updateJob(ownerUri: string, originalJobName: string, jobInfo: sqlops.AgentJobInfo): Thenable<sqlops.UpdateAgentJobResult> {
|
||||
return undefined;
|
||||
}
|
||||
deleteJob(ownerUri: string, jobInfo: sqlops.AgentJobInfo): Thenable<sqlops.ResultStatus> {
|
||||
return undefined;
|
||||
}
|
||||
getJobDefaults(ownerUri: string): Thenable<sqlops.AgentJobDefaultsResult> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Job Step management methods
|
||||
createJobStep(ownerUri: string, jobInfo: sqlops.AgentJobStepInfo): Thenable<sqlops.CreateAgentJobStepResult> {
|
||||
return undefined;
|
||||
}
|
||||
updateJobStep(ownerUri: string, originalJobStepName: string, jobInfo: sqlops.AgentJobStepInfo): Thenable<sqlops.UpdateAgentJobStepResult> {
|
||||
return undefined;
|
||||
}
|
||||
deleteJobStep(ownerUri: string, jobInfo: sqlops.AgentJobStepInfo): Thenable<sqlops.ResultStatus> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Alert management methods
|
||||
getAlerts(ownerUri: string): Thenable<sqlops.AgentAlertsResult> {
|
||||
return undefined;
|
||||
}
|
||||
createAlert(ownerUri: string, alertInfo: sqlops.AgentAlertInfo): Thenable<sqlops.CreateAgentAlertResult> {
|
||||
return undefined;
|
||||
}
|
||||
updateAlert(ownerUri: string, originalAlertName: string, alertInfo: sqlops.AgentAlertInfo): Thenable<sqlops.UpdateAgentAlertResult> {
|
||||
return undefined;
|
||||
}
|
||||
deleteAlert(ownerUri: string, alertInfo: sqlops.AgentAlertInfo): Thenable<sqlops.ResultStatus> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Operator management methods
|
||||
getOperators(ownerUri: string): Thenable<sqlops.AgentOperatorsResult> {
|
||||
return undefined;
|
||||
}
|
||||
createOperator(ownerUri: string, operatorInfo: sqlops.AgentOperatorInfo): Thenable<sqlops.CreateAgentOperatorResult> {
|
||||
return undefined;
|
||||
}
|
||||
updateOperator(ownerUri: string, originalOperatorName: string, operatorInfo: sqlops.AgentOperatorInfo): Thenable<sqlops.UpdateAgentOperatorResult> {
|
||||
return undefined;
|
||||
}
|
||||
deleteOperator(ownerUri: string, operatorInfo: sqlops.AgentOperatorInfo): Thenable<sqlops.ResultStatus> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Proxy management methods
|
||||
getProxies(ownerUri: string): Thenable<sqlops.AgentProxiesResult> {
|
||||
return undefined;
|
||||
}
|
||||
createProxy(ownerUri: string, proxyInfo: sqlops.AgentProxyInfo): Thenable<sqlops.CreateAgentOperatorResult> {
|
||||
return undefined;
|
||||
}
|
||||
updateProxy(ownerUri: string, originalProxyName: string, proxyInfo: sqlops.AgentProxyInfo): Thenable<sqlops.UpdateAgentOperatorResult> {
|
||||
return undefined;
|
||||
}
|
||||
deleteProxy(ownerUri: string, proxyInfo: sqlops.AgentProxyInfo): Thenable<sqlops.ResultStatus> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Job Schedule management methods
|
||||
getJobSchedules(ownerUri: string): Thenable<sqlops.AgentJobSchedulesResult> {
|
||||
return undefined;
|
||||
}
|
||||
createJobSchedule(ownerUri: string, scheduleInfo: sqlops.AgentJobScheduleInfo): Thenable<sqlops.CreateAgentJobScheduleResult> {
|
||||
return undefined;
|
||||
}
|
||||
updateJobSchedule(ownerUri: string, originalScheduleName: string, scheduleInfo: sqlops.AgentJobScheduleInfo): Thenable<sqlops.UpdateAgentJobScheduleResult> {
|
||||
return undefined;
|
||||
}
|
||||
deleteJobSchedule(ownerUri: string, scheduleInfo: sqlops.AgentJobScheduleInfo): Thenable<sqlops.ResultStatus> {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/// <reference path='../../../../../src/vs/vscode.d.ts'/>
|
||||
/// <reference path='../../../../../src/sql/sqlops.d.ts'/>
|
||||
/// <reference path='../../../../../src/sql/sqlops.proposed.d.ts'/>
|
||||
/// <reference path='../../../../src/vs/vscode.d.ts'/>
|
||||
/// <reference path='../../../../src/sql/sqlops.d.ts'/>
|
||||
/// <reference path='../../../../src/sql/sqlops.proposed.d.ts'/>
|
||||
/// <reference types='@types/node'/>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
<div class="jobs-view-toolbar">
|
||||
<div (click)="refreshJobs()" tabindex="0"><div class="small icon refresh"></div><span>{{RefreshText}}</span></div>
|
||||
<div (click)="openCreateJobDialog()" tabindex="0"><div class="small icon new"></div><span>{{NewAlertText}}</span></div>
|
||||
<div (click)="openCreateAlertDialog()" tabindex="0"><div class="small icon new"></div><span>{{NewAlertText}}</span></div>
|
||||
</div>
|
||||
|
||||
<div #jobalertsgrid class="jobview-grid"></div>
|
||||
|
||||
@@ -149,7 +149,7 @@ export class AlertsViewComponent implements AfterContentChecked {
|
||||
this._cd.detectChanges();
|
||||
}
|
||||
|
||||
private openCreateJobDialog() {
|
||||
private openCreateAlertDialog() {
|
||||
let ownerUri: string = this._dashboardService.connectionManagementService.connectionInfo.ownerUri;
|
||||
this._commandService.executeCommand('agent.openCreateAlertDialog', ownerUri);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user