-
Notifications
You must be signed in to change notification settings - Fork 738
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
EQM: Notify not enough resources to replace questions #12219
Merged
nucleogenesis
merged 6 commits into
learningequality:develop
from
AlexVelezLl:notify-not-enough-replacements
Jun 3, 2024
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
06f1d03
Add not enough resources modal
AlexVelezLl 0144bc7
Fix message
AlexVelezLl 81f3194
Fix message
AlexVelezLl 7bb7603
Fix bug not beign able to update resources
AlexVelezLl 794f9aa
ClosePanel on close no enough resources modal
AlexVelezLl a4c67a7
Add "add" to addMoreResourcesWithEmptyPool
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
81 changes: 81 additions & 0 deletions
81
kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/NotEnoughResourcesModal.vue
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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<template> | ||
|
||
<KModal | ||
:title="notEnoughReplacementsTitle$()" | ||
:submitText="addResourcesAction$()" | ||
> | ||
<p> | ||
{{ | ||
notEnoughReplacementsMessage$({ | ||
selected: selectedQuestions.length, | ||
available: availableResources.length, | ||
}) | ||
}} | ||
</p> | ||
<p v-if="availableResources.length"> | ||
{{ | ||
addMoreResourcesWithNonEmptyPool$({ | ||
available: availableResources.length, | ||
}) | ||
}} | ||
</p> | ||
<p v-else> | ||
{{ addMoreResourcesWithEmptyPool$() }} | ||
</p> | ||
<template #actions> | ||
<KButtonGroup> | ||
<KButton | ||
@click="() => $emit('close')" | ||
> | ||
{{ goBackAction$() }} | ||
</KButton> | ||
<KButton | ||
primary | ||
@click="() => $emit('addResources')" | ||
> | ||
{{ addResourcesAction$() }} | ||
</KButton> | ||
</KButtonGroup> | ||
</template> | ||
</KModal> | ||
|
||
</template> | ||
|
||
|
||
<script> | ||
|
||
import { enhancedQuizManagementStrings } from 'kolibri-common/strings/enhancedQuizManagementStrings'; | ||
|
||
export default { | ||
name: 'NotEnoughResourcesModal', | ||
setup() { | ||
const { | ||
goBackAction$, | ||
addResourcesAction$, | ||
notEnoughReplacementsTitle$, | ||
notEnoughReplacementsMessage$, | ||
addMoreResourcesWithEmptyPool$, | ||
addMoreResourcesWithNonEmptyPool$, | ||
} = enhancedQuizManagementStrings; | ||
return { | ||
goBackAction$, | ||
addResourcesAction$, | ||
notEnoughReplacementsTitle$, | ||
notEnoughReplacementsMessage$, | ||
addMoreResourcesWithEmptyPool$, | ||
addMoreResourcesWithNonEmptyPool$, | ||
}; | ||
}, | ||
props: { | ||
selectedQuestions: { | ||
type: Array, | ||
required: true, | ||
}, | ||
availableResources: { | ||
type: Array, | ||
required: true, | ||
}, | ||
}, | ||
}; | ||
|
||
</script> |
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 |
---|---|---|
|
@@ -122,6 +122,13 @@ | |
</KGridItem> | ||
</KGrid> | ||
</div> | ||
<NotEnoughResourcesModal | ||
v-if="showNoEnoughResources" | ||
:selectedQuestions="selectedActiveQuestions" | ||
:availableResources="replacementQuestionPool" | ||
@close="showNoEnoughResources = false" | ||
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. This should also "go back" in the router and close the side panel. |
||
@addResources="redirectToSelectResources" | ||
/> | ||
<KModal | ||
v-if="showReplacementConfirmation" | ||
:submitText="coreString('confirmAction')" | ||
|
@@ -160,10 +167,12 @@ | |
import { PageNames } from '../../../constants/index'; | ||
import AccordionItem from './AccordionItem'; | ||
import AccordionContainer from './AccordionContainer'; | ||
import NotEnoughResourcesModal from './NotEnoughResourcesModal'; | ||
|
||
export default { | ||
name: 'ReplaceQuestions', | ||
components: { | ||
NotEnoughResourcesModal, | ||
AccordionContainer, | ||
AccordionItem, | ||
}, | ||
|
@@ -202,6 +211,10 @@ | |
|
||
const showCloseConfirmation = ref(false); | ||
const showReplacementConfirmation = ref(false); | ||
const showNoEnoughResources = ref(false); | ||
|
||
showNoEnoughResources.value = | ||
replacementQuestionPool.value.length < selectedActiveQuestions.value.length; | ||
|
||
function handleConfirmClose() { | ||
replacements.value = []; | ||
|
@@ -262,6 +275,7 @@ | |
selectAllIsChecked, | ||
replaceSelectedQuestions, | ||
activeResourceMap, | ||
showNoEnoughResources, | ||
showCloseConfirmation, | ||
showReplacementConfirmation, | ||
confirmReplacement, | ||
|
@@ -338,6 +352,14 @@ | |
next(); | ||
} | ||
}, | ||
methods: { | ||
redirectToSelectResources() { | ||
const route = this.$router.getRoute(PageNames.QUIZ_SELECT_RESOURCES, { | ||
section_id: this.activeSection.section_id, | ||
}); | ||
this.$router.replace(route); | ||
}, | ||
}, | ||
}; | ||
|
||
</script> | ||
|
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
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.
This return here has making the whole function to return, and the updates werent applied when we had resource_pool updates.