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_HAS_REPOSITORY = '[Auth] Change Has Repository',
|
||||
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',
|
||||
}
|
||||
|
||||
@ -71,8 +71,8 @@ export class ActionPreferencesUpdateOpenedMenuSection implements Action {
|
||||
constructor(readonly payload: { path: string; opened: boolean }) {}
|
||||
}
|
||||
|
||||
export class ActionPreferencesUpdateUserSettings implements Action {
|
||||
readonly type = AuthActionTypes.UPDATE_USER_SETTINGS;
|
||||
export class ActionPreferencesPutUserSettings implements Action {
|
||||
readonly type = AuthActionTypes.PUT_USER_SETTINGS;
|
||||
|
||||
constructor(readonly payload: Partial<UserSettings>) {}
|
||||
}
|
||||
@ -85,4 +85,4 @@ export class ActionPreferencesDeleteUserSettings implements Action {
|
||||
|
||||
export type AuthActions = ActionAuthAuthenticated | ActionAuthUnauthenticated |
|
||||
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 }))
|
||||
), {dispatch: false});
|
||||
|
||||
updatedUserSettings = createEffect(() => this.actions$.pipe(
|
||||
putUserSettings = createEffect(() => this.actions$.pipe(
|
||||
ofType(
|
||||
AuthActionTypes.UPDATE_USER_SETTINGS,
|
||||
AuthActionTypes.PUT_USER_SETTINGS,
|
||||
),
|
||||
mergeMap((state) => this.userSettingsService.putUserSettings(state.payload))
|
||||
), {dispatch: false});
|
||||
|
||||
@ -76,7 +76,7 @@ export const authReducer = (
|
||||
userSettings = {...state.userSettings, ...{ openedMenuSections: Array.from(openedMenuSections)}};
|
||||
return { ...state, ...{ userSettings }};
|
||||
|
||||
case AuthActionTypes.UPDATE_USER_SETTINGS:
|
||||
case AuthActionTypes.PUT_USER_SETTINGS:
|
||||
userSettings = {...state.userSettings, ...action.payload};
|
||||
return { ...state, ...{ userSettings }};
|
||||
|
||||
|
||||
@ -355,7 +355,9 @@ const SNAKE_CASE_REGEXP = /[A-Z]/g;
|
||||
|
||||
export function snakeCase(name: string, separator: string): string {
|
||||
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 {
|
||||
|
||||
@ -40,7 +40,7 @@ import {
|
||||
NetworkTransportType,
|
||||
PublishTelemetryCommand
|
||||
} 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 { getOS } from '@core/utils';
|
||||
|
||||
@ -121,7 +121,7 @@ export class DeviceCheckConnectivityDialogComponent extends
|
||||
|
||||
close(): void {
|
||||
if (this.notShowAgain && this.showDontShowAgain) {
|
||||
this.store.dispatch(new ActionPreferencesUpdateUserSettings({ notDisplayConnectivityAfterAddDevice: true }));
|
||||
this.store.dispatch(new ActionPreferencesPutUserSettings({ notDisplayConnectivityAfterAddDevice: true }));
|
||||
this.dialogRef.close(null);
|
||||
} else {
|
||||
this.dialogRef.close(null);
|
||||
|
||||
@ -88,7 +88,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
a:not(.ignore-style-a) {
|
||||
a {
|
||||
font-weight: 500;
|
||||
color: #2a7dec;
|
||||
text-decoration: none;
|
||||
|
||||
@ -152,13 +152,6 @@
|
||||
&.space-between {
|
||||
justify-content: space-between;
|
||||
}
|
||||
&.no-border {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
&.no-padding {
|
||||
padding: 0;
|
||||
}
|
||||
.mat-divider-vertical {
|
||||
height: 56px;
|
||||
margin-top: -7px;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user