Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve secondary workflows dialog #1143

Merged
merged 25 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9a34b0b
Clean up HTML
ceesvoesenek Dec 16, 2024
85980f0
Add type for workflow form data
ceesvoesenek Dec 18, 2024
da1741c
Move functions to library
ceesvoesenek Dec 18, 2024
05cf413
Move functions to library instead of TypeScript file next to component
ceesvoesenek Dec 18, 2024
64e253b
Move form schema fetching/creation to composable
ceesvoesenek Dec 18, 2024
099fd30
Make sure the forms container scrolls when it has many elements
ceesvoesenek Dec 18, 2024
b28f84b
Select first item in the list upon creation of the component
ceesvoesenek Dec 18, 2024
31c2432
Add task run description field for secondary workflows
ceesvoesenek Dec 18, 2024
cc2987d
Label controls with "T0" instead of "t0"
ceesvoesenek Dec 18, 2024
b2fe381
Remove duplicated code
ceesvoesenek Dec 18, 2024
bbcf1fd
Use v-date-input instead of v-date-picker
ceesvoesenek Dec 18, 2024
0c90ab3
Show secondary workflow name instead of description
ceesvoesenek Dec 18, 2024
cc5554b
Disable workflow select field if only one workflow exists
ceesvoesenek Dec 18, 2024
7449d6c
Show workflow description if available
ceesvoesenek Dec 18, 2024
83739ff
Hide time picker header
ceesvoesenek Dec 18, 2024
42ca51c
Allow entering times with the text field as well as the picker
ceesvoesenek Dec 18, 2024
341d33a
Add missing types
ceesvoesenek Dec 19, 2024
0063ad1
Add label to auto-generated UI schema
ceesvoesenek Dec 19, 2024
3ce2dd8
Use textarea for description
wkramer Dec 19, 2024
aed4909
Rename run workflows to run tasks
wkramer Dec 20, 2024
35cf6a5
Cleanup UI, add placehoder for task run description
wkramer Dec 20, 2024
e8ed3b1
Make JSON forms v-container compact
wkramer Dec 20, 2024
15b6dc6
Use native time input
wkramer Dec 20, 2024
8f53cbc
Empty string when workflow description is missing
wkramer Dec 20, 2024
1fa9512
Fix linter issue
wkramer Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/assets/JsonFormsConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"variant": "outlined"
},
"v-container": {
"class": "pa-0"
"class": "pa-0",
"density": "compact"
}
}
}
115 changes: 45 additions & 70 deletions src/components/general/DateTimeField.vue
Original file line number Diff line number Diff line change
@@ -1,40 +1,30 @@
<template>
<div class="d-flex flex-row gc-2">
<v-menu :close-on-content-click="false">
<template #activator="{ props }">
<v-text-field
v-bind="props"
:model-value="dateString"
:label="dateLabel"
readonly
/>
</template>
<v-date-picker v-model="internalDate" />
</v-menu>
<v-menu :close-on-content-click="false">
<template #activator="{ props }">
<v-text-field
v-bind="props"
:model-value="timeString"
:label="timeLabel"
readonly
/>
</template>
<v-time-picker
v-model="internalTime"
format="24hr"
:use-seconds="false"
@update:hour="updateHours"
@update:minute="updateMinutes"
<v-row>
<v-col>
<v-date-input
prepend-icon=""
v-model="internalDate"
:label="dateLabel"
variant="outlined"
density="compact"
/>
</v-menu>
</div>
</v-col>
<v-col>
<v-text-field
v-model="timeString"
type="time"
variant="outlined"
density="compact"
:label="timeLabel"
cleatable
/>
</v-col>
</v-row>
</template>

<script setup lang="ts">
import { computed } from 'vue'

import { VTimePicker } from 'vuetify/labs/components'
import { computed, ref, watch } from 'vue'
import { VDateInput } from 'vuetify/labs/components'

interface Props {
dateLabel?: string
Expand All @@ -54,47 +44,32 @@ const internalDate = computed<Date>({
date.value = newDate
},
})
const internalTime = computed<string>({
get: () => timeString.value,
set: (newValue) => {
const [hours, minutes] = newValue.split(':').map(parseFloat)

const newDate = new Date(date.value)
newDate.setHours(hours)
newDate.setMinutes(minutes)
date.value = newDate
},
})

// Get date and time from the text fields.
const dateString = computed<string>(() => {
const year = date.value.getFullYear()
const month = date.value.getMonth()
const day = date.value.getDate()
const timeString = ref('')
// Update time string when the time was set from the picker.
watch(
date,
() => {
const hours = date.value.getHours()
const minutes = date.value.getMinutes()

const monthString = (month + 1).toString().padStart(2, '0')
const dayString = day.toString().padStart(2, '0')
return `${year}-${monthString}-${dayString}`
})

const timeString = computed<string>(() => {
const hours = date.value.getHours()
const minutes = date.value.getMinutes()

const hoursString = hours.toString().padStart(2, '0')
const minutesString = minutes.toString().padStart(2, '0')
return `${hoursString}:${minutesString}`
})
const hoursString = hours.toString().padStart(2, '0')
const minutesString = minutes.toString().padStart(2, '0')
timeString.value = `${hoursString}:${minutesString}`
},
{ immediate: true },
)
</script>

function updateHours(hours: number): void {
const newDate = new Date(date.value)
newDate.setHours(hours)
date.value = newDate
<style>
/* Hide the clock icon in Chrome, Edge, and other WebKit-based browsers */
input[type='time']::-webkit-inner-spin-button,
input[type='time']::-webkit-calendar-picker-indicator {
display: none;
-webkit-appearance: none;
}

function updateMinutes(minutes: number): void {
const newDate = new Date(date.value)
newDate.setMinutes(minutes)
date.value = newDate
input[type='time']::-moz-selection {
background-color: tomato;
}
</script>
</style>
Loading
Loading