Minor update to select logic and removed the sample pro badge behaviour
This commit is contained in:
parent
fe4314e168
commit
a134fa41ee
|
@ -8,7 +8,6 @@
|
||||||
import Search from "./Search.svelte"
|
import Search from "./Search.svelte"
|
||||||
import Icon from "../../Icon/Icon.svelte"
|
import Icon from "../../Icon/Icon.svelte"
|
||||||
import StatusLight from "../../StatusLight/StatusLight.svelte"
|
import StatusLight from "../../StatusLight/StatusLight.svelte"
|
||||||
import Badge from "../../Badge/Badge.svelte"
|
|
||||||
|
|
||||||
export let id = null
|
export let id = null
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
|
@ -21,7 +20,6 @@
|
||||||
export let options = []
|
export let options = []
|
||||||
export let isOptionSelected = () => false
|
export let isOptionSelected = () => false
|
||||||
export let isOptionEnabled = () => true
|
export let isOptionEnabled = () => true
|
||||||
export let getBadgeLabel = () => ""
|
|
||||||
export let onSelectOption = () => {}
|
export let onSelectOption = () => {}
|
||||||
export let getOptionLabel = option => option
|
export let getOptionLabel = option => option
|
||||||
export let getOptionValue = option => option
|
export let getOptionValue = option => option
|
||||||
|
@ -179,11 +177,6 @@
|
||||||
<StatusLight square color={getOptionColour(option, idx)} />
|
<StatusLight square color={getOptionColour(option, idx)} />
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
{#if getBadgeLabel(option)}
|
|
||||||
<span class="badge-pro">
|
|
||||||
<Badge grey quiet size="S">{getBadgeLabel(option)}</Badge>
|
|
||||||
</span>
|
|
||||||
{/if}
|
|
||||||
<span class="spectrum-Menu-itemLabel">
|
<span class="spectrum-Menu-itemLabel">
|
||||||
{getOptionLabel(option, idx)}
|
{getOptionLabel(option, idx)}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
export let getOptionIcon = () => null
|
export let getOptionIcon = () => null
|
||||||
export let getOptionColour = () => null
|
export let getOptionColour = () => null
|
||||||
export let isOptionEnabled
|
export let isOptionEnabled
|
||||||
export let getBadgeLabel
|
|
||||||
export let readonly = false
|
export let readonly = false
|
||||||
export let quiet = false
|
export let quiet = false
|
||||||
export let autoWidth = false
|
export let autoWidth = false
|
||||||
|
@ -69,7 +68,6 @@
|
||||||
{getOptionIcon}
|
{getOptionIcon}
|
||||||
{getOptionColour}
|
{getOptionColour}
|
||||||
{isOptionEnabled}
|
{isOptionEnabled}
|
||||||
{getBadgeLabel}
|
|
||||||
{autocomplete}
|
{autocomplete}
|
||||||
{sort}
|
{sort}
|
||||||
isPlaceholder={value == null || value === ""}
|
isPlaceholder={value == null || value === ""}
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
export let getOptionIcon = option => option?.icon
|
export let getOptionIcon = option => option?.icon
|
||||||
export let getOptionColour = option => option?.colour
|
export let getOptionColour = option => option?.colour
|
||||||
export let isOptionEnabled
|
export let isOptionEnabled
|
||||||
export let getBadgeLabel
|
|
||||||
export let quiet = false
|
export let quiet = false
|
||||||
export let autoWidth = false
|
export let autoWidth = false
|
||||||
export let sort = false
|
export let sort = false
|
||||||
|
@ -52,7 +51,6 @@
|
||||||
{getOptionIcon}
|
{getOptionIcon}
|
||||||
{getOptionColour}
|
{getOptionColour}
|
||||||
{isOptionEnabled}
|
{isOptionEnabled}
|
||||||
{getBadgeLabel}
|
|
||||||
on:change={onChange}
|
on:change={onChange}
|
||||||
on:click
|
on:click
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
STOPPED = "stopped"
|
STOPPED = "stopped"
|
||||||
export let app
|
export let app
|
||||||
|
|
||||||
let licensePlan = $auth.user?.license?.plan
|
$: licensePlan = $auth.user?.license?.plan
|
||||||
$: upgradeUrl = `${$admin.accountPortalUrl}/portal/upgrade`
|
$: upgradeUrl = `${$admin.accountPortalUrl}/portal/upgrade`
|
||||||
|
|
||||||
let pageInfo = createPaginationStore()
|
let pageInfo = createPaginationStore()
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
$: page = $pageInfo.page
|
$: page = $pageInfo.page
|
||||||
$: fetchLogs(automationId, status, page, timeRange)
|
$: fetchLogs(automationId, status, page, timeRange)
|
||||||
|
$: cloudHosted = !$admin.cloud
|
||||||
|
|
||||||
const timeOptions = [
|
const timeOptions = [
|
||||||
{ value: "1-w", label: "Past week" },
|
{ value: "1-w", label: "Past week" },
|
||||||
|
@ -37,18 +38,14 @@
|
||||||
{ value: "5-m", label: "Past 5 mins" },
|
{ value: "5-m", label: "Past 5 mins" },
|
||||||
]
|
]
|
||||||
|
|
||||||
const allowedFilters = ["1-d", "1-h", "15-m", "5-m"]
|
$: parsedOptions = timeOptions.filter(ele => {
|
||||||
|
return !cloudHosted || (licensePlan?.type === "free" && "1-w" !== ele.value)
|
||||||
let parsedOptions = timeOptions.filter(ele => {
|
|
||||||
return allowedFilters.indexOf(ele.value) >= 0
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if (parsedOptions.length && timeRange === null) {
|
$: if (parsedOptions.length && timeRange === null) {
|
||||||
timeRange = parsedOptions[0].value
|
timeRange = parsedOptions[0].value
|
||||||
}
|
}
|
||||||
|
|
||||||
$: console.log("parsed options", parsedOptions)
|
|
||||||
|
|
||||||
const statusOptions = [
|
const statusOptions = [
|
||||||
{ value: SUCCESS, label: "Success" },
|
{ value: SUCCESS, label: "Success" },
|
||||||
{ value: ERROR, label: "Error" },
|
{ value: ERROR, label: "Error" },
|
||||||
|
@ -135,23 +132,6 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="root" class:panelOpen={showPanel}>
|
<div class="root" class:panelOpen={showPanel}>
|
||||||
<!-- {#if licensePlan?.type === "free"}
|
|
||||||
<Layout noPadding>
|
|
||||||
<div class="pro-banner">
|
|
||||||
<Banner
|
|
||||||
type="info"
|
|
||||||
showCloseButton={false}
|
|
||||||
extraButtonText={"Check it out!"}
|
|
||||||
extraButtonAction={() => {
|
|
||||||
window.open(upgradeUrl)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
24 hrs of logs currently available. Upgrade your budibase installation
|
|
||||||
to unlock additional features.
|
|
||||||
</Banner>
|
|
||||||
</div>
|
|
||||||
</Layout>
|
|
||||||
{/if} -->
|
|
||||||
<Layout noPadding gap="M" alignContent="start">
|
<Layout noPadding gap="M" alignContent="start">
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<div class="select">
|
<div class="select">
|
||||||
|
@ -169,22 +149,11 @@
|
||||||
bind:value={timeRange}
|
bind:value={timeRange}
|
||||||
options={timeOptions}
|
options={timeOptions}
|
||||||
isOptionEnabled={x => {
|
isOptionEnabled={x => {
|
||||||
if (licensePlan?.type === "free") {
|
if (cloudHosted) {
|
||||||
return allowedFilters.indexOf(x.value) >= 0
|
return licensePlan?.type === "free" && "1-w" !== x.value
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}}
|
}}
|
||||||
getBadgeLabel={x => {
|
|
||||||
console.log("Running label change", licensePlan)
|
|
||||||
if (
|
|
||||||
licensePlan?.type === "free" &&
|
|
||||||
allowedFilters.indexOf(x.value) < 0
|
|
||||||
) {
|
|
||||||
return "Pro"
|
|
||||||
} else {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="select">
|
<div class="select">
|
||||||
|
|
Loading…
Reference in New Issue