core/ui-settings/ui-settings.component.ts
OnInit
OnDestroy
selector | c8y-ui-settings |
templateUrl | ./ui-settings.component.html |
Properties |
|
Methods |
|
constructor(translate: TranslateService, state: AppStateService, ui: AppStateService, userPreferences: UserPreferencesService, c8yModalService: ModalService, headerService: HeaderService, themeSwitcher: ThemeSwitcherService)
|
||||||||||||||||||||||||
Parameters :
|
ngOnDestroy |
ngOnDestroy()
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
Async onLanguageChange | ||||||
onLanguageChange(changedLang: string)
|
||||||
Parameters :
Returns :
Promise<void>
|
Async persistLanguage | ||||||
persistLanguage(lang: string)
|
||||||
Parameters :
Returns :
Promise<boolean>
|
currentLang |
Type : string
|
languages |
Type : literal type[]
|
open$ |
Type : Observable<boolean>
|
Public themeSwitcher |
Type : ThemeSwitcherService
|
<div class="separator-top p-t-8 p-b-8">
<div class="c8y-right-drawer__item sticky-top">
<i c8yIcon="eyedropper"></i>
<span class="text-bold">{{ 'UI settings' | translate }}</span>
</div>
<div
class="p-l-16 p-r-16 p-b-16"
*ngIf="themeSwitcher.darkThemeAvailable$ | async"
>
<p translate>Theme</p>
<div
class="c8y-switch-multistate"
*ngIf="themeSwitcher.userSelectedThemePreference$ | async as themePreference"
>
<ng-container *ngFor="let themeOption of themeSwitcher.themeOptions; index as i">
<input
[attr.aria-label]="themeOption.label"
tabindex="{{ (open$ | async) ? '0' : '-1' }}"
name="theme-switcher"
type="radio"
[id]="'theme-option-' + i"
[disabled]="themeSwitcher.disableThemeSelection$ | async"
[checked]="themePreference === themeOption.value"
(click)="themeSwitcher.changeUserPreference(themeOption.value)"
/>
<label
title="{{ themeOption.label | translate }}"
[for]="'theme-option-' + i"
>
<i [c8yIcon]="themeOption.icon"></i>
</label>
</ng-container>
<div class="c8y-switch-multistate__handle"></div>
</div>
</div>
<div class="form-group p-l-16 p-r-16">
<label
for="userLang"
translate
>
Language
</label>
<div class="c8y-select-wrapper">
<select
id="userLang"
tabindex="{{ (open$ | async) ? '0' : '-1' }}"
#selectLang
[ngModel]="currentLang"
(change)="onLanguageChange(selectLang.value)"
>
<option
*ngFor="let language of languages"
[value]="language.lang"
>
{{ language.nativeLanguage }}
</option>
</select>
<span></span>
</div>
</div>
</div>