You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by bo...@apache.org on 2024/03/28 07:09:46 UTC

(streampipes) branch dev updated: fix(#2650): Better highlight mandatory settings for self-registration (#2652)

This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to refs/heads/dev by this push:
     new 0c9b86bd16 fix(#2650): Better highlight mandatory settings for self-registration (#2652)
0c9b86bd16 is described below

commit 0c9b86bd16982470768cca62e8ca5d56a96521fb
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Thu Mar 28 08:09:34 2024 +0100

    fix(#2650): Better highlight mandatory settings for self-registration (#2652)
---
 ui/src/app/configuration/configuration.module.ts   |   2 +
 .../general-configuration.component.html           | 101 ++++++++++-----------
 .../general-configuration.component.scss           |   6 ++
 .../general-configuration.component.ts             |   1 -
 4 files changed, 58 insertions(+), 52 deletions(-)

diff --git a/ui/src/app/configuration/configuration.module.ts b/ui/src/app/configuration/configuration.module.ts
index 8f1b4fc239..8d85fb3e21 100644
--- a/ui/src/app/configuration/configuration.module.ts
+++ b/ui/src/app/configuration/configuration.module.ts
@@ -70,6 +70,7 @@ import { MatTableModule } from '@angular/material/table';
 import { MatPaginatorModule } from '@angular/material/paginator';
 import { MatRadioModule } from '@angular/material/radio';
 import { MatSelectModule } from '@angular/material/select';
+import { MatButtonToggleModule } from '@angular/material/button-toggle';
 
 @NgModule({
     imports: [
@@ -77,6 +78,7 @@ import { MatSelectModule } from '@angular/material/select';
         FlexLayoutModule,
         MatGridListModule,
         MatButtonModule,
+        MatButtonToggleModule,
         MatProgressSpinnerModule,
         MatIconModule,
         MatInputModule,
diff --git a/ui/src/app/configuration/general-configuration/general-configuration.component.html b/ui/src/app/configuration/general-configuration/general-configuration.component.html
index f4872b6487..0b4e2bcd72 100644
--- a/ui/src/app/configuration/general-configuration/general-configuration.component.html
+++ b/ui/src/app/configuration/general-configuration/general-configuration.component.html
@@ -24,11 +24,14 @@
             *ngIf="formReady"
         >
             <form [formGroup]="parentForm" fxFlex="100" fxLayout="column">
-                <div class="warning mb-10" *ngIf="!generalConfig.configured">
-                    These are default values - to use features such as email you
-                    need to store these values once.
-                </div>
                 <sp-split-section title="Basic" subtitle="Basic settings">
+                    <div
+                        class="warning mb-10"
+                        *ngIf="!generalConfig.configured"
+                    >
+                        These are default values - to use features such as email
+                        you need to store these values once.
+                    </div>
                     <div class="subsection-title">App Name</div>
                     <mat-form-field color="accent">
                         <input
@@ -106,58 +109,54 @@
                             !mailConfig.emailConfigured
                         "
                     >
-                        Requires valid mail server settings and basic host
-                        settings.
+                        Self-registration requires valid mail server and basic
+                        host settings.
                     </div>
-                    <mat-checkbox
-                        [disabled]="
-                            !generalConfig.configured ||
-                            !mailConfig.emailConfigured
-                        "
-                        formControlName="allowSelfRegistration"
-                        >Allow self-registration
-                    </mat-checkbox>
                     <div
-                        *ngIf="generalConfig.allowSelfRegistration"
-                        class="mt-10 mb-10"
+                        fxLayout="column"
+                        *ngIf="
+                            generalConfig.configured &&
+                            mailConfig.emailConfigured
+                        "
                     >
-                        <h5>Default roles for new users</h5>
-                        <mat-select
-                            formControlName="defaultUserRoles"
-                            [multiple]="true"
+                        <mat-checkbox formControlName="allowSelfRegistration"
+                            >Allow self-registration
+                        </mat-checkbox>
+                        <div
+                            *ngIf="generalConfig.allowSelfRegistration"
+                            class="mt-10 mb-10"
                         >
-                            <mat-option
-                                *ngFor="let role of availableRoles"
-                                [value]="role.role"
-                                >{{ role.roleTitle }}
-                            </mat-option>
-                        </mat-select>
-                    </div>
-                    <mat-checkbox
-                        [disabled]="
-                            !generalConfig.configured ||
-                            !mailConfig.emailConfigured
-                        "
-                        formControlName="allowPasswordRecovery"
-                        >Allow self-service password recovery
-                    </mat-checkbox>
+                            <h5>Default roles for new users</h5>
+                            <mat-form-field color="accent" appearance="outline">
+                                <mat-select
+                                    formControlName="defaultUserRoles"
+                                    [multiple]="true"
+                                >
+                                    <mat-option
+                                        *ngFor="let role of availableRoles"
+                                        [value]="role.role"
+                                        >{{ role.roleTitle }}
+                                    </mat-option>
+                                </mat-select>
+                            </mat-form-field>
+                        </div>
+                        <mat-checkbox formControlName="allowPasswordRecovery"
+                            >Allow self-service password recovery
+                        </mat-checkbox>
 
-                    <div class="mt-10">
-                        <button
-                            mat-button
-                            mat-raised-button
-                            color="accent"
-                            (click)="updateConfig()"
-                            style="margin-right: 10px"
-                            [disabled]="
-                                !generalConfig.configured ||
-                                !mailConfig.emailConfigured
-                            "
-                            data-cy="sp-element-general-registration-config-save"
-                        >
-                            <i class="material-icons">save</i
-                            ><span>&nbsp;Save</span>
-                        </button>
+                        <div class="mt-10">
+                            <button
+                                mat-button
+                                mat-raised-button
+                                color="accent"
+                                (click)="updateConfig()"
+                                style="margin-right: 10px"
+                                data-cy="sp-element-general-registration-config-save"
+                            >
+                                <i class="material-icons">save</i
+                                ><span>&nbsp;Save</span>
+                            </button>
+                        </div>
                     </div>
                 </sp-split-section>
             </form>
diff --git a/ui/src/app/configuration/general-configuration/general-configuration.component.scss b/ui/src/app/configuration/general-configuration/general-configuration.component.scss
index efc38fc2b0..2f5187372e 100644
--- a/ui/src/app/configuration/general-configuration/general-configuration.component.scss
+++ b/ui/src/app/configuration/general-configuration/general-configuration.component.scss
@@ -19,3 +19,9 @@
 .ml-10 {
     margin-left: 10px;
 }
+
+.warning {
+    border: 1px solid #dea843;
+    background: #ececc9;
+    padding: 5px;
+}
diff --git a/ui/src/app/configuration/general-configuration/general-configuration.component.ts b/ui/src/app/configuration/general-configuration/general-configuration.component.ts
index c9aa7c419d..e770dba8d2 100644
--- a/ui/src/app/configuration/general-configuration/general-configuration.component.ts
+++ b/ui/src/app/configuration/general-configuration/general-configuration.component.ts
@@ -153,7 +153,6 @@ export class GeneralConfigurationComponent implements OnInit {
                 this.generalConfig.defaultUserRoles = v.defaultUserRoles.map(
                     r => UserRole[r],
                 );
-                console.log(this.generalConfig);
             });
 
             this.formReady = true;