Persist apiVersion when editing resources in monaco (#4406)

* Persist apiVersion when editing resources in monaco

- Use a new custom k8slens prefixed label

- Means that users aren't surprised when they use lens to update a
  resource to a new apiVersionWithGroup

- Doesn't touch the versions in the stores

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix lint

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* fix: Fix lint issues

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* chore: make lint not bail on failure

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* chore: Run lint:fix on all files

Signed-off-by: Sebastian Malton <sebastian@malton.name>

---------

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2023-04-05 10:56:23 -04:00
1 parent 058494bc73
commit 807f98ed1b
57 files changed
+295 -400

No files matched your search

@@ -32,9 +32,7 @@ const someRequestChannelWithoutListeners: SomeRequestChannel = {
};
[{ scenarioIsAsync: true }, { scenarioIsAsync: false }].forEach(({ scenarioIsAsync }) =>
describe(`get-message-bridge-fake, given running as ${
scenarioIsAsync ? "async" : "sync"
}`, () => {
describe(`get-message-bridge-fake, given running as ${scenarioIsAsync ? "async" : "sync"}`, () => {
let messageBridgeFake: any;
beforeEach(() => {
@@ -135,9 +133,7 @@ const someRequestChannelWithoutListeners: SomeRequestChannel = {
describe("given a message is sent in di-1", () => {
beforeEach(() => {
const sendMessageToChannelFromDi1 = someDi1.inject(
sendMessageToChannelInjectionToken,
);
const sendMessageToChannelFromDi1 = someDi1.inject(sendMessageToChannelInjectionToken);
sendMessageToChannelFromDi1(someMessageChannel, "some-message");
});
@@ -161,13 +157,10 @@ const someRequestChannelWithoutListeners: SomeRequestChannel = {
});
it("the response gets handled in di-1", () => {
expect(someHandler1MockInDi1).toHaveBeenCalledWith(
"some-response-to: some-message",
{
frameId: 42,
processId: 42,
},
);
expect(someHandler1MockInDi1).toHaveBeenCalledWith("some-response-to: some-message", {
frameId: 42,
processId: 42,
});
});
scenarioIsAsync &&
@@ -191,13 +184,10 @@ const someRequestChannelWithoutListeners: SomeRequestChannel = {
});
it("the response gets handled in di-1", () => {
expect(someHandler1MockInDi1).toHaveBeenCalledWith(
"some-response-to: some-message",
{
frameId: 42,
processId: 42,
},
);
expect(someHandler1MockInDi1).toHaveBeenCalledWith("some-response-to: some-message", {
frameId: 42,
processId: 42,
});
});
});
});
@@ -375,9 +365,7 @@ const someRequestChannelWithoutListeners: SomeRequestChannel = {
const requestFromChannelFromDi2 = someDi2.inject(requestFromChannelInjectionToken);
return expect(() =>
requestFromChannelFromDi2(someRequestChannel, "irrelevant"),
).rejects.toThrow(
return expect(() => requestFromChannelFromDi2(someRequestChannel, "irrelevant")).rejects.toThrow(
'Tried to make a request but multiple listeners were discovered for channel "some-request-channel" in multiple DIs.',
);
});
@@ -385,9 +373,7 @@ const someRequestChannelWithoutListeners: SomeRequestChannel = {
it("when requesting from channel without listener, throws", () => {
const requestFromChannel = someDi1.inject(requestFromChannelInjectionToken);
return expect(() =>
requestFromChannel(someRequestChannelWithoutListeners, "irrelevant"),
).rejects.toThrow(
return expect(() => requestFromChannel(someRequestChannelWithoutListeners, "irrelevant")).rejects.toThrow(
'Tried to make a request but no listeners for channel "some-request-channel-without-listeners" was discovered in any DIs',
);
});
@@ -22,7 +22,7 @@ import asyncFn, { AsyncFnMock } from "@async-fn/jest";
export type MessageBridgeFake = {
involve: (...dis: DiContainer[]) => void;
messagePropagation: () => Promise<void>;
messagePropagationRecursive: (callback: any) => any;
messagePropagationRecursive: (callback: () => any) => any;
setAsync: (value: boolean) => void;
};
@@ -167,9 +167,7 @@ export const getMessageBridgeFake = (): MessageBridgeFake => {
await Promise.all(oldMessages.map((x) => wrapper(x.resolve)));
};
const messagePropagationRecursive = async (
wrapper: (callback: any) => any = (callback) => callback(),
) => {
const messagePropagationRecursive = async (wrapper = (callback: () => any) => callback()) => {
while (messagePropagationBuffer.size) {
await messagePropagation(wrapper);
}