Skip to content

Commit

Permalink
pre-pended PRODUCTIZED_BUILD with NEXT_PUBLIC_ (#924)
Browse files Browse the repository at this point in the history
Signed-off-by: hemahg <[email protected]>
  • Loading branch information
hemahg authored Jul 24, 2024
1 parent 5064314 commit 3659965
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 34 deletions.
5 changes: 2 additions & 3 deletions ui/app/[locale]/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import { PropsWithChildren, Suspense } from "react";

export function AppLayout({
children,
showLearningLinks,
}: PropsWithChildren<{ showLearningLinks: boolean }>) {
}: PropsWithChildren) {
const t = useTranslations();
return (
<Page
Expand All @@ -48,7 +47,7 @@ export function AppLayout({
>
{/*<HelpContainer>*/}
<ClusterDrawerProvider>
<ClusterDrawer showLearningLinks={showLearningLinks}>
<ClusterDrawer>
<Banner variant={"blue"}>
<Split>
<SplitItem isFilled={true}>
Expand Down
6 changes: 3 additions & 3 deletions ui/app/[locale]/ClusterConnectionDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import {
} from "@/libs/patternfly/react-core";
import { Divider, Stack, StackItem } from "@patternfly/react-core";
import { useTranslations } from "next-intl";
import { isProductizedBuild } from "@/utils/env";


export async function ClusterConnectionDetails({
clusterId,
showLearningLinks,
}: {
clusterId: string;
showLearningLinks: boolean;
}) {
const t = useTranslations();
const data = await getKafkaCluster(clusterId);
Expand Down Expand Up @@ -103,7 +103,7 @@ export async function ClusterConnectionDetails({
</ExpandableSection>
</TextContent>
</StackItem>
{showLearningLinks && (
{isProductizedBuild && (
<StackItem>
<Divider />
<Stack hasGutter={true} className={"pf-v5-u-p-lg"}>
Expand Down
18 changes: 8 additions & 10 deletions ui/app/[locale]/ClusterDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ import { useTranslations } from "next-intl";
import { PropsWithChildren, Suspense } from "react";

export function ClusterDrawer({
children,
showLearningLinks,
}: PropsWithChildren<{ showLearningLinks: boolean }>) {
children
}: PropsWithChildren) {
const t = useTranslations();
const { expanded, clusterId, close } = useClusterDrawerContext();
return (
Expand Down Expand Up @@ -54,7 +53,6 @@ export function ClusterDrawer({
{clusterId && (
<ClusterConnectionDetails
clusterId={clusterId}
showLearningLinks={showLearningLinks}
/>
)}
</Suspense>
Expand All @@ -63,12 +61,12 @@ export function ClusterDrawer({
>
<DrawerContentBody
className={"pf-v5-u-display-flex pf-v5-u-flex-direction-column"}
// style={{
// height: "100%",
// width: "100%",
// overflowY: "auto",
// position: "absolute",
// }}
// style={{
// height: "100%",
// width: "100%",
// overflowY: "auto",
// position: "absolute",
// }}
>
{children}
</DrawerContentBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
TopicsTableColumns,
} from "@/components/TopicsTable/TopicsTable";
import { useRouter } from "@/navigation";
import { isProductizedBuild, isReadonly } from "@/utils/env";
import { isReadonly } from "@/utils/env";
import { useFilterParams } from "@/utils/useFilterParams";
import { useOptimistic, useTransition } from "react";

Expand Down Expand Up @@ -193,7 +193,6 @@ export function ConnectedTopicsTable({
}}
includeHidden={includeHidden}
isReadOnly={isReadonly}
showLearningLinks={isProductizedBuild}
/>
);
}
3 changes: 1 addition & 2 deletions ui/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import NextIntlProvider from "@/app/[locale]/NextIntlProvider";
import { SessionRefresher } from "@/app/[locale]/SessionRefresher";

import { authOptions } from "@/utils/authOptions";
import { isProductizedBuild } from "@/utils/env";
import { getServerSession } from "next-auth";
import { getTranslations } from "next-intl/server";
import { notFound } from "next/navigation";
Expand All @@ -31,7 +30,7 @@ export default async function Layout({ children, params: { locale } }: Props) {
<NextIntlProvider locale={locale} messages={messages}>
<AppSessionProvider session={session}>
<AppLayoutProvider>
<AppLayout showLearningLinks={isProductizedBuild}>
<AppLayout>
{children}
</AppLayout>
</AppLayoutProvider>
Expand Down
15 changes: 6 additions & 9 deletions ui/components/TopicsTable/TopicsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export type TopicsTableProps = {
filterId: string | undefined;
filterName: string | undefined;
filterStatus: TopicStatus[] | undefined;
showLearningLinks: boolean;
onEditTopic: (topic: TopicList) => void;
onDeleteTopic: (topic: TopicList) => void;
onCreateTopic: () => void;
Expand Down Expand Up @@ -112,7 +111,6 @@ export function TopicsTable({
onFilterIdChange,
onFilterNameChange,
onFilterStatusChange,
showLearningLinks,
}: TopicsTableProps) {
const t = useTranslations("topics");
return (
Expand All @@ -127,7 +125,6 @@ export function TopicsTable({
canCreate={isReadOnly === false}
createHref={`${baseurl}/create`}
onShowHiddenTopics={() => onInternalTopicsChange(true)}
showLearningLinks={showLearningLinks}
/>
}
emptyStateNoResults={
Expand Down Expand Up @@ -301,12 +298,12 @@ export function TopicsTable({
actions={
isReadOnly === false
? [
{
label: t("create_topic"),
onClick: onCreateTopic,
isPrimary: true,
},
]
{
label: t("create_topic"),
onClick: onCreateTopic,
isPrimary: true,
},
]
: undefined
}
tools={[
Expand Down
5 changes: 2 additions & 3 deletions ui/components/TopicsTable/components/EmptyStateNoTopics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ import {
} from "@/libs/patternfly/react-core";
import { PlusCircleIcon } from "@/libs/patternfly/react-icons";
import { useTranslations } from "next-intl";
import { isProductizedBuild } from "@/utils/env"

export function EmptyStateNoTopics({
canCreate,
createHref,
onShowHiddenTopics,
showLearningLinks,
}: {
canCreate: boolean;
createHref: string;
onShowHiddenTopics: () => void;
showLearningLinks: boolean;
}) {
const t = useTranslations();
return (
Expand All @@ -45,7 +44,7 @@ export function EmptyStateNoTopics({
{t("EmptyStateNoTopics.show_internal_topics")}
</Button>
</EmptyStateActions>
{showLearningLinks && (
{isProductizedBuild && (
<EmptyStateActions>
<ExternalLink
testId={"create-topic"}
Expand Down
2 changes: 1 addition & 1 deletion ui/environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace NodeJS {
KEYCLOAK_CLIENTID?: string;
KEYCLOAK_CLIENTSECRET?: string;
NEXT_PUBLIC_KEYCLOAK_URL?: string;
PRODUCTIZED_BUILD?: "true" | "false";
NEXT_PUBLIC_PRODUCTIZED_BUILD?: "true" | "false";
CONSOLE_METRICS_PROMETHEUS_URL?: string;
LOG_LEVEL?: "fatal" | "error" | "warn" | "info" | "debug" | "trace";
CONSOLE_MODE?: "read-only" | "read-write";
Expand Down
2 changes: 1 addition & 1 deletion ui/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ export const isReadonly = (() => {
return true;
})();

export const isProductizedBuild = process.env.PRODUCTIZED_BUILD === "true";
export const isProductizedBuild = process.env.NEXT_PUBLIC_PRODUCTIZED_BUILD === "true";

0 comments on commit 3659965

Please sign in to comment.