Feature flags (#543)

* Re-organize a bit controllers

* Added the featureflagcontroller

* Implement feature flags in the front-end

* Clean env files

* Clean console.log messages

* Fix feature flag test
This commit is contained in:
Julien Nahum
2024-08-27 16:49:43 +02:00
committed by GitHub
parent 1dffd27390
commit 79d3dd7888
40 changed files with 304 additions and 147 deletions

View File

@@ -21,21 +21,21 @@
</div>
<div class="flex justify-center mt-5 md:mt-0">
<div class="grid grid-cols-1 lg:grid-cols-2 gap-x-4 gap-y-2">
<router-link
v-if="!appStore.selfHosted"
:to="{ name: 'privacy-policy' }"
class="text-gray-600 dark:text-gray-400 transition-colors duration-300 hover:text-nt-blue"
>
Privacy Policy
</router-link>
<template v-if="!useFeatureFlag('self_hosted')">
<router-link
:to="{ name: 'privacy-policy' }"
class="text-gray-600 dark:text-gray-400 transition-colors duration-300 hover:text-nt-blue"
>
Privacy Policy
</router-link>
<router-link
v-if="!appStore.selfHosted"
:to="{ name: 'terms-conditions' }"
class="text-gray-600 dark:text-gray-400 transition-colors duration-300 hover:text-nt-blue"
>
Terms & Conditions
</router-link>
<router-link
:to="{ name: 'terms-conditions' }"
class="text-gray-600 dark:text-gray-400 transition-colors duration-300 hover:text-nt-blue"
>
Terms & Conditions
</router-link>
</template>
<a
:href="opnformConfig.links.feature_requests"
target="_blank"

View File

@@ -59,6 +59,7 @@
</v-button>
<v-button
v-if="useFeatureFlag('services.google.auth')"
native-type="button"
color="white"
class="space-x-4 mt-4 flex items-center w-full"
@@ -72,7 +73,7 @@
<span class="mx-2">Sign in with Google</span>
</v-button>
<p
v-if="!appStore.selfHosted"
v-if="!useFeatureFlag('self_hosted')"
class="text-gray-500 text-sm text-center mt-4"
>
Don't have an account?

View File

@@ -87,19 +87,21 @@
Create account
</v-button>
<p class="text-gray-600/50 text-sm text-center my-4">
Or
</p>
<v-button
native-type="buttom"
color="white"
class="space-x-4 flex items-center w-full"
:loading="false"
@click.prevent="signInwithGoogle"
>
<Icon name="devicon:google" />
<span class="mx-2">Sign in with Google</span>
</v-button>
<template v-if="useFeatureFlag('services.google.auth')">
<p class="text-gray-600/50 text-sm text-center my-4">
Or
</p>
<v-button
native-type="buttom"
color="white"
class="space-x-4 flex items-center w-full"
:loading="false"
@click.prevent="signInwithGoogle"
>
<Icon name="devicon:google" />
<span class="mx-2">Sign in with Google</span>
</v-button>
</template>
<p class="text-gray-500 mt-4 text-sm text-center">
Already have an account?

View File

@@ -72,7 +72,7 @@
</p>
</div>
<div
v-if="aiFeaturesEnabled"
v-if="useFeatureFlag('ai_features')"
v-track.select_form_base="{ base: 'ai' }"
class="rounded-md border p-4 flex flex-col items-center cursor-pointer hover:bg-gray-50"
role="button"
@@ -185,12 +185,6 @@ export default {
loading: false,
}),
computed: {
aiFeaturesEnabled() {
return this.runtimeConfig.public.aiFeaturesEnabled
},
},
methods: {
generateForm() {
if (this.loading) return

View File

@@ -1,6 +1,6 @@
<template>
<div
v-if="customDomainsEnabled"
v-if="useFeatureFlag('custom_domains')"
id="custom-domains"
>
<UButton
@@ -82,10 +82,6 @@ const customDomainsForm = useForm({
const customDomainsLoading = ref(false)
const showCustomDomainModal = ref(false)
const customDomainsEnabled = computed(
() => useRuntimeConfig().public.customDomainsEnabled,
)
onMounted(() => {
initCustomDomains()
})

View File

@@ -202,7 +202,7 @@ const showEditUserModal = ref(false)
const selectedUser = ref(null)
const userNewRole = ref("")
const paidPlansEnabled = computed(() => useRuntimeConfig().public.paidPlansEnabled)
const paidPlansEnabled = ref(useFeatureFlag('billing.enabled'))
const canInviteUser = computed(() => {
return paidPlansEnabled.value ? workspace.value.is_pro : true
})