<ngx-datatable-row-detail [rowHeight]="'auto'">
<ng-template let-row="row" let-expanded="expanded" ngx-datatable-row-detail-template>
<div *ngFor="let status of row.statuses">
- <span class = "status" [attr.data-tests-id]="generateDataTestID('statusTimeStamp_',componentName, row.name, status.status)">{{ status.timeStamp | date:'short':'UTC'}}</span>
- <span class = "status" [attr.data-tests-id]="generateDataTestID('statusValue_',componentName, row.name, status.status)">{{ status.status }}</span>
+ <span class = "status timestamp" [attr.data-tests-id]="generateDataTestID('statusTimeStamp_',componentName, row.name, status.status)">{{ status.timeStamp | date:'short':'UTC'}}</span>
+ <span class = "status value" [attr.data-tests-id]="generateDataTestID('statusValue_',componentName, row.name, status.status)">{{ status.status }}</span>
+ <span class = "status message" [attr.data-tests-id]="generateDataTestID('statusMessageValue_',componentName, row.name, status.errorReason)">{{ status.errorReason }}</span>
</div>
</ng-template>
</ngx-datatable-row-detail>
<div class = "distributionRowValue ellipsisCell" [attr.data-tests-id]="generateDataTestID('status_',componentName, row.name)" sdc-tooltip [tooltip-placement]="3" [tooltip-text]="getLatestArtifact(row.name).status">{{ getLatestArtifact(row.name).status }}</div>
</ng-template>
</ngx-datatable-column>
+ <ngx-datatable-column [resizeable]="false" [width]="280" name="Message">
+ <ng-template ngx-datatable-cell-template let-row="row">
+ <div class = "distributionRowValue ellipsisCell" [attr.data-tests-id]="generateDataTestID('message_',componentName, row.name)" sdc-tooltip [tooltip-placement]="3" [tooltip-text]="getLatestArtifact(row.name).errorReason">{{ getLatestArtifact(row.name).errorReason }}</div>
+ </ng-template>
+ </ngx-datatable-column>
</ngx-datatable>
</div>
\ No newline at end of file
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ComponentFixture } from '@angular/core/testing';
import { NgxDatatableModule } from '@swimlane/ngx-datatable';
-import { SdcUiServices } from 'onap-ui-angular';
import { ConfigureFn, configureTests } from '../../../../../../../jest/test-config.helper';
import { DistributionService } from '../../distribution.service';
import { DistributionComponentArtifactTableComponent } from './distribution-component-artifact-table.component';
{
name: 'Artifact1',
statuses: [
- {timeStamp: '7/25/2019 12:48AM', status: 'DEPLOY_OK'},
- {timeStamp: '7/25/2019 12:48AM', status: 'DOWNLOAD_OK'},
- {timeStamp: '7/25/2019 12:48AM', status: 'NOTIFIED'}
+ {timeStamp: '7/25/2019 12:48AM', status: 'DEPLOY_OK', errorReason: 'Sample message 1'},
+ {timeStamp: '7/25/2019 12:48AM', status: 'DOWNLOAD_OK', errorReason: 'Sample message 2'},
+ {timeStamp: '7/25/2019 12:48AM', status: 'NOTIFIED', errorReason: 'Sample message 3'}
],
url: 'URL1',
},
{
name: 'Artifact2',
statuses: [
- {timeStamp: '7/26/2019 12:48AM', status: 'STATUS_TO_DISPLAY'},
+ {timeStamp: '7/26/2019 12:48AM', status: 'STATUS_TO_DISPLAY', errorReason: 'null'},
{timeStamp: '7/25/2019 12:48AM', status: 'DOWNLOAD_OK'},
{timeStamp: '7/25/2019 12:48AM', status: 'NOTIFIED'}
],
url: 'URL2',
},
+ {
+ name: 'Artifact3',
+ statuses: [
+ {timeStamp: '12/12/2020 13:30AM', status: 'DEPLOY_OK', errorReason: null},
+ {timeStamp: '12/11/2020 13:20AM', status: 'DOWNLOAD_OK', errorReason: 'Sample error reason'}
+ ],
+ url: 'URL3',
+ },
{
name: 'ArtifactWithNoStatuses',
url: 'URL2',
});
- it('Get Latest Artifact (status and timeStamp) - So the Component Table will display the last time stamp of the notification', async () => {
+ it('Get Latest Artifact (status, timeStamp, errorReason) - So the Component Table will display the last time stamp of the notification', async () => {
await fixture.componentInstance.ngOnInit();
- expect(fixture.componentInstance.getLatestArtifact('Artifact2')).toEqual({status: 'STATUS_TO_DISPLAY', timeStamp: '7/26/2019 12:48AM'});
+ expect(fixture.componentInstance.getLatestArtifact('Artifact2')).toEqual({timeStamp: '7/26/2019 12:48AM', status: 'STATUS_TO_DISPLAY', errorReason: ''});
expect(fixture.componentInstance.getLatestArtifact('ArtifactWithNoStatuses')).toEqual(null);
});
+ it('Get Latest Artifact (status, timeStamp, errorReason) - So the Component Table will display correct Message', async () => {
+ await fixture.componentInstance.ngOnInit();
+ expect(fixture.componentInstance.getLatestArtifact('Artifact1').errorReason).toEqual('Sample message 1');
+ expect(fixture.componentInstance.getLatestArtifact('Artifact2').errorReason).toEqual('');
+ expect(fixture.componentInstance.getLatestArtifact('Artifact3').errorReason).toEqual('');
+ });
+
it('Once the Distribution Component Artifact Table Component is created - artifacts will keep the relevant artifacts for a specific distributionID and Component Name', async () => {
await fixture.componentInstance.ngOnInit();
// tslint:disable:no-string-literal
- expect(fixture.componentInstance.artifacts.length).toBe(3);
+ expect(fixture.componentInstance.artifacts.length).toBe(4);
expect(fixture.componentInstance.artifacts[0].name).toBe('Artifact1');
expect(fixture.componentInstance.artifacts[0].url).toBe('URL1');
expect(fixture.componentInstance.artifacts[0].statuses.length).toBe(3);
'specific distributionID and Component Name filtered by Status', async () => {
fixture.componentInstance.statusFilter = 'DOWNLOAD_OK';
await fixture.componentInstance.ngOnInit();
- expect(fixture.componentInstance.artifacts.length).toBe(3);
+ expect(fixture.componentInstance.artifacts.length).toBe(4);
expect(fixture.componentInstance.artifacts[0].name).toBe('Artifact1');
expect(fixture.componentInstance.artifacts[0].url).toBe('URL1');
expect(fixture.componentInstance.artifacts[0].statuses.length).toBe(1);
- expect(fixture.componentInstance.artifacts[0].statuses[0]).toEqual({status: 'DOWNLOAD_OK', timeStamp: '7/25/2019 12:48AM'});
+ expect(fixture.componentInstance.artifacts[0].statuses[0]).toEqual({status: 'DOWNLOAD_OK', timeStamp: '7/25/2019 12:48AM', errorReason: 'Sample message 2'});
});
+
});
const artifactObj = {
url: artifact.artifactUrl,
name: artifact.artifactName,
- statuses: artifact.statuses
+ statuses: artifact.statuses,
+ errorReason: artifact.errorReason
};
artifacts.push(artifactObj);
});
url: distributionStatus['url'],
time: distributionStatus['timestamp'],
status: distributionStatus['status'],
+ errorReason: distributionStatus['errorReason']
};
// Case where there is a url -> should add its status
component.artifacts[artifactPosition].statuses.push({
timeStamp: detailedArtifactStatus.time,
- status: detailedArtifactStatus.status
+ status: detailedArtifactStatus.status,
+ errorReason: detailedArtifactStatus.errorReason
});
} else {
// Should update the Component -> status from MSO