-
Notifications
You must be signed in to change notification settings - Fork 64
feat(settings): Move "keyboard layout" from VM creation to Settings #1220
Conversation
@@ -56,6 +56,10 @@ export enum UserTagsActionTypes { | |||
UpdateNavigationOrderSuccess = '[Resource tags API] Update "csui.user.navigation-order" tag success', | |||
UpdateNavigationOrderError = '[Resource tags API] Update "csui.user.navigation-order" tag error', | |||
|
|||
UpdateKeyboardLayoutForVms = '[Keyboard layout] Update "csui.user.vm-keyboard-layout" tag', | |||
UpdateKeyboardLayoutForVmsSuccess = '[Keyboard layout] Update "csui.user.vm-keyboard-layout" tag success', | |||
UpdateKeyboardLayoutForVmsError = '[Keyboard layout] Update "csui.user.vm-keyboard-layout" tag error', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the right sources in all your strings
@@ -190,15 +190,6 @@ <h4>{{ 'VM_PAGE.VM_CREATION.AFFINITY_GROUP' | translate }}</h4> | |||
></cs-vm-creation-security-group-rules-manager> | |||
</div> | |||
|
|||
<div> | |||
<h4>{{ 'VM_PAGE.VM_CREATION.KEYBOARD_LAYOUT' | translate }}</h4> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove translations if it is not used anymore
|
||
export const getKeyboardLayout = createSelector( | ||
getUserTagsEntities, | ||
(entities): string => entities[userTagKeys.keyboardLayoutForVms] && entities[userTagKeys.keyboardLayoutForVms].value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All tags should exist see examples of other tags. Add this tag to default-config and SystemTagsService
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}), | ||
catchError((error) => Observable.of(new vmActions.DeploymentRequestError(error)))); | ||
})) | ||
.catch((error) => Observable.of(new vmActions.DeploymentRequestError(error))))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a pipeable operator
@@ -12,6 +12,10 @@ | |||
[apiDocumentationLink]="apiDocumentationLink" | |||
(regenerateKeys)="onRegenerateKeys()" | |||
></cs-api-settings> | |||
<cs-vm-settings | |||
[settings]="settings$ | async" | |||
(updateKeyboardLayout)="keyboardChange($event)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it looks like other bindings in the components.
It looks that its logic is different
src/app/settings/settings.module.ts
Outdated
} from './components'; | ||
import { KeyboardsComponent } from '../vm/vm-creation/keyboards/keyboards.component'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move a component to its corresponding place
@@ -16,7 +16,7 @@ import { AuthService } from '../../../shared/services/auth.service'; | |||
import { BaseTemplateModel } from '../../../template/shared'; | |||
import { VmService } from '../../shared/vm.service'; | |||
import { NotSelected, VmCreationState } from '../data/vm-creation-state'; | |||
import { KeyboardLayout } from '../keyboards/keyboards.component'; | |||
import { KeyboardLayout } from '../../../settings/components/keyboards/keyboards.component'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this type in this file and function that it uses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tamazlykar we use this type in a keyboard.component too.
where should we store it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I know you need to remove a keyboard layout from VM creation form.
This is a VM creation form and this type used only in public onKeyboardChange(keyboard: KeyboardLayout)
do we still need this function and corresponding event emitter and so on?
If somwere else you need this type and it used by different modules it will be better to place type in app/shared/types
@@ -1,6 +1,6 @@ | |||
import { AffinityGroup, DiskOffering, InstanceGroup, ServiceOffering, SSHKeyPair, Zone } from '../../../shared/models'; | |||
import { BaseTemplateModel } from '../../../template/shared'; | |||
import { KeyboardLayout } from '../keyboards/keyboards.component'; | |||
import { KeyboardLayout } from '../../../settings/components/keyboards/keyboards.component'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this type in this file and keyboard property that it uses?
@@ -14,7 +14,7 @@ | |||
></cs-api-settings> | |||
<cs-vm-settings | |||
[settings]="settings$ | async" | |||
(updateKeyboardLayout)="keyboardChange($event)" | |||
(updateKeyboardLayout)="onUpdateKeyboardLayout($event)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it looks like other bindings in the components.
It looks that its logic is different
# Conflicts: # src/app/core/config/default-configuration.ts # src/app/core/services/system-tags.service.ts # src/app/reducers/vm/redux/vm-creation.effects.ts # src/app/root-store/server-data/user-tags/user-tags.selectors.ts # src/app/shared/models/config/config.interface.ts
this.handleDeploymentMessages({stage: VmDeploymentStage.VM_DEPLOYED}); | ||
|
||
return this.doCreateInstanceGroup(deployedVm, action.payload) | ||
.switchMap((virtualMachine) => this.doCopyTags(virtualMachine, action.payload)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add pipe
} | ||
return new vmActions.DeploymentRequestSuccess(vmWithTags); | ||
}), | ||
catchError((error) => Observable.of(new vmActions.DeploymentRequestError(error)))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use of
instead of Observable.of
because it will be deprecated in new rxjs version.
Change it in both catchError
|
||
export const getKeyboardLayout = createSelector( | ||
getUserTagsEntities, | ||
(entities): string => entities[userTagKeys.keyboardLayoutForVms] && entities[userTagKeys.keyboardLayoutForVms].value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use (entities): string => entities[userTagKeys.keyboardLayoutForVms].value
without check. It can be confising why just only this selector has this check? Can it be undefined unlike the rest?
@@ -0,0 +1,36 @@ | |||
import { Component, EventEmitter, Input, Output } from '@angular/core'; | |||
|
|||
export enum KeyboardLayout { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably app/shared/types
is a better place for this?
|
||
@Component({ | ||
selector: 'cs-keyboards', | ||
templateUrl: 'keyboards.component.html', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add changeDetection: ChangeDetectionStrategy.OnPush
@@ -7,4 +7,5 @@ export interface SettingsViewModel { | |||
firstDayOfWeek: DayOfWeek; | |||
timeFormat: TimeFormat; | |||
theme: string; | |||
keyboardLayout: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change type to KeyboardLayout
# Conflicts: # src/app/reducers/vm/redux/vm-creation.effects.ts # src/app/settings/containers/settings/settings.component.ts
No description provided.