-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(coral): Add route filter and updated navigtion for superadmin behind feature flag #2303
Conversation
cad163b
to
deaecb0
Compare
deaecb0
to
06a2c54
Compare
@@ -349,7 +356,118 @@ const routes: Array<RouteObject> = [ | |||
}, | |||
]; | |||
|
|||
const router = createBrowserRouter(routes, { | |||
/** `superadminRouteMap` is used as in-between-solution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to leave the map itself here in router.tsx
because it's similar to our routes
map and I thought it's good to keep them together? 🤔
} from "src/services/router-utils/route-utils"; | ||
import { isFeatureFlagActive } from "src/services/feature-flags/utils"; | ||
|
||
const superAdminAccessCoralEnabled = isFeatureFlagActive( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to run the filter when the feature isn't enabled anyway, so I added it here, too.
@@ -0,0 +1,279 @@ | |||
import { useToast } from "@aivenio/aquarium"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
route-utils.tsx
was located in /services/feature-flag
before, because it only contained the createRouteBehindFeatureFlag
function before.
Now that we have more util functions related to router, I moved this to a separate directory.
@@ -1,5 +1,3 @@ | |||
import isString from "lodash/isString"; | |||
|
|||
enum Routes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved route-utils.ts
in the new directory in services
and renamed it to types.ts
. All functions are moved to router-utils.tsx
. So now type definition are separated from functions and there is only one route-utils
file :D
…ole. Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
06a2c54
to
1d016fb
Compare
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
}); | ||
}); | ||
|
||
describe("filteredRoutesForSuperAdmin", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the new tests case I added, rest was only moved with the file.
The tests are a bit rough and superficial, I didn't want to start adding rendering etc. pp. here, because it's only for a temporary time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments ^^
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
0d78d15
to
1643249
Compare
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
1643249
to
cfa346c
Compare
Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Description
This PR enables user with the role SUPERADMIN to access coral. It's behind a feature flag!
This is part of #2307
Description
SuperAdminRouteMap
to add redirects to some routes and remove others. The filter is not super optimised, as it's a temporary solution.Additionally:
What kind of change does this PR introduce?
Requirements (all must be checked before review)
main
branch have been pulledpnpm lint
has been run successfully