mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
cleanup Lens repo with tighter linting
Signed-off-by: Sebastian Malton <smalton@mirantis.com>
This commit is contained in:
1 parent
e468105143
commit
b1ff34879a
470 files changed
+8447
-7443
No files matched your search
@@ -1,3 +1,3 @@
|
||||
export * from "./pod-security-policies.route"
|
||||
export * from "./pod-security-policies"
|
||||
export * from "./pod-security-policy-details"
|
||||
export * from "./pod-security-policies.route";
|
||||
export * from "./pod-security-policies";
|
||||
export * from "./pod-security-policy-details";
|
||||
@@ -1,8 +1,8 @@
|
||||
import { RouteProps } from "react-router"
|
||||
import { RouteProps } from "react-router";
|
||||
import { buildURL } from "../../navigation";
|
||||
|
||||
export const podSecurityPoliciesRoute: RouteProps = {
|
||||
path: "/pod-security-policies"
|
||||
}
|
||||
};
|
||||
|
||||
export const podSecurityPoliciesURL = buildURL(podSecurityPoliciesRoute.path)
|
||||
export const podSecurityPoliciesURL = buildURL(podSecurityPoliciesRoute.path);
|
||||
@@ -8,5 +8,5 @@ export class PodSecurityPoliciesStore extends KubeObjectStore<PodSecurityPolicy>
|
||||
api = pspApi
|
||||
}
|
||||
|
||||
export const podSecurityPoliciesStore = new PodSecurityPoliciesStore()
|
||||
export const podSecurityPoliciesStore = new PodSecurityPoliciesStore();
|
||||
apiManager.registerStore(pspApi, podSecurityPoliciesStore);
|
||||
@@ -18,22 +18,22 @@ enum sortBy {
|
||||
|
||||
@observer
|
||||
export class PodSecurityPolicies extends React.Component {
|
||||
render() {
|
||||
render(): JSX.Element {
|
||||
return (
|
||||
<KubeObjectListLayout
|
||||
className="PodSecurityPolicies"
|
||||
isClusterScoped={true}
|
||||
store={podSecurityPoliciesStore}
|
||||
sortingCallbacks={{
|
||||
[sortBy.name]: (item: PodSecurityPolicy) => item.getName(),
|
||||
[sortBy.volumes]: (item: PodSecurityPolicy) => item.getVolumes(),
|
||||
[sortBy.privileged]: (item: PodSecurityPolicy) => +item.isPrivileged(),
|
||||
[sortBy.age]: (item: PodSecurityPolicy) => item.metadata.creationTimestamp,
|
||||
[sortBy.name]: (item: PodSecurityPolicy): string => item.getName(),
|
||||
[sortBy.volumes]: (item: PodSecurityPolicy): string[] => item.getVolumes(),
|
||||
[sortBy.privileged]: (item: PodSecurityPolicy): number => +item.isPrivileged(),
|
||||
[sortBy.age]: (item: PodSecurityPolicy): string => item.metadata.creationTimestamp,
|
||||
}}
|
||||
searchFilters={[
|
||||
(item: PodSecurityPolicy) => item.getSearchFields(),
|
||||
(item: PodSecurityPolicy) => item.getVolumes(),
|
||||
(item: PodSecurityPolicy) => Object.values(item.getRules()),
|
||||
(item: PodSecurityPolicy): string[] => item.getSearchFields(),
|
||||
(item: PodSecurityPolicy): string[] => item.getVolumes(),
|
||||
(item: PodSecurityPolicy): string[] => Object.values(item.getRules()),
|
||||
]}
|
||||
renderHeaderTitle={<Trans>Pod Security Policies</Trans>}
|
||||
renderTableHeader={[
|
||||
@@ -42,28 +42,28 @@ export class PodSecurityPolicies extends React.Component {
|
||||
{ title: <Trans>Volumes</Trans>, className: "volumes", sortBy: sortBy.volumes },
|
||||
{ title: <Trans>Age</Trans>, className: "age", sortBy: sortBy.age },
|
||||
]}
|
||||
renderTableContents={(item: PodSecurityPolicy) => {
|
||||
renderTableContents={(item: PodSecurityPolicy): (string | number | JSX.Element)[] => {
|
||||
return [
|
||||
item.getName(),
|
||||
item.isPrivileged() ? <Trans>Yes</Trans> : <Trans>No</Trans>,
|
||||
item.getVolumes().join(", "),
|
||||
item.getAge(),
|
||||
]
|
||||
];
|
||||
}}
|
||||
renderItemMenu={(item: PodSecurityPolicy) => {
|
||||
return <PodSecurityPolicyMenu object={item}/>
|
||||
renderItemMenu={(item: PodSecurityPolicy): JSX.Element => {
|
||||
return <PodSecurityPolicyMenu object={item}/>;
|
||||
}}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export function PodSecurityPolicyMenu(props: KubeObjectMenuProps<PodSecurityPolicy>) {
|
||||
export function PodSecurityPolicyMenu(props: KubeObjectMenuProps<PodSecurityPolicy>): JSX.Element {
|
||||
return (
|
||||
<KubeObjectMenu {...props}/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
apiManager.registerViews(pspApi, {
|
||||
Menu: PodSecurityPolicyMenu,
|
||||
})
|
||||
});
|
||||
+13
-11
@@ -21,8 +21,10 @@ export class PodSecurityPolicyDetails extends React.Component<Props> {
|
||||
group: {
|
||||
rule: string;
|
||||
ranges?: { max: number; min: number }[];
|
||||
}) {
|
||||
if (!group) return;
|
||||
}): JSX.Element {
|
||||
if (!group) {
|
||||
return;
|
||||
}
|
||||
const { rule, ranges } = group;
|
||||
return (
|
||||
<>
|
||||
@@ -33,24 +35,24 @@ export class PodSecurityPolicyDetails extends React.Component<Props> {
|
||||
{ranges && (
|
||||
<DrawerItem name={<Trans>Ranges (Min-Max)</Trans>} labelsOnly>
|
||||
{ranges.map(({ min, max }, index) => {
|
||||
return <Badge key={index} label={`${min} - ${max}`}/>
|
||||
return <Badge key={index} label={`${min} - ${max}`}/>;
|
||||
})}
|
||||
</DrawerItem>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
render(): JSX.Element {
|
||||
const { object: psp } = this.props;
|
||||
if (!psp) {
|
||||
return null;
|
||||
}
|
||||
const {
|
||||
allowedHostPaths, allowedCapabilities, allowedCSIDrivers, allowedFlexVolumes, allowedProcMountTypes,
|
||||
allowedUnsafeSysctls, allowPrivilegeEscalation, defaultAddCapabilities, defaultAllowPrivilegeEscalation,
|
||||
forbiddenSysctls, fsGroup, hostIPC, hostNetwork, hostPID, hostPorts, privileged, readOnlyRootFilesystem,
|
||||
requiredDropCapabilities, runAsGroup, runAsUser, runtimeClass, seLinux, supplementalGroups, volumes
|
||||
allowedUnsafeSysctls, allowPrivilegeEscalation, defaultAddCapabilities, forbiddenSysctls, fsGroup,
|
||||
hostIPC, hostNetwork, hostPID, hostPorts, privileged, readOnlyRootFilesystem, requiredDropCapabilities,
|
||||
runAsGroup, runAsUser, runtimeClass, seLinux, supplementalGroups, volumes
|
||||
} = psp.spec;
|
||||
return (
|
||||
<div className="PodSecurityPolicyDetails">
|
||||
@@ -137,7 +139,7 @@ export class PodSecurityPolicyDetails extends React.Component<Props> {
|
||||
{hostPorts && (
|
||||
<DrawerItem name={<Trans>Host Ports (Min-Max)</Trans>} labelsOnly>
|
||||
{hostPorts.map(({ min, max }, index) => {
|
||||
return <Badge key={index} label={`${min} - ${max}`}/>
|
||||
return <Badge key={index} label={`${min} - ${max}`}/>;
|
||||
})}
|
||||
</DrawerItem>
|
||||
)}
|
||||
@@ -156,7 +158,7 @@ export class PodSecurityPolicyDetails extends React.Component<Props> {
|
||||
<TableCell>{pathPrefix}</TableCell>
|
||||
<TableCell>{readOnly ? <Trans>Yes</Trans> : <Trans>No</Trans>}</TableCell>
|
||||
</TableRow>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</Table>
|
||||
</>
|
||||
@@ -205,7 +207,7 @@ export class PodSecurityPolicyDetails extends React.Component<Props> {
|
||||
)}
|
||||
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user