-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Adjust behavior of all close tab commands #7278
Conversation
As far as I understood this PR only tries to prevent closing from user perspective, from programming perspective one can still close. I think it is reasonable, just checking. |
@akosyakov Yes it only affects the commands, one can still close the tab programmatically using the |
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.
Great! A few remarks.
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 have tested this and it works fairly well. I did note the following:
- When a view is not closable (and there are other closable views), the action 'Close Others' is disabled. I would expect it to be enabled.
- It looks like 'close others' should only close views within the same location. We need to be sure this is all consistent.
examples/api-samples/src/browser/api-samples-frontend-module.ts
Outdated
Show resolved
Hide resolved
bind(WidgetFactory).toDynamicValue(ctx => ({ | ||
id: SampleView.ID, | ||
createWidget: () => ctx.container.get<SampleView>(SampleView) | ||
})); |
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.
This function is going to get rather big if lots of stuff is added to it. Also it is not clear which lines relate to which example. Same comment applies to api-samples-contribution. It seems to me we should have a single function call here for each example, so here we have just
bindDynamicLabelProvider(bind);
bindUnclosableView(bind);
Then have a folder for each example where these functions are implemented. I know this is not how it was set up before, but now you are adding the second example it would be helpful if you were able to improve the structure here.
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.
Ok I see what you mean, I'll improve that.
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 gave it a try, tell me what you think.
|
1f82b50
to
aa2135a
Compare
examples/api-samples/src/browser/view/sample-uncloable-view-contribution.ts
Outdated
Show resolved
Hide resolved
…t they respect the widget.title.closable propertySigned-off-by: Vivien Jovet <vivien.jovet@gmail.com>
@spoenemann please merge |
I was misunderstanding what was the same or a different area. It's working fine. |
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.
Looks great. Thanks also for changing the view title from 'Sample'. I forgot to mention that but you did it anyway. I appreciate your keeping the examples package tidy too, as that was not really part of this PR.
Fixes #7268, adjust behavior of all close tab commands so that they respect the
widget.title.closable
property.What it does
This PR improves the close tab commands so that they take into account the
widget.title.closable
property. It means that a widget cannot be closed using any of the commands ifwidget.title.closable === false
.The behavior is as follow:
Close
andClose Tab in Main Area
are enabled when the current widget is closableClose Others
andClose Other Tabs in Main Area
are enabled if at least one other widget is closableClose All
andClose All Tabs in Main Area
enabled if at least one widget is closableClose to the Right
is enabled if at least one widget to the right is closableHow to test
I added a sample view to the examples so you can open the
Sample Unclosable View
and toggle the checkbox in it to settitle.closable
and try the logic described above.Review checklist
Reminder for reviewers