mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 18:27:36 +00:00
improvement: add support for ordering by destination
This commit is contained in:
+2
-1
@@ -14,7 +14,8 @@ export const getIntegrationDestination = (integration: TIntegration) =>
|
|||||||
(integration.scope === "github-org" && `${integration.owner}`) ||
|
(integration.scope === "github-org" && `${integration.owner}`) ||
|
||||||
(["aws-parameter-store", "rundeck"].includes(integration.integration) && `${integration.path}`) ||
|
(["aws-parameter-store", "rundeck"].includes(integration.integration) && `${integration.path}`) ||
|
||||||
(integration.scope?.startsWith("github-") && `${integration.owner}/${integration.app}`) ||
|
(integration.scope?.startsWith("github-") && `${integration.owner}/${integration.app}`) ||
|
||||||
integration.app;
|
integration.app ||
|
||||||
|
"-";
|
||||||
|
|
||||||
export const IntegrationDetails = ({ integration }: Props) => {
|
export const IntegrationDetails = ({ integration }: Props) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
+21
-4
@@ -36,8 +36,8 @@ import { usePagination, useResetPageHelper } from "@app/hooks";
|
|||||||
import { OrderByDirection } from "@app/hooks/api/generic/types";
|
import { OrderByDirection } from "@app/hooks/api/generic/types";
|
||||||
import { useSyncIntegration } from "@app/hooks/api/integrations/queries";
|
import { useSyncIntegration } from "@app/hooks/api/integrations/queries";
|
||||||
import { TCloudIntegration, TIntegration } from "@app/hooks/api/integrations/types";
|
import { TCloudIntegration, TIntegration } from "@app/hooks/api/integrations/types";
|
||||||
import { getIntegrationDestination } from "@app/views/IntegrationsPage/components/IntegrationsSection/components/IntegrationDetails";
|
|
||||||
|
|
||||||
|
import { getIntegrationDestination } from "./IntegrationDetails";
|
||||||
import { IntegrationRow } from "./IntegrationRow";
|
import { IntegrationRow } from "./IntegrationRow";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -53,7 +53,8 @@ enum IntegrationsOrderBy {
|
|||||||
App = "app",
|
App = "app",
|
||||||
Status = "status",
|
Status = "status",
|
||||||
SecretPath = "secretPath",
|
SecretPath = "secretPath",
|
||||||
Environment = "environment"
|
Environment = "environment",
|
||||||
|
Destination = "destination"
|
||||||
}
|
}
|
||||||
|
|
||||||
enum IntegrationStatus {
|
enum IntegrationStatus {
|
||||||
@@ -144,7 +145,7 @@ export const IntegrationsTable = ({
|
|||||||
.includes(search.trim().toLowerCase()) ||
|
.includes(search.trim().toLowerCase()) ||
|
||||||
secretPath.replace("-", " ").toLowerCase().includes(search.trim().toLowerCase()) ||
|
secretPath.replace("-", " ").toLowerCase().includes(search.trim().toLowerCase()) ||
|
||||||
getIntegrationDestination(integration)
|
getIntegrationDestination(integration)
|
||||||
?.toLowerCase()
|
.toLowerCase()
|
||||||
.includes(search.trim().toLowerCase()) ||
|
.includes(search.trim().toLowerCase()) ||
|
||||||
environmentMap
|
environmentMap
|
||||||
.get(envId)
|
.get(envId)
|
||||||
@@ -168,6 +169,10 @@ export const IntegrationsTable = ({
|
|||||||
.localeCompare(
|
.localeCompare(
|
||||||
(environmentMap.get(integrationTwo.envId)?.name ?? "-").toLowerCase()
|
(environmentMap.get(integrationTwo.envId)?.name ?? "-").toLowerCase()
|
||||||
);
|
);
|
||||||
|
case IntegrationsOrderBy.Destination:
|
||||||
|
return getIntegrationDestination(integrationOne)
|
||||||
|
.toLowerCase()
|
||||||
|
.localeCompare(getIntegrationDestination(integrationTwo).toLowerCase());
|
||||||
case IntegrationsOrderBy.Status:
|
case IntegrationsOrderBy.Status:
|
||||||
if (typeof integrationOne.isSynced !== "boolean") return 1; // Place undefined at the end
|
if (typeof integrationOne.isSynced !== "boolean") return 1; // Place undefined at the end
|
||||||
if (typeof integrationTwo.isSynced !== "boolean") return -1;
|
if (typeof integrationTwo.isSynced !== "boolean") return -1;
|
||||||
@@ -365,7 +370,19 @@ export const IntegrationsTable = ({
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
</Th>
|
</Th>
|
||||||
<Th className="w-1/5">Destination</Th>
|
<Th className="w-1/5">
|
||||||
|
<div className="flex items-center">
|
||||||
|
Destination
|
||||||
|
<IconButton
|
||||||
|
variant="plain"
|
||||||
|
className={getClassName(IntegrationsOrderBy.Destination)}
|
||||||
|
ariaLabel="sort"
|
||||||
|
onClick={() => handleSort(IntegrationsOrderBy.Destination)}
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon icon={getColSortIcon(IntegrationsOrderBy.Destination)} />
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
|
</Th>
|
||||||
<Th className="w-1/5">
|
<Th className="w-1/5">
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
Status
|
Status
|
||||||
|
|||||||
Reference in New Issue
Block a user