reloadPage & delete buttons updated

This commit is contained in:
gpapavgeri 2020-07-22 14:26:49 +03:00
parent cd554dc1d1
commit 868678e03f
16 changed files with 114 additions and 32 deletions

View File

@ -22,6 +22,7 @@ import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { UiNotificationService } from '@app/core/services/notification/ui-notification-service';
import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dmp-invitation-dialog.component';
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { Location } from '@angular/common';
@Component({
selector: 'app-drafts',
@ -55,7 +56,8 @@ export class DraftsComponent extends BaseComponent implements OnInit {
public dialog: MatDialog,
private datasetWizardService: DatasetWizardService,
public enumUtils: EnumUtils,
private uiNotificationService: UiNotificationService
private uiNotificationService: UiNotificationService,
private location: Location
) {
super();
}
@ -170,8 +172,8 @@ export class DraftsComponent extends BaseComponent implements OnInit {
this.datasetWizardService.delete(id)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => this.onCallbackSuccess(),
error => this.onCallbackError(error)
complete => this.onDeleteCallbackSuccess(),
error => this.onDeleteCallbackError(error)
);
}
});
@ -198,6 +200,22 @@ export class DraftsComponent extends BaseComponent implements OnInit {
// this.setErrorModel(error.error);
}
reloadPage(): void {
const path = this.location.path();
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
this.router.navigate([path]);
});
}
onDeleteCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success);
this.reloadPage();
}
onDeleteCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
}
downloadPDF(dataset: DatasetListingModel): void {
this.datasetWizardService.downloadPDF(dataset.id as string)
.pipe(takeUntil(this._destroyed))

View File

@ -82,7 +82,7 @@
<button mat-menu-item (click)="viewVersions(getGroupId(activity), activity.title)">
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
</button>
<button mat-menu-item *ngIf="isUserOwner(activity)" (click)="deleteClicked()" class="menu-item">
<button mat-menu-item *ngIf="isUserOwner(activity)" (click)="deleteClicked(activity)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}
</button>
</mat-menu>

View File

@ -30,6 +30,7 @@ import { DatasetWizardService } from '@app/core/services/dataset-wizard/dataset-
import { FormControl, FormBuilder } from '@angular/forms';
import { DatasetCopyDialogueComponent } from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { Location } from '@angular/common';
@Component({
selector: 'app-recent-edited-activity',
@ -64,7 +65,8 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
private language: TranslateService,
private dialog: MatDialog,
private uiNotificationService: UiNotificationService,
private datasetWizardService: DatasetWizardService
private datasetWizardService: DatasetWizardService,
private location: Location
) {
super();
}
@ -158,7 +160,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
this.dmpService.delete(dmp.id)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => { this.onCallbackSuccess() },
complete => this.onDeleteCallbackSuccess(),
error => this.onDeleteCallbackError(error)
);
}
@ -186,6 +188,18 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
this.router.navigate(['/plans']);
}
reloadPage(): void {
const path = this.location.path();
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
this.router.navigate([path]);
});
}
onDeleteCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success);
this.reloadPage();
}
onDeleteCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
}
@ -394,8 +408,8 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
this.datasetWizardService.delete(id)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => this.onCallbackSuccess(),
// error => this.onCallbackError(error)
complete => this.onDeleteCallbackSuccess(),
error => this.onDeleteCallbackError(error)
);
}
});

View File

@ -54,7 +54,7 @@
<button mat-menu-item *ngIf="isAuthenticated()" (click)="openDmpSearchDialogue(activity.id)" class="menu-item">
<mat-icon>file_copy</mat-icon>{{'DATASET-WIZARD.ACTIONS.COPY-DATASET' | translate}}
</button>
<button mat-menu-item *ngIf="isUserOwner" (click)="openConfirm(activity.id)" class="menu-item">
<button mat-menu-item *ngIf="isUserOwner(activity)" (click)="openConfirm(activity.id)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }}
</button>
<!-- <button mat-menu-item *ngIf="needsUpdate(activity)" class="menu-item" (click)="openUpdateDatasetProfileDialogue(activity.id);">

View File

@ -23,6 +23,7 @@ import { DatasetStatus } from '@app/core/common/enum/dataset-status';
import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dmp-invitation-dialog.component';
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { Role } from '@app/core/common/enum/role';
import { Location } from '@angular/common';
@Component({
selector: 'app-recent-edited-dataset-activity',
@ -53,7 +54,8 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
public dialog: MatDialog,
public router: Router,
private datasetWizardService: DatasetWizardService,
private uiNotificationService: UiNotificationService
private uiNotificationService: UiNotificationService,
private location: Location
) {
super();
}
@ -185,8 +187,8 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
this.datasetWizardService.delete(id)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => this.onCallbackSuccess(),
error => this.onCallbackError(error)
complete => this.onDeleteCallbackSuccess(),
error => this.onDeleteCallbackError(error)
);
}
});
@ -265,6 +267,22 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
this.setErrorModel(error.error);
}
reloadPage(): void {
const path = this.location.path();
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
this.router.navigate([path]);
});
}
onDeleteCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success);
this.reloadPage();
}
onDeleteCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
}
openUpdateDatasetProfileDialogue(id: string) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
restoreFocus: false,

View File

@ -22,6 +22,7 @@ import { DatasetListingModel } from '@app/core/model/dataset/dataset-listing';
import { Role } from '@app/core/common/enum/role';
import { FormBuilder, FormControl } from '@angular/forms';
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { Location } from '@angular/common';
@Component({
selector: 'app-recent-edited-dmp-activity',
@ -55,7 +56,8 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
private datasetService: DatasetService,
private language: TranslateService,
private dialog: MatDialog,
private uiNotificationService: UiNotificationService
private uiNotificationService: UiNotificationService,
private location: Location
) {
super();
}
@ -143,7 +145,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
this.dmpService.delete(dmp.id)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => { this.onCallbackSuccess() },
complete => this.onDeleteCallbackSuccess(),
error => this.onDeleteCallbackError(error)
);
}
@ -171,6 +173,18 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
this.router.navigate(['/plans']);
}
reloadPage(): void {
const path = this.location.path();
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
this.router.navigate([path]);
});
}
onDeleteCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success);
this.reloadPage();
}
onDeleteCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
}

View File

@ -32,7 +32,7 @@
<button *ngIf="isAuthenticated()" mat-menu-item (click)="openDmpSearchDialogue(dataset)" class="menu-item">
<mat-icon>file_copy</mat-icon>{{'DATASET-WIZARD.ACTIONS.COPY-DATASET' | translate}}
</button>
<button *ngIf="isUserOwner && !lockStatus" mat-menu-item (click)="openConfirm(dataset.id)" class="menu-item">
<button *ngIf="isUserOwner" mat-menu-item (click)="openConfirm(dataset.id)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }}
</button>
<!-- <button mat-menu-item *ngIf="needsUpdate(activity)" class="menu-item" (click)="openUpdateDatasetProfileDialogue(activity.id);">

View File

@ -19,6 +19,7 @@ import { Principal } from '@app/core/model/auth/principal';
import { AuthService } from '@app/core/services/auth/auth.service';
import { LockService } from '@app/core/services/lock/lock.service';
import { Role } from '@app/core/common/enum/role';
import { Location } from '@angular/common';
@Component({
selector: 'app-dataset-listing-item-component',
@ -45,7 +46,8 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
private language: TranslateService,
private authentication: AuthService,
private uiNotificationService: UiNotificationService,
private lockService: LockService
private lockService: LockService,
private location: Location
) {
super();
}
@ -203,13 +205,14 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
}
reloadPage(): void {
const path = this.location.path();
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
this.router.navigate(['/datasets']);
this.router.navigate([path]);
});
}
onDeleteCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Success);
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success);
this.reloadPage();
}
@ -217,10 +220,10 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
}
// onCallbackSuccess(id?: String): void {
// this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
// id ? this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'edit', id]); }) : this.router.navigate(['/datasets']);
// }
onCallbackSuccess(id?: String): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
id ? this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'edit', id]); }) : this.router.navigate(['/datasets']);
}
roleDisplay(value: any) {
const principal: Principal = this.authentication.current();

View File

@ -166,10 +166,11 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
}
reloadPage(): void {
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
this.router.navigate([`/datasets/overview/${this.dataset.id}`]);
});
}
const path = this.location.path();
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
this.router.navigate([path]);
});
}
getDmpResearchers() {
this.dmpService.getSingle(this.dataset.dmp.id).pipe(takeUntil(this._destroyed))
@ -301,7 +302,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
}
onDeleteCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Success);
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success);
this.router.navigate(['/datasets']);
}

View File

@ -17,6 +17,7 @@ import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog
import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
import { Role } from '@app/core/common/enum/role';
import { LockService } from '@app/core/services/lock/lock.service';
import { Location } from '@angular/common';
@Component({
selector: 'app-dmp-listing-item-component',
@ -43,7 +44,8 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
private dmpService: DmpService,
private language: TranslateService,
private uiNotificationService: UiNotificationService,
private lockService: LockService) {
private lockService: LockService,
private location: Location) {
super();
}
@ -226,13 +228,14 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
}
reloadPage(): void {
const path = this.location.path();
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
this.router.navigate(['/plans']);
this.router.navigate([path]);
});
}
onDeleteCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Success);
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success);
this.reloadPage();
}
@ -240,6 +243,11 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
}
onCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
this.router.navigate(['/plans']);
}
isUserOwner(activity: DmpListingModel): boolean {
const principal: Principal = this.authentication.current();
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id;

View File

@ -231,7 +231,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
}
onDeleteCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Success);
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DELETE'), SnackBarNotificationLevel.Success);
this.router.navigate(['/plans']);
}
@ -607,8 +607,9 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
}
reloadPage(): void {
const path = this.location.path();
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
this.router.navigate([`/plans/overview/${this.dmp.id}`]);
this.router.navigate([path]);
});
}

View File

@ -21,6 +21,7 @@
"UNSUCCESSFUL-LOGIN": "Anmeldung fehlgeschlagen",
"SUCCESSFUL-DATASET-PROFILE-DELETE": "Erfolgreich gelöscht",
"UNSUCCESSFUL-DATASET-PROFILE-DELETE": "Diese Vorlage kann nicht gelöscht werden, da Datensatzbeschreibungen noch damit verbunden sind",
"SUCCESSFUL-DELETE": "Erfolgreich gelöscht",
"UNSUCCESSFUL-DELETE": "Löschen fehlgeschlagen",
"UNSUCCESSFUL-EMAIL-SEND": "E-Mail versenden fehlgeschlagen"
},

View File

@ -21,6 +21,7 @@
"UNSUCCESSFUL-LOGIN": "Unsuccessful Login",
"SUCCESSFUL-DATASET-PROFILE-DELETE": "Successful Delete",
"UNSUCCESSFUL-DATASET-PROFILE-DELETE": "This template can not deleted, because Dataset Descriptions are associated with it",
"SUCCESSFUL-DELETE": "Successful Delete",
"UNSUCCESSFUL-DELETE": "Unsuccessful Delete",
"UNSUCCESSFUL-EMAIL-SEND": "Failed sending email"
},

View File

@ -21,6 +21,7 @@
"UNSUCCESSFUL-LOGIN": "Inicio de sesión fallido",
"SUCCESSFUL-DATASET-PROFILE-DELETE": "Borrado correcto",
"UNSUCCESSFUL-DATASET-PROFILE-DELETE": "Esta plantilla no se puede borrar, porque está asociada a descripciones del Dataset",
"SUCCESSFUL-DELETE": "Borrado correcto",
"UNSUCCESSFUL-DELETE": "Borrado fallido",
"UNSUCCESSFUL-EMAIL-SEND": "Fallo enviando el correo"
},

View File

@ -21,6 +21,7 @@
"UNSUCCESSFUL-LOGIN": "Αποτυχημένη σύνδεση",
"SUCCESSFUL-DATASET-PROFILE-DELETE": "Επιτυχής διαγραφή",
"UNSUCCESSFUL-DATASET-PROFILE-DELETE": "Το template δεν μπορεί να διαγραφεί, επειδή οι περιγραφές των συνόλων δεδομένων σχετίζονται με αυτό",
"SUCCESSFUL-DELETE": "Επιτυχής διαγραφή",
"UNSUCCESSFUL-DELETE": "Αποτυχημένη διαγραφή",
"UNSUCCESSFUL-EMAIL-SEND": "Αποτυχία αποστολής email"
},

View File

@ -21,6 +21,7 @@
"UNSUCCESSFUL-LOGIN": "Başarısız Giriş",
"SUCCESSFUL-DATASET-PROFILE-DELETE": "Silme Başarılı",
"UNSUCCESSFUL-DATASET-PROFILE-DELETE": "Veriseti Tanımları ilişkilendirildiği için bu şablon silinemez",
"SUCCESSFUL-DELETE": "Silme Başarılı",
"UNSUCCESSFUL-DELETE": "Başarısız Silme",
"UNSUCCESSFUL-EMAIL-SEND": "E-posta gönderilemedi"
},