Minor update to select logic and removed the sample pro badge behaviour
This commit is contained in:
parent
776160df7f
commit
7407b5ee45
|
@ -8,7 +8,6 @@
|
|||
import Search from "./Search.svelte"
|
||||
import Icon from "../../Icon/Icon.svelte"
|
||||
import StatusLight from "../../StatusLight/StatusLight.svelte"
|
||||
import Badge from "../../Badge/Badge.svelte"
|
||||
|
||||
export let id = null
|
||||
export let disabled = false
|
||||
|
@ -21,7 +20,6 @@
|
|||
export let options = []
|
||||
export let isOptionSelected = () => false
|
||||
export let isOptionEnabled = () => true
|
||||
export let getBadgeLabel = () => ""
|
||||
export let onSelectOption = () => {}
|
||||
export let getOptionLabel = option => option
|
||||
export let getOptionValue = option => option
|
||||
|
@ -179,11 +177,6 @@
|
|||
<StatusLight square color={getOptionColour(option, idx)} />
|
||||
</span>
|
||||
{/if}
|
||||
{#if getBadgeLabel(option)}
|
||||
<span class="badge-pro">
|
||||
<Badge grey quiet size="S">{getBadgeLabel(option)}</Badge>
|
||||
</span>
|
||||
{/if}
|
||||
<span class="spectrum-Menu-itemLabel">
|
||||
{getOptionLabel(option, idx)}
|
||||
</span>
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
export let getOptionIcon = () => null
|
||||
export let getOptionColour = () => null
|
||||
export let isOptionEnabled
|
||||
export let getBadgeLabel
|
||||
export let readonly = false
|
||||
export let quiet = false
|
||||
export let autoWidth = false
|
||||
|
@ -69,7 +68,6 @@
|
|||
{getOptionIcon}
|
||||
{getOptionColour}
|
||||
{isOptionEnabled}
|
||||
{getBadgeLabel}
|
||||
{autocomplete}
|
||||
{sort}
|
||||
isPlaceholder={value == null || value === ""}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
export let getOptionIcon = option => option?.icon
|
||||
export let getOptionColour = option => option?.colour
|
||||
export let isOptionEnabled
|
||||
export let getBadgeLabel
|
||||
export let quiet = false
|
||||
export let autoWidth = false
|
||||
export let sort = false
|
||||
|
@ -52,7 +51,6 @@
|
|||
{getOptionIcon}
|
||||
{getOptionColour}
|
||||
{isOptionEnabled}
|
||||
{getBadgeLabel}
|
||||
on:change={onChange}
|
||||
on:click
|
||||
/>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
STOPPED = "stopped"
|
||||
export let app
|
||||
|
||||
let licensePlan = $auth.user?.license?.plan
|
||||
$: licensePlan = $auth.user?.license?.plan
|
||||
$: upgradeUrl = `${$admin.accountPortalUrl}/portal/upgrade`
|
||||
|
||||
let pageInfo = createPaginationStore()
|
||||
|
@ -28,6 +28,7 @@
|
|||
|
||||
$: page = $pageInfo.page
|
||||
$: fetchLogs(automationId, status, page, timeRange)
|
||||
$: cloudHosted = !$admin.cloud
|
||||
|
||||
const timeOptions = [
|
||||
{ value: "1-w", label: "Past week" },
|
||||
|
@ -37,18 +38,14 @@
|
|||
{ value: "5-m", label: "Past 5 mins" },
|
||||
]
|
||||
|
||||
const allowedFilters = ["1-d", "1-h", "15-m", "5-m"]
|
||||
|
||||
let parsedOptions = timeOptions.filter(ele => {
|
||||
return allowedFilters.indexOf(ele.value) >= 0
|
||||
$: parsedOptions = timeOptions.filter(ele => {
|
||||
return !cloudHosted || (licensePlan?.type === "free" && "1-w" !== ele.value)
|
||||
})
|
||||
|
||||
if (parsedOptions.length && timeRange === null) {
|
||||
$: if (parsedOptions.length && timeRange === null) {
|
||||
timeRange = parsedOptions[0].value
|
||||
}
|
||||
|
||||
$: console.log("parsed options", parsedOptions)
|
||||
|
||||
const statusOptions = [
|
||||
{ value: SUCCESS, label: "Success" },
|
||||
{ value: ERROR, label: "Error" },
|
||||
|
@ -135,23 +132,6 @@
|
|||
</script>
|
||||
|
||||
<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">
|
||||
<div class="search">
|
||||
<div class="select">
|
||||
|
@ -169,22 +149,11 @@
|
|||
bind:value={timeRange}
|
||||
options={timeOptions}
|
||||
isOptionEnabled={x => {
|
||||
if (licensePlan?.type === "free") {
|
||||
return allowedFilters.indexOf(x.value) >= 0
|
||||
if (cloudHosted) {
|
||||
return licensePlan?.type === "free" && "1-w" !== x.value
|
||||
}
|
||||
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 class="select">
|
||||
|
|
Loading…
Reference in New Issue