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

Coach loading state reports #12178

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion kolibri/plugins/coach/assets/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import router from 'kolibri.coreVue.router';
import KolibriApp from 'kolibri_app';
import routes from './routes';
import pluginModule from './modules/pluginModule';
import pages from './views/reports/allReportsPages';

class CoachToolsModule extends KolibriApp {
get stateSetters() {
Expand All @@ -24,7 +25,12 @@ class CoachToolsModule extends KolibriApp {
redirectBrowser();
return;
}
this.store.dispatch('loading');

const skipLoading = [pages.ReportsQuizLearnerPage.name];

if (!skipLoading.includes(to.name)) {
this.store.dispatch('loading');
}
const promises = [];
// Clear the snackbar at every navigation to prevent it from re-appearing
// when the next page component mounts.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import store from 'kolibri.coreVue.vuex.store';
import { showResourceView } from '../resourceDetail/handlers';

export function generateQuestionListHandler(paramsToCheck) {
return function questionListHandler(to, from) {
if (paramsToCheck.some(param => to.params[param] !== from.params[param])) {
// Only set loading state if we are not switching
store.dispatch('loading');
}
showQuestionListView(to.params).then(() => {
const { exerciseId } = to.params;
Promise.all([
exerciseId ? showResourceView({ exerciseId }) : Promise.resolve(),
showQuestionListView(to.params),
]).then(() => {
// Set not loading regardless, as we are now
// ready to render.
store.dispatch('notLoading');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function generateResourceHandler(paramsToCheck) {
};
}

function showResourceView({ resourceId, exerciseId } = {}) {
export function showResourceView({ resourceId, exerciseId } = {}) {
// Passed in exerciseId is the content_id of the contentNode
// Map this to the id of the content node to do this fetch
const nodeId = store.state.classSummary.contentMap[resourceId || exerciseId].node_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@
{{ coachString('sizeLabel') }}
</KGridItem>
<KGridItem :layout12="layout12Value">
<p>
<p v-if="lesson.size">
{{ bytesForHumans(lesson.size) }}
</p>
<KEmptyPlaceholder v-else />
</KGridItem>
</div>
</KGrid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<KPageContainer>

<ReportsResourceHeader
:resource="exercise"
:resource="resource"
@previewClick="onPreviewClick"
/>

Expand Down Expand Up @@ -81,11 +81,12 @@
mixins: [commonCoach],
computed: {
...mapState('questionList', ['exercise']),
...mapState('resourceDetail', ['resource']),
...mapGetters('questionList', ['difficultQuestions']),
lesson() {
return this.lessonMap[this.$route.params.lessonId];
},
resource() {
exercise() {
marcellamaki marked this conversation as resolved.
Show resolved Hide resolved
return this.contentMap[this.$route.params.exerciseId];
},
group() {
Expand Down
Loading