Hook up flags to the custom prop filter

This commit is contained in:
Uku Taht 2022-04-21 16:43:16 +03:00
parent c7742ec179
commit 428ee747c3
3 changed files with 11 additions and 6 deletions

View File

@ -127,7 +127,9 @@ function DropdownContent({history, site, query, wrapped}) {
const [addingFilter, setAddingFilter] = useState(false);
if (wrapped === 0 || addingFilter) {
return Object.keys(FILTER_GROUPS).map((option) => filterDropdownOption(site, option))
return Object.keys(FILTER_GROUPS)
.filter((option) => option === 'props' ? site.flags.custom_dimension_filter : true)
.map((option) => filterDropdownOption(site, option))
}
return (

View File

@ -16,7 +16,8 @@ if (container) {
statsBegin: container.dataset.statsBegin,
embedded: container.dataset.embedded,
background: container.dataset.background,
selfhosted: container.dataset.selfhosted === 'true'
selfhosted: container.dataset.selfhosted === 'true',
flags: JSON.parse(container.dataset.flags)
}
const loggedIn = container.dataset.loggedIn === 'true'

View File

@ -41,9 +41,11 @@ defmodule PlausibleWeb.Router do
plug PlausibleWeb.Firewall
end
pipeline :mounted_apps do
pipeline :flags do
plug :accepts, ["html"]
plug :put_secure_browser_headers
plug :fetch_session
plug PlausibleWeb.CRMAuthPlug
end
if Mix.env() == :dev do
@ -52,9 +54,9 @@ defmodule PlausibleWeb.Router do
use Kaffy.Routes, scope: "/crm", pipe_through: [PlausibleWeb.CRMAuthPlug]
scope path: "/feature-flags" do
pipe_through :mounted_apps
forward "/", FunWithFlags.UI.Router, namespace: "feature-flags"
scope path: "/flags" do
pipe_through :flags
forward "/", FunWithFlags.UI.Router, namespace: "flags"
end
scope "/api/stats", PlausibleWeb.Api do