Archived
Add more folders to strict compile (#8954)
* add more folders to strictire compile, add more strict compile options * update ci * remove unnecessary assertion
This commit is contained in:
@@ -37,8 +37,8 @@ jobs:
|
|||||||
# name: Download Electron
|
# name: Download Electron
|
||||||
# - run: yarn gulp hygiene
|
# - run: yarn gulp hygiene
|
||||||
# name: Run Hygiene Checks
|
# name: Run Hygiene Checks
|
||||||
# - run: yarn strict-null-check # {{SQL CARBON EDIT}} add step
|
# - run: yarn strict-vscode # {{SQL CARBON EDIT}} add step
|
||||||
# name: Run Strict Null Check
|
# name: Run Strict Compile Options
|
||||||
# # - run: yarn monaco-compile-check {{SQL CARBON EDIT}} remove step
|
# # - run: yarn monaco-compile-check {{SQL CARBON EDIT}} remove step
|
||||||
# # name: Run Monaco Editor Checks
|
# # name: Run Monaco Editor Checks
|
||||||
# - run: yarn valid-layers-check
|
# - run: yarn valid-layers-check
|
||||||
@@ -71,8 +71,8 @@ jobs:
|
|||||||
name: Download Electron
|
name: Download Electron
|
||||||
- run: yarn gulp hygiene
|
- run: yarn gulp hygiene
|
||||||
name: Run Hygiene Checks
|
name: Run Hygiene Checks
|
||||||
- run: yarn strict-null-check # {{SQL CARBON EDIT}} add step
|
- run: yarn strict-vscode # {{SQL CARBON EDIT}} add step
|
||||||
name: Run Strict Null Check
|
name: Run Strict Compile Options
|
||||||
# - run: yarn monaco-compile-check {{SQL CARBON EDIT}} remove step
|
# - run: yarn monaco-compile-check {{SQL CARBON EDIT}} remove step
|
||||||
# name: Run Monaco Editor Checks
|
# name: Run Monaco Editor Checks
|
||||||
- run: yarn valid-layers-check
|
- run: yarn valid-layers-check
|
||||||
@@ -102,8 +102,8 @@ jobs:
|
|||||||
name: Download Electron
|
name: Download Electron
|
||||||
- run: yarn gulp hygiene
|
- run: yarn gulp hygiene
|
||||||
name: Run Hygiene Checks
|
name: Run Hygiene Checks
|
||||||
- run: yarn strict-null-check # {{SQL CARBON EDIT}} add step
|
- run: yarn strict-vscode # {{SQL CARBON EDIT}} add step
|
||||||
name: Run Strict Null Check
|
name: Run Strict Compile Options
|
||||||
# - run: yarn monaco-compile-check {{SQL CARBON EDIT}} remove step
|
# - run: yarn monaco-compile-check {{SQL CARBON EDIT}} remove step
|
||||||
# name: Run Monaco Editor Checks
|
# name: Run Monaco Editor Checks
|
||||||
- run: yarn valid-layers-check
|
- run: yarn valid-layers-check
|
||||||
|
|||||||
Vendored
+3
-3
@@ -47,15 +47,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "npm",
|
"type": "npm",
|
||||||
"script": "strict-null-check-watch",
|
"script": "strict-vscode-watch",
|
||||||
"label": "TS - Strict Null Checks",
|
"label": "TS - Strict VSCode",
|
||||||
"isBackground": true,
|
"isBackground": true,
|
||||||
"presentation": {
|
"presentation": {
|
||||||
"reveal": "never"
|
"reveal": "never"
|
||||||
},
|
},
|
||||||
"problemMatcher": {
|
"problemMatcher": {
|
||||||
"base": "$tsc-watch",
|
"base": "$tsc-watch",
|
||||||
"owner": "typescript-strict-null-checks",
|
"owner": "typescript-vscode",
|
||||||
"applyTo": "allDocuments"
|
"applyTo": "allDocuments"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ steps:
|
|||||||
yarn gulp hygiene
|
yarn gulp hygiene
|
||||||
displayName: Run Hygiene Checks
|
displayName: Run Hygiene Checks
|
||||||
- script: | # {{SQL CARBON EDIT}} add step
|
- script: | # {{SQL CARBON EDIT}} add step
|
||||||
yarn strict-null-check
|
yarn strict-vscode
|
||||||
displayName: Run Strict Null Check.
|
displayName: Run Strict Null Check.
|
||||||
# - script: | {{SQL CARBON EDIT}} remove step
|
# - script: | {{SQL CARBON EDIT}} remove step
|
||||||
# yarn monaco-compile-check
|
# yarn monaco-compile-check
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ steps:
|
|||||||
yarn gulp hygiene
|
yarn gulp hygiene
|
||||||
displayName: Run Hygiene Checks
|
displayName: Run Hygiene Checks
|
||||||
- script: | # {{SQL CARBON EDIT}} add strict null check
|
- script: | # {{SQL CARBON EDIT}} add strict null check
|
||||||
yarn strict-null-check
|
yarn strict-vscode
|
||||||
displayName: Run Strict Null Check
|
displayName: Run Strict Null Check
|
||||||
# - script: | {{SQL CARBON EDIT}} remove monaco editor checks
|
# - script: | {{SQL CARBON EDIT}} remove monaco editor checks
|
||||||
# yarn monaco-compile-check
|
# yarn monaco-compile-check
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ steps:
|
|||||||
- script: |
|
- script: |
|
||||||
set -e
|
set -e
|
||||||
yarn gulp hygiene
|
yarn gulp hygiene
|
||||||
yarn strict-null-check
|
yarn strict-vscode
|
||||||
yarn valid-layers-check
|
yarn valid-layers-check
|
||||||
displayName: Run hygiene, tslint
|
displayName: Run hygiene, tslint
|
||||||
condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ steps:
|
|||||||
yarn gulp hygiene
|
yarn gulp hygiene
|
||||||
displayName: Run Hygiene Checks
|
displayName: Run Hygiene Checks
|
||||||
- script: | # {{SQL CARBON EDIT}} add step
|
- script: | # {{SQL CARBON EDIT}} add step
|
||||||
yarn strict-null-check
|
yarn strict-vscode
|
||||||
displayName: Run Strict Null Check
|
displayName: Run Strict Null Check
|
||||||
# - powershell: | {{SQL CARBON EDIT}} remove step
|
# - powershell: | {{SQL CARBON EDIT}} remove step
|
||||||
# yarn monaco-compile-check
|
# yarn monaco-compile-check
|
||||||
|
|||||||
+2
-2
@@ -24,8 +24,8 @@
|
|||||||
"update-localization-extension": "node build/npm/update-localization-extension.js",
|
"update-localization-extension": "node build/npm/update-localization-extension.js",
|
||||||
"smoketest": "cd test/smoke && node test/index.js",
|
"smoketest": "cd test/smoke && node test/index.js",
|
||||||
"monaco-compile-check": "tsc -p src/tsconfig.monaco.json --noEmit",
|
"monaco-compile-check": "tsc -p src/tsconfig.monaco.json --noEmit",
|
||||||
"strict-null-check": "node node_modules/typescript/bin/tsc -p src/tsconfig.strictNullChecks.json",
|
"strict-vscode": "node node_modules/typescript/bin/tsc -p src/tsconfig.vscode.json",
|
||||||
"strict-null-check-watch": "node node_modules/typescript/bin/tsc -p src/tsconfig.strictNullChecks.json --watch",
|
"strict-vscode-watch": "node node_modules/typescript/bin/tsc -p src/tsconfig.vscode.json --watch",
|
||||||
"strict-initialization-watch": "tsc --watch -p src/tsconfig.json --noEmit --strictPropertyInitialization",
|
"strict-initialization-watch": "tsc --watch -p src/tsconfig.json --noEmit --strictPropertyInitialization",
|
||||||
"valid-layers-check": "node build/lib/layersChecker.js",
|
"valid-layers-check": "node build/lib/layersChecker.js",
|
||||||
"strict-function-types-watch": "tsc --watch -p src/tsconfig.json --noEmit --strictFunctionTypes",
|
"strict-function-types-watch": "tsc --watch -p src/tsconfig.json --noEmit --strictFunctionTypes",
|
||||||
|
|||||||
Vendored
+1
-1
@@ -328,7 +328,7 @@ declare module 'azdata' {
|
|||||||
authenticationType: string;
|
authenticationType: string;
|
||||||
savePassword: boolean;
|
savePassword: boolean;
|
||||||
groupFullName?: string;
|
groupFullName?: string;
|
||||||
groupId: string;
|
groupId?: string;
|
||||||
providerName: string;
|
providerName: string;
|
||||||
saveProfile: boolean;
|
saveProfile: boolean;
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ import { Checkbox as sqlCheckbox } from 'sql/base/browser/ui/checkbox/checkbox';
|
|||||||
template: ''
|
template: ''
|
||||||
})
|
})
|
||||||
export class Checkbox implements OnInit, OnChanges {
|
export class Checkbox implements OnInit, OnChanges {
|
||||||
@Input() label: string;
|
@Input() label!: string;
|
||||||
@Input() enabled = true;
|
@Input() enabled = true;
|
||||||
@Input() checked = true;
|
@Input() checked = true;
|
||||||
@Input('aria-label') private ariaLabel: string;
|
@Input('aria-label') private ariaLabel?: string;
|
||||||
|
|
||||||
@Output() onChange = new EventEmitter<boolean>();
|
@Output() onChange = new EventEmitter<boolean>();
|
||||||
|
|
||||||
private _checkbox: sqlCheckbox;
|
private _checkbox?: sqlCheckbox;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef
|
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export class InputBox extends vsInputBox {
|
|||||||
private _onLoseFocus = this._register(new Emitter<OnLoseFocusParams>());
|
private _onLoseFocus = this._register(new Emitter<OnLoseFocusParams>());
|
||||||
public onLoseFocus: Event<OnLoseFocusParams> = this._onLoseFocus.event;
|
public onLoseFocus: Event<OnLoseFocusParams> = this._onLoseFocus.event;
|
||||||
|
|
||||||
private _isTextAreaInput: boolean;
|
private _isTextAreaInput = false;
|
||||||
private _hideErrors = false;
|
private _hideErrors = false;
|
||||||
|
|
||||||
constructor(container: HTMLElement, contextViewProvider: IContextViewProvider, options?: IInputOptions) {
|
constructor(container: HTMLElement, contextViewProvider: IContextViewProvider, options?: IInputOptions) {
|
||||||
|
|||||||
@@ -60,11 +60,11 @@ export class ListBox extends SelectBox {
|
|||||||
this.contextViewProvider = contextViewProvider;
|
this.contextViewProvider = contextViewProvider;
|
||||||
this.isValid = true;
|
this.isValid = true;
|
||||||
this.selectElement.multiple = true;
|
this.selectElement.multiple = true;
|
||||||
this.selectElement.style['height'] = '80px';
|
this.selectElement.style.height = '80px';
|
||||||
|
|
||||||
// Set width style for horizontal scrollbar
|
// Set width style for horizontal scrollbar
|
||||||
this.selectElement.style['width'] = 'inherit';
|
this.selectElement.style.width = 'inherit';
|
||||||
this.selectElement.style['min-width'] = '100%';
|
this.selectElement.style.minWidth = '100%';
|
||||||
|
|
||||||
this._register(dom.addStandardDisposableListener(this.selectElement, dom.EventType.KEY_DOWN, (e: StandardKeyboardEvent) => this._onKeyDown.fire(e)));
|
this._register(dom.addStandardDisposableListener(this.selectElement, dom.EventType.KEY_DOWN, (e: StandardKeyboardEvent) => this._onKeyDown.fire(e)));
|
||||||
|
|
||||||
|
|||||||
@@ -68,30 +68,29 @@ let idPool = 0;
|
|||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class PanelComponent extends Disposable {
|
export class PanelComponent extends Disposable {
|
||||||
@Input() public options: IPanelOptions;
|
@Input() public options?: IPanelOptions;
|
||||||
@Input() public actions: Array<Action>;
|
@Input() public actions?: Array<Action>;
|
||||||
@ContentChildren(TabComponent) private _tabs: QueryList<TabComponent>;
|
@ContentChildren(TabComponent) private readonly _tabs!: QueryList<TabComponent>;
|
||||||
@ViewChild(ScrollableDirective) private scrollable: ScrollableDirective;
|
@ViewChild(ScrollableDirective) private scrollable?: ScrollableDirective;
|
||||||
|
|
||||||
@Output() public onTabChange = new EventEmitter<TabComponent>();
|
@Output() public onTabChange = new EventEmitter<TabComponent>();
|
||||||
@Output() public onTabClose = new EventEmitter<TabComponent>();
|
@Output() public onTabClose = new EventEmitter<TabComponent>();
|
||||||
|
|
||||||
private _activeTab: TabComponent;
|
private _activeTab?: TabComponent;
|
||||||
private _actionbar: ActionBar;
|
private _actionbar?: ActionBar;
|
||||||
private _mru: TabComponent[];
|
private _mru: TabComponent[] = [];
|
||||||
|
|
||||||
protected AutoScrollbarVisibility = ScrollbarVisibility.Auto; // used by angular template
|
protected AutoScrollbarVisibility = ScrollbarVisibility.Auto; // used by angular template
|
||||||
protected HiddenScrollbarVisibility = ScrollbarVisibility.Hidden; // used by angular template
|
protected HiddenScrollbarVisibility = ScrollbarVisibility.Hidden; // used by angular template
|
||||||
protected NavigationBarLayout = NavigationBarLayout; // used by angular template
|
protected NavigationBarLayout = NavigationBarLayout; // used by angular template
|
||||||
|
|
||||||
@ViewChild('panelActionbar', { read: ElementRef }) private _actionbarRef: ElementRef;
|
@ViewChild('panelActionbar', { read: ElementRef }) private _actionbarRef!: ElementRef;
|
||||||
constructor(@Inject(forwardRef(() => NgZone)) private _zone: NgZone) {
|
constructor(@Inject(forwardRef(() => NgZone)) private _zone: NgZone) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.options = mixin(this.options || {}, defaultOptions, false);
|
this.options = mixin(this.options || {}, defaultOptions, false);
|
||||||
this._mru = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentInit(): void {
|
ngAfterContentInit(): void {
|
||||||
@@ -195,8 +194,8 @@ export class PanelComponent extends Disposable {
|
|||||||
/**
|
/**
|
||||||
* Get the id of the active tab
|
* Get the id of the active tab
|
||||||
*/
|
*/
|
||||||
public get getActiveTab(): string {
|
public get getActiveTab(): string | undefined {
|
||||||
return this._activeTab.identifier;
|
return this._activeTab?.identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -244,6 +243,6 @@ export class PanelComponent extends Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public layout() {
|
public layout() {
|
||||||
this._activeTab.layout();
|
this._activeTab?.layout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export class TabbedPanel extends Disposable {
|
|||||||
private body: HTMLElement;
|
private body: HTMLElement;
|
||||||
private parent: HTMLElement;
|
private parent: HTMLElement;
|
||||||
private _actionbar: ActionBar;
|
private _actionbar: ActionBar;
|
||||||
private _currentDimensions: DOM.Dimension;
|
private _currentDimensions?: DOM.Dimension;
|
||||||
private _collapsed = false;
|
private _collapsed = false;
|
||||||
private _headerVisible: boolean;
|
private _headerVisible: boolean;
|
||||||
private _styleElement: HTMLStyleElement;
|
private _styleElement: HTMLStyleElement;
|
||||||
@@ -130,8 +130,10 @@ export class TabbedPanel extends Disposable {
|
|||||||
if (this._tabMap.size > 1 && !this._headerVisible) {
|
if (this._tabMap.size > 1 && !this._headerVisible) {
|
||||||
this.parent.insertBefore(this.header, this.parent.firstChild);
|
this.parent.insertBefore(this.header, this.parent.firstChild);
|
||||||
this._headerVisible = true;
|
this._headerVisible = true;
|
||||||
|
if (this._currentDimensions) {
|
||||||
this.layout(this._currentDimensions);
|
this.layout(this._currentDimensions);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return tab.identifier as PanelTabIdentifier;
|
return tab.identifier as PanelTabIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,9 +289,11 @@ export class TabbedPanel extends Disposable {
|
|||||||
if (!this.options.showHeaderWhenSingleView && this._tabMap.size === 1 && this._headerVisible) {
|
if (!this.options.showHeaderWhenSingleView && this._tabMap.size === 1 && this._headerVisible) {
|
||||||
this.header.remove();
|
this.header.remove();
|
||||||
this._headerVisible = false;
|
this._headerVisible = false;
|
||||||
|
if (this._currentDimensions) {
|
||||||
this.layout(this._currentDimensions);
|
this.layout(this._currentDimensions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private focusNextTab(index: number): void {
|
private focusNextTab(index: number): void {
|
||||||
if (index < 0 || index > this.tabList.children.length) {
|
if (index < 0 || index > this.tabList.children.length) {
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ export abstract class TabChild extends Disposable {
|
|||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class TabComponent implements OnDestroy {
|
export class TabComponent implements OnDestroy {
|
||||||
private _child: TabChild;
|
private _child?: TabChild;
|
||||||
@ContentChild(TemplateRef) templateRef: TemplateRef<any>;
|
@ContentChild(TemplateRef) templateRef!: TemplateRef<any>;
|
||||||
@Input() public title: string;
|
@Input() public title!: string;
|
||||||
@Input() public canClose: boolean;
|
@Input() public canClose!: boolean;
|
||||||
@Input() public actions: Array<Action>;
|
@Input() public actions?: Array<Action>;
|
||||||
@Input() public iconClass: string;
|
@Input() public iconClass?: string;
|
||||||
public _active = false;
|
public _active = false;
|
||||||
@Input() public identifier: string;
|
@Input() public identifier!: string;
|
||||||
@Input() private visibilityType: 'if' | 'visibility' = 'if';
|
@Input() private visibilityType: 'if' | 'visibility' = 'if';
|
||||||
private rendered = false;
|
private rendered = false;
|
||||||
private destroyed: boolean = false;
|
private destroyed: boolean = false;
|
||||||
|
|||||||
@@ -29,17 +29,17 @@ import { CloseTabAction } from 'sql/base/browser/ui/panel/tabActions';
|
|||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class TabHeaderComponent extends Disposable implements AfterContentInit, OnDestroy {
|
export class TabHeaderComponent extends Disposable implements AfterContentInit, OnDestroy {
|
||||||
@Input() public tab: TabComponent;
|
@Input() public tab!: TabComponent;
|
||||||
@Input() public showIcon: boolean;
|
@Input() public showIcon?: boolean;
|
||||||
@Input() public active: boolean;
|
@Input() public active?: boolean;
|
||||||
@Output() public onSelectTab: EventEmitter<TabComponent> = new EventEmitter<TabComponent>();
|
@Output() public onSelectTab: EventEmitter<TabComponent> = new EventEmitter<TabComponent>();
|
||||||
@Output() public onCloseTab: EventEmitter<TabComponent> = new EventEmitter<TabComponent>();
|
@Output() public onCloseTab: EventEmitter<TabComponent> = new EventEmitter<TabComponent>();
|
||||||
|
|
||||||
private _actionbar: ActionBar;
|
private _actionbar!: ActionBar;
|
||||||
|
|
||||||
@ViewChild('actionHeader', { read: ElementRef }) private _actionHeaderRef: ElementRef;
|
@ViewChild('actionHeader', { read: ElementRef }) private _actionHeaderRef!: ElementRef;
|
||||||
@ViewChild('actionbar', { read: ElementRef }) private _actionbarRef: ElementRef;
|
@ViewChild('actionbar', { read: ElementRef }) private _actionbarRef!: ElementRef;
|
||||||
@ViewChild('tabLabel', { read: ElementRef }) private _tabLabelRef: ElementRef;
|
@ViewChild('tabLabel', { read: ElementRef }) private _tabLabelRef!: ElementRef;
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ import { AngularDisposable } from 'sql/base/browser/lifecycle';
|
|||||||
selector: '[scrollable]'
|
selector: '[scrollable]'
|
||||||
})
|
})
|
||||||
export class ScrollableDirective extends AngularDisposable {
|
export class ScrollableDirective extends AngularDisposable {
|
||||||
private scrollableElement: ScrollableElement;
|
private scrollableElement!: ScrollableElement;
|
||||||
private parent: HTMLElement;
|
private parent!: HTMLElement;
|
||||||
private scrolled: HTMLElement;
|
private scrolled!: HTMLElement;
|
||||||
@Input() horizontalScroll: ScrollbarVisibility;
|
@Input() horizontalScroll?: ScrollbarVisibility;
|
||||||
@Input() verticalScroll: ScrollbarVisibility;
|
@Input() verticalScroll?: ScrollbarVisibility;
|
||||||
@Input() useShadow = false;
|
@Input() useShadow = false;
|
||||||
@Input() scrollYToX = false;
|
@Input() scrollYToX = false;
|
||||||
|
|
||||||
|
|||||||
@@ -121,12 +121,12 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
|||||||
private proportions: undefined | number[] = undefined;
|
private proportions: undefined | number[] = undefined;
|
||||||
private viewItems: IViewItem[] = [];
|
private viewItems: IViewItem[] = [];
|
||||||
private sashItems: ISashItem[] = [];
|
private sashItems: ISashItem[] = [];
|
||||||
private sashDragState: ISashDragState;
|
private sashDragState?: ISashDragState;
|
||||||
private state: State = State.Idle;
|
private state: State = State.Idle;
|
||||||
private inverseAltBehavior: boolean;
|
private inverseAltBehavior: boolean;
|
||||||
|
|
||||||
private lastRenderHeight: number;
|
private lastRenderHeight?: number;
|
||||||
private lastRenderTop: number;
|
private lastRenderTop?: number;
|
||||||
|
|
||||||
private options: ISplitViewOptions;
|
private options: ISplitViewOptions;
|
||||||
|
|
||||||
@@ -317,8 +317,8 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
|||||||
|
|
||||||
// Re-render the views. Set lastRenderTop and lastRenderHeight to undefined since
|
// Re-render the views. Set lastRenderTop and lastRenderHeight to undefined since
|
||||||
// this isn't actually scrolling up or down
|
// this isn't actually scrolling up or down
|
||||||
let scrollTop = this.lastRenderTop;
|
let scrollTop = this.lastRenderTop!;
|
||||||
let viewHeight = this.lastRenderHeight;
|
let viewHeight = this.lastRenderHeight!;
|
||||||
this.lastRenderTop = 0;
|
this.lastRenderTop = 0;
|
||||||
this.lastRenderHeight = 0;
|
this.lastRenderHeight = 0;
|
||||||
this.render(scrollTop, viewHeight);
|
this.render(scrollTop, viewHeight);
|
||||||
@@ -528,8 +528,8 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
|||||||
|
|
||||||
// This way, we can press Alt while we resize a sash, macOS style!
|
// This way, we can press Alt while we resize a sash, macOS style!
|
||||||
const disposable = combinedDisposable(
|
const disposable = combinedDisposable(
|
||||||
domEvent(document.body, 'keydown')(e => resetSashDragState(this.sashDragState.current, e.altKey)),
|
domEvent(document.body, 'keydown')(e => resetSashDragState(this.sashDragState!.current, e.altKey)),
|
||||||
domEvent(document.body, 'keyup')(() => resetSashDragState(this.sashDragState.current, false))
|
domEvent(document.body, 'keyup')(() => resetSashDragState(this.sashDragState!.current, false))
|
||||||
);
|
);
|
||||||
|
|
||||||
const resetSashDragState = (start: number, alt: boolean) => {
|
const resetSashDragState = (start: number, alt: boolean) => {
|
||||||
@@ -565,8 +565,8 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private onSashChange({ current }: ISashEvent): void {
|
private onSashChange({ current }: ISashEvent): void {
|
||||||
const { index, start, sizes, alt, minDelta, maxDelta } = this.sashDragState;
|
const { index, start, sizes, alt, minDelta, maxDelta } = this.sashDragState!;
|
||||||
this.sashDragState.current = current;
|
this.sashDragState!.current = current;
|
||||||
|
|
||||||
const delta = current - start;
|
const delta = current - start;
|
||||||
const newDelta = this.resize(index, delta, sizes, undefined, undefined, minDelta, maxDelta);
|
const newDelta = this.resize(index, delta, sizes, undefined, undefined, minDelta, maxDelta);
|
||||||
@@ -589,7 +589,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
|||||||
|
|
||||||
private onSashEnd(index: number): void {
|
private onSashEnd(index: number): void {
|
||||||
this._onDidSashChange.fire(index);
|
this._onDidSashChange.fire(index);
|
||||||
this.sashDragState.disposable.dispose();
|
this.sashDragState!.disposable.dispose();
|
||||||
this.saveProportions();
|
this.saveProportions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -686,7 +686,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
|||||||
|
|
||||||
let renderTop = scrollTop;
|
let renderTop = scrollTop;
|
||||||
let renderBottom = scrollTop + viewHeight;
|
let renderBottom = scrollTop + viewHeight;
|
||||||
let thisRenderBottom = this.lastRenderTop + this.lastRenderHeight;
|
let thisRenderBottom = this.lastRenderTop! + this.lastRenderHeight!;
|
||||||
|
|
||||||
// when view scrolls down, start rendering from the renderBottom
|
// when view scrolls down, start rendering from the renderBottom
|
||||||
for (i = this.indexAfter(renderBottom) - 1, stop = this.indexAt(Math.max(thisRenderBottom, renderTop)); i >= stop; i--) {
|
for (i = this.indexAfter(renderBottom) - 1, stop = this.indexAt(Math.max(thisRenderBottom, renderTop)); i >= stop; i--) {
|
||||||
@@ -696,21 +696,21 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// when view scrolls up, start rendering from either this.renderTop or renderBottom
|
// when view scrolls up, start rendering from either this.renderTop or renderBottom
|
||||||
for (i = Math.min(this.indexAt(this.lastRenderTop), this.indexAfter(renderBottom)) - 1, stop = this.indexAt(renderTop); i >= stop; i--) {
|
for (i = Math.min(this.indexAt(this.lastRenderTop!), this.indexAfter(renderBottom)) - 1, stop = this.indexAt(renderTop); i >= stop; i--) {
|
||||||
if (this.insertItemInDOM(<IViewItem>this.itemAtIndex(i))) {
|
if (this.insertItemInDOM(<IViewItem>this.itemAtIndex(i))) {
|
||||||
this.dirtyState = true;
|
this.dirtyState = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// when view scrolls down, start unrendering from renderTop
|
// when view scrolls down, start unrendering from renderTop
|
||||||
for (i = this.indexAt(this.lastRenderTop), stop = Math.min(this.indexAt(renderTop), this.indexAfter(thisRenderBottom)); i < stop; i++) {
|
for (i = this.indexAt(this.lastRenderTop!), stop = Math.min(this.indexAt(renderTop), this.indexAfter(thisRenderBottom)); i < stop; i++) {
|
||||||
if (this.removeItemFromDOM(<IViewItem>this.itemAtIndex(i))) {
|
if (this.removeItemFromDOM(<IViewItem>this.itemAtIndex(i))) {
|
||||||
this.dirtyState = true;
|
this.dirtyState = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// when view scrolls up, start unrendering from either renderBottom this.renderTop
|
// when view scrolls up, start unrendering from either renderBottom this.renderTop
|
||||||
for (i = Math.max(this.indexAfter(renderBottom), this.indexAt(this.lastRenderTop)), stop = this.indexAfter(thisRenderBottom); i < stop; i++) {
|
for (i = Math.max(this.indexAfter(renderBottom), this.indexAt(this.lastRenderTop!)), stop = this.indexAfter(thisRenderBottom); i < stop; i++) {
|
||||||
if (this.removeItemFromDOM(<IViewItem>this.itemAtIndex(i))) {
|
if (this.removeItemFromDOM(<IViewItem>this.itemAtIndex(i))) {
|
||||||
this.dirtyState = true;
|
this.dirtyState = true;
|
||||||
}
|
}
|
||||||
@@ -854,7 +854,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
|||||||
this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);
|
||||||
|
|
||||||
if (this.dirtyState) {
|
if (this.dirtyState) {
|
||||||
for (let i = this.indexAt(this.lastRenderTop); i <= this.indexAfter(this.lastRenderTop + this.lastRenderHeight) - 1; i++) {
|
for (let i = this.indexAt(this.lastRenderTop!); i <= this.indexAfter(this.lastRenderTop! + this.lastRenderHeight!) - 1; i++) {
|
||||||
this.viewItems[i].layout();
|
this.viewItems[i].layout();
|
||||||
if (this.options.enableResizing) {
|
if (this.options.enableResizing) {
|
||||||
this.sashItems[i].sash.layout();
|
this.sashItems[i].sash.layout();
|
||||||
|
|||||||
@@ -58,9 +58,7 @@ export class SelectBox extends vsSelectBox {
|
|||||||
private inputValidationErrorBackground?: Color;
|
private inputValidationErrorBackground?: Color;
|
||||||
private inputValidationErrorForeground?: Color;
|
private inputValidationErrorForeground?: Color;
|
||||||
|
|
||||||
private element: HTMLElement;
|
private element?: HTMLElement;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
constructor(options: string[], selectedOption: string, contextViewProvider: IContextViewProvider, container?: HTMLElement, selectBoxOptions?: ISelectBoxOptions) {
|
constructor(options: string[], selectedOption: string, contextViewProvider: IContextViewProvider, container?: HTMLElement, selectBoxOptions?: ISelectBoxOptions) {
|
||||||
super(options.map(option => { return { text: option }; }), 0, contextViewProvider, undefined, selectBoxOptions);
|
super(options.map(option => { return { text: option }; }), 0, contextViewProvider, undefined, selectBoxOptions);
|
||||||
@@ -261,10 +259,12 @@ export class SelectBox extends vsSelectBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public hideMessage(): void {
|
public hideMessage(): void {
|
||||||
|
if (this.element) {
|
||||||
dom.removeClass(this.element, 'info');
|
dom.removeClass(this.element, 'info');
|
||||||
dom.removeClass(this.element, 'warning');
|
dom.removeClass(this.element, 'warning');
|
||||||
dom.removeClass(this.element, 'error');
|
dom.removeClass(this.element, 'error');
|
||||||
dom.addClass(this.element, 'idle');
|
dom.addClass(this.element, 'idle');
|
||||||
|
}
|
||||||
|
|
||||||
this._hideMessage();
|
this._hideMessage();
|
||||||
this.applyStyles();
|
this.applyStyles();
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export class VirtualizedCollection<T extends Slick.SlickData> implements IObserv
|
|||||||
private _bufferWindowAfter: DataWindow<T>;
|
private _bufferWindowAfter: DataWindow<T>;
|
||||||
private _lengthChanged = false;
|
private _lengthChanged = false;
|
||||||
|
|
||||||
private collectionChangedCallback: (startIndex: number, count: number) => void;
|
private collectionChangedCallback?: (startIndex: number, count: number) => void;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly windowSize: number,
|
private readonly windowSize: number,
|
||||||
|
|||||||
@@ -6,11 +6,13 @@
|
|||||||
import { escape } from 'sql/base/common/strings';
|
import { escape } from 'sql/base/common/strings';
|
||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
|
|
||||||
export class DBCellValue {
|
export interface DBCellValue {
|
||||||
displayValue: string;
|
displayValue: string;
|
||||||
isNull: boolean;
|
isNull: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
public static isDBCellValue(object: any): boolean {
|
export namespace DBCellValue {
|
||||||
|
export function isDBCellValue(object: any): boolean {
|
||||||
return (object !== undefined && object.displayValue !== undefined && object.isNull !== undefined);
|
return (object !== undefined && object.displayValue !== undefined && object.isNull !== undefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
|||||||
* Implements the various additional navigation keybindings we want out of slickgrid
|
* Implements the various additional navigation keybindings we want out of slickgrid
|
||||||
*/
|
*/
|
||||||
export class AdditionalKeyBindings<T> implements Slick.Plugin<T> {
|
export class AdditionalKeyBindings<T> implements Slick.Plugin<T> {
|
||||||
private grid: Slick.Grid<T>;
|
private grid!: Slick.Grid<T>;
|
||||||
private handler = new Slick.EventHandler();
|
private handler = new Slick.EventHandler();
|
||||||
|
|
||||||
public init(grid: Slick.Grid<T>) {
|
public init(grid: Slick.Grid<T>) {
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ const defaultOptions: IAutoColumnSizeOptions = {
|
|||||||
autoSizeOnRender: false
|
autoSizeOnRender: false
|
||||||
};
|
};
|
||||||
|
|
||||||
export class AutoColumnSize<T extends Object> implements Slick.Plugin<T> {
|
export class AutoColumnSize<T extends Slick.SlickData> implements Slick.Plugin<T> {
|
||||||
private _grid: Slick.Grid<T>;
|
private _grid!: Slick.Grid<T>;
|
||||||
private _$container: JQuery;
|
private _$container!: JQuery;
|
||||||
private _context: CanvasRenderingContext2D;
|
private _context!: CanvasRenderingContext2D;
|
||||||
private _options: IAutoColumnSizeOptions;
|
private _options: IAutoColumnSizeOptions;
|
||||||
private onPostEventHandler = new Slick.EventHandler();
|
private onPostEventHandler = new Slick.EventHandler();
|
||||||
|
|
||||||
|
|||||||
@@ -37,12 +37,12 @@ export interface ICellRangeDecorator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class CellRangeSelector<T> implements ICellRangeSelector<T> {
|
export class CellRangeSelector<T> implements ICellRangeSelector<T> {
|
||||||
private grid: Slick.Grid<T>;
|
private grid!: Slick.Grid<T>;
|
||||||
private dragging: boolean;
|
private dragging?: boolean;
|
||||||
private handler = new Slick.EventHandler();
|
private handler = new Slick.EventHandler();
|
||||||
private decorator: ICellRangeDecorator;
|
private decorator!: ICellRangeDecorator;
|
||||||
private canvas: HTMLCanvasElement;
|
private canvas!: HTMLCanvasElement;
|
||||||
private currentlySelectedRange: { start: Slick.Cell, end?: Slick.Cell };
|
private currentlySelectedRange?: { start: Slick.Cell, end?: Slick.Cell };
|
||||||
|
|
||||||
public onBeforeCellRangeSelected = new Slick.Event<Slick.Cell>();
|
public onBeforeCellRangeSelected = new Slick.Event<Slick.Cell>();
|
||||||
public onCellRangeSelected = new Slick.Event<Slick.Range>();
|
public onCellRangeSelected = new Slick.Event<Slick.Range>();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const defaults: ICellSelectionModelOptions = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export class CellSelectionModel<T> implements Slick.SelectionModel<T, Array<Slick.Range>> {
|
export class CellSelectionModel<T> implements Slick.SelectionModel<T, Array<Slick.Range>> {
|
||||||
private grid: Slick.Grid<T>;
|
private grid!: Slick.Grid<T>;
|
||||||
private selector: ICellRangeSelector<T>;
|
private selector: ICellRangeSelector<T>;
|
||||||
private ranges: Array<Slick.Range> = [];
|
private ranges: Array<Slick.Range> = [];
|
||||||
private _handler = new Slick.EventHandler();
|
private _handler = new Slick.EventHandler();
|
||||||
|
|||||||
@@ -47,10 +47,10 @@ const checkboxTemplate = `<div style="display: flex; align-items: center; flex-d
|
|||||||
|
|
||||||
export class CheckboxSelectColumn<T extends Slick.SlickData> implements Slick.Plugin<T> {
|
export class CheckboxSelectColumn<T extends Slick.SlickData> implements Slick.Plugin<T> {
|
||||||
private _options: ICheckboxSelectColumnOptions;
|
private _options: ICheckboxSelectColumnOptions;
|
||||||
private _grid: Slick.Grid<T>;
|
private _grid!: Slick.Grid<T>;
|
||||||
private _handler = new Slick.EventHandler();
|
private _handler = new Slick.EventHandler();
|
||||||
private _selectedRowsLookup: dict.INumberDictionary<boolean> = {};
|
private _selectedRowsLookup: dict.INumberDictionary<boolean> = {};
|
||||||
private _selectedCheckBoxLookup = {};
|
private _selectedCheckBoxLookup: {[key: string]: boolean} = {};
|
||||||
private _useState = false;
|
private _useState = false;
|
||||||
|
|
||||||
private _onChange = new Emitter<ICheckboxCellActionEventArgs>();
|
private _onChange = new Emitter<ICheckboxCellActionEventArgs>();
|
||||||
@@ -274,7 +274,7 @@ export class CheckboxSelectColumn<T extends Slick.SlickData> implements Slick.Pl
|
|||||||
|
|
||||||
// use data for first time rendering
|
// use data for first time rendering
|
||||||
// note: make sure Init is called before using this._grid
|
// note: make sure Init is called before using this._grid
|
||||||
let rowVal = (this._grid) ? this._grid.getDataItem(row) : null;
|
let rowVal = this._grid?.getDataItem(row);
|
||||||
if (rowVal && this._options.title && rowVal[this._options.title] === true) {
|
if (rowVal && this._options.title && rowVal[this._options.title] === true) {
|
||||||
this._selectedCheckBoxLookup[row] = true;
|
this._selectedCheckBoxLookup[row] = true;
|
||||||
return strings.format(checkboxTemplate, 'checked', this.getAriaLabel(true));
|
return strings.format(checkboxTemplate, 'checked', this.getAriaLabel(true));
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { isUndefinedOrNull } from 'vs/base/common/types';
|
|||||||
* Implements the various additional navigation keybindings we want out of slickgrid
|
* Implements the various additional navigation keybindings we want out of slickgrid
|
||||||
*/
|
*/
|
||||||
export class CopyKeybind<T> implements Slick.Plugin<T> {
|
export class CopyKeybind<T> implements Slick.Plugin<T> {
|
||||||
private grid: Slick.Grid<T>;
|
private grid!: Slick.Grid<T>;
|
||||||
private handler = new Slick.EventHandler();
|
private handler = new Slick.EventHandler();
|
||||||
|
|
||||||
private _onCopy = new Emitter<Slick.Range[]>();
|
private _onCopy = new Emitter<Slick.Range[]>();
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ export class HeaderFilter<T extends Slick.SlickData> {
|
|||||||
public onFilterApplied = new Slick.Event();
|
public onFilterApplied = new Slick.Event();
|
||||||
public onCommand = new Slick.Event();
|
public onCommand = new Slick.Event();
|
||||||
|
|
||||||
private grid: Slick.Grid<T>;
|
private grid!: Slick.Grid<T>;
|
||||||
private handler = new Slick.EventHandler();
|
private handler = new Slick.EventHandler();
|
||||||
|
|
||||||
private $menu?: JQuery<HTMLElement>;
|
private $menu?: JQuery<HTMLElement>;
|
||||||
private okButton: Button;
|
private okButton?: Button;
|
||||||
private clearButton: Button;
|
private clearButton?: Button;
|
||||||
private cancelButton: Button;
|
private cancelButton?: Button;
|
||||||
private workingFilters: Array<string>;
|
private workingFilters!: Array<string>;
|
||||||
private columnDef: IExtendedColumn<T>;
|
private columnDef!: IExtendedColumn<T>;
|
||||||
private buttonStyles: IButtonStyles;
|
private buttonStyles?: IButtonStyles;
|
||||||
|
|
||||||
private disposableStore = new DisposableStore();
|
private disposableStore = new DisposableStore();
|
||||||
|
|
||||||
@@ -286,7 +286,7 @@ export class HeaderFilter<T extends Slick.SlickData> {
|
|||||||
|
|
||||||
if ($checkbox.prop('checked') && index < 0) {
|
if ($checkbox.prop('checked') && index < 0) {
|
||||||
workingFilters.push(filterItems[value]);
|
workingFilters.push(filterItems[value]);
|
||||||
const nextRow = filterItems[(parseInt(<string><any>value) + 1).toString()]; // for some reason parseInt is defined as only supporting strings even though it works fine for numbers
|
const nextRow = filterItems[Number((parseInt(<string><any>value) + 1).toString())]; // for some reason parseInt is defined as only supporting strings even though it works fine for numbers
|
||||||
if (nextRow && nextRow.indexOf('Error:') >= 0) {
|
if (nextRow && nextRow.indexOf('Error:') >= 0) {
|
||||||
workingFilters.push(nextRow);
|
workingFilters.push(nextRow);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ const defaultOptions: IMouseWheelSupportOptions = {
|
|||||||
|
|
||||||
export class MouseWheelSupport implements Slick.Plugin<any> {
|
export class MouseWheelSupport implements Slick.Plugin<any> {
|
||||||
|
|
||||||
private viewport: HTMLElement;
|
private viewport!: HTMLElement;
|
||||||
private canvas: HTMLElement;
|
private canvas!: HTMLElement;
|
||||||
private options: IMouseWheelSupportOptions;
|
private options: IMouseWheelSupportOptions;
|
||||||
|
|
||||||
private _disposables = new DisposableStore();
|
private _disposables = new DisposableStore();
|
||||||
|
|||||||
@@ -51,11 +51,11 @@ export class RowDetailView<T extends Slick.SlickData> {
|
|||||||
public readonly onAfterRowDetailToggle = new Slick.Event<{ grid: Slick.Grid<T>, item: T }>();
|
public readonly onAfterRowDetailToggle = new Slick.Event<{ grid: Slick.Grid<T>, item: T }>();
|
||||||
public readonly onBeforeRowDetailToggle = new Slick.Event<{ grid: Slick.Grid<T>, item: T }>();
|
public readonly onBeforeRowDetailToggle = new Slick.Event<{ grid: Slick.Grid<T>, item: T }>();
|
||||||
|
|
||||||
private _grid: Slick.Grid<T>;
|
private _grid!: Slick.Grid<T>;
|
||||||
private _expandedRows: Array<ExtendedItem<T>> = [];
|
private _expandedRows: Array<ExtendedItem<T>> = [];
|
||||||
private _handler = new Slick.EventHandler();
|
private _handler = new Slick.EventHandler();
|
||||||
|
|
||||||
private _dataView: AugmentedDataView<T>;
|
private _dataView!: AugmentedDataView<T>;
|
||||||
private _options: IRowDetailViewOptions<T>;
|
private _options: IRowDetailViewOptions<T>;
|
||||||
|
|
||||||
constructor(options: IRowDetailViewOptions<T>) {
|
constructor(options: IRowDetailViewOptions<T>) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export interface IRowNumberColumnOptions {
|
|||||||
|
|
||||||
export class RowNumberColumn<T> implements Slick.Plugin<T> {
|
export class RowNumberColumn<T> implements Slick.Plugin<T> {
|
||||||
private handler = new Slick.EventHandler();
|
private handler = new Slick.EventHandler();
|
||||||
private grid: Slick.Grid<T>;
|
private grid!: Slick.Grid<T>;
|
||||||
|
|
||||||
constructor(private options: IRowNumberColumnOptions) {
|
constructor(private options: IRowNumberColumnOptions) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export interface IRowSelectionModelOptions extends Slick.PluginOptions {
|
|||||||
|
|
||||||
export class RowSelectionModel<T extends Slick.SlickData> implements Slick.SelectionModel<T, Array<Slick.Range>> {
|
export class RowSelectionModel<T extends Slick.SlickData> implements Slick.SelectionModel<T, Array<Slick.Range>> {
|
||||||
private _options: IRowSelectionModelOptions;
|
private _options: IRowSelectionModelOptions;
|
||||||
private _grid: Slick.Grid<T>;
|
private _grid!: Slick.Grid<T>;
|
||||||
private _handler = new Slick.EventHandler();
|
private _handler = new Slick.EventHandler();
|
||||||
private _ranges: Array<Slick.Range> = [];
|
private _ranges: Array<Slick.Range> = [];
|
||||||
|
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ export class Table<T extends Slick.SlickData> extends Widget implements IDisposa
|
|||||||
private _grid: Slick.Grid<T>;
|
private _grid: Slick.Grid<T>;
|
||||||
private _columns: Slick.Column<T>[];
|
private _columns: Slick.Column<T>[];
|
||||||
private _data: IDisposableDataProvider<T>;
|
private _data: IDisposableDataProvider<T>;
|
||||||
private _sorter: ITableSorter<T>;
|
private _sorter?: ITableSorter<T>;
|
||||||
|
|
||||||
private _autoscroll: boolean;
|
private _autoscroll?: boolean;
|
||||||
private _container: HTMLElement;
|
private _container: HTMLElement;
|
||||||
private _tableContainer: HTMLElement;
|
private _tableContainer: HTMLElement;
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ export class Table<T extends Slick.SlickData> extends Widget implements IDisposa
|
|||||||
if (configuration && configuration.sorter) {
|
if (configuration && configuration.sorter) {
|
||||||
this._sorter = configuration.sorter;
|
this._sorter = configuration.sorter;
|
||||||
this._grid.onSort.subscribe((e, args) => {
|
this._grid.onSort.subscribe((e, args) => {
|
||||||
this._sorter(args);
|
this._sorter!(args);
|
||||||
this._grid.invalidate();
|
this._grid.invalidate();
|
||||||
this._grid.render();
|
this._grid.render();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ export class TableDataView<T extends Slick.SlickData> implements IDisposableData
|
|||||||
//The data exposed publicly, when filter is enabled, _data holds the filtered data.
|
//The data exposed publicly, when filter is enabled, _data holds the filtered data.
|
||||||
private _data: Array<T>;
|
private _data: Array<T>;
|
||||||
//Used when filtering is enabled, _allData holds the complete set of data.
|
//Used when filtering is enabled, _allData holds the complete set of data.
|
||||||
private _allData: Array<T>;
|
private _allData!: Array<T>;
|
||||||
private _findArray: Array<IFindPosition>;
|
private _findArray?: Array<IFindPosition>;
|
||||||
private _findIndex: number;
|
private _findIndex?: number;
|
||||||
private _filterEnabled: boolean;
|
private _filterEnabled: boolean;
|
||||||
|
|
||||||
private _onRowCountChange = new Emitter<number>();
|
private _onRowCountChange = new Emitter<number>();
|
||||||
@@ -166,7 +166,7 @@ export class TableDataView<T extends Slick.SlickData> implements IDisposableData
|
|||||||
if (exp) {
|
if (exp) {
|
||||||
return new Promise<IFindPosition>((resolve) => {
|
return new Promise<IFindPosition>((resolve) => {
|
||||||
const disp = this.onFindCountChange(e => {
|
const disp = this.onFindCountChange(e => {
|
||||||
resolve(this._findArray[e - 1]);
|
resolve(this._findArray![e - 1]);
|
||||||
disp.dispose();
|
disp.dispose();
|
||||||
});
|
});
|
||||||
this._startSearch(exp, maxMatches);
|
this._startSearch(exp, maxMatches);
|
||||||
@@ -185,9 +185,9 @@ export class TableDataView<T extends Slick.SlickData> implements IDisposableData
|
|||||||
for (let j = 0; j < result.length; j++) {
|
for (let j = 0; j < result.length; j++) {
|
||||||
const pos = result[j];
|
const pos = result[j];
|
||||||
const index = { col: pos, row: i };
|
const index = { col: pos, row: i };
|
||||||
this._findArray.push(index);
|
this._findArray!.push(index);
|
||||||
this._onFindCountChange.fire(this._findArray.length);
|
this._onFindCountChange.fire(this._findArray!.length);
|
||||||
if (maxMatches > 0 && this._findArray.length === maxMatches) {
|
if (maxMatches > 0 && this._findArray!.length === maxMatches) {
|
||||||
breakout = true;
|
breakout = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -211,9 +211,9 @@ export class TableDataView<T extends Slick.SlickData> implements IDisposableData
|
|||||||
if (this._findIndex === this._findArray.length - 1) {
|
if (this._findIndex === this._findArray.length - 1) {
|
||||||
this._findIndex = 0;
|
this._findIndex = 0;
|
||||||
} else {
|
} else {
|
||||||
++this._findIndex;
|
++this._findIndex!;
|
||||||
}
|
}
|
||||||
return Promise.resolve(this._findArray[this._findIndex]);
|
return Promise.resolve(this._findArray[this._findIndex!]);
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject(new Error('no search running'));
|
return Promise.reject(new Error('no search running'));
|
||||||
}
|
}
|
||||||
@@ -224,9 +224,9 @@ export class TableDataView<T extends Slick.SlickData> implements IDisposableData
|
|||||||
if (this._findIndex === 0) {
|
if (this._findIndex === 0) {
|
||||||
this._findIndex = this._findArray.length - 1;
|
this._findIndex = this._findArray.length - 1;
|
||||||
} else {
|
} else {
|
||||||
--this._findIndex;
|
--this._findIndex!;
|
||||||
}
|
}
|
||||||
return Promise.resolve(this._findArray[this._findIndex]);
|
return Promise.resolve(this._findArray[this._findIndex!]);
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject(new Error('no search running'));
|
return Promise.reject(new Error('no search running'));
|
||||||
}
|
}
|
||||||
@@ -234,7 +234,7 @@ export class TableDataView<T extends Slick.SlickData> implements IDisposableData
|
|||||||
|
|
||||||
get currentFindPosition(): Thenable<IFindPosition> {
|
get currentFindPosition(): Thenable<IFindPosition> {
|
||||||
if (this._findArray && this._findArray.length !== 0) {
|
if (this._findArray && this._findArray.length !== 0) {
|
||||||
return Promise.resolve(this._findArray[this._findIndex]);
|
return Promise.resolve(this._findArray[this._findIndex!]);
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject(new Error('no search running'));
|
return Promise.reject(new Error('no search running'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
export class Deferred<T> implements Promise<T> {
|
export class Deferred<T> implements Promise<T> {
|
||||||
promise: Promise<T>;
|
promise: Promise<T>;
|
||||||
resolve: (value?: T | PromiseLike<T>) => void;
|
resolve!: (value?: T | PromiseLike<T>) => void;
|
||||||
reject: (reason?: any) => void;
|
reject!: (reason?: any) => void;
|
||||||
constructor() {
|
constructor() {
|
||||||
this.promise = new Promise<T>((resolve, reject) => {
|
this.promise = new Promise<T>((resolve, reject) => {
|
||||||
this.resolve = resolve;
|
this.resolve = resolve;
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export class Dropdown extends Disposable {
|
|||||||
private _filter = new DropdownFilter();
|
private _filter = new DropdownFilter();
|
||||||
private _renderer = new DropdownRenderer();
|
private _renderer = new DropdownRenderer();
|
||||||
private _controller = new DropdownController();
|
private _controller = new DropdownController();
|
||||||
public fireOnTextChange: boolean;
|
public fireOnTextChange?: boolean;
|
||||||
|
|
||||||
private _onBlur = this._register(new Emitter<void>());
|
private _onBlur = this._register(new Emitter<void>());
|
||||||
public onBlur: Event<void> = this._onBlur.event;
|
public onBlur: Event<void> = this._onBlur.event;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export class DropdownRenderer implements tree.IRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class DropdownDataSource implements tree.IDataSource {
|
export class DropdownDataSource implements tree.IDataSource {
|
||||||
public options: Array<Resource>;
|
public options?: Array<Resource>;
|
||||||
|
|
||||||
public getId(tree: tree.ITree, element: Resource | DropdownModel): string {
|
public getId(tree: tree.ITree, element: Resource | DropdownModel): string {
|
||||||
if (element instanceof DropdownModel) {
|
if (element instanceof DropdownModel) {
|
||||||
@@ -93,10 +93,14 @@ export class DropdownDataSource implements tree.IDataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class DropdownFilter extends TreeDefaults.DefaultFilter {
|
export class DropdownFilter extends TreeDefaults.DefaultFilter {
|
||||||
public filterString: string;
|
public filterString?: string;
|
||||||
|
|
||||||
public isVisible(tree: tree.ITree | undefined, element: Resource): boolean {
|
public isVisible(tree: tree.ITree | undefined, element: Resource): boolean {
|
||||||
|
if (this.filterString) {
|
||||||
return element.value.toLowerCase().indexOf(this.filterString.toLowerCase()) !== -1;
|
return element.value.toLowerCase().indexOf(this.filterString.toLowerCase()) !== -1;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,10 @@ const testText = '<div>test text</div>';
|
|||||||
suite('Grid shared services tests', () => {
|
suite('Grid shared services tests', () => {
|
||||||
test('textFormatter should encode HTML when formatting a DBCellValue object', () => {
|
test('textFormatter should encode HTML when formatting a DBCellValue object', () => {
|
||||||
// If I format a DBCellValue object that contains HTML
|
// If I format a DBCellValue object that contains HTML
|
||||||
let cellValue = new SharedServices.DBCellValue();
|
let cellValue = {
|
||||||
cellValue.displayValue = testText;
|
displayValue: testText,
|
||||||
cellValue.isNull = false;
|
isNull: false
|
||||||
|
};
|
||||||
let formattedHtml = SharedServices.textFormatter(undefined, undefined, cellValue, undefined, undefined);
|
let formattedHtml = SharedServices.textFormatter(undefined, undefined, cellValue, undefined, undefined);
|
||||||
|
|
||||||
// Then the result is HTML for a span element containing the cell value's display value as plain text
|
// Then the result is HTML for a span element containing the cell value's display value as plain text
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ suite('TableDataView', () => {
|
|||||||
function populateData(row: number, column: number): any[] {
|
function populateData(row: number, column: number): any[] {
|
||||||
let data: Array<{ [key: string]: string }> = [];
|
let data: Array<{ [key: string]: string }> = [];
|
||||||
for (let i: number = 0; i < row; i++) {
|
for (let i: number = 0; i < row; i++) {
|
||||||
let row = {};
|
let row: { [key: string]: string } = {};
|
||||||
for (let j: number = 0; j < column; j++) {
|
for (let j: number = 0; j < column; j++) {
|
||||||
row[getColumnName(j)] = getCellValue(i, j);
|
row[getColumnName(j)] = getCellValue(i, j);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
|
|
||||||
export class EventVerifierSingle<T> {
|
export class EventVerifierSingle<T> {
|
||||||
private _eventArgument: T;
|
private _eventArgument?: T;
|
||||||
private _eventFired: boolean;
|
private _eventFired: boolean;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this._eventFired = false;
|
this._eventFired = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get eventArgument(): T {
|
public get eventArgument(): T | undefined {
|
||||||
return this._eventArgument;
|
return this._eventArgument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ export class EventVerifierSingle<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public assertFiredWithVerify(argumentVerification: (arg: T) => void) {
|
public assertFiredWithVerify(argumentVerification: (arg: T | undefined) => void) {
|
||||||
assert.ok(this._eventFired);
|
assert.ok(this._eventFired);
|
||||||
argumentVerification(this._eventArgument);
|
argumentVerification(this._eventArgument);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ export class ApplyFilterAction extends Action {
|
|||||||
export class RefreshAccountAction extends Action {
|
export class RefreshAccountAction extends Action {
|
||||||
public static ID = 'account.refresh';
|
public static ID = 'account.refresh';
|
||||||
public static LABEL = localize('refreshAccount', "Reenter your credentials");
|
public static LABEL = localize('refreshAccount', "Reenter your credentials");
|
||||||
public account: azdata.Account;
|
public account?: azdata.Account;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@IAccountManagementService private _accountManagementService: IAccountManagementService,
|
@IAccountManagementService private _accountManagementService: IAccountManagementService,
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ export default class AccountStore implements IAccountStore {
|
|||||||
public static MEMENTO_KEY: string = 'Microsoft.SqlTools.Accounts';
|
public static MEMENTO_KEY: string = 'Microsoft.SqlTools.Accounts';
|
||||||
|
|
||||||
// MEMBER VARIABLES ////////////////////////////////////////////////////
|
// MEMBER VARIABLES ////////////////////////////////////////////////////
|
||||||
private _activeOperation: Thenable<any>;
|
private _activeOperation?: Thenable<any>;
|
||||||
|
|
||||||
constructor(private _memento: object) { }
|
constructor(private _memento: { [key: string]: any }) { }
|
||||||
|
|
||||||
// PUBLIC METHODS //////////////////////////////////////////////////////
|
// PUBLIC METHODS //////////////////////////////////////////////////////
|
||||||
public addOrUpdate(newAccount: azdata.Account): Thenable<AccountAdditionResult> {
|
public addOrUpdate(newAccount: azdata.Account): Thenable<AccountAdditionResult> {
|
||||||
|
|||||||
@@ -12,33 +12,33 @@ export class FirewallRuleViewModel {
|
|||||||
public isIPAddressSelected: boolean;
|
public isIPAddressSelected: boolean;
|
||||||
public selectedAccount: azdata.Account | undefined;
|
public selectedAccount: azdata.Account | undefined;
|
||||||
|
|
||||||
private _defaultIPAddress: string;
|
private _defaultIPAddress?: string;
|
||||||
private _defaultFromSubnetIPRange: string;
|
private _defaultFromSubnetIPRange?: string;
|
||||||
private _defaultToSubnetIPRange: string;
|
private _defaultToSubnetIPRange?: string;
|
||||||
private _fromSubnetIPRange: string;
|
private _fromSubnetIPRange?: string;
|
||||||
private _toSubnetIPRange: string;
|
private _toSubnetIPRange?: string;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.isIPAddressSelected = true;
|
this.isIPAddressSelected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get defaultIPAddress(): string {
|
public get defaultIPAddress(): string | undefined {
|
||||||
return this._defaultIPAddress;
|
return this._defaultIPAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get defaultFromSubnetIPRange(): string {
|
public get defaultFromSubnetIPRange(): string | undefined {
|
||||||
return this._defaultFromSubnetIPRange;
|
return this._defaultFromSubnetIPRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get defaultToSubnetIPRange(): string {
|
public get defaultToSubnetIPRange(): string | undefined {
|
||||||
return this._defaultToSubnetIPRange;
|
return this._defaultToSubnetIPRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public set fromSubnetIPRange(IPAddress: string) {
|
public set fromSubnetIPRange(IPAddress: string | undefined) {
|
||||||
this._fromSubnetIPRange = IPAddress;
|
this._fromSubnetIPRange = IPAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get fromSubnetIPRange(): string {
|
public get fromSubnetIPRange(): string | undefined {
|
||||||
if (this._fromSubnetIPRange) {
|
if (this._fromSubnetIPRange) {
|
||||||
return this._fromSubnetIPRange;
|
return this._fromSubnetIPRange;
|
||||||
} else {
|
} else {
|
||||||
@@ -46,11 +46,11 @@ export class FirewallRuleViewModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public set toSubnetIPRange(IPAddress: string) {
|
public set toSubnetIPRange(IPAddress: string | undefined) {
|
||||||
this._toSubnetIPRange = IPAddress;
|
this._toSubnetIPRange = IPAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get toSubnetIPRange(): string {
|
public get toSubnetIPRange(): string | undefined {
|
||||||
if (this._toSubnetIPRange) {
|
if (this._toSubnetIPRange) {
|
||||||
return this._toSubnetIPRange;
|
return this._toSubnetIPRange;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { EventVerifierSingle } from 'sql/base/test/common/event';
|
|||||||
suite('Account Store Tests', () => {
|
suite('Account Store Tests', () => {
|
||||||
test('AddOrUpdate - Uninitialized memento', () => {
|
test('AddOrUpdate - Uninitialized memento', () => {
|
||||||
// Setup: Create account store w/o initialized memento
|
// Setup: Create account store w/o initialized memento
|
||||||
let memento = {};
|
let memento: { [key: string]: azdata.Account[] } = {};
|
||||||
let as = new AccountStore(memento);
|
let as = new AccountStore(memento);
|
||||||
|
|
||||||
// If: I add an account to the store
|
// If: I add an account to the store
|
||||||
@@ -32,7 +32,7 @@ suite('Account Store Tests', () => {
|
|||||||
|
|
||||||
test('AddOrUpdate - Adds to accounts', () => {
|
test('AddOrUpdate - Adds to accounts', () => {
|
||||||
// Setup: Create account store with initialized memento with accounts
|
// Setup: Create account store with initialized memento with accounts
|
||||||
let memento = {};
|
let memento: { [key: string]: azdata.Account[] } = {};
|
||||||
memento[AccountStore.MEMENTO_KEY] = [];
|
memento[AccountStore.MEMENTO_KEY] = [];
|
||||||
let as = new AccountStore(memento);
|
let as = new AccountStore(memento);
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ suite('Account Store Tests', () => {
|
|||||||
|
|
||||||
test('GetAccountsByProvider - No accounts', () => {
|
test('GetAccountsByProvider - No accounts', () => {
|
||||||
// Setup: Create account store with initialized memento with accounts
|
// Setup: Create account store with initialized memento with accounts
|
||||||
let memento = {};
|
let memento: { [key: string]: azdata.Account[] } = {};
|
||||||
memento[AccountStore.MEMENTO_KEY] = [];
|
memento[AccountStore.MEMENTO_KEY] = [];
|
||||||
let as = new AccountStore(memento);
|
let as = new AccountStore(memento);
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ suite('Account Store Tests', () => {
|
|||||||
|
|
||||||
test('GetAllAccounts - No accounts', () => {
|
test('GetAllAccounts - No accounts', () => {
|
||||||
// Setup: Create account store with initialized memento with accounts
|
// Setup: Create account store with initialized memento with accounts
|
||||||
let memento = {};
|
let memento: { [key: string]: azdata.Account[] } = {};
|
||||||
memento[AccountStore.MEMENTO_KEY] = [];
|
memento[AccountStore.MEMENTO_KEY] = [];
|
||||||
let as = new AccountStore(memento);
|
let as = new AccountStore(memento);
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ suite('Account Store Tests', () => {
|
|||||||
|
|
||||||
test('Remove - Uninitialized menento', () => {
|
test('Remove - Uninitialized menento', () => {
|
||||||
// Setup: Create account store w/o initialized memento
|
// Setup: Create account store w/o initialized memento
|
||||||
let memento = {};
|
let memento: { [key: string]: azdata.Account[] } = {};
|
||||||
let as = new AccountStore(memento);
|
let as = new AccountStore(memento);
|
||||||
|
|
||||||
// If: I remove an account when there's an uninitialized memento
|
// If: I remove an account when there's an uninitialized memento
|
||||||
@@ -211,7 +211,7 @@ suite('Account Store Tests', () => {
|
|||||||
|
|
||||||
test('Remove - Account does not exist', () => {
|
test('Remove - Account does not exist', () => {
|
||||||
// Setup: Create account store with initialized memento with accounts
|
// Setup: Create account store with initialized memento with accounts
|
||||||
let memento = {};
|
let memento: { [key: string]: azdata.Account[] } = {};
|
||||||
memento[AccountStore.MEMENTO_KEY] = [];
|
memento[AccountStore.MEMENTO_KEY] = [];
|
||||||
let as = new AccountStore(memento);
|
let as = new AccountStore(memento);
|
||||||
|
|
||||||
@@ -250,7 +250,7 @@ suite('Account Store Tests', () => {
|
|||||||
test('Update - Uninitialized menento', () => {
|
test('Update - Uninitialized menento', () => {
|
||||||
// Setup:
|
// Setup:
|
||||||
// ... Create account store w/o initialized memento
|
// ... Create account store w/o initialized memento
|
||||||
let memento = {};
|
let memento: { [key: string]: azdata.Account[] } = {};
|
||||||
let as = new AccountStore(memento);
|
let as = new AccountStore(memento);
|
||||||
|
|
||||||
// ... Create a callback that we can verify was called
|
// ... Create a callback that we can verify was called
|
||||||
@@ -274,7 +274,7 @@ suite('Account Store Tests', () => {
|
|||||||
|
|
||||||
test('Update - Account does not exist', () => {
|
test('Update - Account does not exist', () => {
|
||||||
// Setup: Create account store with initialized memento with accounts
|
// Setup: Create account store with initialized memento with accounts
|
||||||
let memento = {};
|
let memento: { [key: string]: azdata.Account[] } = {};
|
||||||
memento[AccountStore.MEMENTO_KEY] = [];
|
memento[AccountStore.MEMENTO_KEY] = [];
|
||||||
let as = new AccountStore(memento);
|
let as = new AccountStore(memento);
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@ const account2 = <azdata.Account>{
|
|||||||
};
|
};
|
||||||
|
|
||||||
function getTestMemento() {
|
function getTestMemento() {
|
||||||
let memento = {};
|
let memento: { [key: string]: azdata.Account[] } = {};
|
||||||
memento[AccountStore.MEMENTO_KEY] = [account1, account2];
|
memento[AccountStore.MEMENTO_KEY] = [account1, account2];
|
||||||
|
|
||||||
return memento;
|
return memento;
|
||||||
|
|||||||
@@ -20,15 +20,15 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
|||||||
template: ''
|
template: ''
|
||||||
})
|
})
|
||||||
export class EditableDropDown extends AngularDisposable implements OnInit, OnChanges {
|
export class EditableDropDown extends AngularDisposable implements OnInit, OnChanges {
|
||||||
private _selectbox: Dropdown;
|
private _selectbox!: Dropdown;
|
||||||
|
|
||||||
@Input() options: string[];
|
@Input() options!: string[];
|
||||||
@Input() selectedOption: string;
|
@Input() selectedOption!: string;
|
||||||
@Input() onlyEmitOnChange = false;
|
@Input() onlyEmitOnChange = false;
|
||||||
|
|
||||||
@Output() onDidSelect = new EventEmitter<string>();
|
@Output() onDidSelect = new EventEmitter<string>();
|
||||||
|
|
||||||
private _previousVal: string;
|
private _previousVal?: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(forwardRef(() => ElementRef)) private readonly _el: ElementRef,
|
@Inject(forwardRef(() => ElementRef)) private readonly _el: ElementRef,
|
||||||
|
|||||||
@@ -20,14 +20,14 @@ import { IContextViewService } from 'vs/platform/contextview/browser/contextView
|
|||||||
template: ''
|
template: ''
|
||||||
})
|
})
|
||||||
export class InputBox extends AngularDisposable implements OnInit, OnChanges {
|
export class InputBox extends AngularDisposable implements OnInit, OnChanges {
|
||||||
private _inputbox: vsInputBox;
|
private _inputbox!: vsInputBox;
|
||||||
|
|
||||||
@Input() min: string;
|
@Input() min?: string;
|
||||||
@Input() max: string;
|
@Input() max?: string;
|
||||||
@Input() type: string;
|
@Input() type?: string;
|
||||||
@Input() placeholder: string;
|
@Input() placeholder?: string;
|
||||||
@Input('aria-label') ariaLabel: string;
|
@Input('aria-label') ariaLabel?: string;
|
||||||
@Input() value: string;
|
@Input() value?: string;
|
||||||
|
|
||||||
@Output() onDidChange = new EventEmitter<string | number>();
|
@Output() onDidChange = new EventEmitter<string | number>();
|
||||||
|
|
||||||
@@ -67,16 +67,16 @@ export class InputBox extends AngularDisposable implements OnInit, OnChanges {
|
|||||||
ngOnChanges(changes: SimpleChanges): void {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
if (this._inputbox) {
|
if (this._inputbox) {
|
||||||
if (changes['min']) {
|
if (changes['min']) {
|
||||||
this._inputbox.inputElement.min = this.min;
|
this._inputbox.inputElement.min = this.min!;
|
||||||
}
|
}
|
||||||
if (changes['max']) {
|
if (changes['max']) {
|
||||||
this._inputbox.inputElement.max = this.max;
|
this._inputbox.inputElement.max = this.max!;
|
||||||
}
|
}
|
||||||
if (changes['type']) {
|
if (changes['type']) {
|
||||||
this._inputbox.inputElement.type = this.type;
|
this._inputbox.inputElement.type = this.type!;
|
||||||
}
|
}
|
||||||
if (changes['placeholder']) {
|
if (changes['placeholder']) {
|
||||||
this._inputbox.inputElement.placeholder = this.placeholder;
|
this._inputbox.inputElement.placeholder = this.placeholder!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,16 +21,16 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
|||||||
template: ''
|
template: ''
|
||||||
})
|
})
|
||||||
export class SelectBox extends AngularDisposable implements OnInit, OnChanges {
|
export class SelectBox extends AngularDisposable implements OnInit, OnChanges {
|
||||||
private _selectbox: vsSelectBox;
|
private _selectbox!: vsSelectBox;
|
||||||
|
|
||||||
@Input() options: string[];
|
@Input() options!: string[];
|
||||||
@Input() selectedOption: string;
|
@Input() selectedOption!: string;
|
||||||
@Input() onlyEmitOnChange = false;
|
@Input() onlyEmitOnChange = false;
|
||||||
@Input('aria-label') ariaLabel: string;
|
@Input('aria-label') ariaLabel?: string;
|
||||||
|
|
||||||
@Output() onDidSelect = new EventEmitter<ISelectData>();
|
@Output() onDidSelect = new EventEmitter<ISelectData>();
|
||||||
|
|
||||||
private _previousVal: string;
|
private _previousVal?: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef,
|
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef,
|
||||||
|
|||||||
@@ -10,62 +10,56 @@ import { StopWatch } from 'vs/base/common/stopwatch';
|
|||||||
/**
|
/**
|
||||||
* Information for a document's connection. Exported for testing purposes.
|
* Information for a document's connection. Exported for testing purposes.
|
||||||
*/
|
*/
|
||||||
export class ConnectionManagementInfo {
|
export interface ConnectionManagementInfo {
|
||||||
/**
|
/**
|
||||||
* Connection GUID returned from the service host
|
* Connection GUID returned from the service host
|
||||||
*/
|
*/
|
||||||
public connectionId: string;
|
connectionId?: string;
|
||||||
|
|
||||||
|
providerId: string;
|
||||||
public providerId: string;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Credentials used to connect
|
* Credentials used to connect
|
||||||
*/
|
*/
|
||||||
public connectionProfile: ConnectionProfile;
|
connectionProfile: ConnectionProfile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for when a connection notification is received.
|
* Callback for when a connection notification is received.
|
||||||
*/
|
*/
|
||||||
public connectHandler: (result: boolean, errorMessage?: string, errorCode?: number, callStack?: string) => void;
|
connectHandler?: (result: boolean, errorMessage?: string, errorCode?: number, callStack?: string) => void;
|
||||||
|
|
||||||
/**
|
|
||||||
* Information about the SQL Server instance.
|
|
||||||
*/
|
|
||||||
//public serverInfo: ConnectionContracts.ServerInfo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timer for tracking extension connection time.
|
* Timer for tracking extension connection time.
|
||||||
*/
|
*/
|
||||||
public extensionTimer: StopWatch;
|
extensionTimer: StopWatch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timer for tracking service connection time.
|
* Timer for tracking service connection time.
|
||||||
*/
|
*/
|
||||||
public serviceTimer: StopWatch;
|
serviceTimer: StopWatch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timer for tracking intelliSense activation time.
|
* Timer for tracking intelliSense activation time.
|
||||||
*/
|
*/
|
||||||
public intelliSenseTimer: StopWatch;
|
intelliSenseTimer: StopWatch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the connection is in the process of connecting.
|
* Whether the connection is in the process of connecting.
|
||||||
*/
|
*/
|
||||||
public connecting: boolean;
|
connecting: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the connection should be deleted after connection is complete.
|
* Whether the connection should be deleted after connection is complete.
|
||||||
*/
|
*/
|
||||||
public deleted: boolean;
|
deleted?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information about the connected server.
|
* Information about the connected server.
|
||||||
*/
|
*/
|
||||||
serverInfo: azdata.ServerInfo;
|
serverInfo?: azdata.ServerInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Owner uri assigned to the connection
|
* Owner uri assigned to the connection
|
||||||
*/
|
*/
|
||||||
public ownerUri: string;
|
ownerUri: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
|||||||
private _id: string;
|
private _id: string;
|
||||||
public savePassword: boolean;
|
public savePassword: boolean;
|
||||||
private _groupName?: string;
|
private _groupName?: string;
|
||||||
public groupId: string;
|
public groupId?: string;
|
||||||
public saveProfile: boolean;
|
public saveProfile: boolean;
|
||||||
|
|
||||||
public isDisconnecting: boolean = false;
|
public isDisconnecting: boolean = false;
|
||||||
@@ -256,7 +256,7 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
|||||||
let connectionInfo = ConnectionProfile.fromIConnectionProfile(capabilitiesService, connectionProfile);
|
let connectionInfo = ConnectionProfile.fromIConnectionProfile(capabilitiesService, connectionProfile);
|
||||||
let profile: interfaces.IConnectionProfileStore = {
|
let profile: interfaces.IConnectionProfileStore = {
|
||||||
options: {},
|
options: {},
|
||||||
groupId: connectionProfile.groupId,
|
groupId: connectionProfile.groupId!,
|
||||||
providerName: connectionInfo.providerName,
|
providerName: connectionInfo.providerName,
|
||||||
savePassword: connectionInfo.savePassword,
|
savePassword: connectionInfo.savePassword,
|
||||||
id: connectionInfo.id
|
id: connectionInfo.id
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ export interface IConnectionProfileGroup {
|
|||||||
|
|
||||||
export class ConnectionProfileGroup extends Disposable implements IConnectionProfileGroup {
|
export class ConnectionProfileGroup extends Disposable implements IConnectionProfileGroup {
|
||||||
|
|
||||||
public children: ConnectionProfileGroup[];
|
public children: ConnectionProfileGroup[] = [];
|
||||||
public connections: ConnectionProfile[];
|
public connections: ConnectionProfile[] = [];
|
||||||
public parentId?: string;
|
public parentId?: string;
|
||||||
private _isRenamed: boolean;
|
private _isRenamed = false;
|
||||||
public constructor(
|
public constructor(
|
||||||
public name: string,
|
public name: string,
|
||||||
public parent: ConnectionProfileGroup | undefined,
|
public parent: ConnectionProfileGroup | undefined,
|
||||||
@@ -42,7 +42,7 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
|||||||
|
|
||||||
public toObject(): IConnectionProfileGroup {
|
public toObject(): IConnectionProfileGroup {
|
||||||
let subgroups = undefined;
|
let subgroups = undefined;
|
||||||
if (this.children) {
|
if (this.children.length > 0) {
|
||||||
subgroups = [];
|
subgroups = [];
|
||||||
this.children.forEach((group) => {
|
this.children.forEach((group) => {
|
||||||
subgroups.push(group.toObject());
|
subgroups.push(group.toObject());
|
||||||
@@ -129,9 +129,6 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
|||||||
}
|
}
|
||||||
|
|
||||||
public addConnections(connections: ConnectionProfile[]): void {
|
public addConnections(connections: ConnectionProfile[]): void {
|
||||||
if (!this.connections) {
|
|
||||||
this.connections = [];
|
|
||||||
}
|
|
||||||
connections.forEach((conn) => {
|
connections.forEach((conn) => {
|
||||||
this.connections = this.connections.filter((curConn) => { return curConn.id !== conn.id; });
|
this.connections = this.connections.filter((curConn) => { return curConn.id !== conn.id; });
|
||||||
conn.parent = this;
|
conn.parent = this;
|
||||||
@@ -142,9 +139,6 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
|||||||
}
|
}
|
||||||
|
|
||||||
public addGroups(groups: ConnectionProfileGroup[]): void {
|
public addGroups(groups: ConnectionProfileGroup[]): void {
|
||||||
if (!this.children) {
|
|
||||||
this.children = [];
|
|
||||||
}
|
|
||||||
groups.forEach((group) => {
|
groups.forEach((group) => {
|
||||||
this.children = this.children.filter((grp) => { return group.id !== grp.id; });
|
this.children = this.children.filter((grp) => { return group.id !== grp.id; });
|
||||||
group.parent = this;
|
group.parent = this;
|
||||||
|
|||||||
@@ -77,15 +77,16 @@ export class ConnectionStatusManager {
|
|||||||
this._logService.info(`Adding connection ${id}`);
|
this._logService.info(`Adding connection ${id}`);
|
||||||
// Always create a copy and save that in the list
|
// Always create a copy and save that in the list
|
||||||
let connectionProfile = new ConnectionProfile(this._capabilitiesService, connection);
|
let connectionProfile = new ConnectionProfile(this._capabilitiesService, connection);
|
||||||
let connectionInfo: ConnectionManagementInfo = new ConnectionManagementInfo();
|
let connectionInfo: ConnectionManagementInfo = {
|
||||||
connectionInfo.providerId = connection.providerName;
|
providerId: connection.providerName,
|
||||||
connectionInfo.extensionTimer = StopWatch.create();
|
extensionTimer: StopWatch.create(),
|
||||||
connectionInfo.intelliSenseTimer = StopWatch.create();
|
intelliSenseTimer: StopWatch.create(),
|
||||||
connectionInfo.connectionProfile = connectionProfile;
|
connectionProfile: connectionProfile,
|
||||||
connectionInfo.connecting = true;
|
connecting: true,
|
||||||
|
serviceTimer: StopWatch.create(),
|
||||||
|
ownerUri: id
|
||||||
|
};
|
||||||
this._connections[id] = connectionInfo;
|
this._connections[id] = connectionInfo;
|
||||||
connectionInfo.serviceTimer = StopWatch.create();
|
|
||||||
connectionInfo.ownerUri = id;
|
|
||||||
this._logService.info(`Successfully added connection ${id}`);
|
this._logService.info(`Successfully added connection ${id}`);
|
||||||
return connectionInfo;
|
return connectionInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export interface IConnectionProfile extends azdata.IConnectionProfile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IConnectionProfileStore {
|
export interface IConnectionProfileStore {
|
||||||
options: {};
|
options: { [key: string]: any };
|
||||||
groupId: string;
|
groupId: string;
|
||||||
providerName: string;
|
providerName: string;
|
||||||
savePassword: boolean;
|
savePassword: boolean;
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
|||||||
|
|
||||||
options: { [name: string]: any } = {};
|
options: { [name: string]: any } = {};
|
||||||
|
|
||||||
private _providerName: string;
|
private _providerName?: string;
|
||||||
private _onCapabilitiesRegisteredDisposable: IDisposable;
|
private _onCapabilitiesRegisteredDisposable?: IDisposable;
|
||||||
protected _serverCapabilities: ConnectionProviderProperties;
|
protected _serverCapabilities?: ConnectionProviderProperties;
|
||||||
private static readonly SqlAuthentication = 'SqlLogin';
|
private static readonly SqlAuthentication = 'SqlLogin';
|
||||||
public static readonly ProviderPropertyName = 'providerName';
|
public static readonly ProviderPropertyName = 'providerName';
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
|||||||
}
|
}
|
||||||
|
|
||||||
public get providerName(): string {
|
public get providerName(): string {
|
||||||
return this._providerName;
|
return this._providerName!; // this needs to be rewritten at some point
|
||||||
}
|
}
|
||||||
|
|
||||||
public set providerName(name: string) {
|
public set providerName(name: string) {
|
||||||
@@ -100,7 +100,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get serverCapabilities(): ConnectionProviderProperties {
|
public get serverCapabilities(): ConnectionProviderProperties | undefined {
|
||||||
return this._serverCapabilities;
|
return this._serverCapabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
|||||||
* Returns true if the capabilities and options are loaded correctly
|
* Returns true if the capabilities and options are loaded correctly
|
||||||
*/
|
*/
|
||||||
public get isConnectionOptionsValid(): boolean {
|
public get isConnectionOptionsValid(): boolean {
|
||||||
return this.serverCapabilities && this.title.indexOf('undefined') < 0;
|
return !!this.serverCapabilities && this.title.indexOf('undefined') < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public isPasswordRequired(): boolean {
|
public isPasswordRequired(): boolean {
|
||||||
@@ -284,7 +284,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
|||||||
}
|
}
|
||||||
|
|
||||||
public get authenticationTypeDisplayName(): string {
|
public get authenticationTypeDisplayName(): string {
|
||||||
let optionMetadata = find(this._serverCapabilities.connectionOptions, o => o.specialValueType === ConnectionOptionSpecialType.authType);
|
let optionMetadata = this._serverCapabilities ? find(this._serverCapabilities.connectionOptions, o => o.specialValueType === ConnectionOptionSpecialType.authType) : undefined;
|
||||||
let authType = this.authenticationType;
|
let authType = this.authenticationType;
|
||||||
let displayName: string = authType;
|
let displayName: string = authType;
|
||||||
|
|
||||||
@@ -298,8 +298,8 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
|||||||
return displayName;
|
return displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getProviderOptions(): azdata.ConnectionOption[] {
|
public getProviderOptions(): azdata.ConnectionOption[] | undefined {
|
||||||
return this._serverCapabilities.connectionOptions;
|
return this._serverCapabilities?.connectionOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static get idSeparator(): string {
|
public static get idSeparator(): string {
|
||||||
@@ -317,6 +317,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
|||||||
parts.push(this.databaseName);
|
parts.push(this.databaseName);
|
||||||
parts.push(this.authenticationTypeDisplayName);
|
parts.push(this.authenticationTypeDisplayName);
|
||||||
|
|
||||||
|
if (this._serverCapabilities) {
|
||||||
this._serverCapabilities.connectionOptions.forEach(element => {
|
this._serverCapabilities.connectionOptions.forEach(element => {
|
||||||
if (element.specialValueType !== ConnectionOptionSpecialType.serverName &&
|
if (element.specialValueType !== ConnectionOptionSpecialType.serverName &&
|
||||||
element.specialValueType !== ConnectionOptionSpecialType.databaseName &&
|
element.specialValueType !== ConnectionOptionSpecialType.databaseName &&
|
||||||
@@ -330,6 +331,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return parts;
|
return parts;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,11 +126,11 @@ suite('ConnectionConfig', () => {
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: 'serverName',
|
name: 'serverName',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.serverName,
|
specialValueType: ConnectionOptionSpecialType.serverName,
|
||||||
@@ -138,11 +138,11 @@ suite('ConnectionConfig', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'databaseName',
|
name: 'databaseName',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.databaseName,
|
specialValueType: ConnectionOptionSpecialType.databaseName,
|
||||||
@@ -150,11 +150,11 @@ suite('ConnectionConfig', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'userName',
|
name: 'userName',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.userName,
|
specialValueType: ConnectionOptionSpecialType.userName,
|
||||||
@@ -162,11 +162,11 @@ suite('ConnectionConfig', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'authenticationType',
|
name: 'authenticationType',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.authType,
|
specialValueType: ConnectionOptionSpecialType.authType,
|
||||||
@@ -174,11 +174,11 @@ suite('ConnectionConfig', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'password',
|
name: 'password',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.password,
|
specialValueType: ConnectionOptionSpecialType.password,
|
||||||
@@ -218,7 +218,7 @@ suite('ConnectionConfig', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// weird way to verify that each group appears the same number of times in each array
|
// weird way to verify that each group appears the same number of times in each array
|
||||||
let result = groupsAreEqual(groups1.filter(a => a.parentId === group.id), groups2.filter(b => b.parentId === g2.id));
|
let result = groupsAreEqual(groups1.filter(a => a.parentId === group.id), groups2.filter(b => b.parentId === g2!.id));
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -251,13 +251,13 @@ suite('ConnectionConfig', () => {
|
|||||||
savePassword: true,
|
savePassword: true,
|
||||||
groupFullName: undefined,
|
groupFullName: undefined,
|
||||||
groupId: undefined,
|
groupId: undefined,
|
||||||
getOptionsKey: undefined,
|
getOptionsKey: undefined!,
|
||||||
matches: undefined,
|
matches: undefined!,
|
||||||
providerName: 'MSSQL',
|
providerName: 'MSSQL',
|
||||||
options: {},
|
options: {},
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: undefined,
|
id: undefined!,
|
||||||
connectionName: undefined
|
connectionName: undefined!
|
||||||
};
|
};
|
||||||
|
|
||||||
let configurationService = new TestConfigurationService();
|
let configurationService = new TestConfigurationService();
|
||||||
@@ -269,7 +269,7 @@ suite('ConnectionConfig', () => {
|
|||||||
let savedConnectionProfile = await config.addConnection(connectionProfile);
|
let savedConnectionProfile = await config.addConnection(connectionProfile);
|
||||||
|
|
||||||
assert.ok(!!savedConnectionProfile.id);
|
assert.ok(!!savedConnectionProfile.id);
|
||||||
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue.length, testConnections.length + 1);
|
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length + 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('addConnection should not add the new profile to user settings if already exists', async () => {
|
test('addConnection should not add the new profile to user settings if already exists', async () => {
|
||||||
@@ -283,13 +283,13 @@ suite('ConnectionConfig', () => {
|
|||||||
groupId: existingConnection.groupId,
|
groupId: existingConnection.groupId,
|
||||||
savePassword: true,
|
savePassword: true,
|
||||||
groupFullName: undefined,
|
groupFullName: undefined,
|
||||||
getOptionsKey: undefined,
|
getOptionsKey: undefined!,
|
||||||
matches: undefined,
|
matches: undefined!,
|
||||||
providerName: 'MSSQL',
|
providerName: 'MSSQL',
|
||||||
options: {},
|
options: {},
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: undefined,
|
id: undefined!,
|
||||||
connectionName: undefined
|
connectionName: undefined!
|
||||||
};
|
};
|
||||||
|
|
||||||
let configurationService = new TestConfigurationService();
|
let configurationService = new TestConfigurationService();
|
||||||
@@ -303,7 +303,7 @@ suite('ConnectionConfig', () => {
|
|||||||
let savedConnectionProfile = await config.addConnection(connectionProfile);
|
let savedConnectionProfile = await config.addConnection(connectionProfile);
|
||||||
|
|
||||||
assert.equal(savedConnectionProfile.id, existingConnection.id);
|
assert.equal(savedConnectionProfile.id, existingConnection.id);
|
||||||
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue.length, testConnections.length);
|
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('addConnection should add the new group to user settings if does not exist', async () => {
|
test('addConnection should add the new group to user settings if does not exist', async () => {
|
||||||
@@ -316,13 +316,13 @@ suite('ConnectionConfig', () => {
|
|||||||
savePassword: true,
|
savePassword: true,
|
||||||
groupFullName: 'g2/g2-2',
|
groupFullName: 'g2/g2-2',
|
||||||
groupId: undefined,
|
groupId: undefined,
|
||||||
getOptionsKey: undefined,
|
getOptionsKey: undefined!,
|
||||||
matches: undefined,
|
matches: undefined!,
|
||||||
providerName: 'MSSQL',
|
providerName: 'MSSQL',
|
||||||
options: {},
|
options: {},
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: undefined,
|
id: undefined!,
|
||||||
connectionName: undefined
|
connectionName: undefined!
|
||||||
};
|
};
|
||||||
|
|
||||||
let configurationService = new TestConfigurationService();
|
let configurationService = new TestConfigurationService();
|
||||||
@@ -333,8 +333,8 @@ suite('ConnectionConfig', () => {
|
|||||||
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
|
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
|
||||||
await config.addConnection(connectionProfile);
|
await config.addConnection(connectionProfile);
|
||||||
|
|
||||||
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue.length, testConnections.length + 1);
|
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length + 1);
|
||||||
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connectionGroups').userValue.length, testGroups.length + 1);
|
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connectionGroups').userValue!.length, testGroups.length + 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getConnections should return connections from user and workspace settings given getWorkspaceConnections set to true', () => {
|
test('getConnections should return connections from user and workspace settings given getWorkspaceConnections set to true', () => {
|
||||||
@@ -363,7 +363,7 @@ suite('ConnectionConfig', () => {
|
|||||||
return c;
|
return c;
|
||||||
});
|
});
|
||||||
let userConnections = deepClone(testConnections).map(c => {
|
let userConnections = deepClone(testConnections).map(c => {
|
||||||
c.id = undefined;
|
c.id = undefined!;
|
||||||
return c;
|
return c;
|
||||||
});
|
});
|
||||||
let configurationService = new TestConfigurationService();
|
let configurationService = new TestConfigurationService();
|
||||||
@@ -381,13 +381,13 @@ suite('ConnectionConfig', () => {
|
|||||||
} else {
|
} else {
|
||||||
let workspaceConnection = find(workspaceConnections, u => u.options['serverName'] === connection.serverName);
|
let workspaceConnection = find(workspaceConnections, u => u.options['serverName'] === connection.serverName);
|
||||||
assert.notEqual(connection.id, connection.getOptionsKey());
|
assert.notEqual(connection.id, connection.getOptionsKey());
|
||||||
assert.equal(workspaceConnection.id, connection.id);
|
assert.equal(workspaceConnection!.id, connection.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('saveGroup should save the new groups to tree and return the id of the last group name', () => {
|
test('saveGroup should save the new groups to tree and return the id of the last group name', () => {
|
||||||
let config = new ConnectionConfig(undefined, undefined);
|
let config = new ConnectionConfig(undefined!, undefined!);
|
||||||
let groups: IConnectionProfileGroup[] = deepClone(testGroups);
|
let groups: IConnectionProfileGroup[] = deepClone(testGroups);
|
||||||
let newGroups: string = 'ROOT/g1/g1-1/new-group/new-group2';
|
let newGroups: string = 'ROOT/g1/g1-1/new-group/new-group2';
|
||||||
let color: string = 'red';
|
let color: string = 'red';
|
||||||
@@ -396,11 +396,11 @@ suite('ConnectionConfig', () => {
|
|||||||
assert.ok(!!result);
|
assert.ok(!!result);
|
||||||
assert.equal(result.groups.length, testGroups.length + 2, 'The result groups length is invalid');
|
assert.equal(result.groups.length, testGroups.length + 2, 'The result groups length is invalid');
|
||||||
let newGroup = find(result.groups, g => g.name === 'new-group2');
|
let newGroup = find(result.groups, g => g.name === 'new-group2');
|
||||||
assert.equal(result.newGroupId, newGroup.id, 'The groups id is invalid');
|
assert.equal(result.newGroupId, newGroup!.id, 'The groups id is invalid');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('saveGroup should only add the groups that are not in the tree', () => {
|
test('saveGroup should only add the groups that are not in the tree', () => {
|
||||||
let config = new ConnectionConfig(undefined, undefined);
|
let config = new ConnectionConfig(undefined!, undefined!);
|
||||||
let groups: IConnectionProfileGroup[] = deepClone(testGroups);
|
let groups: IConnectionProfileGroup[] = deepClone(testGroups);
|
||||||
let newGroups: string = 'ROOT/g2/g2-5';
|
let newGroups: string = 'ROOT/g2/g2-5';
|
||||||
let color: string = 'red';
|
let color: string = 'red';
|
||||||
@@ -409,11 +409,11 @@ suite('ConnectionConfig', () => {
|
|||||||
assert.ok(!!result);
|
assert.ok(!!result);
|
||||||
assert.equal(result.groups.length, testGroups.length + 1, 'The result groups length is invalid');
|
assert.equal(result.groups.length, testGroups.length + 1, 'The result groups length is invalid');
|
||||||
let newGroup = find(result.groups, g => g.name === 'g2-5');
|
let newGroup = find(result.groups, g => g.name === 'g2-5');
|
||||||
assert.equal(result.newGroupId, newGroup.id, 'The groups id is invalid');
|
assert.equal(result.newGroupId, newGroup!.id, 'The groups id is invalid');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('saveGroup should not add any new group if tree already has all the groups in the full path', () => {
|
test('saveGroup should not add any new group if tree already has all the groups in the full path', () => {
|
||||||
let config = new ConnectionConfig(undefined, undefined);
|
let config = new ConnectionConfig(undefined!, undefined!);
|
||||||
let groups: IConnectionProfileGroup[] = deepClone(testGroups);
|
let groups: IConnectionProfileGroup[] = deepClone(testGroups);
|
||||||
let newGroups: string = 'ROOT/g2/g2-1';
|
let newGroups: string = 'ROOT/g2/g2-1';
|
||||||
let color: string = 'red';
|
let color: string = 'red';
|
||||||
@@ -422,7 +422,7 @@ suite('ConnectionConfig', () => {
|
|||||||
assert.ok(!!result);
|
assert.ok(!!result);
|
||||||
assert.equal(result.groups.length, testGroups.length, 'The result groups length is invalid');
|
assert.equal(result.groups.length, testGroups.length, 'The result groups length is invalid');
|
||||||
let newGroup = find(result.groups, g => g.name === 'g2-1');
|
let newGroup = find(result.groups, g => g.name === 'g2-1');
|
||||||
assert.equal(result.newGroupId, newGroup.id, 'The groups id is invalid');
|
assert.equal(result.newGroupId, newGroup!.id, 'The groups id is invalid');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('deleteConnection should remove the connection from config', async () => {
|
test('deleteConnection should remove the connection from config', async () => {
|
||||||
@@ -435,13 +435,13 @@ suite('ConnectionConfig', () => {
|
|||||||
savePassword: true,
|
savePassword: true,
|
||||||
groupFullName: 'g3',
|
groupFullName: 'g3',
|
||||||
groupId: 'g3',
|
groupId: 'g3',
|
||||||
getOptionsKey: undefined,
|
getOptionsKey: undefined!,
|
||||||
matches: undefined,
|
matches: undefined!,
|
||||||
providerName: 'MSSQL',
|
providerName: 'MSSQL',
|
||||||
options: {},
|
options: {},
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: undefined,
|
id: undefined!,
|
||||||
connectionName: undefined
|
connectionName: undefined!
|
||||||
};
|
};
|
||||||
let configurationService = new TestConfigurationService();
|
let configurationService = new TestConfigurationService();
|
||||||
configurationService.updateValue('datasource.connections', deepClone(testConnections), ConfigurationTarget.USER);
|
configurationService.updateValue('datasource.connections', deepClone(testConnections), ConfigurationTarget.USER);
|
||||||
@@ -452,7 +452,7 @@ suite('ConnectionConfig', () => {
|
|||||||
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
|
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
|
||||||
await config.deleteConnection(connectionProfile);
|
await config.deleteConnection(connectionProfile);
|
||||||
|
|
||||||
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue.length, testConnections.length - 1);
|
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length - 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('deleteConnectionGroup should remove the children connections and subgroups from config', async () => {
|
test('deleteConnectionGroup should remove the children connections and subgroups from config', async () => {
|
||||||
@@ -465,13 +465,13 @@ suite('ConnectionConfig', () => {
|
|||||||
savePassword: true,
|
savePassword: true,
|
||||||
groupFullName: 'g3',
|
groupFullName: 'g3',
|
||||||
groupId: 'g3',
|
groupId: 'g3',
|
||||||
getOptionsKey: undefined,
|
getOptionsKey: undefined!,
|
||||||
matches: undefined,
|
matches: undefined!,
|
||||||
providerName: 'MSSQL',
|
providerName: 'MSSQL',
|
||||||
options: {},
|
options: {},
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: undefined,
|
id: undefined!,
|
||||||
connectionName: undefined
|
connectionName: undefined!
|
||||||
};
|
};
|
||||||
let configurationService = new TestConfigurationService();
|
let configurationService = new TestConfigurationService();
|
||||||
configurationService.updateValue('datasource.connections', deepClone(testConnections), ConfigurationTarget.USER);
|
configurationService.updateValue('datasource.connections', deepClone(testConnections), ConfigurationTarget.USER);
|
||||||
@@ -488,8 +488,8 @@ suite('ConnectionConfig', () => {
|
|||||||
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
|
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
|
||||||
await config.deleteGroup(connectionProfileGroup);
|
await config.deleteGroup(connectionProfileGroup);
|
||||||
|
|
||||||
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue.length, testConnections.length - 1);
|
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length - 1);
|
||||||
assert.equal(configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue.length, testGroups.length - 2);
|
assert.equal(configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!.length, testGroups.length - 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('deleteConnection should not throw error for connection not in config', async () => {
|
test('deleteConnection should not throw error for connection not in config', async () => {
|
||||||
@@ -502,13 +502,13 @@ suite('ConnectionConfig', () => {
|
|||||||
savePassword: true,
|
savePassword: true,
|
||||||
groupFullName: 'g3',
|
groupFullName: 'g3',
|
||||||
groupId: 'newid',
|
groupId: 'newid',
|
||||||
getOptionsKey: undefined,
|
getOptionsKey: undefined!,
|
||||||
matches: undefined,
|
matches: undefined!,
|
||||||
providerName: 'MSSQL',
|
providerName: 'MSSQL',
|
||||||
options: {},
|
options: {},
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: undefined,
|
id: undefined!,
|
||||||
connectionName: undefined
|
connectionName: undefined!
|
||||||
};
|
};
|
||||||
let configurationService = new TestConfigurationService();
|
let configurationService = new TestConfigurationService();
|
||||||
configurationService.updateValue('datasource.connections', deepClone(testConnections), ConfigurationTarget.USER);
|
configurationService.updateValue('datasource.connections', deepClone(testConnections), ConfigurationTarget.USER);
|
||||||
@@ -517,7 +517,7 @@ suite('ConnectionConfig', () => {
|
|||||||
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
|
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
|
||||||
await config.deleteConnection(connectionProfile);
|
await config.deleteConnection(connectionProfile);
|
||||||
|
|
||||||
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue.length, testConnections.length);
|
assert.equal(configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!.length, testConnections.length);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('renameGroup should change group name', async () => {
|
test('renameGroup should change group name', async () => {
|
||||||
@@ -528,12 +528,12 @@ suite('ConnectionConfig', () => {
|
|||||||
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
|
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
|
||||||
await config.editGroup(connectionProfileGroup);
|
await config.editGroup(connectionProfileGroup);
|
||||||
|
|
||||||
let editedGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue;
|
let editedGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
|
||||||
|
|
||||||
assert.equal(editedGroups.length, testGroups.length);
|
assert.equal(editedGroups.length, testGroups.length);
|
||||||
let editedGroup = find(editedGroups, group => group.id === 'g2');
|
let editedGroup = find(editedGroups, group => group.id === 'g2');
|
||||||
assert.ok(!!editedGroup);
|
assert.ok(!!editedGroup);
|
||||||
assert.equal(editedGroup.name, 'g-renamed');
|
assert.equal(editedGroup!.name, 'g-renamed');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('edit group should throw if there is a confliction', async () => {
|
test('edit group should throw if there is a confliction', async () => {
|
||||||
@@ -547,10 +547,10 @@ suite('ConnectionConfig', () => {
|
|||||||
await config.editGroup(sameNameGroup);
|
await config.editGroup(sameNameGroup);
|
||||||
assert.fail();
|
assert.fail();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
let groups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue;
|
let groups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
|
||||||
let originalGroup = find(groups, g => g.id === 'g2');
|
let originalGroup = find(groups, g => g.id === 'g2');
|
||||||
assert.ok(!!originalGroup);
|
assert.ok(!!originalGroup);
|
||||||
assert.equal(originalGroup.name, 'g2');
|
assert.equal(originalGroup!.name, 'g2');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -563,12 +563,12 @@ suite('ConnectionConfig', () => {
|
|||||||
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
|
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
|
||||||
await config.changeGroupIdForConnectionGroup(sourceProfileGroup, targetProfileGroup);
|
await config.changeGroupIdForConnectionGroup(sourceProfileGroup, targetProfileGroup);
|
||||||
|
|
||||||
let editedGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue;
|
let editedGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
|
||||||
|
|
||||||
assert.equal(editedGroups.length, testGroups.length);
|
assert.equal(editedGroups.length, testGroups.length);
|
||||||
let editedGroup = find(editedGroups, group => group.id === 'g2');
|
let editedGroup = find(editedGroups, group => group.id === 'g2');
|
||||||
assert.ok(!!editedGroup);
|
assert.ok(!!editedGroup);
|
||||||
assert.equal(editedGroup.parentId, 'g3');
|
assert.equal(editedGroup!.parentId, 'g3');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -583,12 +583,12 @@ suite('ConnectionConfig', () => {
|
|||||||
groupFullName: 'g3',
|
groupFullName: 'g3',
|
||||||
groupId: 'g3',
|
groupId: 'g3',
|
||||||
getOptionsKey: () => { return 'connectionId'; },
|
getOptionsKey: () => { return 'connectionId'; },
|
||||||
matches: undefined,
|
matches: undefined!,
|
||||||
providerName: 'MSSQL',
|
providerName: 'MSSQL',
|
||||||
options: {},
|
options: {},
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: 'server3-2',
|
id: 'server3-2',
|
||||||
connectionName: undefined
|
connectionName: undefined!
|
||||||
};
|
};
|
||||||
let existingProfile = ConnectionProfile.convertToProfileStore(capabilitiesService.object, {
|
let existingProfile = ConnectionProfile.convertToProfileStore(capabilitiesService.object, {
|
||||||
serverName: 'server3',
|
serverName: 'server3',
|
||||||
@@ -600,15 +600,15 @@ suite('ConnectionConfig', () => {
|
|||||||
groupFullName: 'test',
|
groupFullName: 'test',
|
||||||
groupId: 'test',
|
groupId: 'test',
|
||||||
getOptionsKey: () => { return 'connectionId'; },
|
getOptionsKey: () => { return 'connectionId'; },
|
||||||
matches: undefined,
|
matches: undefined!,
|
||||||
providerName: 'MSSQL',
|
providerName: 'MSSQL',
|
||||||
options: {},
|
options: {},
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: 'server3',
|
id: 'server3',
|
||||||
connectionName: undefined
|
connectionName: undefined!
|
||||||
});
|
});
|
||||||
|
|
||||||
let _testConnections = deepClone(testConnections).concat([existingProfile, changingProfile]);
|
let _testConnections = [...deepClone(testConnections), existingProfile, changingProfile];
|
||||||
|
|
||||||
let configurationService = new TestConfigurationService();
|
let configurationService = new TestConfigurationService();
|
||||||
configurationService.updateValue('datasource.connections', _testConnections, ConfigurationTarget.USER);
|
configurationService.updateValue('datasource.connections', _testConnections, ConfigurationTarget.USER);
|
||||||
@@ -620,12 +620,12 @@ suite('ConnectionConfig', () => {
|
|||||||
await config.changeGroupIdForConnection(connectionProfile, 'test');
|
await config.changeGroupIdForConnection(connectionProfile, 'test');
|
||||||
assert.fail();
|
assert.fail();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
let editedConnections = configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue;
|
let editedConnections = configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!;
|
||||||
// two
|
// two
|
||||||
assert.equal(editedConnections.length, _testConnections.length);
|
assert.equal(editedConnections.length, _testConnections.length);
|
||||||
let editedConnection = find(editedConnections, con => con.id === 'server3-2');
|
let editedConnection = find(editedConnections, con => con.id === 'server3-2');
|
||||||
assert.ok(!!editedConnection);
|
assert.ok(!!editedConnection);
|
||||||
assert.equal(editedConnection.groupId, 'g3');
|
assert.equal(editedConnection!.groupId, 'g3');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -640,12 +640,12 @@ suite('ConnectionConfig', () => {
|
|||||||
groupFullName: 'g3',
|
groupFullName: 'g3',
|
||||||
groupId: 'g3',
|
groupId: 'g3',
|
||||||
getOptionsKey: () => { return 'connectionId'; },
|
getOptionsKey: () => { return 'connectionId'; },
|
||||||
matches: undefined,
|
matches: undefined!,
|
||||||
providerName: 'MSSQL',
|
providerName: 'MSSQL',
|
||||||
options: {},
|
options: {},
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: 'server3',
|
id: 'server3',
|
||||||
connectionName: undefined
|
connectionName: undefined!
|
||||||
};
|
};
|
||||||
|
|
||||||
let configurationService = new TestConfigurationService();
|
let configurationService = new TestConfigurationService();
|
||||||
@@ -657,11 +657,11 @@ suite('ConnectionConfig', () => {
|
|||||||
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
|
let config = new ConnectionConfig(configurationService, capabilitiesService.object);
|
||||||
await config.changeGroupIdForConnection(connectionProfile, newId);
|
await config.changeGroupIdForConnection(connectionProfile, newId);
|
||||||
|
|
||||||
let editedConnections = configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue;
|
let editedConnections = configurationService.inspect<IConnectionProfileStore[]>('datasource.connections').userValue!;
|
||||||
assert.equal(editedConnections.length, testConnections.length);
|
assert.equal(editedConnections.length, testConnections.length);
|
||||||
let editedConnection = find(editedConnections, con => con.id === 'server3');
|
let editedConnection = find(editedConnections, con => con.id === 'server3');
|
||||||
assert.ok(!!editedConnection);
|
assert.ok(!!editedConnection);
|
||||||
assert.equal(editedConnection.groupId, 'newid');
|
assert.equal(editedConnection!.groupId, 'newid');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('addConnection should not move the connection when editing', async () => {
|
test('addConnection should not move the connection when editing', async () => {
|
||||||
@@ -691,7 +691,7 @@ suite('ConnectionConfig', () => {
|
|||||||
|
|
||||||
test('addgroup works', async () => {
|
test('addgroup works', async () => {
|
||||||
let newGroup: IConnectionProfileGroup = {
|
let newGroup: IConnectionProfileGroup = {
|
||||||
id: undefined,
|
id: undefined!,
|
||||||
parentId: undefined,
|
parentId: undefined,
|
||||||
name: 'new group',
|
name: 'new group',
|
||||||
color: 'red',
|
color: 'red',
|
||||||
@@ -704,14 +704,14 @@ suite('ConnectionConfig', () => {
|
|||||||
|
|
||||||
await config.addGroup(newGroup);
|
await config.addGroup(newGroup);
|
||||||
|
|
||||||
let editGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue;
|
let editGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
|
||||||
|
|
||||||
assert.equal(editGroups.length, testGroups.length + 1);
|
assert.equal(editGroups.length, testGroups.length + 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('addGroup rejects if group name already exists', async () => {
|
test('addGroup rejects if group name already exists', async () => {
|
||||||
let existingGroupName: IConnectionProfileGroup = {
|
let existingGroupName: IConnectionProfileGroup = {
|
||||||
id: undefined,
|
id: undefined!,
|
||||||
parentId: undefined,
|
parentId: undefined,
|
||||||
name: 'g2',
|
name: 'g2',
|
||||||
color: 'red',
|
color: 'red',
|
||||||
@@ -725,7 +725,7 @@ suite('ConnectionConfig', () => {
|
|||||||
await config.addGroup(existingGroupName);
|
await config.addGroup(existingGroupName);
|
||||||
assert.fail();
|
assert.fail();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
let editGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue;
|
let editGroups = configurationService.inspect<IConnectionProfileGroup[]>('datasource.connectionGroups').userValue!;
|
||||||
|
|
||||||
assert.equal(editGroups.length, testGroups.length);
|
assert.equal(editGroups.length, testGroups.length);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ suite('SQL ConnectionProfileInfo tests', () => {
|
|||||||
savePassword: true,
|
savePassword: true,
|
||||||
groupFullName: 'g2/g2-2',
|
groupFullName: 'g2/g2-2',
|
||||||
groupId: 'group id',
|
groupId: 'group id',
|
||||||
getOptionsKey: undefined,
|
getOptionsKey: undefined!,
|
||||||
matches: undefined,
|
matches: undefined!,
|
||||||
providerName: mssqlProviderName,
|
providerName: mssqlProviderName,
|
||||||
options: {},
|
options: {},
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: undefined
|
id: undefined!
|
||||||
};
|
};
|
||||||
|
|
||||||
let storedProfile: IConnectionProfileStore = {
|
let storedProfile: IConnectionProfileStore = {
|
||||||
@@ -54,11 +54,11 @@ suite('SQL ConnectionProfileInfo tests', () => {
|
|||||||
let connectionProvider: azdata.ConnectionOption[] = [
|
let connectionProvider: azdata.ConnectionOption[] = [
|
||||||
{
|
{
|
||||||
name: 'connectionName',
|
name: 'connectionName',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.connectionName,
|
specialValueType: ConnectionOptionSpecialType.connectionName,
|
||||||
@@ -66,11 +66,11 @@ suite('SQL ConnectionProfileInfo tests', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'serverName',
|
name: 'serverName',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.serverName,
|
specialValueType: ConnectionOptionSpecialType.serverName,
|
||||||
@@ -78,11 +78,11 @@ suite('SQL ConnectionProfileInfo tests', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'databaseName',
|
name: 'databaseName',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.databaseName,
|
specialValueType: ConnectionOptionSpecialType.databaseName,
|
||||||
@@ -90,11 +90,11 @@ suite('SQL ConnectionProfileInfo tests', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'userName',
|
name: 'userName',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.userName,
|
specialValueType: ConnectionOptionSpecialType.userName,
|
||||||
@@ -102,11 +102,11 @@ suite('SQL ConnectionProfileInfo tests', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'authenticationType',
|
name: 'authenticationType',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.authType,
|
specialValueType: ConnectionOptionSpecialType.authType,
|
||||||
@@ -114,11 +114,11 @@ suite('SQL ConnectionProfileInfo tests', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'password',
|
name: 'password',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.password,
|
specialValueType: ConnectionOptionSpecialType.password,
|
||||||
@@ -135,7 +135,7 @@ suite('SQL ConnectionProfileInfo tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('set properties should set the values correctly', () => {
|
test('set properties should set the values correctly', () => {
|
||||||
let conn = new ConnectionProfile(capabilitiesService, undefined);
|
let conn = new ConnectionProfile(capabilitiesService, undefined!);
|
||||||
assert.equal(conn.serverName, undefined);
|
assert.equal(conn.serverName, undefined);
|
||||||
conn.connectionName = connectionProfile.connectionName;
|
conn.connectionName = connectionProfile.connectionName;
|
||||||
conn.serverName = connectionProfile.serverName;
|
conn.serverName = connectionProfile.serverName;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ suite('SQL ConnectionProfileGroup tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('getGroupFullNameParts should return a list With ROOT in it given null', () => {
|
test('getGroupFullNameParts should return a list With ROOT in it given null', () => {
|
||||||
let groupFullName: string = undefined;
|
let groupFullName: string = undefined!;
|
||||||
let expected: string[] = [ConnectionProfileGroup.RootGroupName];
|
let expected: string[] = [ConnectionProfileGroup.RootGroupName];
|
||||||
let actual = ConnectionProfileGroup.getGroupFullNameParts(groupFullName);
|
let actual = ConnectionProfileGroup.getGroupFullNameParts(groupFullName);
|
||||||
assert.deepEqual(actual, expected);
|
assert.deepEqual(actual, expected);
|
||||||
@@ -99,7 +99,7 @@ suite('SQL ConnectionProfileGroup tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('isRoot should return true given null', () => {
|
test('isRoot should return true given null', () => {
|
||||||
let name: string = undefined;
|
let name: string = undefined!;
|
||||||
let expected: boolean = true;
|
let expected: boolean = true;
|
||||||
let actual = ConnectionProfileGroup.isRoot(name);
|
let actual = ConnectionProfileGroup.isRoot(name);
|
||||||
assert.deepEqual(actual, expected);
|
assert.deepEqual(actual, expected);
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ suite('ConnectionStore', () => {
|
|||||||
savePassword: true,
|
savePassword: true,
|
||||||
groupId: '',
|
groupId: '',
|
||||||
groupFullName: '',
|
groupFullName: '',
|
||||||
getOptionsKey: undefined,
|
getOptionsKey: undefined!,
|
||||||
matches: () => false,
|
matches: () => false,
|
||||||
providerName: mssqlProviderName,
|
providerName: mssqlProviderName,
|
||||||
options: {},
|
options: {},
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: undefined
|
id: undefined!
|
||||||
});
|
});
|
||||||
let capabilitiesService: TestCapabilitiesService;
|
let capabilitiesService: TestCapabilitiesService;
|
||||||
let maxRecent = 5;
|
let maxRecent = 5;
|
||||||
@@ -51,11 +51,11 @@ suite('ConnectionStore', () => {
|
|||||||
let connectionProvider: azdata.ConnectionOption[] = [
|
let connectionProvider: azdata.ConnectionOption[] = [
|
||||||
{
|
{
|
||||||
name: 'connectionName',
|
name: 'connectionName',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.connectionName,
|
specialValueType: ConnectionOptionSpecialType.connectionName,
|
||||||
@@ -63,11 +63,11 @@ suite('ConnectionStore', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'serverName',
|
name: 'serverName',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.serverName,
|
specialValueType: ConnectionOptionSpecialType.serverName,
|
||||||
@@ -75,11 +75,11 @@ suite('ConnectionStore', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'databaseName',
|
name: 'databaseName',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.databaseName,
|
specialValueType: ConnectionOptionSpecialType.databaseName,
|
||||||
@@ -87,11 +87,11 @@ suite('ConnectionStore', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'userName',
|
name: 'userName',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.userName,
|
specialValueType: ConnectionOptionSpecialType.userName,
|
||||||
@@ -99,11 +99,11 @@ suite('ConnectionStore', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'authenticationType',
|
name: 'authenticationType',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.authType,
|
specialValueType: ConnectionOptionSpecialType.authType,
|
||||||
@@ -111,11 +111,11 @@ suite('ConnectionStore', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'password',
|
name: 'password',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.password,
|
specialValueType: ConnectionOptionSpecialType.password,
|
||||||
@@ -232,8 +232,8 @@ suite('ConnectionStore', () => {
|
|||||||
let current = connectionStore.getRecentlyUsedConnections();
|
let current = connectionStore.getRecentlyUsedConnections();
|
||||||
// Then verify that since its password based we save the password
|
// Then verify that since its password based we save the password
|
||||||
assert.equal(credentialsService.credentials.size, 1);
|
assert.equal(credentialsService.credentials.size, 1);
|
||||||
assert.strictEqual(recentCredential.password, defaultNamedProfile.password);
|
assert.strictEqual(recentCredential!.password, defaultNamedProfile.password);
|
||||||
assert.ok(recentCredential.credentialId.indexOf('Profile') > -1, 'Expect credential to be marked as an Profile cred');
|
assert.ok(recentCredential!.credentialId.indexOf('Profile') > -1, 'Expect credential to be marked as an Profile cred');
|
||||||
assert.ok(!current[0].password);
|
assert.ok(!current[0].password);
|
||||||
// When add integrated auth connection
|
// When add integrated auth connection
|
||||||
const integratedCredConnectionProfile = new ConnectionProfile(capabilitiesService, integratedCred);
|
const integratedCredConnectionProfile = new ConnectionProfile(capabilitiesService, integratedCred);
|
||||||
@@ -376,11 +376,11 @@ suite('ConnectionStore', () => {
|
|||||||
credentialsService, capabilitiesService);
|
credentialsService, capabilitiesService);
|
||||||
|
|
||||||
// If I look up the parent group using its ID, then I get back the correct group
|
// If I look up the parent group using its ID, then I get back the correct group
|
||||||
let actualGroup = connectionStore.getGroupFromId(parentGroupId);
|
let actualGroup = connectionStore.getGroupFromId(parentGroupId)!;
|
||||||
assert.equal(actualGroup.id, parentGroupId, 'Did not get the parent group when looking it up with its ID');
|
assert.equal(actualGroup.id, parentGroupId, 'Did not get the parent group when looking it up with its ID');
|
||||||
|
|
||||||
// If I look up the child group using its ID, then I get back the correct group
|
// If I look up the child group using its ID, then I get back the correct group
|
||||||
actualGroup = connectionStore.getGroupFromId(childGroupId);
|
actualGroup = connectionStore.getGroupFromId(childGroupId)!;
|
||||||
assert.equal(actualGroup.id, childGroupId, 'Did not get the child group when looking it up with its ID');
|
assert.equal(actualGroup.id, childGroupId, 'Did not get the child group when looking it up with its ID');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ suite('SQL ProviderConnectionInfo tests', () => {
|
|||||||
savePassword: true,
|
savePassword: true,
|
||||||
groupFullName: 'g2/g2-2',
|
groupFullName: 'g2/g2-2',
|
||||||
groupId: undefined,
|
groupId: undefined,
|
||||||
getOptionsKey: undefined,
|
getOptionsKey: undefined!,
|
||||||
matches: undefined,
|
matches: undefined!,
|
||||||
providerName: mssqlProviderName,
|
providerName: mssqlProviderName,
|
||||||
options: undefined,
|
options: undefined!,
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: undefined
|
id: undefined!
|
||||||
};
|
};
|
||||||
|
|
||||||
setup(() => {
|
setup(() => {
|
||||||
@@ -39,11 +39,11 @@ suite('SQL ProviderConnectionInfo tests', () => {
|
|||||||
let connectionProvider: azdata.ConnectionOption[] = [
|
let connectionProvider: azdata.ConnectionOption[] = [
|
||||||
{
|
{
|
||||||
name: 'connectionName',
|
name: 'connectionName',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.connectionName,
|
specialValueType: ConnectionOptionSpecialType.connectionName,
|
||||||
@@ -51,11 +51,11 @@ suite('SQL ProviderConnectionInfo tests', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'serverName',
|
name: 'serverName',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.serverName,
|
specialValueType: ConnectionOptionSpecialType.serverName,
|
||||||
@@ -63,11 +63,11 @@ suite('SQL ProviderConnectionInfo tests', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'databaseName',
|
name: 'databaseName',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.databaseName,
|
specialValueType: ConnectionOptionSpecialType.databaseName,
|
||||||
@@ -75,11 +75,11 @@ suite('SQL ProviderConnectionInfo tests', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'userName',
|
name: 'userName',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.userName,
|
specialValueType: ConnectionOptionSpecialType.userName,
|
||||||
@@ -87,11 +87,11 @@ suite('SQL ProviderConnectionInfo tests', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'authenticationType',
|
name: 'authenticationType',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.authType,
|
specialValueType: ConnectionOptionSpecialType.authType,
|
||||||
@@ -99,11 +99,11 @@ suite('SQL ProviderConnectionInfo tests', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'password',
|
name: 'password',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: true,
|
isIdentity: true,
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
specialValueType: ConnectionOptionSpecialType.password,
|
specialValueType: ConnectionOptionSpecialType.password,
|
||||||
@@ -111,14 +111,14 @@ suite('SQL ProviderConnectionInfo tests', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'encrypt',
|
name: 'encrypt',
|
||||||
displayName: undefined,
|
displayName: undefined!,
|
||||||
description: undefined,
|
description: undefined!,
|
||||||
groupName: undefined,
|
groupName: undefined!,
|
||||||
categoryValues: undefined,
|
categoryValues: undefined!,
|
||||||
defaultValue: undefined,
|
defaultValue: undefined!,
|
||||||
isIdentity: false,
|
isIdentity: false,
|
||||||
isRequired: false,
|
isRequired: false,
|
||||||
specialValueType: undefined,
|
specialValueType: undefined!,
|
||||||
valueType: ServiceOptionType.string
|
valueType: ServiceOptionType.string
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
@@ -133,7 +133,7 @@ suite('SQL ProviderConnectionInfo tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('constructor should accept undefined parameters', () => {
|
test('constructor should accept undefined parameters', () => {
|
||||||
let conn = new ProviderConnectionInfo(undefined, undefined);
|
let conn = new ProviderConnectionInfo(undefined!, undefined!);
|
||||||
assert.equal(conn.serverName, undefined);
|
assert.equal(conn.serverName, undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ suite('SQL ProviderConnectionInfo tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('constructor should initialize the options given a valid model with options', () => {
|
test('constructor should initialize the options given a valid model with options', () => {
|
||||||
let options = {};
|
let options: { [key: string]: string } = {};
|
||||||
options['encrypt'] = 'test value';
|
options['encrypt'] = 'test value';
|
||||||
let conn2 = assign({}, connectionProfile, { options: options });
|
let conn2 = assign({}, connectionProfile, { options: options });
|
||||||
let conn = new ProviderConnectionInfo(capabilitiesService, conn2);
|
let conn = new ProviderConnectionInfo(capabilitiesService, conn2);
|
||||||
@@ -247,7 +247,7 @@ suite('SQL ProviderConnectionInfo tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('getProviderFromOptionsKey should return empty string give null', () => {
|
test('getProviderFromOptionsKey should return empty string give null', () => {
|
||||||
let optionsKey = undefined;
|
let optionsKey = undefined!;
|
||||||
let expectedProviderId: string = '';
|
let expectedProviderId: string = '';
|
||||||
let actual = ProviderConnectionInfo.getProviderFromOptionsKey(optionsKey);
|
let actual = ProviderConnectionInfo.getProviderFromOptionsKey(optionsKey);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { getConfigurationKeys, IConfigurationOverrides, IConfigurationService, g
|
|||||||
export class TestConfigurationService implements IConfigurationService {
|
export class TestConfigurationService implements IConfigurationService {
|
||||||
public _serviceBrand: undefined;
|
public _serviceBrand: undefined;
|
||||||
|
|
||||||
private configuration = {
|
private configuration: { user: { [key: string]: any }; workspace: { [key: string]: any } } = {
|
||||||
user: {},
|
user: {},
|
||||||
workspace: {}
|
workspace: {}
|
||||||
};
|
};
|
||||||
@@ -22,7 +22,7 @@ export class TestConfigurationService implements IConfigurationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public updateValue(key: string, value: any, target?: any): Promise<void> {
|
public updateValue(key: string, value: any, target?: any): Promise<void> {
|
||||||
let _target = (target as ConfigurationTarget) === ConfigurationTarget.USER ? 'user' : 'workspace';
|
let _target: 'user' | 'workspace' = (target as ConfigurationTarget) === ConfigurationTarget.USER ? 'user' : 'workspace';
|
||||||
let keyArray = key.split('.');
|
let keyArray = key.split('.');
|
||||||
let targetObject = this.configuration[_target];
|
let targetObject = this.configuration[_target];
|
||||||
for (let i = 0; i < keyArray.length; i++) {
|
for (let i = 0; i < keyArray.length; i++) {
|
||||||
|
|||||||
@@ -16,11 +16,16 @@ import { ConnectionProviderProperties } from 'sql/platform/capabilities/common/c
|
|||||||
// Test stubs for commonly used objects
|
// Test stubs for commonly used objects
|
||||||
|
|
||||||
export class TestConnectionManagementService implements IConnectionManagementService {
|
export class TestConnectionManagementService implements IConnectionManagementService {
|
||||||
|
disconnect(connection: IConnectionProfile): Promise<void>;
|
||||||
|
disconnect(ownerUri: string): Promise<void>;
|
||||||
|
disconnect(ownerUri: any) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
_serviceBrand: undefined;
|
_serviceBrand: undefined;
|
||||||
onAddConnectionProfile = undefined;
|
onAddConnectionProfile = undefined!;
|
||||||
onDeleteConnectionProfile = undefined;
|
onDeleteConnectionProfile = undefined!;
|
||||||
onConnectionChanged = undefined;
|
onConnectionChanged = undefined!;
|
||||||
onLanguageFlavorChanged = undefined;
|
onLanguageFlavorChanged = undefined!;
|
||||||
|
|
||||||
public get onConnect(): Event<any> {
|
public get onConnect(): Event<any> {
|
||||||
return Event.None;
|
return Event.None;
|
||||||
@@ -43,15 +48,15 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
showConnectionDialog(params?: INewConnectionParams, options?: IConnectionCompletionOptions, model?: IConnectionProfile, connectionResult?: IConnectionResult): Promise<void> {
|
showConnectionDialog(params?: INewConnectionParams, options?: IConnectionCompletionOptions, model?: IConnectionProfile, connectionResult?: IConnectionResult): Promise<void> {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
showCreateServerGroupDialog(): Promise<void> {
|
showCreateServerGroupDialog(): Promise<void> {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
showEditServerGroupDialog(group: ConnectionProfileGroup): Promise<void> {
|
showEditServerGroupDialog(group: ConnectionProfileGroup): Promise<void> {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
onConnectionComplete(handle: number, connectionInfoSummary: azdata.ConnectionInfoSummary): void {
|
onConnectionComplete(handle: number, connectionInfoSummary: azdata.ConnectionInfoSummary): void {
|
||||||
@@ -67,7 +72,7 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCurrentConnectionSummary(): azdata.ConnectionSummary {
|
getCurrentConnectionSummary(): azdata.ConnectionSummary {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
getConnectionGroups(providers?: string[]): ConnectionProfileGroup[] {
|
getConnectionGroups(providers?: string[]): ConnectionProfileGroup[] {
|
||||||
@@ -79,7 +84,7 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
saveProfileGroup(profile: IConnectionProfileGroup): Promise<string> {
|
saveProfileGroup(profile: IConnectionProfileGroup): Promise<string> {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
getRecentConnections(providers?: string[]): ConnectionProfile[] {
|
getRecentConnections(providers?: string[]): ConnectionProfile[] {
|
||||||
@@ -123,15 +128,15 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
getConnectionUri(connectionProfile: ConnectionProfile): string {
|
getConnectionUri(connectionProfile: ConnectionProfile): string {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
getFormattedUri(uri: string, connectionProfile: ConnectionProfile): string {
|
getFormattedUri(uri: string, connectionProfile: ConnectionProfile): string {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
getConnectionUriFromId(connectionId: string): string {
|
getConnectionUriFromId(connectionId: string): string {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
isConnected(fileUri: string, connectionProfile?: ConnectionProfile): boolean {
|
isConnected(fileUri: string, connectionProfile?: ConnectionProfile): boolean {
|
||||||
@@ -151,12 +156,12 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
findExistingConnection(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection'): ConnectionProfile {
|
findExistingConnection(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection'): ConnectionProfile {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(connection: IConnectionProfile, uri: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks): Promise<IConnectionResult> {
|
connect(connection: IConnectionProfile, uri: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks): Promise<IConnectionResult> {
|
||||||
return new Promise<IConnectionResult>((resolve, reject) => {
|
return new Promise<IConnectionResult>((resolve, reject) => {
|
||||||
resolve({ connected: true, errorMessage: undefined, errorCode: undefined, callStack: undefined });
|
resolve({ connected: true, errorMessage: undefined!, errorCode: undefined!, callStack: undefined! });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,20 +173,12 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
return new Promise<boolean>(() => true);
|
return new Promise<boolean>(() => true);
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnect(connection: IConnectionProfile);
|
|
||||||
disconnect(uri: string);
|
|
||||||
disconnect(input: any): Promise<boolean> {
|
|
||||||
return new Promise<boolean>((resolve, reject) => {
|
|
||||||
resolve(true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getConnectionProfile(fileUri: string): IConnectionProfile {
|
getConnectionProfile(fileUri: string): IConnectionProfile {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
getConnectionInfo(fileUri: string): ConnectionManagementInfo {
|
getConnectionInfo(fileUri: string): ConnectionManagementInfo {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
addSavedPassword(connectionProfile: IConnectionProfile): Promise<IConnectionProfile> {
|
addSavedPassword(connectionProfile: IConnectionProfile): Promise<IConnectionProfile> {
|
||||||
@@ -189,15 +186,15 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
public listDatabases(connectionUri: string): Thenable<azdata.ListDatabasesResult> {
|
public listDatabases(connectionUri: string): Thenable<azdata.ListDatabasesResult> {
|
||||||
return Promise.resolve(undefined);
|
return Promise.resolve(undefined!);
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelConnection(connection: IConnectionProfile): Thenable<boolean> {
|
cancelConnection(connection: IConnectionProfile): Thenable<boolean> {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelEditorConnection(owner: IConnectableInput): Thenable<boolean> {
|
cancelEditorConnection(owner: IConnectableInput): Thenable<boolean> {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
showDashboard(connection: ConnectionProfile): Promise<boolean> {
|
showDashboard(connection: ConnectionProfile): Promise<boolean> {
|
||||||
@@ -220,7 +217,7 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
getProviderIdFromUri(ownerUri: string): string {
|
getProviderIdFromUri(ownerUri: string): string {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasRegisteredServers(): boolean {
|
hasRegisteredServers(): boolean {
|
||||||
@@ -228,7 +225,7 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCapabilities(providerName: string): azdata.DataProtocolServerCapabilities {
|
getCapabilities(providerName: string): azdata.DataProtocolServerCapabilities {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
canChangeConnectionConfig(profile: ConnectionProfile, newGroupID: string): boolean {
|
canChangeConnectionConfig(profile: ConnectionProfile, newGroupID: string): boolean {
|
||||||
@@ -243,55 +240,55 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
connectIfNotConnected(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection', saveConnection: boolean = false): Promise<string> {
|
connectIfNotConnected(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection', saveConnection: boolean = false): Promise<string> {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
rebuildIntelliSenseCache(uri: string): Thenable<void> {
|
rebuildIntelliSenseCache(uri: string): Thenable<void> {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTabColorForUri(uri: string): string {
|
getTabColorForUri(uri: string): string {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
removeConnectionProfileCredentials(profile: IConnectionProfile): IConnectionProfile {
|
removeConnectionProfileCredentials(profile: IConnectionProfile): IConnectionProfile {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
getActiveConnectionCredentials(profileId: string): { [name: string]: string } {
|
getActiveConnectionCredentials(profileId: string): { [name: string]: string } {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
getServerInfo(profileId: string): azdata.ServerInfo {
|
getServerInfo(profileId: string): azdata.ServerInfo {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
getConnectionString(connectionId: string): Thenable<string> {
|
getConnectionString(connectionId: string): Thenable<string> {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildConnectionInfo(connectionString: string, provider?: string): Thenable<azdata.ConnectionInfo> {
|
buildConnectionInfo(connectionString: string, provider?: string): Thenable<azdata.ConnectionInfo> {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
providerRegistered(providerId: string): boolean {
|
providerRegistered(providerId: string): boolean {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
getConnectionProfileById(profileId: string): IConnectionProfile {
|
getConnectionProfileById(profileId: string): IConnectionProfile {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
getProviderProperties(providerName: string): ConnectionProviderProperties {
|
getProviderProperties(providerName: string): ConnectionProviderProperties {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
getConnectionIconId(connectionId: string): string {
|
getConnectionIconId(connectionId: string): string {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultProviderId(): string {
|
getDefaultProviderId(): string {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
|
|
||||||
getConnections(activeConnectionsOnly?: boolean): ConnectionProfile[] {
|
getConnections(activeConnectionsOnly?: boolean): ConnectionProfile[] {
|
||||||
@@ -299,6 +296,6 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
getConnection(uri: string): ConnectionProfile {
|
getConnection(uri: string): ConnectionProfile {
|
||||||
return undefined;
|
return undefined!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,31 +10,31 @@ export class TestConnectionProvider implements azdata.ConnectionProvider {
|
|||||||
public readonly providerId = mssqlProviderName;
|
public readonly providerId = mssqlProviderName;
|
||||||
|
|
||||||
connect(connectionUri: string, connectionInfo: azdata.ConnectionInfo): Thenable<boolean> {
|
connect(connectionUri: string, connectionInfo: azdata.ConnectionInfo): Thenable<boolean> {
|
||||||
return undefined;
|
return Promise.resolve(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnect(connectionUri: string): Thenable<boolean> {
|
disconnect(connectionUri: string): Thenable<boolean> {
|
||||||
return undefined;
|
return Promise.resolve(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelConnect(connectionUri: string): Thenable<boolean> {
|
cancelConnect(connectionUri: string): Thenable<boolean> {
|
||||||
return undefined;
|
return Promise.resolve(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
listDatabases(connectionUri: string): Thenable<azdata.ListDatabasesResult> {
|
listDatabases(connectionUri: string): Thenable<azdata.ListDatabasesResult> {
|
||||||
return undefined;
|
return Promise.resolve({ databaseNames: [] });
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDatabase(connectionUri: string, newDatabase: string): Thenable<boolean> {
|
changeDatabase(connectionUri: string, newDatabase: string): Thenable<boolean> {
|
||||||
return undefined;
|
return Promise.resolve(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
getConnectionString(connectionUri: string): Thenable<string> {
|
getConnectionString(connectionUri: string): Thenable<string> {
|
||||||
return undefined;
|
return Promise.resolve('');
|
||||||
}
|
}
|
||||||
|
|
||||||
rebuildIntelliSenseCache(connectionUri: string): Thenable<void> {
|
rebuildIntelliSenseCache(connectionUri: string): Thenable<void> {
|
||||||
return undefined;
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
registerOnConnectionComplete(handler: (connSummary: azdata.ConnectionInfoSummary) => any) {
|
registerOnConnectionComplete(handler: (connSummary: azdata.ConnectionInfoSummary) => any) {
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ let connectionProfile: IConnectionProfile = {
|
|||||||
groupFullName: 'g2/g2-2',
|
groupFullName: 'g2/g2-2',
|
||||||
groupId: 'group id',
|
groupId: 'group id',
|
||||||
getOptionsKey: () => 'connection1',
|
getOptionsKey: () => 'connection1',
|
||||||
matches: undefined,
|
matches: undefined!,
|
||||||
providerName: mssqlProviderName,
|
providerName: mssqlProviderName,
|
||||||
options: {},
|
options: {},
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: undefined
|
id: undefined!
|
||||||
};
|
};
|
||||||
let editorConnectionProfile: IConnectionProfile = {
|
let editorConnectionProfile: IConnectionProfile = {
|
||||||
connectionName: 'new name',
|
connectionName: 'new name',
|
||||||
@@ -48,11 +48,11 @@ let editorConnectionProfile: IConnectionProfile = {
|
|||||||
groupFullName: 'g2/g2-2',
|
groupFullName: 'g2/g2-2',
|
||||||
groupId: 'group id',
|
groupId: 'group id',
|
||||||
getOptionsKey: () => 'connection2',
|
getOptionsKey: () => 'connection2',
|
||||||
matches: undefined,
|
matches: undefined!,
|
||||||
providerName: mssqlProviderName,
|
providerName: mssqlProviderName,
|
||||||
options: {},
|
options: {},
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: undefined
|
id: undefined!
|
||||||
};
|
};
|
||||||
let connectionProfileWithoutDbName: IConnectionProfile = {
|
let connectionProfileWithoutDbName: IConnectionProfile = {
|
||||||
connectionName: 'new name',
|
connectionName: 'new name',
|
||||||
@@ -65,11 +65,11 @@ let connectionProfileWithoutDbName: IConnectionProfile = {
|
|||||||
groupFullName: 'g2/g2-2',
|
groupFullName: 'g2/g2-2',
|
||||||
groupId: 'group id',
|
groupId: 'group id',
|
||||||
getOptionsKey: () => 'connection1',
|
getOptionsKey: () => 'connection1',
|
||||||
matches: undefined,
|
matches: undefined!,
|
||||||
providerName: mssqlProviderName,
|
providerName: mssqlProviderName,
|
||||||
options: {},
|
options: {},
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: undefined
|
id: undefined!
|
||||||
};
|
};
|
||||||
|
|
||||||
let connection1Id: string;
|
let connection1Id: string;
|
||||||
@@ -101,7 +101,7 @@ suite('SQL ConnectionStatusManager tests', () => {
|
|||||||
test('findConnection should return connection given valid id', () => {
|
test('findConnection should return connection given valid id', () => {
|
||||||
let id: string = connection1Id;
|
let id: string = connection1Id;
|
||||||
let actual = connections.findConnection(id);
|
let actual = connections.findConnection(id);
|
||||||
assert.equal(connectionProfileObject.matches(actual.connectionProfile), true);
|
assert.equal(connectionProfileObject.matches(actual!.connectionProfile), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getConnectionProfile should return undefined given invalid id', () => {
|
test('getConnectionProfile should return undefined given invalid id', () => {
|
||||||
@@ -114,7 +114,7 @@ suite('SQL ConnectionStatusManager tests', () => {
|
|||||||
test('getConnectionProfile should return connection given valid id', () => {
|
test('getConnectionProfile should return connection given valid id', () => {
|
||||||
let id: string = connection1Id;
|
let id: string = connection1Id;
|
||||||
let actual = connections.getConnectionProfile(id);
|
let actual = connections.getConnectionProfile(id);
|
||||||
assert.equal(connectionProfileObject.matches(actual), true);
|
assert.equal(connectionProfileObject.matches(actual!), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('hasConnection should return false given invalid id', () => {
|
test('hasConnection should return false given invalid id', () => {
|
||||||
@@ -136,11 +136,11 @@ suite('SQL ConnectionStatusManager tests', () => {
|
|||||||
let summary: azdata.ConnectionInfoSummary = {
|
let summary: azdata.ConnectionInfoSummary = {
|
||||||
ownerUri: connection1Id,
|
ownerUri: connection1Id,
|
||||||
connectionId: connection1Id,
|
connectionId: connection1Id,
|
||||||
messages: undefined,
|
messages: undefined!,
|
||||||
errorMessage: undefined,
|
errorMessage: undefined!,
|
||||||
errorNumber: undefined,
|
errorNumber: undefined!,
|
||||||
serverInfo: undefined,
|
serverInfo: undefined!,
|
||||||
connectionSummary: undefined
|
connectionSummary: undefined!
|
||||||
};
|
};
|
||||||
connections.onConnectionComplete(summary);
|
connections.onConnectionComplete(summary);
|
||||||
let actual = connections.addConnection(connectionProfile, connection1Id).connecting;
|
let actual = connections.addConnection(connectionProfile, connection1Id).connecting;
|
||||||
@@ -152,14 +152,14 @@ suite('SQL ConnectionStatusManager tests', () => {
|
|||||||
let summary: azdata.ConnectionInfoSummary = {
|
let summary: azdata.ConnectionInfoSummary = {
|
||||||
ownerUri: connection1Id,
|
ownerUri: connection1Id,
|
||||||
connectionId: connection1Id,
|
connectionId: connection1Id,
|
||||||
messages: undefined,
|
messages: undefined!,
|
||||||
errorMessage: undefined,
|
errorMessage: undefined!,
|
||||||
errorNumber: undefined,
|
errorNumber: undefined!,
|
||||||
serverInfo: undefined,
|
serverInfo: undefined!,
|
||||||
connectionSummary: undefined
|
connectionSummary: undefined!
|
||||||
};
|
};
|
||||||
connections.onConnectionComplete(summary);
|
connections.onConnectionComplete(summary);
|
||||||
let actual = connections.findConnection(connection1Id).connecting;
|
let actual = connections.findConnection(connection1Id)!.connecting;
|
||||||
assert.equal(actual, expected);
|
assert.equal(actual, expected);
|
||||||
actual = connections.isConnecting(connection1Id);
|
actual = connections.isConnecting(connection1Id);
|
||||||
assert.equal(actual, expected);
|
assert.equal(actual, expected);
|
||||||
@@ -174,8 +174,8 @@ suite('SQL ConnectionStatusManager tests', () => {
|
|||||||
let actualId = connections.updateConnectionProfile(updatedConnection, connection1Id);
|
let actualId = connections.updateConnectionProfile(updatedConnection, connection1Id);
|
||||||
|
|
||||||
let newId = Utils.generateUri(updatedConnection);
|
let newId = Utils.generateUri(updatedConnection);
|
||||||
let actual = connections.getConnectionProfile(newId).groupId;
|
let actual = connections.getConnectionProfile(newId)!.groupId;
|
||||||
let actualConnectionId = connections.getConnectionProfile(newId).id;
|
let actualConnectionId = connections.getConnectionProfile(newId)!.id;
|
||||||
assert.equal(actual, expected);
|
assert.equal(actual, expected);
|
||||||
assert.equal(actualId, newId);
|
assert.equal(actualId, newId);
|
||||||
assert.equal(actualConnectionId, expectedConnectionId);
|
assert.equal(actualConnectionId, expectedConnectionId);
|
||||||
@@ -186,25 +186,25 @@ suite('SQL ConnectionStatusManager tests', () => {
|
|||||||
let summary: azdata.ConnectionInfoSummary = {
|
let summary: azdata.ConnectionInfoSummary = {
|
||||||
connectionSummary: {
|
connectionSummary: {
|
||||||
databaseName: dbName,
|
databaseName: dbName,
|
||||||
serverName: undefined,
|
serverName: undefined!,
|
||||||
userName: undefined
|
userName: undefined!
|
||||||
}
|
}
|
||||||
, ownerUri: connection3Id,
|
, ownerUri: connection3Id,
|
||||||
connectionId: 'connection id',
|
connectionId: 'connection id',
|
||||||
errorMessage: undefined,
|
errorMessage: undefined!,
|
||||||
errorNumber: undefined,
|
errorNumber: undefined!,
|
||||||
messages: undefined,
|
messages: undefined!,
|
||||||
serverInfo: undefined
|
serverInfo: undefined!
|
||||||
};
|
};
|
||||||
|
|
||||||
//The original connection didn't have database name
|
//The original connection didn't have database name
|
||||||
let connectionStatus = connections.findConnection(connection3Id);
|
let connectionStatus = connections.findConnection(connection3Id);
|
||||||
connectionStatus.connectionProfile.databaseName = '';
|
connectionStatus!.connectionProfile.databaseName = '';
|
||||||
|
|
||||||
//Verify database name changed after connection is complete
|
//Verify database name changed after connection is complete
|
||||||
connections.updateDatabaseName(summary);
|
connections.updateDatabaseName(summary);
|
||||||
connectionStatus = connections.findConnection(connection3Id);
|
connectionStatus = connections.findConnection(connection3Id);
|
||||||
assert.equal(connectionStatus.connectionProfile.databaseName, dbName);
|
assert.equal(connectionStatus!.connectionProfile.databaseName, dbName);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getOriginalOwnerUri should return the original uri given uri with db name', () => {
|
test('getOriginalOwnerUri should return the original uri given uri with db name', () => {
|
||||||
@@ -212,24 +212,24 @@ suite('SQL ConnectionStatusManager tests', () => {
|
|||||||
let summary: azdata.ConnectionInfoSummary = {
|
let summary: azdata.ConnectionInfoSummary = {
|
||||||
connectionSummary: {
|
connectionSummary: {
|
||||||
databaseName: dbName,
|
databaseName: dbName,
|
||||||
serverName: undefined,
|
serverName: undefined!,
|
||||||
userName: undefined
|
userName: undefined!
|
||||||
}
|
}
|
||||||
, ownerUri: connection3Id,
|
, ownerUri: connection3Id,
|
||||||
connectionId: 'connection id',
|
connectionId: 'connection id',
|
||||||
errorMessage: undefined,
|
errorMessage: undefined!,
|
||||||
errorNumber: undefined,
|
errorNumber: undefined!,
|
||||||
messages: undefined,
|
messages: undefined!,
|
||||||
serverInfo: undefined
|
serverInfo: undefined!
|
||||||
};
|
};
|
||||||
|
|
||||||
//The original connection didn't have database name
|
//The original connection didn't have database name
|
||||||
let connectionStatus = connections.findConnection(connection3Id);
|
let connectionStatus = connections.findConnection(connection3Id)!;
|
||||||
connectionStatus.connectionProfile.databaseName = '';
|
connectionStatus.connectionProfile.databaseName = '';
|
||||||
|
|
||||||
//Verify database name changed after connection is complete
|
//Verify database name changed after connection is complete
|
||||||
connections.updateDatabaseName(summary);
|
connections.updateDatabaseName(summary);
|
||||||
connectionStatus = connections.findConnection(connection3Id);
|
connectionStatus = connections.findConnection(connection3Id)!;
|
||||||
let ownerUriWithDbName = Utils.generateUriWithPrefix(connectionStatus.connectionProfile, 'connection:');
|
let ownerUriWithDbName = Utils.generateUriWithPrefix(connectionStatus.connectionProfile, 'connection:');
|
||||||
|
|
||||||
//The uri assigned to connection without db name should be the original one
|
//The uri assigned to connection without db name should be the original one
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export class CredentialsService implements ICredentialsService {
|
|||||||
|
|
||||||
private _serverEvents: { [handle: number]: CredentialManagementEvents; } = Object.create(null);
|
private _serverEvents: { [handle: number]: CredentialManagementEvents; } = Object.create(null);
|
||||||
|
|
||||||
private _lastHandle: number;
|
private _lastHandle?: number;
|
||||||
|
|
||||||
private _onServerEventsReady: Deferred<void> = new Deferred<void>();
|
private _onServerEventsReady: Deferred<void> = new Deferred<void>();
|
||||||
|
|
||||||
@@ -59,14 +59,14 @@ export class CredentialsService implements ICredentialsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public saveCredential(credentialId: string, password: string): Promise<boolean> {
|
public saveCredential(credentialId: string, password: string): Promise<boolean> {
|
||||||
return this._onServerEventsReady.promise.then(() => this._serverEvents[this._lastHandle].onSaveCredential(credentialId, password));
|
return this._onServerEventsReady.promise.then(() => this._serverEvents[this._lastHandle!].onSaveCredential(credentialId, password));
|
||||||
}
|
}
|
||||||
|
|
||||||
public readCredential(credentialId: string): Promise<azdata.Credential> {
|
public readCredential(credentialId: string): Promise<azdata.Credential> {
|
||||||
return this._onServerEventsReady.promise.then(() => this._serverEvents[this._lastHandle].onReadCredential(credentialId));
|
return this._onServerEventsReady.promise.then(() => this._serverEvents[this._lastHandle!].onReadCredential(credentialId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteCredential(credentialId: string): Promise<boolean> {
|
public deleteCredential(credentialId: string): Promise<boolean> {
|
||||||
return this._onServerEventsReady.promise.then(() => this._serverEvents[this._lastHandle].onDeleteCredential(credentialId));
|
return this._onServerEventsReady.promise.then(() => this._serverEvents[this._lastHandle!].onDeleteCredential(credentialId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export class TestCredentialsService implements ICredentialsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class TestCredentialsProvider implements CredentialProvider {
|
export class TestCredentialsProvider implements CredentialProvider {
|
||||||
handle: number;
|
handle: number = 0;
|
||||||
|
|
||||||
public storedCredentials: { [K: string]: Credential } = {};
|
public storedCredentials: { [K: string]: Credential } = {};
|
||||||
|
|
||||||
|
|||||||
@@ -13,15 +13,15 @@ export const SERVICE_ID = 'dashboardViewService';
|
|||||||
export interface IDashboardWebview extends IView {
|
export interface IDashboardWebview extends IView {
|
||||||
setHtml(html: string): void;
|
setHtml(html: string): void;
|
||||||
onMessage: Event<string>;
|
onMessage: Event<string>;
|
||||||
sendMessage(message: string);
|
sendMessage(message: string): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDashboardViewService {
|
export interface IDashboardViewService {
|
||||||
_serviceBrand: undefined;
|
_serviceBrand: undefined;
|
||||||
onRegisteredWebview: Event<IDashboardWebview>;
|
onRegisteredWebview: Event<IDashboardWebview>;
|
||||||
registerWebview(widget: IDashboardWebview);
|
registerWebview(widget: IDashboardWebview): void;
|
||||||
onRegisteredModelView: Event<IModelView>;
|
onRegisteredModelView: Event<IModelView>;
|
||||||
registerModelView(widget: IModelView);
|
registerModelView(widget: IModelView): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const IDashboardViewService = createDecorator<IDashboardViewService>(SERVICE_ID);
|
export const IDashboardViewService = createDecorator<IDashboardViewService>(SERVICE_ID);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class InsightRegistry implements IInsightRegistry {
|
|||||||
* @param schema config schema of the widget
|
* @param schema config schema of the widget
|
||||||
*/
|
*/
|
||||||
public registerInsight(id: string, description: string, schema: IJSONSchema, ctor: Type<IInsightsView>): InsightIdentifier {
|
public registerInsight(id: string, description: string, schema: IJSONSchema, ctor: Type<IInsightsView>): InsightIdentifier {
|
||||||
this._insightSchema.properties[id] = schema;
|
this._insightSchema.properties![id] = schema;
|
||||||
this._idToCtor[id] = ctor;
|
this._idToCtor[id] = ctor;
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export const Extensions = {
|
|||||||
export interface IComponentRegistry {
|
export interface IComponentRegistry {
|
||||||
registerComponentType(id: string, typeMapping: ModelComponentTypes, ctor: Type<IComponent>): ComponentIdentifier;
|
registerComponentType(id: string, typeMapping: ModelComponentTypes, ctor: Type<IComponent>): ComponentIdentifier;
|
||||||
getIdForTypeMapping(typeMapping: ModelComponentTypes): string;
|
getIdForTypeMapping(typeMapping: ModelComponentTypes): string;
|
||||||
getCtorForType(typeMapping: ModelComponentTypes): Type<IComponent>;
|
getCtorForType(typeMapping: ModelComponentTypes): Type<IComponent> | undefined;
|
||||||
getCtorFromId(id: string): Type<IComponent>;
|
getCtorFromId(id: string): Type<IComponent>;
|
||||||
getAllCtors(): Array<Type<IComponent>>;
|
getAllCtors(): Array<Type<IComponent>>;
|
||||||
getAllIds(): Array<string>;
|
getAllIds(): Array<string>;
|
||||||
@@ -38,7 +38,7 @@ class ComponentRegistry implements IComponentRegistry {
|
|||||||
return this._typeNameToId[ModelComponentTypes[typeMapping]];
|
return this._typeNameToId[ModelComponentTypes[typeMapping]];
|
||||||
}
|
}
|
||||||
|
|
||||||
public getCtorForType(typeMapping: ModelComponentTypes): Type<IComponent> {
|
public getCtorForType(typeMapping: ModelComponentTypes): Type<IComponent> | undefined {
|
||||||
let id = this.getIdForTypeMapping(typeMapping);
|
let id = this.getIdForTypeMapping(typeMapping);
|
||||||
return id ? this._idToCtor[id] : undefined;
|
return id ? this._idToCtor[id] : undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,14 +55,14 @@ class DashboardWidgetRegistry implements IDashboardWidgetRegistry {
|
|||||||
this._allSchema.extensionProperties[id] = schema;
|
this._allSchema.extensionProperties[id] = schema;
|
||||||
} else {
|
} else {
|
||||||
if (context === undefined || context === 'database') {
|
if (context === undefined || context === 'database') {
|
||||||
this._dashboardWidgetSchema.properties[id] = schema;
|
this._dashboardWidgetSchema.properties![id] = schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context === undefined || context === 'server') {
|
if (context === undefined || context === 'server') {
|
||||||
this._serverWidgetSchema.properties[id] = schema;
|
this._serverWidgetSchema.properties![id] = schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._allSchema.properties[id] = schema;
|
this._allSchema.properties![id] = schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
@@ -77,11 +77,11 @@ class DashboardWidgetRegistry implements IDashboardWidgetRegistry {
|
|||||||
*/
|
*/
|
||||||
public registerNonCustomDashboardWidget(id: string, description: string, val: IInsightsConfig, context?: 'database' | 'server'): WidgetIdentifier {
|
public registerNonCustomDashboardWidget(id: string, description: string, val: IInsightsConfig, context?: 'database' | 'server'): WidgetIdentifier {
|
||||||
if (context === undefined || context === 'database') {
|
if (context === undefined || context === 'database') {
|
||||||
this._dashboardWidgetSchema.properties[id] = { type: 'null', default: null };
|
this._dashboardWidgetSchema.properties![id] = { type: 'null', default: null };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context === undefined || context === 'server') {
|
if (context === undefined || context === 'server') {
|
||||||
this._serverWidgetSchema.properties[id] = { type: 'null', default: null };
|
this._serverWidgetSchema.properties![id] = { type: 'null', default: null };
|
||||||
}
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ export const TaskRegistry: ITaskRegistry = new class implements ITaskRegistry {
|
|||||||
export abstract class Task {
|
export abstract class Task {
|
||||||
public readonly id: string;
|
public readonly id: string;
|
||||||
public readonly title: string;
|
public readonly title: string;
|
||||||
public readonly iconPathDark: string;
|
|
||||||
public readonly iconPath?: { dark: URI; light?: URI; };
|
public readonly iconPath?: { dark: URI; light?: URI; };
|
||||||
private readonly _iconClass?: string;
|
private readonly _iconClass?: string;
|
||||||
private readonly _description?: ITaskHandlerDescription;
|
private readonly _description?: ITaskHandlerDescription;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export class TaskNode {
|
|||||||
/**
|
/**
|
||||||
* Provider Name
|
* Provider Name
|
||||||
*/
|
*/
|
||||||
public providerName: string;
|
public providerName?: string;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +57,7 @@ export class TaskNode {
|
|||||||
/**
|
/**
|
||||||
* The end time of the task
|
* The end time of the task
|
||||||
*/
|
*/
|
||||||
public endTime: string;
|
public endTime?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The timer for the task
|
* The timer for the task
|
||||||
@@ -72,12 +72,12 @@ export class TaskNode {
|
|||||||
/**
|
/**
|
||||||
* Children of this node
|
* Children of this node
|
||||||
*/
|
*/
|
||||||
public children: TaskNode[];
|
public children?: TaskNode[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Task's message
|
* Task's message
|
||||||
*/
|
*/
|
||||||
public message: string;
|
public message?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Status of the task
|
* Status of the task
|
||||||
@@ -97,7 +97,7 @@ export class TaskNode {
|
|||||||
/**
|
/**
|
||||||
* Script of task operation
|
* Script of task operation
|
||||||
*/
|
*/
|
||||||
public script: string;
|
public script?: string;
|
||||||
|
|
||||||
constructor(taskName: string, serverName?: string, databaseName?: string, taskId: string | undefined = undefined, taskExecutionMode: TaskExecutionMode = TaskExecutionMode.execute, isCancelable: boolean = true) {
|
constructor(taskName: string, serverName?: string, databaseName?: string, taskId: string | undefined = undefined, taskExecutionMode: TaskExecutionMode = TaskExecutionMode.execute, isCancelable: boolean = true) {
|
||||||
this.id = taskId || generateUuid();
|
this.id = taskId || generateUuid();
|
||||||
|
|||||||
@@ -127,9 +127,9 @@ export class TaskService implements ITaskService {
|
|||||||
|
|
||||||
private cancelAllTasks(): Thenable<void> {
|
private cancelAllTasks(): Thenable<void> {
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
let promises = this._taskQueue.children.map(task => {
|
let promises = this._taskQueue.children!.map(task => {
|
||||||
if (task.status === TaskStatus.InProgress || task.status === TaskStatus.NotStarted) {
|
if (task.status === TaskStatus.InProgress || task.status === TaskStatus.NotStarted) {
|
||||||
return this.cancelTask(task.providerName, task.id);
|
return this.cancelTask(task.providerName!, task.id);
|
||||||
}
|
}
|
||||||
return Promise.resolve(true);
|
return Promise.resolve(true);
|
||||||
});
|
});
|
||||||
@@ -144,7 +144,7 @@ export class TaskService implements ITaskService {
|
|||||||
|
|
||||||
public handleNewTask(task: TaskNode): void {
|
public handleNewTask(task: TaskNode): void {
|
||||||
if (this._taskQueue.hasChildren) {
|
if (this._taskQueue.hasChildren) {
|
||||||
this._taskQueue.children.unshift(task);
|
this._taskQueue.children!.unshift(task);
|
||||||
} else {
|
} else {
|
||||||
this._taskQueue.hasChildren = true;
|
this._taskQueue.hasChildren = true;
|
||||||
this._taskQueue.children = [task];
|
this._taskQueue.children = [task];
|
||||||
@@ -227,7 +227,7 @@ export class TaskService implements ITaskService {
|
|||||||
|
|
||||||
private getTaskInQueue(taskId: string): TaskNode | undefined {
|
private getTaskInQueue(taskId: string): TaskNode | undefined {
|
||||||
if (this._taskQueue.hasChildren) {
|
if (this._taskQueue.hasChildren) {
|
||||||
return find(this._taskQueue.children, x => x.id === taskId);
|
return find(this._taskQueue.children!, x => x.id === taskId);
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@@ -242,7 +242,7 @@ export class TaskService implements ITaskService {
|
|||||||
|
|
||||||
public getNumberOfInProgressTasks(): number {
|
public getNumberOfInProgressTasks(): number {
|
||||||
if (this._taskQueue.hasChildren) {
|
if (this._taskQueue.hasChildren) {
|
||||||
let inProgressTasks = this._taskQueue.children.filter(x => x.status === TaskStatus.InProgress);
|
let inProgressTasks = this._taskQueue.children!.filter(x => x.status === TaskStatus.InProgress);
|
||||||
return inProgressTasks ? inProgressTasks.length : 0;
|
return inProgressTasks ? inProgressTasks.length : 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -398,8 +398,8 @@ export enum AzureResource {
|
|||||||
|
|
||||||
export class TreeItem extends vsExtTypes.TreeItem {
|
export class TreeItem extends vsExtTypes.TreeItem {
|
||||||
label?: string;
|
label?: string;
|
||||||
payload: IConnectionProfile;
|
payload?: IConnectionProfile;
|
||||||
providerHandle: string;
|
providerHandle?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ServerInfoOption {
|
export interface ServerInfoOption {
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ export interface IInsight {
|
|||||||
options: IInsightOptions;
|
options: IInsightOptions;
|
||||||
data: IInsightData;
|
data: IInsightData;
|
||||||
readonly types: Array<InsightType | ChartType>;
|
readonly types: Array<InsightType | ChartType>;
|
||||||
layout(dim: Dimension);
|
layout(dim: Dimension): void;
|
||||||
dispose();
|
dispose(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IInsightCtor {
|
export interface IInsightCtor {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
export class ChartState {
|
export class ChartState {
|
||||||
dataId: { batchId: number, resultId: number };
|
dataId?: { batchId: number, resultId: number };
|
||||||
options: IInsightOptions = {
|
options: IInsightOptions = {
|
||||||
type: ChartType.Bar
|
type: ChartType.Bar
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-5
@@ -11,7 +11,6 @@ import { WidgetConfig } from 'sql/workbench/contrib/dashboard/browser/core/dashb
|
|||||||
import { DashboardServiceInterface } from 'sql/workbench/contrib/dashboard/browser/services/dashboardServiceInterface.service';
|
import { DashboardServiceInterface } from 'sql/workbench/contrib/dashboard/browser/services/dashboardServiceInterface.service';
|
||||||
import { SingleAdminService, SingleConnectionManagementService } from 'sql/workbench/services/bootstrap/browser/commonServiceInterface.service';
|
import { SingleAdminService, SingleConnectionManagementService } from 'sql/workbench/services/bootstrap/browser/commonServiceInterface.service';
|
||||||
import { PropertiesWidgetComponent } from 'sql/workbench/contrib/dashboard/browser/widgets/properties/propertiesWidget.component';
|
import { PropertiesWidgetComponent } from 'sql/workbench/contrib/dashboard/browser/widgets/properties/propertiesWidget.component';
|
||||||
import { ConnectionManagementInfo } from 'sql/platform/connection/common/connectionManagementInfo';
|
|
||||||
|
|
||||||
import * as TypeMoq from 'typemoq';
|
import * as TypeMoq from 'typemoq';
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
@@ -88,11 +87,8 @@ suite('Dashboard Properties Widget Tests', () => {
|
|||||||
|
|
||||||
dashboardService.setup(x => x.adminService).returns(() => singleAdminService.object);
|
dashboardService.setup(x => x.adminService).returns(() => singleAdminService.object);
|
||||||
|
|
||||||
let connectionManagementinfo = TypeMoq.Mock.ofType(ConnectionManagementInfo);
|
|
||||||
connectionManagementinfo.object.serverInfo = serverInfo;
|
|
||||||
|
|
||||||
let singleConnectionService = TypeMoq.Mock.ofType(SingleConnectionManagementService);
|
let singleConnectionService = TypeMoq.Mock.ofType(SingleConnectionManagementService);
|
||||||
singleConnectionService.setup(x => x.connectionInfo).returns(() => connectionManagementinfo.object);
|
singleConnectionService.setup(x => x.connectionInfo).returns(() => ({ serverInfo, providerId: undefined, connectionProfile: undefined, extensionTimer: undefined, serviceTimer: undefined, intelliSenseTimer: undefined, connecting: undefined, ownerUri: undefined }));
|
||||||
|
|
||||||
dashboardService.setup(x => x.connectionManagementService).returns(() => singleConnectionService.object);
|
dashboardService.setup(x => x.connectionManagementService).returns(() => singleConnectionService.object);
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ suite('SQL Connection Tree Action tests', () => {
|
|||||||
connectionManagementService.callBase = true;
|
connectionManagementService.callBase = true;
|
||||||
connectionManagementService.setup(x => x.isConnected(undefined, TypeMoq.It.isAny())).returns(() => isConnectedReturnValue);
|
connectionManagementService.setup(x => x.isConnected(undefined, TypeMoq.It.isAny())).returns(() => isConnectedReturnValue);
|
||||||
connectionManagementService.setup(x => x.connect(TypeMoq.It.isAny(), undefined, TypeMoq.It.isAny(), undefined)).returns(() => Promise.resolve(connectionResult));
|
connectionManagementService.setup(x => x.connect(TypeMoq.It.isAny(), undefined, TypeMoq.It.isAny(), undefined)).returns(() => Promise.resolve(connectionResult));
|
||||||
connectionManagementService.setup(x => x.disconnect(TypeMoq.It.isAny())).returns(() => Promise.resolve(true));
|
connectionManagementService.setup(x => x.disconnect(TypeMoq.It.isAny())).returns(() => Promise.resolve());
|
||||||
connectionManagementService.setup(x => x.findExistingConnection(TypeMoq.It.isAny())).returns(() => undefined);
|
connectionManagementService.setup(x => x.findExistingConnection(TypeMoq.It.isAny())).returns(() => undefined);
|
||||||
connectionManagementService.setup(x => x.showDashboard(TypeMoq.It.isAny())).returns(() => Promise.resolve(true));
|
connectionManagementService.setup(x => x.showDashboard(TypeMoq.It.isAny())).returns(() => Promise.resolve(true));
|
||||||
connectionManagementService.setup(x => x.isProfileConnected(TypeMoq.It.isAny())).returns(() => isConnectedReturnValue);
|
connectionManagementService.setup(x => x.isProfileConnected(TypeMoq.It.isAny())).returns(() => isConnectedReturnValue);
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import { FileNode } from 'sql/workbench/services/fileBrowser/common/fileNode';
|
|||||||
/**
|
/**
|
||||||
* File tree info needed to render initially
|
* File tree info needed to render initially
|
||||||
*/
|
*/
|
||||||
export class FileBrowserTree {
|
export interface FileBrowserTree {
|
||||||
public rootNode: FileNode;
|
rootNode: FileNode;
|
||||||
public selectedNode?: FileNode;
|
selectedNode?: FileNode;
|
||||||
public expandedNodes: FileNode[];
|
expandedNodes: FileNode[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export class FileNode {
|
|||||||
/**
|
/**
|
||||||
* Children nodes
|
* Children nodes
|
||||||
*/
|
*/
|
||||||
public children: FileNode[];
|
public children?: FileNode[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the node expanded
|
* Is the node expanded
|
||||||
@@ -53,7 +53,7 @@ export class FileNode {
|
|||||||
/**
|
/**
|
||||||
* Does this node have children
|
* Does this node have children
|
||||||
*/
|
*/
|
||||||
public hasChildren: boolean;
|
public hasChildren?: boolean;
|
||||||
|
|
||||||
constructor(id: string, name: string, fullPath: string, isFile: boolean, isExpanded: boolean, ownerUri: string, parent?: FileNode) {
|
constructor(id: string, name: string, fullPath: string, isFile: boolean, isExpanded: boolean, ownerUri: string, parent?: FileNode) {
|
||||||
if (id) {
|
if (id) {
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "./tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"noEmit": true,
|
|
||||||
"strictNullChecks": true,
|
|
||||||
"noImplicitAny": true,
|
|
||||||
"suppressImplicitAnyIndexErrors": true,
|
|
||||||
"skipLibCheck": true
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"./typings",
|
|
||||||
"./vs/vscode.d.ts",
|
|
||||||
"./vs/vscode.proposed.d.ts",
|
|
||||||
"./sql/azdata.d.ts",
|
|
||||||
"./sql/azdata.proposed.d.ts",
|
|
||||||
"./vs/base/**/*.ts",
|
|
||||||
// "./vs/platform/**/*.ts",
|
|
||||||
"./sql/base/**/*.ts",
|
|
||||||
"./sql/editor/**/*.ts",
|
|
||||||
"./sql/platform/accounts/common/**/*.ts",
|
|
||||||
"./sql/platform/angularEventing/**/*.ts",
|
|
||||||
"./sql/platform/backup/**/*.ts",
|
|
||||||
"./sql/platform/browser/**/*.ts",
|
|
||||||
"./sql/platform/capabilities/**/*.ts",
|
|
||||||
"./sql/platform/clipboard/**/*.ts",
|
|
||||||
"./sql/platform/common/**/*.ts",
|
|
||||||
"./sql/platform/connection/common/**/*.ts",
|
|
||||||
"./sql/platform/credentials/**/*.ts",
|
|
||||||
"./sql/platform/errorMessage/**/*.ts",
|
|
||||||
"./sql/platform/fileBrowser/**/*.ts",
|
|
||||||
"./sql/platform/metadata/**/*.ts",
|
|
||||||
"./sql/platform/model/**/*.ts",
|
|
||||||
"./sql/platform/modelComponents/**/*.ts",
|
|
||||||
"./sql/platform/notebooks/**/*.ts",
|
|
||||||
"./sql/platform/oAuth/**/*.ts",
|
|
||||||
"./sql/platform/query/common/gridDataProvider.ts",
|
|
||||||
"./sql/platform/scripting/**/*.ts",
|
|
||||||
"./sql/platform/serialization/**/*.ts",
|
|
||||||
"./sql/platform/serverGroup/**/*.ts",
|
|
||||||
"./sql/platform/tasks/**/*.ts",
|
|
||||||
"./sql/platform/telemetry/**/*.ts",
|
|
||||||
"./sql/platform/theme/**/*.ts"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"noEmit": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"alwaysStrict": true,
|
||||||
|
"strictBindCallApply": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"strictPropertyInitialization": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"skipLibCheck": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"./typings",
|
||||||
|
"./vs/vscode.d.ts",
|
||||||
|
"./vs/vscode.proposed.d.ts",
|
||||||
|
"./vs/monaco.d.ts",
|
||||||
|
"./sql/azdata.d.ts",
|
||||||
|
"./sql/azdata.proposed.d.ts",
|
||||||
|
"./vs/base/**/*.ts",
|
||||||
|
// "./vs/code/**/*.ts",
|
||||||
|
"./vs/editor/**/*.ts",
|
||||||
|
// "./vs/platform/**/*.ts",
|
||||||
|
"./sql/base/**/*.ts",
|
||||||
|
"./sql/editor/**/*.ts",
|
||||||
|
"./sql/platform/**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"./sql/platform/jobManagement/**/*.ts",
|
||||||
|
"./sql/platform/query/**/*.ts",
|
||||||
|
"./sql/platform/queryHistory/**/*.ts",
|
||||||
|
"./sql/platform/restore/**/*.ts",
|
||||||
|
]
|
||||||
|
}
|
||||||
Vendored
+6
-7
@@ -351,7 +351,7 @@ declare namespace Slick {
|
|||||||
* @static
|
* @static
|
||||||
* @constructor
|
* @constructor
|
||||||
**/
|
**/
|
||||||
export var GlobalEditorLock: EditorLock<Slick.SlickData>;
|
export let GlobalEditorLock: EditorLock<Slick.SlickData>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* slick.grid.js
|
* slick.grid.js
|
||||||
@@ -699,8 +699,7 @@ declare namespace Slick {
|
|||||||
getItems(): Array<T>;
|
getItems(): Array<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SlickData extends Object {
|
export type SlickData = { [key: string]: any };
|
||||||
}
|
|
||||||
|
|
||||||
export interface RowMetadata<T> {
|
export interface RowMetadata<T> {
|
||||||
/**
|
/**
|
||||||
@@ -1553,10 +1552,10 @@ declare namespace Slick {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export module Formatters {
|
export module Formatters {
|
||||||
var PercentComplete: Formatter<Slick.SlickData>;
|
let PercentComplete: Formatter<Slick.SlickData>;
|
||||||
var PercentCompleteBar: Formatter<Slick.SlickData>;
|
let PercentCompleteBar: Formatter<Slick.SlickData>;
|
||||||
var YesNo: Formatter<Slick.SlickData>;
|
let YesNo: Formatter<Slick.SlickData>;
|
||||||
var Checkmark: Formatter<Slick.SlickData>;
|
let Checkmark: Formatter<Slick.SlickData>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export module Data {
|
export module Data {
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export class InputBox extends Widget {
|
|||||||
private scrollableElement: ScrollableElement | undefined;
|
private scrollableElement: ScrollableElement | undefined;
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}} - Add showValidationMessage and set inputBackground, inputForeground, and inputBorder as protected
|
// {{SQL CARBON EDIT}} - Add showValidationMessage and set inputBackground, inputForeground, and inputBorder as protected
|
||||||
protected showValidationMessage: boolean;
|
protected showValidationMessage?: boolean;
|
||||||
protected inputBackground?: Color;
|
protected inputBackground?: Color;
|
||||||
protected inputForeground?: Color;
|
protected inputForeground?: Color;
|
||||||
protected inputBorder?: Color;
|
protected inputBorder?: Color;
|
||||||
|
|||||||
Reference in New Issue
Block a user