Merge pull request #8014 from Budibase/feature/automation-log-filter-by-license
Feature/automation log filter by license
This commit is contained in:
commit
cf8b5be13e
|
@ -19,6 +19,7 @@
|
||||||
export let placeholderOption = null
|
export let placeholderOption = null
|
||||||
export let options = []
|
export let options = []
|
||||||
export let isOptionSelected = () => false
|
export let isOptionSelected = () => false
|
||||||
|
export let isOptionEnabled = () => true
|
||||||
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
|
||||||
|
@ -164,6 +165,7 @@
|
||||||
aria-selected="true"
|
aria-selected="true"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
on:click={() => onSelectOption(getOptionValue(option, idx))}
|
on:click={() => onSelectOption(getOptionValue(option, idx))}
|
||||||
|
class:is-disabled={!isOptionEnabled(option)}
|
||||||
>
|
>
|
||||||
{#if getOptionIcon(option, idx)}
|
{#if getOptionIcon(option, idx)}
|
||||||
<span class="option-extra">
|
<span class="option-extra">
|
||||||
|
@ -256,4 +258,7 @@
|
||||||
.spectrum-Popover :global(.spectrum-Search .spectrum-Textfield-icon) {
|
.spectrum-Popover :global(.spectrum-Search .spectrum-Textfield-icon) {
|
||||||
top: 9px;
|
top: 9px;
|
||||||
}
|
}
|
||||||
|
.spectrum-Menu-item.is-disabled {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
export let getOptionValue = option => option
|
export let getOptionValue = option => option
|
||||||
export let getOptionIcon = () => null
|
export let getOptionIcon = () => null
|
||||||
export let getOptionColour = () => null
|
export let getOptionColour = () => null
|
||||||
|
export let isOptionEnabled
|
||||||
export let readonly = false
|
export let readonly = false
|
||||||
export let quiet = false
|
export let quiet = false
|
||||||
export let autoWidth = false
|
export let autoWidth = false
|
||||||
|
@ -66,6 +67,7 @@
|
||||||
{getOptionValue}
|
{getOptionValue}
|
||||||
{getOptionIcon}
|
{getOptionIcon}
|
||||||
{getOptionColour}
|
{getOptionColour}
|
||||||
|
{isOptionEnabled}
|
||||||
{autocomplete}
|
{autocomplete}
|
||||||
{sort}
|
{sort}
|
||||||
isPlaceholder={value == null || value === ""}
|
isPlaceholder={value == null || value === ""}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
export let getOptionValue = option => extractProperty(option, "value")
|
export let getOptionValue = option => extractProperty(option, "value")
|
||||||
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 quiet = false
|
export let quiet = false
|
||||||
export let autoWidth = false
|
export let autoWidth = false
|
||||||
export let sort = false
|
export let sort = false
|
||||||
|
@ -49,6 +50,7 @@
|
||||||
{getOptionValue}
|
{getOptionValue}
|
||||||
{getOptionIcon}
|
{getOptionIcon}
|
||||||
{getOptionColour}
|
{getOptionColour}
|
||||||
|
{isOptionEnabled}
|
||||||
on:change={onChange}
|
on:change={onChange}
|
||||||
on:click
|
on:click
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { Layout, Table, Select, Pagination } from "@budibase/bbui"
|
import { Layout, Table, Select, Pagination, Button } 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,16 @@
|
||||||
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, licensing, admin } from "stores/portal"
|
||||||
|
import { Constants } from "@budibase/frontend-core"
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
let pageInfo = createPaginationStore()
|
let pageInfo = createPaginationStore()
|
||||||
let runHistory = null
|
let runHistory = null
|
||||||
let showPanel = false
|
let showPanel = false
|
||||||
|
@ -26,6 +30,8 @@
|
||||||
$: fetchLogs(automationId, status, page, timeRange)
|
$: fetchLogs(automationId, status, page, timeRange)
|
||||||
|
|
||||||
const timeOptions = [
|
const timeOptions = [
|
||||||
|
{ value: "90-d", label: "Past 90 days" },
|
||||||
|
{ value: "30-d", label: "Past 30 days" },
|
||||||
{ value: "1-w", label: "Past week" },
|
{ value: "1-w", label: "Past week" },
|
||||||
{ value: "1-d", label: "Past day" },
|
{ value: "1-d", label: "Past day" },
|
||||||
{ value: "1-h", label: "Past 1 hour" },
|
{ value: "1-h", label: "Past 1 hour" },
|
||||||
|
@ -131,10 +137,20 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="select">
|
<div class="select">
|
||||||
<Select
|
<Select
|
||||||
placeholder="Past 30 days"
|
placeholder="All"
|
||||||
label="Date range"
|
label="Date range"
|
||||||
bind:value={timeRange}
|
bind:value={timeRange}
|
||||||
options={timeOptions}
|
options={timeOptions}
|
||||||
|
isOptionEnabled={x => {
|
||||||
|
if (licensePlan?.type === Constants.PlanType.FREE) {
|
||||||
|
return ["1-w", "30-d", "90-d"].indexOf(x.value) < 0
|
||||||
|
} else if (licensePlan?.type === Constants.PlanType.TEAM) {
|
||||||
|
return ["90-d"].indexOf(x.value) < 0
|
||||||
|
} else if (licensePlan?.type === Constants.PlanType.PRO) {
|
||||||
|
return ["30-d", "90-d"].indexOf(x.value) < 0
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="select">
|
<div class="select">
|
||||||
|
@ -145,6 +161,14 @@
|
||||||
options={statusOptions}
|
options={statusOptions}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{#if (licensePlan?.type !== Constants.PlanType.ENTERPRISE && $auth.user.accountPortalAccess) || !$admin.cloud}
|
||||||
|
<div class="pro-upgrade">
|
||||||
|
<div class="pro-copy">Expand your automation log history</div>
|
||||||
|
<Button primary newStyles on:click={$licensing.goToUpgradePage()}>
|
||||||
|
Upgrade
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if runHistory}
|
{#if runHistory}
|
||||||
<div>
|
<div>
|
||||||
|
@ -221,4 +245,15 @@
|
||||||
.panelOpen {
|
.panelOpen {
|
||||||
grid-template-columns: auto 420px;
|
grid-template-columns: auto 420px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pro-upgrade {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pro-copy {
|
||||||
|
margin-right: var(--spacing-l);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -58,13 +58,6 @@ export const DefaultAppTheme = {
|
||||||
navTextColor: "var(--spectrum-global-color-gray-800)",
|
navTextColor: "var(--spectrum-global-color-gray-800)",
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PlanType = {
|
|
||||||
FREE: "free",
|
|
||||||
PRO: "pro",
|
|
||||||
BUSINESS: "business",
|
|
||||||
ENTERPRISE: "enterprise",
|
|
||||||
}
|
|
||||||
|
|
||||||
export const PluginSource = {
|
export const PluginSource = {
|
||||||
URL: "URL",
|
URL: "URL",
|
||||||
NPM: "NPM",
|
NPM: "NPM",
|
||||||
|
|
|
@ -91,6 +91,7 @@
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{"is adming" + $auth.isAdmin}
|
||||||
{#if $auth.isAdmin}
|
{#if $auth.isAdmin}
|
||||||
<DeleteLicenseKeyModal
|
<DeleteLicenseKeyModal
|
||||||
bind:this={deleteLicenseKeyModal}
|
bind:this={deleteLicenseKeyModal}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import { admin, auth, licensing } from "../../../../stores/portal"
|
import { admin, auth, licensing } from "../../../../stores/portal"
|
||||||
import { PlanType } from "../../../../constants"
|
import { Constants } from "@budibase/frontend-core"
|
||||||
import { DashCard, Usage } from "../../../../components/usage"
|
import { DashCard, Usage } from "../../../../components/usage"
|
||||||
|
|
||||||
let staticUsage = []
|
let staticUsage = []
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const goToAccountPortal = () => {
|
const goToAccountPortal = () => {
|
||||||
if (license?.plan.type === PlanType.FREE) {
|
if (license?.plan.type === Constants.PlanType.FREE) {
|
||||||
window.location.href = upgradeUrl
|
window.location.href = upgradeUrl
|
||||||
} else {
|
} else {
|
||||||
window.location.href = manageUrl
|
window.location.href = manageUrl
|
||||||
|
@ -133,7 +133,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const setPrimaryActionText = () => {
|
const setPrimaryActionText = () => {
|
||||||
if (license?.plan.type === PlanType.FREE) {
|
if (license?.plan.type === Constants.PlanType.FREE) {
|
||||||
primaryActionText = "Upgrade"
|
primaryActionText = "Upgrade"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
export const PlanType = {
|
|
||||||
FREE: "free",
|
|
||||||
PRO: "pro",
|
|
||||||
TEAM: "team",
|
|
||||||
BUSINESS: "business",
|
|
||||||
ENTERPRISE: "enterprise",
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { authStore } from "../stores/auth.js"
|
import { authStore } from "../stores/auth.js"
|
||||||
import { get } from "svelte/store"
|
import { get } from "svelte/store"
|
||||||
import { PlanType } from "./constants"
|
import { Constants } from "@budibase/frontend-core"
|
||||||
|
|
||||||
const getLicense = () => {
|
const getLicense = () => {
|
||||||
const user = get(authStore)
|
const user = get(authStore)
|
||||||
|
@ -12,7 +12,7 @@ const getLicense = () => {
|
||||||
export const isFreePlan = () => {
|
export const isFreePlan = () => {
|
||||||
const license = getLicense()
|
const license = getLicense()
|
||||||
if (license) {
|
if (license) {
|
||||||
return license.plan.type === PlanType.FREE
|
return license.plan.type === Constants.PlanType.FREE
|
||||||
} else {
|
} else {
|
||||||
// safety net - no license means free plan
|
// safety net - no license means free plan
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -98,6 +98,7 @@ export const BuilderRoleDescriptions = [
|
||||||
export const PlanType = {
|
export const PlanType = {
|
||||||
FREE: "free",
|
FREE: "free",
|
||||||
TEAM: "team",
|
TEAM: "team",
|
||||||
|
PRO: "pro",
|
||||||
BUSINESS: "business",
|
BUSINESS: "business",
|
||||||
ENTERPRISE: "enterprise",
|
ENTERPRISE: "enterprise",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue