Skip to content

Commit

Permalink
Revert "Disabling additional user import until multiple user syncing …
Browse files Browse the repository at this point in the history
…is working"
  • Loading branch information
marcellamaki authored Oct 27, 2023
1 parent b06cfe2 commit 76d2100
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
v-if="!isImported(userRow.user) && !isImporting(userRow.user)"
:text="coreString('importAction')"
appearance="flat-button"
:disabled="isImportingUserDisabled"
@click="startImport(userRow.user)"
/>
<KCircularLoader
Expand Down Expand Up @@ -92,8 +91,6 @@
isPolling: false,
// array of user/learner ids
learnersBeingImported: [],
// To be removed
isImportingUserDisabled: false,
};
},
inject: ['wizardService'],
Expand Down Expand Up @@ -143,20 +140,12 @@
beforeMount() {
this.isPolling = true;
this.pollImportTask();
this.checkImportedUser();
},
methods: {
importedLearners() {
return this.wizardService.state.context.importedUsers;
},
pollImportTask() {
// TODO :: This has to be removed once the multiple user syncing has been fixed.
if (
this.learnersBeingImported.length > 0 ||
this.wizardService.state.context.importedUsers.length > 0
) {
this.wizardService.send('LOADING');
}
TaskResource.list({ queue: SoudQueue }).then(tasks => {
if (tasks.length) {
tasks.forEach(task => {
Expand Down Expand Up @@ -197,7 +186,6 @@
}
},
startImport(learner) {
this.isImportingUserDisabled = true;
// Push the learner into being imported, we'll remove it if we get an error later on
this.learnersBeingImported.push(learner.id);
Expand All @@ -219,21 +207,14 @@
}
TaskResource.startTask(params).catch(() => {
this.learnersBeingImported = this.learnersBeingImported.filter(id => id != learner.id);
this.isImportingUserDisabled = false;
});
},
isImported(learner) {
return this.importedLearners().find(u => u === learner.username);
},
isImporting(learner) {
this.checkImportedUser(learner);
return this.learnersBeingImported.includes(learner.id);
},
checkImportedUser(learner) {
if (this.learnersBeingImported.length > 0 || this.isImported(learner)) {
this.isImportingUserDisabled = true;
}
},
},
$trs: {
commaSeparatedPair: {
Expand Down
37 changes: 14 additions & 23 deletions kolibri/plugins/setup_wizard/assets/src/views/LoadingTaskPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@
</template>
<span v-else></span>
</template>
<!-- TODO: to be roled back when multiple user syncing is working in the upcoming release -->
<!-- <KButton
<KButton
v-if="loadingTask.status === 'COMPLETED' && isImportingSoud"
appearance="basic-link"
:text="$tr('importAnother')"
@click="importAnother"
/> -->
/>
</OnboardingStepBase>

</template>
Expand All @@ -54,12 +53,7 @@
import commonSyncElements from 'kolibri.coreVue.mixins.commonSyncElements';
import { TaskResource } from 'kolibri.resources';
import { TaskStatuses } from 'kolibri.utils.syncTaskUtils';
import {
DeviceTypePresets,
// LodTypePresets,
SoudQueue,
FooterMessageTypes,
} from '../constants';
import { DeviceTypePresets, LodTypePresets, SoudQueue, FooterMessageTypes } from '../constants';
import OnboardingStepBase from './OnboardingStepBase';
export default {
Expand Down Expand Up @@ -130,10 +124,9 @@
isSoud() {
return this.queue === SoudQueue;
},
// TODO: role this back when multiple user syncing is working in the upcoming release!
// isImportingSoud() {
// return this.wizardService.state.context.lodImportOrJoin === LodTypePresets.IMPORT;
// },
isImportingSoud() {
return this.wizardService.state.context.lodImportOrJoin === LodTypePresets.IMPORT;
},
queue() {
return this.wizardService.state.context.fullOrLOD === DeviceTypePresets.LOD
? SoudQueue
Expand All @@ -150,11 +143,10 @@
this.pollTask();
},
methods: {
// TODO: role this back when multiple user syncing is working in the upcoming release!
// importAnother() {
// this.isPolling = false;
// this.wizardService.send('IMPORT_ANOTHER');
// },
importAnother() {
this.isPolling = false;
this.wizardService.send('IMPORT_ANOTHER');
},
pushCompletedToWizardMachine() {
this.completedTasks.forEach(task => {
if (!this.wizardService.state.context.importedUsers.includes(task.username)) {
Expand Down Expand Up @@ -234,11 +226,10 @@
},
},
$trs: {
// TODO: role this back when multiple user syncing is working in the upcoming release!
// importAnother: {
// message: 'Import another user account',
// context: 'Link to restart the import step for another user. ',
// },
importAnother: {
message: 'Import another user account',
context: 'Link to restart the import step for another user. ',
},
loadUserTitle: {
message: 'Load user account',
context: 'Title of a page where user is waiting for a user to be imported',
Expand Down

0 comments on commit 76d2100

Please sign in to comment.