Fixing the layering in the base folder (#5308)

* removes more builder references

* remove builder from profiler

* formatting

* fix profiler dailog

* remove builder from oatuhdialog

* remove the rest of builder references

* formatting

* add more strict null checks to base

* enable strict tslint rules

* code layering of base

* wip

* working through changes to table data view

* fix tests

* update editabledropdown to not use layout service

* wip

* fix imports

* fix import

* fix compile error

* add more localization

* add comments to changes to import patterns

* add more import comments
This commit is contained in:
Anthony Dresser
2019-05-03 14:49:18 -07:00
committed by GitHub
parent 354ed22706
commit db387eb770
61 changed files with 198 additions and 112 deletions

View File

@@ -0,0 +1,58 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/breadcrumb';
import { Component, Inject, forwardRef, OnInit, OnDestroy, ChangeDetectorRef } from '@angular/core';
import { Router } from '@angular/router';
import { toDisposableSubscription } from 'sql/base/node/rxjsUtils';
import { IBreadcrumbService, MenuItem } from './interfaces';
import { IDisposable } from 'vs/base/common/lifecycle';
@Component({
selector: 'breadcrumb',
template: `
<span style="display: flex; flex-flow: row; align-items: center; margin: 10px">
<ng-template ngFor let-item let-first="first" let-last="last" [ngForOf]="menuItems">
<span style="padding: 5px; display: flex; align-items: center">
<span *ngIf="item.icon" class="icon" style="display: inline-block; margin-right: 5px" [ngClass]="item.icon"></span>
<span *ngIf="first">{{item.label}}</span>
<span *ngIf="last" style="">{{item.label}}</span>
<a class="router-link" *ngIf="!last && !first" (click)="route(item.routerLink)" >{{item.label}}</a>
</span>
<span *ngIf="!last" class="icon chevron-right"></span>
</ng-template>
</span>
`
})
export class BreadcrumbComponent implements OnInit, OnDestroy {
protected menuItems: MenuItem[] = []; // used by angular template
private disposables: Array<IDisposable> = new Array();
constructor(
@Inject(forwardRef(() => IBreadcrumbService)) private _breadcrumbService: IBreadcrumbService,
@Inject(forwardRef(() => Router)) private _router: Router,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef
) { }
ngOnInit() {
this.disposables.push(toDisposableSubscription(this._breadcrumbService.breadcrumbItem.subscribe((item) => this.updateCrumb(item))));
}
ngOnDestroy() {
this.disposables.forEach(item => item.dispose());
}
private updateCrumb(items: MenuItem[]) {
this.menuItems = items;
this._changeRef.detectChanges();
}
public route(link: any[]): void {
this._router.navigate(link);
}
}

View File

@@ -0,0 +1,29 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { InjectionToken, EventEmitter } from '@angular/core';
import { Subject } from 'rxjs/Subject';
export const IBreadcrumbService = new InjectionToken<IBreadcrumbService>('breadcrumbService');
export interface IBreadcrumbService {
breadcrumbItem: Subject<MenuItem[]>;
setBreadcrumbs(page: any): void;
}
export interface MenuItem {
label?: string;
icon?: string;
command?: (event?: any) => void;
url?: string;
routerLink?: any[];
eventEmitter?: EventEmitter<any>;
items?: MenuItem[];
expanded?: boolean;
disabled?: boolean;
visible?: boolean;
target?: string;
routerLinkActiveOptions?: any;
}

View File

@@ -0,0 +1,32 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.vs .chevron-right.icon {
background-image: url("chevron_right.svg");
}
.vs-dark .chevron-right.icon,
.hc-black .chevron-right.icon {
background-image: url("chevron_right_inverse.svg");
}
breadcrumb .icon {
background-size: 16px;
background-position: 50% 50%;
background-repeat: no-repeat;
padding: 8px;
}
breadcrumb .chevron-right.icon {
background-size: 16px;
background-position: 50% 50%;
background-repeat: no-repeat;
padding: 8px;
}
breadcrumb .router-link {
cursor: pointer;
}

View File

@@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.cls-1{fill:#231f20;}</style></defs><title>chevron_right</title><polygon class="cls-1" points="13.59 2.21 13.58 2.22 13.58 2.2 13.59 2.21"/><path d="M10.54,8l-7-7,1-1,8,8-8,8-1-1Z"/></svg>

After

Width:  |  Height:  |  Size: 294 B

View File

@@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.cls-1{fill:#fff;}</style></defs><title>chevron_right_inverse</title><path class="cls-1" d="M10.38,8l-7-7,1-1,8,8-8,8-1-1Z"/></svg>

After

Width:  |  Height:  |  Size: 237 B