Skip to content
This repository has been archived by the owner on Mar 25, 2023. It is now read-only.

feat(settings): Move "keyboard layout" from VM creation to Settings #1220

Merged
merged 13 commits into from
Sep 24, 2018

Conversation

HeyRoach
Copy link
Contributor

No description provided.

@@ -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',
Copy link
Collaborator

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>
Copy link
Collaborator

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
Copy link
Collaborator

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

Copy link
Collaborator

@tamazlykar tamazlykar Aug 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See there is empty value if user don't have this tag
screenshot from 2018-08-22 14-05-28

}),
catchError((error) => Observable.of(new vmActions.DeploymentRequestError(error))));
}))
.catch((error) => Observable.of(new vmActions.DeploymentRequestError(error)))));
Copy link
Collaborator

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)"
Copy link
Collaborator

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

} from './components';
import { KeyboardsComponent } from '../vm/vm-creation/keyboards/keyboards.component';
Copy link
Collaborator

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';
Copy link
Collaborator

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?

Copy link
Contributor Author

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?

Copy link
Collaborator

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';
Copy link
Collaborator

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)"
Copy link
Collaborator

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));
Copy link
Collaborator

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))));
Copy link
Collaborator

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
Copy link
Collaborator

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 {
Copy link
Collaborator

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',
Copy link
Collaborator

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;
Copy link
Collaborator

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
@HeyRoach HeyRoach merged commit 5ff8051 into bwsw:master Sep 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants