Merge branch 'feature/backups-ui' of github.com:Budibase/budibase into feature/backups-ui
This commit is contained in:
commit
7f1233576b
|
@ -62,11 +62,9 @@
|
||||||
const [dates] = event.detail
|
const [dates] = event.detail
|
||||||
const noTimezone = enableTime && !timeOnly && ignoreTimezones
|
const noTimezone = enableTime && !timeOnly && ignoreTimezones
|
||||||
let newValue = dates[0]
|
let newValue = dates[0]
|
||||||
|
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
newValue = newValue.toISOString()
|
newValue = newValue.toISOString()
|
||||||
}
|
}
|
||||||
|
|
||||||
// If time only set date component to 2000-01-01
|
// If time only set date component to 2000-01-01
|
||||||
else if (timeOnly) {
|
else if (timeOnly) {
|
||||||
// Classic flackpickr causing issues.
|
// Classic flackpickr causing issues.
|
||||||
|
@ -95,11 +93,14 @@
|
||||||
newValue = new Date(dates[0].getTime() - offset)
|
newValue = new Date(dates[0].getTime() - offset)
|
||||||
.toISOString()
|
.toISOString()
|
||||||
.slice(0, -1)
|
.slice(0, -1)
|
||||||
} else if (range) {
|
|
||||||
console.log("hello")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (range) {
|
||||||
|
dispatch("change", event.detail)
|
||||||
|
} else {
|
||||||
dispatch("change", newValue)
|
dispatch("change", newValue)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const clearDateOnBackspace = event => {
|
const clearDateOnBackspace = event => {
|
||||||
if (["Backspace", "Clear", "Delete"].includes(event.key)) {
|
if (["Backspace", "Clear", "Delete"].includes(event.key)) {
|
||||||
|
@ -163,7 +164,7 @@
|
||||||
{#key redrawOptions}
|
{#key redrawOptions}
|
||||||
<Flatpickr
|
<Flatpickr
|
||||||
bind:flatpickr
|
bind:flatpickr
|
||||||
value={parseDate(value)}
|
value={range ? value : parseDate(value)}
|
||||||
on:open={onOpen}
|
on:open={onOpen}
|
||||||
on:close={onClose}
|
on:close={onClose}
|
||||||
options={flatpickrOptions}
|
options={flatpickrOptions}
|
||||||
|
|
|
@ -18,7 +18,13 @@
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
const onChange = e => {
|
const onChange = e => {
|
||||||
|
if (range) {
|
||||||
|
// Flatpickr cant take two dates and work out what to display, needs to be provided a string.
|
||||||
|
// Like - "Date1 to Date2". Hence passing in that specifically from the array
|
||||||
|
value = e.detail[1]
|
||||||
|
} else {
|
||||||
value = e.detail
|
value = e.detail
|
||||||
|
}
|
||||||
dispatch("change", e.detail)
|
dispatch("change", e.detail)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -26,9 +26,11 @@
|
||||||
let modal
|
let modal
|
||||||
let trigger = null
|
let trigger = null
|
||||||
let pageInfo = createPaginationStore()
|
let pageInfo = createPaginationStore()
|
||||||
$: page = $pageInfo.page
|
let startDate
|
||||||
|
let endDate
|
||||||
|
|
||||||
$: fetchBackups(trigger, page)
|
$: page = $pageInfo.page
|
||||||
|
$: fetchBackups(trigger, page, startDate, endDate)
|
||||||
|
|
||||||
const triggers = {
|
const triggers = {
|
||||||
PUBLISH: "publish",
|
PUBLISH: "publish",
|
||||||
|
@ -78,11 +80,13 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchBackups(trigger, page) {
|
async function fetchBackups(trigger, page, startDate, endDate) {
|
||||||
const response = await backups.searchBackups({
|
const response = await backups.searchBackups({
|
||||||
appId: app.instance._id,
|
appId: app.instance._id,
|
||||||
trigger,
|
trigger,
|
||||||
page,
|
page,
|
||||||
|
startDate,
|
||||||
|
endDate,
|
||||||
})
|
})
|
||||||
pageInfo.fetched(response.hasNextPage, response.nextPage)
|
pageInfo.fetched(response.hasNextPage, response.nextPage)
|
||||||
|
|
||||||
|
@ -139,9 +143,14 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
range
|
range={true}
|
||||||
label={"Filter Range"}
|
label={"Filter Range"}
|
||||||
on:change={e => console.log(e)}
|
on:change={e => {
|
||||||
|
if (e.detail[0].length > 1) {
|
||||||
|
startDate = e.detail[0][0].toISOString()
|
||||||
|
endDate = e.detail[0][1].toISOString()
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ export function createBackupsStore() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function searchBackups({ appId, trigger, page } = {}) {
|
async function searchBackups({ appId, trigger, page, startDate, endDate }) {
|
||||||
return API.searchBackups({ appId, trigger, page })
|
return API.searchBackups({ appId, trigger, page, startDate, endDate })
|
||||||
}
|
}
|
||||||
|
|
||||||
async function restoreBackup({ appId, backupId }) {
|
async function restoreBackup({ appId, backupId }) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ export const buildBackupsEndpoints = API => ({
|
||||||
if (trigger) {
|
if (trigger) {
|
||||||
opts.trigger = trigger.toLowerCase()
|
opts.trigger = trigger.toLowerCase()
|
||||||
}
|
}
|
||||||
if (startDate) {
|
if (startDate && endDate) {
|
||||||
opts.startDate = startDate
|
opts.startDate = startDate
|
||||||
opts.endDate = endDate
|
opts.endDate = endDate
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue