Applied pnpm prettier rules to code.

This commit is contained in:
djeinstine 2024-11-11 09:31:18 +00:00
parent ac997ea841
commit 94a934ec65

View File

@ -38,16 +38,10 @@ export async function checkCRD(name) {
} }
const getSchemaFromGateway = async (gatewayRef) => { const getSchemaFromGateway = async (gatewayRef) => {
const schema = await crd
const schema = await crd.getNamespacedCustomObject( .getNamespacedCustomObject(apiGroup, version, gatewayRef.namespace, "gateways", gatewayRef.name)
apiGroup,
version,
gatewayRef.namespace,
"gateways",
gatewayRef.name,
)
.then((response) => { .then((response) => {
const listner = response.body.spec.listeners.filter((listener) => listener.name === gatewayRef.sectionName)[0] const listner = response.body.spec.listeners.filter((listener) => listener.name === gatewayRef.sectionName)[0];
return listner.protocol.toLowerCase(); return listner.protocol.toLowerCase();
}) })
.catch((error) => { .catch((error) => {
@ -73,16 +67,10 @@ function getUrlFromIngress(ingress) {
} }
async function getHttpRouteList() { async function getHttpRouteList() {
// httproutes // httproutes
const getHttpRoute = (async (namespace) => const getHttpRoute = async (namespace) =>
crd crd
.listNamespacedCustomObject( .listNamespacedCustomObject(apiGroup, version, namespace, "httproutes")
apiGroup,
version,
namespace,
"httproutes"
)
.then((response) => { .then((response) => {
const [httpRoute] = response.body.items; const [httpRoute] = response.body.items;
return httpRoute; return httpRoute;
@ -91,8 +79,7 @@ async function getHttpRouteList() {
logger.error("Error getting httproutes: %d %s %s", error.statusCode, error.body, error.response); logger.error("Error getting httproutes: %d %s %s", error.statusCode, error.body, error.response);
logger.debug(error); logger.debug(error);
return null; return null;
}) });
)
// namespaces // namespaces
const namespaces = await core const namespaces = await core
@ -106,18 +93,14 @@ async function getHttpRouteList() {
let httpRouteList = []; let httpRouteList = [];
if (namespaces) { if (namespaces) {
const httpRouteListUnfiltered = await Promise.all( const httpRouteListUnfiltered = await Promise.all(
namespaces namespaces.map(async (namespace) => {
.map( async(namespace) => {
const httpRoute = await getHttpRoute(namespace); const httpRoute = await getHttpRoute(namespace);
return httpRoute; return httpRoute;
}) }),
) );
httpRouteList = httpRouteListUnfiltered
.filter((httpRoute) => httpRoute !== undefined)
httpRouteList = httpRouteListUnfiltered.filter((httpRoute) => httpRoute !== undefined);
} }
return httpRouteList; return httpRouteList;
} }