diff --git a/src/app/shared/entry/doi/manage-dois/manage-dois-dialog.component.html b/src/app/shared/entry/doi/manage-dois/manage-dois-dialog.component.html
index 13c8b6fcd..100578564 100644
--- a/src/app/shared/entry/doi/manage-dois/manage-dois-dialog.component.html
+++ b/src/app/shared/entry/doi/manage-dois/manage-dois-dialog.component.html
@@ -1,47 +1,94 @@
Manage DOIs
-
- A Digital Object Identifier (DOI) allows a {{ entryTypeMetadata.term }} version to be easily cited in publications. There are two types
- of DOIs:
-
-
- Version DOI: represents a specific version.
- Concept DOI: represents all versions and resolves to the latest one.
-
-
- info This {{ entryTypeMetadata.term }} has no DOIs.
-
- Select which DOI to display publicly:
-
-
-
-
-
-
{{ doiInfo.key | titlecase }}
-
-
-
-
- Manually created by a user in the Dockstore UI.
-
- Automatically created by Dockstore for valid tags belonging to published {{ entryTypeMetadata.termPlural }}.
-
- Created by Zenodo's integration with GitHub.
-
-
- Version DOI:
-
- n/a
-
-
- Concept DOI:
-
-
-
+
+
+
+ A Digital Object Identifier (DOI) allows a {{ entryTypeMetadata.term }} version to be easily cited in publications. There are two
+ types of DOIs:
+
+
+ Version DOI: represents a specific version.
+ Concept DOI: represents all versions and resolves to the latest one.
+
+
+
+
Automatic DOI Generation:
+
{{ isAutoDoiEnabled ? 'On' : 'Off' }}
+
{{ isAutoDoiEnabled ? 'On' : 'Off' }}
+
+
+
+
+ Dockstore automatically creates a DOI for each valid, tagged version of this {{ entryTypeMetadata.term }} if it is published. It
+ does not require a Zenodo account to be linked.
+
+
+ Edit the enableAutoDoi field in the .dockstore.yml to change your Automatic DOI Generation preference.
+
+ info
+
+
+
+
DOI Selection
+
Select which DOI to display publicly:
+
+ info This {{ entryTypeMetadata.term }} has no DOIs.
-
+
+
+
+
+
+
{{ doiInfo.key | titlecase }}
+
+
+
+
+ Manually created by a user in the Dockstore UI.
+
+ Automatically created by Dockstore for valid tags belonging to published {{ entryTypeMetadata.termPlural }}.
+
+ Created by Zenodo's integration with GitHub.
+
+
+
+
+ Version DOI:
+
+ n/a
+
+
+ Concept DOI:
+
+
+
+
+
+
+
- Cancel
- Save
+ Done
diff --git a/src/app/shared/entry/doi/manage-dois/manage-dois-dialog.component.ts b/src/app/shared/entry/doi/manage-dois/manage-dois-dialog.component.ts
index 595d86aa6..c64789761 100644
--- a/src/app/shared/entry/doi/manage-dois/manage-dois-dialog.component.ts
+++ b/src/app/shared/entry/doi/manage-dois/manage-dois-dialog.component.ts
@@ -10,6 +10,9 @@ import { Doi, EntryTypeMetadata, Workflow, WorkflowVersion } from 'app/shared/op
import { ManageDoisDialogService } from './manage-dois-dialog.service';
import { MatIconModule } from '@angular/material/icon';
import { DoiBadgeComponent } from '../doi-badge/doi-badge.component';
+import { MatLegacySlideToggleModule } from '@angular/material/legacy-slide-toggle';
+import { Dockstore } from 'app/shared/dockstore.model';
+import { AlertComponent } from 'app/shared/alert/alert.component';
export interface ManageDoisDialogData {
entry: Workflow;
@@ -32,6 +35,7 @@ export interface DoiInfo {
MatLegacyButtonModule,
MatLegacyCardModule,
MatLegacyRadioModule,
+ MatLegacySlideToggleModule,
MatIconModule,
FlexModule,
FormsModule,
@@ -40,14 +44,18 @@ export interface DoiInfo {
KeyValuePipe,
TitleCasePipe,
DoiBadgeComponent,
+ AlertComponent,
],
})
export class ManageDoisDialogComponent {
+ Dockstore = Dockstore;
DoiInitiatorEnum = Doi.InitiatorEnum;
entry: Workflow;
entryTypeMetadata: EntryTypeMetadata;
selectedOption: Doi.InitiatorEnum;
doiInfoMap: Map = new Map();
+ isAutoDoiEnabled: boolean;
+ isGitHubAppEntry: boolean;
constructor(
public dialogRef: MatLegacyDialogRef,
@@ -57,6 +65,8 @@ export class ManageDoisDialogComponent {
this.entry = data.entry;
this.entryTypeMetadata = data.entry.entryTypeMetadata;
this.selectedOption = data.entry.doiSelection;
+ this.isAutoDoiEnabled = data.entry.autoGenerateDois;
+ this.isGitHubAppEntry = data.entry.mode === Workflow.ModeEnum.DOCKSTOREYML;
Object.entries(data.entry.conceptDois).forEach(([initiator, conceptDoi]) => {
let initiatorEnum = Object.keys(Doi.InitiatorEnum).find((i) => Doi.InitiatorEnum[i] === initiator);
let versionDoi = data.version?.dois[initiator];
@@ -68,6 +78,14 @@ export class ManageDoisDialogComponent {
});
}
+ /**
+ * Called on slide toggle to enable or disable auto DOI generation
+ * @param event toggle event
+ */
+ toggleAutoDoiGeneration() {
+ this.manageDoisDialogService.toggleAutoDoiGeneration(this.entry, this.isAutoDoiEnabled);
+ }
+
saveDoiSelection() {
this.manageDoisDialogService.saveDoiSelection(this.entry, this.selectedOption);
}
diff --git a/src/app/shared/entry/doi/manage-dois/manage-dois-dialog.service.ts b/src/app/shared/entry/doi/manage-dois/manage-dois-dialog.service.ts
index 3883b8c62..78c1c5a33 100644
--- a/src/app/shared/entry/doi/manage-dois/manage-dois-dialog.service.ts
+++ b/src/app/shared/entry/doi/manage-dois/manage-dois-dialog.service.ts
@@ -21,7 +21,7 @@ export class ManageDoisDialogService {
this.workflowsService.updateWorkflow(entry.id, newEntryForUpdate).subscribe(
(response) => {
- this.alertService.detailedSuccess();
+ this.alertService.simpleSuccess();
this.workflowService.setWorkflow({ ...this.workflowQuery.getActive(), doiSelection: response.doiSelection });
},
(error) => {
@@ -29,4 +29,17 @@ export class ManageDoisDialogService {
}
);
}
+
+ toggleAutoDoiGeneration(entry: Workflow, isAutoDoiEnabled: boolean) {
+ this.alertService.start((isAutoDoiEnabled ? 'Enabling' : 'Disabling') + ' automatic DOI generation');
+ this.workflowsService.autoGenerateDois(entry.id, { autoGenerateDois: isAutoDoiEnabled }).subscribe(
+ (response) => {
+ this.alertService.simpleSuccess();
+ this.workflowService.setWorkflow({ ...this.workflowQuery.getActive(), autoGenerateDois: response });
+ },
+ (error) => {
+ this.alertService.detailedError(error);
+ }
+ );
+ }
}
diff --git a/src/app/workflow/workflow.component.html b/src/app/workflow/workflow.component.html
index 575d09099..9b3b53e72 100644
--- a/src/app/workflow/workflow.component.html
+++ b/src/app/workflow/workflow.component.html
@@ -171,7 +171,7 @@
class="private-btn small-btn-structure ml-2"
matTooltip="Manage DOIs"
(click)="manageDois()"
- [disabled]="!canWrite"
+ [disabled]="!canWrite || (isRefreshing$ | async)"
>
Manage DOIs
@@ -204,7 +204,7 @@
mat-button
class="private-btn small-btn-structure"
(click)="toggleLabelsEditMode()"
- [disabled]="!canWrite"
+ [disabled]="!canWrite || (isRefreshing$ | async)"
>
Manage labels