-
Notifications
You must be signed in to change notification settings - Fork 714
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
Onboarding import facility - Mostly designs #9534
Merged
nucleogenesis
merged 24 commits into
learningequality:develop
from
nucleogenesis:onboarding-import-facility
Aug 15, 2022
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
b3d2542
Move syncTaskUtils into core as it's shared across SetupWizard, Facil…
nucleogenesis cb2b2c1
Import TaskTypes, TaskStatuses, TransferTypes from kolibri.utils.sync…
nucleogenesis b215043
Move FacilityTaskPanel(Details) to core & syncComponentSet
nucleogenesis 2c5d6f2
update selectFacilityTitle message to "Select learning facility"
nucleogenesis a5c9f68
Preclude non-Boolean return type on SelectAddressForm#submitDisabled
nucleogenesis f53553b
Only render description prop <p> when there is a description to show
nucleogenesis 0f5ae0d
ImportFacilitySetup: remove styling, add step & component ImportAuthe…
nucleogenesis 1e736b2
ensure network address is selected before going to select a facility …
nucleogenesis ac156cb
SelectFacilityForm: remove all admin form business, emit data to pare…
nucleogenesis 5fad68d
Wrap LoadingTaskPage with OnbStepBase, update title message, use core…
nucleogenesis 3fc56c0
OnboardingStepBase listens for enter key, continues if focused elemen…
nucleogenesis 479dacc
OnboardingStepBase navDisabled prop to permit disabling of back/conti…
nucleogenesis b883396
LoadingTaskPage disables nav when task is neither failed nor complete…
nucleogenesis 4111c6b
SuperUserCredentialsForm header msg changed to "Create super admin" -…
nucleogenesis 9c0a906
Ensure FacilityAdminCredentialsForm wrapped in <form> tags; remediate…
nucleogenesis 9deda6e
skip LoadingTaskPage tests re: buttons - will update suite when flow …
nucleogenesis df54943
arrow func rather than bind
nucleogenesis 41bcada
trap focus in language switcher modal
nucleogenesis dfaa167
focus doesn't get trapped when v-show already rendered it into the do…
nucleogenesis dfc402e
add new address button moved under address list, also fixes focus out…
nucleogenesis 31051ce
use the new getTaskString export
nucleogenesis 95afde2
ensure function not called until expected in sync status info, fix mi…
nucleogenesis 6356f39
fix broken refs after rebase
nucleogenesis ad797f8
use extra_metadata field for facility name on task status string
nucleogenesis 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 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 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 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 |
---|---|---|
@@ -1,7 +1,45 @@ | ||
import coreStrings from 'kolibri.coreVue.mixins.commonCoreStrings'; | ||
import taskStrings from 'kolibri.coreVue.mixins.commonTaskStrings'; | ||
import bytesForHumans from 'kolibri.utils.bytesForHumans'; | ||
import { TaskStatuses, TaskTypes } from '../constants'; | ||
import commonCoreStrings from '../mixins/commonCoreStrings'; | ||
import { getTaskString } from '../mixins/taskStrings'; | ||
import bytesForHumans from '../utils/bytesForHumans'; | ||
|
||
export const TaskTypes = { | ||
REMOTECHANNELIMPORT: 'kolibri.core.content.tasks.remotechannelimport', | ||
REMOTECONTENTIMPORT: 'kolibri.core.content.tasks.remotecontentimport', | ||
REMOTEIMPORT: 'kolibri.core.content.tasks.remoteimport', | ||
DISKCHANNELIMPORT: 'kolibri.core.content.tasks.diskchannelimport', | ||
DISKCONTENTIMPORT: 'kolibri.core.content.tasks.diskcontentimport', | ||
DISKIMPORT: 'kolibri.core.content.tasks.diskimport', | ||
DISKCONTENTEXPORT: 'kolibri.core.content.tasks.diskcontentexport', | ||
DISKEXPORT: 'kolibri.core.content.tasks.diskexport', | ||
DELETECHANNEL: 'kolibri.core.content.tasks.deletechannel', | ||
UPDATECHANNEL: 'kolibri.core.content.tasks.updatechannel', | ||
REMOTECHANNELDIFFSTATS: 'kolibri.core.content.tasks.remotechanneldiffstats', | ||
LOCALCHANNELDIFFSTATS: 'kolibri.core.content.tasks.localchanneldiffstats', | ||
SYNCDATAPORTAL: 'kolibri.core.auth.tasks.dataportalsync', | ||
SYNCPEERFULL: 'kolibri.core.auth.tasks.peerfacilitysync', | ||
SYNCPEERPULL: 'kolibri.core.auth.tasks.peerfacilityimport', | ||
DELETEFACILITY: 'kolibri.core.auth.tasks.deletefacility', | ||
}; | ||
|
||
// identical to facility constants.js | ||
export const TaskStatuses = Object.freeze({ | ||
IN_PROGRESS: 'INPROGRESS', | ||
COMPLETED: 'COMPLETED', | ||
FAILED: 'FAILED', | ||
PENDING: 'PENDING', | ||
RUNNING: 'RUNNING', | ||
QUEUED: 'QUEUED', | ||
SCHEDULED: 'SCHEDULED', | ||
CANCELED: 'CANCELED', | ||
CANCELING: 'CANCELING', | ||
}); | ||
|
||
export const TransferTypes = { | ||
LOCALEXPORT: 'localexport', | ||
LOCALIMPORT: 'localimport', | ||
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. Same as above |
||
PEERIMPORT: 'peerimport', | ||
REMOTEIMPORT: 'remoteimport', | ||
}; | ||
|
||
export const SyncTaskStatuses = { | ||
SESSION_CREATION: 'SESSION_CREATION', | ||
|
@@ -18,8 +56,7 @@ export const SyncTaskStatuses = { | |
FAILED: 'FAILED', | ||
}; | ||
|
||
const { getTaskString } = taskStrings.methods; | ||
const { coreString } = coreStrings.methods; | ||
const { coreString } = commonCoreStrings.methods; | ||
|
||
const syncTaskStatusToStepMap = { | ||
[SyncTaskStatuses.SESSION_CREATION]: 1, | ||
|
@@ -31,24 +68,25 @@ const syncTaskStatusToStepMap = { | |
[SyncTaskStatuses.REMOTE_DEQUEUING]: 7, | ||
}; | ||
|
||
// getTaskString is wrapped in an arrow func to avoid evaluation before i18n is ready | ||
const genericStatusToDescriptionMap = { | ||
[TaskStatuses.PENDING]: getTaskString('taskWaitingStatus'), | ||
[TaskStatuses.QUEUED]: getTaskString('taskWaitingStatus'), | ||
[TaskStatuses.COMPLETED]: getTaskString('taskFinishedStatus'), | ||
[TaskStatuses.CANCELED]: getTaskString('taskCanceledStatus'), | ||
[TaskStatuses.CANCELING]: getTaskString('taskCancelingStatus'), | ||
[TaskStatuses.FAILED]: getTaskString('taskFailedStatus'), | ||
[TaskStatuses.PENDING]: () => getTaskString('taskWaitingStatus'), | ||
[TaskStatuses.QUEUED]: () => getTaskString('taskWaitingStatus'), | ||
[TaskStatuses.COMPLETED]: () => getTaskString('taskFinishedStatus'), | ||
[TaskStatuses.CANCELED]: () => getTaskString('taskCanceledStatus'), | ||
[TaskStatuses.CANCELING]: () => getTaskString('taskCancelingStatus'), | ||
[TaskStatuses.FAILED]: () => getTaskString('taskFailedStatus'), | ||
}; | ||
|
||
export const syncStatusToDescriptionMap = { | ||
...genericStatusToDescriptionMap, | ||
[SyncTaskStatuses.SESSION_CREATION]: getTaskString('establishingConnectionStatus'), | ||
[SyncTaskStatuses.REMOTE_QUEUING]: getTaskString('remotelyPreparingDataStatus'), | ||
[SyncTaskStatuses.PULLING]: getTaskString('receivingDataStatus'), | ||
[SyncTaskStatuses.LOCAL_DEQUEUING]: getTaskString('locallyIntegratingDataStatus'), | ||
[SyncTaskStatuses.LOCAL_QUEUING]: getTaskString('locallyPreparingDataStatus'), | ||
[SyncTaskStatuses.PUSHING]: getTaskString('sendingDataStatus'), | ||
[SyncTaskStatuses.REMOTE_DEQUEUING]: getTaskString('remotelyIntegratingDataStatus'), | ||
[SyncTaskStatuses.SESSION_CREATION]: () => getTaskString('establishingConnectionStatus'), | ||
[SyncTaskStatuses.REMOTE_QUEUING]: () => getTaskString('remotelyPreparingDataStatus'), | ||
[SyncTaskStatuses.PULLING]: () => getTaskString('receivingDataStatus'), | ||
[SyncTaskStatuses.LOCAL_DEQUEUING]: () => getTaskString('locallyIntegratingDataStatus'), | ||
[SyncTaskStatuses.LOCAL_QUEUING]: () => getTaskString('locallyPreparingDataStatus'), | ||
[SyncTaskStatuses.PUSHING]: () => getTaskString('sendingDataStatus'), | ||
[SyncTaskStatuses.REMOTE_DEQUEUING]: () => getTaskString('remotelyIntegratingDataStatus'), | ||
}; | ||
|
||
function formatNameWithId(name, id) { | ||
|
@@ -85,20 +123,20 @@ export function syncFacilityTaskDisplayInfo(task) { | |
const statusDescription = | ||
syncStatusToDescriptionMap[task.extra_metadata.sync_state] || | ||
syncStatusToDescriptionMap[task.status] || | ||
getTaskString('taskUnknownStatus'); | ||
(() => getTaskString('taskUnknownStatus')); | ||
|
||
if (task.status === TaskStatuses.COMPLETED) { | ||
statusMsg = getTaskString('taskFinishedStatus'); | ||
} else if (syncStep) { | ||
statusMsg = getTaskString('syncStepAndDescription', { | ||
step: syncStep, | ||
total: task.type === TaskTypes.SYNCPEERPULL ? PULLSTEPS : PUSHPULLSTEPS, | ||
description: statusDescription, | ||
description: statusDescription(), | ||
}); | ||
} else { | ||
if (task.type === TaskTypes.SYNCLOD && task.status === TaskStatuses.FAILED) | ||
statusMsg = `${statusDescription}: ${task.exception}`; | ||
else statusMsg = statusDescription; | ||
statusMsg = `${statusDescription()}: ${task.exception}`; | ||
else statusMsg = statusDescription(); | ||
} | ||
|
||
if (task.status === TaskStatuses.COMPLETED) { | ||
|
@@ -127,7 +165,7 @@ export function syncFacilityTaskDisplayInfo(task) { | |
|
||
export const removeStatusToDescriptionMap = { | ||
...genericStatusToDescriptionMap, | ||
[TaskStatuses.RUNNING]: getTaskString('removingFacilityStatus'), | ||
[TaskStatuses.RUNNING]: () => getTaskString('removingFacilityStatus'), | ||
}; | ||
|
||
// Consolidates logic on how Remove-Facility Tasks should be displayed | ||
|
@@ -137,7 +175,7 @@ export function removeFacilityTaskDisplayInfo(task) { | |
task.extra_metadata.facility | ||
); | ||
const statusDescription = | ||
removeStatusToDescriptionMap[task.status] || getTaskString('taskUnknownStatus'); | ||
removeStatusToDescriptionMap[task.status]() || getTaskString('taskUnknownStatus'); | ||
|
||
return { | ||
headingMsg: getTaskString('removeFacilityTaskLabel', { facilityName }), | ||
|
This file contains 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 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 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 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 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 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 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
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.
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.
Not blocking: This is a bit nit-picky, and I can see that this was just a "move existing code" but if it's possible, would we have these be more like
REMOTE_CHANNEL_IMPORT
without it being too much of a hassle? I think it would be a lot easier to read. If easier to keep as is, because these are in too many places, no problem thoughThere 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.
💯 no prob at all good idea