Merge commit

This commit is contained in:
Dean 2022-07-15 11:33:05 +01:00
parent 47603f462f
commit 92ded1afe4
1 changed files with 28 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<script> <script>
import { Layout, Table, Select, Pagination } from "@budibase/bbui" import { Layout, Table, Select, Pagination, Link } from "@budibase/bbui"
import DateTimeRenderer from "components/common/renderers/DateTimeRenderer.svelte" import DateTimeRenderer from "components/common/renderers/DateTimeRenderer.svelte"
import StatusRenderer from "./StatusRenderer.svelte" import StatusRenderer from "./StatusRenderer.svelte"
import HistoryDetailsPanel from "./HistoryDetailsPanel.svelte" import HistoryDetailsPanel from "./HistoryDetailsPanel.svelte"
@ -7,12 +7,17 @@
import { createPaginationStore } from "helpers/pagination" import { createPaginationStore } from "helpers/pagination"
import { onMount } from "svelte" import { onMount } from "svelte"
import dayjs from "dayjs" import dayjs from "dayjs"
import { auth, admin } from "stores/portal"
const ERROR = "error", const ERROR = "error",
SUCCESS = "success", SUCCESS = "success",
STOPPED = "stopped" STOPPED = "stopped"
export let app export let app
$: licensePlan = $auth.user?.license?.plan
$: console.log($auth.user?.license)
$: upgradeUrl = `${$admin.accountPortalUrl}/portal/upgrade`
let pageInfo = createPaginationStore() let pageInfo = createPaginationStore()
let runHistory = null let runHistory = null
let showPanel = false let showPanel = false
@ -33,6 +38,20 @@
{ value: "5-m", label: "Past 5 mins" }, { value: "5-m", label: "Past 5 mins" },
] ]
$: allowedTimeOptions = timeOptions.filter(option => {
option.value === "1-d" && licensePlan.type === "free"
})
$: console.log(allowedTimeOptions)
$: parsedOptions = timeOptions.reduce((acc, ele) => {
if (ele.value !== "1-d" && licensePlan.type === "free") {
ele = { ...ele, disabled: true }
}
acc.push(ele)
return acc
}, [])
$: console.log(parsedOptions)
const statusOptions = [ const statusOptions = [
{ value: SUCCESS, label: "Success" }, { value: SUCCESS, label: "Success" },
{ value: ERROR, label: "Error" }, { value: ERROR, label: "Error" },
@ -121,6 +140,12 @@
<div class="root" class:panelOpen={showPanel}> <div class="root" class:panelOpen={showPanel}>
<Layout paddingX="XL" gap="S" alignContent="start"> <Layout paddingX="XL" gap="S" alignContent="start">
<div class="search"> <div class="search">
{#if licensePlan.type === "free"}
<div>
Upgrade your budibase installation to unlock additional features.
<Link size="L" href={upgradeUrl}>Pro</Link>
</div>
{/if}
<div class="select"> <div class="select">
<Select <Select
placeholder="All automations" placeholder="All automations"
@ -131,10 +156,10 @@
</div> </div>
<div class="select"> <div class="select">
<Select <Select
placeholder="Past 30 days" placeholder={allowedTimeOptions[0]?.label}
label="Date range" label="Date range"
bind:value={timeRange} bind:value={timeRange}
options={timeOptions} options={parsedOptions}
/> />
</div> </div>
<div class="select"> <div class="select">