-
Notifications
You must be signed in to change notification settings - Fork 270
[Remove Vuetify from Studio] Content Library catalog page (#5526) #5616
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
vtushar06
wants to merge
10
commits into
learningequality:channel-cards
Choose a base branch
from
vtushar06:fix/content-library-5526
base: channel-cards
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.
+264
−200
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
789809d
added StudioCatalogList.vue following past PRs
vtushar06 40e62b0
fixed UI for select button
vtushar06 a4d96a3
fixed import in router for StudioCatalogList
vtushar06 1823d79
Added Checkbox in StudioChannalCaard with select slot
vtushar06 b27335e
changes unit tests frron test-utils to vue testing library
vtushar06 41585fc
update import for CatalogList component in router
vtushar06 850c003
replace Checkbox with KCheckbox and update selection logic in Catalog…
vtushar06 fe88025
remove StudioCatalogList component and its associated styles
vtushar06 0635b3e
rename StudioCatalogList to CatalogList in tests
vtushar06 c5ceb61
remove unused detailsRouteName
vtushar06 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,34 +39,36 @@ | |
| appearance="basic-link" | ||
| @click="setSelection(true)" | ||
| /> | ||
| <Checkbox | ||
| <KCheckbox | ||
| v-else-if="selecting" | ||
| v-model="selectAll" | ||
| class="mb-4 mx-2" | ||
| :checked="selectAll" | ||
| :indeterminate="isIndeterminate" | ||
| :label="$tr('selectAll')" | ||
| data-test="select-all" | ||
| :indeterminate="selected.length > 0 && selected.length < channels.length" | ||
| class="mb-4 mx-2" | ||
| @change="toggleSelectAll" | ||
| /> | ||
| </VFlex> | ||
| <VFlex xs12> | ||
| <VLayout | ||
| v-for="item in channels" | ||
| :key="item.id" | ||
| align-center | ||
| <KCardGrid | ||
| layout="1-1-1" | ||
| :skeletonsConfig="[ | ||
| { | ||
| breakpoints: [0, 1, 2, 3, 4, 5, 6, 7], | ||
| orientation: 'vertical', | ||
| count: 3, | ||
| }, | ||
| ]" | ||
| > | ||
| <Checkbox | ||
| v-show="selecting" | ||
| v-model="selected" | ||
| class="mx-2" | ||
| :value="item.id" | ||
| data-test="checkbox" | ||
| <StudioChannelCard | ||
| v-for="channel in channels" | ||
| :key="channel.id" | ||
| :channel="channel" | ||
| :selectable="selecting" | ||
| :selected="isChannelSelected(channel.id)" | ||
| @toggle-selection="handleSelectionToggle" | ||
| /> | ||
| <ChannelItem | ||
| :channelId="item.id" | ||
| :detailsRouteName="detailsRouteName" | ||
| style="flex-grow: 1; width: 100%" | ||
| /> | ||
| </VLayout> | ||
| </KCardGrid> | ||
| </VFlex> | ||
| <VFlex | ||
| xs12 | ||
|
|
@@ -130,11 +132,10 @@ | |
| import union from 'lodash/union'; | ||
| import { RouteNames } from '../../constants'; | ||
| import CatalogFilters from './CatalogFilters'; | ||
| import ChannelItem from './ChannelItem'; | ||
| import StudioChannelCard from './components/StudioChannelCard'; | ||
| import LoadingText from 'shared/views/LoadingText'; | ||
| import Pagination from 'shared/views/Pagination'; | ||
| import BottomBar from 'shared/views/BottomBar'; | ||
| import Checkbox from 'shared/views/form/Checkbox'; | ||
| import ToolBar from 'shared/views/ToolBar'; | ||
| import OfflineText from 'shared/views/OfflineText'; | ||
| import { constantsTranslationMixin } from 'shared/mixins'; | ||
|
|
@@ -143,12 +144,11 @@ | |
| export default { | ||
| name: 'CatalogList', | ||
| components: { | ||
| ChannelItem, | ||
| StudioChannelCard, | ||
| LoadingText, | ||
| CatalogFilters, | ||
| Pagination, | ||
| BottomBar, | ||
| Checkbox, | ||
| ToolBar, | ||
| OfflineText, | ||
| }, | ||
|
|
@@ -202,9 +202,6 @@ | |
| debouncedSearch() { | ||
| return debounce(this.loadCatalog, 1000); | ||
| }, | ||
| detailsRouteName() { | ||
| return RouteNames.CATALOG_DETAILS; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What was the reason for removing this part? |
||
| }, | ||
| channels() { | ||
| // Sort again by the same ordering used on the backend - name. | ||
| // Have to do this because of how we are getting the object data via getChannels. | ||
|
|
@@ -213,6 +210,9 @@ | |
| selectedCount() { | ||
| return this.page.count - this.excluded.length; | ||
| }, | ||
| isIndeterminate() { | ||
| return this.selected.length > 0 && this.selected.length < this.channels.length; | ||
| }, | ||
| }, | ||
| watch: { | ||
| $route(to) { | ||
|
|
@@ -236,6 +236,20 @@ | |
| }, | ||
| methods: { | ||
| ...mapActions('channelList', ['searchCatalog']), | ||
| isChannelSelected(channelId) { | ||
| return this.selected.includes(channelId); | ||
| }, | ||
| handleSelectionToggle(channelId) { | ||
| const currentlySelected = this.selected; | ||
| if (currentlySelected.includes(channelId)) { | ||
| this.selected = currentlySelected.filter(id => id !== channelId); | ||
| } else { | ||
| this.selected = [...currentlySelected, channelId]; | ||
| } | ||
| }, | ||
| toggleSelectAll() { | ||
| this.selectAll = !this.selectAll; | ||
| }, | ||
| loadCatalog() { | ||
| this.loading = true; | ||
| const params = { | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
At this place, we can keep
v-model- it will be simpler to maintain.I think that when you implemented this PR,
KCheckboxdidn't yet supportv-model, but we recently implemented it - you can see the latest documentation.You will need to merge latestunstableto this branch and runpnpm installso that you have access to the latest KDS version.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.
Oh sorry, when I was writing this I forgot for a moment that we're targeting
channel-cards. So actually let's wait a bit for this update until I do this and then you can resolve it together with test conflicts.