TSK-1221: Added copy functionality to classifications
This commit is contained in:
parent
018ac2ebc1
commit
b0dc2663e5
|
@ -12,12 +12,15 @@
|
|||
<button type="button" (click)="onRestore()" class="btn btn-default" data-toggle="tooltip" title="Restore Previous Version">
|
||||
<span class="material-icons md-20 blue">restore</span>
|
||||
</button>
|
||||
<button type="button" (click)="onCopy()" data-toggle="tooltip" title="Copy" class="btn btn-default">
|
||||
<span class="material-icons md-20 green-blue">content_copy</span>
|
||||
</button>
|
||||
<button type="button" (click)="removeClassification()" data-toggle="tooltip" title="Delete" class="btn btn-default">
|
||||
<span class="material-icons md-20 red">delete</span>
|
||||
</button>
|
||||
</div>
|
||||
<h4 class="panel-header">{{classification.name}} [{{classification.type}}]
|
||||
<span *ngIf="action=== 0" class="badge warning"> {{badgeMessage}}</span>
|
||||
<span *ngIf="action" class="badge warning"> {{badgeMessage}}</span>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
|
@ -30,9 +33,9 @@
|
|||
<!-- KEY -->
|
||||
<div class="form-group required">
|
||||
<label for="classification-key" class="control-label">Key</label>
|
||||
<input type="text" required #key="ngModel" [disabled]="action!== 0" class="form-control"
|
||||
<input type="text" required #key="ngModel" [disabled]="!action" class="form-control"
|
||||
id="classification-key" placeholder="Key" [(ngModel)]="classification.key" name="classification.key">
|
||||
<taskana-field-error-display *ngIf="action === 0" [displayError]="!isFieldValid('classification.key')"
|
||||
<taskana-field-error-display *ngIf="action" [displayError]="!isFieldValid('classification.key')"
|
||||
[validationTrigger]="this.toogleValidationMap.get('classification.key')" errorMessage="* Key is required">
|
||||
</taskana-field-error-display>
|
||||
</div>
|
||||
|
|
|
@ -28,7 +28,8 @@ import { ClassificationCategoryImages,
|
|||
import { CreateClassification,
|
||||
RemoveSelectedClassification,
|
||||
RestoreSelectedClassification,
|
||||
SaveClassification } from '../../../shared/store/classification-store/classification.actions';
|
||||
SaveClassification,
|
||||
SetActiveAction } from '../../../shared/store/classification-store/classification.actions';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-classification-details',
|
||||
|
@ -82,6 +83,8 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
this.classification = { ...initialClassification };
|
||||
});
|
||||
this.badgeMessage = 'Creating new classification';
|
||||
} else if (this.action === ACTION.COPY) {
|
||||
this.badgeMessage = `Copying Classification: ${this.classification.name}`;
|
||||
} else {
|
||||
this.badgeMessage = '';
|
||||
}
|
||||
|
@ -131,6 +134,11 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
onCopy() {
|
||||
this.store.dispatch(new SetActiveAction(ACTION.COPY));
|
||||
this.classification.key = '';
|
||||
}
|
||||
|
||||
selectCategory(category: string) {
|
||||
this.classification.category = category;
|
||||
}
|
||||
|
@ -157,7 +165,8 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
|
||||
private async onSave() {
|
||||
this.requestInProgressService.setRequestInProgress(true);
|
||||
if (this.action === ACTION.CREATE) {
|
||||
if (this.action) {
|
||||
this.classification.classificationId = null; // in case the id has been set, but a new classification should be created
|
||||
this.store.dispatch(
|
||||
new CreateClassification(this.classification)
|
||||
).pipe(take(1)).subscribe(store => {
|
||||
|
|
Loading…
Reference in New Issue