From 876eebe15d82a988892586747d1926988071a6a3 Mon Sep 17 00:00:00 2001
From: Raizaaa <89463672+raizasafeel@users.noreply.github.com>
Date: Mon, 16 Nov 2026 02:35:53 +0530
Subject: [PATCH 01/19] fix: let the page choose the discussions heading size
(cherry picked from commit d791cea0a71b1f3b4c01e8e0b38e73ca8c6aaa86)
---
frontend/src/components/Discussions.vue | 10 ++++++---
frontend/src/pages/Batches/BatchDetail.vue | 1 +
frontend/src/tests/Discussions.test.ts | 26 ++++++++++++++++++----
3 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/frontend/src/components/Discussions.vue b/frontend/src/components/Discussions.vue
index 707b2a87af..447d450d30 100644
--- a/frontend/src/components/Discussions.vue
+++ b/frontend/src/components/Discussions.vue
@@ -12,9 +12,7 @@
{{ __(title) }}
@@ -174,6 +172,12 @@ const props = defineProps({
type: Boolean,
default: false,
},
+ // The page that places this decides how prominent its heading is.
+ headingSize: {
+ type: String,
+ default: '2xl',
+ validator: (size) => ['lg', '2xl'].includes(size),
+ },
})
onMounted(() => {
diff --git a/frontend/src/pages/Batches/BatchDetail.vue b/frontend/src/pages/Batches/BatchDetail.vue
index e018740d8e..bba69ca3e0 100644
--- a/frontend/src/pages/Batches/BatchDetail.vue
+++ b/frontend/src/pages/Batches/BatchDetail.vue
@@ -86,6 +86,7 @@
doctype="LMS Batch"
:docname="batch.data.name"
:title="__('Discussions')"
+ heading-size="lg"
:key="batch.data.name"
:singleThread="true"
:scrollToBottom="false"
diff --git a/frontend/src/tests/Discussions.test.ts b/frontend/src/tests/Discussions.test.ts
index 91f3652917..5b318a4087 100644
--- a/frontend/src/tests/Discussions.test.ts
+++ b/frontend/src/tests/Discussions.test.ts
@@ -34,7 +34,11 @@ const TOPICS = [
// pieces Discussions uses.
// Each mount gets this resource; a test can swap it for one that loads later.
let resource: { data?: typeof TOPICS; reload: () => void; refresh: () => void }
-const loadedResource = () => ({ data: TOPICS, reload: vi.fn(), refresh: vi.fn() })
+const loadedResource = () => ({
+ data: TOPICS,
+ reload: vi.fn(),
+ refresh: vi.fn(),
+})
vi.mock('frappe-ui', () => ({
Button: { template: ' ' },
createResource: () => resource,
@@ -66,9 +70,14 @@ String.prototype.format = function (...args: unknown[]) {
return this.replace(/\{(\d+)\}/g, (_: string, i: number) => String(args[i]))
}
-const mountDiscussions = () =>
+const mountDiscussions = (props: Record = {}) =>
mount(Discussions, {
- props: { title: 'Questions', doctype: 'Course Lesson', docname: 'L1' },
+ props: {
+ title: 'Questions',
+ doctype: 'Course Lesson',
+ docname: 'L1',
+ ...props,
+ },
global: {
provide: {
$socket: { on: vi.fn(), off: vi.fn() },
@@ -80,7 +89,9 @@ const mountDiscussions = () =>
// jsdom has no matchMedia, so each test that needs one adds it and it is removed after.
const setWideScreen = (wide: boolean) => {
- window.matchMedia = (() => ({ matches: wide })) as unknown as typeof window.matchMedia
+ window.matchMedia = (() => ({
+ matches: wide,
+ })) as unknown as typeof window.matchMedia
}
describe('Discussions master-detail', () => {
@@ -141,4 +152,11 @@ describe('Discussions master-detail', () => {
expect(rows[0].classes()).toContain('bg-surface-gray-2')
expect(rows[1].classes()).not.toContain('bg-surface-gray-2')
})
+
+ it('takes its heading size from the page, not from the doctype', async () => {
+ const heading = (props: Record) =>
+ mountDiscussions(props).find('.text-ink-gray-9').classes()
+ expect(heading({ doctype: 'LMS Batch' })).toContain('text-2xl-semibold')
+ expect(heading({ headingSize: 'lg' })).toContain('text-lg-semibold')
+ })
})
From f364b132330494b16d6cd0f46fa402c66cbde050 Mon Sep 17 00:00:00 2001
From: Raizaaa <89463672+raizasafeel@users.noreply.github.com>
Date: Mon, 16 Nov 2026 02:35:53 +0530
Subject: [PATCH 02/19] fix: show every form's refusal and loading state
through FormShell
(cherry picked from commit 4dbf303219c1e5e0c623918ae506fa5eac1f18f8)
# Conflicts:
# frontend/src/pages/Programs/ProgramEnrollment.vue
---
.../Enrollment/EnrollStudentsForm.vue | 19 +++----
frontend/src/components/FormShell.vue | 47 +++++++++++++---
frontend/src/components/FormShellStatus.vue | 18 +++++++
.../src/components/Quiz/QuestionDialog.vue | 31 ++++-------
frontend/src/pages/Forms/AnnouncementForm.vue | 35 ++++++------
frontend/src/pages/Forms/AssessmentForm.vue | 13 ++---
frontend/src/pages/Forms/AssignmentForm.vue | 51 +++++++++---------
frontend/src/pages/Forms/BatchCourseForm.vue | 13 ++---
.../src/pages/Forms/BulkCertificatesForm.vue | 35 ++++++------
frontend/src/pages/Forms/ChapterForm.vue | 34 ++++++------
frontend/src/pages/Forms/CourseImportForm.vue | 30 ++++++-----
.../src/pages/Forms/EmailTemplateForm.vue | 13 ++---
frontend/src/pages/Forms/LiveClassForm.vue | 31 ++++-------
frontend/src/pages/Forms/MemberForm.vue | 24 ++++-----
frontend/src/pages/Forms/NewBatchForm.vue | 32 ++++++-----
frontend/src/pages/Forms/NewCourseForm.vue | 32 ++++++-----
frontend/src/pages/Forms/ProfileEditForm.vue | 30 +++++------
frontend/src/pages/Forms/ProgramForm.vue | 44 +++++++--------
.../src/pages/Programs/ProgramEnrollment.vue | 43 +++++++--------
frontend/src/tests/FormShell.test.ts | 53 ++++++++++++++++++-
frontend/src/tests/enrollStudentsForm.test.ts | 1 +
21 files changed, 350 insertions(+), 279 deletions(-)
create mode 100644 frontend/src/components/FormShellStatus.vue
diff --git a/frontend/src/components/Enrollment/EnrollStudentsForm.vue b/frontend/src/components/Enrollment/EnrollStudentsForm.vue
index 4ef170298a..de295dd305 100644
--- a/frontend/src/components/Enrollment/EnrollStudentsForm.vue
+++ b/frontend/src/components/Enrollment/EnrollStudentsForm.vue
@@ -3,6 +3,9 @@
:title="__('Enroll Students')"
size="4xl"
position="top"
+ :loading
+ :message="refusal"
+ :statusClass="bodyHeight"
@close="onClose"
>
@@ -25,16 +28,10 @@
-
- {{ __('Loading...') }}
-
-
- {{ refusal }}
-
@@ -225,6 +222,10 @@ const panelOpen = ref(false)
const ticked = ref([])
const previewLoading = ref(false)
const { isMobile } = useScreenSize()
+// Fixed so the dialog keeps its size from the spinner to the loaded list.
+const bodyHeight = computed(() =>
+ isMobile.value ? 'h-full' : 'h-[min(32rem,calc(80dvh-17rem))]'
+)
const NONE = '—'
diff --git a/frontend/src/components/FormShell.vue b/frontend/src/components/FormShell.vue
index 85567de283..1cb88ef3ad 100644
--- a/frontend/src/components/FormShell.vue
+++ b/frontend/src/components/FormShell.vue
@@ -29,10 +29,16 @@
: 'max-h-[calc(100dvh-17rem)]'
"
>
-
+
+
-
+
@@ -75,7 +81,7 @@
class="ms-auto flex shrink-0 items-center gap-2"
>
-
+
@@ -83,7 +89,13 @@
data-testid="form-shell-body"
class="flex-1 overflow-y-auto overscroll-contain px-5 py-4"
>
-
+
+
@@ -99,11 +111,20 @@
// `lucide-`, which a plain `` does not satisfy.
import { Dialog } from 'frappe-ui'
import type { DialogPosition, DialogSize } from 'frappe-ui'
-import { nextTick, onBeforeUnmount, onMounted, ref, useId, watch } from 'vue'
+import {
+ computed,
+ nextTick,
+ onBeforeUnmount,
+ onMounted,
+ ref,
+ useId,
+ watch,
+} from 'vue'
import { useEventListener, useMediaQuery } from '@vueuse/core'
import { useScreenSize } from '@/utils/composables'
import { useInertBackground } from '@/composables/useInertBackground'
import { focusedElementOwnsLayer, trapTab } from '@/composables/useFocusTrap'
+import FormShellStatus from '@/components/FormShellStatus.vue'
// The transition wraps the teleported node and must never move onto
// : a transform on any ancestor would establish a containing block
@@ -115,18 +136,32 @@ const reduceMotion = useMediaQuery('(prefers-reduced-motion: reduce)')
// `position="top"` keeps a form whose height changes (a message appearing above
// Save) from shifting the whole dialog, as a centred one does.
-withDefaults(
+//
+// `loading` and `message` replace the fields and hide the actions: one place
+// for every form's loading spinner and its refusal ("not permitted",
+// "read-only") text. Loading wins, so a form whose refusal reads data that is
+// still loading shows the spinner, not a premature refusal.
+// `statusClass` sizes that box for a form whose body has a fixed height.
+const props = withDefaults(
defineProps<{
title: string
size?: DialogSize
position?: DialogPosition
+ loading?: boolean
+ message?: string | null
+ statusClass?: string
}>(),
{
size: '3xl',
position: 'center',
+ loading: false,
+ message: null,
+ statusClass: '',
}
)
+const showsForm = computed(() => !props.loading && !props.message)
+
const emit = defineEmits<{ close: [] }>()
const { isMobile } = useScreenSize()
const titleId = useId()
diff --git a/frontend/src/components/FormShellStatus.vue b/frontend/src/components/FormShellStatus.vue
new file mode 100644
index 0000000000..1eb8d4326e
--- /dev/null
+++ b/frontend/src/components/FormShellStatus.vue
@@ -0,0 +1,18 @@
+
+
+
+
+
+ {{ message }}
+
+
+
diff --git a/frontend/src/components/Quiz/QuestionDialog.vue b/frontend/src/components/Quiz/QuestionDialog.vue
index 4fe3ddfbd7..dd515ffd8f 100644
--- a/frontend/src/components/Quiz/QuestionDialog.vue
+++ b/frontend/src/components/Quiz/QuestionDialog.vue
@@ -3,19 +3,12 @@
v-if="show"
size="4xl"
:title="questionName ? __('Edit question') : __('New question')"
+ :loading
+ :statusClass="bodyHeight"
@close="show = false"
>
-
-
-
-
-
-
+
diff --git a/frontend/src/components/CourseCardOverlay.vue b/frontend/src/components/CourseCardOverlay.vue
index af2814ba3a..55a5cb4ae8 100644
--- a/frontend/src/components/CourseCardOverlay.vue
+++ b/frontend/src/components/CourseCardOverlay.vue
@@ -70,6 +70,7 @@
/>
+
+
diff --git a/frontend/src/components/Modals/EvaluationModal.vue b/frontend/src/components/Modals/EvaluationModal.vue
index aa3be9e5c6..f2b166f879 100644
--- a/frontend/src/components/Modals/EvaluationModal.vue
+++ b/frontend/src/components/Modals/EvaluationModal.vue
@@ -132,7 +132,7 @@ function submitEvaluation(close) {
})
return
}
- call('frappe.client.insert', {
+ return call('frappe.client.insert', {
doc: {
doctype: 'LMS Certificate Request',
batch_name: evaluation.value.batch,
diff --git a/frontend/src/components/Modals/Event.vue b/frontend/src/components/Modals/Event.vue
index 7570942548..214dd2e14b 100644
--- a/frontend/src/components/Modals/Event.vue
+++ b/frontend/src/components/Modals/Event.vue
@@ -123,6 +123,7 @@
{{ __('Save') }}
@@ -164,6 +165,7 @@
{{ __('Save') }}
@@ -285,6 +287,7 @@ const evaluationDetails = createResource({
})
const saveEvaluation = () => {
+ if (evaluationResource.loading) return
evaluationResource.submit(
{},
{
@@ -351,6 +354,7 @@ const certificateDetails = createResource({
})
const saveCertificate = () => {
+ if (certificateResource.loading) return
certificateResource.submit(
{},
{
diff --git a/frontend/src/components/Modals/ReviewModal.vue b/frontend/src/components/Modals/ReviewModal.vue
index 9609c17619..d285f7f5b6 100644
--- a/frontend/src/components/Modals/ReviewModal.vue
+++ b/frontend/src/components/Modals/ReviewModal.vue
@@ -60,7 +60,7 @@ const createReview = createResource({
})
function submitReview(close: () => void) {
- submitResource(createReview, review, {
+ return submitResource(createReview, review, {
validate() {
if (!review.rating) {
return 'Please enter a rating.'
diff --git a/frontend/src/components/Notes/InlineLessonMenu.vue b/frontend/src/components/Notes/InlineLessonMenu.vue
index aa559632a4..f8826735b5 100644
--- a/frontend/src/components/Notes/InlineLessonMenu.vue
+++ b/frontend/src/components/Notes/InlineLessonMenu.vue
@@ -17,6 +17,7 @@
:key="color"
type="button"
class="w-full flex items-center gap-x-2 px-3 py-2 cursor-pointer hover:bg-surface-gray-2"
+ :disabled="saving"
@click="saveHighLight(color)"
>
@@ -43,6 +45,7 @@
@@ -67,6 +70,13 @@ const top = ref(0)
const left = ref(0)
const currentSelection = ref(null)
const selectedText = ref('')
+const saving = computed(() =>
+ Boolean(
+ notes.value?.insert.loading ||
+ notes.value?.setValue.loading ||
+ notes.value?.delete.loading
+ )
+)
const emit = defineEmits<{
(e: 'updateNotes'): void
}>()
@@ -120,7 +130,7 @@ const highlightExists = () => {
}
const saveHighLight = (color: string) => {
- if (!selectedText.value) return
+ if (saving.value || !selectedText.value) return
notes.value?.insert.submit(
{
@@ -145,6 +155,7 @@ const saveHighLight = (color: string) => {
}
const deleteHighlight = () => {
+ if (saving.value) return
let notesToDelete = notes.value?.data?.find(
(note: Note) => note.highlighted_text === selectedText.value
)
@@ -167,7 +178,7 @@ const deleteHighlight = () => {
}
const addToNotes = () => {
- if (!selectedText.value) return
+ if (saving.value || !selectedText.value) return
let noteToUpdate = notes.value?.data?.find((note: Note) => {
return !note.highlighted_text && note.note !== ''
})
diff --git a/frontend/src/components/Notes/Notes.vue b/frontend/src/components/Notes/Notes.vue
index f580b61fab..f8d6cd019d 100644
--- a/frontend/src/components/Notes/Notes.vue
+++ b/frontend/src/components/Notes/Notes.vue
@@ -68,7 +68,16 @@ const debouncedSave = useDebounceFn(() => {
saveNotes()
}, 2000)
+// A save while the first insert is in flight would insert a second note, so it
+// waits and runs as an update once the insert lands.
+const creating = ref(false)
+const saveAfterCreate = ref(false)
+
const saveNotes = () => {
+ if (creating.value) {
+ saveAfterCreate.value = true
+ return
+ }
if (currentNoteName.value) {
updateNote()
} else {
@@ -76,7 +85,15 @@ const saveNotes = () => {
}
}
+const finishCreate = () => {
+ creating.value = false
+ if (!saveAfterCreate.value) return
+ saveAfterCreate.value = false
+ saveNotes()
+}
+
const createNote = () => {
+ creating.value = true
notes.value?.insert.submit(
{
lesson: props.lesson,
@@ -89,9 +106,11 @@ const createNote = () => {
onSuccess(data: Note) {
currentNoteName.value = data.name || null
emit('updateNotes')
+ finishCreate()
},
onError(err: FrappeResourceError) {
console.error('Error creating note:', err)
+ finishCreate()
},
}
)
diff --git a/frontend/src/components/Notifications/NotificationPanel.vue b/frontend/src/components/Notifications/NotificationPanel.vue
index 44134e43ee..ab06f119bf 100644
--- a/frontend/src/components/Notifications/NotificationPanel.vue
+++ b/frontend/src/components/Notifications/NotificationPanel.vue
@@ -27,7 +27,8 @@
@@ -159,6 +160,11 @@ watch(panelVisible, (open) => {
if (open) notifications.reload()
})
+const markAllRead = () => {
+ if (markAllAsRead.loading) return
+ markAllAsRead.submit()
+}
+
const onSelect = (n) => {
if (!n.read) markAsRead.submit({ name: n.name })
navigateToPage(n)
diff --git a/frontend/src/components/Profile/ChangePasswordDialog.vue b/frontend/src/components/Profile/ChangePasswordDialog.vue
new file mode 100644
index 0000000000..771fe5f077
--- /dev/null
+++ b/frontend/src/components/Profile/ChangePasswordDialog.vue
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
diff --git a/frontend/src/components/Profile/ProfileEvaluatorCalendar.vue b/frontend/src/components/Profile/ProfileEvaluatorCalendar.vue
index 5024ac5c27..7e5b459b28 100644
--- a/frontend/src/components/Profile/ProfileEvaluatorCalendar.vue
+++ b/frontend/src/components/Profile/ProfileEvaluatorCalendar.vue
@@ -317,6 +317,7 @@ const updateCalendar = createResource({
}) as Resource
const setEnabled = async (on: boolean) => {
+ if (updateCalendar.loading) return
try {
let calendar = await updateCalendar.submit({
fieldname: 'enable',
diff --git a/frontend/src/components/Quiz.vue b/frontend/src/components/Quiz.vue
index f9fbf527bb..6c2ac3805a 100644
--- a/frontend/src/components/Quiz.vue
+++ b/frontend/src/components/Quiz.vue
@@ -482,6 +482,7 @@
questionDetails.data.type != 'Open Ended'
"
variant="solid"
+ :loading="answerCheck.loading"
@click="checkAnswer()"
>
{{ __('Check') }}
@@ -852,6 +853,7 @@ import {
useAssessmentSchedule,
} from '@/composables/useAssessmentSchedule'
import { markLessonProgress } from '@/utils/markLessonProgress'
+import { submitResource } from '@/utils/resource'
import ResponsiveListView from '@/components/ResponsiveListView.vue'
import RichTextEditor from '@/components/RichTextEditor.vue'
import router from '@/router'
@@ -1626,7 +1628,12 @@ const getAnswers = (): Answer[] => {
return answers
}
+const answerCheck = createResource({
+ url: 'lms.lms.doctype.lms_quiz.lms_quiz.check_answer',
+})
+
const checkAnswer = (): void => {
+ if (answerCheck.loading) return
const answers = getAnswers()
const details = questionDetails.data
if (!quiz.data || !details) return
@@ -1635,35 +1642,39 @@ const checkAnswer = (): void => {
return
}
- createResource({
- url: 'lms.lms.doctype.lms_quiz.lms_quiz.check_answer',
- params: {
+ submitResource(
+ answerCheck,
+ {
quiz: quiz.data.name,
question: currentQuestion.value,
question_type: details.type,
answers: JSON.stringify(answers),
},
- auto: true,
- onSuccess(data: AnswerVerdict[] | AnswerVerdict) {
- if (details.type == 'Choices' && Array.isArray(data)) {
- selectedOptions.value.forEach((option, index) => {
- if (option) {
- showAnswers[index] = data[index]
- } else if (data[index] == 2) {
- showAnswers[index] = 2
- } else {
- showAnswers[index] = undefined
- }
- })
- } else if (!Array.isArray(data)) {
- showAnswers.push(data)
- }
- addToLocalStorage()
- if (!quiz.data?.show_answers) {
- resetQuestion()
- }
- },
- })
+ {
+ onSuccess(data) {
+ if (details.type == 'Choices' && Array.isArray(data)) {
+ selectedOptions.value.forEach((option, index) => {
+ if (option) {
+ showAnswers[index] = data[index]
+ } else if (data[index] == 2) {
+ showAnswers[index] = 2
+ } else {
+ showAnswers[index] = undefined
+ }
+ })
+ } else if (!Array.isArray(data)) {
+ showAnswers.push(data)
+ }
+ addToLocalStorage()
+ if (!quiz.data?.show_answers) {
+ resetQuestion()
+ }
+ },
+ onError(error) {
+ console.error(error)
+ },
+ }
+ )
}
const addToLocalStorage = (): void => {
diff --git a/frontend/src/components/Settings/Categories.vue b/frontend/src/components/Settings/Categories.vue
index 6ccf1813e7..b72730d82e 100644
--- a/frontend/src/components/Settings/Categories.vue
+++ b/frontend/src/components/Settings/Categories.vue
@@ -110,9 +110,8 @@ const confirmDeletion = (row: SettingsListRow) => {
label: __('Delete'),
theme: 'red',
variant: 'solid',
- onClick({ close }: { close: () => void }) {
- deleteCategory(row.name, close)
- },
+ onClick: ({ close }: { close: () => void }) =>
+ deleteCategory(row.name, close),
},
],
})
@@ -241,8 +240,14 @@ const saveChanges = () => {
// LMS Category is a Link target on Course and Batch, so the server unlinks
// before deleting; a plain delete raises LinkExistsError.
const deleteCategory = (name: string, close: () => void) => {
+<<<<<<< HEAD
saving.value = true
call('lms.lms.api.delete_category', { category: name })
+=======
+ if (deleting.value) return Promise.resolve()
+ deleting.value = true
+ return call('lms.lms.api.delete_category', { category: name })
+>>>>>>> c612645 (fix: block a second click on action buttons while they run)
.then(() => {
list.reload()
if (typeof close === 'function') close()
diff --git a/frontend/src/components/Settings/EmailAccount/EmailAccountDefaults.vue b/frontend/src/components/Settings/EmailAccount/EmailAccountDefaults.vue
new file mode 100644
index 0000000000..800cd4c9e8
--- /dev/null
+++ b/frontend/src/components/Settings/EmailAccount/EmailAccountDefaults.vue
@@ -0,0 +1,176 @@
+
+
+
+ {{ __('Default Settings') }}
+
+
+
+
+
+ {{ __('Default Incoming') }}
+
+
+ {{ __('Replies to your organisation arrive at this account.') }}
+
+
+
+ pick('incoming', value == null ? null : String(value))
+ "
+ />
+
+
+
+
+
+ {{ __('Default Outgoing') }}
+
+
+ {{ __('Outgoing mail is sent from this account.') }}
+
+
+
+ pick('outgoing', value == null ? null : String(value))
+ "
+ />
+
+
+
+
+
+
+
diff --git a/frontend/src/components/Settings/GoogleCalendar/GoogleCalendarDetail.vue b/frontend/src/components/Settings/GoogleCalendar/GoogleCalendarDetail.vue
new file mode 100644
index 0000000000..29bee8dfaf
--- /dev/null
+++ b/frontend/src/components/Settings/GoogleCalendar/GoogleCalendarDetail.vue
@@ -0,0 +1,162 @@
+
+
+ {}"
+ />
+
+
+
+ {{ __('Save the calendar before authorizing it.') }}
+
+
+
+
+
+
diff --git a/frontend/src/components/Settings/Members/members.ts b/frontend/src/components/Settings/Members/members.ts
new file mode 100644
index 0000000000..92d9a6e1f0
--- /dev/null
+++ b/frontend/src/components/Settings/Members/members.ts
@@ -0,0 +1,203 @@
+import { call, toast } from 'frappe-ui'
+import type { FrappeResourceError } from 'frappe-ui'
+import { markRaw } from 'vue'
+// @ts-expect-error utils/dialogs.js is still plain JS, so it has no declarations
+import { createDialog } from '@/utils/dialogs'
+import Members from '@/components/Settings/Members/Members.vue'
+import { cleanError } from '@/utils'
+import type { CustomPage, SelectOption } from '@/types/settingsSchema'
+import type { SettingsListColumn, SettingsListRow } from '@/types'
+
+/**
+ * Settings > Users, as config: what the list shows, what a row offers, and
+ * the roles the form can grant. Members.vue draws all of it.
+ *
+ * Every translated string is produced inside a function: `__` is installed
+ * on window after main.js finishes importing the settings tree, so a
+ * `__()` call at module scope would throw.
+ */
+
+export const MEMBERS_METHOD = 'lms.lms.api.get_members'
+
+// Users, as far as list invalidation is concerned: get_members returns them
+// and delete_member removes them.
+export const MEMBERS_DOCTYPE = 'User'
+
+// The raw role names get_members returns, and what a badge calls them. Only
+// these four are shown: member_roles() returns LMS_ROLES, and a role outside
+// this map is not one of them.
+const ROLE_LABELS: Record string> = {
+ 'LMS Student': () => __('Student'),
+ 'Course Creator': () => __('Instructor'),
+ Moderator: () => __('Moderator'),
+ 'Batch Evaluator': () => __('Evaluator'),
+}
+
+export const roleOptions = (): SelectOption[] => [
+ { label: __('All'), value: 'All' },
+ ...Object.entries(ROLE_LABELS).map(([value, label]) => ({
+ label: label(),
+ value,
+ })),
+]
+
+/**
+ * The four roles the form grants, in order. `role` is the server's name
+ * (`lms.lms.api.save_role` takes it); `label` is what the row reads. Course
+ * Creator keeps its own name here, not the badge's "Instructor".
+ */
+export const ROLE_ROWS = [
+ {
+ key: 'lms_student',
+ role: 'LMS Student',
+ label: () => __('Student'),
+ description: () => __('Learn courses and track progress'),
+ },
+ {
+ key: 'course_creator',
+ role: 'Course Creator',
+ label: () => __('Course Creator'),
+ description: () => __('Build and manage courses, chapters, and lessons'),
+ },
+ {
+ key: 'batch_evaluator',
+ role: 'Batch Evaluator',
+ label: () => __('Evaluator'),
+ description: () => __('Manage batches, review and grade submissions'),
+ },
+ {
+ key: 'moderator',
+ role: 'Moderator',
+ label: () => __('Moderator'),
+ description: () => __('Oversee all users, content, and system settings'),
+ },
+] as const
+
+export type MemberRoleKey = typeof ROLE_ROWS[number]['key']
+
+export type MemberRoles = Record
+
+export const noRoles = (): MemberRoles => ({
+ lms_student: false,
+ course_creator: false,
+ batch_evaluator: false,
+ moderator: false,
+})
+
+/** The four switches, as the server would name them. */
+export const rolesFrom = (granted: string[] | undefined): MemberRoles => {
+ const held = granted ?? []
+ const roles = noRoles()
+ for (const row of ROLE_ROWS) roles[row.key] = held.includes(row.role)
+ return roles
+}
+
+export interface MemberRowActions {
+ /** The member's own page, which is not a settings page. */
+ profile: (row: SettingsListRow) => void
+ remove: (row: SettingsListRow) => void
+}
+
+export const memberColumns = (
+ actions: MemberRowActions
+): SettingsListColumn[] => [
+ {
+ key: 'member',
+ label: __('User'),
+ type: 'stacked',
+ primary: (row) => row.full_name,
+ secondary: (row) => row.name,
+ avatar: (row) => ({ image: row.user_image, label: row.full_name }),
+ },
+ {
+ key: 'roles',
+ label: __('Roles'),
+ type: 'badge',
+ badges: (row) =>
+ ((row.roles || []) as string[])
+ .filter((role) => ROLE_LABELS[role])
+ .map((role) => ({
+ label: ROLE_LABELS[role](),
+ theme: 'gray' as const,
+ })),
+ },
+ {
+ key: 'actions',
+ type: 'actions',
+ ariaLabel: (row) => __('Actions for {0}').format(row.full_name),
+ // Editing is what a row click does now, so the menu carries the two
+ // things a click cannot: the person's public profile, and deletion.
+ options: (row) => [
+ {
+ label: __('Go to Profile'),
+ icon: 'lucide-user',
+ onClick: () => actions.profile(row),
+ },
+ {
+ label: __('Delete user'),
+ icon: 'lucide-trash-2',
+ theme: 'red',
+ onClick: () => actions.remove(row),
+ },
+ ],
+ },
+]
+
+export const memberError = (
+ error: FrappeResourceError,
+ fallback: string
+): string => {
+ const message = error?.messages?.[0] || error?.message
+ return message ? cleanError(message) : fallback
+}
+
+const removeMember = (
+ row: SettingsListRow,
+ close: (() => void) | undefined,
+ onDeleted: () => void
+) =>
+ call('lms.lms.api.delete_member', { user: row.name })
+ .then(() => {
+ if (typeof close === 'function') close()
+ toast.success(__('User deleted'))
+ onDeleted()
+ })
+ .catch((error: FrappeResourceError) => {
+ toast.error(memberError(error, __('Unable to delete user')))
+ console.error(error)
+ })
+
+// Same confirmation the other settings lists put a delete behind (Categories,
+// Transactions): a red solid Delete in a dialog that says what is lost. A user
+// account is the most destructive row in settings, so it keeps one.
+export const confirmMemberDeletion = (
+ row: SettingsListRow,
+ onDeleted: () => void
+) => {
+ createDialog({
+ title: __('Delete {0}?').format(row.full_name),
+ message: __(
+ 'This permanently deletes the user account and cannot be undone.'
+ ),
+ size: 'sm',
+ actions: [
+ {
+ label: __('Delete'),
+ theme: 'red',
+ variant: 'solid',
+ onClick: ({ close }: { close: () => void }) =>
+ removeMember(row, close, onDeleted),
+ },
+ ],
+ })
+}
+
+// A getter, not a property: this module and Members.vue import each other,
+// so whichever loads first finds the other's bindings uninitialized. Reading
+// it when the panel renders, not while this module evaluates, keeps the pair safe.
+export const membersSettingsPage: CustomPage = {
+ kind: 'custom',
+ get component() {
+ return markRaw(Members)
+ },
+}
diff --git a/frontend/src/components/Settings/Raven/ChannelView.vue b/frontend/src/components/Settings/Raven/ChannelView.vue
index 3a85bbc10e..261f47cdbe 100644
--- a/frontend/src/components/Settings/Raven/ChannelView.vue
+++ b/frontend/src/components/Settings/Raven/ChannelView.vue
@@ -16,7 +16,7 @@
size="sm"
:label="__('Enabled')"
:model-value="enabled"
- :disabled="locked"
+ :disabled="locked || setEnabled.loading"
@update:model-value="toggleEnabled"
/>
diff --git a/frontend/src/components/Settings/Raven/RavenSettings.vue b/frontend/src/components/Settings/Raven/RavenSettings.vue
index 1c8dcbd712..3e88e88ad7 100644
--- a/frontend/src/components/Settings/Raven/RavenSettings.vue
+++ b/frontend/src/components/Settings/Raven/RavenSettings.vue
@@ -57,7 +57,7 @@
v-else
:missing="missingApp"
:loading="enableIntegration.loading"
- @enable="enableIntegration.submit()"
+ @enable="enable"
/>
@@ -136,6 +136,11 @@ const enableIntegration = createResource({
},
})
+function enable(): void {
+ if (enableIntegration.loading) return
+ enableIntegration.submit()
+}
+
/** Which of the three screens is showing. A channel always has a workspace behind it. */
type Screen = 'list' | 'workspace' | 'channel'
diff --git a/frontend/src/components/Settings/Services/Services.vue b/frontend/src/components/Settings/Services/Services.vue
new file mode 100644
index 0000000000..d4e37696dc
--- /dev/null
+++ b/frontend/src/components/Settings/Services/Services.vue
@@ -0,0 +1,229 @@
+
+
+
+
+
+ {{ __('Livecode URL') }}
+
+
setLmsField('livecode_url', value)"
+ />
+
+ {{
+ __(
+ "Address of the LiveCode server that runs the code learners write in programming exercises. Leave it blank to use Frappe's hosted server, or see https://docs.frappe.io/learning/falcon-self-hosting-guide to host your own."
+ )
+ }}
+
+
+
+
+ {{ __('Unsplash Access Key') }}
+
+
setLmsField('unsplash_access_key', value)
+ "
+ />
+
+ {{
+ __(
+ 'Allows users to pick a profile cover image from Unsplash. https://unsplash.com/documentation#getting-started.'
+ )
+ }}
+
+
+
+
+
+
+ {{ __('Google API') }}
+
+
+
+
+
+ {{ __('Enable') }}
+
+
+ {{ __('Turns on Google API access for this site.') }}
+
+
+
setGoogleField('enable', value ? 1 : 0)
+ "
+ />
+
+
+
+ {{ __('Client ID') }}
+
+
setGoogleField('client_id', value)"
+ />
+
+
+
+ {{ __('Client Secret') }}
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/components/Settings/Transactions/AddressModal.vue b/frontend/src/components/Settings/Transactions/AddressModal.vue
index ce54317e33..fa909e399c 100644
--- a/frontend/src/components/Settings/Transactions/AddressModal.vue
+++ b/frontend/src/components/Settings/Transactions/AddressModal.vue
@@ -136,7 +136,7 @@ const createAddress = (close: () => void) => {
)
return
}
- call('frappe.client.insert', {
+ return call('frappe.client.insert', {
doc: {
doctype: 'Address',
...address,
diff --git a/frontend/src/components/Sidebar/UserDropdown.vue b/frontend/src/components/Sidebar/UserDropdown.vue
index 8a82aeca7f..afd67f80da 100644
--- a/frontend/src/components/Sidebar/UserDropdown.vue
+++ b/frontend/src/components/Sidebar/UserDropdown.vue
@@ -323,25 +323,24 @@ const clearDemoDataConfirmation = () => {
theme: 'red',
variant: 'solid',
onClick({ close }) {
- clearDemoData()
- close()
+ return clearDemoData(close)
},
},
],
})
}
-const clearDemoData = () => {
+const clearDemoData = (close) =>
call('lms.lms.api.clear_demo_data')
.then(() => {
window.location.href = '/lms'
toast.success(__('Demo data cleared successfully'))
})
.catch((error) => {
+ close()
toast.error(__(error.message || 'Error clearing demo data'))
console.error('Error clearing demo data:', error)
})
-}