Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
114 lines
3.1 KiB
Vue
114 lines
3.1 KiB
Vue
<script setup>
|
|
import { computed, defineModel, ref, watch } from 'vue';
|
|
import { useI18n } from 'vue-i18n';
|
|
import Button from 'dashboard/components-next/button/Button.vue';
|
|
import Input from 'dashboard/components-next/input/Input.vue';
|
|
import ComboBox from 'dashboard/components-next/combobox/ComboBox.vue';
|
|
import Checkbox from 'dashboard/components-next/checkbox/Checkbox.vue';
|
|
|
|
const emit = defineEmits(['remove']);
|
|
const { t } = useI18n();
|
|
const showErrors = ref(false);
|
|
|
|
const name = defineModel('name', {
|
|
type: String,
|
|
required: true,
|
|
});
|
|
|
|
const type = defineModel('type', {
|
|
type: String,
|
|
required: true,
|
|
});
|
|
|
|
const description = defineModel('description', {
|
|
type: String,
|
|
default: '',
|
|
});
|
|
|
|
const required = defineModel('required', {
|
|
type: Boolean,
|
|
default: false,
|
|
});
|
|
|
|
const paramTypeOptions = computed(() => [
|
|
{ value: 'string', label: t('CAPTAIN.CUSTOM_TOOLS.FORM.PARAM_TYPES.STRING') },
|
|
{ value: 'number', label: t('CAPTAIN.CUSTOM_TOOLS.FORM.PARAM_TYPES.NUMBER') },
|
|
{
|
|
value: 'boolean',
|
|
label: t('CAPTAIN.CUSTOM_TOOLS.FORM.PARAM_TYPES.BOOLEAN'),
|
|
},
|
|
{ value: 'array', label: t('CAPTAIN.CUSTOM_TOOLS.FORM.PARAM_TYPES.ARRAY') },
|
|
{ value: 'object', label: t('CAPTAIN.CUSTOM_TOOLS.FORM.PARAM_TYPES.OBJECT') },
|
|
]);
|
|
|
|
const validationError = computed(() => {
|
|
if (!name.value || name.value.trim() === '') {
|
|
return 'PARAM_NAME_REQUIRED';
|
|
}
|
|
return null;
|
|
});
|
|
|
|
watch([name, type, description, required], () => {
|
|
showErrors.value = false;
|
|
});
|
|
|
|
const validate = () => {
|
|
showErrors.value = true;
|
|
return !validationError.value;
|
|
};
|
|
|
|
defineExpose({ validate });
|
|
</script>
|
|
|
|
<template>
|
|
<li class="list-none">
|
|
<div
|
|
class="flex items-start gap-2 p-3 rounded-lg border border-n-weak bg-n-alpha-2"
|
|
:class="{
|
|
'animate-wiggle border-n-ruby-9': showErrors && validationError,
|
|
}"
|
|
>
|
|
<div class="flex flex-col flex-1 gap-3">
|
|
<div class="grid grid-cols-3 gap-2">
|
|
<Input
|
|
v-model="name"
|
|
:placeholder="t('CAPTAIN.CUSTOM_TOOLS.FORM.PARAM_NAME.PLACEHOLDER')"
|
|
class="col-span-2"
|
|
/>
|
|
<ComboBox
|
|
v-model="type"
|
|
:options="paramTypeOptions"
|
|
:placeholder="t('CAPTAIN.CUSTOM_TOOLS.FORM.PARAM_TYPE.PLACEHOLDER')"
|
|
class="[&>div>button]:bg-n-alpha-black2"
|
|
/>
|
|
</div>
|
|
<Input
|
|
v-model="description"
|
|
:placeholder="
|
|
t('CAPTAIN.CUSTOM_TOOLS.FORM.PARAM_DESCRIPTION.PLACEHOLDER')
|
|
"
|
|
/>
|
|
<label class="flex items-center gap-2 cursor-pointer">
|
|
<Checkbox v-model="required" />
|
|
<span class="text-sm text-n-slate-11">
|
|
{{ t('CAPTAIN.CUSTOM_TOOLS.FORM.PARAM_REQUIRED.LABEL') }}
|
|
</span>
|
|
</label>
|
|
</div>
|
|
<Button
|
|
solid
|
|
slate
|
|
icon="i-lucide-trash"
|
|
class="flex-shrink-0"
|
|
@click.stop="emit('remove')"
|
|
/>
|
|
</div>
|
|
<span
|
|
v-if="showErrors && validationError"
|
|
class="block mt-1 text-sm text-n-ruby-11"
|
|
>
|
|
{{ t(`CAPTAIN.CUSTOM_TOOLS.FORM.ERRORS.${validationError}`) }}
|
|
</span>
|
|
</li>
|
|
</template>
|