Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(devex): use the projects api path in shared frontend code (#104352)

Julian Beza98863833a60
diff --git a/.semgrep/rules/devex/no-environments-api-urls-frontend.yaml b/.semgrep/rules/devex/no-environments-api-urls-frontend.yaml
index 747662577128..647438443009 100644
--- a/.semgrep/rules/devex/no-environments-api-urls-frontend.yaml
+++ b/.semgrep/rules/devex/no-environments-api-urls-frontend.yaml
@@ -50,19 +50,6 @@ rules:
# Each file below still constructs hand-coded `/api/environments/`
# or `api/environments/` URLs. Removing a file from this list
# re-enables the gate for it.
- - '/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelNotificationsLogic.tsx'
- - '/frontend/src/lib/approvals/approvalsGateLogic.ts'
- - '/frontend/src/lib/components/HelpMenu/healthSummaryLogic.tsx'
- - '/frontend/src/lib/components/PropertiesTimeline/propertiesTimelineLogic.ts'
- - '/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsx'
- - '/frontend/src/lib/components/PropertyFilters/components/groupKeySelectLogic.ts'
- - '/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx'
- - '/frontend/src/lib/components/TaxonomicFilter/utils/buildGroupAnalyticsGroups.ts'
- - '/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx'
- - '/frontend/src/lib/logic/eventIngestionRestrictionLogic.ts'
- - '/frontend/src/models/dashboardsModel.tsx'
- - '/frontend/src/models/propertyDefinitionsModel.ts'
- - '/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts'
- '/frontend/src/scenes/approvals/approvalLogic.tsx'
- '/frontend/src/scenes/approvals/approvalsLogic.tsx'
- '/frontend/src/scenes/approvals/changeRequestsLogic.ts'
diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelNotificationsLogic.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelNotificationsLogic.tsx
index 4a15467f9f29..94dfa1dfbcfb 100644
--- a/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelNotificationsLogic.tsx
+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelNotificationsLogic.tsx
@@ -1018,7 +1018,7 @@ export const sidePanelNotificationsLogic = kea<sidePanelNotificationsLogicType>(
refreshInAppUnreadCount: async () => {
try {
const countResp = await api.get<{ count: number }>(
- `api/environments/${values.currentProjectId}/notifications/unread_count/`
+ `api/projects/${values.currentProjectId}/notifications/unread_count/`
)
actions.setInAppUnreadCount(countResp.count)
} catch {
@@ -1328,7 +1328,7 @@ export const sidePanelNotificationsLogic = kea<sidePanelNotificationsLogicType>(
}
try {
const countResp = await api.get<{ count: number }>(
- `api/environments/${values.currentProjectId}/notifications/unread_count/`
+ `api/projects/${values.currentProjectId}/notifications/unread_count/`
)
actions.setInAppUnreadCount(countResp.count)
} catch {
diff --git a/frontend/src/lib/approvals/approvalsGateLogic.ts b/frontend/src/lib/approvals/approvalsGateLogic.ts
index b43dd335f82b..1bb1a9474e7e 100644
--- a/frontend/src/lib/approvals/approvalsGateLogic.ts
+++ b/frontend/src/lib/approvals/approvalsGateLogic.ts
@@ -73,9 +73,7 @@ export const approvalsGateLogic = kea<approvalsGateLogicType>([
}
try {
- const response = await api.get(
- `api/environments/${values.currentTeamIdStrict}/approval_policies/`
- )
+ const response = await api.get(`api/projects/${values.currentTeamIdStrict}/approval_policies/`)
return (response.results || []).filter((p: ApprovalPolicy) => p.enabled)
} catch {
return []
diff --git a/frontend/src/lib/components/HelpMenu/healthSummaryLogic.tsx b/frontend/src/lib/components/HelpMenu/healthSummaryLogic.tsx
index 2d31a7e17507..7f5be48b9511 100644
--- a/frontend/src/lib/components/HelpMenu/healthSummaryLogic.tsx
+++ b/frontend/src/lib/components/HelpMenu/healthSummaryLogic.tsx
@@ -63,7 +63,7 @@ export const healthSummaryLogic = kea<healthSummaryLogicType>([
{
loadHealthSummary: async (): Promise<HealthIssueSummary | null> => {
try {
- return await api.get(`api/environments/${values.currentTeamIdStrict}/health_issues/summary/`)
+ return await api.get(`api/projects/${values.currentTeamIdStrict}/health_issues/summary/`)
} catch {
return null
}
diff --git a/frontend/src/lib/components/PropertiesTimeline/propertiesTimelineLogic.ts b/frontend/src/lib/components/PropertiesTimeline/propertiesTimelineLogic.ts
index 70af806311f9..79f7c789b757 100644
--- a/frontend/src/lib/components/PropertiesTimeline/propertiesTimelineLogic.ts
+++ b/frontend/src/lib/components/PropertiesTimeline/propertiesTimelineLogic.ts
@@ -115,7 +115,7 @@ export const propertiesTimelineLogic = kea<propertiesTimelineLogicType>([
loadResult: async () => {
if (props.actor.type === 'person') {
const response = await api.get<RawPropertiesTimelineResult>(
- `api/environments/${values.currentTeamId}/persons/${
+ `api/projects/${values.currentTeamId}/persons/${
props.actor.id
}/properties_timeline/?${toParams(props.filter)}`
)
diff --git a/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsx b/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsx
index 6a4e1fb43b76..ee1665f292dd 100644
--- a/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsx
+++ b/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsx
@@ -210,7 +210,7 @@ export function TaxonomicPropertyFilter({
filter?.type === PropertyFilterType.DataWarehouse &&
dataWarehouseTableName &&
currentTeamId
- ? `api/environments/${currentTeamId}/data_warehouse/property_values?${toParams({
+ ? `api/projects/${currentTeamId}/data_warehouse/property_values?${toParams({
table_name: dataWarehouseTableName,
key: filter.key,
})}`
diff --git a/frontend/src/lib/components/PropertyFilters/components/groupKeySelectLogic.ts b/frontend/src/lib/components/PropertyFilters/components/groupKeySelectLogic.ts
index 4e9bac558c72..cc16c61e5f35 100644
--- a/frontend/src/lib/components/PropertyFilters/components/groupKeySelectLogic.ts
+++ b/frontend/src/lib/components/PropertyFilters/components/groupKeySelectLogic.ts
@@ -30,7 +30,7 @@ export async function findGroups(
groupKeys.map(async (groupKey) => {
try {
const response: Group = await api.get(
- `api/environments/${teamId}/groups/find/?${new URLSearchParams({
+ `api/projects/${teamId}/groups/find/?${new URLSearchParams({
group_type_index: String(groupTypeIndex),
group_key: groupKey,
// Resolving a display name is read-only; don't lazily
@@ -159,7 +159,7 @@ export const groupKeySelectLogic = kea<groupKeySelectLogicType>([
params.search = search
}
const response = await api.get(
- `api/environments/${values.currentTeamId}/groups/?${new URLSearchParams(
+ `api/projects/${values.currentTeamId}/groups/?${new URLSearchParams(
Object.entries(params).map(([k, v]) => [k, String(v)])
).toString()}`
)
diff --git a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx
index bea003439f41..4b0dfb731be3 100644
--- a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx
@@ -1505,8 +1505,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
),
getName: (option) => option.name,
getValue: (option) => option.value,
- valuesEndpoint: (key) =>
- `api/environments/${projectId}/error_tracking/issues/values?key=` + key,
+ valuesEndpoint: (key) => `api/projects/${projectId}/error_tracking/issues/values?key=` + key,
getPopoverHeader: () => 'Issues',
},
{
@@ -1565,7 +1564,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
},
getValue: (option: PropertyDefinition) => option.id,
valuesEndpoint: (key) => {
- return `api/environments/${projectId}/revenue_analytics/taxonomy/values?key=${encodeURIComponent(
+ return `api/projects/${projectId}/revenue_analytics/taxonomy/values?key=${encodeURIComponent(
key
)}`
},
@@ -1643,13 +1642,13 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
name: 'Log attributes',
searchPlaceholder: 'attributes',
type: TaxonomicFilterGroupType.LogAttributes,
- endpoint: combineUrl(`api/environments/${projectId}/logs/attributes`, {
+ endpoint: combineUrl(`api/projects/${projectId}/logs/attributes`, {
attribute_type: 'log',
search_values: 'true',
...endpointFilters,
}).url,
valuesEndpoint: (key) =>
- combineUrl(`api/environments/${projectId}/logs/values`, {
+ combineUrl(`api/projects/${projectId}/logs/values`, {
attribute_type: 'log',
key: key,
...endpointFilters,
@@ -1662,13 +1661,13 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
name: 'Resource attributes',
searchPlaceholder: 'resources',
type: TaxonomicFilterGroupType.LogResourceAttributes,
- endpoint: combineUrl(`api/environments/${projectId}/logs/attributes`, {
+ endpoint: combineUrl(`api/projects/${projectId}/logs/attributes`, {
attribute_type: 'resource',
search_values: 'true',
...endpointFilters,
}).url,
valuesEndpoint: (key) =>
- combineUrl(`api/environments/${projectId}/logs/values`, {
+ combineUrl(`api/projects/${projectId}/logs/values`, {
attribute_type: 'resource',
key: key,
...endpointFilters,
@@ -1681,11 +1680,11 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
name: 'Metric attributes',
searchPlaceholder: 'attributes',
type: TaxonomicFilterGroupType.MetricAttributes,
- endpoint: combineUrl(`api/environments/${projectId}/metrics/attributes`, {
+ endpoint: combineUrl(`api/projects/${projectId}/metrics/attributes`, {
...endpointFilters,
}).url,
valuesEndpoint: (key) =>
- combineUrl(`api/environments/${projectId}/metrics/attribute_values`, {
+ combineUrl(`api/projects/${projectId}/metrics/attribute_values`, {
key: key,
...endpointFilters,
}).url,
@@ -1707,7 +1706,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
],
valuesEndpoint: (key) =>
key === 'name'
- ? combineUrl(`api/environments/${projectId}/tracing/spans/values`, {
+ ? combineUrl(`api/projects/${projectId}/tracing/spans/values`, {
attribute_type: 'span',
key: key,
...endpointFilters,
@@ -1721,13 +1720,13 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
name: 'Span attributes',
searchPlaceholder: 'span attributes',
type: TaxonomicFilterGroupType.SpanAttributes,
- endpoint: combineUrl(`api/environments/${projectId}/tracing/spans/attributes`, {
+ endpoint: combineUrl(`api/projects/${projectId}/tracing/spans/attributes`, {
attribute_type: 'span_attribute',
search_values: 'true',
...endpointFilters,
}).url,
valuesEndpoint: (key) =>
- combineUrl(`api/environments/${projectId}/tracing/spans/values`, {
+ combineUrl(`api/projects/${projectId}/tracing/spans/values`, {
attribute_type: 'span_attribute',
key: key,
...endpointFilters,
@@ -1740,13 +1739,13 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
name: 'Span resource attributes',
searchPlaceholder: 'span resources',
type: TaxonomicFilterGroupType.SpanResourceAttributes,
- endpoint: combineUrl(`api/environments/${projectId}/tracing/spans/attributes`, {
+ endpoint: combineUrl(`api/projects/${projectId}/tracing/spans/attributes`, {
attribute_type: 'span_resource_attribute',
search_values: 'true',
...endpointFilters,
}).url,
valuesEndpoint: (key) =>
- combineUrl(`api/environments/${projectId}/tracing/spans/values`, {
+ combineUrl(`api/projects/${projectId}/tracing/spans/values`, {
attribute_type: 'span_resource_attribute',
key: key,
...endpointFilters,
@@ -1854,7 +1853,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
name: 'Pageview URLs',
searchPlaceholder: 'pageview URLs',
type: TaxonomicFilterGroupType.PageviewUrls,
- endpoint: `api/environments/${teamId}/events/values/?key=$current_url&event_name=$pageview`,
+ endpoint: `api/projects/${teamId}/events/values/?key=$current_url&event_name=$pageview`,
searchAlias: 'value',
getName: (option: SimpleOption | QuickFilterItem) => option.name,
// The collapsed "URL contains <query>" row is a QuickFilterItem whose
@@ -1870,7 +1869,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
name: 'Pageview events',
searchPlaceholder: 'pageview events',
type: TaxonomicFilterGroupType.PageviewEvents,
- endpoint: `api/environments/${teamId}/events/values/?key=$current_url&event_name=$pageview`,
+ endpoint: `api/projects/${teamId}/events/values/?key=$current_url&event_name=$pageview`,
searchAlias: 'value',
getName: (option: SimpleOption) => option.name,
getValue: (option: SimpleOption) => option.name,
@@ -1885,7 +1884,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
name: 'Screens',
searchPlaceholder: 'screens',
type: TaxonomicFilterGroupType.Screens,
- endpoint: `api/environments/${teamId}/events/values/?key=$screen_name&event_name=$screen`,
+ endpoint: `api/projects/${teamId}/events/values/?key=$screen_name&event_name=$screen`,
searchAlias: 'value',
getName: (option: SimpleOption) => option.name,
getValue: (option: SimpleOption) => option.name,
@@ -1897,7 +1896,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
name: 'Screen events',
searchPlaceholder: 'screen events',
type: TaxonomicFilterGroupType.ScreenEvents,
- endpoint: `api/environments/${teamId}/events/values/?key=$screen_name&event_name=$screen`,
+ endpoint: `api/projects/${teamId}/events/values/?key=$screen_name&event_name=$screen`,
searchAlias: 'value',
getName: (option: SimpleOption) => option.name,
getValue: (option: SimpleOption) => option.name,
@@ -1909,7 +1908,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
name: 'Email addresses',
searchPlaceholder: 'email addresses',
type: TaxonomicFilterGroupType.EmailAddresses,
- endpoint: `api/environments/${teamId}/persons/values/?key=email`,
+ endpoint: `api/projects/${teamId}/persons/values/?key=email`,
searchAlias: 'value',
getName: (option: SimpleOption) => option.name,
getValue: (option: SimpleOption) => option.name,
@@ -1921,7 +1920,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
name: 'Autocapture events',
searchPlaceholder: 'autocapture events',
type: TaxonomicFilterGroupType.AutocaptureEvents,
- endpoint: `api/environments/${teamId}/events/values/?key=$el_text&event_name=$autocapture`,
+ endpoint: `api/projects/${teamId}/events/values/?key=$el_text&event_name=$autocapture`,
searchAlias: 'value',
getName: (option: SimpleOption) => option.name,
getValue: (option: SimpleOption) => option.name,
@@ -1954,7 +1953,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
name: 'Persons',
searchPlaceholder: 'persons',
type: TaxonomicFilterGroupType.Persons,
- endpoint: `api/environments/${teamId}/persons/`,
+ endpoint: `api/projects/${teamId}/persons/`,
getName: (person: PersonType) => person.name || 'Anon user?',
getValue: (person: PersonType) => person.distinct_ids?.[0],
getPopoverHeader: () => `Person`,
@@ -1963,7 +1962,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
name: 'Insights',
searchPlaceholder: 'insights',
type: TaxonomicFilterGroupType.Insights,
- endpoint: combineUrl(`api/environments/${teamId}/insights/`, {
+ endpoint: combineUrl(`api/projects/${teamId}/insights/`, {
saved: true,
}).url,
getName: (insight: InsightModel) => insight.name,
@@ -2048,7 +2047,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
})),
}
: {
- endpoint: `api/environments/${teamId}/sessions/property_definitions`,
+ endpoint: `api/projects/${teamId}/sessions/property_definitions`,
}),
getName: (option: any) => option.name,
getValue: (option) => option.name,
@@ -2121,7 +2120,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
valuesEndpoint: (key) => {
if (key === 'visited_page') {
return (
- `api/environments/${teamId}/events/values/?key=` +
+ `api/projects/${teamId}/events/values/?key=` +
encodeURIComponent('$current_url') +
'&event_name=' +
encodeURIComponent('$pageview')
@@ -2251,7 +2250,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
name: `${capitalizeFirstLetter(aggregationLabel(type.group_type_index).plural)}`,
searchPlaceholder: `${aggregationLabel(type.group_type_index).plural}`,
type: `${TaxonomicFilterGroupType.GroupNamesPrefix}_${type.group_type_index}` as unknown as TaxonomicFilterGroupType,
- endpoint: combineUrl(`api/environments/${teamId}/groups/`, {
+ endpoint: combineUrl(`api/projects/${teamId}/groups/`, {
group_type_index: type.group_type_index,
}).url,
getPopoverHeader: () => `Group Names`,
diff --git a/frontend/src/lib/components/TaxonomicFilter/utils/buildGroupAnalyticsGroups.ts b/frontend/src/lib/components/TaxonomicFilter/utils/buildGroupAnalyticsGroups.ts
index f054d1d5592a..59bf60af2e51 100644
--- a/frontend/src/lib/components/TaxonomicFilter/utils/buildGroupAnalyticsGroups.ts
+++ b/frontend/src/lib/components/TaxonomicFilter/utils/buildGroupAnalyticsGroups.ts
@@ -24,7 +24,7 @@ export function buildGroupAnalyticsTaxonomicGroupNames(
name: capitalizeFirstLetter(aggregationLabel(type.group_type_index).plural),
searchPlaceholder: aggregationLabel(type.group_type_index).plural,
type: `${TaxonomicFilterGroupType.GroupNamesPrefix}_${type.group_type_index}` as unknown as TaxonomicFilterGroupType,
- endpoint: combineUrl(`api/environments/${teamId}/groups/`, {
+ endpoint: combineUrl(`api/projects/${teamId}/groups/`, {
group_type_index: type.group_type_index,
}).url,
getPopoverHeader: () => 'Group Names',
diff --git a/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx b/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx
index bde334a6d14b..bcf6f4e5e3aa 100644
--- a/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx
@@ -492,7 +492,7 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
.filter((o) => !excludedProperties[TaxonomicFilterGroupType.ErrorTrackingIssues]?.includes(o.value)),
getName: (option) => option.name,
getValue: (option) => option.value,
- valuesEndpoint: (key) => `api/environments/${projectId}/error_tracking/issues/values?key=` + key,
+ valuesEndpoint: (key) => `api/projects/${projectId}/error_tracking/issues/values?key=` + key,
getPopoverHeader: () => 'Issues',
},
{
@@ -548,7 +548,7 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
},
getValue: (option: PropertyDefinition) => option.id,
valuesEndpoint: (key) => {
- return `api/environments/${projectId}/revenue_analytics/taxonomy/values?key=${encodeURIComponent(key)}`
+ return `api/projects/${projectId}/revenue_analytics/taxonomy/values?key=${encodeURIComponent(key)}`
},
getPopoverHeader: () => 'Revenue analytics properties',
},
@@ -622,13 +622,13 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
name: 'Log attributes',
searchPlaceholder: 'attributes',
type: TaxonomicFilterGroupType.LogAttributes,
- endpoint: combineUrl(`api/environments/${projectId}/logs/attributes`, {
+ endpoint: combineUrl(`api/projects/${projectId}/logs/attributes`, {
attribute_type: 'log',
search_values: 'true',
...endpointFilters,
}).url,
valuesEndpoint: (key) =>
- combineUrl(`api/environments/${projectId}/logs/values`, {
+ combineUrl(`api/projects/${projectId}/logs/values`, {
attribute_type: 'log',
key: key,
...endpointFilters,
@@ -641,13 +641,13 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
name: 'Resource attributes',
searchPlaceholder: 'resources',
type: TaxonomicFilterGroupType.LogResourceAttributes,
- endpoint: combineUrl(`api/environments/${projectId}/logs/attributes`, {
+ endpoint: combineUrl(`api/projects/${projectId}/logs/attributes`, {
attribute_type: 'resource',
search_values: 'true',
...endpointFilters,
}).url,
valuesEndpoint: (key) =>
- combineUrl(`api/environments/${projectId}/logs/values`, {
+ combineUrl(`api/projects/${projectId}/logs/values`, {
attribute_type: 'resource',
key: key,
...endpointFilters,
@@ -660,11 +660,11 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
name: 'Metric attributes',
searchPlaceholder: 'attributes',
type: TaxonomicFilterGroupType.MetricAttributes,
- endpoint: combineUrl(`api/environments/${projectId}/metrics/attributes`, {
+ endpoint: combineUrl(`api/projects/${projectId}/metrics/attributes`, {
...endpointFilters,
}).url,
valuesEndpoint: (key) =>
- combineUrl(`api/environments/${projectId}/metrics/attribute_values`, {
+ combineUrl(`api/projects/${projectId}/metrics/attribute_values`, {
key: key,
...endpointFilters,
}).url,
@@ -686,7 +686,7 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
],
valuesEndpoint: (key) =>
key === 'name'
- ? combineUrl(`api/environments/${projectId}/tracing/spans/values`, {
+ ? combineUrl(`api/projects/${projectId}/tracing/spans/values`, {
attribute_type: 'span',
key: key,
...endpointFilters,
@@ -700,13 +700,13 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
name: 'Span attributes',
searchPlaceholder: 'span attributes',
type: TaxonomicFilterGroupType.SpanAttributes,
- endpoint: combineUrl(`api/environments/${projectId}/tracing/spans/attributes`, {
+ endpoint: combineUrl(`api/projects/${projectId}/tracing/spans/attributes`, {
attribute_type: 'span_attribute',
search_values: 'true',
...endpointFilters,
}).url,
valuesEndpoint: (key) =>
- combineUrl(`api/environments/${projectId}/tracing/spans/values`, {
+ combineUrl(`api/projects/${projectId}/tracing/spans/values`, {
attribute_type: 'span_attribute',
key: key,
...endpointFilters,
@@ -719,13 +719,13 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
name: 'Span resource attributes',
searchPlaceholder: 'span resources',
type: TaxonomicFilterGroupType.SpanResourceAttributes,
- endpoint: combineUrl(`api/environments/${projectId}/tracing/spans/attributes`, {
+ endpoint: combineUrl(`api/projects/${projectId}/tracing/spans/attributes`, {
attribute_type: 'span_resource_attribute',
search_values: 'true',
...endpointFilters,
}).url,
valuesEndpoint: (key) =>
- combineUrl(`api/environments/${projectId}/tracing/spans/values`, {
+ combineUrl(`api/projects/${projectId}/tracing/spans/values`, {
attribute_type: 'span_resource_attribute',
key: key,
...endpointFilters,
@@ -827,7 +827,7 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
name: 'Pageview URLs',
searchPlaceholder: 'pageview URLs',
type: TaxonomicFilterGroupType.PageviewUrls,
- endpoint: `api/environments/${teamId}/events/values/?key=$current_url&event_name=$pageview`,
+ endpoint: `api/projects/${teamId}/events/values/?key=$current_url&event_name=$pageview`,
searchAlias: 'value',
getName: (option: SimpleOption) => option.name,
getValue: (option: SimpleOption) => option.name,
@@ -839,7 +839,7 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
name: 'Pageview events',
searchPlaceholder: 'pageview events',
type: TaxonomicFilterGroupType.PageviewEvents,
- endpoint: `api/environments/${teamId}/events/values/?key=$current_url&event_name=$pageview`,
+ endpoint: `api/projects/${teamId}/events/values/?key=$current_url&event_name=$pageview`,
searchAlias: 'value',
getName: (option: SimpleOption) => option.name,
getValue: (option: SimpleOption) => option.name,
@@ -854,7 +854,7 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
name: 'Screens',
searchPlaceholder: 'screens',
type: TaxonomicFilterGroupType.Screens,
- endpoint: `api/environments/${teamId}/events/values/?key=$screen_name&event_name=$screen`,
+ endpoint: `api/projects/${teamId}/events/values/?key=$screen_name&event_name=$screen`,
searchAlias: 'value',
getName: (option: SimpleOption) => option.name,
getValue: (option: SimpleOption) => option.name,
@@ -866,7 +866,7 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
name: 'Screen events',
searchPlaceholder: 'screen events',
type: TaxonomicFilterGroupType.ScreenEvents,
- endpoint: `api/environments/${teamId}/events/values/?key=$screen_name&event_name=$screen`,
+ endpoint: `api/projects/${teamId}/events/values/?key=$screen_name&event_name=$screen`,
searchAlias: 'value',
getName: (option: SimpleOption) => option.name,
getValue: (option: SimpleOption) => option.name,
@@ -878,7 +878,7 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
name: 'Email addresses',
searchPlaceholder: 'email addresses',
type: TaxonomicFilterGroupType.EmailAddresses,
- endpoint: `api/environments/${teamId}/persons/values/?key=email`,
+ endpoint: `api/projects/${teamId}/persons/values/?key=email`,
searchAlias: 'value',
getName: (option: SimpleOption) => option.name,
getValue: (option: SimpleOption) => option.name,
@@ -890,7 +890,7 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
name: 'Autocapture events',
searchPlaceholder: 'autocapture events',
type: TaxonomicFilterGroupType.AutocaptureEvents,
- endpoint: `api/environments/${teamId}/events/values/?key=$el_text&event_name=$autocapture`,
+ endpoint: `api/projects/${teamId}/events/values/?key=$el_text&event_name=$autocapture`,
searchAlias: 'value',
getName: (option: SimpleOption) => option.name,
getValue: (option: SimpleOption) => option.name,
@@ -923,7 +923,7 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
name: 'Persons',
searchPlaceholder: 'persons',
type: TaxonomicFilterGroupType.Persons,
- endpoint: `api/environments/${teamId}/persons/`,
+ endpoint: `api/projects/${teamId}/persons/`,
getName: (person: PersonType) => person.name || 'Anon user?',
getValue: (person: PersonType) => person.distinct_ids?.[0],
getPopoverHeader: () => `Person`,
@@ -932,7 +932,7 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
name: 'Insights',
searchPlaceholder: 'insights',
type: TaxonomicFilterGroupType.Insights,
- endpoint: combineUrl(`api/environments/${teamId}/insights/`, {
+ endpoint: combineUrl(`api/projects/${teamId}/insights/`, {
saved: true,
}).url,
getName: (insight: InsightModel) => insight.name,
@@ -1026,7 +1026,7 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
})),
}
: {
- endpoint: `api/environments/${teamId}/sessions/property_definitions`,
+ endpoint: `api/projects/${teamId}/sessions/property_definitions`,
}),
getName: (option: any) => option.name,
getValue: (option) => option.name,
@@ -1097,7 +1097,7 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
valuesEndpoint: (key) => {
if (key === 'visited_page') {
return (
- `api/environments/${teamId}/events/values/?key=` +
+ `api/projects/${teamId}/events/values/?key=` +
encodeURIComponent('$current_url') +
'&event_name=' +
encodeURIComponent('$pageview')
diff --git a/frontend/src/lib/logic/eventIngestionRestrictionLogic.test.ts b/frontend/src/lib/logic/eventIngestionRestrictionLogic.test.ts
index 04702959379c..9b3ad8124b7d 100644
--- a/frontend/src/lib/logic/eventIngestionRestrictionLogic.test.ts
+++ b/frontend/src/lib/logic/eventIngestionRestrictionLogic.test.ts
@@ -31,7 +31,7 @@ describe('eventIngestionRestrictionLogic', () => {
logic.values.eventIngestionRestrictions
await delay(1)
const hasMatchingCall = (api.get as jest.Mock).mock.calls.some(
- (call) => call[0] === `api/environments/${MOCK_TEAM_ID}/event_ingestion_restrictions/`
+ (call) => call[0] === `api/projects/${MOCK_TEAM_ID}/event_ingestion_restrictions/`
)
expect(hasMatchingCall).toBe(true)
diff --git a/frontend/src/lib/logic/eventIngestionRestrictionLogic.ts b/frontend/src/lib/logic/eventIngestionRestrictionLogic.ts
index 3cdef36a3955..68279541b672 100644
--- a/frontend/src/lib/logic/eventIngestionRestrictionLogic.ts
+++ b/frontend/src/lib/logic/eventIngestionRestrictionLogic.ts
@@ -68,7 +68,7 @@ export const eventIngestionRestrictionLogic = kea<eventIngestionRestrictionLogic
loadEventIngestionRestrictions: async () => {
try {
const response = await api.get(
- `api/environments/${values.currentTeamIdStrict}/event_ingestion_restrictions/`
+ `api/projects/${values.currentTeamIdStrict}/event_ingestion_restrictions/`
)
// api.get resolves to null on non-JSON responses (204, CDN error pages, etc.) — coerce to []
return Array.isArray(response) ? response : []
diff --git a/frontend/src/models/dashboardsModel.tsx b/frontend/src/models/dashboardsModel.tsx
index 50167e5515f9..c0690300e6fb 100644
--- a/frontend/src/models/dashboardsModel.tsx
+++ b/frontend/src/models/dashboardsModel.tsx
@@ -427,7 +427,7 @@ export const dashboardsModel = kea<dashboardsModelType>([
let apiUrl =
url ||
- `api/environments/${teamLogic.values.currentTeamId}/dashboards/?limit=2000&exclude_generated=true`
+ `api/projects/${teamLogic.values.currentTeamId}/dashboards/?limit=2000&exclude_generated=true`
const dashboards: PaginatedResponse<DashboardType> = await api.get(apiUrl)
@@ -451,7 +451,7 @@ export const dashboardsModel = kea<dashboardsModelType>([
const beforeChange = { ...values.rawDashboards[id] }
const response = await api.update<DashboardType>(
- `api/environments/${teamLogic.values.currentTeamId}/dashboards/${id}`,
+ `api/projects/${teamLogic.values.currentTeamId}/dashboards/${id}`,
payload
)
refreshTreeItem('dashboard', id)
@@ -473,7 +473,7 @@ export const dashboardsModel = kea<dashboardsModelType>([
label: 'Undo',
action: async () => {
const reverted = await api.update<DashboardType>(
- `api/environments/${teamLogic.values.currentTeamId}/dashboards/${id}`,
+ `api/projects/${teamLogic.values.currentTeamId}/dashboards/${id}`,
beforeChange
)
actions.updateDashboardSuccess(getQueryBasedDashboard(reverted))
@@ -496,7 +496,7 @@ export const dashboardsModel = kea<dashboardsModelType>([
},
deleteDashboard: async ({ id, deleteInsights }) => {
const deleted = getQueryBasedDashboard(
- await api.update(`api/environments/${teamLogic.values.currentTeamId}/dashboards/${id}`, {
+ await api.update(`api/projects/${teamLogic.values.currentTeamId}/dashboards/${id}`, {
deleted: true,
delete_insights: deleteInsights,
})
@@ -506,7 +506,7 @@ export const dashboardsModel = kea<dashboardsModelType>([
},
restoreDashboard: async ({ id }) => {
const restored = getQueryBasedDashboard(
- await api.update(`api/environments/${teamLogic.values.currentTeamId}/dashboards/${id}`, {
+ await api.update(`api/projects/${teamLogic.values.currentTeamId}/dashboards/${id}`, {
deleted: false,
})
) as DashboardType
@@ -514,18 +514,15 @@ export const dashboardsModel = kea<dashboardsModelType>([
return restored
},
pinDashboard: async ({ id, source }) => {
- const response = await api.update(
- `api/environments/${teamLogic.values.currentTeamId}/dashboards/${id}`,
- {
- pinned: true,
- }
- )
+ const response = await api.update(`api/projects/${teamLogic.values.currentTeamId}/dashboards/${id}`, {
+ pinned: true,
+ })
eventUsageLogic.actions.reportDashboardPinToggled(id, true, source)
return getQueryBasedDashboard(response)!
},
unpinDashboard: async ({ id, source }) => {
const response = await api.update<DashboardType>(
- `api/environments/${teamLogic.values.currentTeamId}/dashboards/${id}`,
+ `api/projects/${teamLogic.values.currentTeamId}/dashboards/${id}`,
{
pinned: false,
}
@@ -535,7 +532,7 @@ export const dashboardsModel = kea<dashboardsModelType>([
},
duplicateDashboard: async ({ id, name, show, duplicateTiles }) => {
const result = await api.create<DashboardType>(
- `api/environments/${teamLogic.values.currentTeamId}/dashboards/`,
+ `api/projects/${teamLogic.values.currentTeamId}/dashboards/`,
{
use_dashboard: id,
name: `${name} (Copy)`,
diff --git a/frontend/src/models/propertyDefinitionsModel.ts b/frontend/src/models/propertyDefinitionsModel.ts
index 81fd44931548..6dc93ce9515f 100644
--- a/frontend/src/models/propertyDefinitionsModel.ts
+++ b/frontend/src/models/propertyDefinitionsModel.ts
@@ -167,7 +167,7 @@ const constructValuesEndpoint = (
let basePath: string
if (type === PropertyDefinitionType.Session) {
- basePath = `api/environments/${teamId}/${type}s/values`
+ basePath = `api/projects/${teamId}/${type}s/values`
} else if (type === PropertyDefinitionType.FlagValue) {
// FlagValue is project-scoped, so use the project-scoped endpoint
basePath = `api/projects/${teamId}/${type}/values`
diff --git a/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts b/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts
index 533c58048856..4810c006a094 100644
--- a/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts
+++ b/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts
@@ -2080,7 +2080,7 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
abortQuery: async ({ queryId }) => {
try {
const { currentTeamId } = values
- await api.delete(`api/environments/${currentTeamId}/query/${queryId}/`)
+ await api.delete(`api/projects/${currentTeamId}/query/${queryId}/`)
} catch (e) {
console.warn('Failed cancelling query', e)
}