Skip to content
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

enh(App): navigation tweaks for Contexts #1080

Merged
merged 1 commit into from
May 10, 2024
Merged

enh(App): navigation tweaks for Contexts #1080

merged 1 commit into from
May 10, 2024

Conversation

blizzz
Copy link
Member

@blizzz blizzz commented May 8, 2024

This is a more finegrained approach to to #933. The PR introduces an endpoint for each Context, so they can have the correct navigation item highlighted from the beginning, solving a known papercut from #1037

It also sets an initial state, so that in Vue we can apply the actual route. Alas, the Vue Router adds the same information into the address bar, duplicating "app[lication]" and the context id. This is not nice. I reset it to the original URL (accepting #/), but it comes at the cost of flickering. In Vue the route cannot be applied without changing the address bar, which is a known drawback.

Another tweak: I disable the app navigation, when the Context is opened from its specific URL, making it more "standalone". Questionable if we want it. There are alternatives also: filtering the Tables and Views to only those included in the Context, and not showing applications; or (perhaps in future) a Context-specific app navigation (maybe relevant once we make use of pages).

What is not included in the Controller is a check whether a Context is actually having a navigation bar entry. So far we did not expose the setting, so all Contexts are shown there anyway. But even if not, I am not sure this is an issue (user has access anyways).

Please check the annotated video for a recorded quick tour.

context-nav-tweaks.mp4

@blizzz blizzz added enhancement New feature or request 3. to review Waiting for reviews labels May 8, 2024
@blizzz blizzz requested review from juliusknorr and enjeck May 8, 2024 11:05
const contextId = loadState('tables', 'contextId', undefined);
const originalUrl = window.location.href
this.$router.replace('/application/' + contextId).catch(() => {})
// reverts turning /apps/tables/app/28 into /apps/tables/app/28#/application/28
Copy link
Member

Choose a reason for hiding this comment

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

Seems like an OK approach for now.

We could also change the vue-router so that it uses the exact same routes as the backend defines, but that might require a few more changes to have the old urls still work.

nextcloud/deck@9f98f0b
https://github.com/nextcloud/deck/pull/1977/files

Copy link
Member Author

Choose a reason for hiding this comment

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

interesting switch! Thanks for the pointer

Copy link
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

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

Looks good once CI is happy about linting and missing node dependency 🚀

Copy link
Contributor

@enjeck enjeck left a comment

Choose a reason for hiding this comment

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

@blizzz This is magic 🧙 🪄

- new page endpoint for contexts
- no Tables navigation in "standalone" contexts

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz blizzz merged commit 246fbbd into main May 10, 2024
58 checks passed
@blizzz blizzz deleted the enh/933/navigation branch May 10, 2024 10:16
@blizzz
Copy link
Member Author

blizzz commented May 10, 2024

Do we want this also in 0.7?

@blizzz
Copy link
Member Author

blizzz commented May 10, 2024

/backport to stable0.7

@backportbot backportbot bot added the backport-request Pending backport by the backport-bot label May 10, 2024
@backportbot backportbot bot removed the backport-request Pending backport by the backport-bot label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Applications: Backend/frontend - Indicate active context in the navigation
3 participants