Browse Source

ref(platform-key): Sync PlatformKey type with the active projects (#57460)

* Extend the `PlatformKey` type with the values of currently active
projects.
* Remove `python-tracing`, `node-tracing`, `react-native-tracing` as
they were only used for loading docs.
ArthurKnaus 1 year ago
parent
commit
58d819a26c

+ 1 - 1
static/app/actionCreators/projects.tsx

@@ -367,7 +367,7 @@ export function loadDocs({
 }: {
   api: Client;
   orgSlug: string;
-  platform: PlatformKey;
+  platform: PlatformKey | 'python-tracing' | 'node-tracing' | 'react-native-tracing';
   projectSlug: string;
 }) {
   return api.requestPromise(`/projects/${orgSlug}/${projectSlug}/docs/${platform}/`);

+ 1 - 3
static/app/components/events/interfaces/spans/inlineDocs.tsx

@@ -7,12 +7,10 @@ import {Client} from 'sentry/api';
 import ExternalLink from 'sentry/components/links/externalLink';
 import LoadingIndicator from 'sentry/components/loadingIndicator';
 import {t, tct} from 'sentry/locale';
-import type {PlatformKey} from 'sentry/types';
 import withApi from 'sentry/utils/withApi';
 
 type Props = {
   api: Client;
-
   orgSlug: string;
   platform: string;
   projectSlug: string;
@@ -51,7 +49,7 @@ class InlineDocs extends Component<Props, State> {
 
     this.setState({loading: true});
 
-    let tracingPlatform: PlatformKey;
+    let tracingPlatform: 'python-tracing' | 'node-tracing' | 'react-native-tracing';
 
     if (platform.startsWith('sentry.python')) {
       tracingPlatform = 'python-tracing';

+ 0 - 6
static/app/data/platformCategories.tsx

@@ -150,12 +150,6 @@ export const sourceMaps: PlatformKey[] = [
   'electron',
 ];
 
-export const tracing: PlatformKey[] = [
-  'python-tracing',
-  'node-tracing',
-  'react-native-tracing',
-];
-
 export const performance: PlatformKey[] = [
   'bun',
   'javascript',

+ 54 - 41
static/app/types/project.tsx

@@ -119,31 +119,42 @@ export interface TeamWithProjects extends Team {
 }
 
 /**
- * The type of all platforms keys.
+ * The type of all platform keys.
  * Also includes platforms that cannot be created in the UI anymore.
  */
 export type PlatformKey =
   | 'android'
+  | 'apple'
   | 'apple-ios'
   | 'apple-macos'
-  | 'apple'
   | 'bun'
+  | 'c'
   | 'capacitor'
+  | 'cfml'
+  | 'cocoa'
+  | 'cocoa-objc'
+  | 'cocoa-swift'
   | 'cordova'
+  | 'csharp'
+  | 'csharp-aspnetcore'
   | 'dart'
+  | 'dart-flutter'
+  | 'django'
+  | 'dotnet'
   | 'dotnet-aspnet'
   | 'dotnet-aspnetcore'
   | 'dotnet-awslambda'
   | 'dotnet-gcpfunctions'
+  | 'dotnet-google-cloud-functions'
   | 'dotnet-maui'
   | 'dotnet-uwp'
   | 'dotnet-winforms'
   | 'dotnet-wpf'
   | 'dotnet-xamarin'
-  | 'dotnet'
   | 'electron'
   | 'elixir'
   | 'flutter'
+  | 'go'
   | 'go-echo'
   | 'go-fasthttp'
   | 'go-gin'
@@ -151,14 +162,25 @@ export type PlatformKey =
   | 'go-iris'
   | 'go-martini'
   | 'go-negroni'
-  | 'go'
+  | 'groovy'
   | 'ionic'
+  | 'java'
+  | 'java-android'
+  | 'java-appengine'
+  | 'java-log4j'
   | 'java-log4j2'
   | 'java-logback'
-  | 'java-spring-boot'
+  | 'java-logging'
   | 'java-spring'
-  | 'java'
+  | 'java-spring-boot'
+  | 'javascript'
   | 'javascript-angular'
+  | 'javascript-angularjs'
+  | 'javascript-backbone'
+  | 'javascript-browser'
+  | 'javascript-capacitor'
+  | 'javascript-cordova'
+  | 'javascript-electron'
   | 'javascript-ember'
   | 'javascript-gatsby'
   | 'javascript-nextjs'
@@ -167,25 +189,37 @@ export type PlatformKey =
   | 'javascript-svelte'
   | 'javascript-sveltekit'
   | 'javascript-vue'
-  | 'javascript'
   | 'kotlin'
   | 'minidump'
-  | 'native-qt'
   | 'native'
+  | 'native-crashpad'
+  | 'native-breakpad'
+  | 'native-minidump'
+  | 'native-qt'
+  | 'node'
   | 'node-awslambda'
   | 'node-azurefunctions'
   | 'node-connect'
   | 'node-express'
   | 'node-gcpfunctions'
   | 'node-koa'
+  | 'node-nodeawslambda'
+  | 'node-nodegcpfunctions'
   | 'node-serverlesscloud'
-  | 'node'
+  | 'objc'
+  | 'other'
+  | 'perl'
+  | 'php'
+  | 'PHP'
   | 'php-laravel'
+  | 'php-monolog'
+  | 'php-symfony'
   | 'php-symfony2'
-  | 'php'
+  | 'python'
   | 'python-aiohttp'
   | 'python-asgi'
   | 'python-awslambda'
+  | 'python-azurefunctions'
   | 'python-bottle'
   | 'python-celery'
   | 'python-chalice'
@@ -197,6 +231,10 @@ export type PlatformKey =
   | 'python-pylons'
   | 'python-pymongo'
   | 'python-pyramid'
+  | 'python-pythonawslambda'
+  | 'python-pythonazurefunctions'
+  | 'python-pythongcpfunctions'
+  | 'python-pythonserverless'
   | 'python-quart'
   | 'python-rq'
   | 'python-sanic'
@@ -205,42 +243,17 @@ export type PlatformKey =
   | 'python-tornado'
   | 'python-tryton'
   | 'python-wsgi'
-  | 'python'
+  | 'rails'
+  | 'react'
   | 'react-native'
+  | 'ruby'
   | 'ruby-rack'
   | 'ruby-rails'
-  | 'ruby'
   | 'rust'
+  | 'swift'
+  | 'switt'
   | 'unity'
-  | 'unreal'
-  | 'other'
-  // legacy platforms – not included in the create project flow
-  | 'cocoa-objc'
-  | 'cocoa-swift'
-  | 'cocoa'
-  | 'csharp'
-  | 'dart-flutter'
-  | 'java-android'
-  | 'java-appengine'
-  | 'java-log4j'
-  | 'java-logging'
-  | 'javascript-angularjs'
-  | 'javascript-backbone'
-  | 'javascript-capacitor'
-  | 'javascript-cordova'
-  | 'javascript-electron'
-  | 'native-breakpad'
-  | 'native-crashpad'
-  | 'native-minidump'
-  | 'objc'
-  | 'perl'
-  | 'php-monolog'
-  | 'php-symfony'
-  | 'python-azurefunctions'
-  // TODO(aknaus): check if those are really platform keys and clean up
-  | 'python-tracing'
-  | 'node-tracing'
-  | 'react-native-tracing';
+  | 'unreal';
 
 export type PlatformIntegration = {
   id: PlatformKey;