@gen3/workspaces 0.12.67 → 0.12.68
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/CostTracker.d.ts.map +1 -1
- package/dist/dts/components/CostTracker.js +16 -8
- package/dist/dts/components/CostTracker.js.map +1 -1
- package/dist/index/cjs/index.js +68 -21
- package/dist/index/cjs/index.js.map +1 -1
- package/dist/index/esm/index.js +69 -22
- package/dist/index/esm/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import React, { useCallback, useMemo, useState, useRef, useEffect, createContext, useImperativeHandle, forwardRef } from 'react';
|
|
3
3
|
import { mergeDefaultTailwindClassnames, ACTIVITY_CHANNEL, convertSecondsToMilliseconds, InfoRolloverButton, OverflowTooltippedLabel, PanelErrorBoundary, ProtectedContent, FixedNavPageLayout, ContentSource, getNavPageLayoutPropsFromConfig } from '@gen3/frontend';
|
|
4
|
-
import { Card, Stack, Badge, Text, List, Group, Tooltip, Button, Container, SimpleGrid, LoadingOverlay, Loader, Alert, Select, Divider, ActionIcon,
|
|
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
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';
|
|
@@ -2433,20 +2433,6 @@ const PaymentNumberToString = (x, undefinedValue = 'N/A', precision = 2)=>{
|
|
|
2433
2433
|
const isNoPayModelError = (error)=>{
|
|
2434
2434
|
return 'status' in error && error.status === 'PARSING_ERROR' && error.originalStatus === 404;
|
|
2435
2435
|
};
|
|
2436
|
-
const NoPayModel = ()=>{
|
|
2437
|
-
return /*#__PURE__*/ jsx(Group, {
|
|
2438
|
-
className: "p-2 border-1 border-l-0 border-r-0 border-base-lighter w-full h-16",
|
|
2439
|
-
justify: "space-between",
|
|
2440
|
-
children: /*#__PURE__*/ jsx(Text, {
|
|
2441
|
-
className: "pl-4",
|
|
2442
|
-
size: "md",
|
|
2443
|
-
classNames: {
|
|
2444
|
-
root: 'font-heading text-utility-warning'
|
|
2445
|
-
},
|
|
2446
|
-
children: "No pay model defined"
|
|
2447
|
-
})
|
|
2448
|
-
});
|
|
2449
|
-
};
|
|
2450
2436
|
const CostTracker = ({ workspaceAccountManagerTarget = '' })=>{
|
|
2451
2437
|
const { data, isLoading, isFetching, isError, error } = useGetWorkspacePayModelsQuery(undefined, {
|
|
2452
2438
|
pollingInterval: 120000,
|
|
@@ -2489,16 +2475,77 @@ const CostTracker = ({ workspaceAccountManagerTarget = '' })=>{
|
|
|
2489
2475
|
}, [
|
|
2490
2476
|
data
|
|
2491
2477
|
]);
|
|
2492
|
-
if (isLoading && isFetching) return /*#__PURE__*/ jsx(
|
|
2493
|
-
|
|
2494
|
-
|
|
2478
|
+
if (isLoading && isFetching) return /*#__PURE__*/ jsx(Badge, {
|
|
2479
|
+
leftSection: /*#__PURE__*/ jsx(Loader, {
|
|
2480
|
+
size: "xs",
|
|
2481
|
+
type: "dots",
|
|
2482
|
+
className: "m-1"
|
|
2483
|
+
}),
|
|
2484
|
+
variant: "default",
|
|
2485
|
+
children: "Loading..."
|
|
2495
2486
|
});
|
|
2487
|
+
const PayModelError = (message)=>{
|
|
2488
|
+
// dropdown error state to provide user access to Account Manager if available
|
|
2489
|
+
if (workspaceAccountManagerTarget) {
|
|
2490
|
+
return /*#__PURE__*/ jsxs(Popover, {
|
|
2491
|
+
width: "target",
|
|
2492
|
+
position: "bottom",
|
|
2493
|
+
shadow: "lg",
|
|
2494
|
+
trapFocus: true,
|
|
2495
|
+
opened: opened,
|
|
2496
|
+
onChange: setOpened,
|
|
2497
|
+
children: [
|
|
2498
|
+
/*#__PURE__*/ jsx(Popover.Target, {
|
|
2499
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
2500
|
+
onClick: ()=>setOpened((o)=>!o),
|
|
2501
|
+
size: "xs",
|
|
2502
|
+
radius: "xl",
|
|
2503
|
+
className: "h-[--badge-height] uppercase",
|
|
2504
|
+
color: "utility.3",
|
|
2505
|
+
rightSection: /*#__PURE__*/ jsx(MdExpandMore, {
|
|
2506
|
+
size: "1.5em",
|
|
2507
|
+
"aria-label": opened ? 'close' : 'open',
|
|
2508
|
+
style: {
|
|
2509
|
+
transform: opened ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
2510
|
+
transition: 'transform 200ms ease'
|
|
2511
|
+
}
|
|
2512
|
+
}),
|
|
2513
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
2514
|
+
className: "font-black",
|
|
2515
|
+
children: message
|
|
2516
|
+
})
|
|
2517
|
+
})
|
|
2518
|
+
}),
|
|
2519
|
+
/*#__PURE__*/ jsx(Popover.Dropdown, {
|
|
2520
|
+
className: "px-2",
|
|
2521
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
2522
|
+
component: "a",
|
|
2523
|
+
href: workspaceAccountManagerTarget,
|
|
2524
|
+
target: "_blank",
|
|
2525
|
+
variant: "outline",
|
|
2526
|
+
leftSection: /*#__PURE__*/ jsx(MdOpenInNew, {
|
|
2527
|
+
size: "1.1em",
|
|
2528
|
+
"aria-label": "external"
|
|
2529
|
+
}),
|
|
2530
|
+
size: "xs",
|
|
2531
|
+
className: "w-full",
|
|
2532
|
+
children: "Workspace Account Manager"
|
|
2533
|
+
})
|
|
2534
|
+
})
|
|
2535
|
+
]
|
|
2536
|
+
});
|
|
2537
|
+
}
|
|
2538
|
+
return /*#__PURE__*/ jsx(Badge, {
|
|
2539
|
+
color: "utility.3",
|
|
2540
|
+
children: message
|
|
2541
|
+
});
|
|
2542
|
+
};
|
|
2496
2543
|
if (isError) {
|
|
2497
2544
|
if (isNoPayModelError(error)) {
|
|
2498
|
-
return
|
|
2499
|
-
} else
|
|
2500
|
-
|
|
2501
|
-
}
|
|
2545
|
+
return PayModelError('No pay model defined');
|
|
2546
|
+
} else {
|
|
2547
|
+
return PayModelError('Unable to get Payment information');
|
|
2548
|
+
}
|
|
2502
2549
|
}
|
|
2503
2550
|
const ProgressBar = (className = '')=>/*#__PURE__*/ jsx(Progress, {
|
|
2504
2551
|
size: "sm",
|