Refactor based on feedback
This commit is contained in:
parent
9a6a1abb84
commit
7456596c7a
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
const RemoveID = "remove"
|
const RemoveID = "remove"
|
||||||
const subType = $licensing.license.plan.type
|
const subType = $licensing.license.plan.type ?? null
|
||||||
|
|
||||||
$: enrichLabel = label => (labelPrefix ? `${labelPrefix} ${label}` : label)
|
$: enrichLabel = label => (labelPrefix ? `${labelPrefix} ${label}` : label)
|
||||||
$: options = getOptions(
|
$: options = getOptions(
|
||||||
|
@ -69,19 +69,13 @@
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// Add creator if required
|
// Add creator if required
|
||||||
if (
|
if (allowCreator || isEnterprisePlan(subType)) {
|
||||||
allowCreator ||
|
|
||||||
subType === Constants.PlanType.ENTERPRISE ||
|
|
||||||
subType === Constants.PlanType.ENTERPRISE_BASIC
|
|
||||||
) {
|
|
||||||
options.unshift({
|
options.unshift({
|
||||||
_id: Constants.Roles.CREATOR,
|
_id: Constants.Roles.CREATOR,
|
||||||
name: "Can edit",
|
name: "Can edit",
|
||||||
tag:
|
tag: isEnterprisePlan(subType)
|
||||||
subType === Constants.PlanType.ENTERPRISE ||
|
? null
|
||||||
subType === Constants.PlanType.ENTERPRISE_BASIC
|
: capitalise(Constants.PlanType.ENTERPRISE),
|
||||||
? null
|
|
||||||
: capitalise(Constants.PlanType.ENTERPRISE),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,6 +118,14 @@
|
||||||
dispatch("change", e.detail)
|
dispatch("change", e.detail)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isEnterprisePlan(subType) {
|
||||||
|
return (
|
||||||
|
subType === Constants.PlanType.ENTERPRISE ||
|
||||||
|
subType === Constants.PlanType.ENTERPRISE_BASIC ||
|
||||||
|
subType === Constants.PlanType.ENTERPRISE_BASIC_trial
|
||||||
|
)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if fancySelect}
|
{#if fancySelect}
|
||||||
|
@ -143,11 +145,7 @@
|
||||||
getOptionIcon={getIcon}
|
getOptionIcon={getIcon}
|
||||||
isOptionEnabled={option => {
|
isOptionEnabled={option => {
|
||||||
if (option._id === Constants.Roles.CREATOR) {
|
if (option._id === Constants.Roles.CREATOR) {
|
||||||
return (
|
return isEnterprisePlan(subType)
|
||||||
subType === Constants.PlanType.ENTERPRISE ||
|
|
||||||
(subType === Constants.PlanType.ENTERPRISE_BASIC_TRIAL &&
|
|
||||||
$licensing.perAppBuildersEnabled)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}}
|
}}
|
||||||
|
@ -170,11 +168,7 @@
|
||||||
getOptionIcon={getIcon}
|
getOptionIcon={getIcon}
|
||||||
isOptionEnabled={option => {
|
isOptionEnabled={option => {
|
||||||
if (option._id === Constants.Roles.CREATOR) {
|
if (option._id === Constants.Roles.CREATOR) {
|
||||||
return (
|
return isEnterprisePlan(subType)
|
||||||
subType === Constants.PlanType.ENTERPRISE ||
|
|
||||||
(subType === Constants.PlanType.ENTERPRISE_BASIC_TRIAL &&
|
|
||||||
$licensing.perAppBuildersEnabled)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
return option.enabled !== false
|
return option.enabled !== false
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Reference in New Issue