mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
default value for device name
This commit is contained in:
committed by
Aiden McClelland
parent
b0c78ad1a0
commit
a74a4b5c28
@@ -13,7 +13,7 @@
|
|||||||
<div style="margin-left: 16px;">
|
<div style="margin-left: 16px;">
|
||||||
<p class="input-label">{{ label }}</p>
|
<p class="input-label">{{ label }}</p>
|
||||||
<ion-item lines="none" color="dark">
|
<ion-item lines="none" color="dark">
|
||||||
<ion-input [type]="useMask && !unmasked ? 'password' : 'text'" [(ngModel)]="value" name="value" (ionChange)="error = ''"></ion-input>
|
<ion-input [type]="useMask && !unmasked ? 'password' : 'text'" [(ngModel)]="value" name="value" [placeholder]="placeholder" (ionChange)="error = ''"></ion-input>
|
||||||
<ion-button slot="end" *ngIf="useMask" fill="clear" color="light" (click)="toggleMask()">
|
<ion-button slot="end" *ngIf="useMask" fill="clear" color="light" (click)="toggleMask()">
|
||||||
<ion-icon slot="icon-only" [name]="unmasked ? 'eye-off-outline' : 'eye-outline'" size="small"></ion-icon>
|
<ion-icon slot="icon-only" [name]="unmasked ? 'eye-off-outline' : 'eye-outline'" size="small"></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
<ion-button fill="clear" (click)="cancel()">
|
<ion-button fill="clear" (click)="cancel()">
|
||||||
Cancel
|
Cancel
|
||||||
</ion-button>
|
</ion-button>
|
||||||
<ion-button fill="clear" type="submit" [disabled]="!value">
|
<ion-button fill="clear" type="submit" [disabled]="!value && !nullable">
|
||||||
{{ buttonText }}
|
{{ buttonText }}
|
||||||
</ion-button>
|
</ion-button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ import { getErrorMessage } from 'src/app/services/error-toast.service'
|
|||||||
export class GenericInputComponent {
|
export class GenericInputComponent {
|
||||||
@Input() title: string
|
@Input() title: string
|
||||||
@Input() message: string
|
@Input() message: string
|
||||||
@Input() label = 'Enter value'
|
@Input() label: string
|
||||||
@Input() buttonText = 'Submit'
|
@Input() buttonText = 'Submit'
|
||||||
|
@Input() placeholder = 'Enter Value'
|
||||||
|
@Input() nullable = false
|
||||||
@Input() useMask = false
|
@Input() useMask = false
|
||||||
@Input() value = ''
|
@Input() value = ''
|
||||||
@Input() submitFn: (value: string) => Promise<any>
|
@Input() submitFn: (value: string) => Promise<any>
|
||||||
|
|||||||
@@ -34,9 +34,11 @@ export class PreferencesPage {
|
|||||||
message: 'This is for your reference only.',
|
message: 'This is for your reference only.',
|
||||||
label: 'Device Name',
|
label: 'Device Name',
|
||||||
useMask: false,
|
useMask: false,
|
||||||
|
placeholder: this.patch.data['server-info'].id,
|
||||||
|
nullable: true,
|
||||||
value: this.patch.data.ui.name,
|
value: this.patch.data.ui.name,
|
||||||
buttonText: 'Save',
|
buttonText: 'Save',
|
||||||
submitFn: async (value: string) => await this.setDbValue('name', value),
|
submitFn: async (value: string) => await this.setDbValue('name', value || this.patch.data['server-info'].id),
|
||||||
},
|
},
|
||||||
cssClass: 'alertlike-modal',
|
cssClass: 'alertlike-modal',
|
||||||
presentingElement: await this.modalCtrl.getTop(),
|
presentingElement: await this.modalCtrl.getTop(),
|
||||||
|
|||||||
Reference in New Issue
Block a user