MCPcopy Create free account
hub / github.com/bytebase/bytebase / instanceV1Name

Function instanceV1Name

frontend/src/utils/v1/instance.ts:16–31  ·  view source on GitHub ↗
(instance: Instance | InstanceResource)

Source from the content-addressed store, hash-verified

14import { appStoreUtilBridge } from "@/utils/app-store-bridge";
15
16export function instanceV1Name(instance: Instance | InstanceResource) {
17 const currentPlan = appStoreUtilBridge()?.currentPlan() ?? PlanType.FREE;
18 let name = instance.title;
19 // For unknown instance, we will use the name as the title.
20 if (instance.title === unknownInstance().title) {
21 name = extractInstanceResourceName(instance.name);
22 }
23 if (
24 isValidInstanceName(instance.name) &&
25 !instance.activation &&
26 currentPlan !== PlanType.FREE
27 ) {
28 name += ` (${i18n.t("common.no-license")})`;
29 }
30 return name;
31}
32
33export const extractInstanceResourceName = (name: string) => {
34 const pattern = /(?:^|\/)instances\/([^/]+)(?:$|\/)/;

Callers 9

DatabaseTitleFunction · 0.90
SelectedDatabaseTagFunction · 0.90
DatabaseNodeFunction · 0.90
InstanceNodeFunction · 0.90
DatabaseHoverPanelFunction · 0.90
RichDatabaseNameFunction · 0.90
DatabaseDetailHeaderFunction · 0.90
InstanceDetailPageFunction · 0.90

Calls 4

appStoreUtilBridgeFunction · 0.90
unknownInstanceFunction · 0.90
isValidInstanceNameFunction · 0.90

Tested by

no test coverage detected