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

feat: add possibility to remove shared users from dataset #1084

Merged
merged 6 commits into from
Jun 1, 2023
Merged
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
1 change: 1 addition & 0 deletions CI/ESS/e2e/cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"secondaryUsername": "archiveManager",
"secondaryPassword": "aman",
"guestUsername":"user1",
"guestUserEmail":"user1@your.site",
"guestPassword":"a609316768619f154ef58db4d847b75e",
"defaultCommandTimeout": 10000,
"retries": 1
Expand Down
1 change: 1 addition & 0 deletions cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"secondaryUsername": "archiveManager",
"secondaryPassword": "aman",
"guestUsername":"user1",
"guestUserEmail":"user1@your.site",
"guestPassword":"a609316768619f154ef58db4d847b75e",
"defaultCommandTimeout": 10000,
"retries": 1
Expand Down
67 changes: 67 additions & 0 deletions cypress/integration/datasets-share.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/// <reference types="Cypress" />

describe("Datasets", () => {
beforeEach(() => {
cy.login(Cypress.config("username"), Cypress.config("password"));
});

after(() => {
cy.login(
Cypress.config("secondaryUsername"),
Cypress.config("secondaryPassword")
);
cy.removeDatasets();
});

describe("Add item to cart and publish", () => {
it("should add dataset to cart, share it with another user and remove the share", () => {
cy.createDataset("raw");

cy.visit("/datasets");

cy.get(".dataset-table mat-table mat-header-row").should("exist");

cy.finishedLoading();

cy.get('input[type="search"][data-placeholder="Text Search"]')
.clear()
.type("Cypress");

cy.isLoading();

cy.get("[data-cy=checkboxInput]").first().click();

cy.get("#addToBatchButton").click();

cy.get("#cartOnHeaderButton").click();

cy.get("a.button").click();

cy.get("#shareButton").click();

cy.get("#userEmailField").type(Cypress.config("guestUserEmail"));

cy.get("#addUserButton").click();

cy.get(".mat-dialog-container .mat-chip-list .mat-chip")
.first()
.should("contain.text", Cypress.config("guestUserEmail"));

cy.get("#shareListButton").should("not.be.disabled");
cy.get("#shareListButton").click();

cy.get(".mat-snack-bar-container.snackbar-success").should("exist");

cy.get("#shareButton").click();

cy.get(".mat-dialog-container .mat-chip-list .mat-chip")
.first()
.should("contain.text", Cypress.config("guestUserEmail"));

cy.get("#removeAllButton").should("not.be.disabled");
cy.get("#removeAllButton").click();

cy.get(".mat-snack-bar-container.snackbar-success").should("exist");
});
});
});
264 changes: 135 additions & 129 deletions src/app/datasets/batch-view/batch-view.component.html
Original file line number Diff line number Diff line change
@@ -1,129 +1,135 @@
<div style="margin-top: 1em">
<div *ngIf="hasBatch; else empty_batch">
<div style="text-align: right; margin-bottom: 1em">
<button (click)="onEmpty()" mat-button class="button" color="primary">
<mat-icon> remove_shopping_cart </mat-icon>
Empty Cart
</button>
<button
mat-button
id="publishButton"
(click)="onPublish()"
class="button"
color="primary"
>
<mat-icon> school </mat-icon>
Publish
</button>
<ng-container *ngIf="shareEnabled">
<button mat-button (click)="onShare()" class="button" color="primary">
<mat-icon> share </mat-icon>
Share
</button>
</ng-container>
<ng-container *ngIf="appConfig.archiveWorkflowEnabled">
<button mat-button (click)="onArchive()" class="button" color="primary">
<mat-icon> archive </mat-icon>
Archive
</button>
<button
mat-button
(click)="onRetrieve()"
class="button"
color="primary"
>
<mat-icon> cloud_download </mat-icon>
Retrieve
</button>
</ng-container>
</div>

<mat-table
[dataSource]="batch$"
class="mat-elevation-z2"
style="margin-left: 1em"
>
<ng-container matColumnDef="remove">
<mat-header-cell *matHeaderCellDef>
<div fxLayout="column" style="align-items: center">
<div>
<mat-icon> remove_circle </mat-icon>
</div>
<div>Remove</div>
</div>
</mat-header-cell>

<mat-cell *matCellDef="let dataset">
<button mat-icon-button color="warn" (click)="onRemove(dataset)">
<mat-icon> remove_circle </mat-icon>
</button>
</mat-cell>
</ng-container>

<ng-container matColumnDef="pid">
<mat-header-cell *matHeaderCellDef>
<div fxLayout="column" style="align-items: center">
<div>
<mat-icon> perm_contact_calendar </mat-icon>
</div>
<div>PID</div>
</div>
</mat-header-cell>
<mat-cell *matCellDef="let dataset">{{ dataset.pid }}</mat-cell>
</ng-container>

<ng-container matColumnDef="sourceFolder">
<mat-header-cell *matHeaderCellDef>
<div fxLayout="column" style="align-items: center">
<div>
<mat-icon> folder </mat-icon>
</div>
<div>Source Folder</div>
</div>
</mat-header-cell>
<mat-cell *matCellDef="let dataset">{{
dataset.sourceFolder
}}</mat-cell>
</ng-container>

<ng-container matColumnDef="size">
<mat-header-cell *matHeaderCellDef>
<div fxLayout="column" style="align-items: center">
<div>
<mat-icon> save </mat-icon>
</div>
<div>Size</div>
</div>
</mat-header-cell>
<mat-cell *matCellDef="let dataset">
{{ dataset.size | filesize }}
</mat-cell>
</ng-container>

<ng-container matColumnDef="creationTime">
<mat-header-cell *matHeaderCellDef>
<div fxLayout="column" style="align-items: center">
<div>
<mat-icon> calendar_today </mat-icon>
</div>
<div>Creation Time</div>
</div>
</mat-header-cell>
<mat-cell *matCellDef="let dataset">
{{ dataset.creationTime | date: "yyyy-MM-dd HH:mm" }}
</mat-cell>
</ng-container>

<mat-header-row class="datasets-header" *matHeaderRowDef="visibleColumns">
</mat-header-row>

<mat-row *matRowDef="let dataset; columns: visibleColumns"> </mat-row>
</mat-table>
</div>

<ng-template #empty_batch>
<mat-card class="empty-batch-message">
<mat-icon>info</mat-icon> There are no datasets in the batch.
</mat-card>
</ng-template>
</div>
<div style="margin-top: 1em">
<div *ngIf="hasBatch; else empty_batch">
<div style="text-align: right; margin-bottom: 1em">
<button (click)="onEmpty()" mat-button class="button" color="primary">
<mat-icon> remove_shopping_cart </mat-icon>
Empty Cart
</button>
<button
mat-button
id="publishButton"
(click)="onPublish()"
class="button"
color="primary"
>
<mat-icon> school </mat-icon>
Publish
</button>
<ng-container *ngIf="shareEnabled">
<button
mat-button
(click)="onShare()"
id="shareButton"
class="button"
color="primary"
>
<mat-icon> share </mat-icon>
Share
</button>
</ng-container>
<ng-container *ngIf="appConfig.archiveWorkflowEnabled">
<button mat-button (click)="onArchive()" class="button" color="primary">
<mat-icon> archive </mat-icon>
Archive
</button>
<button
mat-button
(click)="onRetrieve()"
class="button"
color="primary"
>
<mat-icon> cloud_download </mat-icon>
Retrieve
</button>
</ng-container>
</div>

<mat-table
[dataSource]="batch$"
class="mat-elevation-z2"
style="margin-left: 1em"
>
<ng-container matColumnDef="remove">
<mat-header-cell *matHeaderCellDef>
<div fxLayout="column" style="align-items: center">
<div>
<mat-icon> remove_circle </mat-icon>
</div>
<div>Remove</div>
</div>
</mat-header-cell>

<mat-cell *matCellDef="let dataset">
<button mat-icon-button color="warn" (click)="onRemove(dataset)">
<mat-icon> remove_circle </mat-icon>
</button>
</mat-cell>
</ng-container>

<ng-container matColumnDef="pid">
<mat-header-cell *matHeaderCellDef>
<div fxLayout="column" style="align-items: center">
<div>
<mat-icon> perm_contact_calendar </mat-icon>
</div>
<div>PID</div>
</div>
</mat-header-cell>
<mat-cell *matCellDef="let dataset">{{ dataset.pid }}</mat-cell>
</ng-container>

<ng-container matColumnDef="sourceFolder">
<mat-header-cell *matHeaderCellDef>
<div fxLayout="column" style="align-items: center">
<div>
<mat-icon> folder </mat-icon>
</div>
<div>Source Folder</div>
</div>
</mat-header-cell>
<mat-cell *matCellDef="let dataset">{{
dataset.sourceFolder
}}</mat-cell>
</ng-container>

<ng-container matColumnDef="size">
<mat-header-cell *matHeaderCellDef>
<div fxLayout="column" style="align-items: center">
<div>
<mat-icon> save </mat-icon>
</div>
<div>Size</div>
</div>
</mat-header-cell>
<mat-cell *matCellDef="let dataset">
{{ dataset.size | filesize }}
</mat-cell>
</ng-container>

<ng-container matColumnDef="creationTime">
<mat-header-cell *matHeaderCellDef>
<div fxLayout="column" style="align-items: center">
<div>
<mat-icon> calendar_today </mat-icon>
</div>
<div>Creation Time</div>
</div>
</mat-header-cell>
<mat-cell *matCellDef="let dataset">
{{ dataset.creationTime | date: "yyyy-MM-dd HH:mm" }}
</mat-cell>
</ng-container>

<mat-header-row class="datasets-header" *matHeaderRowDef="visibleColumns">
</mat-header-row>

<mat-row *matRowDef="let dataset; columns: visibleColumns"> </mat-row>
</mat-table>
</div>

<ng-template #empty_batch>
<mat-card class="empty-batch-message">
<mat-icon>info</mat-icon> There are no datasets in the batch.
</mat-card>
</ng-template>
</div>
Loading