mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 14:29:45 +00:00
fix amination for config nested objects
This commit is contained in:
committed by
Aiden McClelland
parent
923ed6fe4e
commit
397a71cb0d
@@ -82,7 +82,7 @@
|
|||||||
name="chevron-up"
|
name="chevron-up"
|
||||||
[ngStyle]="{
|
[ngStyle]="{
|
||||||
'transform': objectDisplay[entry.key].expanded ? 'rotate(0deg)' : 'rotate(180deg)',
|
'transform': objectDisplay[entry.key].expanded ? 'rotate(0deg)' : 'rotate(180deg)',
|
||||||
'transition': 'transform 0.4s ease-out'
|
'transition': 'transform 0.25s ease-out'
|
||||||
}"
|
}"
|
||||||
></ion-icon>
|
></ion-icon>
|
||||||
</ion-item-divider>
|
</ion-item-divider>
|
||||||
@@ -93,8 +93,7 @@
|
|||||||
'max-height': objectDisplay[entry.key].height,
|
'max-height': objectDisplay[entry.key].height,
|
||||||
'overflow': 'hidden',
|
'overflow': 'hidden',
|
||||||
'transition-property': 'max-height',
|
'transition-property': 'max-height',
|
||||||
'transition-duration': '.5s',
|
'transition-duration': '.25s'
|
||||||
'transition-delay': '.05s'
|
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="nested-wrapper">
|
<div class="nested-wrapper">
|
||||||
@@ -106,7 +105,7 @@
|
|||||||
[formGroup]="$any(entry.value)"
|
[formGroup]="$any(entry.value)"
|
||||||
[current]="current ? current[entry.key] : undefined"
|
[current]="current ? current[entry.key] : undefined"
|
||||||
[unionSpec]="spec.type === 'union' ? spec : undefined"
|
[unionSpec]="spec.type === 'union' ? spec : undefined"
|
||||||
(onUnionChange)="resizeUnion(entry.key)"
|
(onExpand)="resize(entry.key)"
|
||||||
></form-object>
|
></form-object>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ ion-item-divider {
|
|||||||
|
|
||||||
.nested-wrapper {
|
.nested-wrapper {
|
||||||
padding: 0 0 30px 30px;
|
padding: 0 0 30px 30px;
|
||||||
// border-bottom: 1px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.13))))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.validation-error {
|
.validation-error {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Component, Input, Output, SimpleChange, EventEmitter } from '@angular/core'
|
import { Component, Input, Output, EventEmitter } from '@angular/core'
|
||||||
import { AbstractFormGroupDirective, FormArray, FormGroup } from '@angular/forms'
|
import { AbstractFormGroupDirective, FormArray, FormGroup } from '@angular/forms'
|
||||||
import { AlertButton, AlertController, IonicSafeString, ModalController } from '@ionic/angular'
|
import { AlertButton, AlertController, IonicSafeString, ModalController } from '@ionic/angular'
|
||||||
import { ConfigSpec, ListValueSpecOf, ValueSpec, ValueSpecBoolean, ValueSpecList, ValueSpecListOf, ValueSpecUnion } from 'src/app/pkg-config/config-types'
|
import { ConfigSpec, ListValueSpecOf, ValueSpec, ValueSpecBoolean, ValueSpecList, ValueSpecListOf, ValueSpecUnion } from 'src/app/pkg-config/config-types'
|
||||||
@@ -20,7 +20,7 @@ export class FormObjectComponent {
|
|||||||
@Input() current: { [key: string]: any }
|
@Input() current: { [key: string]: any }
|
||||||
@Input() showEdited: boolean = false
|
@Input() showEdited: boolean = false
|
||||||
@Output() onInputChange = new EventEmitter<void>()
|
@Output() onInputChange = new EventEmitter<void>()
|
||||||
@Output() onUnionChange = new EventEmitter<void>()
|
@Output() onExpand = new EventEmitter<void>()
|
||||||
warningAck: { [key: string]: boolean } = { }
|
warningAck: { [key: string]: boolean } = { }
|
||||||
unmasked: { [key: string]: boolean } = { }
|
unmasked: { [key: string]: boolean } = { }
|
||||||
objectDisplay: { [key: string]: { expanded: boolean, height: string } } = { }
|
objectDisplay: { [key: string]: { expanded: boolean, height: string } } = { }
|
||||||
@@ -74,13 +74,14 @@ export class FormObjectComponent {
|
|||||||
this.formGroup.addControl(control, unionGroup.controls[control])
|
this.formGroup.addControl(control, unionGroup.controls[control])
|
||||||
})
|
})
|
||||||
|
|
||||||
this.onUnionChange.emit()
|
this.onExpand.emit()
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeUnion (key: string): void {
|
resize (key: string): void {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.objectDisplay[key].height = this.getDocSize(key)
|
this.objectDisplay[key].height = this.getDocSize(key)
|
||||||
}, 100)
|
this.onExpand.emit()
|
||||||
|
}, 250) // 250 to match transition-duration, defined in html
|
||||||
}
|
}
|
||||||
|
|
||||||
addListItemWrapper (key: string, spec: ValueSpec) {
|
addListItemWrapper (key: string, spec: ValueSpec) {
|
||||||
@@ -114,6 +115,7 @@ export class FormObjectComponent {
|
|||||||
toggleExpandObject (key: string) {
|
toggleExpandObject (key: string) {
|
||||||
this.objectDisplay[key].expanded = !this.objectDisplay[key].expanded
|
this.objectDisplay[key].expanded = !this.objectDisplay[key].expanded
|
||||||
this.objectDisplay[key].height = this.objectDisplay[key].expanded ? this.getDocSize(key) : '0px'
|
this.objectDisplay[key].height = this.objectDisplay[key].expanded ? this.getDocSize(key) : '0px'
|
||||||
|
this.onExpand.emit()
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleExpandListObject (key: string, i: number) {
|
toggleExpandListObject (key: string, i: number) {
|
||||||
@@ -233,7 +235,7 @@ export class FormObjectComponent {
|
|||||||
added.forEach(val => this.addListItem(key, false, val))
|
added.forEach(val => this.addListItem(key, false, val))
|
||||||
}
|
}
|
||||||
|
|
||||||
getDocSize (selected: string) {
|
private getDocSize (selected: string) {
|
||||||
const element = document.getElementById(selected)
|
const element = document.getElementById(selected)
|
||||||
return `${element.scrollHeight}px`
|
return `${element.scrollHeight}px`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1368,6 +1368,47 @@ export module Mock {
|
|||||||
'unique-by': null,
|
'unique-by': null,
|
||||||
'description': 'Advanced settings',
|
'description': 'Advanced settings',
|
||||||
'spec': {
|
'spec': {
|
||||||
|
'bitcoin-node': {
|
||||||
|
'name': 'Bitcoin Node Settings',
|
||||||
|
'type': 'union',
|
||||||
|
'unique-by': null,
|
||||||
|
'description': 'The node settings',
|
||||||
|
'default': 'internal',
|
||||||
|
'warning': 'Careful changing this',
|
||||||
|
'tag': {
|
||||||
|
'id': 'type',
|
||||||
|
'name': 'Type',
|
||||||
|
'variant-names': {
|
||||||
|
'internal': 'Internal',
|
||||||
|
'external': 'External',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'variants': {
|
||||||
|
'internal': {
|
||||||
|
'lan-address': {
|
||||||
|
'name': 'LAN Address',
|
||||||
|
'type': 'pointer',
|
||||||
|
'subtype': 'app',
|
||||||
|
'target': 'lan-address',
|
||||||
|
'app-id': 'bitcoind',
|
||||||
|
'description': 'the lan address',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'external': {
|
||||||
|
'public-domain': {
|
||||||
|
'name': 'Public Domain',
|
||||||
|
'type': 'string',
|
||||||
|
'description': 'the public address of the node',
|
||||||
|
'nullable': false,
|
||||||
|
'default': 'bitcoinnode.com',
|
||||||
|
'pattern': '.*',
|
||||||
|
'pattern-description': 'anything',
|
||||||
|
'masked': false,
|
||||||
|
'copyable': true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
'notifications': {
|
'notifications': {
|
||||||
'name': 'Notification Preferences',
|
'name': 'Notification Preferences',
|
||||||
'type': 'list',
|
'type': 'list',
|
||||||
@@ -1396,47 +1437,6 @@ export module Mock {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'bitcoin-node': {
|
|
||||||
'name': 'Bitcoin Node Settings',
|
|
||||||
'type': 'union',
|
|
||||||
'unique-by': null,
|
|
||||||
'description': 'The node settings',
|
|
||||||
'default': 'internal',
|
|
||||||
'warning': 'Careful changing this',
|
|
||||||
'tag': {
|
|
||||||
'id': 'type',
|
|
||||||
'name': 'Type',
|
|
||||||
'variant-names': {
|
|
||||||
'internal': 'Internal',
|
|
||||||
'external': 'External',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'variants': {
|
|
||||||
'internal': {
|
|
||||||
'lan-address': {
|
|
||||||
'name': 'LAN Address',
|
|
||||||
'type': 'pointer',
|
|
||||||
'subtype': 'app',
|
|
||||||
'target': 'lan-address',
|
|
||||||
'app-id': 'bitcoind',
|
|
||||||
'description': 'the lan address',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'external': {
|
|
||||||
'public-domain': {
|
|
||||||
'name': 'Public Domain',
|
|
||||||
'type': 'string',
|
|
||||||
'description': 'the public address of the node',
|
|
||||||
'nullable': false,
|
|
||||||
'default': 'bitcoinnode.com',
|
|
||||||
'pattern': '.*',
|
|
||||||
'pattern-description': 'anything',
|
|
||||||
'masked': false,
|
|
||||||
'copyable': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'port': {
|
'port': {
|
||||||
'name': 'Port',
|
'name': 'Port',
|
||||||
'type': 'number',
|
'type': 'number',
|
||||||
|
|||||||
Reference in New Issue
Block a user