1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +02:00

chore(deps): upgrade tailwind and prettier [EE-5218] (#10068)

This commit is contained in:
Chaim Lev-Ari 2023-09-04 16:20:36 +01:00 committed by GitHub
parent cb7377ead6
commit 0e2eb17220
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
69 changed files with 444 additions and 316 deletions

View file

@ -196,14 +196,17 @@ function getUniqNames(appName: string, services: ServiceFormValues[]) {
function getServiceTypeCounts(
services: ServiceFormValues[]
): Record<ServiceTypeValue, number> {
return services.reduce((acc, service) => {
const type = serviceTypeEnumsToValues[service.Type];
const count = acc[type];
return {
...acc,
[type]: count ? count + 1 : 1,
};
}, {} as Record<ServiceTypeValue, number>);
return services.reduce(
(acc, service) => {
const type = serviceTypeEnumsToValues[service.Type];
const count = acc[type];
return {
...acc,
[type]: count ? count + 1 : 1,
};
},
{} as Record<ServiceTypeValue, number>
);
}
/**
@ -213,15 +216,18 @@ function getServiceTypeHasErrors(
services: ServiceFormValues[],
errors: FormikErrors<ServiceFormValues[] | undefined>
): Record<ServiceTypeValue, boolean> {
return services.reduce((acc, service, index) => {
const type = serviceTypeEnumsToValues[service.Type];
const serviceHasErrors = !!errors?.[index];
// if the service type already has an error, don't overwrite it
if (acc[type] === true) return acc;
// otherwise, set the error to the value of serviceHasErrors
return {
...acc,
[type]: serviceHasErrors,
};
}, {} as Record<ServiceTypeValue, boolean>);
return services.reduce(
(acc, service, index) => {
const type = serviceTypeEnumsToValues[service.Type];
const serviceHasErrors = !!errors?.[index];
// if the service type already has an error, don't overwrite it
if (acc[type] === true) return acc;
// otherwise, set the error to the value of serviceHasErrors
return {
...acc,
[type]: serviceHasErrors,
};
},
{} as Record<ServiceTypeValue, boolean>
);
}

View file

@ -30,7 +30,7 @@ export function PublishingExplaination() {
ingresses
</a>
:
<ul className="mt-3 ml-5 [&>li]:mb-3 [&>li>ul>li]:ml-5">
<ul className="ml-5 mt-3 [&>li>ul>li]:ml-5 [&>li]:mb-3">
<li>
<b>Inside</b> the cluster{' '}
<b>

View file

@ -97,15 +97,16 @@ function getIngressPathsForAppServices(
if (!ingress.Paths) {
return [];
}
const matchingIngressPaths = ingress.Paths?.filter((path) =>
services?.some((service) => {
const servicePorts = service.spec?.ports?.map((port) => port.port);
// include the ingress if the ingress path has a matching service name and port
return (
path.ServiceName === service.metadata?.name &&
servicePorts?.includes(path.Port)
);
})
const matchingIngressPaths = ingress.Paths?.filter(
(path) =>
services?.some((service) => {
const servicePorts = service.spec?.ports?.map((port) => port.port);
// include the ingress if the ingress path has a matching service name and port
return (
path.ServiceName === service.metadata?.name &&
servicePorts?.includes(path.Port)
);
})
).map((path) => {
const secure =
(ingress.TLS &&

View file

@ -84,7 +84,7 @@ async function getApplicationsForNamespace(
// if not known, get the type of an application (Deployment, DaemonSet, StatefulSet or naked pod) by name
export async function getApplication<
T extends Application | string = Application
T extends Application | string = Application,
>(
environmentId: EnvironmentId,
namespace: string,
@ -233,7 +233,7 @@ async function patchApplicationByKind<T extends Application>(
}
async function getApplicationByKind<
T extends Application | string = Application
T extends Application | string = Application,
>(
environmentId: EnvironmentId,
namespace: string,

View file

@ -12,7 +12,7 @@ import { parseKubernetesAxiosError } from '../axiosError';
// when yaml is set to true, the expected return type is a string
export function useHorizontalAutoScalarQuery<
T extends HorizontalPodAutoscaler | string = HorizontalPodAutoscaler
T extends HorizontalPodAutoscaler | string = HorizontalPodAutoscaler,
>(
environmentId: EnvironmentId,
namespace: string,
@ -62,7 +62,7 @@ export async function getNamespaceHorizontalPodAutoscalers(
}
export async function getNamespaceHorizontalPodAutoscaler<
T extends HorizontalPodAutoscaler | string = HorizontalPodAutoscaler
T extends HorizontalPodAutoscaler | string = HorizontalPodAutoscaler,
>(
environmentId: EnvironmentId,
namespace: string,

View file

@ -233,23 +233,31 @@ export function getRollbackPatchPayload(
// keep the annotations to skip from the deployment, in the patch
const applicationAnnotations = application.metadata?.annotations || {};
const applicationAnnotationsInPatch =
unchangedAnnotationKeysForRollbackPatch.reduce((acc, annotationKey) => {
if (applicationAnnotations[annotationKey]) {
acc[annotationKey] = applicationAnnotations[annotationKey];
}
return acc;
}, {} as Record<string, string>);
unchangedAnnotationKeysForRollbackPatch.reduce(
(acc, annotationKey) => {
if (applicationAnnotations[annotationKey]) {
acc[annotationKey] = applicationAnnotations[annotationKey];
}
return acc;
},
{} as Record<string, string>
);
// add any annotations from the target revision that shouldn't be skipped
const revisionAnnotations = previousRevision.metadata?.annotations || {};
const revisionAnnotationsInPatch = Object.entries(
revisionAnnotations
).reduce((acc, [annotationKey, annotationValue]) => {
if (!unchangedAnnotationKeysForRollbackPatch.includes(annotationKey)) {
acc[annotationKey] = annotationValue;
}
return acc;
}, {} as Record<string, string>);
).reduce(
(acc, [annotationKey, annotationValue]) => {
if (
!unchangedAnnotationKeysForRollbackPatch.includes(annotationKey)
) {
acc[annotationKey] = annotationValue;
}
return acc;
},
{} as Record<string, string>
);
const patchAnnotations = {
...applicationAnnotationsInPatch,

View file

@ -14,11 +14,12 @@ export function getIsConfigMapInUse(
? app?.spec
: app?.spec?.template?.spec;
const hasEnvVarReference = appSpec?.containers.some((container) =>
container.env?.some(
(envVar) =>
envVar.valueFrom?.configMapKeyRef?.name === configMap.metadata?.name
)
const hasEnvVarReference = appSpec?.containers.some(
(container) =>
container.env?.some(
(envVar) =>
envVar.valueFrom?.configMapKeyRef?.name === configMap.metadata?.name
)
);
const hasVolumeReference = appSpec?.volumes?.some(
(volume) => volume.configMap?.name === configMap.metadata?.name

View file

@ -11,11 +11,12 @@ export function getIsSecretInUse(secret: Secret, applications: Application[]) {
? app?.spec
: app?.spec?.template?.spec;
const hasEnvVarReference = appSpec?.containers.some((container) =>
container.env?.some(
(envVar) =>
envVar.valueFrom?.secretKeyRef?.name === secret.metadata?.name
)
const hasEnvVarReference = appSpec?.containers.some(
(container) =>
container.env?.some(
(envVar) =>
envVar.valueFrom?.secretKeyRef?.name === secret.metadata?.name
)
);
const hasVolumeReference = appSpec?.volumes?.some(
(volume) => volume.secret?.secretName === secret.metadata?.name

View file

@ -44,7 +44,7 @@ export function Annotations({
/>
</div>
{errors[`annotations.key[${i}]`] && (
<FormError className="mt-1 !mb-0">
<FormError className="!mb-0 mt-1">
{errors[`annotations.key[${i}]`]}
</FormError>
)}
@ -64,7 +64,7 @@ export function Annotations({
/>
</div>
{errors[`annotations.value[${i}]`] && (
<FormError className="mt-1 !mb-0">
<FormError className="!mb-0 mt-1">
{errors[`annotations.value[${i}]`]}
</FormError>
)}

View file

@ -79,7 +79,7 @@ export function CreateIngressView() {
string[],
Ingress[],
Record<string, number>,
Record<string, string>
Record<string, string>,
] => {
const ruleCounterByNamespace: Record<string, number> = {};
const hostWithTLS: Record<string, string> = {};

View file

@ -311,7 +311,7 @@ export function IngressForm({
<TooltipWithChildren message="Use annotations to configure options for an ingress. Review Nginx or Traefik documentation to find the annotations supported by your choice of ingress type.">
<span>
<Button
className="btn btn-sm btn-light mb-2 !ml-0"
className="btn btn-sm btn-light !ml-0 mb-2"
onClick={() => addNewAnnotation()}
icon={Plus}
>
@ -406,13 +406,13 @@ export function IngressForm({
/>
</InputGroup>
{errors[`hosts[${hostIndex}].host`] && (
<FormError className="mt-1 !mb-0">
<FormError className="!mb-0 mt-1">
{errors[`hosts[${hostIndex}].host`]}
</FormError>
)}
</div>
<div className="form-group col-sm-6 col-lg-4 !pr-0 !pl-2">
<div className="form-group col-sm-6 col-lg-4 !pl-2 !pr-0">
<InputGroup size="small">
<InputGroup.Addon>TLS secret</InputGroup.Addon>
<Select
@ -490,7 +490,7 @@ export function IngressForm({
{host.Paths.map((path, pathIndex) => (
<div
className="row path mt-5 !mb-5"
className="row path !mb-5 mt-5"
key={`path_${path.Key}}`}
>
<div className="form-group col-sm-3 col-xl-2 !m-0 !pl-0">
@ -531,7 +531,7 @@ export function IngressForm({
{errors[
`hosts[${hostIndex}].paths[${pathIndex}].servicename`
] && (
<FormError className="error-inline mt-1 !mb-0">
<FormError className="error-inline !mb-0 mt-1">
{
errors[
`hosts[${hostIndex}].paths[${pathIndex}].servicename`
@ -587,7 +587,7 @@ export function IngressForm({
{errors[
`hosts[${hostIndex}].paths[${pathIndex}].serviceport`
] && (
<FormError className="mt-1 !mb-0">
<FormError className="!mb-0 mt-1">
{
errors[
`hosts[${hostIndex}].paths[${pathIndex}].serviceport`
@ -639,7 +639,7 @@ export function IngressForm({
{errors[
`hosts[${hostIndex}].paths[${pathIndex}].pathType`
] && (
<FormError className="mt-1 !mb-0">
<FormError className="!mb-0 mt-1">
{
errors[
`hosts[${hostIndex}].paths[${pathIndex}].pathType`
@ -672,7 +672,7 @@ export function IngressForm({
{errors[
`hosts[${hostIndex}].paths[${pathIndex}].path`
] && (
<FormError className="mt-1 !mb-0">
<FormError className="!mb-0 mt-1">
{
errors[
`hosts[${hostIndex}].paths[${pathIndex}].path`