-
Notifications
You must be signed in to change notification settings - Fork 906
Remote connection status #10347
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
Merged
rtibbles
merged 8 commits into
learningequality:develop
from
jredrejo:remote_connection_status
Mar 31, 2023
Merged
Remote connection status #10347
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
077fb01
changes in immersive page to add icons on the top right
dc1ac4c
Connection status in remote browsing library
5e15c85
Add remote browsing status to content renderer
42810ba
Refactor function to check conn status into a composable
1fa5a9d
Added connection status to another library channel browser connection
5bd56da
Refactor visual part to a component
540d0f8
Adding tests and mocks
9d2ade1
New refactoring removing some code
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
47 changes: 47 additions & 0 deletions
47
kolibri/plugins/learn/assets/src/views/DeviceConnectionStatus.vue
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,47 @@ | ||
| <template> | ||
|
|
||
| <span v-if="!devices.some(device => device.id === deviceId && device.available)"> | ||
| <span class="inner" style="font-size: 14px;"> | ||
| {{ coreString('disconnected') }} | ||
| </span> | ||
| <KIconButton | ||
| icon="disconnected" | ||
| data-test="disconnected-icon" | ||
| :color="color" | ||
| :tooltip="coreString('disconnected')" | ||
| :ariaLabel="coreString('disconnected')" | ||
| /> | ||
| </span> | ||
|
|
||
| </template> | ||
|
|
||
|
|
||
| <script> | ||
|
|
||
| import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings'; | ||
| import { useDevicesWithFacility } from 'kolibri.coreVue.componentSets.sync'; | ||
|
|
||
| export default { | ||
| name: 'DeviceConnectionStatus', | ||
| mixins: [commonCoreStrings], | ||
| setup() { | ||
| const { devices } = useDevicesWithFacility(); | ||
| return { | ||
| devices, | ||
| }; | ||
| }, | ||
| props: { | ||
| // eslint-disable-next-line kolibri/vue-no-unused-properties | ||
| deviceId: { | ||
| type: String, | ||
| required: true, | ||
| }, | ||
| color: { | ||
| type: String, | ||
| // 'primary' by default, but could add more later | ||
| default: 'primary', | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| </script> |
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
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
50 changes: 50 additions & 0 deletions
50
kolibri/plugins/learn/assets/test/views/device-connection-status.spec.js
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,50 @@ | ||
| import { shallowMount, mount } from '@vue/test-utils'; | ||
| import { useDevicesWithFacility } from 'kolibri.coreVue.componentSets.sync'; | ||
| import DeviceConnectionStatus from '../../src/views/DeviceConnectionStatus'; | ||
|
|
||
| jest.mock('kolibri.coreVue.componentSets.sync'); | ||
|
|
||
| function makeWrapper({ propsData } = {}) { | ||
| return mount(DeviceConnectionStatus, { propsData }); | ||
| } | ||
|
|
||
| describe('DeviceConnectionStatus', () => { | ||
| beforeEach(() => { | ||
| useDevicesWithFacility.mockReturnValue({ | ||
| devices: [ | ||
| { | ||
| id: '1', | ||
| available: true, | ||
| }, | ||
| ], | ||
| }); | ||
| }); | ||
| it('smoke test', () => { | ||
| const wrapper = shallowMount(DeviceConnectionStatus, { | ||
| propsData: { | ||
| deviceId: '1', | ||
| }, | ||
| }); | ||
| expect(wrapper.exists()).toBe(true); | ||
| }); | ||
|
|
||
| it('does not show the disconnected icon', () => { | ||
| const wrapper = makeWrapper({ | ||
| propsData: { | ||
| deviceId: '1', | ||
| }, | ||
| }); | ||
|
|
||
| expect(wrapper.find('[data-test="disconnected-icon"]').exists()).toBeFalsy(); | ||
| }); | ||
|
|
||
| it('shows the disconnected icon', () => { | ||
| useDevicesWithFacility.mockReturnValue({ devices: [] }); | ||
| const wrapper = makeWrapper({ | ||
| propsData: { | ||
| deviceId: '1', | ||
| }, | ||
| }); | ||
| expect(wrapper.find('[data-test="disconnected-icon"]').exists()).toBeTruthy(); | ||
| }); | ||
| }); |
13 changes: 12 additions & 1 deletion
13
kolibri/plugins/learn/assets/test/views/learning-activity-bar.spec.js
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
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.
Non-blocking, but just double checking you intentionally left out the color prop here :)