Skip to content

Commit e7bd30e

Browse files
reeceyangConvex, Inc.
authored andcommitted
dash: fix integrations panel card sorting (#43616)
GitOrigin-RevId: f511f08e159978bf17e99739c7b65699bad5b99d
1 parent 6caca83 commit e7bd30e

File tree

1 file changed

+24
-29
lines changed
  • npm-packages/dashboard-common/src/features/settings/components/integrations

1 file changed

+24
-29
lines changed

npm-packages/dashboard-common/src/features/settings/components/integrations/Integrations.tsx

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ export function Integrations({
4545
const streamingExportEntitlementGranted =
4646
entitlements?.streamingExportEnabled;
4747

48-
// Sort the configured and unconfigured integrations in the order specified by LOG_INTEGRATIONS
4948
const configuredIntegrationsMap = Object.fromEntries(
5049
integrations.map((integration) => [integration.config.type, integration]),
5150
);
@@ -58,13 +57,7 @@ export function Integrations({
5857
existing: existing ?? null,
5958
} as LogIntegration;
6059
},
61-
).sort((a: LogIntegration, b: LogIntegration) => {
62-
// Show configured integrations first
63-
if (a.existing !== null && b.existing === null) {
64-
return -1;
65-
}
66-
return 0;
67-
});
60+
);
6861

6962
const authIntegrations: AuthIntegration[] = workosIntegrationEnabled
7063
? [
@@ -83,12 +76,6 @@ export function Integrations({
8376
kind,
8477
existing: existing ?? null,
8578
} as ExceptionReportingIntegration;
86-
}).sort((a, b) => {
87-
// Show configured integrations first
88-
if (a.existing !== null && b.existing === null) {
89-
return -1;
90-
}
91-
return 0;
9279
});
9380

9481
const devCallouts = [];
@@ -118,6 +105,21 @@ export function Integrations({
118105
const streamingExportIntegrationUnavailableReason =
119106
!streamingExportEntitlementGranted ? "MissingEntitlement" : null;
120107

108+
// Show configured integrations first
109+
const allIntegrations = [
110+
...authIntegrations,
111+
...exceptionReportingIntegrations,
112+
...logIntegrations,
113+
].sort((a, b) => {
114+
if (a.existing !== null && b.existing === null) {
115+
return -1;
116+
}
117+
if (a.existing === null && b.existing !== null) {
118+
return 1;
119+
}
120+
return 0;
121+
});
122+
121123
return (
122124
<div className="flex flex-col gap-4">
123125
<Sheet className="flex flex-col gap-4">
@@ -137,21 +139,14 @@ export function Integrations({
137139
</div>
138140
</div>
139141
<div className="flex flex-col gap-2">
140-
{[
141-
...authIntegrations,
142-
...exceptionReportingIntegrations,
143-
...logIntegrations,
144-
]
145-
.sort((a, b) =>
146-
a.existing !== null && b.existing === null ? -1 : 0,
147-
)
148-
.map((i) => (
149-
<PanelCard
150-
integration={i}
151-
unavailableReason={logIntegrationUnvaliableReason}
152-
teamSlug={team?.slug}
153-
/>
154-
))}
142+
{allIntegrations.map((i) => (
143+
<PanelCard
144+
key={i.kind}
145+
integration={i}
146+
unavailableReason={logIntegrationUnvaliableReason}
147+
teamSlug={team?.slug}
148+
/>
149+
))}
155150
{EXPORT_INTEGRATIONS.map((i) => (
156151
<PanelCard
157152
integration={{ kind: i }}

0 commit comments

Comments
 (0)