mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-24 09:43:56 +00:00
Rewrite of WebUI (#245)
Rewrite of the UI using Typescript, Vue3, Windicss and Vite. The design should be close to the current one with some changes: - latest pipeline in a sidebar on the right - secrets and registry as part of the repo-settings (secrets and registry entries shouldn't be used as much so they can be "hidden" under settings IMO) - start page shows list of active repositories with button to enable / add new ones (currently you see all repositories and in most cases you only add new repositories once in a while)
This commit is contained in:
65
web/src/components/form/CheckboxesField.vue
Normal file
65
web/src/components/form/CheckboxesField.vue
Normal file
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<Checkbox
|
||||
v-for="option in options"
|
||||
:key="option.value"
|
||||
:model-value="innerValue.includes(option.value)"
|
||||
:label="option.text"
|
||||
class="mb-2"
|
||||
@update:model-value="clickOption(option)"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, PropType, toRef } from 'vue';
|
||||
|
||||
import Checkbox from './Checkbox.vue';
|
||||
import { CheckboxOption } from './form.types';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CheckboxesField',
|
||||
|
||||
components: { Checkbox },
|
||||
|
||||
props: {
|
||||
// used by toRef
|
||||
// eslint-disable-next-line vue/no-unused-properties
|
||||
modelValue: {
|
||||
type: Array as PropType<CheckboxOption['value'][]>,
|
||||
default: () => [],
|
||||
},
|
||||
|
||||
options: {
|
||||
type: Array as PropType<CheckboxOption[]>,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
emits: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
'update:modelValue': (_value: CheckboxOption['value'][]): boolean => true,
|
||||
},
|
||||
|
||||
setup: (props, ctx) => {
|
||||
const modelValue = toRef(props, 'modelValue');
|
||||
const innerValue = computed({
|
||||
get: () => modelValue.value,
|
||||
set: (value) => {
|
||||
ctx.emit('update:modelValue', value);
|
||||
},
|
||||
});
|
||||
|
||||
function clickOption(option: CheckboxOption) {
|
||||
if (innerValue.value.includes(option.value)) {
|
||||
innerValue.value = innerValue.value.filter((o) => o !== option.value);
|
||||
} else {
|
||||
innerValue.value.push(option.value);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
innerValue,
|
||||
clickOption,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user