-
Notifications
You must be signed in to change notification settings - Fork 156
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
Add viewMode toggle for condensed resource table #7976
Add viewMode toggle for condensed resource table #7976
Conversation
6f21e60
to
b0e257c
Compare
b0e257c
to
80b16f3
Compare
Just checked it out, my impression is that the font size is already too small. But it might just be that I'm not "scientific enough" for the scientific mode. 😁 |
What does the scientific corner say? @elizavetaRa 🤓 |
decrease whitespaceLet's only decrease whitespace, to achieve the goal of showing more lines in the viewport. Example how this looks in dropbox: let's not decrease fonstsize, because:
|
@pascalwengerter created a custom menu-line-condensed.svg
|
80b16f3
to
2070677
Compare
@@ -0,0 +1,5 @@ | |||
Enhancement: Add condensed menu icon |
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.
@kulmann not sure if the changelog in the design system still gets updated individually or if there's only one in the repo root from now on?
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.
We need to maintain a separate changelog, because we want to be able to release independently with non aligned version numbers
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.
Good, that's what I assumed (and hence the changelog entry^^)
Nice feature, indeed wished by our users. Looking forward to it! |
export abstract class ViewModeConstants { | ||
static readonly viewModeDefault: string = 'resource-table' | ||
static readonly viewModeQueryName: string = 'view-mode' | ||
} |
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 huge fan of this use class as enum pattern, I'd rather use typescript types for this nowadays
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've followed what I found in another composable basically, idk if refactoring my/the other solution independently is within the scope of this PR?
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 agree with both of you 😆 Would like to get rid of it, but also fine in a separate PR.
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.
UX feels good! 🥳
Could you please add unit tests for the view mode selection, as implemented in ViewOptions.vue
? Added some comments.
@@ -59,6 +61,10 @@ export const useResourcesViewDefaults = <T, TT, TU extends any[]>( | |||
fields | |||
}) | |||
|
|||
const currentViewMode = useRouteQuery('view-mode', 'resource-table') |
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.
const currentViewMode = useRouteQuery('view-mode', 'resource-table') | |
const currentViewModeQuery = useRouteQuery('view-mode', 'resource-table') |
@@ -59,6 +61,10 @@ export const useResourcesViewDefaults = <T, TT, TU extends any[]>( | |||
fields | |||
}) | |||
|
|||
const currentViewMode = useRouteQuery('view-mode', 'resource-table') | |||
const someViewMode = computed((): string => String(currentViewMode.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.
const someViewMode = computed((): string => String(currentViewMode.value)) | |
const currentViewMode = computed((): string => queryItemAsString(currentViewMode.value)) |
- the import of
queryItemAsString
fromweb-pkg/src/composables
<div class="oc-flex oc-flex-middle"> | ||
<div class="oc-button-group oc-visible@s oc-mr-s"> | ||
<oc-button | ||
:appearance="viewModeCurrent === 'resource-table-condensed' ? 'filled' : 'outline'" |
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.
Please use your constants. ;-) You can just disclose them to the template by including them in the object returned by the setup function.
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.
Done, good point. Took me way longer than necessary because I was wondering what const
you were talking about exactly^^. Please take a look at e14e464 and let me know which of the two constant variants you prefer! (as in ViewModeConstants.viewModeDefault
vis ViewModeConstants.default
, e.g.)
:class="hoverableQuickActions && 'hoverable-quick-actions'" | ||
:class="[ | ||
hoverableQuickActions && 'hoverable-quick-actions', | ||
{ condensed: viewMode === 'resource-table-condensed' } |
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 const
please
@@ -318,6 +321,10 @@ export default defineComponent({ | |||
required: false, | |||
default: false | |||
}, | |||
viewMode: { | |||
type: String, | |||
default: 'resource-table' |
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 const
please
export abstract class ViewModeConstants { | ||
static readonly viewModeDefault: string = 'resource-table' | ||
static readonly viewModeQueryName: string = 'view-mode' | ||
} |
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 agree with both of you 😆 Would like to get rid of it, but also fine in a separate PR.
name: ViewModeConstants.viewModeQueryName, | ||
defaultValue: ViewModeConstants.viewModeDefault | ||
}) | ||
return computed(() => String(unref(perPageQuery))) |
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.
return computed(() => String(unref(perPageQuery))) | |
return computed(() => queryItemAsString(unref(perPageQuery))) |
- import from
web-pkg/src/composables
2070677
to
fda425e
Compare
Thanks for the review, I've addressed all points AFAIK and added a unit test for the button group, basically checking whether the correct button gets shown as outlined/filled after clicking the respective option - is that sufficient for now? |
@kulmann could I get a re-review? :) |
awesome! (was blocked as I did not manage to start it locally. Benedikt helped me) Would love to see it like thismenu-line icon for regular-view mode |
… table, fix unit tests
fda425e
to
9efc6fd
Compare
Done! |
Kudos, SonarCloud Quality Gate passed! |
@tbsbdr found a kind of UX flaw: the views |
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.
UX feels good, code is also good now. One hint about tests (ok for later, see comment). My feeling is that we can handle my previous comment in a followup. Let's merge this as first iteration of the condensed view mode.
@@ -95,4 +97,46 @@ describe('ViewOptions', () => { | |||
|
|||
expect(mockedStore.modules.Files.mutations.SET_HIDDEN_FILES_VISIBILITY).toHaveBeenCalled() | |||
}) | |||
|
|||
it('initially shows normal resource-table by default', () => { | |||
const wrapper = shallowMount(ViewOptions, { |
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.
for future tests (not blocking this PR): we introduced a new way of handling mocks in unit tests. See for example
function getMountedWrapper({ |
The functions creating the wrappers now return an object, containing mocks, storeOptions and the wrapper. That gives you the chance to manipulate mocks within the test code.
Description
Adds route-query based toggle between "normal" and "condensed" resource table
Related Issue
Screenshots (if appropriate):
Types of changes
Open tasks: