Skip to content

Commit

Permalink
fix actions
Browse files Browse the repository at this point in the history
  • Loading branch information
satkunas committed Dec 17, 2024
1 parent 4ea564a commit cd8cadf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions html/pfappserver/root/src/globals/pfActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ const pfActionSchema = yup.object({
value: yup.string()
.when('type', type => {
switch (true) {
case !type:
case type === 'set_role':
case pfActions[type].types.includes(fieldType.NONE):
case pfActions[type].types.includes(fieldType.HIDDEN):
Expand All @@ -205,7 +204,7 @@ const pfActionSchema = yup.object({
// break
case type === 'set_access_level':
case type === 'set_access_level_by_acl_user':
return yup.array().nullable()
return yup.array().ensure()
.of(yup.string().nullable())
.required(i18n.t('Level(s) required.'))
// break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ const components = {
BaseInputChosenOne
}
import i18n from '@/utils/locale'
const sortOptions = ({text: a}, {text: b}) => i18n.t(a).localeCompare(i18n.t(b))
import { computed, inject, nextTick, ref, unref, watch } from '@vue/composition-api'
import {
pfComponentType as componentType,
Expand Down Expand Up @@ -67,6 +70,7 @@ const setup = (props, context) => {
watch( // when `type` is mutated
() => unref(inputValue) && unref(inputValue).type,
() => {
unref(inputValue).value = undefined
const { isFocus = false } = typeComponentRef.value
if (isFocus) { // and `type` isFocus
const { ['default']: _default } = unref(action)
Expand Down Expand Up @@ -97,7 +101,7 @@ const setup = (props, context) => {
const typeOptions = computed(() => unref(actions).map(action => {
const { text, value } = action
return { text, value }
}))
}).sort(sortOptions))
const valueComponent = computed(() => {
if (action.value) {
Expand Down

0 comments on commit cd8cadf

Please sign in to comment.