From 6e4fa31a49d485384eaacf7dcb2abc7ee9ee2273 Mon Sep 17 00:00:00 2001 From: steve richards Date: Fri, 16 Oct 2020 08:46:30 +0100 Subject: [PATCH] Sort Pod environment values in alphabetical order (#1075) * Sort Pod environment values in alphabetical order Fixes: #739 Signed-off-by: Steve Richards * Consolidated to a single lodash import. Corrected Lint failure - Removed the additional import of flatten and updated as needed; - Changed the variabled `orderedEnv` to be a const; Signed-off-by: Steve Richards Co-authored-by: Steve Richards --- .../components/+workloads-pods/pod-container-env.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/+workloads-pods/pod-container-env.tsx b/src/renderer/components/+workloads-pods/pod-container-env.tsx index fb779a9eaa..2071c959d1 100644 --- a/src/renderer/components/+workloads-pods/pod-container-env.tsx +++ b/src/renderer/components/+workloads-pods/pod-container-env.tsx @@ -1,7 +1,6 @@ import "./pod-container-env.scss"; import React, { useEffect, useState } from "react"; -import flatten from "lodash/flatten"; import { observer } from "mobx-react"; import { Trans } from "@lingui/macro"; import { IPodContainer, Secret } from "../../api/endpoints"; @@ -11,6 +10,7 @@ import { secretsStore } from "../+config-secrets/secrets.store"; import { configMapsStore } from "../+config-maps/config-maps.store"; import { Icon } from "../icon"; import { base64, cssNames } from "../../utils"; +import _ from "lodash"; interface Props { container: IPodContainer; @@ -40,7 +40,9 @@ export const ContainerEnvironment = observer((props: Props) => { ) const renderEnv = () => { - return env.map(variable => { + const orderedEnv = _.sortBy(env, 'name'); + + return orderedEnv.map(variable => { const { name, value, valueFrom } = variable let secretValue = null @@ -89,7 +91,7 @@ export const ContainerEnvironment = observer((props: Props) => { )) }) - return flatten(envVars) + return _.flatten(envVars) } return (