File tree Expand file tree Collapse file tree
apps/greenhouse/src/routes Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " @cloudoperators/juno-app-greenhouse " : patch
3+ ---
4+
5+ Keep alerts plugin backward compatible after plugin name hamonization happened in the backend.
Original file line number Diff line number Diff line change 4747 uses : ./.github/workflows/shared-detect-pkg-changes.yaml
4848 with :
4949 paths : " packages apps"
50- runs-on : [ ubuntu-latest ]
50+ runs-on : ubuntu-latest
5151
5252 build-deploy :
5353 # skip if the PR is from a forked repository
Original file line number Diff line number Diff line change @@ -16,6 +16,18 @@ const searchSchema = z.object({
1616 activeApps : z . string ( ) . optional ( ) ,
1717} )
1818
19+ /**
20+ * Backend has harmonized name of alerts plugin across all organizations
21+ * which is now "alerts" instead of "alerts-<orgId>" which affects backward
22+ * compatibility in case people had bookmarked links with the old name.
23+ * In order to stay backward compatible we need to map "alerts-<orgId>" to "alerts".
24+ * This method will be removed once we stop supporting legacy URLs.
25+ **/
26+ const getBackwardCompatibleApp = ( appId : string ) => {
27+ if ( ! appId ) return ""
28+ return / ^ a l e r t s - .+ / . test ( appId ) ? "alerts" : appId
29+ }
30+
1931export const Route = createFileRoute ( "/" ) ( {
2032 validateSearch : searchSchema ,
2133 beforeLoad : ( ) => {
@@ -24,7 +36,7 @@ export const Route = createFileRoute("/")({
2436 const activeApps = legacyState ?. [ ACTIVE_APPS_KEY ]
2537 const parsedActiveApps = activeApps ?. split ( "," ) || [ ]
2638 return {
27- activeApp : parsedActiveApps . length > 0 ? parsedActiveApps [ 0 ] : "" ,
39+ activeApp : parsedActiveApps . length > 0 ? getBackwardCompatibleApp ( parsedActiveApps [ 0 ] ) : "" ,
2840 }
2941 } ,
3042 component : RouteComponent ,
You can’t perform that action at this time.
0 commit comments