Skip to content

Shared data tab refactor#894

Merged
marySalvi merged 21 commits intomainfrom
shared-data-tab-refactor
Sep 22, 2021
Merged

Shared data tab refactor#894
marySalvi merged 21 commits intomainfrom
shared-data-tab-refactor

Conversation

@marySalvi
Copy link
Collaborator

@marySalvi marySalvi commented Aug 16, 2021

fixes #837

  • Adds 'Browse Data and 'Shared with Me' tabs
  • Adds Data Table to display the "Shared with Me' Data

Screenshot from 2021-08-16 08-23-53
Screenshot from 2021-08-16 08-28-05

subdavis and others added 5 commits August 19, 2021 14:23
* Fixes for location

* Location fixes

* Prehydrate to prevent duplicate requests

* Fix issue with event subscriber
@subdavis subdavis marked this pull request as ready for review September 10, 2021 23:27
Copy link
Contributor

@subdavis subdavis left a comment

Choose a reason for hiding this comment

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

Few small changes.

Also, in order to make this change, the docs need to be updated. Mostly Sharing data with teams on the docs/Web-Version.md page needs to mention this new tab. The way you create shares is the same, but there should be a mention of where to find the items shared with you.

offset,
sort,
sortDir,
published: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

might want to add this as an optional param?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated all params to be optional to match server-side.

{
path: 'shared',
name: 'shared',
component: DataShared,
Copy link
Contributor

Choose a reason for hiding this comment

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

need to add beforeEnter to this route as well, or possible just on the parent or grandparent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would it make sense to do a global beforeEach here?

Copy link
Contributor

@subdavis subdavis Sep 20, 2021

Choose a reason for hiding this comment

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

I don't think it makes a difference. You can either put a beforeEnter in 2 places or you can check inside of a global beforeEach that the next route isn't the login route to prevent an infinite redirect.

I kinda prefer beforeEnter because if you do the beforeEach thing, you're sorta migrating some of the scope of the router config into function logic, but that's just me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK that makes sense. I don't personally have a preference so I will add the beforeEnter. It does look as though it needs to be added to each individual route, not the parent.

const newPath = getPathFromLocation(location);
if (newPath !== router.currentRoute.path) {
router.push(newPath);
async hydrate({ commit }, location: LocationType) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment that explains that hydrate populates the full girder model on location change if it's missing.

}

function isAnnotationFolder(item: GirderModel) {
// TODO: update to check for other info
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this todo still valid? What else would we check for?

Comment on lines +62 to +66
watch(tableOptions, updateOptions, {
deep: true,
});

updateOptions();
Copy link
Contributor

@subdavis subdavis Sep 13, 2021

Choose a reason for hiding this comment

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

edit: removed suggestion.

You'll have to merge main again and run yarn to install latest dependeicies.

Copy link
Contributor

Choose a reason for hiding this comment

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

I retract this comment, watchEffect is still behaving unpredictably and is probably unsafe here. Please leave as-is.

}

onBeforeUnmount(() => {
onBeforeUnmount(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

this function does not need to be async.

const { getters } = store;

const clearSelected = () => {
locationStore.selected = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not mutate store from outside module definition. Use commit to invoke mutation. Vuex's typescript definitions are still really lacking.

store.commit('Location/setSelected', [])

Copy link
Member

Choose a reason for hiding this comment

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

I've had success in a few projects now using https://github.com/paroi-tech/direct-vuex. In my iterated experience, the strong typing overrides concerns about the wrapperness or the non-standardness of the library. Something to think about. I can hook you up with the engineers who actually were managing its usage, just let me know.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like the looks of that (though I still generally dislike vuex). Any refactoring to use a new library like this should probably be a separate PR, but we should look into direct-vuex.

Browse Data
</v-tab>
<v-tab :to="{name: 'shared'}">
<v-icon class="mr-2">
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a problem here where the width of the icon is dynamic, which causes a race condition with the calcuation of the underline active tab style. Soemtimes it ends up in the wrong place because the icon hasn't rendered yet.

You can solve this by forcing a fixed with on the icon. replace class="mr-2" with class="tab-icon" and define the new style as scoped.

<style scoped>
.tab-icon {
  width: 28px;
  margin-right: 10px;
}
</style>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Great catch.

@subdavis subdavis self-requested a review September 21, 2021 17:52
Copy link
Contributor

@subdavis subdavis left a comment

Choose a reason for hiding this comment

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

Looks awesome!

  • One other small comment about adding a more helpful message for the case where there's no data
  • A simple documentation update

After those two small things, I think we should be good to merge.

Launch Annotator
</v-btn>
</template>
</v-data-table>
Copy link
Contributor

Choose a reason for hiding this comment

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

    <template #no-data>
      <span class="pr-4">No datasets have been shared with you yet.</span>
      <a href="https://kitware.github.io/dive/Web-Version/#sharing-data-with-teams">Learn more about sharing</a>
    </template>

I support aggressively linking to documentation. Can we add this slot here?

Screenshot from 2021-09-21 13-53-15

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Definitely. I think this is a great idea.

@subdavis subdavis self-requested a review September 21, 2021 18:52
Copy link
Contributor

@subdavis subdavis left a comment

Choose a reason for hiding this comment

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

🎉

@marySalvi marySalvi merged commit f6fe9c0 into main Sep 22, 2021
@subdavis subdavis deleted the shared-data-tab-refactor branch September 22, 2021 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] "Shared with me" view on Data Browser page.

3 participants