mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
chore: Remove leading '+' on some directory names
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
7dff8e31a6
commit
4379edf0c7
903 files changed
+438
-438
No files matched your search
+234
@@ -0,0 +1,234 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`ValidatingWebhookConfigsDetails renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="ValidatingWebhookDetails"
|
||||
>
|
||||
<div
|
||||
class="DrawerItem"
|
||||
>
|
||||
<span
|
||||
class="name"
|
||||
>
|
||||
API version
|
||||
</span>
|
||||
<span
|
||||
class="value"
|
||||
>
|
||||
admissionregistration.k8s.io/v1
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="DrawerTitle title"
|
||||
>
|
||||
Webhooks
|
||||
</div>
|
||||
<div
|
||||
class="DrawerItem firstItem"
|
||||
>
|
||||
<span
|
||||
class="name"
|
||||
>
|
||||
Name
|
||||
</span>
|
||||
<span
|
||||
class="value"
|
||||
>
|
||||
<strong>
|
||||
pod-policy.example.com
|
||||
</strong>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="DrawerItem"
|
||||
>
|
||||
<span
|
||||
class="name"
|
||||
>
|
||||
Client Config
|
||||
</span>
|
||||
<span
|
||||
class="value"
|
||||
>
|
||||
<div>
|
||||
<div>
|
||||
Name:
|
||||
|
||||
service-name
|
||||
</div>
|
||||
<div>
|
||||
Namespace:
|
||||
|
||||
service-namespace
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="DrawerItem"
|
||||
>
|
||||
<span
|
||||
class="name"
|
||||
>
|
||||
Match Policy
|
||||
</span>
|
||||
<span
|
||||
class="value"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="DrawerItem"
|
||||
>
|
||||
<span
|
||||
class="name"
|
||||
>
|
||||
Failure Policy
|
||||
</span>
|
||||
<span
|
||||
class="value"
|
||||
>
|
||||
Fail
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="DrawerItem"
|
||||
>
|
||||
<span
|
||||
class="name"
|
||||
>
|
||||
Admission Review Versions
|
||||
</span>
|
||||
<span
|
||||
class="value"
|
||||
>
|
||||
v1, v1beta1
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="DrawerItem"
|
||||
>
|
||||
<span
|
||||
class="name"
|
||||
>
|
||||
Side Effects
|
||||
</span>
|
||||
<span
|
||||
class="value"
|
||||
>
|
||||
None
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="DrawerItem"
|
||||
>
|
||||
<span
|
||||
class="name"
|
||||
>
|
||||
Timeout Seconds
|
||||
</span>
|
||||
<span
|
||||
class="value"
|
||||
>
|
||||
5
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="DrawerItem"
|
||||
>
|
||||
<span
|
||||
class="name"
|
||||
>
|
||||
Namespace Selector
|
||||
</span>
|
||||
<span
|
||||
class="value"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="DrawerItem"
|
||||
>
|
||||
<span
|
||||
class="name"
|
||||
>
|
||||
Object Selector
|
||||
</span>
|
||||
<span
|
||||
class="value"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="DrawerItem lastItem"
|
||||
>
|
||||
<span
|
||||
class="name"
|
||||
>
|
||||
Rules
|
||||
</span>
|
||||
<span
|
||||
class="value"
|
||||
>
|
||||
<div>
|
||||
<div>
|
||||
API Groups:
|
||||
|
||||
, apps, extensions
|
||||
</div>
|
||||
<div>
|
||||
API Versions:
|
||||
|
||||
v1, v1beta1
|
||||
</div>
|
||||
<div>
|
||||
Operations:
|
||||
|
||||
CREATE, UPDATE
|
||||
</div>
|
||||
<div>
|
||||
Resources:
|
||||
|
||||
pods, deployments
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`ValidatingWebhookConfigsDetails renders with no webhooks 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="ValidatingWebhookDetails"
|
||||
>
|
||||
<div
|
||||
class="DrawerItem"
|
||||
>
|
||||
<span
|
||||
class="name"
|
||||
>
|
||||
API version
|
||||
</span>
|
||||
<span
|
||||
class="value"
|
||||
>
|
||||
admissionregistration.k8s.io/v1
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="DrawerTitle title"
|
||||
>
|
||||
Webhooks
|
||||
</div>
|
||||
<div
|
||||
style="opacity: 0.6;"
|
||||
>
|
||||
No webhooks set
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import {
|
||||
ValidatingWebhookConfiguration,
|
||||
} from "../../../common/k8s-api/endpoints";
|
||||
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
|
||||
import type { DiRender } from "../test-utils/renderFor";
|
||||
import { renderFor } from "../test-utils/renderFor";
|
||||
import { ValidatingWebhookDetails } from "./validating-webhook-configurations-details";
|
||||
|
||||
const validatingWebhookConfig = {
|
||||
apiVersion: "admissionregistration.k8s.io/v1",
|
||||
kind: "ValidatingWebhookConfiguration",
|
||||
metadata: {
|
||||
name: "pod-policy.example.com",
|
||||
resourceVersion: "1",
|
||||
uid: "pod-policy.example.com",
|
||||
namespace: "default",
|
||||
selfLink: "/apis/admissionregistration.k8s.io/v1/pod-policy.example.com",
|
||||
},
|
||||
webhooks: [
|
||||
{
|
||||
name: "pod-policy.example.com",
|
||||
rules: [
|
||||
{
|
||||
apiGroups: ["", "apps", "extensions"],
|
||||
apiVersions: ["v1", "v1beta1"],
|
||||
operations: ["CREATE", "UPDATE"],
|
||||
resources: ["pods", "deployments"],
|
||||
},
|
||||
],
|
||||
failurePolicy: "Fail",
|
||||
admissionReviewVersions: ["v1", "v1beta1"],
|
||||
sideEffects: "None",
|
||||
timeoutSeconds: 5,
|
||||
clientConfig: {
|
||||
service: {
|
||||
namespace: "service-namespace",
|
||||
name: "service-name",
|
||||
},
|
||||
caBundle: "Cg==",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
describe("ValidatingWebhookConfigsDetails", () => {
|
||||
let result: RenderResult;
|
||||
let render: DiRender;
|
||||
|
||||
beforeEach(async () => {
|
||||
const di = getDiForUnitTesting();
|
||||
|
||||
render = renderFor(di);
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
const webhookConfig = new ValidatingWebhookConfiguration(validatingWebhookConfig);
|
||||
|
||||
result = render(
|
||||
<ValidatingWebhookDetails object={webhookConfig} />,
|
||||
);
|
||||
|
||||
expect(result.baseElement).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders with no webhooks", () => {
|
||||
const webhookConfig = new ValidatingWebhookConfiguration({
|
||||
...validatingWebhookConfig,
|
||||
webhooks: [],
|
||||
});
|
||||
|
||||
result = render(
|
||||
<ValidatingWebhookDetails object={webhookConfig} />,
|
||||
);
|
||||
|
||||
expect(result.baseElement).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
export * from "./validating-webhook-configurations";
|
||||
export * from "./validating-webhook-configurations-details";
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { kubeObjectStoreInjectionToken } from "../../../common/k8s-api/api-manager/kube-object-store-token";
|
||||
import { ValidatingWebhookConfigurationStore } from "./validating-webhook-configuration-store";
|
||||
import clusterFrameContextForNamespacedResourcesInjectable from "../../cluster-frame-context/for-namespaced-resources.injectable";
|
||||
import loggerInjectable from "../../../common/logger.injectable";
|
||||
import validatingWebhookConfigurationApiInjectable
|
||||
from "../../../common/k8s-api/endpoints/validating-webhook-configuration-api.injectable";
|
||||
|
||||
const validatingWebhookConfigurationStoreInjectable = getInjectable({
|
||||
id: "validating-webhook-configuration-store",
|
||||
instantiate: (di) => {
|
||||
const api = di.inject(validatingWebhookConfigurationApiInjectable);
|
||||
|
||||
return new ValidatingWebhookConfigurationStore({
|
||||
context: di.inject(clusterFrameContextForNamespacedResourcesInjectable),
|
||||
logger: di.inject(loggerInjectable),
|
||||
}, api);
|
||||
},
|
||||
injectionToken: kubeObjectStoreInjectionToken,
|
||||
});
|
||||
|
||||
export default validatingWebhookConfigurationStoreInjectable;
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type {
|
||||
ValidatingWebhookConfiguration,
|
||||
ValidatingWebhookConfigurationApi,
|
||||
} from "../../../common/k8s-api/endpoints";
|
||||
import type {
|
||||
KubeObjectStoreDependencies,
|
||||
KubeObjectStoreOptions,
|
||||
} from "../../../common/k8s-api/kube-object.store";
|
||||
import { KubeObjectStore } from "../../../common/k8s-api/kube-object.store";
|
||||
|
||||
export interface ValidatingWebhookConfigurationStoreDependencies extends KubeObjectStoreDependencies {
|
||||
}
|
||||
|
||||
export class ValidatingWebhookConfigurationStore extends KubeObjectStore<ValidatingWebhookConfiguration, ValidatingWebhookConfigurationApi> {
|
||||
constructor(protected readonly dependencies: ValidatingWebhookConfigurationStoreDependencies, api: ValidatingWebhookConfigurationApi, opts?: KubeObjectStoreOptions) {
|
||||
super(dependencies, api, opts);
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { DrawerItem, DrawerTitle } from "../drawer";
|
||||
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
||||
import { WebhookConfig } from "../config-mutating-webhook-configurations/webhook-config";
|
||||
import type { ValidatingWebhookConfiguration } from "../../../common/k8s-api/endpoints";
|
||||
|
||||
export interface ValidatingWebhookProps extends KubeObjectDetailsProps<ValidatingWebhookConfiguration> {
|
||||
}
|
||||
|
||||
@observer
|
||||
export class ValidatingWebhookDetails extends React.Component<ValidatingWebhookProps> {
|
||||
render() {
|
||||
const { object: webhookConfig } = this.props;
|
||||
|
||||
return (
|
||||
<div className="ValidatingWebhookDetails">
|
||||
<DrawerItem name="API version">
|
||||
{webhookConfig.apiVersion}
|
||||
</DrawerItem>
|
||||
<DrawerTitle>Webhooks</DrawerTitle>
|
||||
{webhookConfig.getWebhooks()?.length == 0 && (
|
||||
<div style={{ opacity: 0.6 }}>No webhooks set</div>
|
||||
)}
|
||||
{webhookConfig.getWebhooks()?.map((webhook) => (
|
||||
<WebhookConfig webhook={webhook} key={webhook.name} />
|
||||
))}
|
||||
</div >
|
||||
);
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import {
|
||||
routeSpecificComponentInjectionToken,
|
||||
} from "../../routes/route-specific-component-injection-token";
|
||||
import validatingWebhookConfigurationsRouteInjectable
|
||||
from "../../../common/front-end-routing/routes/cluster/config/validating-webhook-configurations/validating-webhook-configurations-route.injectable";
|
||||
import { ValidatingWebhookConfigurations } from "./validating-webhook-configurations";
|
||||
|
||||
const validatingWebhookConfigurationsRouteComponentInjectable = getInjectable({
|
||||
id: "validating-webhook-configuration-route-component",
|
||||
|
||||
instantiate: (di) => ({
|
||||
route: di.inject(validatingWebhookConfigurationsRouteInjectable),
|
||||
Component: ValidatingWebhookConfigurations,
|
||||
}),
|
||||
|
||||
injectionToken: routeSpecificComponentInjectionToken,
|
||||
});
|
||||
|
||||
export default validatingWebhookConfigurationsRouteComponentInjectable;
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { computed } from "mobx";
|
||||
import { sidebarItemsInjectionToken } from "../layout/sidebar-items.injectable";
|
||||
import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import validatingWebhookConfigurationsRouteInjectable
|
||||
from "../../../common/front-end-routing/routes/cluster/config/validating-webhook-configurations/validating-webhook-configurations-route.injectable";
|
||||
import navigateToValidatingWebhookConfigurationsInjectable
|
||||
from "../../../common/front-end-routing/routes/cluster/config/validating-webhook-configurations/navigate-to-validating-webhook-configurations.injectable";
|
||||
import { configSidebarItemId } from "../config/config-sidebar-items.injectable";
|
||||
|
||||
const validatingWebhookConfigurationsSidebarItemsInjectable = getInjectable({
|
||||
id: "validating-webhook-configurations-sidebar-items",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(validatingWebhookConfigurationsRouteInjectable);
|
||||
const navigateToPage = di.inject(navigateToValidatingWebhookConfigurationsInjectable);
|
||||
const routeIsActive = di.inject(routeIsActiveInjectable, route);
|
||||
|
||||
return computed(() => [
|
||||
{
|
||||
id: "validating-webhook-configurations",
|
||||
parentId: configSidebarItemId,
|
||||
title: "Validating Webhook Configs",
|
||||
onClick: navigateToPage,
|
||||
isActive: routeIsActive,
|
||||
isVisible: route.isEnabled,
|
||||
orderNumber: 100,
|
||||
},
|
||||
]);
|
||||
},
|
||||
|
||||
injectionToken: sidebarItemsInjectionToken,
|
||||
});
|
||||
|
||||
export default validatingWebhookConfigurationsSidebarItemsInjectable;
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
||||
import { SiblingsInTabLayout } from "../layout/siblings-in-tab-layout";
|
||||
import type { ValidatingWebhookConfigurationStore } from "./validating-webhook-configuration-store";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import validatingWebhookConfigurationsStoreInjectable from "./validating-webhook-configuration-store.injectable";
|
||||
import { KubeObjectAge } from "../kube-object/age";
|
||||
|
||||
enum columnId {
|
||||
name = "name",
|
||||
webhooks = "webhooks",
|
||||
age = "age",
|
||||
}
|
||||
|
||||
interface Dependencies {
|
||||
store: ValidatingWebhookConfigurationStore;
|
||||
}
|
||||
|
||||
const NonInjectedValidatingWebhookConfigurations = observer((props: Dependencies) => {
|
||||
return (
|
||||
<SiblingsInTabLayout>
|
||||
<KubeObjectListLayout
|
||||
isConfigurable
|
||||
customizeHeader={({ searchProps, ...rest }) => ({
|
||||
...rest,
|
||||
searchProps: {
|
||||
...searchProps,
|
||||
placeholder: "Search...",
|
||||
},
|
||||
})}
|
||||
tableId="config_validating_webhook_configurations"
|
||||
className={"ValidatingWebhookConfigurations"}
|
||||
store={props.store}
|
||||
sortingCallbacks={{
|
||||
[columnId.name]: item => item.getName(),
|
||||
[columnId.webhooks]: item => item.getWebhooks().length,
|
||||
[columnId.age]: item => -item.getCreationTimestamp(),
|
||||
}}
|
||||
searchFilters={[
|
||||
item => item.getSearchFields(),
|
||||
item => item.getLabels(),
|
||||
]}
|
||||
renderHeaderTitle="Validating Webhook Configs"
|
||||
renderTableHeader={[
|
||||
{ title: "Name", className: "name", sortBy: columnId.name, id: columnId.name },
|
||||
{
|
||||
title: "Webhooks",
|
||||
sortBy: columnId.webhooks,
|
||||
id: columnId.webhooks,
|
||||
},
|
||||
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
|
||||
]}
|
||||
renderTableContents={item => [
|
||||
item.getName(),
|
||||
item.getWebhooks().length,
|
||||
<KubeObjectAge key="age" object={item} />,
|
||||
]}
|
||||
/>
|
||||
</SiblingsInTabLayout>
|
||||
);
|
||||
});
|
||||
|
||||
export const ValidatingWebhookConfigurations = withInjectables<Dependencies>(NonInjectedValidatingWebhookConfigurations, {
|
||||
getProps: (di, props) => ({
|
||||
...props,
|
||||
store: di.inject(validatingWebhookConfigurationsStoreInjectable),
|
||||
}),
|
||||
});
|
||||
Reference in new issue
Block a user