core/common/ui-state.service.ts
Properties |
Methods |
|
Accessors |
constructor(applicationService: ApplicationService, apiService: ApiService, options: OptionsService, fetchClient: FetchClient, tenantLoginOptionsService: TenantLoginOptionsService)
|
||||||||||||||||||
Parameters :
|
assignApplicationKeyToDefaultHeaders |
assignApplicationKeyToDefaultHeaders()
|
Returns :
void
|
Protected currentAppsOfUser$ |
currentAppsOfUser$()
|
Returns :
Observable<IApplication[]>
|
getCurrentContextPath |
getCurrentContextPath()
|
Returns :
any
The current contextPath. |
getLangs |
getLangs()
|
Returns :
any
|
Async isApplicationAvailable | ||||||||
isApplicationAvailable(name: string)
|
||||||||
Checks current users application list and matches it against given application name. Returns true if application is in the list.
Parameters :
Returns :
unknown
|
isOwnerOfApplication | ||||||||
isOwnerOfApplication(app?: IApplication)
|
||||||||
Verifies if the current application is owned by the current tenant.
Parameters :
Returns :
boolean
true if it belongs to the current tenant. |
isOwnerOfApplication$ | ||||||||
isOwnerOfApplication$(app?: IApplication)
|
||||||||
Verifies if the current application is owned by the current tenant.
Parameters :
Returns :
Observable<boolean>
true if it belongs to the current tenant. |
Async loadManifest |
loadManifest()
|
Loads the app manifest. If no access -> throw an error to verify app access.
Returns :
any
|
Protected onAppChangesCompletion$ |
onAppChangesCompletion$()
|
An Observable emitting once all POST, PUT, DELETE requests to the application API finished
Returns :
Observable<void>
|
Async refreshLoginOptions |
refreshLoginOptions()
|
Decorators :
@throttle(600, {trailing: false})
|
When this function called, it refreshes the values of loginOptions stored within ui state object. Function is throttled to execute the refresh once in a time specified by params of @throttled decorator, it should be called on leading edge of the timeout.
Returns :
any
|
setUser | ||||||||
setUser(userInfo: literal type)
|
||||||||
Sets current user (including support user).
Parameters :
Returns :
void
|
Protected emitNewState |
emitNewState()
|
Emits a new state.
Returns :
void
|
map | ||||||||
map(mappedProperty: (undefined) => void)
|
||||||||
Maps to a property and just returns that property.
Parameters :
Returns :
Observable<any>
|
Public apiService |
Type : ApiService
|
currentApplication |
Type : BehaviorSubject<IApplication | null>
|
Default value : new BehaviorSubject(null)
|
currentApplicationConfig |
Type : Observable<any>
|
Default value : this.currentApplication.pipe(
filter(app => !!app),
map(app => app?.config || null)
)
|
currentAppsOfUser |
Type : Observable<IApplication[]>
|
An Observable of the applications available for the current user. The Observable emits a new array on user changes or if the application performs POST, PUT or DELETE requests to the application API. |
currentSupportUserName |
Type : BehaviorSubject<string | null>
|
Default value : new BehaviorSubject(null)
|
currentTenant |
Type : BehaviorSubject<ICurrentTenant | null>
|
Default value : new BehaviorSubject(null)
|
currentUser |
Type : BehaviorSubject<IUser | null>
|
Default value : new BehaviorSubject(null)
|
state$ |
Type : BehaviorSubject<any>
|
Default value : new BehaviorSubject<any>({
app: {
name: this.options.name,
contextPath: this.getCurrentContextPath() || this.options.contextPath,
icon: this.options.icon
},
supportUrl: this.options.supportUrl,
lang: this.options.get('defaultLanguage', 'en'),
langs: this.getLangs(),
langsDetail: this.options.languages,
loginOptions: this.options.loginOptions,
activateSupportUserAvailable: undefined,
versions: {
backend: undefined,
ui: this.options.versions || { ngx: undefined }
},
hidePowered: this.options.hidePowered,
isLoading: false,
showRightDrawer: this.options.rightDrawer,
loginExtraLink: this.options.get('login_extra_link'),
newsletter: this.options.newsletter
})
|
Saves the state. Should not be accessible directly. Use map or the getter to access the state. Use functions in the implementation to change the state. |
state |
getstate()
|
Returns the current state. |
uiVersion |
getuiVersion()
|
Returns the correct UI version. In hybrid mode for angular and ngx. |