Skip to content
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

WD-8394 - Add secrets tab #1684

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a test here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

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 />}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might need to add case "secrets": in the definition of shouldShow. Currently, the Secrets page doesn't render.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, thanks!

</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
Loading