-
Notifications
You must be signed in to change notification settings - Fork 28
Refactor DynamicDataTable #1914
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
Open
BenjaminCharmes
wants to merge
12
commits into
main
Choose a base branch
from
bc/refactor-dynamicdatatable
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5741733
Refactor DynamicDataTable
BenjaminCharmes 3caf17f
Fix cypress tests
BenjaminCharmes 7375cbb
Fix cypress tests
BenjaminCharmes 03614e4
Fix cypress tests
BenjaminCharmes 90aec61
Add human-readable `last_modified` as a data table column and summary…
ml-evs 231b45c
Let `/save-item` endpoint indicate that nothing was changed
ml-evs e9855de
Add last modified column to collections table
ml-evs 446c67b
Store which columns are available at the moment users save their tabl…
ml-evs 532c4eb
Add a small test for searching groups
ml-evs 830b7a1
Tidy up error handling after item versions
ml-evs 8a0671c
Backfill item `last_modified` from MongoDB `_id`
ml-evs 7fd5426
Merge remote-tracking branch 'origin/main' into bc/refactor-dynamicda…
BenjaminCharmes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| <template> | ||
| <MultiSelect | ||
| ref="multiselect" | ||
| :model-value="modelValue" | ||
| :options="options" | ||
| option-label="display_name" | ||
| placeholder="Any" | ||
| class="d-flex w-full" | ||
| :filter="true" | ||
| @update:model-value="onValueChange" | ||
| @click.stop | ||
| > | ||
| <template #option="slotProps"> | ||
| <div class="flex items-center"> | ||
| <UserBubble | ||
| v-if="slotProps.option.type === 'creator'" | ||
| :creator="slotProps.option" | ||
| :size="24" | ||
| /> | ||
| <FormattedGroupName | ||
| v-if="slotProps.option.type === 'group'" | ||
| :group="slotProps.option" | ||
| :size="24" | ||
| /> | ||
| <span v-if="slotProps.option.type === 'creator'" class="ml-1">{{ | ||
| slotProps.option.display_name | ||
| }}</span> | ||
| </div> | ||
| </template> | ||
| <template #value="slotProps"> | ||
| <div class="flex flex-wrap gap-2 items-center"> | ||
| <template v-if="slotProps.value && slotProps.value.length"> | ||
| <span | ||
| v-for="(option, index) in slotProps.value" | ||
| :key="index" | ||
| class="inline-flex items-center mr-2" | ||
| > | ||
| <UserBubble v-if="option.type === 'creator'" :creator="option" :size="20" /> | ||
| <FormattedGroupName v-if="option.type === 'group'" :group="option" :size="20" /> | ||
| <span v-if="option.type === 'creator'" class="ml-1">{{ option.display_name }}</span> | ||
| </span> | ||
| </template> | ||
| <span v-else class="text-gray-400">Any</span> | ||
| </div> | ||
| </template> | ||
| </MultiSelect> | ||
| </template> | ||
|
|
||
| <script> | ||
| import MultiSelect from "primevue/multiselect"; | ||
| import UserBubble from "@/components/UserBubble.vue"; | ||
| import FormattedGroupName from "@/components/FormattedGroupName.vue"; | ||
|
|
||
| export default { | ||
| components: { MultiSelect, UserBubble, FormattedGroupName }, | ||
| props: { | ||
| modelValue: { type: Array, default: null }, | ||
| options: { type: Array, default: () => [] }, | ||
| }, | ||
| emits: ["update:modelValue", "apply"], | ||
| methods: { | ||
| onValueChange(value) { | ||
| this.$emit("update:modelValue", value); | ||
| this.$emit("apply"); | ||
| this.$nextTick(() => this.$refs.multiselect?.hide?.()); | ||
| }, | ||
| }, | ||
| }; | ||
| </script> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think this file got missed during the filter migration. On main, these three columns all had filter: true:
{ field: "date", header: "Date", label: "Date", filter: true },
{ field: "creatorsAndGroups", ..., filter: true },
{ field: "blocks", ..., filter: true },
In the refactored version they only kept getValue/body for rendering the filter key is just gone, and none of DateRangeFilter, CreatorsAndGroupsFilter, or matchBlocks/blocksOptions are imported at the top of the file (only TextFilter and MultiSelectFilter made it in, for the id/type/status columns).
So they are lost kinda, maybe we should return them? or it was a plan to do like 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 think the filters should indeed stay the same unless this is intentional ?