mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix configuration shown release details being stale (#7174)
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
54e874f646
commit
4bf72742fd
File diff suppressed because it is too large
Load Diff
@ -224,15 +224,96 @@ describe("showing details for helm release", () => {
|
|||||||
|
|
||||||
it("closes details for first release", () => {
|
it("closes details for first release", () => {
|
||||||
expect(
|
expect(
|
||||||
rendered.queryByTestId("helm-release-details-for-some-namespace/some-name"),
|
rendered.queryByTestId(
|
||||||
|
"helm-release-details-for-some-namespace/some-name",
|
||||||
|
),
|
||||||
).not.toBeInTheDocument();
|
).not.toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("opens details for second release", () => {
|
it("opens details for second release", () => {
|
||||||
expect(
|
expect(
|
||||||
rendered.getByTestId("helm-release-details-for-some-other-namespace/some-other-name"),
|
rendered.getByTestId(
|
||||||
|
"helm-release-details-for-some-other-namespace/some-other-name",
|
||||||
|
),
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("shows spinner", () => {
|
||||||
|
expect(
|
||||||
|
rendered.getByTestId("helm-release-detail-content-spinner"),
|
||||||
|
).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("when details for second release resolve", () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
await requestDetailedHelmReleaseMock.resolve({
|
||||||
|
callWasSuccessful: true,
|
||||||
|
response: {
|
||||||
|
release: {
|
||||||
|
appVersion: "some-app-version",
|
||||||
|
chart: "some-chart-1.0.0",
|
||||||
|
status: "some-status",
|
||||||
|
updated: "some-updated",
|
||||||
|
revision: "some-revision",
|
||||||
|
name: "some-other-name",
|
||||||
|
namespace: "some-other-namespace",
|
||||||
|
},
|
||||||
|
|
||||||
|
details: {
|
||||||
|
name: "some-other-name",
|
||||||
|
namespace: "some-other-namespace",
|
||||||
|
version: "some-version",
|
||||||
|
config: "some-config",
|
||||||
|
manifest: "some-manifest",
|
||||||
|
|
||||||
|
info: {
|
||||||
|
deleted: "some-deleted",
|
||||||
|
description: "some-description",
|
||||||
|
first_deployed: "some-first-deployed",
|
||||||
|
last_deployed: "some-last-deployed",
|
||||||
|
notes: "some-notes",
|
||||||
|
status: "some-status",
|
||||||
|
},
|
||||||
|
|
||||||
|
resources: [
|
||||||
|
{
|
||||||
|
kind: "some-kind",
|
||||||
|
apiVersion: "some-api-version",
|
||||||
|
metadata: {
|
||||||
|
uid: "some-uid",
|
||||||
|
name: "some-resource",
|
||||||
|
namespace: "some-namespace",
|
||||||
|
creationTimestamp: "2015-10-22T07:28:00Z",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("renders", () => {
|
||||||
|
expect(rendered.baseElement).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("calls for release configuration", () => {
|
||||||
|
expect(
|
||||||
|
requestHelmReleaseConfigurationMock,
|
||||||
|
).toHaveBeenCalledWith("some-other-name", "some-other-namespace", true);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("when configuration resolves", () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
await requestHelmReleaseConfigurationMock.resolve(
|
||||||
|
"some-other-configuration",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("renders", () => {
|
||||||
|
expect(rendered.baseElement).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("when details is closed", () => {
|
describe("when details is closed", () => {
|
||||||
@ -410,7 +491,7 @@ describe("showing details for helm release", () => {
|
|||||||
describe("when changing the configuration", () => {
|
describe("when changing the configuration", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const configuration = rendered.getByTestId(
|
const configuration = rendered.getByTestId(
|
||||||
"monaco-editor-for-helm-release-configuration",
|
"monaco-editor-for-helm-release-configuration-some-namespace/some-name",
|
||||||
);
|
);
|
||||||
|
|
||||||
fireEvent.change(configuration, {
|
fireEvent.change(configuration, {
|
||||||
@ -424,7 +505,7 @@ describe("showing details for helm release", () => {
|
|||||||
|
|
||||||
it("has the configuration", () => {
|
it("has the configuration", () => {
|
||||||
const input = rendered.getByTestId(
|
const input = rendered.getByTestId(
|
||||||
"monaco-editor-for-helm-release-configuration",
|
"monaco-editor-for-helm-release-configuration-some-namespace/some-name",
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(input).toHaveValue("some-new-configuration");
|
expect(input).toHaveValue("some-new-configuration");
|
||||||
@ -466,7 +547,7 @@ describe("showing details for helm release", () => {
|
|||||||
|
|
||||||
it("overrides the user inputted configuration with new configuration", () => {
|
it("overrides the user inputted configuration with new configuration", () => {
|
||||||
const input = rendered.getByTestId(
|
const input = rendered.getByTestId(
|
||||||
"monaco-editor-for-helm-release-configuration",
|
"monaco-editor-for-helm-release-configuration-some-namespace/some-name",
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(input).toHaveValue("some-other-configuration");
|
expect(input).toHaveValue("some-other-configuration");
|
||||||
|
|||||||
@ -85,6 +85,7 @@ const NonInjectedReleaseDetailsContent = observer(({ model }: Dependencies & Rel
|
|||||||
</DrawerItem>
|
</DrawerItem>
|
||||||
|
|
||||||
<ReleaseValues
|
<ReleaseValues
|
||||||
|
releaseId={model.id}
|
||||||
configuration={model.configuration}
|
configuration={model.configuration}
|
||||||
onlyUserSuppliedValuesAreShown={
|
onlyUserSuppliedValuesAreShown={
|
||||||
model.onlyUserSuppliedValuesAreShown
|
model.onlyUserSuppliedValuesAreShown
|
||||||
@ -150,11 +151,12 @@ const ResourceGroup = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
interface ReleaseValuesProps {
|
interface ReleaseValuesProps {
|
||||||
|
releaseId: string;
|
||||||
configuration: ConfigurationInput;
|
configuration: ConfigurationInput;
|
||||||
onlyUserSuppliedValuesAreShown: OnlyUserSuppliedValuesAreShownToggle;
|
onlyUserSuppliedValuesAreShown: OnlyUserSuppliedValuesAreShownToggle;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ReleaseValues = observer(({ configuration, onlyUserSuppliedValuesAreShown }: ReleaseValuesProps) => {
|
const ReleaseValues = observer(({ releaseId, configuration, onlyUserSuppliedValuesAreShown }: ReleaseValuesProps) => {
|
||||||
const configurationIsLoading = configuration.isLoading.get();
|
const configurationIsLoading = configuration.isLoading.get();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -171,7 +173,7 @@ const ReleaseValues = observer(({ configuration, onlyUserSuppliedValuesAreShown
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<MonacoEditor
|
<MonacoEditor
|
||||||
id="helm-release-configuration"
|
id={`helm-release-configuration-${releaseId}`}
|
||||||
style={{ minHeight: 300 }}
|
style={{ minHeight: 300 }}
|
||||||
value={configuration.nonSavedValue.get()}
|
value={configuration.nonSavedValue.get()}
|
||||||
onChange={configuration.onChange}
|
onChange={configuration.onChange}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user