|
1 | | -<div *ngIf="isAdmin$ | async"> |
2 | | -<div *ngIf="(versionsDTO$ | async) as versionsDTO; else noItemVersion" class="mb-2"> |
3 | | - <div *ngIf="(versionRD$ | async)?.payload as itemVersion"> |
4 | | - <h2 *ngIf="displayTitle" class="h4">{{ "item.version.history.head" | translate }}</h2> |
5 | | - <ds-alert [type]="AlertTypeEnum.Info"> |
6 | | - {{ "item.version.history.selected.alert" | translate : { version: itemVersion.version } }} |
7 | | - </ds-alert> |
8 | | - <ds-pagination *ngIf="versionsDTO.versionDTOs.length > 0" |
9 | | - (paginationChange)="onPageChange()" |
10 | | - [hideGear]="true" |
11 | | - [hidePagerWhenSinglePage]="true" |
12 | | - [paginationOptions]="options" |
13 | | - [collectionSize]="versionsDTO.totalElements" |
14 | | - [retainScrollPosition]="true"> |
15 | | - <table class="table table-striped table-bordered align-middle my-2"> |
16 | | - <thead> |
17 | | - <tr> |
18 | | - <th scope="col">{{ "item.version.history.table.version" | translate }}</th> |
19 | | - <th scope="col" *ngIf="(showSubmitter() | async)">{{ "item.version.history.table.editor" | translate }}</th> |
20 | | - <th scope="col">{{ "item.version.history.table.date" | translate }}</th> |
21 | | - <th scope="col">{{ "item.version.history.table.summary" | translate }}</th> |
22 | | - </tr> |
23 | | - </thead> |
24 | | - <tbody> |
25 | | - <tr *ngFor="let versionDTO of versionsDTO.versionDTOs" [id]="'version-row-' + versionDTO.version.id"> |
26 | | - <td class="version-row-element-version"> |
27 | | - <!-- Get the ID of the workspace/workflow item (`undefined` if they don't exist). |
28 | | - Conditionals inside *ngVar are needed in order to avoid useless calls. --> |
29 | | - <ng-container |
30 | | - *ngVar="((hasDraftVersion$ | async) ? getWorkspaceId(versionDTO.version.item) : undefined) as workspaceId$"> |
| 1 | +<section *ngIf="isAdmin$ | async"> |
| 2 | + <div *ngIf="(versionsDTO$ | async) as versionsDTO; else noItemVersion" class="mb-2"> |
| 3 | + <div *ngIf="(versionRD$ | async)?.payload as itemVersion"> |
| 4 | + <h2 *ngIf="displayTitle" class="h4">{{ "item.version.history.head" | translate }}</h2> |
| 5 | + <ds-alert [type]="AlertTypeEnum.Info"> |
| 6 | + {{ "item.version.history.selected.alert" | translate : { version: itemVersion.version } }} |
| 7 | + </ds-alert> |
| 8 | + <ds-pagination *ngIf="versionsDTO.versionDTOs.length > 0" |
| 9 | + (paginationChange)="onPageChange()" |
| 10 | + [hideGear]="true" |
| 11 | + [hidePagerWhenSinglePage]="true" |
| 12 | + [paginationOptions]="options" |
| 13 | + [collectionSize]="versionsDTO.totalElements" |
| 14 | + [retainScrollPosition]="true"> |
| 15 | + <table class="table table-striped table-bordered align-middle my-2"> |
| 16 | + <thead> |
| 17 | + <tr> |
| 18 | + <th scope="col">{{ "item.version.history.table.version" | translate }}</th> |
| 19 | + <th scope="col" *ngIf="(showSubmitter() | async)">{{ "item.version.history.table.editor" | translate }}</th> |
| 20 | + <th scope="col">{{ "item.version.history.table.date" | translate }}</th> |
| 21 | + <th scope="col">{{ "item.version.history.table.summary" | translate }}</th> |
| 22 | + </tr> |
| 23 | + </thead> |
| 24 | + <tbody> |
| 25 | + <tr *ngFor="let versionDTO of versionsDTO.versionDTOs" [id]="'version-row-' + versionDTO.version.id"> |
| 26 | + <td class="version-row-element-version"> |
| 27 | + <!-- Get the ID of the workspace/workflow item (`undefined` if they don't exist). |
| 28 | + Conditionals inside *ngVar are needed in order to avoid useless calls. --> |
31 | 29 | <ng-container |
32 | | - *ngVar=" ((workspaceId$ | async) ? undefined : getWorkflowId(versionDTO.version.item)) as workflowId$"> |
| 30 | + *ngVar="((hasDraftVersion$ | async) ? getWorkspaceId(versionDTO.version.item) : undefined) as workspaceId$"> |
| 31 | + <ng-container |
| 32 | + *ngVar=" ((workspaceId$ | async) ? undefined : getWorkflowId(versionDTO.version.item)) as workflowId$"> |
33 | 33 |
|
34 | | - <div class="left-column"> |
| 34 | + <div class="left-column"> |
35 | 35 |
|
36 | | - <span |
37 | | - *ngIf="(workspaceId$ | async) || (workflowId$ | async); then itemNameWithoutLink else itemNameWithLink"></span> |
38 | | - <ng-template #itemNameWithLink> |
39 | | - <ng-container *ngIf="(versionDTO.version.item | async)?.payload as versionItem"> |
40 | | - <a [routerLink]="getVersionRoute(versionDTO.version.id)"> |
| 36 | + <span |
| 37 | + *ngIf="(workspaceId$ | async) || (workflowId$ | async); then itemNameWithoutLink else itemNameWithLink"></span> |
| 38 | + <ng-template #itemNameWithLink> |
| 39 | + <ng-container *ngIf="(versionDTO.version.item | async)?.payload as versionItem"> |
| 40 | + <a [routerLink]="getVersionRoute(versionDTO.version.id)"> |
| 41 | + {{ versionItem.firstMetadataValue('dc.title') || versionItem.name || 'Untitled' }} |
| 42 | + </a> |
| 43 | + </ng-container> |
| 44 | + </ng-template> |
| 45 | + <ng-template #itemNameWithoutLink> |
| 46 | + <ng-container *ngIf="(versionDTO.version.item | async)?.payload as versionItem"> |
41 | 47 | {{ versionItem.firstMetadataValue('dc.title') || versionItem.name || 'Untitled' }} |
42 | | - </a> |
43 | | - </ng-container> |
44 | | - </ng-template> |
45 | | - <ng-template #itemNameWithoutLink> |
46 | | - <ng-container *ngIf="(versionDTO.version.item | async)?.payload as versionItem"> |
47 | | - {{ versionItem.firstMetadataValue('dc.title') || versionItem.name || 'Untitled' }} |
48 | | - </ng-container> |
49 | | - </ng-template> |
50 | | - <span *ngIf="versionDTO.version.id === itemVersion?.id">*</span> |
| 48 | + </ng-container> |
| 49 | + </ng-template> |
| 50 | + <span *ngIf="versionDTO.version.id === itemVersion?.id">*</span> |
51 | 51 |
|
52 | | - <span *ngIf="workspaceId$ | async" class="text-light badge badge-primary ml-3"> |
53 | | - {{ "item.version.history.table.workspaceItem" | translate }} |
54 | | - </span> |
| 52 | + <span *ngIf="workspaceId$ | async" class="text-light badge badge-primary ml-3"> |
| 53 | + {{ "item.version.history.table.workspaceItem" | translate }} |
| 54 | + </span> |
55 | 55 |
|
56 | | - <span *ngIf="workflowId$ | async" class="text-light badge badge-info ml-3"> |
57 | | - {{ "item.version.history.table.workflowItem" | translate }} |
58 | | - </span> |
| 56 | + <span *ngIf="workflowId$ | async" class="text-light badge badge-info ml-3"> |
| 57 | + {{ "item.version.history.table.workflowItem" | translate }} |
| 58 | + </span> |
59 | 59 |
|
60 | | - </div> |
| 60 | + </div> |
61 | 61 |
|
62 | | - <div class="right-column"> |
| 62 | + <div class="right-column"> |
63 | 63 |
|
64 | | - <div class="btn-group edit-field space-children-mr" *ngIf="displayActions"> |
65 | | - <!--EDIT WORKSPACE ITEM--> |
66 | | - <button class="btn btn-outline-primary btn-sm version-row-element-edit" |
67 | | - *ngIf="workspaceId$ | async" |
68 | | - (click)="editWorkspaceItem(workspaceId$)" |
69 | | - title="{{'item.version.history.table.action.editWorkspaceItem' | translate }}"> |
70 | | - <i class="fas fa-pencil-alt fa-fw"></i> |
71 | | - </button> |
72 | | - <!--CREATE--> |
73 | | - <ng-container *ngIf="canCreateVersion$ | async"> |
74 | | - <button class="btn btn-outline-primary btn-sm version-row-element-create" |
75 | | - [dsBtnDisabled]="isAnyBeingEdited() || (hasDraftVersion$ | async)" |
76 | | - (click)="createNewVersion(versionDTO.version)" |
77 | | - title="{{createVersionTitle$ | async | translate }}"> |
78 | | - <i class="fas fa-code-branch fa-fw"></i> |
| 64 | + <div class="btn-group edit-field space-children-mr" *ngIf="displayActions"> |
| 65 | + <!--EDIT WORKSPACE ITEM--> |
| 66 | + <button class="btn btn-outline-primary btn-sm version-row-element-edit" |
| 67 | + *ngIf="workspaceId$ | async" |
| 68 | + (click)="editWorkspaceItem(workspaceId$)" |
| 69 | + title="{{'item.version.history.table.action.editWorkspaceItem' | translate }}"> |
| 70 | + <i class="fas fa-pencil-alt fa-fw"></i> |
79 | 71 | </button> |
80 | | - </ng-container> |
81 | | - <!--DELETE--> |
82 | | - <ng-container *ngIf="versionDTO.canDeleteVersion"> |
83 | | - <button class="btn btn-sm version-row-element-delete" |
84 | | - [ngClass]="isAnyBeingEdited() ? 'btn-outline-primary' : 'btn-outline-danger'" |
85 | | - [dsBtnDisabled]="isAnyBeingEdited()" |
86 | | - (click)="deleteVersion(versionDTO.version, versionDTO.version.id==itemVersion.id)" |
87 | | - title="{{'item.version.history.table.action.deleteVersion' | translate}}"> |
88 | | - <i class="fas fa-trash fa-fw"></i> |
89 | | - </button> |
90 | | - </ng-container> |
91 | | - </div> |
| 72 | + <!--CREATE--> |
| 73 | + <ng-container *ngIf="canCreateVersion$ | async"> |
| 74 | + <button class="btn btn-outline-primary btn-sm version-row-element-create" |
| 75 | + [dsBtnDisabled]="isAnyBeingEdited() || (hasDraftVersion$ | async)" |
| 76 | + (click)="createNewVersion(versionDTO.version)" |
| 77 | + title="{{createVersionTitle$ | async | translate }}"> |
| 78 | + <i class="fas fa-code-branch fa-fw"></i> |
| 79 | + </button> |
| 80 | + </ng-container> |
| 81 | + <!--DELETE--> |
| 82 | + <ng-container *ngIf="versionDTO.canDeleteVersion"> |
| 83 | + <button class="btn btn-sm version-row-element-delete" |
| 84 | + [ngClass]="isAnyBeingEdited() ? 'btn-outline-primary' : 'btn-outline-danger'" |
| 85 | + [dsBtnDisabled]="isAnyBeingEdited()" |
| 86 | + (click)="deleteVersion(versionDTO.version, versionDTO.version.id==itemVersion.id)" |
| 87 | + title="{{'item.version.history.table.action.deleteVersion' | translate}}"> |
| 88 | + <i class="fas fa-trash fa-fw"></i> |
| 89 | + </button> |
| 90 | + </ng-container> |
| 91 | + </div> |
92 | 92 |
|
93 | | - </div> |
| 93 | + </div> |
94 | 94 |
|
| 95 | + </ng-container> |
95 | 96 | </ng-container> |
96 | | - </ng-container> |
97 | | - </td> |
98 | | - <td class="version-row-element-editor" *ngIf="(showSubmitter() | async)"> |
99 | | - {{ versionDTO.version.submitterName }} |
100 | | - </td> |
101 | | - <td class="version-row-element-date"> |
102 | | - {{ versionDTO.version.created | date : 'yyyy-MM-dd HH:mm:ss' }} |
103 | | - </td> |
104 | | - <td class="version-row-element-summary"> |
105 | | - <div class="float-left"> |
106 | | - <ng-container |
107 | | - *ngIf="isThisBeingEdited(versionDTO.version); then editSummary else showSummary"></ng-container> |
108 | | - <ng-template #showSummary>{{ versionDTO.version.summary }}</ng-template> |
109 | | - <ng-template #editSummary> |
110 | | - <input [attr.aria-label]="'item.version.history.table.action.editSummary' | translate" |
111 | | - [(ngModel)]="versionBeingEditedSummary" (keyup.enter)="onSummarySubmit()" |
112 | | - class="form-control" type="text"/> |
113 | | - </ng-template> |
114 | | - </div> |
| 97 | + </td> |
| 98 | + <td class="version-row-element-editor" *ngIf="(showSubmitter() | async)"> |
| 99 | + {{ versionDTO.version.submitterName }} |
| 100 | + </td> |
| 101 | + <td class="version-row-element-date"> |
| 102 | + {{ versionDTO.version.created | date : 'yyyy-MM-dd HH:mm:ss' }} |
| 103 | + </td> |
| 104 | + <td class="version-row-element-summary"> |
| 105 | + <div class="float-left"> |
| 106 | + <ng-container |
| 107 | + *ngIf="isThisBeingEdited(versionDTO.version); then editSummary else showSummary"></ng-container> |
| 108 | + <ng-template #showSummary>{{ versionDTO.version.summary }}</ng-template> |
| 109 | + <ng-template #editSummary> |
| 110 | + <input [attr.aria-label]="'item.version.history.table.action.editSummary' | translate" |
| 111 | + [(ngModel)]="versionBeingEditedSummary" (keyup.enter)="onSummarySubmit()" |
| 112 | + class="form-control" type="text"/> |
| 113 | + </ng-template> |
| 114 | + </div> |
115 | 115 |
|
116 | | - <div class="float-right btn-group edit-field space-children-mr" *ngIf="displayActions"> |
117 | | - <!--DISCARD EDIT --> |
118 | | - <ng-container *ngIf="(versionDTO.canEditVersion | async) && isThisBeingEdited(versionDTO.version)"> |
119 | | - <button class="btn btn-sm" |
120 | | - [ngClass]="isThisBeingEdited(versionDTO.version) ? 'btn-outline-warning' : 'btn-outline-primary'" |
121 | | - (click)="disableVersionEditing()" |
122 | | - title="{{'item.version.history.table.action.discardSummary' | translate}}"> |
123 | | - <i class="fas fa-undo-alt fa-fw"></i> |
124 | | - </button> |
125 | | - </ng-container> |
126 | | - <!--EDIT / SAVE--> |
127 | | - <ng-container *ngIf="versionDTO.canEditVersion | async"> |
128 | | - <button class="btn btn-outline-primary btn-sm version-row-element-edit" |
129 | | - *ngIf="!isThisBeingEdited(versionDTO.version)" |
130 | | - [dsBtnDisabled]="isAnyBeingEdited()" |
131 | | - (click)="enableVersionEditing(versionDTO.version)" |
132 | | - title="{{'item.version.history.table.action.editSummary' | translate}}"> |
133 | | - <i class="fas fa-edit fa-fw"></i> |
134 | | - </button> |
135 | | - <button class="btn btn-outline-success btn-sm" |
136 | | - *ngIf="isThisBeingEdited(versionDTO.version)" |
137 | | - (click)="onSummarySubmit()" |
138 | | - title="{{'item.version.history.table.action.saveSummary' | translate}}"> |
139 | | - <i class="fas fa-check fa-fw"></i> |
140 | | - </button> |
141 | | - </ng-container> |
142 | | - </div> |
143 | | - </td> |
144 | | - </tr> |
145 | | - </tbody> |
146 | | - </table> |
147 | | - <div>* {{ "item.version.history.selected" | translate }}</div> |
148 | | - </ds-pagination> |
| 116 | + <div class="float-right btn-group edit-field space-children-mr" *ngIf="displayActions"> |
| 117 | + <!--DISCARD EDIT --> |
| 118 | + <ng-container *ngIf="(versionDTO.canEditVersion | async) && isThisBeingEdited(versionDTO.version)"> |
| 119 | + <button class="btn btn-sm" |
| 120 | + [ngClass]="isThisBeingEdited(versionDTO.version) ? 'btn-outline-warning' : 'btn-outline-primary'" |
| 121 | + (click)="disableVersionEditing()" |
| 122 | + title="{{'item.version.history.table.action.discardSummary' | translate}}"> |
| 123 | + <i class="fas fa-undo-alt fa-fw"></i> |
| 124 | + </button> |
| 125 | + </ng-container> |
| 126 | + <!--EDIT / SAVE--> |
| 127 | + <ng-container *ngIf="versionDTO.canEditVersion | async"> |
| 128 | + <button class="btn btn-outline-primary btn-sm version-row-element-edit" |
| 129 | + *ngIf="!isThisBeingEdited(versionDTO.version)" |
| 130 | + [dsBtnDisabled]="isAnyBeingEdited()" |
| 131 | + (click)="enableVersionEditing(versionDTO.version)" |
| 132 | + title="{{'item.version.history.table.action.editSummary' | translate}}"> |
| 133 | + <i class="fas fa-edit fa-fw"></i> |
| 134 | + </button> |
| 135 | + <button class="btn btn-outline-success btn-sm" |
| 136 | + *ngIf="isThisBeingEdited(versionDTO.version)" |
| 137 | + (click)="onSummarySubmit()" |
| 138 | + title="{{'item.version.history.table.action.saveSummary' | translate}}"> |
| 139 | + <i class="fas fa-check fa-fw"></i> |
| 140 | + </button> |
| 141 | + </ng-container> |
| 142 | + </div> |
| 143 | + </td> |
| 144 | + </tr> |
| 145 | + </tbody> |
| 146 | + </table> |
| 147 | + <div>* {{ "item.version.history.selected" | translate }}</div> |
| 148 | + </ds-pagination> |
| 149 | + </div> |
149 | 150 | </div> |
150 | | -</div> |
151 | | -<ng-template #noItemVersion> |
152 | | - <ds-alert *ngIf="displayWhenEmpty" |
153 | | - [content]="'item.version.history.empty'" |
154 | | - [type]="AlertTypeEnum.Info"> |
155 | | - </ds-alert> |
156 | | -</ng-template> |
157 | | -</div> |
| 151 | + <ng-template #noItemVersion> |
| 152 | + <ds-alert *ngIf="displayWhenEmpty" |
| 153 | + [content]="'item.version.history.empty'" |
| 154 | + [type]="AlertTypeEnum.Info"> |
| 155 | + </ds-alert> |
| 156 | + </ng-template> |
| 157 | +</section> |
0 commit comments