Skip to content
Draft
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
95 changes: 5 additions & 90 deletions src/app/datasets/batch-view/batch-view.component.html
Original file line number Diff line number Diff line change
@@ -1,44 +1,6 @@
<div style="margin-top: 1em">
<div *ngIf="hasBatch; else empty_batch">
<div style="text-align: right; margin-bottom: 1em">
<div *ngIf="editingPublishedDataDoi">
You are currently editing
<a (click)="onCancelEdit()">{{ editingPublishedDataDoi }}</a>
dataset list.
</div>
<button
*ngIf="editingPublishedDataDoi"
mat-button
id="changeSelectionButton"
(click)="onChangeSelection()"
class="button"
color="primary"
>
<mat-icon> edit </mat-icon>
Select new datasets
</button>
<button
*ngIf="editingPublishedDataDoi"
mat-button
id="saveChangesButton"
(click)="onSaveChanges()"
class="button"
color="primary"
>
<mat-icon> save </mat-icon>
Save Changes
</button>
<button
*ngIf="editingPublishedDataDoi"
mat-button
id="cancelButton"
(click)="onCancelEdit()"
class="button"
color="warn"
>
<mat-icon> close </mat-icon>
Cancel
</button>
<div class="batch-actions" fxLayout="row" fxLayoutAlign="end center">
<button
*ngIf="!editingPublishedDataDoi"
(click)="onEmpty()"
Expand All @@ -49,58 +11,11 @@
<mat-icon> remove_circle_outline </mat-icon>
Empty Selection
</button>
<button
*ngIf="!editingPublishedDataDoi"
mat-button
id="exportCsvButton"
(click)="onExportCsv()"
class="button"
color="primary"
>
<mat-icon> download </mat-icon>
Export CSV
</button>
<button
*ngIf="!editingPublishedDataDoi"
mat-button
id="publishButton"
(click)="onPublish()"
class="button"
color="primary"
>
<mat-icon> school </mat-icon>
Publish
</button>
<ng-container *ngIf="shareEnabled">
<button
*ngIf="!editingPublishedDataDoi"
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>
<configurable-actions
[actionsConfig]="appConfig.datasetSelectionActions"
[actionItems]="actionItems"
></configurable-actions>
</div>

<mat-table
[dataSource]="batch$"
class="mat-elevation-z2"
Expand Down
8 changes: 8 additions & 0 deletions src/app/datasets/batch-view/batch-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ import { DatasetsListService } from "shared/services/datasets-list.service";
import { fetchInstrumentsAction } from "state-management/actions/instruments.actions";
import { TranslateService } from "@ngx-translate/core";
import { translateComponentLabel } from "shared/pipes/component-translate.pipe";
import {
ActionItemDataset,
ActionItems,
} from "shared/modules/configurable-actions/configurable-action.interfaces";

@Component({
selector: "batch-view",
Expand All @@ -56,6 +60,9 @@ export class BatchViewComponent implements OnInit, OnDestroy {
shareEnabled = this.appConfig.shareEnabled;

datasetList: OutputDatasetObsoleteDto[] = [];
actionItems: ActionItems = {
datasets: [],
};
public hasBatch = false;
visibleColumns: string[] = ["remove", "pid", "sourceFolder", "creationTime"];

Expand Down Expand Up @@ -349,6 +356,7 @@ export class BatchViewComponent implements OnInit, OnDestroy {
this.batch$.subscribe((result) => {
if (result) {
this.datasetList = result;
this.actionItems.datasets = <ActionItemDataset[]>result;
this.hasBatch = result.length > 0;
}
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,8 @@
<ng-template [ngIf]="dataset">
<div fxLayout="row">
<div fxFlex="auto">
<a
mat-raised-button
href="{{ appConfig.jupyterHubUrl }}"
target="_blank"
rel="noopener noreferrer"
class="jupyter-button"
*ngIf="appConfig.jupyterHubUrl"
>
Jupyter Hub
</a>
</div>
<div fxFlex="auto" *ngIf="editingAllowed">
<mat-slide-toggle
class="public-toggle"
[checked]="dataset.isPublished"
(change)="onSlidePublic($event)"
>
Public
</mat-slide-toggle>
</div>
</div>
<configurable-actions
[actionsConfig]="appConfig.datasetDetailsActions"
[actionItems]="actionItems"
></configurable-actions>
<div style="clear: both"></div>
<div fxLayout="row" fxLayout.xs="column" *ngIf="dataset">
<div [fxFlex]="(attachments$ | async)?.length > 0 ? '90%' : '100%'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ import {
OutputSampleDto,
} from "@scicatproject/scicat-sdk-ts-angular";
import { AttachmentService } from "shared/services/attachment.service";
import {
ActionItemDataset,
ActionItems,
} from "shared/modules/configurable-actions/configurable-action.interfaces";

/**
* Component to show details for a data set, using the
Expand Down Expand Up @@ -75,6 +79,9 @@ export class DatasetDetailComponent implements OnInit, OnDestroy {

localization = "dataset";
dataset: OutputDatasetObsoleteDto | undefined;
actionItems: ActionItems = {
datasets: [],
};
datasetWithout$ = this.store.select(selectCurrentDatasetWithoutFileInfo);
attachments$ = this.store.select(selectCurrentAttachments);
loading$ = this.store.select(selectIsLoading);
Expand Down Expand Up @@ -107,6 +114,7 @@ export class DatasetDetailComponent implements OnInit, OnDestroy {
this.subscriptions.push(
this.store.select(selectCurrentDataset).subscribe((dataset) => {
this.dataset = dataset;
this.actionItems.datasets = <ActionItemDataset[]>[dataset];
if (this.dataset) {
combineLatest([this.accessGroups$, this.isAdmin$]).subscribe(
([groups, isAdmin]) => {
Expand Down
Loading