Skip to content

Commit 0e6c31b

Browse files
authored
feat(portal): adds permissions based conditional rendering for create and delete flavors and flavors spec (#393)
* feat(portal): confirmation of ExtraSpec Deletion * feat(portal): added compiled translation * chore(portal): delete non confirm classes * chore(portal): delete onClick which leads to nested buttons * feat(portal): added conditional render based on permission * chore(portal): add translations * chore(portal): add compiled * chore(portal): adjust Test with act and i18nProvider * fix(portal): correct permissions * fix(portal): delete console.log * test(portal): added Tests to changed components * test(portal): added Tests to changed components * test(portal): undo problematic test * refactor(portal): changed useEffects to use * chore(portal): add translation * chore(portal): added compiled trans * chore(portal): delete test
1 parent 31dca47 commit 0e6c31b

31 files changed

Lines changed: 2125 additions & 1384 deletions

File tree

apps/aurora-portal/permission_policies/compute.yaml

Lines changed: 830 additions & 821 deletions
Large diffs are not rendered by default.

apps/aurora-portal/src/client/App.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import styles from "./index.css?inline"
66
import { i18n } from "@lingui/core"
77
import { I18nProvider } from "@lingui/react"
88
import { ErrorBoundary } from "react-error-boundary"
9+
import { Trans } from "@lingui/react/macro"
910

1011
type AppProps = {
1112
theme?: "theme-dark" | "theme-light"
@@ -14,9 +15,13 @@ const App = (props: AppProps) => (
1415
<ErrorBoundary
1516
fallbackRender={({ error, resetErrorBoundary }) => (
1617
<div role="alert" style={{ padding: 24 }}>
17-
<p>Something went wrong:</p>
18+
<p>
19+
<Trans>Something went wrong:</Trans>
20+
</p>
1821
<pre style={{ color: "red" }}>{error.message}</pre>
19-
<button onClick={resetErrorBoundary}>Try again</button>
22+
<button onClick={resetErrorBoundary}>
23+
<Trans>Try again</Trans>
24+
</button>
2025
</div>
2126
)}
2227
>

apps/aurora-portal/src/client/routes/_auth.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ export const Route = createFileRoute("/_auth")({
2020
})
2121

2222
function RouteComponent() {
23-
const { user } = useAuth()
24-
25-
console.log("Auth Data:", user)
23+
useAuth()
2624

2725
return <Outlet /> // This is where child routes will render
2826
}

apps/aurora-portal/src/client/routes/_auth/accounts/$accountId/projects/$projectId/compute/$.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function ComputeDashboard({ client }: { client: TrpcClient }) {
5151
<div className="col-span-9 flex flex-col gap-4">
5252
<div className="w-full">
5353
{project ? (
54-
<ErrorBoundary fallback={<div className="p-4 text-center text-gray-400">Error loading component</div>}>
54+
<ErrorBoundary fallback={<div className="p-4 text-center">Error loading component</div>}>
5555
{(() => {
5656
switch (splat) {
5757
case "instances":

apps/aurora-portal/src/client/routes/_auth/accounts/$accountId/projects/$projectId/compute/-components/ComputeNavBar.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ContentHeading } from "@cloudoperators/juno-ui-components/index"
2+
import { Trans } from "@lingui/react/macro"
23
import { useLocation, useParams, Link } from "@tanstack/react-router"
34

45
export const ComputeSideNavBar = () => {
@@ -24,7 +25,9 @@ export const ComputeSideNavBar = () => {
2425

2526
return (
2627
<div className="w-full flex flex-col items-start px-4">
27-
<ContentHeading>Compute</ContentHeading>
28+
<ContentHeading>
29+
<Trans>Compute</Trans>
30+
</ContentHeading>
2831
{/* Navigation */}
2932
<nav className="w-full flex flex-col rounded-lg items-start ">
3033
{links.map(({ path, label }) => (

0 commit comments

Comments
 (0)