@evergis/react 3.1.68 → 3.1.69
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/Dashboard/containers/TaskContainer/components/LogDialog/constants.d.ts +3 -1
- package/dist/components/Dashboard/containers/TaskContainer/components/LogDialog/styled.d.ts +2 -3
- package/dist/components/Dashboard/containers/TaskContainer/components/StatusWaitingButton/index.d.ts +12 -0
- package/dist/components/Dashboard/containers/TaskContainer/components/StatusWaitingButton/styled.d.ts +5 -0
- package/dist/components/Dashboard/types.d.ts +2 -2
- package/dist/index.js +49 -35
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +50 -36
- package/dist/react.esm.js.map +1 -1
- package/package.json +3 -3
- package/dist/components/Dashboard/containers/TaskContainer/styled.d.ts +0 -5
package/dist/components/Dashboard/containers/TaskContainer/components/LogDialog/constants.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { RemoteTaskStatus } from '@evergis/api';
|
|
2
|
+
import { IconTypesKeys } from '@evergis/uilib-gl';
|
|
2
3
|
export declare const STATUS_TRANSLATION_KEYS: Partial<Record<RemoteTaskStatus, string>>;
|
|
3
|
-
export declare const
|
|
4
|
+
export declare const STATUS_TITLES: Partial<Record<RemoteTaskStatus, string>>;
|
|
4
5
|
export declare const STATUS_COLORS: Partial<Record<RemoteTaskStatus, string>>;
|
|
6
|
+
export declare const STATUS_ICONS: Partial<Record<RemoteTaskStatus, IconTypesKeys>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare const StatusBadge: import('styled-components').StyledComponent<
|
|
2
|
-
|
|
1
|
+
export declare const StatusBadge: import('styled-components').StyledComponent<import('react').FC<import('@evergis/uilib-gl').IChipProps>, any, {
|
|
2
|
+
bgColor?: string;
|
|
3
3
|
}, never>;
|
|
4
|
-
export declare const LogContainer: import('styled-components').StyledComponent<"div", any, {}, never>;
|
package/dist/components/Dashboard/containers/TaskContainer/components/StatusWaitingButton/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { RemoteTaskStatus } from '@evergis/api';
|
|
3
|
+
import { IconTypesKeys } from '@evergis/uilib-gl';
|
|
4
|
+
export declare const StatusWaitingButton: FC<{
|
|
5
|
+
title: string;
|
|
6
|
+
icon: IconTypesKeys;
|
|
7
|
+
status: RemoteTaskStatus;
|
|
8
|
+
statusColors: Record<RemoteTaskStatus, string>;
|
|
9
|
+
isWaiting: boolean;
|
|
10
|
+
isDisabled: boolean;
|
|
11
|
+
onClick: VoidFunction;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RemoteTaskStatus } from '@evergis/api';
|
|
2
|
+
export declare const StyledButton: import('styled-components').StyledComponent<"button", any, import('@evergis/uilib-gl').IButtonProps & {
|
|
3
|
+
status?: RemoteTaskStatus;
|
|
4
|
+
statusColors?: Record<RemoteTaskStatus, string>;
|
|
5
|
+
}, never>;
|
|
@@ -3,7 +3,7 @@ import { Projection } from 'mapbox-gl';
|
|
|
3
3
|
import { i18n } from 'i18next';
|
|
4
4
|
import { AttributeDefinitionDc, AttributeFormatDefinitionDc, AttributeType, EqlRequestDc, FeatureDc, GeometryType, PagedFeaturesListDc, PositionDc, RemoteTaskStatus, StringSubType } from '@evergis/api';
|
|
5
5
|
import { PieChartData, BarChartMarker } from '@evergis/charts';
|
|
6
|
-
import { IOption } from '@evergis/uilib-gl';
|
|
6
|
+
import { IconTypesKeys, IOption } from '@evergis/uilib-gl';
|
|
7
7
|
import { FeatureAttributeValue, EditGeometryType, LayerInfo, ThemeName } from '../../types';
|
|
8
8
|
import { InnerContainerProps } from './containers/DataSourceInnerContainer/types';
|
|
9
9
|
export interface DashboardsProps {
|
|
@@ -115,7 +115,7 @@ export interface ConfigOptions {
|
|
|
115
115
|
expanded?: boolean;
|
|
116
116
|
expandLength?: number;
|
|
117
117
|
wrap?: boolean;
|
|
118
|
-
icon?:
|
|
118
|
+
icon?: IconTypesKeys;
|
|
119
119
|
iconUrl?: string;
|
|
120
120
|
big?: boolean;
|
|
121
121
|
bigIcon?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -4890,11 +4890,12 @@ const usePythonTask = () => {
|
|
|
4890
4890
|
setStatus(data.status);
|
|
4891
4891
|
setLog([logRef.current, data.log].filter(Boolean).join("\n\n"));
|
|
4892
4892
|
setExecutionTime(Date.now() - start);
|
|
4893
|
+
setLoading(false);
|
|
4893
4894
|
setTaskId([api.RemoteTaskStatus.Completed, api.RemoteTaskStatus.Error].includes(data.status)
|
|
4894
|
-
?
|
|
4895
|
+
? null
|
|
4895
4896
|
: newTaskId);
|
|
4896
4897
|
setSubscriptionId([api.RemoteTaskStatus.Completed, api.RemoteTaskStatus.Error].includes(data.status)
|
|
4897
|
-
?
|
|
4898
|
+
? null
|
|
4898
4899
|
: newSubscriptionId);
|
|
4899
4900
|
if ([api.RemoteTaskStatus.Completed, api.RemoteTaskStatus.Error].includes(data.status)) {
|
|
4900
4901
|
unsubscribeById(newSubscriptionId);
|
|
@@ -6762,38 +6763,26 @@ const UploadContainer = React.memo(({ type, elementConfig, renderElement }) => {
|
|
|
6762
6763
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && renderElement({ id: "uploader", wrap: false })] }));
|
|
6763
6764
|
});
|
|
6764
6765
|
|
|
6765
|
-
const StatusBadge = styled(uilibGl.
|
|
6766
|
-
|
|
6767
|
-
padding: 0.5rem 1rem;
|
|
6768
|
-
background-color: ${({ $statusColor }) => $statusColor};
|
|
6766
|
+
const StatusBadge = styled(uilibGl.Chip) `
|
|
6767
|
+
background-color: ${({ bgColor }) => bgColor};
|
|
6769
6768
|
color: ${({ theme }) => theme.palette.iconContrast};
|
|
6770
|
-
border-radius: 0.25rem;
|
|
6771
|
-
`;
|
|
6772
|
-
styled.div `
|
|
6773
|
-
flex: 1;
|
|
6774
|
-
padding: 1rem;
|
|
6775
|
-
background-color: ${({ theme }) => theme.palette.element};
|
|
6776
|
-
color: ${({ theme }) => theme.palette.textPrimary};
|
|
6777
|
-
font-family: monospace;
|
|
6778
|
-
font-size: 0.875rem;
|
|
6779
|
-
overflow: auto;
|
|
6780
|
-
white-space: pre-wrap;
|
|
6781
|
-
word-break: break-word;
|
|
6782
|
-
border-radius: 0.25rem;
|
|
6783
|
-
max-height: 31.25rem;
|
|
6784
6769
|
`;
|
|
6785
6770
|
|
|
6786
6771
|
const TerminalWrapper = styled.div `
|
|
6787
6772
|
flex: 1;
|
|
6788
6773
|
overflow: hidden;
|
|
6789
6774
|
padding: 0;
|
|
6790
|
-
margin:
|
|
6775
|
+
margin: 0;
|
|
6791
6776
|
box-sizing: border-box;
|
|
6792
6777
|
min-height: 0;
|
|
6793
6778
|
|
|
6794
|
-
|
|
6779
|
+
.xterm-viewport {
|
|
6795
6780
|
overflow-y: auto;
|
|
6796
6781
|
}
|
|
6782
|
+
|
|
6783
|
+
.xterm-screen .xterm-rows span {
|
|
6784
|
+
letter-spacing: 0 !important;
|
|
6785
|
+
}
|
|
6797
6786
|
`;
|
|
6798
6787
|
|
|
6799
6788
|
const LogTerminal = ({ log }) => {
|
|
@@ -6810,15 +6799,16 @@ const LogTerminal = ({ log }) => {
|
|
|
6810
6799
|
const terminal = new xterm.Terminal({
|
|
6811
6800
|
cursorBlink: false,
|
|
6812
6801
|
fontSize: 12,
|
|
6813
|
-
fontFamily: '"
|
|
6802
|
+
fontFamily: '"Nunito Sans", sans-serif',
|
|
6803
|
+
scrollback: 10000,
|
|
6804
|
+
convertEol: true,
|
|
6805
|
+
lineHeight: 1.5,
|
|
6806
|
+
letterSpacing: 0,
|
|
6814
6807
|
theme: {
|
|
6815
|
-
background: theme.palette.
|
|
6808
|
+
background: theme.palette.background,
|
|
6816
6809
|
foreground: theme.palette.textPrimary,
|
|
6817
6810
|
cursor: theme.palette.primary,
|
|
6818
6811
|
},
|
|
6819
|
-
scrollback: 10000,
|
|
6820
|
-
convertEol: true,
|
|
6821
|
-
lineHeight: 1.5,
|
|
6822
6812
|
});
|
|
6823
6813
|
// Create fit addon
|
|
6824
6814
|
const fitAddon = new addonFit.FitAddon();
|
|
@@ -6902,9 +6892,9 @@ const STATUS_TRANSLATION_KEYS = {
|
|
|
6902
6892
|
[api.RemoteTaskStatus.Error]: "taskError",
|
|
6903
6893
|
[api.RemoteTaskStatus.Unknown]: "taskUnknown",
|
|
6904
6894
|
};
|
|
6905
|
-
const
|
|
6906
|
-
[api.RemoteTaskStatus.Process]: "
|
|
6907
|
-
[api.RemoteTaskStatus.Completed]: "
|
|
6895
|
+
const STATUS_TITLES = {
|
|
6896
|
+
[api.RemoteTaskStatus.Process]: "В процессе",
|
|
6897
|
+
[api.RemoteTaskStatus.Completed]: "Выполнено",
|
|
6908
6898
|
[api.RemoteTaskStatus.Error]: "Ошибка",
|
|
6909
6899
|
[api.RemoteTaskStatus.Unknown]: "Неизвестно",
|
|
6910
6900
|
};
|
|
@@ -6914,21 +6904,30 @@ const STATUS_COLORS = {
|
|
|
6914
6904
|
[api.RemoteTaskStatus.Error]: "#f44336",
|
|
6915
6905
|
[api.RemoteTaskStatus.Unknown]: "#757575",
|
|
6916
6906
|
};
|
|
6907
|
+
const STATUS_ICONS = {
|
|
6908
|
+
[api.RemoteTaskStatus.Process]: "loading_circle",
|
|
6909
|
+
[api.RemoteTaskStatus.Completed]: "success",
|
|
6910
|
+
[api.RemoteTaskStatus.Error]: "error",
|
|
6911
|
+
[api.RemoteTaskStatus.Unknown]: "play",
|
|
6912
|
+
};
|
|
6917
6913
|
|
|
6918
6914
|
const LogDialog = ({ isOpen, onClose, logs, status, statusColors }) => {
|
|
6919
6915
|
const { t } = useGlobalContext();
|
|
6920
|
-
const
|
|
6916
|
+
const getStatusTitle = React.useCallback((status) => {
|
|
6921
6917
|
const translationKey = STATUS_TRANSLATION_KEYS[status] || STATUS_TRANSLATION_KEYS[api.RemoteTaskStatus.Unknown];
|
|
6922
|
-
const defaultValue =
|
|
6918
|
+
const defaultValue = STATUS_TITLES[status] || STATUS_TITLES[api.RemoteTaskStatus.Unknown];
|
|
6923
6919
|
return t(translationKey, { ns: "dashboard", defaultValue });
|
|
6924
6920
|
}, [t]);
|
|
6925
6921
|
const getStatusColor = React.useCallback((status) => {
|
|
6926
6922
|
return statusColors?.[status] || STATUS_COLORS[status] || STATUS_COLORS[api.RemoteTaskStatus.Unknown];
|
|
6927
6923
|
}, [statusColors]);
|
|
6928
|
-
return (jsxRuntime.jsxs(uilibGl.Dialog, { isOpen: isOpen, onCloseRequest: onClose, modal: true, maxWidth: "800px", minWidth: "600px", minHeight: "
|
|
6924
|
+
return (jsxRuntime.jsxs(uilibGl.Dialog, { isOpen: isOpen, onCloseRequest: onClose, modal: true, maxWidth: "800px", minWidth: "600px", minHeight: "600px", children: [jsxRuntime.jsx(uilibGl.DialogTitle, { children: jsxRuntime.jsxs(uilibGl.Flex, { justifyContent: "space-between", alignItems: "center", children: [jsxRuntime.jsxs(uilibGl.Flex, { alignItems: "center", children: [jsxRuntime.jsx(uilibGl.FlexSpan, { marginRight: "1rem", children: t("taskLogs", { ns: "dashboard", defaultValue: "Логи выполнения задачи" }) }), jsxRuntime.jsx(StatusBadge, { text: getStatusTitle(status), bgColor: getStatusColor(status) })] }), jsxRuntime.jsx(uilibGl.IconButton, { kind: "close", onClick: onClose })] }) }), jsxRuntime.jsx(uilibGl.DialogContent, { children: jsxRuntime.jsx(uilibGl.Flex, { flexDirection: "column", height: "100%", marginBottom: "2rem", children: jsxRuntime.jsx(LogTerminal, { log: logs || t("taskLogsEmpty", { ns: "dashboard", defaultValue: "Логи отсутствуют" }) }) }) })] }));
|
|
6929
6925
|
};
|
|
6930
6926
|
|
|
6931
|
-
const
|
|
6927
|
+
const StyledButton = styled(uilibGl.FlatButton) `
|
|
6928
|
+
display: flex;
|
|
6929
|
+
align-items: center;
|
|
6930
|
+
|
|
6932
6931
|
${({ status = api.RemoteTaskStatus.Unknown, statusColors }) => !!statusColors?.[status] && styled.css `
|
|
6933
6932
|
transition: background-color ${uilibGl.transition.toggle};
|
|
6934
6933
|
background-color: ${statusColors[status]};
|
|
@@ -6939,6 +6938,21 @@ const StatusWaitingButton = styled(uilibGl.WaitingButton) `
|
|
|
6939
6938
|
`}
|
|
6940
6939
|
`;
|
|
6941
6940
|
|
|
6941
|
+
const StatusWaitingButton = ({ title, icon = "play", status, statusColors, isWaiting, isDisabled, onClick }) => {
|
|
6942
|
+
const { t } = useGlobalContext();
|
|
6943
|
+
const renderTitle = React.useMemo(() => status === api.RemoteTaskStatus.Process
|
|
6944
|
+
? t("", { ns: "dashboard", defaultValue: "Остановить" })
|
|
6945
|
+
: status === api.RemoteTaskStatus.Unknown ? title : STATUS_TITLES[status], [status, t, title]);
|
|
6946
|
+
const renderIcon = React.useMemo(() => {
|
|
6947
|
+
const iconComponent = isWaiting ? (jsxRuntime.jsx(uilibGl.CircularProgress, { diameter: 1, theme: uilibGl.darkTheme }))
|
|
6948
|
+
: status !== api.RemoteTaskStatus.Unknown
|
|
6949
|
+
? jsxRuntime.jsx(uilibGl.Icon, { kind: STATUS_ICONS[status] })
|
|
6950
|
+
: jsxRuntime.jsx(uilibGl.Icon, { kind: icon });
|
|
6951
|
+
return (jsxRuntime.jsx(uilibGl.FlexSpan, { marginRight: renderTitle ? "0.5rem" : 0, children: iconComponent }));
|
|
6952
|
+
}, [icon, isWaiting, renderTitle, status]);
|
|
6953
|
+
return (jsxRuntime.jsxs(StyledButton, { status: status, statusColors: statusColors, disabled: isDisabled, onClick: onClick, children: [renderIcon, renderTitle] }));
|
|
6954
|
+
};
|
|
6955
|
+
|
|
6942
6956
|
const TaskContainer = React.memo(({ type, elementConfig, renderElement }) => {
|
|
6943
6957
|
const { t, ewktGeometry } = useGlobalContext();
|
|
6944
6958
|
const { dataSources, filters: selectedFilters } = useWidgetContext(type);
|
|
@@ -6962,7 +6976,7 @@ const TaskContainer = React.memo(({ type, elementConfig, renderElement }) => {
|
|
|
6962
6976
|
return runTask({ resourceId, parameters: newParams, script, fileName, methodName });
|
|
6963
6977
|
}));
|
|
6964
6978
|
}, [currentPage.filters, dataSources, ewktGeometry, relatedResources, runTask, selectedFilters, stopTask, taskId]);
|
|
6965
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), jsxRuntime.jsxs(uilibGl.Flex, { justifyContent: center ? "center" : "flex-start", children: [jsxRuntime.
|
|
6979
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), jsxRuntime.jsxs(uilibGl.Flex, { justifyContent: center ? "center" : "flex-start", children: [jsxRuntime.jsx(StatusWaitingButton, { title: title || t("run", { ns: "dashboard", defaultValue: "Запуск" }), icon: icon, status: status, statusColors: statusColors, isWaiting: loading || !!taskId, isDisabled: !relatedResources?.length, onClick: onClick }), !!(log || taskId) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(uilibGl.IconButton, { kind: "info", onClick: openLog }), jsxRuntime.jsx(LogDialog, { logs: log, status: status, statusColors: statusColors, isOpen: isLogDialogOpen, onClose: closeLog })] }))] })] }));
|
|
6966
6980
|
});
|
|
6967
6981
|
|
|
6968
6982
|
const containerComponents = {
|