mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
20 lines
513 B
TypeScript
20 lines
513 B
TypeScript
import type {Environment} from 'sentry/types';
|
|
|
|
const DEFAULT_EMPTY_ROUTING_NAME = 'none';
|
|
const DEFAULT_EMPTY_ENV_NAME = '(No Environment)';
|
|
|
|
export function getUrlRoutingName(env: Partial<Environment>) {
|
|
if (env.name) {
|
|
return encodeURIComponent(env.name);
|
|
}
|
|
|
|
if (env.displayName) {
|
|
return encodeURIComponent(env.displayName);
|
|
}
|
|
return DEFAULT_EMPTY_ROUTING_NAME;
|
|
}
|
|
|
|
export function getDisplayName(env: Partial<Environment>) {
|
|
return env.name || env.displayName || DEFAULT_EMPTY_ENV_NAME;
|
|
}
|