diff --git a/frontend/package-lock.json b/frontend/package-lock.json index be1f3dda4..e7b2ea606 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -18,6 +18,9 @@ "@angular/router": "^14.1.0", "@ionic/angular": "^6.1.15", "@materia-ui/ngx-monaco-editor": "^6.0.0", + "@ng-web-apis/common": "^2.0.0", + "@ng-web-apis/mutation-observer": "^2.0.0", + "@ng-web-apis/resize-observer": "^2.0.0", "@start9labs/argon2": "^0.1.0", "@start9labs/emver": "^0.1.5", "angular-svg-round-progressbar": "^9.0.0", @@ -3266,6 +3269,42 @@ "rxjs": ">=6.0.0" } }, + "node_modules/@ng-web-apis/common": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@ng-web-apis/common/-/common-2.0.0.tgz", + "integrity": "sha512-2Vnp4WTEqKZArhbKLgD1JIKjsDa3hWCa67OWaRWRH5sgX5xneVVaIAvC8gVpiCfl2p1Roen2kxfyYngx7G64SQ==", + "dependencies": { + "tslib": "^2.2.0" + }, + "peerDependencies": { + "@angular/common": ">=12.0.0", + "@angular/core": ">=12.0.0" + } + }, + "node_modules/@ng-web-apis/mutation-observer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@ng-web-apis/mutation-observer/-/mutation-observer-2.0.0.tgz", + "integrity": "sha512-f51Cu2DloNze1HaTWdUbtYFnt9VXhzpEnHDd9KFdiKOUNfEDx7wrSXIEQqv810hrq7F2jcIAERCdiqV6ItH7Pg==", + "dependencies": { + "tslib": "^2.2.0" + }, + "peerDependencies": { + "@angular/core": ">=12.0.0", + "@ng-web-apis/common": ">=2.0.0" + } + }, + "node_modules/@ng-web-apis/resize-observer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@ng-web-apis/resize-observer/-/resize-observer-2.0.0.tgz", + "integrity": "sha512-umuXJepTYBCI3ZcW9873fozO0qt1PeHLBNM+wXA+7Wphy35+RQcPNmkwfgkKqWceIjlYAvyuPTNWa5TM1OEeqg==", + "dependencies": { + "tslib": "^2.2.0" + }, + "peerDependencies": { + "@angular/core": ">=12.0.0", + "@ng-web-apis/common": ">=2.0.0" + } + }, "node_modules/@ngtools/webpack": { "version": "14.2.3", "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-14.2.3.tgz", @@ -16891,6 +16930,30 @@ "tslib": "^2.0.0" } }, + "@ng-web-apis/common": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@ng-web-apis/common/-/common-2.0.0.tgz", + "integrity": "sha512-2Vnp4WTEqKZArhbKLgD1JIKjsDa3hWCa67OWaRWRH5sgX5xneVVaIAvC8gVpiCfl2p1Roen2kxfyYngx7G64SQ==", + "requires": { + "tslib": "^2.2.0" + } + }, + "@ng-web-apis/mutation-observer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@ng-web-apis/mutation-observer/-/mutation-observer-2.0.0.tgz", + "integrity": "sha512-f51Cu2DloNze1HaTWdUbtYFnt9VXhzpEnHDd9KFdiKOUNfEDx7wrSXIEQqv810hrq7F2jcIAERCdiqV6ItH7Pg==", + "requires": { + "tslib": "^2.2.0" + } + }, + "@ng-web-apis/resize-observer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@ng-web-apis/resize-observer/-/resize-observer-2.0.0.tgz", + "integrity": "sha512-umuXJepTYBCI3ZcW9873fozO0qt1PeHLBNM+wXA+7Wphy35+RQcPNmkwfgkKqWceIjlYAvyuPTNWa5TM1OEeqg==", + "requires": { + "tslib": "^2.2.0" + } + }, "@ngtools/webpack": { "version": "14.2.3", "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-14.2.3.tgz", diff --git a/frontend/package.json b/frontend/package.json index b28da8090..9d13d7ac6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -39,6 +39,9 @@ "@angular/platform-browser-dynamic": "^14.1.0", "@angular/router": "^14.1.0", "@ionic/angular": "^6.1.15", + "@ng-web-apis/common": "^2.0.0", + "@ng-web-apis/mutation-observer": "^2.0.0", + "@ng-web-apis/resize-observer": "^2.0.0", "@materia-ui/ngx-monaco-editor": "^6.0.0", "@start9labs/argon2": "^0.1.0", "@start9labs/emver": "^0.1.5", diff --git a/frontend/projects/shared/package.json b/frontend/projects/shared/package.json index 3ccefeee3..22ded4fb3 100644 --- a/frontend/projects/shared/package.json +++ b/frontend/projects/shared/package.json @@ -6,6 +6,8 @@ "@angular/core": ">=13.2.0", "@angular/router": ">=13.2.0", "@ionic/angular": ">=6.0.0", + "@ng-web-apis/mutation-observer": ">=2.0.0", + "@ng-web-apis/resize-observer": ">=2.0.0", "@start9labs/emver": "^0.1.5" }, "exports": { diff --git a/frontend/projects/shared/src/components/elastic-container/elastic-container.component.html b/frontend/projects/shared/src/components/elastic-container/elastic-container.component.html new file mode 100644 index 000000000..c587915cf --- /dev/null +++ b/frontend/projects/shared/src/components/elastic-container/elastic-container.component.html @@ -0,0 +1,3 @@ +
{{ getEnumListDisplay(formArr.value, $any(spec.spec)) }}
+ {{ formArr.value | toEnumListDisplay: $any(spec.spec) }}
No config options for {{ pkg.manifest.title }} {{
@@ -111,7 +111,11 @@
',
default: 'internal',
- warning: 'Careful changing this',
tag: {
id: 'type',
- name: 'Type',
'variant-names': {
internal: 'Internal',
external: 'External',
},
+ name: 'Bitcoin Node Settings',
+ description: 'Options
',
+ warning: 'Careful changing this',
},
variants: {
internal: {
diff --git a/frontend/projects/ui/src/app/services/api/mock-patch.ts b/frontend/projects/ui/src/app/services/api/mock-patch.ts
index 1cc63b60d..093b9e2bd 100644
--- a/frontend/projects/ui/src/app/services/api/mock-patch.ts
+++ b/frontend/projects/ui/src/app/services/api/mock-patch.ts
@@ -345,18 +345,17 @@ export const mockPatchData: DataModel = {
},
},
bitcoinNode: {
- name: 'Bitcoin Node Settings',
type: 'union',
- description: 'The node settings',
default: 'internal',
- warning: 'Careful changing this',
tag: {
id: 'type',
- name: 'Type',
'variant-names': {
internal: 'Internal',
external: 'External',
},
+ name: 'Bitcoin Node Settings',
+ description: 'The node settings',
+ warning: 'Careful changing this',
},
variants: {
internal: {
diff --git a/frontend/projects/ui/src/app/services/form.service.ts b/frontend/projects/ui/src/app/services/form.service.ts
index dd861a348..66d368b50 100644
--- a/frontend/projects/ui/src/app/services/form.service.ts
+++ b/frontend/projects/ui/src/app/services/form.service.ts
@@ -46,9 +46,7 @@ export class FormService {
current?: { [key: string]: any } | null,
): UntypedFormGroup {
const { variants, tag } = spec
- const { name, description, warning } = isFullUnion(spec)
- ? spec
- : { ...spec.tag, warning: undefined }
+ const { name, description, warning, 'variant-names': variantNames } = tag
const enumSpec: ValueSpecEnum = {
type: 'enum',
@@ -57,7 +55,7 @@ export class FormService {
warning,
default: selection,
values: Object.keys(variants),
- 'value-names': tag['variant-names'],
+ 'value-names': variantNames,
}
return this.getFormGroup(
{ [spec.tag.id]: enumSpec, ...spec.variants[selection] },
@@ -207,12 +205,6 @@ function listValidators(spec: ValueSpecList): ValidatorFn[] {
return validators
}
-function isFullUnion(
- spec: ValueSpecUnion | ListValueSpecUnion,
-): spec is ValueSpecUnion {
- return !!(spec as ValueSpecUnion).name
-}
-
export function numberInRange(stringRange: string): ValidatorFn {
return control => {
const value = control.value
@@ -461,15 +453,18 @@ function uniqueByMessageWrapper(
) {
let configSpec: ConfigSpec
if (isUnion(spec)) {
- const variantKey = obj[spec.tag.id]
- configSpec = spec.variants[variantKey]
+ const tagId = spec.tag.id
+ configSpec = {
+ [tagId]: { name: spec.tag.name } as ValueSpec,
+ ...spec.variants[obj[tagId]],
+ }
} else {
configSpec = spec.spec
}
const message = uniqueByMessage(uniqueBy, configSpec)
if (message) {
- return ' Must be unique by: ' + message + '.'
+ return ' Must be unique by: ' + message
}
}
@@ -483,7 +478,9 @@ function uniqueByMessage(
if (uniqueBy === null) {
return ''
} else if (typeof uniqueBy === 'string') {
- return configSpec[uniqueBy] ? configSpec[uniqueBy].name : uniqueBy
+ return configSpec[uniqueBy]
+ ? (configSpec[uniqueBy] as ValueSpecObject).name
+ : uniqueBy
} else if ('any' in uniqueBy) {
joinFunc = ' OR '
for (let subSpec of uniqueBy.any) {