Skip to content

Commit

Permalink
Add secrets tab to model details.
Browse files Browse the repository at this point in the history
  • Loading branch information
huwshimi committed Jan 22, 2024
1 parent 5e8ef26 commit 1fe2302
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pages/EntityDetails/EntityDetails.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe("Entity Details Container", () => {
it("lists the correct tabs", () => {
renderComponent(<EntityDetails />, { path, url, state });
expect(screen.getByTestId("view-selector")).toHaveTextContent(
/^ApplicationsIntegrationsLogsMachines$/,
/^ApplicationsIntegrationsLogsSecretsMachines$/,
);
});

Expand All @@ -134,7 +134,7 @@ describe("Entity Details Container", () => {
};
renderComponent(<EntityDetails />, { path, url, state });
expect(screen.getByTestId("view-selector")).toHaveTextContent(
/^ApplicationsIntegrationsLogs$/,
/^ApplicationsIntegrationsLogsSecrets$/,
);
});

Expand Down
7 changes: 7 additions & 0 deletions src/pages/EntityDetails/EntityDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ const EntityDetails = ({ modelWatcherError }: Props) => {
to: urls.model.tab({ userName, modelName, tab: ModelTab.LOGS }),
component: Link,
},
{
active: activeView === "secrets",
label: "Secrets",
onClick: (e: MouseEvent) => handleNavClick(e),

Check warning on line 144 in src/pages/EntityDetails/EntityDetails.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/EntityDetails/EntityDetails.tsx#L144

Added line #L144 was not covered by tests
to: urls.model.tab({ userName, modelName, tab: ModelTab.SECRETS }),
component: Link,
},
];

if (modelInfo?.type !== "kubernetes") {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/EntityDetails/Model/Model.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {

import ApplicationsTab from "./ApplicationsTab/ApplicationsTab";
import Logs from "./Logs";
import Secrets from "./Secrets";

export enum Label {
ACCESS_BUTTON = "Model access",
Expand Down Expand Up @@ -242,6 +243,7 @@ const Model = () => {
</>
)}
{shouldShow("logs", query.activeView) && <Logs />}
{shouldShow("secrets", query.activeView) && <Secrets />}
</div>
</>
);
Expand Down
12 changes: 12 additions & 0 deletions src/pages/EntityDetails/Model/Secrets/Secrets.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { screen } from "@testing-library/react";

import { renderComponent } from "testing/utils";

import Secrets from "./Secrets";

describe("Secrets", () => {
it("can display the action logs tab", async () => {
renderComponent(<Secrets />);
expect(screen.getByText("Secrets")).toBeInTheDocument();
});
});
5 changes: 5 additions & 0 deletions src/pages/EntityDetails/Model/Secrets/Secrets.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Secrets = () => {
return <div>Secrets</div>;
};

export default Secrets;
1 change: 1 addition & 0 deletions src/pages/EntityDetails/Model/Secrets/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./Secrets";
1 change: 1 addition & 0 deletions src/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export enum ModelTab {
MACHINES = "machines",
INTEGRATIONS = "integrations",
LOGS = "logs",
SECRETS = "secrets",
}

export type AppTab = "machines" | "units";
Expand Down

0 comments on commit 1fe2302

Please sign in to comment.