refactor: simplify property management logic and improve type definitions
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 9s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 9s
This commit is contained in:
parent
0da23733ab
commit
0ad05fa960
1 changed files with 15 additions and 15 deletions
|
|
@ -1,18 +1,10 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import {
|
import { moveItemUp, moveItemDown, dialog, deleteItem } from 'stores/utils';
|
||||||
moveItemUp,
|
|
||||||
moveItemDown,
|
|
||||||
dialog,
|
|
||||||
deleteItem,
|
|
||||||
toCamelCase,
|
|
||||||
} from 'stores/utils';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import useOptionStore from 'src/stores/options';
|
import useOptionStore from 'src/stores/options';
|
||||||
import { useWorkflowTemplate } from 'src/stores/workflow-template';
|
import { useWorkflowTemplate } from 'src/stores/workflow-template';
|
||||||
import { useProperty } from 'src/stores/property';
|
|
||||||
import { Option } from 'stores/options/types';
|
|
||||||
import {
|
import {
|
||||||
WorkFlowPayloadStep,
|
WorkFlowPayloadStep,
|
||||||
WorkflowTemplate,
|
WorkflowTemplate,
|
||||||
|
|
@ -22,10 +14,14 @@ import SelectFlow from '../shared/select/SelectFlow.vue';
|
||||||
import NoData from '../NoData.vue';
|
import NoData from '../NoData.vue';
|
||||||
import DialogForm from '../DialogForm.vue';
|
import DialogForm from '../DialogForm.vue';
|
||||||
|
|
||||||
|
interface Option {
|
||||||
|
value: string;
|
||||||
|
label: string;
|
||||||
|
type: string;
|
||||||
|
}
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { getWorkflowTemplate } = useWorkflowTemplate();
|
const { getWorkflowTemplate } = useWorkflowTemplate();
|
||||||
const { getPropertyList } = useProperty();
|
|
||||||
const { locale } = useI18n();
|
|
||||||
const optionStore = useOptionStore();
|
const optionStore = useOptionStore();
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|
@ -99,8 +95,9 @@ function manageProperties(
|
||||||
) {
|
) {
|
||||||
if (property === 'all' && propertiesOption.value) {
|
if (property === 'all' && propertiesOption.value) {
|
||||||
if (
|
if (
|
||||||
tempStep.value[stepIndex].attributes.properties.length ===
|
tempStep.value[stepIndex].attributes.properties.filter((p) =>
|
||||||
propertiesOption.value.length
|
propertiesOption.value.some((opt: Option) => opt.value === p.fieldName),
|
||||||
|
).length === propertiesOption.value.length
|
||||||
) {
|
) {
|
||||||
tempStep.value[stepIndex].attributes.properties = [];
|
tempStep.value[stepIndex].attributes.properties = [];
|
||||||
return;
|
return;
|
||||||
|
|
@ -394,8 +391,11 @@ watch(
|
||||||
<div class="full-width flex items-center">
|
<div class="full-width flex items-center">
|
||||||
<q-icon
|
<q-icon
|
||||||
v-if="
|
v-if="
|
||||||
tempStep[stepIndex].attributes.properties?.length ===
|
tempStep[stepIndex].attributes.properties?.filter((p) =>
|
||||||
propertiesOption?.length
|
propertiesOption.some(
|
||||||
|
(opt: Option) => opt.value === p.fieldName,
|
||||||
|
),
|
||||||
|
).length === propertiesOption.length
|
||||||
"
|
"
|
||||||
name="mdi-checkbox-marked"
|
name="mdi-checkbox-marked"
|
||||||
size="xs"
|
size="xs"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue