UI: Clear code and rename state action
This commit is contained in:
parent
2d2117e9ac
commit
b71ae531bb
@ -27,7 +27,7 @@ export enum AuthActionTypes {
|
|||||||
UPDATE_LAST_PUBLIC_DASHBOARD_ID = '[Auth] Update Last Public Dashboard Id',
|
UPDATE_LAST_PUBLIC_DASHBOARD_ID = '[Auth] Update Last Public Dashboard Id',
|
||||||
UPDATE_HAS_REPOSITORY = '[Auth] Change Has Repository',
|
UPDATE_HAS_REPOSITORY = '[Auth] Change Has Repository',
|
||||||
UPDATE_OPENED_MENU_SECTION = '[Preferences] Update Opened Menu Section',
|
UPDATE_OPENED_MENU_SECTION = '[Preferences] Update Opened Menu Section',
|
||||||
UPDATE_USER_SETTINGS = '[Preferences] Update user settings',
|
PUT_USER_SETTINGS = '[Preferences] Put user settings',
|
||||||
DELETE_USER_SETTINGS = '[Preferences] Delete user settings',
|
DELETE_USER_SETTINGS = '[Preferences] Delete user settings',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,8 +71,8 @@ export class ActionPreferencesUpdateOpenedMenuSection implements Action {
|
|||||||
constructor(readonly payload: { path: string; opened: boolean }) {}
|
constructor(readonly payload: { path: string; opened: boolean }) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ActionPreferencesUpdateUserSettings implements Action {
|
export class ActionPreferencesPutUserSettings implements Action {
|
||||||
readonly type = AuthActionTypes.UPDATE_USER_SETTINGS;
|
readonly type = AuthActionTypes.PUT_USER_SETTINGS;
|
||||||
|
|
||||||
constructor(readonly payload: Partial<UserSettings>) {}
|
constructor(readonly payload: Partial<UserSettings>) {}
|
||||||
}
|
}
|
||||||
@ -85,4 +85,4 @@ export class ActionPreferencesDeleteUserSettings implements Action {
|
|||||||
|
|
||||||
export type AuthActions = ActionAuthAuthenticated | ActionAuthUnauthenticated |
|
export type AuthActions = ActionAuthAuthenticated | ActionAuthUnauthenticated |
|
||||||
ActionAuthLoadUser | ActionAuthUpdateUserDetails | ActionAuthUpdateLastPublicDashboardId | ActionAuthUpdateHasRepository |
|
ActionAuthLoadUser | ActionAuthUpdateUserDetails | ActionAuthUpdateLastPublicDashboardId | ActionAuthUpdateHasRepository |
|
||||||
ActionPreferencesUpdateOpenedMenuSection | ActionPreferencesUpdateUserSettings | ActionPreferencesDeleteUserSettings;
|
ActionPreferencesUpdateOpenedMenuSection | ActionPreferencesPutUserSettings | ActionPreferencesDeleteUserSettings;
|
||||||
|
|||||||
@ -40,9 +40,9 @@ export class AuthEffects {
|
|||||||
mergeMap(([action, state]) => this.userSettingsService.putUserSettings({ openedMenuSections: state.userSettings.openedMenuSections }))
|
mergeMap(([action, state]) => this.userSettingsService.putUserSettings({ openedMenuSections: state.userSettings.openedMenuSections }))
|
||||||
), {dispatch: false});
|
), {dispatch: false});
|
||||||
|
|
||||||
updatedUserSettings = createEffect(() => this.actions$.pipe(
|
putUserSettings = createEffect(() => this.actions$.pipe(
|
||||||
ofType(
|
ofType(
|
||||||
AuthActionTypes.UPDATE_USER_SETTINGS,
|
AuthActionTypes.PUT_USER_SETTINGS,
|
||||||
),
|
),
|
||||||
mergeMap((state) => this.userSettingsService.putUserSettings(state.payload))
|
mergeMap((state) => this.userSettingsService.putUserSettings(state.payload))
|
||||||
), {dispatch: false});
|
), {dispatch: false});
|
||||||
|
|||||||
@ -76,7 +76,7 @@ export const authReducer = (
|
|||||||
userSettings = {...state.userSettings, ...{ openedMenuSections: Array.from(openedMenuSections)}};
|
userSettings = {...state.userSettings, ...{ openedMenuSections: Array.from(openedMenuSections)}};
|
||||||
return { ...state, ...{ userSettings }};
|
return { ...state, ...{ userSettings }};
|
||||||
|
|
||||||
case AuthActionTypes.UPDATE_USER_SETTINGS:
|
case AuthActionTypes.PUT_USER_SETTINGS:
|
||||||
userSettings = {...state.userSettings, ...action.payload};
|
userSettings = {...state.userSettings, ...action.payload};
|
||||||
return { ...state, ...{ userSettings }};
|
return { ...state, ...{ userSettings }};
|
||||||
|
|
||||||
|
|||||||
@ -355,7 +355,9 @@ const SNAKE_CASE_REGEXP = /[A-Z]/g;
|
|||||||
|
|
||||||
export function snakeCase(name: string, separator: string): string {
|
export function snakeCase(name: string, separator: string): string {
|
||||||
separator = separator || '_';
|
separator = separator || '_';
|
||||||
return name.replace(SNAKE_CASE_REGEXP, (letter, pos) => (pos ? separator : '') + letter.toLowerCase());
|
return name.replace(SNAKE_CASE_REGEXP, (letter, pos) => {
|
||||||
|
return (pos ? separator : '') + letter.toLowerCase();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDescendantProp(obj: any, path: string): any {
|
export function getDescendantProp(obj: any, path: string): any {
|
||||||
|
|||||||
@ -40,7 +40,7 @@ import {
|
|||||||
NetworkTransportType,
|
NetworkTransportType,
|
||||||
PublishTelemetryCommand
|
PublishTelemetryCommand
|
||||||
} from '@shared/models/device.models';
|
} from '@shared/models/device.models';
|
||||||
import { ActionPreferencesUpdateUserSettings } from '@core/auth/auth.actions';
|
import { ActionPreferencesPutUserSettings } from '@core/auth/auth.actions';
|
||||||
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
||||||
import { getOS } from '@core/utils';
|
import { getOS } from '@core/utils';
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ export class DeviceCheckConnectivityDialogComponent extends
|
|||||||
|
|
||||||
close(): void {
|
close(): void {
|
||||||
if (this.notShowAgain && this.showDontShowAgain) {
|
if (this.notShowAgain && this.showDontShowAgain) {
|
||||||
this.store.dispatch(new ActionPreferencesUpdateUserSettings({ notDisplayConnectivityAfterAddDevice: true }));
|
this.store.dispatch(new ActionPreferencesPutUserSettings({ notDisplayConnectivityAfterAddDevice: true }));
|
||||||
this.dialogRef.close(null);
|
this.dialogRef.close(null);
|
||||||
} else {
|
} else {
|
||||||
this.dialogRef.close(null);
|
this.dialogRef.close(null);
|
||||||
|
|||||||
@ -88,7 +88,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
a:not(.ignore-style-a) {
|
a {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #2a7dec;
|
color: #2a7dec;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|||||||
@ -152,13 +152,6 @@
|
|||||||
&.space-between {
|
&.space-between {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
&.no-border {
|
|
||||||
border: none;
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
&.no-padding {
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
.mat-divider-vertical {
|
.mat-divider-vertical {
|
||||||
height: 56px;
|
height: 56px;
|
||||||
margin-top: -7px;
|
margin-top: -7px;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user