diff --git a/kolibri/core/assets/src/views/sync/FacilityAdminCredentialsForm.vue b/kolibri/core/assets/src/views/sync/FacilityAdminCredentialsForm.vue index f1e9cd3604e..0c33be4dae5 100644 --- a/kolibri/core/assets/src/views/sync/FacilityAdminCredentialsForm.vue +++ b/kolibri/core/assets/src/views/sync/FacilityAdminCredentialsForm.vue @@ -60,9 +60,20 @@ device: { type: Object, required: true, - validator(val) { - return val.name && val.id && val.baseurl; - }, + validator: objectValidator({ + name: { + type: String, + required: true, + }, + id: { + type: String, + required: true, + }, + baseurl: { + type: String, + required: true, + }, + }), }, facility: { type: Object, diff --git a/kolibri/plugins/coach/assets/src/views/common/notifications/NotificationCard.vue b/kolibri/plugins/coach/assets/src/views/common/notifications/NotificationCard.vue index 1a2a431b745..e966e1f1b1e 100644 --- a/kolibri/plugins/coach/assets/src/views/common/notifications/NotificationCard.vue +++ b/kolibri/plugins/coach/assets/src/views/common/notifications/NotificationCard.vue @@ -93,12 +93,16 @@ notification: { type: Object, required: true, - validator(notification) { - return ( - Object.values(NotificationEvents).includes(notification.event) && - Object.values(NotificationObjects).includes(notification.object) - ); - }, + validator: objectValidator({ + event: { + required: true, + validator: value => Object.values(NotificationEvents).includes(value), + }, + object: { + required: true, + validator: value => Object.values(NotificationObjects).includes(value), + }, + }), }, lastQuery: { type: Object, diff --git a/kolibri/plugins/coach/assets/src/views/plan/GroupsPage/GroupRow.vue b/kolibri/plugins/coach/assets/src/views/plan/GroupsPage/GroupRow.vue index a5d187d9a55..61577f20464 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/GroupsPage/GroupRow.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/GroupsPage/GroupRow.vue @@ -42,9 +42,18 @@ group: { type: Object, required: true, - validator(group) { - return group.name && group.users; - }, + validator: objectValidator({ + name: { + type: String, + required: true, + validator: value => value !== null && value !== '', + }, + users: { + type: Array, + required: true, + validator: value => Array.isArray(value) && value.length > 0, + }, + }), }, }, computed: { diff --git a/packages/kolibri-common/components/SearchFiltersPanel/SelectGroup.vue b/packages/kolibri-common/components/SearchFiltersPanel/SelectGroup.vue index 419bc994fd7..85d0bc27323 100644 --- a/packages/kolibri-common/components/SearchFiltersPanel/SelectGroup.vue +++ b/packages/kolibri-common/components/SearchFiltersPanel/SelectGroup.vue @@ -83,10 +83,24 @@ value: { type: Object, required: true, - validator(value) { - const inputKeys = ['channels', 'accessibility_labels', 'languages', 'grade_levels']; - return inputKeys.every(k => Object.prototype.hasOwnProperty.call(value, k)); - }, + validator: objectValidator({ + channels: { + type: Array, + required: true, + }, + accessibility_labels: { + type: Array, + required: true, + }, + languages: { + type: Array, + required: true, + }, + grade_levels: { + type: Array, + required: true, + }, + }), }, showChannels: { type: Boolean,