reactbridge-sdk 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -2158,12 +2158,15 @@ function AnalyticsDashboard({ onDirectiveAction, className = "", showRefresh = t
|
|
|
2158
2158
|
const theme = customTheme || contextTheme;
|
|
2159
2159
|
const [selectedAnalytics, setSelectedAnalytics] = React.useState(null);
|
|
2160
2160
|
const [directiveFilter, setDirectiveFilter] = React.useState("all");
|
|
2161
|
+
// Directive type filter (by action)
|
|
2162
|
+
const [directiveType, setDirectiveType] = React.useState("all");
|
|
2161
2163
|
// Fetch analytics configurations
|
|
2162
2164
|
const { configs, isLoading: configsLoading, error: configsError, refetch: refetchConfigs, } = useAnalyticsConfigs();
|
|
2163
2165
|
// Fetch latest result for selected analytics
|
|
2164
2166
|
const { result, isLoading: resultLoading, error: resultError, refetch: refetchResult, } = useAnalyticsResult(selectedAnalytics);
|
|
2165
2167
|
// Handle directive actions
|
|
2166
2168
|
const { handleAction, isProcessing } = useDirectiveAction(onDirectiveAction);
|
|
2169
|
+
const [processingId, setProcessingId] = React.useState(null);
|
|
2167
2170
|
// Auto-select first analytics if none selected
|
|
2168
2171
|
React.useEffect(() => {
|
|
2169
2172
|
if (configs && configs.length > 0 && !selectedAnalytics) {
|
|
@@ -2189,14 +2192,24 @@ function AnalyticsDashboard({ onDirectiveAction, className = "", showRefresh = t
|
|
|
2189
2192
|
}
|
|
2190
2193
|
};
|
|
2191
2194
|
const handleDirectiveAction = (directive, action) => __awaiter(this, void 0, void 0, function* () {
|
|
2195
|
+
setProcessingId(directive.directiveId);
|
|
2192
2196
|
yield handleAction(directive, action);
|
|
2197
|
+
setProcessingId(null);
|
|
2193
2198
|
// Refetch result to get updated directive statuses
|
|
2194
2199
|
refetchResult();
|
|
2195
2200
|
});
|
|
2201
|
+
// Get all unique directive types (actions)
|
|
2202
|
+
const directiveTypes = React.useMemo(() => {
|
|
2203
|
+
if (!(result === null || result === void 0 ? void 0 : result.directives))
|
|
2204
|
+
return [];
|
|
2205
|
+
const types = Array.from(new Set(result.directives.map((d) => d.action)));
|
|
2206
|
+
return types;
|
|
2207
|
+
}, [result === null || result === void 0 ? void 0 : result.directives]);
|
|
2208
|
+
// Filter directives by status and type
|
|
2196
2209
|
const filteredDirectives = (result === null || result === void 0 ? void 0 : result.directives.filter((d) => {
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
return
|
|
2210
|
+
const statusMatch = directiveFilter === "all" || d.status === directiveFilter;
|
|
2211
|
+
const typeMatch = directiveType === "all" || d.action === directiveType;
|
|
2212
|
+
return statusMatch && typeMatch;
|
|
2200
2213
|
})) || [];
|
|
2201
2214
|
const selectedConfig = configs === null || configs === void 0 ? void 0 : configs.find((c) => c.analyticsType === selectedAnalytics);
|
|
2202
2215
|
const proposedCount = (result === null || result === void 0 ? void 0 : result.directives.filter((d) => d.status === "proposed").length) || 0;
|
|
@@ -2468,6 +2481,8 @@ function AnalyticsDashboard({ onDirectiveAction, className = "", showRefresh = t
|
|
|
2468
2481
|
display: "flex",
|
|
2469
2482
|
justifyContent: "space-between",
|
|
2470
2483
|
alignItems: "center",
|
|
2484
|
+
flexWrap: "wrap",
|
|
2485
|
+
gap: theme.spacing.sm,
|
|
2471
2486
|
} },
|
|
2472
2487
|
React.createElement("h3", { style: { margin: 0, fontSize: theme.fontSizes.lg } }, "Recommended actions"),
|
|
2473
2488
|
React.createElement("div", { style: { display: "flex", gap: theme.spacing.xs } },
|
|
@@ -2502,7 +2517,22 @@ function AnalyticsDashboard({ onDirectiveAction, className = "", showRefresh = t
|
|
|
2502
2517
|
: theme.colors.text }) },
|
|
2503
2518
|
"Declined (",
|
|
2504
2519
|
declinedCount,
|
|
2505
|
-
")"))
|
|
2520
|
+
")")),
|
|
2521
|
+
directiveTypes.length > 1 && (React.createElement("select", { value: directiveType, onChange: e => setDirectiveType(e.target.value), style: {
|
|
2522
|
+
padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
|
|
2523
|
+
borderRadius: theme.borderRadius,
|
|
2524
|
+
border: `1px solid ${theme.colors.border}`,
|
|
2525
|
+
background: theme.colors.surface,
|
|
2526
|
+
color: theme.colors.text,
|
|
2527
|
+
fontSize: theme.fontSizes.sm,
|
|
2528
|
+
fontWeight: 500,
|
|
2529
|
+
outline: "none",
|
|
2530
|
+
minWidth: 120,
|
|
2531
|
+
marginLeft: theme.spacing.sm,
|
|
2532
|
+
cursor: "pointer",
|
|
2533
|
+
} },
|
|
2534
|
+
React.createElement("option", { value: "all" }, "All types"),
|
|
2535
|
+
directiveTypes.map(type => (React.createElement("option", { key: type, value: type }, type)))))),
|
|
2506
2536
|
filteredDirectives.length === 0 && (React.createElement("div", { style: placeholderStyle }, "No directives match the selected filter.")),
|
|
2507
2537
|
React.createElement("div", { style: {
|
|
2508
2538
|
display: "flex",
|
|
@@ -2547,8 +2577,16 @@ function AnalyticsDashboard({ onDirectiveAction, className = "", showRefresh = t
|
|
|
2547
2577
|
": ",
|
|
2548
2578
|
param.value)))))),
|
|
2549
2579
|
directive.status === "proposed" && (React.createElement("div", { style: { display: "flex", gap: theme.spacing.sm } },
|
|
2550
|
-
React.createElement("button", { type: "button", onClick: () => handleDirectiveAction(directive, "execute"), disabled: isProcessing, style: Object.assign(Object.assign({}, pillStyle(theme.colors.success)), { border: "none", cursor: isProcessing
|
|
2551
|
-
|
|
2580
|
+
React.createElement("button", { type: "button", onClick: () => handleDirectiveAction(directive, "execute"), disabled: isProcessing && processingId === directive.directiveId, style: Object.assign(Object.assign({}, pillStyle(theme.colors.success)), { border: "none", cursor: isProcessing && processingId === directive.directiveId
|
|
2581
|
+
? "not-allowed"
|
|
2582
|
+
: "pointer" }) }, isProcessing && processingId === directive.directiveId
|
|
2583
|
+
? "Processing..."
|
|
2584
|
+
: "Execute"),
|
|
2585
|
+
React.createElement("button", { type: "button", onClick: () => handleDirectiveAction(directive, "decline"), disabled: isProcessing && processingId === directive.directiveId, style: Object.assign(Object.assign({}, pillStyle(theme.colors.error)), { border: "none", cursor: isProcessing && processingId === directive.directiveId
|
|
2586
|
+
? "not-allowed"
|
|
2587
|
+
: "pointer" }) }, isProcessing && processingId === directive.directiveId
|
|
2588
|
+
? "Processing..."
|
|
2589
|
+
: "Decline"))))))))))))));
|
|
2552
2590
|
}
|
|
2553
2591
|
|
|
2554
2592
|
exports.AnalyticsAPI = AnalyticsAPI;
|