@elaraai/e3-ui-components 0.0.1-beta.15 → 0.0.1-beta.16
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/components/InputPreview.d.ts +1 -2
- package/dist/components/InputPreview.d.ts.map +1 -1
- package/dist/components/TaskPreview.d.ts +2 -3
- package/dist/components/TaskPreview.d.ts.map +1 -1
- package/dist/hooks/useInputDataPreview.d.ts +2 -2
- package/dist/hooks/useInputDataPreview.d.ts.map +1 -1
- package/dist/hooks/useTaskLogsHook.d.ts +2 -2
- package/dist/hooks/useTaskLogsHook.d.ts.map +1 -1
- package/dist/hooks/useTaskOutputPreview.d.ts +2 -2
- package/dist/hooks/useTaskOutputPreview.d.ts.map +1 -1
- package/dist/index.cjs +67 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +67 -66
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequestOptions } from '@elaraai/e3-api-client';
|
|
2
2
|
export interface InputPreviewProps {
|
|
3
3
|
apiUrl: string;
|
|
4
4
|
repo: string;
|
|
5
5
|
workspace: string;
|
|
6
6
|
path: string;
|
|
7
|
-
inputInfo: DatasetStatusInfo | null;
|
|
8
7
|
requestOptions?: RequestOptions;
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputPreview.d.ts","sourceRoot":"","sources":["../../src/components/InputPreview.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AA2BH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"InputPreview.d.ts","sourceRoot":"","sources":["../../src/components/InputPreview.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AA2BH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAO7D,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,cAAc,CAAC;CACnC;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,yDA+KuD,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequestOptions } from '@elaraai/e3-api-client';
|
|
2
2
|
export interface TaskPreviewProps {
|
|
3
3
|
apiUrl: string;
|
|
4
4
|
repo: string;
|
|
5
5
|
workspace: string;
|
|
6
6
|
task: string;
|
|
7
|
-
|
|
8
|
-
outputHash: string | null;
|
|
7
|
+
output: string;
|
|
9
8
|
requestOptions?: RequestOptions;
|
|
10
9
|
}
|
|
11
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskPreview.d.ts","sourceRoot":"","sources":["../../src/components/TaskPreview.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAiCH,OAAO,KAAK,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"TaskPreview.d.ts","sourceRoot":"","sources":["../../src/components/TaskPreview.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAiCH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAO7D,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,cAAc,CAAC;CACnC;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,wDA6NkH,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QueryOverrides, DatasetPreview } from './types.js';
|
|
2
|
-
import {
|
|
3
|
-
export declare function useInputDataPreview(apiUrl: string, repo: string, workspace: string | null,
|
|
2
|
+
import { RequestOptions } from '@elaraai/e3-api-client';
|
|
3
|
+
export declare function useInputDataPreview(apiUrl: string, repo: string, workspace: string | null, path: string | null, requestOptions?: RequestOptions, queryOptions?: QueryOverrides): {
|
|
4
4
|
data: DatasetPreview | undefined;
|
|
5
5
|
isLoading: boolean;
|
|
6
6
|
error: Error | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputDataPreview.d.ts","sourceRoot":"","sources":["../../src/hooks/useInputDataPreview.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"useInputDataPreview.d.ts","sourceRoot":"","sources":["../../src/hooks/useInputDataPreview.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAK7D,wBAAgB,mBAAmB,CAC/B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,cAAc,CAAC,EAAE,cAAc,EAC/B,YAAY,CAAC,EAAE,cAAc;;;;EA+ChC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QueryOverrides } from './types.js';
|
|
2
|
-
import {
|
|
3
|
-
export declare function useTaskLogs(apiUrl: string, repo: string, workspace: string | null,
|
|
2
|
+
import { RequestOptions } from '@elaraai/e3-api-client';
|
|
3
|
+
export declare function useTaskLogs(apiUrl: string, repo: string, workspace: string | null, taskName: string | null, stream?: 'stdout' | 'stderr', requestOptions?: RequestOptions, queryOptions?: QueryOverrides): import('@tanstack/react-query').UseQueryResult<{
|
|
4
4
|
data: string;
|
|
5
5
|
offset: bigint;
|
|
6
6
|
size: bigint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTaskLogsHook.d.ts","sourceRoot":"","sources":["../../src/hooks/useTaskLogsHook.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"useTaskLogsHook.d.ts","sourceRoot":"","sources":["../../src/hooks/useTaskLogsHook.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAwD7D,wBAAgB,WAAW,CACvB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,MAAM,GAAE,QAAQ,GAAG,QAAmB,EACtC,cAAc,CAAC,EAAE,cAAc,EAC/B,YAAY,CAAC,EAAE,cAAc;UAlDd,MAAM;YAAU,MAAM;UAAQ,MAAM;eAAa,MAAM;cAAY,OAAO;UA2D5F"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QueryOverrides, DatasetPreview } from './types.js';
|
|
2
|
-
import {
|
|
3
|
-
export declare function useTaskOutputPreview(apiUrl: string, repo: string, workspace: string | null,
|
|
2
|
+
import { RequestOptions } from '@elaraai/e3-api-client';
|
|
3
|
+
export declare function useTaskOutputPreview(apiUrl: string, repo: string, workspace: string | null, outputPath: string | null, requestOptions?: RequestOptions, queryOptions?: QueryOverrides): {
|
|
4
4
|
data: DatasetPreview | undefined;
|
|
5
5
|
isLoading: boolean;
|
|
6
6
|
error: Error | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTaskOutputPreview.d.ts","sourceRoot":"","sources":["../../src/hooks/useTaskOutputPreview.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"useTaskOutputPreview.d.ts","sourceRoot":"","sources":["../../src/hooks/useTaskOutputPreview.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAK7D,wBAAgB,oBAAoB,CAChC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,cAAc,CAAC,EAAE,cAAc,EAC/B,YAAY,CAAC,EAAE,cAAc;;;;EA+ChC"}
|
package/dist/index.cjs
CHANGED
|
@@ -4482,34 +4482,35 @@ class ErrorBoundary extends React.Component {
|
|
|
4482
4482
|
}
|
|
4483
4483
|
}
|
|
4484
4484
|
const MAX_DOWNLOAD_SIZE$1 = 10 * 1024 * 1024;
|
|
4485
|
-
function useInputDataPreview(apiUrl, repo, workspace,
|
|
4486
|
-
const isUpToDate = React.useMemo(() => (inputInfo == null ? void 0 : inputInfo.status.type) === "up-to-date", [inputInfo == null ? void 0 : inputInfo.status.type]);
|
|
4487
|
-
const hash = React.useMemo(() => {
|
|
4488
|
-
var _a;
|
|
4489
|
-
return ((_a = inputInfo == null ? void 0 : inputInfo.hash) == null ? void 0 : _a.type) === "some" ? inputInfo.hash.value : null;
|
|
4490
|
-
}, [inputInfo == null ? void 0 : inputInfo.hash]);
|
|
4485
|
+
function useInputDataPreview(apiUrl, repo, workspace, path, requestOptions, queryOptions) {
|
|
4491
4486
|
const pathParts = React.useMemo(
|
|
4492
|
-
() =>
|
|
4493
|
-
|
|
4494
|
-
return ((_a = inputInfo == null ? void 0 : inputInfo.path) == null ? void 0 : _a.split(".").filter(Boolean).map((v2) => east.variant("field", v2))) ?? [];
|
|
4495
|
-
},
|
|
4496
|
-
[inputInfo == null ? void 0 : inputInfo.path]
|
|
4487
|
+
() => (path == null ? void 0 : path.split(".").filter(Boolean).map((v2) => east.variant("field", v2))) ?? [],
|
|
4488
|
+
[path]
|
|
4497
4489
|
);
|
|
4498
4490
|
const status = reactQuery.useQuery({
|
|
4499
|
-
queryKey: ["inputDataStatus", apiUrl, repo, workspace,
|
|
4491
|
+
queryKey: ["inputDataStatus", apiUrl, repo, workspace, path],
|
|
4500
4492
|
queryFn: () => e3ApiClient.datasetGetStatus(apiUrl, repo, workspace, pathParts, requestOptions ?? { token: null }),
|
|
4501
|
-
enabled: !!workspace && !!
|
|
4493
|
+
enabled: !!workspace && !!path,
|
|
4494
|
+
refetchInterval: 1e3,
|
|
4502
4495
|
...queryOptions
|
|
4503
4496
|
});
|
|
4497
|
+
const hash = React.useMemo(() => {
|
|
4498
|
+
var _a, _b;
|
|
4499
|
+
return ((_b = (_a = status.data) == null ? void 0 : _a.hash) == null ? void 0 : _b.type) === "some" ? status.data.hash.value : null;
|
|
4500
|
+
}, [status.data]);
|
|
4501
|
+
const hasData = React.useMemo(() => {
|
|
4502
|
+
var _a;
|
|
4503
|
+
return ((_a = status.data) == null ? void 0 : _a.refType) === "value" && hash !== null;
|
|
4504
|
+
}, [status.data, hash]);
|
|
4504
4505
|
const size = React.useMemo(() => {
|
|
4505
4506
|
var _a, _b;
|
|
4506
4507
|
return ((_b = (_a = status.data) == null ? void 0 : _a.size) == null ? void 0 : _b.type) === "some" ? status.data.size.value : null;
|
|
4507
4508
|
}, [status.data]);
|
|
4508
4509
|
const isOversized = React.useMemo(() => size !== null && size > MAX_DOWNLOAD_SIZE$1, [size]);
|
|
4509
4510
|
const data = reactQuery.useQuery({
|
|
4510
|
-
queryKey: ["inputData", apiUrl, repo, workspace,
|
|
4511
|
+
queryKey: ["inputData", apiUrl, repo, workspace, path, hash],
|
|
4511
4512
|
queryFn: () => e3ApiClient.datasetGet(apiUrl, repo, workspace, pathParts, requestOptions ?? { token: null }),
|
|
4512
|
-
enabled:
|
|
4513
|
+
enabled: hasData && !isOversized,
|
|
4513
4514
|
...queryOptions
|
|
4514
4515
|
});
|
|
4515
4516
|
const preview = React.useMemo(() => {
|
|
@@ -4525,7 +4526,7 @@ function useInputDataPreview(apiUrl, repo, workspace, inputInfo, requestOptions,
|
|
|
4525
4526
|
}, [status.data, data.data]);
|
|
4526
4527
|
return {
|
|
4527
4528
|
data: preview,
|
|
4528
|
-
isLoading: status.isLoading || status.isSuccess && !isOversized && data.isLoading,
|
|
4529
|
+
isLoading: status.isLoading || status.isSuccess && hasData && !isOversized && data.isLoading,
|
|
4529
4530
|
error: status.error ?? data.error ?? null
|
|
4530
4531
|
};
|
|
4531
4532
|
}
|
|
@@ -4866,10 +4867,9 @@ const InputPreview = React.memo(function InputPreview2({
|
|
|
4866
4867
|
repo,
|
|
4867
4868
|
workspace,
|
|
4868
4869
|
path,
|
|
4869
|
-
inputInfo,
|
|
4870
4870
|
requestOptions
|
|
4871
4871
|
}) {
|
|
4872
|
-
const { data: preview, isLoading, error } = useInputDataPreview(apiUrl, repo, workspace,
|
|
4872
|
+
const { data: preview, isLoading, error } = useInputDataPreview(apiUrl, repo, workspace, path, requestOptions);
|
|
4873
4873
|
const output = React.useMemo(
|
|
4874
4874
|
() => (preview == null ? void 0 : preview.value.type) === "some" ? preview.value.value : void 0,
|
|
4875
4875
|
[preview]
|
|
@@ -4891,13 +4891,17 @@ const InputPreview = React.memo(function InputPreview2({
|
|
|
4891
4891
|
}, [output]);
|
|
4892
4892
|
const store = React.useMemo(() => eastUiComponents.createEastStore(), [decode]);
|
|
4893
4893
|
const displayName = path.replace(/^\.inputs\./, "");
|
|
4894
|
+
const hasData = React.useMemo(() => {
|
|
4895
|
+
var _a;
|
|
4896
|
+
return (preview == null ? void 0 : preview.refType) === "value" && ((_a = preview == null ? void 0 : preview.hash) == null ? void 0 : _a.type) === "some";
|
|
4897
|
+
}, [preview]);
|
|
4894
4898
|
const content = React.useMemo(() => {
|
|
4895
|
-
if (
|
|
4899
|
+
if (preview && !hasData) {
|
|
4896
4900
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4897
4901
|
StatusDisplay,
|
|
4898
4902
|
{
|
|
4899
4903
|
variant: "info",
|
|
4900
|
-
title:
|
|
4904
|
+
title: "No data available",
|
|
4901
4905
|
message: "Set the input value to see output"
|
|
4902
4906
|
}
|
|
4903
4907
|
);
|
|
@@ -4972,7 +4976,7 @@ const InputPreview = React.memo(function InputPreview2({
|
|
|
4972
4976
|
title: `No data available for input "${displayName}"`
|
|
4973
4977
|
}
|
|
4974
4978
|
);
|
|
4975
|
-
}, [preview, decode, displayName, isLoading, output,
|
|
4979
|
+
}, [preview, decode, displayName, isLoading, output, hasData]);
|
|
4976
4980
|
if (error) {
|
|
4977
4981
|
const { message, details } = formatApiError(error);
|
|
4978
4982
|
return /* @__PURE__ */ jsxRuntime.jsx(StatusDisplay, { variant: "error", title: "Failed to load input", message, details: details ?? "" });
|
|
@@ -4993,12 +4997,7 @@ const InputPreview = React.memo(function InputPreview2({
|
|
|
4993
4997
|
),
|
|
4994
4998
|
/* @__PURE__ */ jsxRuntime.jsx(react.Box, { flex: 1, overflow: "hidden", minHeight: 0, children: content })
|
|
4995
4999
|
] }) });
|
|
4996
|
-
}, (prev, next) =>
|
|
4997
|
-
var _a, _b, _c, _d;
|
|
4998
|
-
const prevHash = ((_b = (_a = prev.inputInfo) == null ? void 0 : _a.hash) == null ? void 0 : _b.type) === "some" ? prev.inputInfo.hash.value : null;
|
|
4999
|
-
const nextHash = ((_d = (_c = next.inputInfo) == null ? void 0 : _c.hash) == null ? void 0 : _d.type) === "some" ? next.inputInfo.hash.value : null;
|
|
5000
|
-
return prev.path === next.path && prev.workspace === next.workspace && prevHash === nextHash;
|
|
5001
|
-
});
|
|
5000
|
+
}, (prev, next) => prev.path === next.path && prev.workspace === next.workspace);
|
|
5002
5001
|
function HighlightedLine({
|
|
5003
5002
|
text,
|
|
5004
5003
|
lineMatches,
|
|
@@ -5359,30 +5358,35 @@ function VirtualizedLogViewer({ content, tabs }) {
|
|
|
5359
5358
|
);
|
|
5360
5359
|
}
|
|
5361
5360
|
const MAX_DOWNLOAD_SIZE = 50 * 1024 * 1024;
|
|
5362
|
-
function useTaskOutputPreview(apiUrl, repo, workspace,
|
|
5363
|
-
const isUpToDate = React.useMemo(() => (task == null ? void 0 : task.status.type) === "up-to-date", [task == null ? void 0 : task.status.type]);
|
|
5361
|
+
function useTaskOutputPreview(apiUrl, repo, workspace, outputPath, requestOptions, queryOptions) {
|
|
5364
5362
|
const pathParts = React.useMemo(
|
|
5365
|
-
() =>
|
|
5366
|
-
|
|
5367
|
-
return ((_a = task == null ? void 0 : task.output) == null ? void 0 : _a.split(".").map((v2) => east.variant("field", v2))) ?? [];
|
|
5368
|
-
},
|
|
5369
|
-
[task == null ? void 0 : task.output]
|
|
5363
|
+
() => (outputPath == null ? void 0 : outputPath.split(".").map((v2) => east.variant("field", v2))) ?? [],
|
|
5364
|
+
[outputPath]
|
|
5370
5365
|
);
|
|
5371
5366
|
const status = reactQuery.useQuery({
|
|
5372
|
-
queryKey: ["taskOutputStatus", apiUrl, repo, workspace,
|
|
5367
|
+
queryKey: ["taskOutputStatus", apiUrl, repo, workspace, outputPath],
|
|
5373
5368
|
queryFn: () => e3ApiClient.datasetGetStatus(apiUrl, repo, workspace, pathParts, requestOptions ?? { token: null }),
|
|
5374
|
-
enabled: !!workspace && !!
|
|
5369
|
+
enabled: !!workspace && !!outputPath,
|
|
5370
|
+
refetchInterval: 1e3,
|
|
5375
5371
|
...queryOptions
|
|
5376
5372
|
});
|
|
5373
|
+
const hash = React.useMemo(() => {
|
|
5374
|
+
var _a, _b;
|
|
5375
|
+
return ((_b = (_a = status.data) == null ? void 0 : _a.hash) == null ? void 0 : _b.type) === "some" ? status.data.hash.value : null;
|
|
5376
|
+
}, [status.data]);
|
|
5377
|
+
const hasData = React.useMemo(() => {
|
|
5378
|
+
var _a;
|
|
5379
|
+
return ((_a = status.data) == null ? void 0 : _a.refType) === "value" && hash !== null;
|
|
5380
|
+
}, [status.data, hash]);
|
|
5377
5381
|
const size = React.useMemo(() => {
|
|
5378
5382
|
var _a, _b;
|
|
5379
5383
|
return ((_b = (_a = status.data) == null ? void 0 : _a.size) == null ? void 0 : _b.type) === "some" ? status.data.size.value : null;
|
|
5380
5384
|
}, [status.data]);
|
|
5381
5385
|
const isOversized = React.useMemo(() => size !== null && size > MAX_DOWNLOAD_SIZE, [size]);
|
|
5382
5386
|
const data = reactQuery.useQuery({
|
|
5383
|
-
queryKey: ["taskOutput", apiUrl, repo, workspace,
|
|
5387
|
+
queryKey: ["taskOutput", apiUrl, repo, workspace, outputPath, hash],
|
|
5384
5388
|
queryFn: () => e3ApiClient.datasetGet(apiUrl, repo, workspace, pathParts, requestOptions ?? { token: null }),
|
|
5385
|
-
enabled:
|
|
5389
|
+
enabled: hasData && !isOversized,
|
|
5386
5390
|
...queryOptions
|
|
5387
5391
|
});
|
|
5388
5392
|
const preview = React.useMemo(() => {
|
|
@@ -5398,7 +5402,7 @@ function useTaskOutputPreview(apiUrl, repo, workspace, task, outputHash = null,
|
|
|
5398
5402
|
}, [status.data, data.data]);
|
|
5399
5403
|
return {
|
|
5400
5404
|
data: preview,
|
|
5401
|
-
isLoading: status.isLoading || status.isSuccess && !isOversized && data.isLoading,
|
|
5405
|
+
isLoading: status.isLoading || status.isSuccess && hasData && !isOversized && data.isLoading,
|
|
5402
5406
|
error: status.error ?? data.error ?? null
|
|
5403
5407
|
};
|
|
5404
5408
|
}
|
|
@@ -5439,15 +5443,12 @@ async function fetchAllLogs(apiUrl, repo, workspace, taskName, stream, requestOp
|
|
|
5439
5443
|
};
|
|
5440
5444
|
}
|
|
5441
5445
|
}
|
|
5442
|
-
function useTaskLogs(apiUrl, repo, workspace,
|
|
5443
|
-
const isTaskRunning = (task == null ? void 0 : task.status.type) === "in-progress" || (task == null ? void 0 : task.status.type) === "stale-running";
|
|
5446
|
+
function useTaskLogs(apiUrl, repo, workspace, taskName, stream = "stdout", requestOptions, queryOptions) {
|
|
5444
5447
|
return reactQuery.useQuery({
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
// Only refetch every second while task is running, otherwise stop polling
|
|
5450
|
-
refetchInterval: isTaskRunning ? 1e3 : false,
|
|
5448
|
+
queryKey: ["taskLogs", apiUrl, repo, workspace, taskName, stream],
|
|
5449
|
+
queryFn: () => fetchAllLogs(apiUrl, repo, workspace, taskName, stream, requestOptions),
|
|
5450
|
+
enabled: !!workspace && !!taskName,
|
|
5451
|
+
refetchInterval: 1e3,
|
|
5451
5452
|
...queryOptions
|
|
5452
5453
|
});
|
|
5453
5454
|
}
|
|
@@ -5457,24 +5458,23 @@ const TaskPreview = React.memo(function TaskPreview2({
|
|
|
5457
5458
|
repo,
|
|
5458
5459
|
workspace,
|
|
5459
5460
|
task,
|
|
5460
|
-
|
|
5461
|
-
outputHash,
|
|
5461
|
+
output,
|
|
5462
5462
|
requestOptions
|
|
5463
5463
|
}) {
|
|
5464
|
-
const { data: preview, isLoading, error } = useTaskOutputPreview(apiUrl, repo, workspace,
|
|
5465
|
-
const
|
|
5464
|
+
const { data: preview, isLoading, error } = useTaskOutputPreview(apiUrl, repo, workspace, output, requestOptions);
|
|
5465
|
+
const rawOutput = React.useMemo(
|
|
5466
5466
|
() => (preview == null ? void 0 : preview.value.type) === "some" ? preview.value.value : void 0,
|
|
5467
5467
|
[preview]
|
|
5468
5468
|
);
|
|
5469
|
-
const { data: stdout } = useTaskLogs(apiUrl, repo, workspace,
|
|
5470
|
-
const { data: stderr } = useTaskLogs(apiUrl, repo, workspace,
|
|
5469
|
+
const { data: stdout } = useTaskLogs(apiUrl, repo, workspace, task, "stdout", requestOptions);
|
|
5470
|
+
const { data: stderr } = useTaskLogs(apiUrl, repo, workspace, task, "stderr", requestOptions);
|
|
5471
5471
|
const ir = React.useMemo(() => {
|
|
5472
|
-
if (!
|
|
5472
|
+
if (!rawOutput) return null;
|
|
5473
5473
|
try {
|
|
5474
|
-
const { type } = east.decodeBeast2(
|
|
5474
|
+
const { type } = east.decodeBeast2(rawOutput);
|
|
5475
5475
|
if (east.isTypeValueEqual(type, east.toEastTypeValue(eastUi.UIComponentType))) {
|
|
5476
5476
|
const decoder = east.decodeBeast2For(eastUi.UIComponentType, { platform: platformImplementations });
|
|
5477
|
-
const value = decoder(
|
|
5477
|
+
const value = decoder(rawOutput);
|
|
5478
5478
|
return value;
|
|
5479
5479
|
} else {
|
|
5480
5480
|
return null;
|
|
@@ -5482,7 +5482,7 @@ const TaskPreview = React.memo(function TaskPreview2({
|
|
|
5482
5482
|
} catch {
|
|
5483
5483
|
return null;
|
|
5484
5484
|
}
|
|
5485
|
-
}, [
|
|
5485
|
+
}, [rawOutput]);
|
|
5486
5486
|
const store = React.useMemo(() => eastUiComponents.createEastStore(), [ir]);
|
|
5487
5487
|
const stdoutContent = React.useMemo(() => (stdout == null ? void 0 : stdout.data) ?? "", [stdout == null ? void 0 : stdout.data]);
|
|
5488
5488
|
const stderrContent = React.useMemo(() => (stderr == null ? void 0 : stderr.data) ?? "", [stderr == null ? void 0 : stderr.data]);
|
|
@@ -5497,13 +5497,17 @@ const TaskPreview = React.memo(function TaskPreview2({
|
|
|
5497
5497
|
return ir === null ? "logs" : "output";
|
|
5498
5498
|
});
|
|
5499
5499
|
}, [isLoading, ir]);
|
|
5500
|
+
const hasData = React.useMemo(() => {
|
|
5501
|
+
var _a;
|
|
5502
|
+
return (preview == null ? void 0 : preview.refType) === "value" && ((_a = preview == null ? void 0 : preview.hash) == null ? void 0 : _a.type) === "some";
|
|
5503
|
+
}, [preview]);
|
|
5500
5504
|
const outputPanel = React.useMemo(() => {
|
|
5501
|
-
if (
|
|
5505
|
+
if (preview && !hasData) {
|
|
5502
5506
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5503
5507
|
StatusDisplay,
|
|
5504
5508
|
{
|
|
5505
5509
|
variant: "info",
|
|
5506
|
-
title:
|
|
5510
|
+
title: "No output available",
|
|
5507
5511
|
message: "Run the task to see output"
|
|
5508
5512
|
}
|
|
5509
5513
|
);
|
|
@@ -5540,9 +5544,9 @@ const TaskPreview = React.memo(function TaskPreview2({
|
|
|
5540
5544
|
if (ir !== null) {
|
|
5541
5545
|
return /* @__PURE__ */ jsxRuntime.jsx(react.Box, { height: "100%", overflow: "auto", p: "4", children: /* @__PURE__ */ jsxRuntime.jsx(eastUiComponents.EastChakraComponent, { value: ir }) });
|
|
5542
5546
|
}
|
|
5543
|
-
if (
|
|
5547
|
+
if (rawOutput && ir === null) {
|
|
5544
5548
|
try {
|
|
5545
|
-
const decoded = east.decodeBeast2(
|
|
5549
|
+
const decoded = east.decodeBeast2(rawOutput);
|
|
5546
5550
|
return /* @__PURE__ */ jsxRuntime.jsx(react.Box, { height: "100%", overflow: "auto", p: "4", children: /* @__PURE__ */ jsxRuntime.jsx(EastValueViewer, { type: decoded.type, value: decoded.value }) });
|
|
5547
5551
|
} catch (e2) {
|
|
5548
5552
|
const errorMessage = e2 instanceof Error ? e2.message : String(e2);
|
|
@@ -5556,7 +5560,7 @@ const TaskPreview = React.memo(function TaskPreview2({
|
|
|
5556
5560
|
title: `No output available for task "${task}"`
|
|
5557
5561
|
}
|
|
5558
5562
|
);
|
|
5559
|
-
}, [preview, ir, task, isLoading,
|
|
5563
|
+
}, [preview, ir, task, isLoading, rawOutput, hasData]);
|
|
5560
5564
|
const activeLogContent = React.useMemo(() => tabs.value === "stderr" ? stderrContent : stdoutContent, [tabs.value, stderrContent, stdoutContent]);
|
|
5561
5565
|
const logsPanel = React.useMemo(() => {
|
|
5562
5566
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5617,10 +5621,7 @@ const TaskPreview = React.memo(function TaskPreview2({
|
|
|
5617
5621
|
),
|
|
5618
5622
|
/* @__PURE__ */ jsxRuntime.jsx(react.Box, { flex: 1, overflow: "hidden", minHeight: 0, children: viewMode === "output" ? outputPanel : logsPanel })
|
|
5619
5623
|
] }) });
|
|
5620
|
-
}, (prev, next) =>
|
|
5621
|
-
var _a, _b;
|
|
5622
|
-
return prev.task === next.task && prev.repo === next.repo && prev.workspace === next.workspace && prev.outputHash === next.outputHash && ((_a = prev.taskInfo) == null ? void 0 : _a.status.type) === ((_b = next.taskInfo) == null ? void 0 : _b.status.type);
|
|
5623
|
-
});
|
|
5624
|
+
}, (prev, next) => prev.task === next.task && prev.repo === next.repo && prev.workspace === next.workspace && prev.output === next.output);
|
|
5624
5625
|
exports.EastValueViewer = EastValueViewer;
|
|
5625
5626
|
exports.ErrorBoundary = ErrorBoundary;
|
|
5626
5627
|
exports.InputPreview = InputPreview;
|