diff --git a/src/app/components-small/template-details/template-details.component.html b/src/app/components-small/template-details/template-details.component.html index 5e3a9e2..c716a9a 100644 --- a/src/app/components-small/template-details/template-details.component.html +++ b/src/app/components-small/template-details/template-details.component.html @@ -12,6 +12,7 @@
Group key cannot be used in experiment workspace tabs!
+ diff --git a/src/app/components-small/template-details/template-details.component.sass b/src/app/components-small/template-details/template-details.component.sass index 4ed5a3f..f26c304 100644 --- a/src/app/components-small/template-details/template-details.component.sass +++ b/src/app/components-small/template-details/template-details.component.sass @@ -19,3 +19,6 @@ .submit-button margin-block-start: 2rem + +.form-error + color: var(--warn-text) diff --git a/src/app/components-small/template-details/template-details.component.ts b/src/app/components-small/template-details/template-details.component.ts index 92beda0..f22b5d5 100644 --- a/src/app/components-small/template-details/template-details.component.ts +++ b/src/app/components-small/template-details/template-details.component.ts @@ -1,5 +1,5 @@ import { Component, Input, OnInit } from '@angular/core'; -import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; +import { FormBuilder, FormControl, FormGroup, ValidationErrors, Validators } from '@angular/forms'; import { ApiLink, ApiResponse } from 'src/app/services/api-data-types'; import { PluginRegistryBaseService } from 'src/app/services/registry.service'; import { TAB_GROUP_NAME_OVERRIDES, TemplateApiObject, TemplateTabApiObject } from 'src/app/services/templates.service'; @@ -60,6 +60,18 @@ export class TemplateDetailsComponent implements OnInit { constructor(private registry: PluginRegistryBaseService, private fb: FormBuilder) { } ngOnInit() { + this.templateForm.addValidators((control): ValidationErrors | null => { + const loc = control.get("location")?.getRawValue() ?? ""; + if (loc === "workspace") { + const groupKey = control.get("groupKey")?.getRawValue() ?? ""; + if (groupKey) { + return { + groupKeyForbidden: true, + }; + } + } + return null; + }); if (this.tabLink != null) { this.registry.getByApiLink