fix eslint

This commit is contained in:
Robert Kaussow
2025-10-12 21:04:01 +02:00
parent fb464e16f0
commit ed5acaf2ca
3 changed files with 58 additions and 11 deletions
@@ -26,7 +26,7 @@
required
>
<option v-for="type in parameterTypes" :key="type" :value="type">
{{ $t(`parameters.types.${type}`) }}
{{ ParameterTypeName(type) }}
</option>
</select>
</InputField>
@@ -93,6 +93,7 @@
<script lang="ts" setup>
import { computed, inject, ref, watch } from 'vue';
import type { Ref } from 'vue';
import { useI18n } from 'vue-i18n';
import Button from '~/components/atomic/Button.vue';
import Checkbox from '~/components/form/Checkbox.vue';
@@ -114,6 +115,8 @@ const emit = defineEmits<{
(e: 'cancel'): void;
}>();
const { t } = useI18n();
const apiClient = useApiClient();
const repo = inject('repo') as Ref<Repo>;
const branches = ref<string[]>([]);
@@ -137,6 +140,25 @@ const isChoice = computed(
const showDefaultValue = computed(() => innerParameter.value.type !== undefined);
const showTrimString = computed(() => !isBoolean.value && !isPassword.value);
const ParameterTypeName = (type: ParameterType): string => {
switch (type) {
case ParameterType.Boolean:
return t('parameters.types.boolean');
case ParameterType.SingleChoice:
return t('parameters.types.single_choice');
case ParameterType.MultipleChoice:
return t('parameters.types.multiple_choice');
case ParameterType.String:
return t('parameters.types.string');
case ParameterType.Text:
return t('parameters.types.text');
case ParameterType.Password:
return t('parameters.types.password');
default:
return type; // Fallback to the type itself if no translation is found
}
};
// Update local copy when prop changes
watch(
() => props.modelValue,
@@ -14,7 +14,7 @@
</div>
</div>
<div class="md:display-unset ml-auto hidden">
<Badge :value="$t(`parameters.types.${parameter.type}`)" />
<Badge :value="ParameterTypeName(parameter.type)" />
</div>
<div class="flex items-center gap-2">
<IconButton
@@ -39,6 +39,8 @@
</template>
<script lang="ts" setup>
import { useI18n } from 'vue-i18n';
import Badge from '~/components/atomic/Badge.vue';
import Icon from '~/components/atomic/Icon.vue';
import IconButton from '~/components/atomic/IconButton.vue';
@@ -53,4 +55,25 @@ defineEmits<{
(e: 'edit', parameter: Parameter): void;
(e: 'delete', parameter: Parameter): void;
}>();
const { t } = useI18n();
const ParameterTypeName = (type: string): string => {
switch (type) {
case 'boolean':
return t('parameters.types.boolean');
case 'single_choice':
return t('parameters.types.single_choice');
case 'multiple_choice':
return t('parameters.types.multiple_choice');
case 'string':
return t('parameters.types.string');
case 'text':
return t('parameters.types.text');
case 'password':
return t('parameters.types.password');
default:
return type; // Fallback to the type itself if no translation is found
}
};
</script>
+11 -9
View File
@@ -1,12 +1,3 @@
export enum ParameterType {
Boolean = 'boolean',
SingleChoice = 'single_choice',
MultipleChoice = 'multiple_choice',
String = 'string',
Text = 'text',
Password = 'password',
}
export interface Parameter {
id: string;
repo_id: number;
@@ -17,3 +8,14 @@ export interface Parameter {
default_value: string;
trim_string: boolean;
}
/* eslint-disable no-unused-vars */
export enum ParameterType {
Boolean = 'boolean',
SingleChoice = 'single_choice',
MultipleChoice = 'multiple_choice',
String = 'string',
Text = 'text',
Password = 'password',
}
/* eslint-enable */