Skip to content

Commit

Permalink
rename completition to completion (Azure#743)
Browse files Browse the repository at this point in the history
  • Loading branch information
ascobie authored Oct 5, 2017
1 parent d5c7238 commit 6c01d9f
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class ApplicationDetailsComponent implements OnInit, OnDestroy {
public addPackage() {
const sidebarRef = this.sidebarManager.open("add-package", ApplicationCreateDialogComponent);
sidebarRef.component.setValue(this.application);
sidebarRef.afterCompletition.subscribe(() => {
sidebarRef.afterCompletion.subscribe(() => {
this.refresh();
});
}
Expand All @@ -81,7 +81,7 @@ export class ApplicationDetailsComponent implements OnInit, OnDestroy {
public editApplication() {
const sidebarRef = this.sidebarManager.open("edit-application", ApplicationEditDialogComponent);
sidebarRef.component.setValue(this.application);
sidebarRef.afterCompletition.subscribe(() => {
sidebarRef.afterCompletion.subscribe(() => {
this.refresh();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class ApplicationPackageTableComponent extends ListOrTableBase implements
public addPackage(event: any) {
const sidebarRef = this.sidebarManager.open("add-package", ApplicationCreateDialogComponent);
sidebarRef.component.setValue(this.application);
sidebarRef.afterCompletition.subscribe(() => {
sidebarRef.afterCompletion.subscribe(() => {
this.refresh();
});
}
Expand Down Expand Up @@ -132,7 +132,7 @@ export class ApplicationPackageTableComponent extends ListOrTableBase implements
public updatePackageVersion() {
const sidebarRef = this.sidebarManager.open("update-package", ApplicationCreateDialogComponent);
sidebarRef.component.setValue(this.application, this.activatedItem);
sidebarRef.afterCompletition.subscribe(() => {
sidebarRef.afterCompletion.subscribe(() => {
this.refresh();
});
}
Expand Down
5 changes: 2 additions & 3 deletions app/components/base/sidebar/sidebar-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ import { SidebarRef } from "./sidebar-ref";

@Injectable()
export class SidebarManager {

public sidebar: MdSidenav = null;
public sidebarContent: SidebarContentComponent = null;

public references: Observable<Array<SidebarRef<any>>>;

private referenceMap: { [key: string]: SidebarRef<any> } = {};

private referencesSubject: BehaviorSubject<Array<SidebarRef<any>>> = new BehaviorSubject([]);

constructor() {
Expand All @@ -42,6 +39,7 @@ export class SidebarManager {
sidebarRef = new SidebarRef<T>(this, id);
this.referenceMap[id] = sidebarRef;
}

// If the component was already init before and we don't want to create a new one
if (openNew) {
this.sidebarContent.open(componentType, sidebarRef);
Expand All @@ -51,6 +49,7 @@ export class SidebarManager {

this.sidebar.open();
this.updateReferenceSubject();

return sidebarRef;
}

Expand Down
11 changes: 5 additions & 6 deletions app/components/base/sidebar/sidebar-ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import { SidebarPageComponent } from "./sidebar-page";
export class SidebarRef<T> {
public component: T;
public page: SidebarPageComponent;
public afterCompletion: Observable<any>;

public afterCompletition: Observable<any>;

private _afterCompletition: Subject<any> = new Subject();
private _afterCompletion: Subject<any> = new Subject();

constructor(private sidebarManager: SidebarManager, public id: string) {
this.afterCompletition = this._afterCompletition.asObservable();
this.afterCompletion = this._afterCompletion.asObservable();
}

public reopen() {
Expand All @@ -24,7 +23,7 @@ export class SidebarRef<T> {
*/
public destroy(result?: any) {
this.sidebarManager.destroy(this);
this._afterCompletition.next(result);
this._afterCompletition.complete();
this._afterCompletion.next(result);
this._afterCompletion.complete();
}
}
2 changes: 1 addition & 1 deletion app/components/data/browse/file-group-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class FileGroupListComponent extends ListOrTableBase implements OnInit, O
folder: null,
}));

sidebarRef.afterCompletition.subscribe(() => {
sidebarRef.afterCompletion.subscribe(() => {
this.storageService.onFileGroupUpdated.next();
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/components/data/details/data-details.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class DataDetailsComponent implements OnInit, OnDestroy {
folder: null,
}));

sidebarRef.afterCompletition.subscribe(() => {
sidebarRef.afterCompletion.subscribe(() => {
this.storageService.onFileGroupUpdated.next();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ export class JobStatsPreviewComponent {
};
}

public get completitionPercent() {
public get completionPercent() {
return Math.floor((this.stats.completed / this.stats.total * 100));
}

public get tooltipMessages() {
return {
taskCompleted: `Job has completed ${this.completitionPercent}% of its tasks.`,
taskCompleted: `Job has completed ${this.completionPercent}% of its tasks.`,
taskFailed: `Job has ${this.stats.failed} tasks that failed.`,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
<div *ngIf="false">
<span class="task-success" md-tooltip="{{tooltipMessages.taskCompleted}}" tooltip-position="below">
<i class="fa fa-check"></i>
<span>{{completitionPercent}} %</span>
<span>{{completionPercent}} %</span>
</span>
<span class="task-failed" md-tooltip="{{tooltipMessages.taskFailed}}" tooltip-position="below" *ngIf="stats.failed > 0">
<i class="fa fa-times"></i>
<span>{{stats.failed}}</span>
</span>
</div>

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</div>
</div>
</div>
<div class="progress" *ngIf="progress" title="Job completition progress">
<div class="progress" *ngIf="progress" title="Job completion progress">
<md-progress-bar class="progress-bar" color="primary" mode="buffer" [value]="progress.completed" [bufferValue]="progress.buffer">
</md-progress-bar>
<span class="progress-label">{{progress.completed}}%</span>
Expand Down
6 changes: 3 additions & 3 deletions test/app/components/base/sidebar/sidebar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ describe("SidebarPageComponent", () => {
expect(sidebarManager.sidebar.opened).toBe(false);
});

it("Should notifiy afterCompletition when the sidebar is destroyed", () => {
it("Should notifiy afterCompletion when the sidebar is destroyed", () => {
const firstSidebarRef = sidebarManager.open("fake-1", FakeComponent);
const spy = jasmine.createSpy("afterCompletition");
const spy = jasmine.createSpy("afterCompletion");

firstSidebarRef.afterCompletition.subscribe(spy);
firstSidebarRef.afterCompletion.subscribe(spy);
firstSidebarRef.destroy("some result");

expect(spy).toHaveBeenCalledTimes(1);
Expand Down

0 comments on commit 6c01d9f

Please sign in to comment.