Skip to content
This repository was archived by the owner on Mar 15, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
a094aff
Refactor to use separate formGroups
eliykat Nov 30, 2021
187c990
Dynamically disable form controls
eliykat Nov 30, 2021
d65f9cc
Add required validators
eliykat Nov 30, 2021
aa5af2f
Use ngValue to preserve type of all form values
eliykat Nov 30, 2021
9ccb8d0
Add requiredIf validator and form configuration
eliykat Nov 30, 2021
e20b696
Move select options to component, form layout
eliykat Nov 30, 2021
811cb57
Simplify requiredIf validator
eliykat Dec 1, 2021
b738acf
Add error count message
eliykat Dec 1, 2021
9378bf0
Update strings
eliykat Dec 1, 2021
43f3af1
Minor changes to form config
eliykat Dec 1, 2021
270885d
Add inline error messages, clear errors directive
eliykat Dec 1, 2021
634b171
Add styling for invalid fields
eliykat Dec 1, 2021
427e36b
Update directive name
eliykat Dec 1, 2021
bbf341e
Linting
eliykat Dec 1, 2021
edfbd2a
Update form labels and layout
eliykat Dec 1, 2021
180b0b3
Move openId customization into own section
eliykat Dec 1, 2021
820b003
Split Sso config form into multiple components
eliykat Dec 1, 2021
e97330a
Refactor how parent handles SsoUrls
eliykat Dec 1, 2021
58dfb0f
Update naming conventions
eliykat Dec 2, 2021
4cadf78
Use new patterns for keyConnectorUrl test
eliykat Dec 2, 2021
f684d62
Strip spaces from inputs
eliykat Dec 2, 2021
ab91710
Move validators to jslib
eliykat Dec 2, 2021
8747abf
Don't validate X509 format
eliykat Dec 2, 2021
adddeb8
Add a11y-invalid directive
eliykat Dec 2, 2021
61ce684
Add helper text for openId Authority
eliykat Dec 2, 2021
88d41ee
Add aria-describedby, simplify error messages
eliykat Dec 2, 2021
f064bfc
Fix styling on headers
eliykat Dec 2, 2021
a8620f2
Add aria-describedby
eliykat Dec 2, 2021
ddd1872
Fix styling on section headers
eliykat Dec 2, 2021
dacb2ea
Fix linting
eliykat Dec 2, 2021
5b4f3d3
Update copy
eliykat Dec 2, 2021
6828fd4
Fix typo
eliykat Dec 2, 2021
fb8412d
Remove unneeded sr-only, fix inline error styling
eliykat Dec 2, 2021
f8c6d50
Add default form values
eliykat Dec 2, 2021
cc5f891
Simplify templating logic
eliykat Dec 3, 2021
ff35922
Use validate on dirty and blur pattern
eliykat Dec 7, 2021
dae48a8
Update imports and naming
eliykat Dec 7, 2021
56fb612
Always require X509 Certificate
eliykat Dec 7, 2021
eae3201
Remove required validator for keyConnectorUrl
eliykat Dec 7, 2021
1df0ad5
Unblock api call
eliykat Dec 7, 2021
4956558
Fix duplicate keyConnector inline messages
eliykat Dec 7, 2021
cf69f64
Add None to SsoType enum
eliykat Dec 8, 2021
2b98662
Use ssoConfigView, restructure forms
eliykat Dec 8, 2021
8fe036e
Use prebuilt dirty validators
eliykat Dec 8, 2021
12c1a23
Add sr-only error text and role=alert for errors
eliykat Dec 8, 2021
cc48126
Add field name to inline errors, fix manual validation
eliykat Dec 8, 2021
7e185b8
Refer to fields instead of errors
eliykat Dec 8, 2021
3afbf82
Fix updateOn options
eliykat Dec 9, 2021
dc62521
Fix linting and layout
eliykat Dec 9, 2021
88f3ce5
Force screenreader to read out error summary
eliykat Dec 9, 2021
d4bccd0
Revert jslib update
eliykat Dec 9, 2021
1a082ab
Revert jslib update
eliykat Dec 9, 2021
ec89297
Put everything back into parent component
eliykat Dec 9, 2021
65e7203
Rename fb to formBuilder
eliykat Dec 9, 2021
8c548a9
Merge commit '2b0a9d995e0147601ca8ae4778434a19354a60c2' into fix/sso-…
eliykat Jan 11, 2022
b202e07
Run prettier
eliykat Jan 11, 2022
13e44f9
Merge commit '56477eb39cfd8a73c9920577d24d75fed36e2cf5' into fix/sso-…
eliykat Jan 11, 2022
83f0612
Fix merge errors
eliykat Jan 11, 2022
343d968
Revert unrelated formatting change
eliykat Jan 11, 2022
4fca7a5
Revert unrelated formatting changes
eliykat Jan 11, 2022
059271e
Revert accidental jslib update
eliykat Jan 11, 2022
367be41
Fix merge errors
eliykat Jan 11, 2022
2c98a4d
Merge branch 'master' into fix/sso-validation
eliykat Jan 11, 2022
16adf9f
Update jslib for testing purposes
eliykat Jan 11, 2022
37c78c4
Revert "Update jslib for testing purposes"
eliykat Jan 11, 2022
cb998a8
Merge branch 'master' into fix/sso-validation
eliykat Feb 18, 2022
d2cf1ac
Reapply new icons
eliykat Feb 18, 2022
2206ee0
Reapply update help site URLs
eliykat Feb 18, 2022
ae24f31
Refactor: move read only fields to component
eliykat Feb 18, 2022
1fa1143
Fix name
eliykat Feb 18, 2022
d0adfa3
Refactor: add input-text component
eliykat Feb 18, 2022
db6c8a1
Fix linting
eliykat Feb 18, 2022
58d7c89
Use CVA for input-text component
eliykat Feb 21, 2022
6a3c946
Automatically detect requiredValidator, more flexible error messages
eliykat Feb 21, 2022
ef8dcb8
Refactor: use select component
eliykat Feb 21, 2022
bd2c6e2
Refactor: use app-input-checkbox component
eliykat Feb 21, 2022
81a5e70
Add whitespace
eliykat Feb 21, 2022
fb9639a
Change folder structure
eliykat Feb 21, 2022
c59c714
WIP: use CVA base class
eliykat Feb 21, 2022
136dc6f
Use clambda properties instead of methods
eliykat Feb 21, 2022
6e99334
Hook up blur, fix onChanges
eliykat Feb 21, 2022
956816d
Remove unused methods and tidy up
eliykat Feb 22, 2022
8c7f763
Fix linting
eliykat Feb 22, 2022
38cef19
Rename interface
eliykat Feb 22, 2022
0db47d2
Don't load form if no config data received
eliykat Feb 22, 2022
a807006
Update name of selector
eliykat Feb 22, 2022
9817d36
Add i18n string
eliykat Feb 24, 2022
9c18392
Move SSO Config Form components into bitwarden_license
eliykat Feb 24, 2022
d0288e3
Update jslib
eliykat Feb 24, 2022
4be9625
Add i18n error message
eliykat Feb 24, 2022
a40cc0a
Update imports
eliykat Feb 24, 2022
104d339
Merge branch 'master' into fix/sso-validation
eliykat Feb 24, 2022
6edbdfd
Merge branch 'update-jslib' into fix/sso-validation
eliykat Feb 24, 2022
6820a72
Fix aria-invalid and invalid styling
eliykat Feb 24, 2022
1d37ba0
Update jslib
eliykat Mar 1, 2022
31fad71
Merge branch 'master' into fix/sso-validation
eliykat Mar 1, 2022
66b80f7
Remove old string
eliykat Mar 1, 2022
c07b565
Add comments
eliykat Mar 1, 2022
e27aa99
Fix styling
eliykat Mar 1, 2022
4c7bdf9
Update jslib
eliykat Mar 1, 2022
6a65356
Linting and unused imports
eliykat Mar 1, 2022
54a9c1f
Reset jslib
eliykat Mar 2, 2022
a8b0f37
Merge branch 'master' into fix/sso-validation
eliykat Mar 2, 2022
2edc243
Update jslib
eliykat Mar 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { Directive, Input, OnInit, Self } from "@angular/core";
import { ControlValueAccessor, FormControl, NgControl, Validators } from "@angular/forms";

import { dirtyRequired } from "jslib-angular/validators/dirty.validator";

/** For use in the SSO Config Form only - will be deprecated by the Component Library */
@Directive()
export abstract class BaseCvaComponent implements ControlValueAccessor, OnInit {
get describedById() {
return this.showDescribedBy ? this.controlId + "Desc" : null;
}

get showDescribedBy() {
return this.helperText != null || this.controlDir.control.hasError("required");
}

get isRequired() {
return (
this.controlDir.control.hasValidator(Validators.required) ||
this.controlDir.control.hasValidator(dirtyRequired)
);
}

@Input() label: string;
@Input() controlId: string;
@Input() helperText: string;

internalControl = new FormControl("");

protected onChange: any;
protected onTouched: any;

constructor(@Self() public controlDir: NgControl) {
this.controlDir.valueAccessor = this;
}

ngOnInit() {
this.internalControl.valueChanges.subscribe(this.onValueChangesInternal);
}

onBlurInternal() {
this.onTouched();
}

// CVA interfaces
writeValue(value: string) {
this.internalControl.setValue(value);
}

registerOnChange(fn: any) {
this.onChange = fn;
}

registerOnTouched(fn: any) {
this.onTouched = fn;
}

setDisabledState(isDisabled: boolean) {
if (isDisabled) {
this.internalControl.disable();
} else {
this.internalControl.enable();
}
}

protected onValueChangesInternal: any = (value: string) => this.onChange(value);
// End CVA interfaces
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="form-group">
<div class="form-check">
<input
class="form-check-input"
type="checkbox"
[attr.id]="controlId"
[attr.aria-describedby]="describedById"
[formControl]="internalControl"
(blur)="onBlurInternal()"
/>
<label class="form-check-label" [attr.for]="controlId">{{ label }}</label>
</div>
<small *ngIf="showDescribedBy" [attr.id]="describedById" class="form-text text-muted">{{
helperText
}}</small>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from "@angular/core";

import { BaseCvaComponent } from "./base-cva.component";

/** For use in the SSO Config Form only - will be deprecated by the Component Library */
@Component({
selector: "app-input-checkbox",
templateUrl: "input-checkbox.component.html",
})
export class InputCheckboxComponent extends BaseCvaComponent {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<div class="form-group">
<label>{{ label }}</label>
<div class="input-group">
<input class="form-control" readonly [value]="controlValue" />
<div class="input-group-append" *ngIf="showLaunch">
<button
type="button"
class="btn btn-outline-secondary"
appA11yTitle="{{ 'launch' | i18n }}"
(click)="launchUri(controlValue)"
>
<i class="bwi bwi-lg bwi-external-link" aria-hidden="true"></i>
</button>
</div>
<div class="input-group-append" *ngIf="showCopy">
<button
type="button"
class="btn btn-outline-secondary"
appA11yTitle="{{ 'copyValue' | i18n }}"
(click)="copy(controlValue)"
>
<i class="bwi bwi-lg bwi-clone" aria-hidden="true"></i>
</button>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Component, Input } from "@angular/core";

import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";

/** For use in the SSO Config Form only - will be deprecated by the Component Library */
@Component({
selector: "app-input-text-readonly",
templateUrl: "input-text-readonly.component.html",
})
export class InputTextReadOnlyComponent {
@Input() controlValue: string;
@Input() label: string;
@Input() showCopy = true;
@Input() showLaunch = false;

constructor(private platformUtilsService: PlatformUtilsService) {}

copy(value: string) {
this.platformUtilsService.copyToClipboard(value);
}

launchUri(url: string) {
this.platformUtilsService.launchUri(url);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<div class="form-group">
<label [attr.for]="controlId">
{{ label }}
<small *ngIf="isRequired" class="text-muted form-text d-inline"
>({{ "required" | i18n }})</small
>
</label>
<input
[formControl]="internalControl"
class="form-control"
[attr.id]="controlId"
[attr.aria-describedby]="describedById"
[attr.aria-invalid]="controlDir.control.invalid"
(blur)="onBlurInternal()"
/>
<div *ngIf="showDescribedBy" [attr.id]="describedById">
<small
*ngIf="helperText != null && !controlDir.control.hasError(helperTextSameAsError)"
class="form-text text-muted"
>
{{ helperText }}
</small>
<small class="error-inline" *ngIf="controlDir.control.hasError('required')" role="alert">
<i class="bwi bwi-exclamation-circle" aria-hidden="true"></i>
<span class="sr-only">{{ "error" | i18n }}:</span>
{{
controlDir.control.hasError(helperTextSameAsError)
? helperText
: ("fieldRequiredError" | i18n: label)
}}
</small>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Component, Input, OnInit } from "@angular/core";

import { BaseCvaComponent } from "./base-cva.component";

/** For use in the SSO Config Form only - will be deprecated by the Component Library */
@Component({
selector: "app-input-text[label][controlId]",
templateUrl: "input-text.component.html",
})
export class InputTextComponent extends BaseCvaComponent implements OnInit {
@Input() helperTextSameAsError: string;
@Input() requiredErrorMessage: string;
@Input() stripSpaces = false;

transformValue: (value: string) => string = null;

ngOnInit() {
super.ngOnInit();
if (this.stripSpaces) {
this.transformValue = this.doStripSpaces;
}
}

writeValue(value: string) {
this.internalControl.setValue(value == null ? "" : value);
}

protected onValueChangesInternal: any = (value: string) => {
let newValue = value;
if (this.transformValue != null) {
newValue = this.transformValue(value);
this.internalControl.setValue(newValue, { emitEvent: false });
}
this.onChange(newValue);
};

protected onValueChangeInternal(value: string) {
let newValue = value;
if (this.transformValue != null) {
newValue = this.transformValue(value);
this.internalControl.setValue(newValue, { emitEvent: false });
}
}

private doStripSpaces(value: string) {
return value.replace(/ /g, "");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<div class="form-group">
<label [attr.for]="controlId">
{{ label }}
<small *ngIf="isRequired" class="text-muted form-text d-inline"
>({{ "required" | i18n }})</small
>
</label>
<select
class="form-control"
[attr.id]="controlId"
[attr.aria-invalid]="controlDir.control.invalid"
[formControl]="internalControl"
(blur)="onBlurInternal()"
>
<option *ngFor="let o of selectOptions" [ngValue]="o.value" disabled="{{ o.disabled }}">
{{ o.name }}
</option>
</select>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Component, Input } from "@angular/core";

import { SelectOptions } from "jslib-angular/interfaces/selectOptions";

import { BaseCvaComponent } from "./base-cva.component";

/** For use in the SSO Config Form only - will be deprecated by the Component Library */
@Component({
selector: "app-select",
templateUrl: "select.component.html",
})
export class SelectComponent extends BaseCvaComponent {
@Input() selectOptions: SelectOptions[];
}
Loading