diff --git a/src/app/project/board/board.component.html b/src/app/project/board/board.component.html index a50ea1b4bf..45050030c9 100644 --- a/src/app/project/board/board.component.html +++ b/src/app/project/board/board.component.html @@ -1,55 +1,63 @@ -
-
- -
- +
+ +
+ + + Active + Deactivated + + + + + + +
+ + +
+
+

+ Project {{ project.shortcode }} | {{ project.shortname | uppercase }} +

+ + Active Deactivated - - -
+
+

+ {{ project.longname }} +

+ + +
- - -
-
-

- Project {{ project.shortcode }} | {{ project.shortname | uppercase }} -

- - - - Active - Deactivated - - -
-
-

- {{ project.longname }} -

- - - - -
-
+ +
+
+
+ + + + +
+ + {{k}} + +
+
diff --git a/src/app/project/project-form/project-form.component.html b/src/app/project/project-form/project-form.component.html index da79a16fe0..7199189f52 100644 --- a/src/app/project/project-form/project-form.component.html +++ b/src/app/project/project-form/project-form.component.html @@ -1,10 +1,5 @@
- - - - -
@@ -75,10 +70,12 @@ {{tag}} cancel - + {{ formErrors.keywords }} @@ -105,9 +102,12 @@ - diff --git a/src/app/project/project-form/project-form.component.ts b/src/app/project/project-form/project-form.component.ts index f624ffe846..6c013f6fbe 100644 --- a/src/app/project/project-form/project-form.component.ts +++ b/src/app/project/project-form/project-form.component.ts @@ -18,6 +18,7 @@ import { import { DspApiConnectionToken } from 'src/app/main/declarations/dsp-api-tokens'; import { existingNamesValidator } from 'src/app/main/directive/existing-name/existing-name.directive'; import { ErrorHandlerService } from 'src/app/main/error/error-handler.service'; +import { NotificationService } from 'src/app/main/services/notification.service'; import { SessionService } from 'src/app/main/services/session.service'; import { CacheService } from '../../main/cache/cache.service'; @@ -141,6 +142,7 @@ export class ProjectFormComponent implements OnInit { @Inject(DspApiConnectionToken) private _dspApiConnection: KnoraApiConnection, private _cache: CacheService, private _errorHandler: ErrorHandlerService, + private _notification: NotificationService, private _fb: FormBuilder, private _router: Router, private _session: SessionService @@ -256,11 +258,15 @@ export class ProjectFormComponent implements OnInit { 'keywords': new FormControl({ // must be empty (even in edit mode), because of the mat-chip-list value: [], disabled: disabled - }, [ - Validators.required - ]) + }) }); + if (!this.projectCode) { + // if projectCode does not exist, we are in create mode; + // in this case, the keywords are required in the API request + this.form.controls['keywords'].setValidators(Validators.required); + } + this.form.valueChanges .subscribe(data => this.onValueChanged(data)); } @@ -339,21 +345,10 @@ export class ProjectFormComponent implements OnInit { this.keywords = []; } this.form.controls['keywords'].setValue(this.keywords); - // this.form.controls['keywords'].disabled = !this.project.status; - - // b) update description field / multi language preparation - // fIXME: this is a quick (hardcoded) hack: - // --> TODO create multi language input fields - // this.form.controls['description'].setValue([{ - // 'language': 'en', - // 'value': this.form.controls['description'].value - // }]); - if (this.projectCode) { const projectData: UpdateProjectRequest = new UpdateProjectRequest(); projectData.description = [new StringLiteral()]; - // projectData.description = this.description; projectData.keywords = this.form.value.keywords; projectData.longname = this.form.value.longname; projectData.status = true; @@ -370,16 +365,15 @@ export class ProjectFormComponent implements OnInit { this._dspApiConnection.admin.projectsEndpoint.updateProject(this.project.id, projectData).subscribe( (response: ApiResponseData) => { - // this.originProject = response.body.project; + this.success = true; this.project = response.body.project; - this.buildForm(this.project); // update cache - this._cache.set(this.projectCode, response); + this._cache.set(this.projectCode, this.project); - this.success = true; + this._notification.openSnackBar('You have successfully updated the project information.'); - this.loading = false; + this.closeDialog.emit(this.project); }, (error: ApiResponseError) => {