SQL Operations Studio Public Preview 1 (0.23) release source code

This commit is contained in:
Karl Burtram
2017-11-09 14:30:27 -08:00
parent b88ecb8d93
commit 3cdac41339
8829 changed files with 759707 additions and 286 deletions

View File

@@ -0,0 +1,132 @@
<!--
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
-->
<div class="task-content">
<form #f="ngForm"
(ngSubmit)="onSubmit(f)">
<span>General</span>
<table class="task-input-table">
<tr>
<td class="task-input-table-label-column">
Database name:
</td>
<td class="task-input-table-content-column">
<input name="databaseName" type="text" id="databaseNameInput" class="task-text-input"
ngModel required [disabled]="formSubmitted" #databaseName="ngModel" />
</td>
</tr>
<!--
<tr>
<td class="task-input-table-label-column">
Owner:
</td>
<td class="task-input-table-content-column">
<table style="width:100%">
<tr>
<td style="width:100%">
<input name="databaseOwner" type="text" id="databaseOwnerInput" class="task-text-input"
ngModel required #databaseOwner="ngModel" />
</td>
<td style="width:auto; padding-left: 5px;">
<button (click)="onSelectOwner()">...</button>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<label><input id="full-text-index" type="checkbox" /><span>Use full-text indexing</span></label>
</td>
</tr>
-->
</table>
<span>{{databaseFilesLabel}}</span>
<table class="task-input-table">
<tr>
<td>
<p-dataTable [value]="databaseFiles" [tableStyle]="{'overflow': 'auto'}" [emptyMessage]="noRecordsFoundLabel">
<p-column header="Logical Name" field="logicalName" ></p-column>
<p-column header="File Type" field="fileType"></p-column>
<p-column header="File Group" field="filegroup"></p-column>
<p-column header="Initial Size" field="initialSize"></p-column>
<p-column header="Autogrow" field="autogrow"></p-column>
<p-column header="Path" field="path"></p-column>
</p-dataTable>
</td>
</tr>
<!--
<tr>
<td class="task-button-bar" style="padding-top: 5px">
<button>Add</button>
<button>Remove</button>
</td>
</tr>
-->
</table>
<!--
<span>Options</span>
<table class="task-input-table">
<tr>
<td class="task-input-table-label-column">
Collation:
</td>
<td class="task-input-table-content-column">
<select>
<option>default</option>
</select>
</td>
</tr>
<tr>
<td class="task-input-table-label-column">
Recovery model:
</td>
<td class="task-input-table-content-column">
<select>
<option>Full</option>
</select>
</td>
</tr>
<tr>
<td class="task-input-table-label-column">
Compatability level:
</td>
<td class="task-input-table-content-column">
<select>
<option>SQL Server vNext (140)</option>
</select>
</td>
</tr>
<tr>
<td class="task-input-table-label-column">
Containment type:
</td>
<td class="task-input-table-content-column">
<select>
<option>None</option>
</select>
</td>
</tr>
</table>
-->
<div class="task-button-bar">
<button type="submit" id="ok-button" [disabled]="formSubmitted">OK</button>
</div>
</form>
</div>

View File

@@ -0,0 +1,98 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ChangeDetectorRef, ElementRef, Component, forwardRef, Inject } from '@angular/core';
import { NgForm } from '@angular/forms';
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
import { TaskDialogComponentParams } from 'sql/services/bootstrap/bootstrapParams';
import { ConnectionManagementInfo } from 'sql/parts/connection/common/connectionManagementInfo';
import { IAdminService } from 'sql/parts/admin/common/adminService';
import { ITaskDialogComponent } from 'sql/parts/tasks/common/tasks';
import data = require('data');
import * as nls from 'vs/nls';
export const CREATEDATABASE_SELECTOR: string = 'createdatabase-component';
export interface DatabaseFile {
logicalName: string;
fileType: string;
filegroup: string;
initialSize: string;
autogrow: string;
path: string;
}
@Component({
selector: CREATEDATABASE_SELECTOR,
templateUrl: decodeURI(require.toUrl('sql/parts/admin/database/create/createDatabase.component.html'))
})
export class CreateDatabaseComponent implements ITaskDialogComponent {
private _adminService: IAdminService;
public formSubmitted: boolean = false;
public ownerUri: string;
public connection: ConnectionManagementInfo;
public databaseFiles: DatabaseFile[] = [];
// tslint:disable:no-unused-variable
private readonly databaseFilesLabel: string = nls.localize('createDatabase.databaseFiles', 'Database files:');
private readonly noRecordsFoundLabel: string = nls.localize('createDatabase.noRecordsFound', 'No records found');
// tslint:enable:no-unused-variable
constructor(
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeDetectorRef: ChangeDetectorRef,
@Inject(BOOTSTRAP_SERVICE_ID) private _bootstrapService: IBootstrapService
) {
this._adminService = this._bootstrapService.adminService;
}
private getDatabaseInfo(form: NgForm): data.DatabaseInfo {
return <data.DatabaseInfo>{
options: {
name: form.value.databaseName,
owner: form.value.databaseOwner
}
};
}
public onSubmit(form: NgForm): void {
this._adminService.createDatabase(this.ownerUri, this.getDatabaseInfo(form));
this.formSubmitted = true;
this._changeDetectorRef.detectChanges();
}
public onOk(): void { }
public onGenerateScript(): void { }
public onCancel(): void { }
public onSelectOwner(): void { }
public injectBootstapper(parameters: TaskDialogComponentParams ): void {
let self = this;
this.ownerUri = parameters.ownerUri;
this._adminService.getDefaultDatabaseInfo(this.ownerUri).then(dbInfo => {
let databaseFilesCount = dbInfo.options['databaseFilesCount'];
for (let i = 0; i < databaseFilesCount; ++i) {
self.databaseFiles[i] = {
logicalName: dbInfo.options['databaseFiles.' + i + '.name'],
fileType: dbInfo.options['databaseFiles.' + i + '.databaseFileType'],
filegroup: dbInfo.options['databaseFiles.' + i + '.fileGroup'],
initialSize: dbInfo.options['databaseFiles.' + i + '.initialSize'],
autogrow: dbInfo.options['databaseFiles.' + i + '.autogrowth'],
path: dbInfo.options['databaseFiles.' + i + '.folder']
};
}
self._changeDetectorRef.detectChanges();
});
}
}