(instance: Instance | InstanceResource)
| 14 | import { appStoreUtilBridge } from "@/utils/app-store-bridge"; |
| 15 | |
| 16 | export 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 | |
| 33 | export const extractInstanceResourceName = (name: string) => { |
| 34 | const pattern = /(?:^|\/)instances\/([^/]+)(?:$|\/)/; |
no test coverage detected