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

MET-6082 Show Depublication Reasons #860

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions projects/metis/cypress/e2e/dataset.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { DepublicationReasonHash } from '../../test-data/_data/depublication-reasons';
import { checkAHref, cleanupUser, setupUser } from '../support/helpers';

function setupDatasetPage(name: string, index: number): void {
Expand Down Expand Up @@ -27,6 +28,12 @@ context('metis-ui', () => {
cy.get('.search-form').should('have.length', 1);
});

it('should show the depublication reason', () => {
cy.get('.pill')
.contains(DepublicationReasonHash['REMOVED_DATA_AT_SOURCE'])
.should('exist');
});

it('should show the throttle level', () => {
cy.get('.last-execution')
.contains(`Weak Throttle`)
Expand Down Expand Up @@ -100,8 +107,8 @@ context('metis-ui', () => {
});

it('should show the indexing_deleted_records status', () => {
getHistoryRow(2).contains('Transform');
getHistoryRow(2)
getHistoryRow(3).contains('Transform');
getHistoryRow(3)
.get('.status-identifying_deleted_records')
.should('have.length', 1);
});
Expand Down
8 changes: 8 additions & 0 deletions projects/metis/cypress/e2e/history.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { DepublicationReasonHash } from '../../test-data/_data/depublication-reasons';
import { cleanupUser, setupUser } from '../support/helpers';

context('metis-ui', () => {
Expand Down Expand Up @@ -59,5 +60,12 @@ context('metis-ui', () => {
.contains(`Strong Throttle`)
.should('exist');
});

it('should show the depublish reason', () => {
cy.visit('/dataset/log/3');
cy.get('.pill')
.contains(DepublicationReasonHash['GDPR'])
.should('exist');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@
</span>
</ng-container>
</ng-container>

<ng-container *ngIf="plugin.pluginType === PluginType.DEPUBLISH">
<ng-container *ngIf="plugin.pluginMetadata; let metadata">
<span *ngIf="metadata.depublicationReason" class="pill">
{{ metadata.depublicationReason }}
</span>
</ng-container>
</ng-container>
</span>
</span>
<span class="totals" [ngClass]="{ stripey: applyStripe }">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ $width-orb: 3em;

.table-grid-row-start {
width: $width-orb;
.orb-status {
cursor: default;
}
}

.time:not(.br) {
Expand Down
19 changes: 10 additions & 9 deletions projects/metis/src/assets/sass/pill.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@
padding-left: 4px;
padding-right: 4px;
white-space: nowrap;
&:not(.depublication-status) {
margin-left: 4px;
&.errors {
background-image: svg-url-icon-warning($eu-red);
background-position: 4px center;
background-size: 14px 12px;
border-color: $eu-red;
color: $eu-red;
}
}
}

.pill-xsl,
.pill-harvest,
.pill-throttle {
background-repeat: no-repeat;
padding-left: 20px;
margin-left: 4px;

&.errors {
background-image: svg-url-icon-warning($eu-red);
background-position: 4px center;
background-size: 14px 12px;
border-color: $eu-red;
color: $eu-red;
}
}

.pill-harvest,
Expand Down
26 changes: 0 additions & 26 deletions projects/metis/test-data/_data/depublication-reasons.json

This file was deleted.

26 changes: 26 additions & 0 deletions projects/metis/test-data/_data/depublication-reasons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
type DepublicationReason =
| 'BROKEN_MEDIA_LINKS'
| 'GDPR'
| 'LACK_OF_PERMISSIONS'
| 'SENSITIVE_CONTENT'
| 'REMOVED_DATA_AT_SOURCE'
| 'GENERIC';

export enum DepublicationReasonHash {
BROKEN_MEDIA_LINKS = 'Broken media links',
GDPR = 'GDPR',
LACK_OF_PERMISSIONS = 'Lack of permissions',
SENSITIVE_CONTENT = 'Sensitive content',
REMOVED_DATA_AT_SOURCE = 'Removed data at source',
GENERIC = 'Generic'
}

export const depublicationReasons: Array<{
name: DepublicationReason;
valueAsString: string;
}> = Object.keys(DepublicationReasonHash).map((key: string) => {
return {
name: key as DepublicationReason,
valueAsString: DepublicationReasonHash[key as DepublicationReason]
};
});
16 changes: 14 additions & 2 deletions projects/metis/test-data/factory/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
WorkflowX,
WorkflowXRunConf
} from '../_models/test-models';
import { DepublicationReasonHash } from '../_data/depublication-reasons';
import { xsltDefault } from '../_data/xslt';
import {
DatasetExecutionProgress,
Expand Down Expand Up @@ -271,7 +272,17 @@ function generatePluginMetadata(pType: PluginType, metadataIndex = 1): PluginMet
? metadataIndex % 2 === 1
? ThrottleLevel.STRONG
: ThrottleLevel.WEAK
: undefined
: undefined,
depublicationReason:
pType === PluginType.DEPUBLISH
? metadataIndex === 1
? DepublicationReasonHash['GDPR']
: DepublicationReasonHash['REMOVED_DATA_AT_SOURCE']
: undefined,
datasetDepublish:
pType === PluginType.DEPUBLISH ? (metadataIndex === 1 ? true : false) : undefined,
recordIdsToDepublish:
pType === PluginType.DEPUBLISH ? (metadataIndex === 1 ? undefined : [1, 2, 4]) : undefined
} as PluginMetadata;
}

Expand Down Expand Up @@ -440,7 +451,8 @@ datasetXs = ((): Array<DatasetX> => {
generatePluginMetadata(PluginType.VALIDATION_EXTERNAL),
generatePluginMetadata(PluginType.TRANSFORMATION),
generatePluginMetadata(PluginType.VALIDATION_INTERNAL),
generatePluginMetadata(PluginType.NORMALIZATION)
generatePluginMetadata(PluginType.NORMALIZATION),
generatePluginMetadata(PluginType.DEPUBLISH)
]
}
]
Expand Down
6 changes: 2 additions & 4 deletions projects/metis/test-data/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as url from 'url';
import * as fileSystem from 'fs';
import { IncomingMessage, ServerResponse } from 'http';
import { TestDataServer } from '../../../tools/test-data-server/test-data-server';
import { xsltStylesheet } from './_data/xslt';
import { depublicationReasons } from './_data/depublication-reasons';
import {
dataset,
errorReport,
Expand Down Expand Up @@ -328,9 +328,7 @@ new (class extends TestDataServer {
regRes = /depublish\/reasons/.exec(route);

if (regRes) {
fileSystem
.createReadStream('projects/metis/test-data/_data/depublication-reasons.json')
.pipe(response);
response.end(JSON.stringify(depublicationReasons));
return true;
}

Expand Down