bug fixes
This commit is contained in:
parent
d4db0e204e
commit
55b6da619f
|
@ -1,5 +1,6 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
import { ReloadHelperComponent } from '@app/ui/misc/reload-helper/reload-helper.component';
|
||||||
import { B2AccessLoginComponent } from './ui/auth/login/b2access/b2access-login.component';
|
import { B2AccessLoginComponent } from './ui/auth/login/b2access/b2access-login.component';
|
||||||
|
|
||||||
const appRoutes: Routes = [
|
const appRoutes: Routes = [
|
||||||
|
@ -183,7 +184,8 @@ const appRoutes: Routes = [
|
||||||
component: B2AccessLoginComponent,
|
component: B2AccessLoginComponent,
|
||||||
data: {
|
data: {
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
{ path: 'reload', component: ReloadHelperComponent }
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|
|
@ -16,6 +16,7 @@ import { DatasetCreateWizardModule } from '@app/ui/dataset-create-wizard/dataset
|
||||||
import { BreadcrumbModule } from '@app/ui/misc/breadcrumb/breadcrumb.module';
|
import { BreadcrumbModule } from '@app/ui/misc/breadcrumb/breadcrumb.module';
|
||||||
import { HelpContentModule } from '@app/ui/misc/help-content/help-content.module';
|
import { HelpContentModule } from '@app/ui/misc/help-content/help-content.module';
|
||||||
import { NavigationModule } from '@app/ui/misc/navigation/navigation.module';
|
import { NavigationModule } from '@app/ui/misc/navigation/navigation.module';
|
||||||
|
import { ReloadHelperComponent } from '@app/ui/misc/reload-helper/reload-helper.component';
|
||||||
import { NavbarModule } from '@app/ui/navbar/navbar.module';
|
import { NavbarModule } from '@app/ui/navbar/navbar.module';
|
||||||
import { SidebarModule } from '@app/ui/sidebar/sidebar.module';
|
import { SidebarModule } from '@app/ui/sidebar/sidebar.module';
|
||||||
import { MomentUtcDateAdapter } from '@common/date/moment-utc-date-adapter';
|
import { MomentUtcDateAdapter } from '@common/date/moment-utc-date-adapter';
|
||||||
|
@ -94,7 +95,8 @@ const cookieConfig: NgcCookieConsentConfig = {
|
||||||
NgcCookieConsentModule.forRoot(cookieConfig)
|
NgcCookieConsentModule.forRoot(cookieConfig)
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent
|
AppComponent,
|
||||||
|
ReloadHelperComponent
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,7 @@ import { UserInfoListingModel } from "../user/user-info-listing";
|
||||||
import { DatasetModel } from "../dataset/dataset";
|
import { DatasetModel } from "../dataset/dataset";
|
||||||
import { ProjectModel } from "../project/project";
|
import { ProjectModel } from "../project/project";
|
||||||
import { FunderModel } from "../funder/funder";
|
import { FunderModel } from "../funder/funder";
|
||||||
|
import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
||||||
|
|
||||||
export interface DmpModel {
|
export interface DmpModel {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -16,7 +17,7 @@ export interface DmpModel {
|
||||||
groupId: String;
|
groupId: String;
|
||||||
profile: String;
|
profile: String;
|
||||||
version: number;
|
version: number;
|
||||||
status: Status;
|
status: DmpStatus;
|
||||||
lockable: boolean;
|
lockable: boolean;
|
||||||
description: String;
|
description: String;
|
||||||
grant: GrantListingModel;
|
grant: GrantListingModel;
|
||||||
|
|
|
@ -203,10 +203,10 @@ export class ExternalServiceEditorModel {
|
||||||
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
|
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
|
||||||
return new FormBuilder().group({
|
return new FormBuilder().group({
|
||||||
id: [this.id],
|
id: [this.id],
|
||||||
abbreviation: [this.abbreviation],
|
abbreviation: [this.abbreviation, Validators.required],
|
||||||
label: [this.label],
|
label: [this.label, Validators.required],
|
||||||
reference: [this.reference],
|
reference: [this.reference],
|
||||||
uri: [this.uri],
|
uri: [this.uri, Validators.required],
|
||||||
definition: [this.definition]
|
definition: [this.definition]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -246,10 +246,10 @@ export class ExternalRegistryEditorModel {
|
||||||
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
|
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
|
||||||
return new FormBuilder().group({
|
return new FormBuilder().group({
|
||||||
id: [this.id],
|
id: [this.id],
|
||||||
abbreviation: [this.abbreviation],
|
abbreviation: [this.abbreviation, Validators.required],
|
||||||
label: [this.label],
|
label: [this.label, Validators.required],
|
||||||
reference: [this.reference],
|
reference: [this.reference],
|
||||||
uri: [this.uri],
|
uri: [this.uri, Validators.required],
|
||||||
definition: [this.definition],
|
definition: [this.definition],
|
||||||
source: [this.source]
|
source: [this.source]
|
||||||
});
|
});
|
||||||
|
@ -291,10 +291,10 @@ export class ExternalDatasetEditorModel {
|
||||||
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
|
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
|
||||||
return new FormBuilder().group({
|
return new FormBuilder().group({
|
||||||
id: [this.id],
|
id: [this.id],
|
||||||
abbreviation: [this.abbreviation],
|
abbreviation: [this.abbreviation, Validators.required],
|
||||||
name: [this.name],
|
name: [this.name, Validators.required],
|
||||||
reference: [this.reference],
|
reference: [this.reference],
|
||||||
type: [this.type, Validators.required],
|
type: [this.type],
|
||||||
info: [this.info],
|
info: [this.info],
|
||||||
source: [this.source]
|
source: [this.source]
|
||||||
});
|
});
|
||||||
|
@ -335,9 +335,9 @@ export class ExternalDataRepositoryEditorModel {
|
||||||
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
|
buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup {
|
||||||
return new FormBuilder().group({
|
return new FormBuilder().group({
|
||||||
id: [this.id],
|
id: [this.id],
|
||||||
label: [this.label],
|
label: [this.label, [Validators.required]],
|
||||||
abbreviation: [this.abbreviation],
|
abbreviation: [this.abbreviation, [Validators.required]],
|
||||||
uri: [this.uri],
|
uri: [this.uri, [Validators.required]],
|
||||||
info: [this.info],
|
info: [this.info],
|
||||||
reference: [this.reference],
|
reference: [this.reference],
|
||||||
source: [this.source]
|
source: [this.source]
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form *ngIf="formGroup" (ngSubmit)="formSubmit()">
|
<form *ngIf="formGroup">
|
||||||
<div class="d-flex flex-column">
|
<div class="d-flex flex-column">
|
||||||
<mat-tab-group class="mt-3">
|
<mat-tab-group class="mt-3">
|
||||||
<mat-tab>
|
<mat-tab>
|
||||||
|
@ -112,8 +112,8 @@
|
||||||
<button mat-raised-button (click)="cancel()" type="button" class="cancelButton" color="primary">
|
<button mat-raised-button (click)="cancel()" type="button" class="cancelButton" color="primary">
|
||||||
{{'DMP-EDITOR.ACTIONS.CANCEL' | translate}}
|
{{'DMP-EDITOR.ACTIONS.CANCEL' | translate}}
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="datasetWizardModel.status == 0 || isNew" mat-raised-button [disabled]="!isSemiFormValid(formGroup)" class="saveButton" color="primary" (click)="save();" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button>
|
<button *ngIf="datasetWizardModel.status == 0 || isNew" mat-raised-button class="saveButton" color="primary" (click)="save();" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button>
|
||||||
<button *ngIf="datasetWizardModel.status == 0 || isNew" mat-raised-button [disabled]="!formGroup.valid" class="finalizeButton" color="primary" (click)="saveFinalize();" type="button">{{ 'DATASET-WIZARD.ACTIONS.FINALIZE' | translate }}</button>
|
<button *ngIf="datasetWizardModel.status == 0 || isNew" mat-raised-button class="finalizeButton" color="primary" (click)="saveFinalize();" type="button">{{ 'DATASET-WIZARD.ACTIONS.FINALIZE' | translate }}</button>
|
||||||
<div class="fill-space"></div>
|
<div class="fill-space"></div>
|
||||||
<button *ngIf="hasReversableStatus()" mat-raised-button class="reverseButton" color="primary" (click)="reverse()" type="button">{{ 'DATASET-WIZARD.ACTIONS.REVERSE' | translate }}</button>
|
<button *ngIf="hasReversableStatus()" mat-raised-button class="reverseButton" color="primary" (click)="reverse()" type="button">{{ 'DATASET-WIZARD.ACTIONS.REVERSE' | translate }}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -18,7 +18,6 @@ import { ExternalSourcesConfigurationService } from '@app/core/services/external
|
||||||
import { ExternalSourcesService } from '@app/core/services/external-sources/external-sources.service';
|
import { ExternalSourcesService } from '@app/core/services/external-sources/external-sources.service';
|
||||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
|
||||||
import { DatasetCopyDialogueComponent } from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
|
import { DatasetCopyDialogueComponent } from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
|
||||||
import { DatasetWizardEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
|
import { DatasetWizardEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
|
||||||
import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
|
import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
|
||||||
|
@ -26,7 +25,10 @@ import { IBreadCrumbComponent } from '@app/ui/misc/breadcrumb/definition/IBreadC
|
||||||
import { DatasetDescriptionFormEditorModel } from '@app/ui/misc/dataset-description-form/dataset-description-form.model';
|
import { DatasetDescriptionFormEditorModel } from '@app/ui/misc/dataset-description-form/dataset-description-form.model';
|
||||||
import { LinkToScroll } from '@app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents';
|
import { LinkToScroll } from '@app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents';
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
import { BaseComponent } from '@common/base/base.component';
|
||||||
|
import { FormService } from '@common/forms/form-service';
|
||||||
|
import { FormValidationErrorsDialogComponent } from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.component';
|
||||||
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
||||||
|
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import * as FileSaver from 'file-saver';
|
import * as FileSaver from 'file-saver';
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
import { Observable, of as observableOf } from 'rxjs';
|
||||||
|
@ -70,7 +72,8 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
public dmpService: DmpService,
|
public dmpService: DmpService,
|
||||||
public dialog: MatDialog,
|
public dialog: MatDialog,
|
||||||
public externalSourcesConfigurationService: ExternalSourcesConfigurationService,
|
public externalSourcesConfigurationService: ExternalSourcesConfigurationService,
|
||||||
private uiNotificationService: UiNotificationService
|
private uiNotificationService: UiNotificationService,
|
||||||
|
private formService: FormService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -89,8 +92,8 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
initialItems: (extraData) => this.searchDmp(''),
|
initialItems: (extraData) => this.searchDmp(''),
|
||||||
displayFn: (item) => this.getDatasetDisplay(item),
|
displayFn: (item) => this.getDatasetDisplay(item),
|
||||||
titleFn: (item) => item['label'],
|
titleFn: (item) => item['label'],
|
||||||
// iconFn: (item) => this.publicMode ? '' : (item['status'] ? 'lock' : 'lock_open'),
|
// iconFn: (item) => this.publicMode ? '' : (item['status'] ? 'lock' : 'lock_open'),
|
||||||
// linkFn: (item) => this.publicMode ? '/explore-plans/overview/' + item['id'] : '/plans/overview/' + item['id']
|
// linkFn: (item) => this.publicMode ? '/explore-plans/overview/' + item['id'] : '/plans/overview/' + item['id']
|
||||||
};
|
};
|
||||||
|
|
||||||
const params = this.route.snapshot.params;
|
const params = this.route.snapshot.params;
|
||||||
|
@ -384,10 +387,10 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
formSubmit(): void {
|
// formSubmit(): void {
|
||||||
if (!this.isFormValid()) { return; }
|
// if (!this.isFormValid()) { return; }
|
||||||
this.onSubmit();
|
// this.onSubmit();
|
||||||
}
|
// }
|
||||||
|
|
||||||
public isFormValid() {
|
public isFormValid() {
|
||||||
return this.formGroup.valid;
|
return this.formGroup.valid;
|
||||||
|
@ -403,36 +406,53 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
return isValid;
|
return isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(): void {
|
// onSubmit(): void {
|
||||||
this.datasetWizardService.createDataset(this.formGroup.value)
|
// this.datasetWizardService.createDataset(this.formGroup.value)
|
||||||
.pipe(takeUntil(this._destroyed))
|
// .pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
// .subscribe(
|
||||||
complete => {
|
// complete => {
|
||||||
this.datasetWizardService.getSingle(complete.id)
|
// this.datasetWizardService.getSingle(complete.id)
|
||||||
.pipe(takeUntil(this._destroyed))
|
// .pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
// .subscribe(
|
||||||
result => {
|
// result => {
|
||||||
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(result);
|
// this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(result);
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
this.onCallbackSuccess();
|
// this.onCallbackSuccess();
|
||||||
},
|
// },
|
||||||
error => this.onCallbackError(error)
|
// error => this.onCallbackError(error)
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
this.datasetWizardService.createDataset(this.formGroup.getRawValue())
|
this.datasetWizardService.createDataset(this.formGroup.getRawValue())
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(data => {
|
.subscribe(
|
||||||
this.router.navigate(['datasets'], { queryParams: { dmpId: this.formGroup.get('dmp').value.id } });
|
data => {
|
||||||
});
|
this.onCallbackSuccess(this.datasetWizardModel.id);
|
||||||
|
},
|
||||||
|
error => this.onCallbackError(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
|
this.formService.touchAllFormFields(this.formGroup);
|
||||||
|
if (!this.isSemiFormValid(this.formGroup)) {
|
||||||
|
this.showValidationErrorsDialog();
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.submit();
|
this.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private showValidationErrorsDialog(projectOnly?: boolean) {
|
||||||
|
const dialogRef = this.dialog.open(FormValidationErrorsDialogComponent, {
|
||||||
|
disableClose: true,
|
||||||
|
data: {
|
||||||
|
formGroup: this.formGroup,
|
||||||
|
projectOnly: projectOnly
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
hasReversableStatus(): boolean {
|
hasReversableStatus(): boolean {
|
||||||
if (this.formGroup.get('dmp').value) {
|
if (this.formGroup.get('dmp').value) {
|
||||||
return (this.formGroup.get('dmp').value.status == DmpStatus.Draft && this.formGroup.get('status').value == DatasetStatus.Finalized);
|
return (this.formGroup.get('dmp').value.status == DmpStatus.Draft && this.formGroup.get('status').value == DatasetStatus.Finalized);
|
||||||
|
@ -461,6 +481,11 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
}
|
}
|
||||||
|
|
||||||
saveFinalize() {
|
saveFinalize() {
|
||||||
|
this.formService.touchAllFormFields(this.formGroup);
|
||||||
|
if (!this.isFormValid()) {
|
||||||
|
this.showValidationErrorsDialog();
|
||||||
|
return;
|
||||||
|
}
|
||||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||||
restoreFocus: false,
|
restoreFocus: false,
|
||||||
data: {
|
data: {
|
||||||
|
@ -479,8 +504,9 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onCallbackSuccess(): void {
|
onCallbackSuccess(id?: String): void {
|
||||||
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : 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']);
|
||||||
}
|
}
|
||||||
|
|
||||||
onCallbackError(error: any) {
|
onCallbackError(error: any) {
|
||||||
|
@ -614,7 +640,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
||||||
this.datasetWizardService.delete(id)
|
this.datasetWizardService.delete(id)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
complete => { this.onCallbackSuccess(); this.router.navigateByUrl('/datasets') },
|
complete => this.onCallbackSuccess(),
|
||||||
error => this.onCallbackError(error)
|
error => this.onCallbackError(error)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||||
import { ExternalDataRepositoryService } from '@app/core/services/external-sources/data-repository/extternal-data-repository.service';
|
import { ExternalDataRepositoryService } from '@app/core/services/external-sources/data-repository/extternal-data-repository.service';
|
||||||
import { ExternalDataRepositoryEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
|
import { ExternalDataRepositoryEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
import { BaseComponent } from '@common/base/base.component';
|
||||||
|
import { FormService } from '@common/forms/form-service';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -16,7 +17,8 @@ export class DatasetExternalDataRepositoryDialogEditorComponent extends BaseComp
|
||||||
constructor(
|
constructor(
|
||||||
private externalDataRepositoryService: ExternalDataRepositoryService,
|
private externalDataRepositoryService: ExternalDataRepositoryService,
|
||||||
public dialogRef: MatDialogRef<DatasetExternalDataRepositoryDialogEditorComponent>,
|
public dialogRef: MatDialogRef<DatasetExternalDataRepositoryDialogEditorComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: any
|
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||||
|
private formService: FormService
|
||||||
) { super(); }
|
) { super(); }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -25,6 +27,8 @@ export class DatasetExternalDataRepositoryDialogEditorComponent extends BaseComp
|
||||||
}
|
}
|
||||||
|
|
||||||
send(value: any) {
|
send(value: any) {
|
||||||
|
this.formService.touchAllFormFields(this.formGroup);
|
||||||
|
if (!this.formGroup.valid) { return; }
|
||||||
this.externalDataRepositoryService.create(this.formGroup.value)
|
this.externalDataRepositoryService.create(this.formGroup.value)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { ExternalDatasetService } from '@app/core/services/external-sources/data
|
||||||
import { ExternalDatasetEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
|
import { ExternalDatasetEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
import { BaseComponent } from '@common/base/base.component';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
import { FormService } from '@common/forms/form-service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: 'dataset-external-dataset-dialog-editor.component.html',
|
templateUrl: 'dataset-external-dataset-dialog-editor.component.html',
|
||||||
|
@ -16,7 +17,8 @@ export class DatasetExternalDatasetDialogEditorComponent extends BaseComponent i
|
||||||
constructor(
|
constructor(
|
||||||
private externalDatasetService: ExternalDatasetService,
|
private externalDatasetService: ExternalDatasetService,
|
||||||
public dialogRef: MatDialogRef<DatasetExternalDatasetDialogEditorComponent>,
|
public dialogRef: MatDialogRef<DatasetExternalDatasetDialogEditorComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: any
|
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||||
|
private formService: FormService
|
||||||
) { super(); }
|
) { super(); }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -25,6 +27,8 @@ export class DatasetExternalDatasetDialogEditorComponent extends BaseComponent i
|
||||||
}
|
}
|
||||||
|
|
||||||
send(value: any) {
|
send(value: any) {
|
||||||
|
this.formService.touchAllFormFields(this.formGroup);
|
||||||
|
if (!this.formGroup.valid) { return; }
|
||||||
this.externalDatasetService.create(this.formGroup.value)
|
this.externalDatasetService.create(this.formGroup.value)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||||
import { ExternalRegistryService } from '@app/core/services/external-sources/registry/external-registry.service';
|
import { ExternalRegistryService } from '@app/core/services/external-sources/registry/external-registry.service';
|
||||||
import { ExternalRegistryEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
|
import { ExternalRegistryEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
import { BaseComponent } from '@common/base/base.component';
|
||||||
|
import { FormService } from '@common/forms/form-service';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -16,7 +17,8 @@ export class DatasetExternalRegistryDialogEditorComponent extends BaseComponent
|
||||||
constructor(
|
constructor(
|
||||||
private externalRegistryService: ExternalRegistryService,
|
private externalRegistryService: ExternalRegistryService,
|
||||||
public dialogRef: MatDialogRef<DatasetExternalRegistryDialogEditorComponent>,
|
public dialogRef: MatDialogRef<DatasetExternalRegistryDialogEditorComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: any
|
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||||
|
private formService: FormService
|
||||||
) { super(); }
|
) { super(); }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -25,6 +27,8 @@ export class DatasetExternalRegistryDialogEditorComponent extends BaseComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
send(value: any) {
|
send(value: any) {
|
||||||
|
this.formService.touchAllFormFields(this.formGroup);
|
||||||
|
if (!this.formGroup.valid) { return; }
|
||||||
this.externalRegistryService.create(this.formGroup.value)
|
this.externalRegistryService.create(this.formGroup.value)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { ExternalServiceService } from '@app/core/services/external-sources/serv
|
||||||
import { ExternalServiceEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
|
import { ExternalServiceEditorModel } from '@app/ui/dataset/dataset-wizard/dataset-wizard-editor.model';
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
import { BaseComponent } from '@common/base/base.component';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
import { FormService } from '@common/forms/form-service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: 'dataset-external-service-dialog-editor.component.html',
|
templateUrl: 'dataset-external-service-dialog-editor.component.html',
|
||||||
|
@ -16,7 +17,8 @@ export class DatasetExternalServiceDialogEditorComponent extends BaseComponent i
|
||||||
constructor(
|
constructor(
|
||||||
private externalServiceService: ExternalServiceService,
|
private externalServiceService: ExternalServiceService,
|
||||||
public dialogRef: MatDialogRef<DatasetExternalServiceDialogEditorComponent>,
|
public dialogRef: MatDialogRef<DatasetExternalServiceDialogEditorComponent>,
|
||||||
@Inject(MAT_DIALOG_DATA) public data: any
|
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||||
|
private formService: FormService
|
||||||
) { super(); }
|
) { super(); }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -25,6 +27,8 @@ export class DatasetExternalServiceDialogEditorComponent extends BaseComponent i
|
||||||
}
|
}
|
||||||
|
|
||||||
send() {
|
send() {
|
||||||
|
this.formService.touchAllFormFields(this.formGroup);
|
||||||
|
if (!this.formGroup.valid) { return; }
|
||||||
this.externalServiceService.create(this.formGroup.value)
|
this.externalServiceService.create(this.formGroup.value)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module';
|
import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module';
|
||||||
import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module';
|
|
||||||
import { ExportMethodDialogModule } from '@app/library/export-method-dialog/export-method-dialog.module';
|
import { ExportMethodDialogModule } from '@app/library/export-method-dialog/export-method-dialog.module';
|
||||||
import { UrlListingModule } from '@app/library/url-listing/url-listing.module';
|
import { UrlListingModule } from '@app/library/url-listing/url-listing.module';
|
||||||
import { DatasetCopyDialogueComponent } from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
|
import { DatasetCopyDialogueComponent } from '@app/ui/dataset/dataset-wizard/dataset-copy-dialogue/dataset-copy-dialogue.component';
|
||||||
|
@ -20,6 +19,8 @@ import { DatasetDescriptionFormModule } from '@app/ui/misc/dataset-description-f
|
||||||
import { TableOfContentsModule } from '@app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents.module';
|
import { TableOfContentsModule } from '@app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents.module';
|
||||||
import { ExternalSourcesModule } from '@app/ui/misc/external-sources/external-sources.module';
|
import { ExternalSourcesModule } from '@app/ui/misc/external-sources/external-sources.module';
|
||||||
import { CommonFormsModule } from '@common/forms/common-forms.module';
|
import { CommonFormsModule } from '@common/forms/common-forms.module';
|
||||||
|
import { FormValidationErrorsDialogModule } from '@common/forms/form-validation-errors-dialog/form-validation-errors-dialog.module';
|
||||||
|
import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module';
|
||||||
import { CommonUiModule } from '@common/ui/common-ui.module';
|
import { CommonUiModule } from '@common/ui/common-ui.module';
|
||||||
import { AngularStickyThingsModule } from '@w11k/angular-sticky-things';
|
import { AngularStickyThingsModule } from '@w11k/angular-sticky-things';
|
||||||
|
|
||||||
|
@ -35,7 +36,8 @@ import { AngularStickyThingsModule } from '@w11k/angular-sticky-things';
|
||||||
DatasetDescriptionFormModule,
|
DatasetDescriptionFormModule,
|
||||||
TableOfContentsModule,
|
TableOfContentsModule,
|
||||||
AngularStickyThingsModule,
|
AngularStickyThingsModule,
|
||||||
DatasetRoutingModule
|
DatasetRoutingModule,
|
||||||
|
FormValidationErrorsDialogModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
DatasetListingComponent,
|
DatasetListingComponent,
|
||||||
|
|
|
@ -16,6 +16,7 @@ import { ValidationErrorModel } from '@common/forms/validation/error-model/valid
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
import { Observable, of as observableOf } from 'rxjs';
|
||||||
import { map, takeUntil } from 'rxjs/operators';
|
import { map, takeUntil } from 'rxjs/operators';
|
||||||
|
import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -58,6 +59,7 @@ export class DmpCloneComponent extends BaseComponent implements OnInit {
|
||||||
this.dmp.project = new ProjectFormModel();
|
this.dmp.project = new ProjectFormModel();
|
||||||
this.dmp.funder = new FunderFormModel();
|
this.dmp.funder = new FunderFormModel();
|
||||||
this.dmp.fromModel(data);
|
this.dmp.fromModel(data);
|
||||||
|
this.dmp.status = DmpStatus.Draft;
|
||||||
this.formGroup = this.dmp.buildForm();
|
this.formGroup = this.dmp.buildForm();
|
||||||
|
|
||||||
this.parentDmpLabel = this.formGroup.get('label').value;
|
this.parentDmpLabel = this.formGroup.get('label').value;
|
||||||
|
|
|
@ -109,7 +109,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
||||||
this.dmp.fromModel(data);
|
this.dmp.fromModel(data);
|
||||||
this.formGroup = this.dmp.buildForm();
|
this.formGroup = this.dmp.buildForm();
|
||||||
//this.registerFormEventsForDmpProfile(this.dmp.definition);
|
//this.registerFormEventsForDmpProfile(this.dmp.definition);
|
||||||
if (!this.editMode || this.dmp.status === Status.Inactive) {
|
if (!this.editMode || this.dmp.status === DmpStatus.Finalized) {
|
||||||
this.isFinalized = true;
|
this.isFinalized = true;
|
||||||
this.formGroup.disable();
|
this.formGroup.disable();
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
||||||
this.dmp.fromModel(data);
|
this.dmp.fromModel(data);
|
||||||
this.formGroup = this.dmp.buildForm();
|
this.formGroup = this.dmp.buildForm();
|
||||||
//this.registerFormEventsForDmpProfile(this.dmp.definition);
|
//this.registerFormEventsForDmpProfile(this.dmp.definition);
|
||||||
if (!this.editMode || this.dmp.status === Status.Inactive) { this.formGroup.disable(); }
|
if (!this.editMode || this.dmp.status === DmpStatus.Finalized) { this.formGroup.disable(); }
|
||||||
// if (!this.isAuthenticated) {
|
// if (!this.isAuthenticated) {
|
||||||
const breadcrumbs = [];
|
const breadcrumbs = [];
|
||||||
breadcrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC-DMPS').toUpperCase(), url: '/plans' });
|
breadcrumbs.push({ parentComponentName: null, label: this.language.instant('NAV-BAR.PUBLIC-DMPS').toUpperCase(), url: '/plans' });
|
||||||
|
@ -271,7 +271,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
||||||
|
|
||||||
onCallbackSuccess(id?: String): void {
|
onCallbackSuccess(id?: String): void {
|
||||||
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
||||||
id != null ? this.router.navigate(['/plans', 'edit', id]) : this.router.navigate(['/plans']);
|
id != null ? this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans', 'edit', id]); }) : this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans']); });
|
||||||
}
|
}
|
||||||
|
|
||||||
onCallbackError(error: any) {
|
onCallbackError(error: any) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
import { DmpProfileFieldDataType } from '@app/core/common/enum/dmp-profile-field-type';
|
import { DmpProfileFieldDataType } from '@app/core/common/enum/dmp-profile-field-type';
|
||||||
import { DmpProfileType } from '@app/core/common/enum/dmp-profile-type';
|
import { DmpProfileType } from '@app/core/common/enum/dmp-profile-type';
|
||||||
import { Status } from '@app/core/common/enum/Status';
|
import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
||||||
import { DatasetModel } from '@app/core/model/dataset/dataset';
|
import { DatasetModel } from '@app/core/model/dataset/dataset';
|
||||||
import { DmpProfile, DmpProfileDefinition } from '@app/core/model/dmp-profile/dmp-profile';
|
import { DmpProfile, DmpProfileDefinition } from '@app/core/model/dmp-profile/dmp-profile';
|
||||||
import { DmpProfileField } from '@app/core/model/dmp-profile/dmp-profile-field';
|
import { DmpProfileField } from '@app/core/model/dmp-profile/dmp-profile-field';
|
||||||
|
@ -29,7 +29,7 @@ export class DmpEditorModel {
|
||||||
public version: number;
|
public version: number;
|
||||||
public lockable: boolean;
|
public lockable: boolean;
|
||||||
public creator: UserModel;
|
public creator: UserModel;
|
||||||
public status: Status = Status.Active;
|
public status: DmpStatus = DmpStatus.Draft;
|
||||||
public description: String;
|
public description: String;
|
||||||
public grant: GrantTabModel;
|
public grant: GrantTabModel;
|
||||||
public project: ProjectFormModel;
|
public project: ProjectFormModel;
|
||||||
|
|
|
@ -14,6 +14,7 @@ import { ProjectFormModel } from '@app/ui/dmp/editor/grant-tab/project-form-mode
|
||||||
import { BackendErrorValidator } from '@common/forms/validation/custom-validator';
|
import { BackendErrorValidator } from '@common/forms/validation/custom-validator';
|
||||||
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
||||||
import { ValidationContext } from '@common/forms/validation/validation-context';
|
import { ValidationContext } from '@common/forms/validation/validation-context';
|
||||||
|
import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
||||||
|
|
||||||
export class DmpWizardEditorModel {
|
export class DmpWizardEditorModel {
|
||||||
public id: string;
|
public id: string;
|
||||||
|
@ -23,7 +24,7 @@ export class DmpWizardEditorModel {
|
||||||
public version: number;
|
public version: number;
|
||||||
public lockable: boolean;
|
public lockable: boolean;
|
||||||
public creator: UserModel;
|
public creator: UserModel;
|
||||||
public status: Status = Status.Active;
|
public status: DmpStatus = DmpStatus.Draft;
|
||||||
public description: String;
|
public description: String;
|
||||||
public grant: GrantTabModel;
|
public grant: GrantTabModel;
|
||||||
public funder: FunderFormModel;
|
public funder: FunderFormModel;
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { Component } from "@angular/core";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
template: "",
|
||||||
|
})
|
||||||
|
export class ReloadHelperComponent {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
}
|
|
@ -7,11 +7,12 @@ import { ValidJsonValidator } from '@app/library/auto-complete/auto-complete-cus
|
||||||
import { BackendErrorValidator } from '@common/forms/validation/custom-validator';
|
import { BackendErrorValidator } from '@common/forms/validation/custom-validator';
|
||||||
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
||||||
import { ValidationContext } from '@common/forms/validation/validation-context';
|
import { ValidationContext } from '@common/forms/validation/validation-context';
|
||||||
|
import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
||||||
|
|
||||||
export class DmpEditorWizardModel {
|
export class DmpEditorWizardModel {
|
||||||
public id: string;
|
public id: string;
|
||||||
public label: string;
|
public label: string;
|
||||||
public status: Status = Status.Active;
|
public status: DmpStatus = DmpStatus.Draft;
|
||||||
public description: String;
|
public description: String;
|
||||||
public datasetProfile: DatasetProfileModel;
|
public datasetProfile: DatasetProfileModel;
|
||||||
public definition: DmpProfileDefinition;
|
public definition: DmpProfileDefinition;
|
||||||
|
|
Loading…
Reference in New Issue