-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deleting chef server message modal window #3478
Deleting chef server message modal window #3478
Conversation
<app-message-modal [title]="'Could Not Delete Server'" [visible]="messageModalVisible" | ||
(close)="closeMessageModal()"> | ||
Before you can delete this server, delete all orgnisations attached to this server. | ||
</app-message-modal> | ||
<div class="page-body"> |
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.
@chef/ui-team is there consensus on listing many attributes/prop bindings on their own line or only wrapping them at a certain line length?
<app-create-chef-server-modal |
[visible]="createModalVisible" |
[creating]="creatingChefServer" |
(close)="closeCreateModal()" |
...etc...> |
</app-create-chef-server-modal> |
vs
<app-create-chef-server-modal [visible]="createModalVisible" [creating]="creatingChefServer" |
(close)="closeCreateModal()" ...etc...> |
</app-create-chef-server-modal> |
I've usually preferred to keep longer lists of attributes/prop bindings on their own line but don't mind either really. By default vscode wraps them by line length whenever you copy/paste html blocks
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.
I used to be indifferent, but lately I am leaning towards one-per-line; it greatly improves readability.
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.
changed as one-per-line 👍
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.
@msorens yea same. Better readability in file and in git diffs. Thx @sachin-msys 👍
Signed-off-by: sachin-msys <[email protected]>
Signed-off-by: sachin-msys <[email protected]>
Signed-off-by: sachin-msys <[email protected]>
79b1c8b
to
f58ef18
Compare
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.
Nice and simple 👍🏻
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.
Looking good; just a few corrections noted then OK to merge.
[title]="'Could Not Delete Server'" | ||
[visible]="messageModalVisible" | ||
(close)="closeMessageModal()"> | ||
Before you can delete this server, delete all orgnisations attached to this server. |
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.
Before you can delete this server, delete all orgnisations attached to this server. | |
Before you can delete this server, delete all organizations attached to it. |
component.startServerDelete(mockChefKeyEvent, genServer('uuid-111', 0)); | ||
expect(component.deleteModalVisible).toBe(true); | ||
component.deleteServer(); | ||
expect(component.deleteModalVisible).toBe(false); |
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.
Correct indents.
const mockChefKeyEvent = new KeyboardEvent('keypress') as ChefKeyboardEvent; | ||
mockChefKeyEvent.isUserInput = true; | ||
|
||
it('upon selecting delete from control menu, opens with org count 0', () => { |
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.
My first impression was the test and body do not match. But after reviewing all the code I realized that it is a language ambiguity. 😁
Please change:
it('upon selecting delete from control menu, opens with org count 0', () => { | |
it('With no orgs, selecting delete from control menu opens the delete modal', () => { |
mockChefKeyEvent.isUserInput = true; | ||
|
||
|
||
it('upon selecting delete from control menu, opens with org count 1', () => { |
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.
it('upon selecting delete from control menu, opens with org count 1', () => { | |
it('With one org, selecting delete from control menu opens the message modal', () => { |
Also, please add one more test:
'With multiple orgs, selecting delete from control menu opens the message modal'
@@ -208,5 +213,56 @@ describe('ChefServersListComponent', () => { | |||
|
|||
}); | |||
}); | |||
|
|||
describe('delete modal', () => { | |||
const mockChefKeyEvent = new KeyboardEvent('keypress') as ChefKeyboardEvent; |
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.
I recently noticed this is the wrong usage and have started a PR (#3518) that will be fixing those that already exist. The problem is we should be using MatOptionSelectionChange
rather than ChefKeyboardEvent
. You can see the errors when we tighten up linting by changing strictOutputEventTypes
to true in tsconfig.json, then running ng build
.
So please change to this here and if you use it elsewhere:
const mockChefKeyEvent = new KeyboardEvent('keypress') as ChefKeyboardEvent; | |
const mockEvent = { isUserInput: true } as MatOptionSelectionChange; |
Signed-off-by: sachin-msys <[email protected]>
@msorens done with all suggestions please have look. |
🔩 Description: What code changed, and why?
User should NOT be allowed to delete a chef server if it has orgs, so added message window for the same.
⛓️ Related Resources
#3294
👍 Definition of Done
👟 How to Build and Test the Change
git fetch origin Sachin/infra-cookbook-details
build components/automate-ui
Chef Servers
option which is underInfrastructure
tab and its underChef-Server
feature flag.✅ Checklist
📷 Screenshots, if applicable