Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move deployment center to use table with proper sorting/grouping #3241

Merged
merged 4 commits into from
Sep 27, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/platform-server": "^5.0.0",
"ngx-datatable-accessable": "^13.1.0",
"@angular/router": "^5.0.0",
"@ng-select/ng-select": "^1.5.0",
"@ngx-translate/core": "^9.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export interface ActivityDetailsLog {
icon: string;
message: string;
date: string;
time: string;
time: Date;
urlInfo: UrlInfo[];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { FtpDashboardComponent } from './provider-dashboards/ftp-dashboard/ftp-d
import { DeploymentCredentialsComponent } from './provider-dashboards/deployment-credentials/deployment-credentials.component';
import { LinuxFramworksComponent } from './deployment-center-setup/step-configure/configure-vsts-build/linux-frameworks/linux-frameworks.component';
import { WindowsFramworksComponent } from './deployment-center-setup/step-configure/configure-vsts-build/windows-frameworks/windows-frameworks.component';
import { NgxDatatableModule } from 'ngx-datatable-accessable';

@NgModule({
entryComponents: [DeploymentCenterComponent],
Expand Down Expand Up @@ -55,7 +56,7 @@ import { WindowsFramworksComponent } from './deployment-center-setup/step-config
LinuxFramworksComponent,
WindowsFramworksComponent,
],
imports: [TranslateModule.forChild(), SharedModule, WizardModule, SidebarModule, NgSelectModule],
imports: [TranslateModule.forChild(), SharedModule, WizardModule, SidebarModule, NgSelectModule, NgxDatatableModule],
exports: [DeploymentCenterComponent],
})
export class DeploymentCenterModule {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,68 +80,67 @@
</div>
</div>
</div>

<div class="list-container">
<tbl [items]="tableItems" #table="tbl" id="activity-list" [name]="'functionApps' | translate" groupColName="time">
<tr>
<th>
{{'time' | translate}}
</th>
<th>
{{'active' | translate}}
</th>
<th>
{{'status' | translate}}
</th>
<th>
{{'commitIdAuthor' | translate}}
</th>
<th>
{{'checkinMessage' | translate}}
</th>
<th class="icon"></th>
</tr>

<tr *ngFor="let item of table.items;trackBy:tableItemTackBy">

<td class="time-column">
<div *ngIf="item.type === 'row'">
{{item.time}}
</div>
<div *ngIf="item.type === 'group'">
<b>{{item.time}}</b>
</div>
</td>
<td class="icon">
<div *ngIf="item.active">
<img src="image/success-blue.svg" (click)="details(item)" />
</div>
</td>
<td>
{{item.status}}
</td>
<td>
<div *ngIf="item.type === 'row'">
{{item.commit}} ({{item.author}})
</div>
</td>
<td>

{{item.checkinMessage}}

</td>

<td class="icon">
<div *ngIf="item.type === 'row'">
<img src="image/generic-template.svg" (click)="details(item)" />
<ngx-datatable
#myTable
class='fluent expandable'
columnMode="flex"
[rows]="tableItems"
[groupRowsBy]="'date'"
[headerHeight]="30"
[footerHeight]="0"
[rowHeight]="'40'"
[virtualization]="true"
[groupExpansionDefault]="true">
<!-- Group Header Template -->
<ngx-datatable-group-header [rowHeight]="100" #myGroupHeader>
<ng-template let-group="group" let-expanded="expanded" ngx-datatable-group-header-template>
<div style="padding-left:5px;">
<span
title="Expand/Collapse Group"
(click)="toggleExpandGroup(group)">
<b>{{group.value[0].date | date:'fullDate'}}</b>
</span>
</div>
</td>
</tr>
</tbl>
</ng-template>
</ngx-datatable-group-header>
<!-- Row Column Template -->
<ngx-datatable-column name="{{'time' | translate}}" prop="time" editable="false" [flexGrow]="2">
<ng-template ngx-datatable-cell-template let-rowIndex="rowIndex" let-value="value" let-row="row"
let-group="group">
<span>
{{row.time | date:'longTime'}}
</span>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column name="{{'status' | translate}}" prop="status" [resizeable]="true" [flexGrow]="2">
<ng-template ngx-datatable-cell-template let-rowIndex="rowIndex" let-value="value" let-row="row"
let-group="group">
<span>
{{row.status}} {{row.active ? '(Active)' : ''}}
</span>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column name="{{'commitIdAuthor' | translate}}" prop="commit" [resizeable]="true" [flexGrow]="2">
<ng-template ngx-datatable-cell-template let-rowIndex="rowIndex" let-value="value" let-row="row"
let-group="group">
<span>
{{row.commit}} ({{row.author}})
</span>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column name="{{'checkinMessage' | translate}}" prop="checkinMessage" [resizeable]="true" [flexGrow]="5"></ngx-datatable-column>
<ngx-datatable-column name="{{'logs' | translate}}" prop="" editable="false" [resizeable]="true" [flexGrow]="1">
<ng-template ngx-datatable-cell-template let-rowIndex="rowIndex" let-value="value" let-row="row"
let-group="group">
<span [load-image]="'image/generic-template.svg'" class="command-icon" (click)="details(row)" role="button" (keyup)="onLogsKeyUp($event.target.value, row)"></span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it would look cleaner if we did 1 attribute per line

</ng-template>
</ngx-datatable-column>
</ngx-datatable>
</div>
</div>
<ng-sidebar #sidebar [(opened)]="sidePanelOpened" [mode]="'over'" [position]="'right'" [closeOnClickOutside]="true" [trapFocus]="false"
[autoFocus]="true" [sidebarClass]="'sidebar'" [ariaLabel]="'Deployment Details'" [animate]="true" [showBackdrop]="true">
<ng-sidebar #sidebar *ngIf="sidePanelOpened" [(opened)]="sidePanelOpened" [mode]="'over'" [position]="'right'" [closeOnClickOutside]="true" [trapFocus]="false"
[autoFocus]="true" [sidebarClass]="'sidebar'" [ariaLabel]="'deploymentDetails'| translate" [animate]="true" [showBackdrop]="true">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with the sidebar :)

<app-deployment-detail [hidden]="hideCreds" [deploymentObject]="rightPaneItem" [redeployEnabled]="redeployEnabled" (closePanel)="sidebar.close()"></app-deployment-detail>
<app-deployment-credentials [hidden]="!hideCreds" [resourceId]="resourceId"></app-deployment-credentials>
</ng-sidebar>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import '../../../../../sass/main';


#essentials-container {
border-bottom: $border;
padding: 10px 20px 12px 20px;
Expand Down Expand Up @@ -48,15 +49,20 @@
width: 90%;
margin: auto;

img{
vertical-align: middle;
margin-bottom: 15px;
margin-right: 5px;
width: 32px;
height: 32px;
}

}
.command-icon{
height: 20px;
width: 20px;
display: inline-block;
}
.icon {
vertical-align: middle;
margin-bottom: 15px;
margin-right: 5px;
width: 32px;
height: 32px;
}

.time-column {
width: 5%;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ArmService } from '../../../../shared/services/arm.service';
import { ArmObj } from '../../../../shared/models/arm/arm-obj';
import { TableItem, TblComponent } from '../../../../controls/tbl/tbl.component';
import { TableItem } from '../../../../controls/tbl/tbl.component';
import { CacheService } from '../../../../shared/services/cache.service';
import { PortalService } from '../../../../shared/services/portal.service';
import { Observable, Subject } from 'rxjs/Rx';
Expand All @@ -12,7 +12,7 @@ import { BusyStateScopeManager } from 'app/busy-state/busy-state-scope-manager';
import { BroadcastService } from 'app/shared/services/broadcast.service';
import { BroadcastEvent } from 'app/shared/models/broadcast-event';
import { LogService } from 'app/shared/services/log.service';
import { LogCategories, SiteTabIds } from 'app/shared/models/constants';
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';
Expand All @@ -27,7 +27,7 @@ enum DeployStatus {

class KuduTableItem implements TableItem {
public type: 'row' | 'group';
public time: string;
public time: Date;
public date: string;
public status: string;
public checkinMessage: string;
Expand All @@ -44,7 +44,7 @@ class KuduTableItem implements TableItem {
})
export class KuduDashboardComponent implements OnChanges, OnDestroy {
@Input() resourceId: string;
@ViewChild(TblComponent) appTable: TblComponent;
@ViewChild('myTable') table: any;

public viewInfoStream$: Subject<string>;

Expand Down Expand Up @@ -125,6 +125,11 @@ export class KuduDashboardComponent implements OnChanges, OnDestroy {
});
}

onLogsKeyUp(event: KeyboardEvent, row: any) {
if (event.keyCode === KeyCodes.enter || event.keyCode === KeyCodes.space) {
this.details(row);
}
}
private _redeployEnabled() {
const scmProvider = this.deploymentObject.siteConfig.properties.scmType;
if (scmProvider === 'Dropbox' || scmProvider === 'OneDrive') {
Expand Down Expand Up @@ -165,7 +170,7 @@ export class KuduDashboardComponent implements OnChanges, OnDestroy {
const author = item.author;
const row: KuduTableItem = {
type: 'row',
time: t.format('h:mm:ss A'),
time: date,
date: t.format('M/D/YY'),
commit: commitId,
checkinMessage: item.message,
Expand All @@ -180,9 +185,6 @@ export class KuduDashboardComponent implements OnChanges, OnDestroy {
const newHash = this._getTableHash(tableItems);
if (this._oldTableHash !== newHash) {
this._tableItems = tableItems;
setTimeout(() => {
this.appTable.groupItems('date', 'desc');
}, 0);
this._oldTableHash = newHash;
}
}
Expand Down Expand Up @@ -353,6 +355,9 @@ export class KuduDashboardComponent implements OnChanges, OnDestroy {
tableItemTackBy(index: number, item: KuduTableItem) {
return item && item.commit; // or item.id
}
toggleExpandGroup(group) {
this.table.groupHeader.toggleExpandGroup(group);
}

showDeploymentCredentials() {
this.hideCreds = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,39 +86,51 @@


<div class="table-container">
<tbl [items]="TableItems" #table="tbl" id="activity-list" [name]="'functionApps' | translate" groupColName="message">
<tr style="display:none">
<th>
<tbl-th name="message">{{'message' | translate}}</tbl-th>
</th>
<th>
<tbl-th name="time">{{'time' | translate}}</tbl-th>
</th>
<th>
<tbl-th name="date">{{'date' | translate}}</tbl-th>
</th>
</tr>

<tr *ngFor="let item of table.items">
<td>
<img *ngIf="item.type === 'row'" style='display:inline-block;vertical-align:middle;width:18px;height:18px;' [src]="item.icon"
/>

<div *ngIf="item.type === 'group'" class="messageColumn">
<b>
<p>{{item.message}}</p>
</b>
<ngx-datatable
#myTable
class='fluent expandable'
columnMode="flex"
[rows]="TableItems"
[groupRowsBy]="'date'"
[headerHeight]="0"
[footerHeight]="0"
[rowHeight]="'auto'"
[virtualization]="true"
[groupExpansionDefault]="true">
<!-- Group Header Template -->
<ngx-datatable-group-header [rowHeight]="100" #myGroupHeader>
<ng-template let-group="group" let-expanded="expanded" ngx-datatable-group-header-template>
<div style="padding-left:5px;">
<span
title="Expand/Collapse Group"
(click)="toggleExpandGroup(group)">
<b>{{group.value[0].date | date:'fullDate'}}</b>
</span>
</div>
<div *ngIf="item.type === 'row'" class="messageColumn">

<p>{{item.message}}</p>
<div style="display:inline-block;margin-left:10px;" *ngFor="let url of item.urlInfo">
</ng-template>
</ngx-datatable-group-header>
<!-- Row Column Template -->
<ngx-datatable-column name="{{'message' | translate}}" prop="time" editable="false" [flexGrow]="6">
<ng-template ngx-datatable-cell-template let-rowIndex="rowIndex" let-value="value" let-row="row"
let-group="group">
<img style='display:inline-block;vertical-align:middle;width:18px;height:18px;' [src]="row.icon"
/>
<div class="messageColumn">
<p >{{row.message}}</p>
<div style="display:inline-block;margin-left:10px;" *ngFor="let url of row.urlInfo">
<span *ngIf="url.urlIcon" [load-image]="url.urlIcon" class="statusImage"></span>
<a (click)="onUrlClick(url.url)" tabindex="0">{{url.urlText}}</a>
</div>
</div>
</td>
<td>{{item.time}}</td>
</tr>
</tbl>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column name="{{'time' | translate}}" prop="time" editable="false" [flexGrow]="1">
<ng-template ngx-datatable-cell-template let-rowIndex="rowIndex" let-value="value" let-row="row"
let-group="group">
<span>
{{row.time | date:'longTime'}}
</span>
</ng-template>
</ngx-datatable-column>
</ngx-datatable>
</div>