mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 14:29:45 +00:00
fixes
This commit is contained in:
committed by
Aiden McClelland
parent
88ed581d95
commit
f3190cc68f
@@ -17,6 +17,9 @@
|
|||||||
<p *ngIf="control.hasError('numberNotInRange')">
|
<p *ngIf="control.hasError('numberNotInRange')">
|
||||||
Number not in range
|
Number not in range
|
||||||
</p>
|
</p>
|
||||||
|
<p *ngIf="control.hasError('invalidNumber')">
|
||||||
|
Invalid Number
|
||||||
|
</p>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- list -->
|
<!-- list -->
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ export class FormObjectComponent {
|
|||||||
const newItem = this.formService.getListItem(listSpec, val)
|
const newItem = this.formService.getListItem(listSpec, val)
|
||||||
newItem.markAllAsTouched()
|
newItem.markAllAsTouched()
|
||||||
arr.insert(0, newItem)
|
arr.insert(0, newItem)
|
||||||
|
console.log('new Item', newItem)
|
||||||
if (['object', 'union'].includes(listSpec.subtype)) {
|
if (['object', 'union'].includes(listSpec.subtype)) {
|
||||||
const displayAs = (listSpec.spec as ListValueSpecOf<'object'>)['display-as']
|
const displayAs = (listSpec.spec as ListValueSpecOf<'object'>)['display-as']
|
||||||
this.objectListInfo[key].push({
|
this.objectListInfo[key].push({
|
||||||
@@ -163,11 +164,11 @@ export class FormObjectComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private deleteListItem (key: string, index: number, markDirty = true): void {
|
private deleteListItem (key: string, index: number, markDirty = true): void {
|
||||||
this.objectListInfo[key][index].height = '0px'
|
if (this.objectListInfo[key]) this.objectListInfo[key][index].height = '0px'
|
||||||
const arr = this.formGroup.get(key) as FormArray
|
const arr = this.formGroup.get(key) as FormArray
|
||||||
if (markDirty) arr.markAsDirty()
|
if (markDirty) arr.markAsDirty()
|
||||||
pauseFor(500).then(() => {
|
pauseFor(500).then(() => {
|
||||||
this.objectListInfo[key].splice(index, 1)
|
if (this.objectListInfo[key]) this.objectListInfo[key].splice(index, 1)
|
||||||
arr.removeAt(index)
|
arr.removeAt(index)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ export class AppInterfacesPage {
|
|||||||
const pkgId = this.route.snapshot.paramMap.get('pkgId')
|
const pkgId = this.route.snapshot.paramMap.get('pkgId')
|
||||||
const pkg = this.patch.data['package-data'][pkgId]
|
const pkg = this.patch.data['package-data'][pkgId]
|
||||||
const interfaces = pkg.manifest.interfaces
|
const interfaces = pkg.manifest.interfaces
|
||||||
const addressesMap = pkg.installed['interface-addresses']
|
const addressesMap = pkg.installed['interface-addresses'] || { }
|
||||||
const ui = interfaces['ui']
|
const ui = interfaces['ui']
|
||||||
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
const uiAddresses = addressesMap['ui']
|
const uiAddresses = addressesMap['ui'] || { }
|
||||||
this.ui = {
|
this.ui = {
|
||||||
def: ui,
|
def: ui,
|
||||||
addresses: {
|
addresses: {
|
||||||
@@ -50,8 +50,8 @@ export class AppInterfacesPage {
|
|||||||
return {
|
return {
|
||||||
def: interfaces[key],
|
def: interfaces[key],
|
||||||
addresses: {
|
addresses: {
|
||||||
'lan-address': addresses['lan-address'] ? 'https://' + addresses['lan-address'] : null,
|
'lan-address': addresses && addresses['lan-address'] ? 'https://' + addresses['lan-address'] : null,
|
||||||
'tor-address': addresses['tor-address'] ? 'http://' + addresses['tor-address'] : null,
|
'tor-address': addresses && addresses['tor-address'] ? 'http://' + addresses['tor-address'] : null,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -119,6 +119,8 @@ export class FormService {
|
|||||||
private numberValidators (spec: ValueSpecNumber | ListValueSpecNumber): ValidatorFn[] {
|
private numberValidators (spec: ValueSpecNumber | ListValueSpecNumber): ValidatorFn[] {
|
||||||
const validators: ValidatorFn[] = []
|
const validators: ValidatorFn[] = []
|
||||||
|
|
||||||
|
validators.push(isNumber())
|
||||||
|
|
||||||
if (!(spec as ValueSpecNumber).nullable) {
|
if (!(spec as ValueSpecNumber).nullable) {
|
||||||
validators.push(Validators.required)
|
validators.push(Validators.required)
|
||||||
}
|
}
|
||||||
@@ -160,6 +162,14 @@ export function numberInRange (stringRange: string): ValidatorFn {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isNumber (): ValidatorFn {
|
||||||
|
return (control: AbstractControl): ValidationErrors | null => {
|
||||||
|
return control.value == Number(control.value) ?
|
||||||
|
null :
|
||||||
|
{ invalidNumber: { value: control.value } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function isInteger (): ValidatorFn {
|
export function isInteger (): ValidatorFn {
|
||||||
return (control: AbstractControl): ValidationErrors | null => {
|
return (control: AbstractControl): ValidationErrors | null => {
|
||||||
return control.value == Math.trunc(control.value) ?
|
return control.value == Math.trunc(control.value) ?
|
||||||
|
|||||||
Reference in New Issue
Block a user