Skip to content

Commit

Permalink
Merge f519af7 into 8a8e264
Browse files Browse the repository at this point in the history
  • Loading branch information
hartra344 committed Oct 3, 2018
2 parents 8a8e264 + f519af7 commit 459a882
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
10 changes: 10 additions & 0 deletions client/src/app/shared/Utilities/comparators.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
interface DateTimeObj { time: Date; };
export function dateTimeComparator(a: DateTimeObj, b: DateTimeObj) {
if (a.time < b.time) {
return -1;
}
if (a.time > b.time) {
return 1;
}
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { LogCategories, SiteTabIds, KeyCodes } from 'app/shared/models/constants
import { forkJoin } from 'rxjs/observable/forkJoin';
import { TranslateService } from '@ngx-translate/core';
import { PortalResources } from '../../../../shared/models/portal-resources';
import { dateTimeComparator } from '../../../../shared/Utilities/comparators';

enum DeployStatus {
Pending,
Expand Down Expand Up @@ -159,9 +160,8 @@ export class KuduDashboardComponent implements OnChanges, OnDestroy {
return hashNumber;
}
private _populateTable() {
const tableItems = [];
const deployments = this.deploymentObject.deployments.value;
deployments.forEach(value => {
const tableItems = deployments.map(value => {
const item = value.properties;
const date: Date = new Date(item.received_time);
const t = moment(date);
Expand All @@ -174,17 +174,16 @@ export class KuduDashboardComponent implements OnChanges, OnDestroy {
date: t.format('M/D/YY'),
commit: commitId,
checkinMessage: item.message,
// TODO: Compute status and show appropriate message
status: this._getStatusString(item.status, item.progress),
active: item.active,
author: author,
deploymentObj: value,
};
tableItems.push(row);
return row;
});
const newHash = this._getTableHash(tableItems);
if (this._oldTableHash !== newHash) {
this._tableItems = tableItems;
this._tableItems = tableItems.sort(dateTimeComparator);
this._oldTableHash = newHash;
}
}
Expand Down Expand Up @@ -271,7 +270,7 @@ export class KuduDashboardComponent implements OnChanges, OnDestroy {
return Observable.of(false);
});
})
.subscribe();
.subscribe();
}

disconnect() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { BusyStateScopeManager } from '../../../../busy-state/busy-state-scope-m
import { ArmService } from '../../../../shared/services/arm.service';
import { BroadcastService } from '../../../../shared/services/broadcast.service';
import { BroadcastEvent } from '../../../../shared/models/broadcast-event';
import { dateTimeComparator } from '../../../../shared/Utilities/comparators';

class VSODeploymentObject extends DeploymentData {
VSOData: VSOBuildDefinition;
Expand Down Expand Up @@ -66,13 +67,12 @@ export class VsoDashboardComponent implements OnChanges, OnDestroy {
deployments: r.deployments,
VSOData: null,
};
this._tableItems = [];
this.deploymentObject.deployments.value.forEach(element => {
const tableItems = this.deploymentObject.deployments.value.map(element => {
const tableItem: ActivityDetailsLog = this._populateActivityDetails(element.properties);
tableItem.type = 'row';
this._tableItems.push(tableItem);
return tableItem;
});

this._tableItems = tableItems.sort(dateTimeComparator);
const vstsMetaData: any = this.deploymentObject.siteMetadata.properties;

const endpoint = vstsMetaData['VSTSRM_ConfiguredCDEndPoint'];
Expand Down

0 comments on commit 459a882

Please sign in to comment.