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

Improved route handlers architecture in Coach - planRoutes #11900

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions kolibri/plugins/coach/assets/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import routes from './routes';
import pluginModule from './modules/pluginModule';
import { LessonsPageNames } from './constants/lessonsConstants';
import LessonEditDetailsPage from './views/plan/LessonEditDetailsPage';
import GroupsPage from './views/plan/GroupsPage';
import GroupMembersPage from './views/plan/GroupMembersPage';
import GroupEnrollPage from './views/plan/GroupEnrollPage';

class CoachToolsModule extends KolibriApp {
get stateSetters() {
Expand Down Expand Up @@ -74,6 +77,9 @@ class CoachToolsModule extends KolibriApp {
LessonsPageNames.LESSON_SELECTION_BOOKMARKS_MAIN,
LessonsPageNames.SELECTION_CONTENT_PREVIEW,
LessonsPageNames.RESOURCE_CONTENT_PREVIEW,
GroupsPage.name,
GroupMembersPage.name,
GroupEnrollPage.name,
].includes(to.name)
) {
next();
Expand Down
11 changes: 8 additions & 3 deletions kolibri/plugins/coach/assets/src/composables/useGroups.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ export function useGroups() {
groupsAreLoading.value = loading;
}

function showGroupsPage(store, classId) {
// On this page, handle loading state locally
// TODO: Open follow-up so that we don't need to do this
async function showGroupsPage(store, classId) {
const initClassInfoPromise = store.dispatch('initClassInfo', classId);
const getFacilitiesPromise =
store.getters.isSuperuser && store.state.core.facilities.length === 0
? store.dispatch('getFacilities').catch(() => {})
: Promise.resolve();

await Promise.all([initClassInfoPromise, getFacilitiesPromise]);
store.dispatch('notLoading');

setGroupsLoading(true);
Expand Down