-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
683 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Url } from 'app/shared/Utilities/url'; | ||
|
||
export enum LogLevel { | ||
error, | ||
warning, | ||
debug, | ||
verbose | ||
} | ||
|
||
export type LogLevelString = 'error' | 'warning' | 'debug' | 'verbose'; | ||
|
||
@Injectable() | ||
export class MockLogService { | ||
|
||
private _logLevel: LogLevel; | ||
private _categories: string[]; | ||
|
||
constructor() { | ||
const levelStr = Url.getParameterByName(null, 'appsvc.log.level'); | ||
|
||
if (levelStr) { | ||
try { | ||
this._logLevel = LogLevel[levelStr]; | ||
} catch (e) { | ||
this._logLevel = LogLevel.warning; | ||
} | ||
} else { | ||
this._logLevel = LogLevel.warning; | ||
} | ||
|
||
this._categories = Url.getParameterArrayByName(null, 'appsvc.log.category'); | ||
} | ||
|
||
public error(category: string, id: string, data: any) { | ||
if (!category || !id || !data) { | ||
throw Error('You must provide a category, id, and data'); | ||
} | ||
if (this._shouldLog(category, LogLevel.error)) { | ||
console.error(`[${category}] - ${data}`); | ||
} | ||
} | ||
|
||
public warn(category: string, id: string, data: any) { | ||
if (!category || !id || !data) { | ||
throw Error('You must provide a category, id, and data'); | ||
} | ||
|
||
if (this._shouldLog(category, LogLevel.warning)) { | ||
console.log(`%c[${category}] - ${data}`, 'color: #ff8c00'); | ||
} | ||
} | ||
|
||
public debug(category: string, data: any) { | ||
if (!category || !data) { | ||
throw Error('You must provide a category and data'); | ||
} | ||
|
||
if (this._shouldLog(category, LogLevel.debug)) { | ||
console.log(`${this._getTime()} %c[${category}] - ${data}`, 'color: #0058ad'); | ||
} | ||
} | ||
|
||
public verbose(category: string, data: any) { | ||
if (!category || !data) { | ||
throw Error('You must provide a category and data'); | ||
} | ||
|
||
if (this._shouldLog(category, LogLevel.verbose)) { | ||
console.log(`${this._getTime()} [${category}] - ${data}`); | ||
} | ||
} | ||
|
||
public log(level: LogLevel, category: string, data: any, id?: string) { | ||
if (!id && (level === LogLevel.error || level === LogLevel.warning)) { | ||
throw Error('Error and Warning log levels require an id'); | ||
} | ||
|
||
if (level === LogLevel.error) { | ||
this.error(category, id, data); | ||
} else if (level === LogLevel.warning) { | ||
this.warn(category, id, data); | ||
} else if (level === LogLevel.debug) { | ||
this.debug(category, data); | ||
} else { | ||
this.verbose(category, data); | ||
} | ||
} | ||
|
||
private _shouldLog(category: string, logLevel: LogLevel) { | ||
|
||
if (logLevel <= this._logLevel) { | ||
if (logLevel === LogLevel.error || logLevel === LogLevel.warning) { | ||
return true; | ||
} else if (this._categories.length > 0 && this._categories.find(c => c.toLowerCase() === category.toLowerCase())) { | ||
return true; | ||
} else if (this._categories.length === 0) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
private _getTime() { | ||
const now = new Date(); | ||
return now.toISOString(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
client/src/app/site/deployment-center/Models/ProviderCard.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { sourceControlProvider } from '../deployment-center-setup/wizard-logic/deployment-center-setup-models'; | ||
|
||
export interface ProviderCard { | ||
id: sourceControlProvider; | ||
name: string; | ||
icon: string; | ||
color: string; | ||
barColor: string; | ||
description: string; | ||
authorizedStatus: 'loadingAuth' | 'notAuthorized' | 'authorized' | 'none'; | ||
authenticatedId?: string; | ||
manual?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ent-center/deployment-center-setup/step-build-provider/step-build-provider.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...-center/deployment-center-setup/step-build-provider/step-build-provider.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { StepBuildProviderComponent } from './step-build-provider.component'; | ||
import { ComponentFixture, fakeAsync, TestBed, async, tick } from '@angular/core/testing'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { DeploymentCenterStateManager } from '../wizard-logic/deployment-center-state-manager'; | ||
import 'rxjs/add/operator/catch'; | ||
import 'rxjs/add/operator/debounceTime'; | ||
import 'rxjs/add/operator/distinctUntilChanged'; | ||
import 'rxjs/add/operator/do'; | ||
import 'rxjs/add/operator/filter'; | ||
import 'rxjs/add/operator/first'; | ||
import 'rxjs/add/observable/forkJoin'; | ||
import 'rxjs/add/operator/map'; | ||
import 'rxjs/add/operator/merge'; | ||
import 'rxjs/add/operator/mergeMap'; | ||
import 'rxjs/add/observable/of'; | ||
import 'rxjs/add/operator/retry'; | ||
import 'rxjs/add/operator/switchMap'; | ||
import 'rxjs/add/operator/take'; | ||
import 'rxjs/add/operator/takeUntil'; | ||
import 'rxjs/add/observable/timer'; | ||
import 'rxjs/add/observable/throw'; | ||
import 'rxjs/add/observable/zip'; | ||
import 'rxjs/add/operator/concatMap'; | ||
import 'rxjs/observable/interval'; | ||
import { Injectable } from '@angular/core'; | ||
import { By } from '@angular/platform-browser'; | ||
describe('StepBuildProviderComponent', () => { | ||
let buildStepTest: StepBuildProviderComponent; | ||
let testFixture: ComponentFixture<StepBuildProviderComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [StepBuildProviderComponent], | ||
providers: [DeploymentCenterStateManager], | ||
imports: [TranslateModule.forRoot()] | ||
}) | ||
.overrideComponent(StepBuildProviderComponent, { | ||
set: { | ||
providers: [ | ||
{ provide: DeploymentCenterStateManager, useClass: MockDeploymentCenterStateManager } | ||
] | ||
} | ||
}).compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
testFixture = TestBed.createComponent(StepBuildProviderComponent); | ||
buildStepTest = testFixture.componentInstance; | ||
testFixture.detectChanges(); | ||
}); | ||
|
||
describe('init', () => { | ||
it('should create', fakeAsync(() => { | ||
expect(buildStepTest).toBeTruthy(); | ||
})); | ||
|
||
it('should start with kudu', fakeAsync(() => { | ||
expect(buildStepTest.wizard.wizardValues.buildProvider).toBe('kudu'); | ||
})); | ||
it('should change to vsts', fakeAsync(() => { | ||
const vstsCard = testFixture.debugElement.query(By.css('#vsts')).nativeElement; | ||
vstsCard.click(); | ||
tick(); | ||
expect(buildStepTest.wizard.wizardValues.buildProvider).toBe('vsts'); | ||
})); | ||
}); | ||
}); | ||
|
||
@Injectable() | ||
class MockDeploymentCenterStateManager { | ||
public wizardValues = { | ||
buildProvider: 'kudu' | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 4 additions & 15 deletions
19
...site/deployment-center/deployment-center-setup/step-complete/step-complete.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
<div class="settings-group-wrapper"> | ||
|
||
<h3 class="first-config-heading">Summary</h3> | ||
|
||
<div class="settings-wrapper"> | ||
<div class="setting-wrapper" *ngFor="let item of summaryItems"> | ||
<div class="setting-label">{{item.name}} | ||
</div> | ||
<div class="setting-control-container"> | ||
{{item.value}} | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
<h3 id="step-complete-summary-heading" class="first-config-heading">{{'summary' | translate}}</h3> | ||
<pre> | ||
{{wizard?.wizardValues | json}} | ||
</pre> | ||
</div> | ||
<div class="footer"> | ||
<button type="button" class="custom-button form-button" previousStep>{{'back' | translate}}</button> | ||
<button type="button" class="custom-button form-button" (click)="Save()">{{'finish' | translate}}</button> | ||
<button id="step-complete-back-button" type="button" class="custom-button form-button" previousStep>{{'back' | translate}}</button> | ||
<button id="step-complete-finish-button" type="button" class="custom-button form-button" (click)="Save()">{{'finish' | translate}}</button> | ||
<button id="step-complete-show-dashboard-button" type="button" *ngIf="showDashboard" class="custom-button form-button" (click)="ShowDashboard()">{{'showDashboard' | translate}}</button> | ||
</div> |
Oops, something went wrong.