@gen3/workspaces 0.12.77 → 0.12.79
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/dts/components/CodingAssistantPanel/CodingAssistantPanel.stories.d.ts +1 -1
- package/dist/dts/components/CodingAssistantPanel/CodingAssistantPanel.stories.d.ts.map +1 -1
- package/dist/dts/components/CodingAssistantPanel/CodingAssistantPanel.stories.js +2 -2
- package/dist/dts/components/CodingAssistantPanel/MessageBubble.stories.d.ts +1 -1
- package/dist/dts/components/CodingAssistantPanel/MessageBubble.stories.d.ts.map +1 -1
- package/dist/dts/components/CodingAssistantPanel/MessageBubble.stories.js +7 -7
- package/dist/dts/components/CompactDictionaryPanel/CompactDictionaryPanel.stories.d.ts +1 -1
- package/dist/dts/components/CompactDictionaryPanel/CompactDictionaryPanel.stories.d.ts.map +1 -1
- package/dist/dts/components/CostTracker.d.ts.map +1 -1
- package/dist/dts/components/CostTracker.js +62 -36
- package/dist/dts/components/CostTracker.js.map +1 -1
- package/dist/dts/components/DataToolsPanel.stories.d.ts +1 -1
- package/dist/dts/components/DataToolsPanel.stories.d.ts.map +1 -1
- package/dist/dts/components/DataToolsPanel.stories.js +2 -2
- package/dist/dts/components/DataToolsRail.stories.d.ts +1 -1
- package/dist/dts/components/DataToolsRail.stories.d.ts.map +1 -1
- package/dist/dts/components/InfrastructureRightPanel.stories.d.ts +1 -1
- package/dist/dts/components/InfrastructureRightPanel.stories.d.ts.map +1 -1
- package/dist/dts/components/KernelLifecyclePanel/ConnectionStatusBadge.stories.d.ts +1 -1
- package/dist/dts/components/KernelLifecyclePanel/ConnectionStatusBadge.stories.d.ts.map +1 -1
- package/dist/dts/components/KernelLifecyclePanel/KernelLifecyclePanel.stories.d.ts +1 -1
- package/dist/dts/components/KernelLifecyclePanel/KernelLifecyclePanel.stories.d.ts.map +1 -1
- package/dist/dts/components/MicroContainerPanel.stories.d.ts +1 -1
- package/dist/dts/components/MicroContainerPanel.stories.d.ts.map +1 -1
- package/dist/dts/components/TierSelectorLanding.stories.d.ts +1 -1
- package/dist/dts/components/TierSelectorLanding.stories.d.ts.map +1 -1
- package/dist/dts/components/UpgradeActionsPanel.stories.d.ts +1 -1
- package/dist/dts/components/UpgradeActionsPanel.stories.d.ts.map +1 -1
- package/dist/dts/components/UpgradeActionsPanel.stories.js +3 -3
- package/dist/dts/components/WorkspaceTierCard.stories.d.ts +1 -1
- package/dist/dts/components/WorkspaceTierCard.stories.d.ts.map +1 -1
- package/dist/dts/components/WorkspaceTierCard.stories.js +1 -1
- package/dist/dts/index.d.ts +2 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/index.js +2 -1
- package/dist/dts/index.js.map +1 -1
- package/dist/index/cjs/index.js +68 -56
- package/dist/index/cjs/index.js.map +1 -1
- package/dist/index/esm/index.js +69 -58
- package/dist/index/esm/index.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/package.json +4 -4
package/dist/index/esm/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { mergeDefaultTailwindClassnames, ACTIVITY_CHANNEL, convertSecondsToMilli
|
|
|
4
4
|
import { Card, Stack, Badge, Text, List, Group, Tooltip, Button, Container, SimpleGrid, LoadingOverlay, Loader, Alert, Select, Divider, ActionIcon, Popover, Accordion, Radio, Progress, TextInput, Textarea, Table, Scroller, Tabs, Center } from '@mantine/core';
|
|
5
5
|
import { Icon } from '@iconify-icon/react';
|
|
6
6
|
import { useInterval, useElementSize, useDisclosure, useResizeObserver } from '@mantine/hooks';
|
|
7
|
-
import { GEN3_API, GEN3_WORKSPACE_API, gen3Api, useCoreSelector, selectJEGActiveWorkspaceStatus, useCoreDispatch, setJEGActiveWorkspaceStatus, WorkspaceStatus, setJEGRequestedWorkspaceStatus, RequestedWorkspaceStatus, setJEGActiveWorkspaceId, isFetchBaseQueryError, selectJEGRequestedWorkspaceStatus, selectJEGRequestedWorkspaceStatusTimestamp, isTimeGreaterThan, formatUptimeInMinutes, selectJEGKernelIds, removeManyJEGActiveKernels, upsertManyJEGActiveKernels, normalizeRtkError, selectAllJEGKernels, addJEGActiveKernel, selectWorkspaceTier, setWorkspaceTier, useGetWorkspacePayModelsQuery, useSetCurrentPayModelMutation, selectWorkspaceFullscreen, setWorkspaceFullscreen, useGetDictionaryFromUrlQuery, useUserAuth, GEN3_COMMONS_NAME } from '@gen3/core';
|
|
7
|
+
import { GEN3_API, GEN3_WORKSPACE_API, gen3Api, useCoreSelector, selectJEGActiveWorkspaceStatus, useCoreDispatch, setJEGActiveWorkspaceStatus, WorkspaceStatus, setJEGRequestedWorkspaceStatus, RequestedWorkspaceStatus, setJEGActiveWorkspaceId, isFetchBaseQueryError, selectJEGRequestedWorkspaceStatus, selectJEGRequestedWorkspaceStatusTimestamp, isTimeGreaterThan, formatUptimeInMinutes, selectJEGKernelIds, removeManyJEGActiveKernels, upsertManyJEGActiveKernels, normalizeRtkError, selectAllJEGKernels, addJEGActiveKernel, selectWorkspaceTier, setWorkspaceTier, useGetWorkspacePayModelsQuery, useGetActivePayModelQuery, useSetCurrentPayModelMutation, selectWorkspaceFullscreen, setWorkspaceFullscreen, useGetDictionaryFromUrlQuery, useUserAuth, GEN3_COMMONS_NAME } from '@gen3/core';
|
|
8
8
|
import { useDeepCompareEffect, useDeepCompareCallback, useDeepCompareMemo } from 'use-deep-compare';
|
|
9
9
|
import { notifications } from '@mantine/notifications';
|
|
10
10
|
import { MdExpandMore, MdOpenInNew, MdKeyboardArrowDown, MdKeyboardArrowRight } from 'react-icons/md';
|
|
@@ -2426,52 +2426,74 @@ const SettingsPanel = ({ showKernels, expanded, setExpanded, width = 380 })=>{
|
|
|
2426
2426
|
});
|
|
2427
2427
|
};
|
|
2428
2428
|
|
|
2429
|
-
|
|
2429
|
+
// TODO rework once requirements are made
|
|
2430
|
+
const usdFormatter = new Intl.NumberFormat('en-US', {
|
|
2431
|
+
style: 'currency',
|
|
2432
|
+
currency: 'USD'
|
|
2433
|
+
});
|
|
2434
|
+
const paymentNumberToString = (x, undefinedValue = 'N/A', precision = 2)=>{
|
|
2430
2435
|
if (typeof x !== 'number' || Number.isNaN(x)) return undefinedValue;
|
|
2431
|
-
return
|
|
2436
|
+
return usdFormatter.format(x);
|
|
2432
2437
|
};
|
|
2433
2438
|
const isNoPayModelError = (error)=>{
|
|
2434
2439
|
return 'status' in error && error.status === 'PARSING_ERROR' && error.originalStatus === 404;
|
|
2435
2440
|
};
|
|
2436
2441
|
const CostTracker = ({ workspaceAccountManagerTarget = '' })=>{
|
|
2437
|
-
const { data, isLoading, isFetching, isError, error } = useGetWorkspacePayModelsQuery(undefined, {
|
|
2442
|
+
const { data, isLoading, isFetching, isError, error, isSuccess } = useGetWorkspacePayModelsQuery(undefined, {
|
|
2438
2443
|
pollingInterval: 120000,
|
|
2439
2444
|
refetchOnMountOrArgChange: true
|
|
2440
2445
|
});
|
|
2441
|
-
const
|
|
2446
|
+
const { data: currentPaymodelData, isFetching: isCurrentPayModelFetching } = useGetActivePayModelQuery();
|
|
2447
|
+
const [setWorkspacePayModel, result] = useSetCurrentPayModelMutation();
|
|
2442
2448
|
const [selectedPayModel, setSelectedPayModel] = useState(null);
|
|
2443
2449
|
const [opened, setOpened] = useState(false);
|
|
2444
|
-
useDeepCompareCallback((id)=>{
|
|
2445
|
-
void setWorkspacePayModel(id); // triggers the call to the service to select the pay model
|
|
2450
|
+
const setPayModel = useDeepCompareCallback((id)=>{
|
|
2451
|
+
void setWorkspacePayModel(id).unwrap(); // triggers the call to the service to select the pay model
|
|
2446
2452
|
setSelectedPayModel(id); // set the paymodel value for the select component
|
|
2447
2453
|
}, [
|
|
2448
2454
|
setWorkspacePayModel,
|
|
2449
2455
|
selectedPayModel
|
|
2450
2456
|
]);
|
|
2451
2457
|
const { usersPayModels, workspaceName, hardLimit, totalUsage } = useDeepCompareMemo(()=>{
|
|
2452
|
-
if (
|
|
2453
|
-
usersPayModels
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2458
|
+
if (isSuccess && data) {
|
|
2459
|
+
const usersPayModels = data?.allPayModels.map((payModel)=>{
|
|
2460
|
+
return {
|
|
2461
|
+
value: payModel.bmh_workspace_id ?? payModel.workspace_type,
|
|
2462
|
+
label: payModel.workspace_type,
|
|
2463
|
+
totalUsage: payModel['total-usage'],
|
|
2464
|
+
currentPayModel: payModel.current_pay_model ?? null,
|
|
2465
|
+
icon: payModel.request_status === 'active' ? /*#__PURE__*/ jsx(FaUser, {}) : /*#__PURE__*/ jsx(FaExclamationCircle, {})
|
|
2466
|
+
};
|
|
2467
|
+
});
|
|
2468
|
+
let currentPayModel = null;
|
|
2469
|
+
if (data?.currentPayModel) {
|
|
2470
|
+
currentPayModel = data?.currentPayModel.bmh_workspace_id ?? data?.currentPayModel.workspace_type;
|
|
2471
|
+
}
|
|
2472
|
+
setSelectedPayModel(currentPayModel);
|
|
2473
|
+
let workspaceName = 'Not Set';
|
|
2474
|
+
let totalUsage = undefined;
|
|
2475
|
+
let hardLimit = undefined;
|
|
2476
|
+
if (data.currentPayModel !== null) {
|
|
2477
|
+
workspaceName = data.currentPayModel.bmh_workspace_id.length > 0 ? data.currentPayModel.bmh_workspace_id : data.currentPayModel.workspace_type;
|
|
2478
|
+
totalUsage = data.currentPayModel?.['total-usage'];
|
|
2479
|
+
hardLimit = data.currentPayModel?.['hard-limit'];
|
|
2480
|
+
}
|
|
2460
2481
|
return {
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2482
|
+
usersPayModels,
|
|
2483
|
+
workspaceName,
|
|
2484
|
+
selectedPayModel,
|
|
2485
|
+
totalUsage,
|
|
2486
|
+
hardLimit
|
|
2466
2487
|
};
|
|
2467
|
-
}
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2488
|
+
} else {
|
|
2489
|
+
return {
|
|
2490
|
+
usersPayModels: [],
|
|
2491
|
+
selectedPayModel: [],
|
|
2492
|
+
workspaceName: 'Not Set',
|
|
2493
|
+
totalUsage: undefined,
|
|
2494
|
+
hardLimit: undefined
|
|
2495
|
+
};
|
|
2496
|
+
}
|
|
2475
2497
|
}, [
|
|
2476
2498
|
data
|
|
2477
2499
|
]);
|
|
@@ -2551,8 +2573,8 @@ const CostTracker = ({ workspaceAccountManagerTarget = '' })=>{
|
|
|
2551
2573
|
size: "sm",
|
|
2552
2574
|
radius: "xl",
|
|
2553
2575
|
"aria-label": "Monthly Workflow Limit",
|
|
2554
|
-
value: !hardLimit ? 100 : hardLimit / totalUsage * 100,
|
|
2555
|
-
color: !hardLimit || totalUsage >= hardLimit ? 'red.5' : 'green.1',
|
|
2576
|
+
value: !hardLimit || !totalUsage ? 100 : hardLimit / totalUsage * 100,
|
|
2577
|
+
color: !hardLimit || totalUsage && totalUsage >= hardLimit ? 'red.5' : 'green.1',
|
|
2556
2578
|
className: className
|
|
2557
2579
|
});
|
|
2558
2580
|
return /*#__PURE__*/ jsxs(Popover, {
|
|
@@ -2581,18 +2603,15 @@ const CostTracker = ({ workspaceAccountManagerTarget = '' })=>{
|
|
|
2581
2603
|
}),
|
|
2582
2604
|
children: [
|
|
2583
2605
|
ProgressBar('w-[110px]'),
|
|
2584
|
-
/*#__PURE__*/
|
|
2585
|
-
className: "font-black pl-3 pr-
|
|
2586
|
-
children:
|
|
2587
|
-
"$",
|
|
2588
|
-
PaymentNumberToString(totalUsage)
|
|
2589
|
-
]
|
|
2606
|
+
/*#__PURE__*/ jsx("span", {
|
|
2607
|
+
className: "font-black pl-3 pr-1",
|
|
2608
|
+
children: paymentNumberToString(totalUsage)
|
|
2590
2609
|
}),
|
|
2591
2610
|
/*#__PURE__*/ jsxs("span", {
|
|
2592
2611
|
className: "font-normal",
|
|
2593
2612
|
children: [
|
|
2594
|
-
"
|
|
2595
|
-
|
|
2613
|
+
"/",
|
|
2614
|
+
paymentNumberToString(hardLimit)
|
|
2596
2615
|
]
|
|
2597
2616
|
})
|
|
2598
2617
|
]
|
|
@@ -2618,13 +2637,11 @@ const CostTracker = ({ workspaceAccountManagerTarget = '' })=>{
|
|
|
2618
2637
|
size: "sm",
|
|
2619
2638
|
className: "uppercase pb-2 px-2",
|
|
2620
2639
|
children: [
|
|
2621
|
-
"Limit
|
|
2622
|
-
|
|
2640
|
+
"Limit",
|
|
2641
|
+
' ',
|
|
2642
|
+
/*#__PURE__*/ jsx("span", {
|
|
2623
2643
|
className: "font-black pl-1",
|
|
2624
|
-
children:
|
|
2625
|
-
"$",
|
|
2626
|
-
PaymentNumberToString(hardLimit)
|
|
2627
|
-
]
|
|
2644
|
+
children: paymentNumberToString(hardLimit)
|
|
2628
2645
|
})
|
|
2629
2646
|
]
|
|
2630
2647
|
}),
|
|
@@ -2651,22 +2668,19 @@ const CostTracker = ({ workspaceAccountManagerTarget = '' })=>{
|
|
|
2651
2668
|
value: "accountInformation",
|
|
2652
2669
|
children: [
|
|
2653
2670
|
/*#__PURE__*/ jsx(Accordion.Control, {
|
|
2654
|
-
children: /*#__PURE__*/
|
|
2671
|
+
children: /*#__PURE__*/ jsx(Text, {
|
|
2655
2672
|
size: "sm",
|
|
2656
2673
|
className: "font-black",
|
|
2657
|
-
children:
|
|
2658
|
-
workspaceName,
|
|
2659
|
-
" - $",
|
|
2660
|
-
PaymentNumberToString(totalUsage)
|
|
2661
|
-
]
|
|
2674
|
+
children: `${workspaceName} - ${paymentNumberToString(totalUsage)}`
|
|
2662
2675
|
})
|
|
2663
2676
|
}),
|
|
2664
2677
|
/*#__PURE__*/ jsx(Accordion.Panel, {
|
|
2665
2678
|
children: /*#__PURE__*/ jsx(Radio.Group, {
|
|
2666
2679
|
className: "pt-2",
|
|
2680
|
+
onChange: setPayModel,
|
|
2681
|
+
value: selectedPayModel,
|
|
2667
2682
|
children: usersPayModels.map((obj)=>/*#__PURE__*/ jsx(Radio.Card, {
|
|
2668
|
-
|
|
2669
|
-
disabled: true,
|
|
2683
|
+
value: obj.value,
|
|
2670
2684
|
className: "p-2 border-none data-checked:bg-primary-lightest data-checked:border-primary-darker data-checked:font-black hover:bg-primary-max ",
|
|
2671
2685
|
children: /*#__PURE__*/ jsxs(Group, {
|
|
2672
2686
|
wrap: "nowrap",
|
|
@@ -2677,12 +2691,9 @@ const CostTracker = ({ workspaceAccountManagerTarget = '' })=>{
|
|
|
2677
2691
|
className: "grow",
|
|
2678
2692
|
children: obj.label
|
|
2679
2693
|
}),
|
|
2680
|
-
/*#__PURE__*/
|
|
2694
|
+
/*#__PURE__*/ jsx(Text, {
|
|
2681
2695
|
size: "sm",
|
|
2682
|
-
children:
|
|
2683
|
-
"$",
|
|
2684
|
-
PaymentNumberToString(obj.totalUsage)
|
|
2685
|
-
]
|
|
2696
|
+
children: `${paymentNumberToString(obj.totalUsage)}`
|
|
2686
2697
|
}),
|
|
2687
2698
|
/*#__PURE__*/ jsx(Radio.Indicator, {
|
|
2688
2699
|
color: "accent"
|
|
@@ -4485,5 +4496,5 @@ const WorkspacesCenterPageGetServerSideProps = async ()=>{
|
|
|
4485
4496
|
}
|
|
4486
4497
|
};
|
|
4487
4498
|
|
|
4488
|
-
export { WorkspacesCenterPage, WorkspacesCenterPageGetServerSideProps };
|
|
4499
|
+
export { CostTracker, WorkspacesCenterPage, WorkspacesCenterPageGetServerSideProps };
|
|
4489
4500
|
//# sourceMappingURL=index.js.map
|