-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c5c4ca
commit 8f5dcff
Showing
12 changed files
with
322 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 0 additions & 74 deletions
74
ui/src/components/executions/date-select/RelativeDateSelect.vue
This file was deleted.
Oops, something went wrong.
128 changes: 128 additions & 0 deletions
128
ui/src/components/executions/date-select/TimeSelect.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
<template> | ||
<date-select | ||
:placeholder="customAwarePlaceholder" | ||
:value="timeRangeSelect" | ||
:options="timeFilterPresets" | ||
:tooltip="fromNow ? $t('relative start date') : undefined" | ||
:clearable="clearable" | ||
@change="onTimeRangeSelect" | ||
/> | ||
<el-tooltip v-if="allowCustom && timeRangeSelect === undefined" :content="allowInfinite ? $t('datepicker.leave empty for infinite') : $t('datepicker.duration example')"> | ||
<el-input class="mt-2" :model-value="timeRange" :placeholder="$t('datepicker.custom duration')" @update:model-value="onTimeRangeChange" /> | ||
</el-tooltip> | ||
</template> | ||
|
||
<script> | ||
import DateSelect from "./DateSelect.vue"; | ||
export default { | ||
components: { | ||
DateSelect | ||
}, | ||
emits: [ | ||
"update:modelValue" | ||
], | ||
computed: { | ||
customAwarePlaceholder() { | ||
if (this.placeholder) { | ||
return this.placeholder; | ||
} | ||
return this.allowCustom ? this.$t("datepicker.custom") : undefined; | ||
}, | ||
presetValues() { | ||
return this.timeFilterPresets.map(preset => preset.value); | ||
} | ||
}, | ||
watch: { | ||
timeRange: { | ||
handler(newValue, oldValue) { | ||
if (oldValue === undefined && this.presetValues.includes(newValue)) { | ||
this.onTimeRangeSelect(newValue); | ||
} | ||
}, | ||
immediate: true | ||
} | ||
}, | ||
data() { | ||
return { | ||
timeRangeSelect: undefined, | ||
timeFilterPresets: [ | ||
{ | ||
value: "PT5M", | ||
label: this.label("5minutes") | ||
}, | ||
{ | ||
value: "PT15M", | ||
label: this.label("15minutes") | ||
}, | ||
{ | ||
value: "PT1H", | ||
label: this.label("1hour") | ||
}, | ||
{ | ||
value: "PT12H", | ||
label: this.label("12hours") | ||
}, | ||
{ | ||
value: "PT24H", | ||
label: this.label("24hours") | ||
}, | ||
{ | ||
value: "PT48H", | ||
label: this.label("48hours") | ||
}, | ||
{ | ||
value: "PT168H", | ||
label: this.label("7days") | ||
}, | ||
{ | ||
value: "PT720H", | ||
label: this.label("30days") | ||
}, | ||
{ | ||
value: "PT8760H", | ||
label: this.label("365days") | ||
} | ||
] | ||
} | ||
}, | ||
props: { | ||
allowCustom: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
placeholder: { | ||
type: String, | ||
default: undefined | ||
}, | ||
timeRange: { | ||
type: String, | ||
default: undefined | ||
}, | ||
fromNow: { | ||
type: Boolean, | ||
default: true | ||
}, | ||
allowInfinite: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
clearable: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}, | ||
methods: { | ||
onTimeRangeSelect(range) { | ||
this.timeRangeSelect = range; | ||
this.onTimeRangeChange(range); | ||
}, | ||
onTimeRangeChange(range) { | ||
this.$emit("update:modelValue", {"timeRange": range}); | ||
}, | ||
label(duration) { | ||
return "datepicker." + (this.fromNow ? "last" : "") + duration; | ||
} | ||
} | ||
} | ||
</script> |
Oops, something went wrong.