@eccenca/gui-elements 23.4.0-rc.0 → 23.4.1
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/CHANGELOG.md +16 -1
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js +3 -2
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js +11 -6
- package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
- package/dist/cjs/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js +7 -4
- package/dist/cjs/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js.map +1 -1
- package/dist/cjs/components/Icon/TestIcon.js +4 -4
- package/dist/cjs/components/Icon/TestIcon.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +5 -0
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js +3 -2
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/SilkActivityControl.js +14 -9
- package/dist/esm/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
- package/dist/esm/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js +8 -4
- package/dist/esm/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.js.map +1 -1
- package/dist/esm/components/Icon/TestIcon.js +4 -4
- package/dist/esm/components/Icon/TestIcon.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +5 -0
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/types/cmem/ActivityControl/ActivityControlTypes.d.ts +1 -0
- package/dist/types/cmem/ActivityControl/ActivityControlWidget.d.ts +4 -0
- package/dist/types/cmem/ActivityControl/SilkActivityControl.d.ts +8 -4
- package/dist/types/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.d.ts +5 -4
- package/dist/types/components/Icon/TestIcon.d.ts +2 -1
- package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
- package/package.json +6 -3
- package/src/cmem/ActivityControl/ActivityControlTypes.ts +2 -0
- package/src/cmem/ActivityControl/ActivityControlWidget.tsx +6 -0
- package/src/cmem/ActivityControl/SilkActivityControl.tsx +78 -46
- package/src/cmem/DateTimeDisplay/ElapsedDateTimeDisplay.tsx +12 -4
- package/src/components/Icon/TestIcon.tsx +9 -13
- package/src/components/Icon/canonicalIconNames.tsx +10 -0
- package/src/components/Icon/stories/Icon.stories.tsx +17 -30
- package/src/components/Icon/stories/TestIcon.stories.tsx +8 -9
- package/src/components/OverviewItem/overviewitem.scss +27 -33
|
@@ -59,6 +59,10 @@ export interface ActivityControlWidgetProps extends TestableComponent {
|
|
|
59
59
|
* if this is set the spinner is replaced when the progress has finished from 0 - 1
|
|
60
60
|
*/
|
|
61
61
|
progressSpinnerFinishedIcon?: React.ReactElement<IconProps> | React.ReactElement<TestIconProps>;
|
|
62
|
+
/**
|
|
63
|
+
* execution timer messages for waiting and running times.
|
|
64
|
+
*/
|
|
65
|
+
timerExecutionMsg?: JSX.Element | null;
|
|
62
66
|
}
|
|
63
67
|
export declare type IActivityControlProps = ActivityControlWidgetProps;
|
|
64
68
|
interface IActivityContextMenu extends TestableComponent {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TestableComponent } from "../../components/interfaces";
|
|
2
1
|
import React from "react";
|
|
3
|
-
import { SilkActivityStatusConcrete, SilkActivityStatusProps } from "./ActivityControlTypes";
|
|
4
2
|
import { Intent } from "@blueprintjs/core/src/common/intent";
|
|
3
|
+
import { TestableComponent } from "../../components/interfaces";
|
|
5
4
|
import { TimeUnits } from "../DateTimeDisplay/ElapsedDateTimeDisplay";
|
|
5
|
+
import { SilkActivityStatusConcrete, SilkActivityStatusProps } from "./ActivityControlTypes";
|
|
6
6
|
export interface SilkActivityControlProps extends TestableComponent {
|
|
7
7
|
label: string | JSX.Element;
|
|
8
8
|
/**
|
|
@@ -34,6 +34,10 @@ export interface SilkActivityControlProps extends TestableComponent {
|
|
|
34
34
|
layoutConfig?: SilkActivityControlLayoutProps;
|
|
35
35
|
/** Configures when the status message should be hidden, e.g. because it is uninteresting. */
|
|
36
36
|
hideMessageOnStatus?: (concreteStatus: SilkActivityStatusConcrete | undefined) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The translation of the time units
|
|
39
|
+
*/
|
|
40
|
+
translateUnits?: (unit: TimeUnits) => string;
|
|
37
41
|
}
|
|
38
42
|
export interface SilkActivityControlLayoutProps {
|
|
39
43
|
small?: boolean;
|
|
@@ -66,7 +70,7 @@ export interface SilkActivityExecutionReportProps {
|
|
|
66
70
|
}
|
|
67
71
|
export declare type IActivityExecutionReport = SilkActivityExecutionReportProps;
|
|
68
72
|
interface IStacktrace {
|
|
69
|
-
errorMessage?:
|
|
73
|
+
errorMessage?: string;
|
|
70
74
|
lines: string[];
|
|
71
75
|
cause?: IStacktrace;
|
|
72
76
|
}
|
|
@@ -76,7 +80,7 @@ export declare type ActivityAction = "start" | "cancel" | "restart";
|
|
|
76
80
|
export declare type SilkActivityControlAction = ActivityAction;
|
|
77
81
|
/** Silk activity control. */
|
|
78
82
|
export declare function SilkActivityControl(props: SilkActivityControlProps): React.JSX.Element;
|
|
79
|
-
export declare function useSilkActivityControl({ label, initialStatus, registerForUpdates, executeActivityAction, showReloadAction, showStartAction, viewValueAction, showStopAction, failureReportAction, unregisterFromUpdates, translate, elapsedTimeOfLastStart, tags, layoutConfig, hideMessageOnStatus, executePrioritized, ...props }: SilkActivityControlProps): {
|
|
83
|
+
export declare function useSilkActivityControl({ label, initialStatus, registerForUpdates, executeActivityAction, showReloadAction, showStartAction, viewValueAction, showStopAction, failureReportAction, unregisterFromUpdates, translate, elapsedTimeOfLastStart, tags, layoutConfig, hideMessageOnStatus, executePrioritized, translateUnits, ...props }: SilkActivityControlProps): {
|
|
80
84
|
readonly elapsedDateTime: React.JSX.Element;
|
|
81
85
|
readonly intent: Intent;
|
|
82
86
|
readonly widget: React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TestableComponent } from "../../components/interfaces";
|
|
3
|
-
export declare type TimeUnits = "minute" | "minutes" | "hour" | "hours" | "day" | "days";
|
|
3
|
+
export declare type TimeUnits = "second" | "seconds" | "minute" | "minutes" | "hour" | "hours" | "day" | "days";
|
|
4
4
|
export declare type ElapsedDateTimeDisplayUnits = TimeUnits;
|
|
5
5
|
export interface ElapsedDateTimeDisplayProps extends TestableComponent {
|
|
6
6
|
dateTime: string | number;
|
|
@@ -8,6 +8,7 @@ export interface ElapsedDateTimeDisplayProps extends TestableComponent {
|
|
|
8
8
|
suffix?: string;
|
|
9
9
|
showDateTimeTooltip?: boolean;
|
|
10
10
|
translateUnits: (unit: ElapsedDateTimeDisplayUnits) => string;
|
|
11
|
+
includeSeconds?: boolean;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* Returns a segmentation of the elapsed time, i.e. an array with the nr of days, hours, minutes, seconds
|
|
@@ -18,12 +19,12 @@ export declare const elapsedTimeSegmented: (elapsedTimeInMs: number) => number[]
|
|
|
18
19
|
* Returns the simplified elapsed time
|
|
19
20
|
* @deprecated moved to `elapsedDateTimeDisplayUtils.simplifiedElapsedTime`
|
|
20
21
|
*/
|
|
21
|
-
export declare const simplifiedElapsedTime: (timeSegments: number[], translateUnits: (unit: ElapsedDateTimeDisplayUnits) => string) => string;
|
|
22
|
+
export declare const simplifiedElapsedTime: (timeSegments: number[], translateUnits: (unit: ElapsedDateTimeDisplayUnits) => string, includeSeconds?: boolean) => string;
|
|
22
23
|
/**
|
|
23
24
|
* Displays the elapsed time in a human readable way.
|
|
24
25
|
*/
|
|
25
|
-
export declare const ElapsedDateTimeDisplay: ({ dateTime, prefix, suffix, showDateTimeTooltip, translateUnits, ...otherProps }: ElapsedDateTimeDisplayProps) => React.JSX.Element;
|
|
26
|
+
export declare const ElapsedDateTimeDisplay: ({ dateTime, prefix, suffix, showDateTimeTooltip, translateUnits, includeSeconds, ...otherProps }: ElapsedDateTimeDisplayProps) => React.JSX.Element;
|
|
26
27
|
export declare const elapsedDateTimeDisplayUtils: {
|
|
27
28
|
elapsedTimeSegmented: (elapsedTimeInMs: number) => number[];
|
|
28
|
-
simplifiedElapsedTime: (timeSegments: number[], translateUnits: (unit: ElapsedDateTimeDisplayUnits) => string) => string;
|
|
29
|
+
simplifiedElapsedTime: (timeSegments: number[], translateUnits: (unit: ElapsedDateTimeDisplayUnits) => string, includeSeconds?: boolean) => string;
|
|
29
30
|
};
|
|
@@ -13,7 +13,8 @@ export interface TestIconProps extends Omit<BaseIconProps, "iconComponent"> {
|
|
|
13
13
|
* Example usage:
|
|
14
14
|
* ```
|
|
15
15
|
* import { LogoReact } from "@carbon/icons-react";
|
|
16
|
-
*
|
|
16
|
+
* import { TestIcon } from "@eccenca/gui-elements";
|
|
17
|
+
* const testIcon = <TestIcon tryout={LogoReact} />;
|
|
17
18
|
* ```
|
|
18
19
|
*/
|
|
19
20
|
export declare const TestIcon: ({ className, tryout, ...otherBaseIconProps }: TestIconProps) => React.JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { IconProps as CarbonIconProps } from "carbon-components-react";
|
|
3
3
|
/** Valid icon names. */
|
|
4
|
-
export declare type ValidIconName = "application-activities" | "application-dataintegration" | "application-explore" | "application-homepage" | "application-legacygui" | "application-mapping" | "application-queries" | "application-useraccount" | "application-vocabularies" | "application-warning" | "application-hotkeys" | "artefact-chatlog" | "artefact-commit" | "artefact-customtask" | "artefact-dataset" | "artefact-dataset-csv" | "artefact-dataset-eccencadataplatform" | "artefact-dataset-excel" | "artefact-dataset-file" | "artefact-dataset-jdbc" | "artefact-dataset-json" | "artefact-dataset-multicsv" | "artefact-dataset-neo4j" | "artefact-dataset-sparkview" | "artefact-dataset-sparqlendpoint" | "artefact-dataset-sqlendpoint" | "artefact-dataset-xml" | "artefact-deprecated" | "artefact-embedded" | "artefact-errorlog" | "artefact-file" | "artefact-linking" | "artefact-project" | "artefact-rawdata" | "artefact-remote" | "artefact-report" | "artefact-task" | "artefact-transform" | "artefact-uncategorized" | "artefact-workflow" | "data-sourcepath" | "data-targetpath" | "entity-human" | "entity-robot" | "item-add-artefact" | "item-clone" | "item-comment" | "item-copy" | "item-download" | "item-draggable" | "item-edit" | "item-evaluation" | "item-execution" | "item-info" | "item-launch" | "item-moremenu" | "item-question" | "item-reload" | "item-remove" | "item-reset" | "item-save" | "item-settings" | "item-shuffle" | "item-skip-forward" | "item-start" | "item-stop" | "item-upload" | "item-vertmenu" | "item-viewdetails" | "item-hidedetails" | "list-sort" | "list-sortasc" | "list-sortdesc" | "module-accesscontrol" | "module-annotation" | "module-dashboard" | "module-gdprsearch" | "module-integrations" | "module-linkedrules" | "module-reports" | "module-search" | "module-thesauri" | "module-timetracker" | "module-visualization" | "navigation-back" | "navigation-close" | "navigation-down" | "navigation-first" | "navigation-forth" | "navigation-jump" | "navigation-last" | "navigation-left" | "navigation-next" | "navigation-previous" | "navigation-right" | "navigation-up" | "operation-aggregation" | "operation-autolayout" | "operation-clear" | "operation-commit" | "operation-comparison" | "operation-erase" | "operation-filter" | "operation-filteredit" | "operation-filterremove" | "operation-fix" | "operation-link" | "operation-logout" | "operation-magic" | "operation-merge" | "operation-redo" | "operation-search" | "operation-sharelink" | "operation-transform" | "operation-translate" | "operation-undo" | "operation-unlink" | "state-checked" | "state-checkedsimple" | "state-confirmed" | "state-danger" | "state-declined" | "state-info" | "state-partlychecked" | "state-protected" | "state-success" | "state-unchecked" | "state-warning" | "toggler-caret" | "toggler-caretright" | "toggler-caretdown" | "toggler-maximize" | "toggler-minimize" | "toggler-moveleft" | "toggler-moveright" | "toggler-rowexpand" | "toggler-rowcollapse" | "toggler-showless" | "toggler-showmore" | "toggler-star-empty" | "toggler-star-filled" | "toggler-tree" | "form-template" | "undefined";
|
|
4
|
+
export declare type ValidIconName = "application-activities" | "application-dataintegration" | "application-explore" | "application-homepage" | "application-legacygui" | "application-mapping" | "application-queries" | "application-useraccount" | "application-vocabularies" | "application-warning" | "application-hotkeys" | "artefact-chatlog" | "artefact-commit" | "artefact-customtask" | "artefact-dataset" | "artefact-dataset-csv" | "artefact-dataset-eccencadataplatform" | "artefact-dataset-excel" | "artefact-dataset-file" | "artefact-dataset-jdbc" | "artefact-dataset-json" | "artefact-dataset-multicsv" | "artefact-dataset-neo4j" | "artefact-dataset-sparkview" | "artefact-dataset-sparqlendpoint" | "artefact-dataset-sqlendpoint" | "artefact-dataset-xml" | "artefact-deprecated" | "artefact-embedded" | "artefact-errorlog" | "artefact-file" | "artefact-linking" | "artefact-project" | "artefact-rawdata" | "artefact-remote" | "artefact-report" | "artefact-task" | "artefact-transform" | "artefact-uncategorized" | "artefact-workflow" | "data-sourcepath" | "data-targetpath" | "data-string" | "data-date" | "data-time" | "data-datetime" | "data-number" | "entity-human" | "entity-robot" | "item-add-artefact" | "item-clone" | "item-comment" | "item-copy" | "item-download" | "item-draggable" | "item-edit" | "item-evaluation" | "item-execution" | "item-info" | "item-launch" | "item-moremenu" | "item-question" | "item-reload" | "item-remove" | "item-reset" | "item-save" | "item-settings" | "item-shuffle" | "item-skip-forward" | "item-start" | "item-stop" | "item-upload" | "item-vertmenu" | "item-viewdetails" | "item-hidedetails" | "list-sort" | "list-sortasc" | "list-sortdesc" | "module-accesscontrol" | "module-annotation" | "module-dashboard" | "module-gdprsearch" | "module-integrations" | "module-linkedrules" | "module-reports" | "module-search" | "module-thesauri" | "module-timetracker" | "module-visualization" | "navigation-back" | "navigation-close" | "navigation-down" | "navigation-first" | "navigation-forth" | "navigation-jump" | "navigation-last" | "navigation-left" | "navigation-next" | "navigation-previous" | "navigation-right" | "navigation-up" | "operation-aggregation" | "operation-autolayout" | "operation-clear" | "operation-commit" | "operation-comparison" | "operation-erase" | "operation-filter" | "operation-filteredit" | "operation-filterremove" | "operation-fix" | "operation-link" | "operation-logout" | "operation-magic" | "operation-merge" | "operation-redo" | "operation-search" | "operation-sharelink" | "operation-transform" | "operation-translate" | "operation-undo" | "operation-unlink" | "state-checked" | "state-checkedsimple" | "state-confirmed" | "state-danger" | "state-declined" | "state-info" | "state-partlychecked" | "state-protected" | "state-success" | "state-unchecked" | "state-warning" | "toggler-caret" | "toggler-caretright" | "toggler-caretdown" | "toggler-maximize" | "toggler-minimize" | "toggler-moveleft" | "toggler-moveright" | "toggler-rowexpand" | "toggler-rowcollapse" | "toggler-showless" | "toggler-showmore" | "toggler-star-empty" | "toggler-star-filled" | "toggler-tree" | "form-template" | "undefined";
|
|
5
5
|
export declare type CarbonIconType = React.ComponentType<CarbonIconProps>;
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eccenca/gui-elements",
|
|
3
3
|
"description": "GUI elements based on other libraries, usable in React application, written in Typescript.",
|
|
4
|
-
"version": "23.4.
|
|
4
|
+
"version": "23.4.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/eccenca/gui-elements",
|
|
7
7
|
"bugs": "https://github.com/eccenca/gui-elements/issues",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@blueprintjs/popover2": "^1.14.1",
|
|
67
67
|
"@blueprintjs/select": "^4.9.14",
|
|
68
68
|
"@carbon/icons": "^11.19.0",
|
|
69
|
-
"@carbon/icons-react": "
|
|
69
|
+
"@carbon/icons-react": "11.19.0",
|
|
70
70
|
"@carbon/styles": "1.32.0",
|
|
71
71
|
"@mavrin/remark-typograf": "^2.2.0",
|
|
72
72
|
"carbon-components-react": "^8.28.0",
|
|
@@ -120,6 +120,7 @@
|
|
|
120
120
|
"chromatic": "^6.17.4",
|
|
121
121
|
"eslint": "^8.49.0",
|
|
122
122
|
"eslint-plugin-react": "^7.33.2",
|
|
123
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
123
124
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
124
125
|
"husky": "4",
|
|
125
126
|
"identity-obj-proxy": "^3.0.0",
|
|
@@ -146,6 +147,7 @@
|
|
|
146
147
|
"yargs": "^17.7.2"
|
|
147
148
|
},
|
|
148
149
|
"peerDependencies": {
|
|
150
|
+
"@carbon/icons-react": ">=11.34.1",
|
|
149
151
|
"@carbon/styles": "<1.33.0",
|
|
150
152
|
"@types/carbon-components-react": ">=7",
|
|
151
153
|
"react": ">=16",
|
|
@@ -155,7 +157,8 @@
|
|
|
155
157
|
"**/@babel/traverse": "^7.23.2",
|
|
156
158
|
"**/@types/react": "^17.0.59",
|
|
157
159
|
"**/postcss": "^8.4.31",
|
|
158
|
-
"**/parse5": "^6.0.1"
|
|
160
|
+
"**/parse5": "^6.0.1",
|
|
161
|
+
"**/@carbon/icons-react": "11.19.0"
|
|
159
162
|
},
|
|
160
163
|
"husky": {
|
|
161
164
|
"hooks": {
|
|
@@ -28,6 +28,8 @@ export interface IActivityStatus {
|
|
|
28
28
|
runtime?: number;
|
|
29
29
|
// The start time as date time, e.g. "2021-09-07T09:34:53.153Z"
|
|
30
30
|
startTime?: string;
|
|
31
|
+
// The queue time spent waiting before workflow is executed as date time, e.g. "2021-09-07T09:34:53.153Z"
|
|
32
|
+
queueTime?: string;
|
|
31
33
|
}
|
|
32
34
|
export type SilkActivityStatusProps = IActivityStatus;
|
|
33
35
|
|
|
@@ -76,6 +76,10 @@ export interface ActivityControlWidgetProps extends TestableComponent {
|
|
|
76
76
|
* if this is set the spinner is replaced when the progress has finished from 0 - 1
|
|
77
77
|
*/
|
|
78
78
|
progressSpinnerFinishedIcon?: React.ReactElement<IconProps> | React.ReactElement<TestIconProps>;
|
|
79
|
+
/**
|
|
80
|
+
* execution timer messages for waiting and running times.
|
|
81
|
+
*/
|
|
82
|
+
timerExecutionMsg?: JSX.Element | null
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
// @deprecated use `ActivityControlWidgetProps`
|
|
@@ -122,6 +126,7 @@ export function ActivityControlWidget(props: ActivityControlWidgetProps) {
|
|
|
122
126
|
canShrink,
|
|
123
127
|
tags,
|
|
124
128
|
progressSpinnerFinishedIcon,
|
|
129
|
+
timerExecutionMsg = "",
|
|
125
130
|
labelWrapper = <OverflowText inline={true} />,
|
|
126
131
|
} = props;
|
|
127
132
|
const spinnerClassNames = (progressSpinner?.className ?? "") + ` ${eccgui}-spinner--permanent`;
|
|
@@ -170,6 +175,7 @@ export function ActivityControlWidget(props: ActivityControlWidgetProps) {
|
|
|
170
175
|
)}
|
|
171
176
|
</OverviewItemLine>
|
|
172
177
|
)}
|
|
178
|
+
{timerExecutionMsg && <OverviewItemLine small>{timerExecutionMsg}</OverviewItemLine>}
|
|
173
179
|
</OverviewItemDescription>
|
|
174
180
|
<OverviewItemActions>
|
|
175
181
|
{activityActions &&
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
import {
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Intent } from "@blueprintjs/core/src/common/intent";
|
|
3
|
+
|
|
4
|
+
import { Icon, Spacing } from "../../";
|
|
5
|
+
import { IntentTypes } from "../../common/Intent";
|
|
6
|
+
import { TestableComponent } from "../../components/interfaces";
|
|
7
|
+
import { ElapsedDateTimeDisplay, TimeUnits } from "../DateTimeDisplay/ElapsedDateTimeDisplay";
|
|
8
|
+
|
|
9
|
+
import { SilkActivityStatusConcrete, SilkActivityStatusProps } from "./ActivityControlTypes";
|
|
10
|
+
import { ActivityControlWidget, ActivityControlWidgetProps } from "./ActivityControlWidget";
|
|
11
|
+
import { ActivityExecutionErrorReportModal } from "./ActivityExecutionErrorReportModal";
|
|
10
12
|
|
|
11
13
|
const progressBreakpointIndetermination = 10;
|
|
12
14
|
const progressBreakpointAnimation = 99;
|
|
@@ -59,7 +61,11 @@ export interface SilkActivityControlProps extends TestableComponent {
|
|
|
59
61
|
// configure how the widget is displayed
|
|
60
62
|
layoutConfig?: SilkActivityControlLayoutProps;
|
|
61
63
|
/** Configures when the status message should be hidden, e.g. because it is uninteresting. */
|
|
62
|
-
hideMessageOnStatus?: (concreteStatus: SilkActivityStatusConcrete | undefined) => boolean
|
|
64
|
+
hideMessageOnStatus?: (concreteStatus: SilkActivityStatusConcrete | undefined) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The translation of the time units
|
|
67
|
+
*/
|
|
68
|
+
translateUnits?: (unit: TimeUnits) => string;
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
export interface SilkActivityControlLayoutProps {
|
|
@@ -130,7 +136,7 @@ export type IActivityExecutionReport = SilkActivityExecutionReportProps;
|
|
|
130
136
|
|
|
131
137
|
interface IStacktrace {
|
|
132
138
|
// The final error message of the stacktrace
|
|
133
|
-
errorMessage?:
|
|
139
|
+
errorMessage?: string;
|
|
134
140
|
// The individual elements of the stack trace
|
|
135
141
|
lines: string[];
|
|
136
142
|
// In case of nested stacktraces this may contain the cause of the failure
|
|
@@ -138,7 +144,12 @@ interface IStacktrace {
|
|
|
138
144
|
}
|
|
139
145
|
|
|
140
146
|
// @deprecated use `SilkActivityControlTranslationKeys`
|
|
141
|
-
export type ActivityControlTranslationKeys =
|
|
147
|
+
export type ActivityControlTranslationKeys =
|
|
148
|
+
| "startActivity"
|
|
149
|
+
| "stopActivity"
|
|
150
|
+
| "reloadActivity"
|
|
151
|
+
| "showErrorReport"
|
|
152
|
+
| "startPrioritized";
|
|
142
153
|
export type SilkActivityControlTranslationKeys = ActivityControlTranslationKeys;
|
|
143
154
|
// @deprecated use `SilkActivityControlAction`
|
|
144
155
|
export type ActivityAction = "start" | "cancel" | "restart";
|
|
@@ -167,38 +178,40 @@ export function useSilkActivityControl({
|
|
|
167
178
|
layoutConfig = defaultLayout,
|
|
168
179
|
hideMessageOnStatus = () => false,
|
|
169
180
|
executePrioritized,
|
|
181
|
+
translateUnits = (unit: TimeUnits) => unit.toString(),
|
|
170
182
|
...props
|
|
171
183
|
}: SilkActivityControlProps) {
|
|
172
184
|
const [activityStatus, setActivityStatus] = useState<SilkActivityStatusProps | undefined>(initialStatus);
|
|
173
|
-
const currentStatus = useRef<SilkActivityStatusProps | undefined>(initialStatus)
|
|
174
|
-
const [showStartPrioritized, setShowStartPrioritized] = useState(false)
|
|
185
|
+
const currentStatus = useRef<SilkActivityStatusProps | undefined>(initialStatus);
|
|
186
|
+
const [showStartPrioritized, setShowStartPrioritized] = useState(false);
|
|
175
187
|
const [errorReport, setErrorReport] = useState<string | SilkActivityExecutionReportProps | undefined>(undefined);
|
|
176
188
|
|
|
177
189
|
// Register update function
|
|
178
|
-
useEffect(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
190
|
+
useEffect(
|
|
191
|
+
() => {
|
|
192
|
+
const updateActivityStatus = (status: SilkActivityStatusProps | undefined) => {
|
|
193
|
+
if (status?.concreteStatus !== "Waiting") {
|
|
194
|
+
setShowStartPrioritized(false);
|
|
195
|
+
} else if (executePrioritized) {
|
|
196
|
+
// Show start prioritized button only-if the activity is still in Waiting status after 2s
|
|
197
|
+
setTimeout(() => {
|
|
198
|
+
if (currentStatus.current?.concreteStatus === "Waiting") {
|
|
199
|
+
setShowStartPrioritized(true);
|
|
200
|
+
}
|
|
201
|
+
}, 2000);
|
|
202
|
+
}
|
|
203
|
+
currentStatus.current = status;
|
|
204
|
+
setActivityStatus(status);
|
|
205
|
+
};
|
|
206
|
+
registerForUpdates(updateActivityStatus);
|
|
207
|
+
return unregisterFromUpdates;
|
|
208
|
+
},
|
|
196
209
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
197
210
|
[]
|
|
198
211
|
);
|
|
199
212
|
|
|
200
213
|
// Create activity actions
|
|
201
|
-
const actions: ActivityControlWidgetProps[
|
|
214
|
+
const actions: ActivityControlWidgetProps["activityActions"] = [];
|
|
202
215
|
|
|
203
216
|
if (failureReportAction && activityStatus?.failed && activityStatus.concreteStatus !== "Cancelled") {
|
|
204
217
|
actions.push({
|
|
@@ -211,13 +224,13 @@ export function useSilkActivityControl({
|
|
|
211
224
|
}
|
|
212
225
|
|
|
213
226
|
if (showStartAction) {
|
|
214
|
-
if(showStartPrioritized && executePrioritized) {
|
|
227
|
+
if (showStartPrioritized && executePrioritized) {
|
|
215
228
|
actions.push({
|
|
216
229
|
"data-test-id": "activity-start-prioritized-activity",
|
|
217
230
|
icon: "item-skip-forward",
|
|
218
231
|
action: executePrioritized,
|
|
219
232
|
tooltip: translate("startPrioritized"),
|
|
220
|
-
})
|
|
233
|
+
});
|
|
221
234
|
} else {
|
|
222
235
|
actions.push({
|
|
223
236
|
"data-test-id": "activity-start-activity",
|
|
@@ -286,9 +299,24 @@ export function useSilkActivityControl({
|
|
|
286
299
|
/>
|
|
287
300
|
</>
|
|
288
301
|
) : (
|
|
289
|
-
|
|
302
|
+
label
|
|
290
303
|
);
|
|
291
304
|
|
|
305
|
+
const timerExecutionMessage =
|
|
306
|
+
(activityStatus?.startTime || activityStatus?.queueTime) && activityStatus.statusName !== "Finished" ? (
|
|
307
|
+
<ElapsedDateTimeDisplay
|
|
308
|
+
includeSeconds
|
|
309
|
+
dateTime={
|
|
310
|
+
(activityStatus.statusName === "Running"
|
|
311
|
+
? activityStatus?.startTime
|
|
312
|
+
: activityStatus.statusName === "Waiting"
|
|
313
|
+
? activityStatus.queueTime
|
|
314
|
+
: activityStatus?.startTime)!
|
|
315
|
+
}
|
|
316
|
+
translateUnits={translateUnits}
|
|
317
|
+
/>
|
|
318
|
+
) : null;
|
|
319
|
+
|
|
292
320
|
const { visualization, ...otherLayoutConfig } = layoutConfig;
|
|
293
321
|
let visualizationProps = {}; // visualization==="none" or undefined
|
|
294
322
|
const runningProgress = activityStatus && activityStatus.isRunning;
|
|
@@ -342,7 +370,10 @@ export function useSilkActivityControl({
|
|
|
342
370
|
data-test-id={props["data-test-id"]}
|
|
343
371
|
label={activityControlLabel}
|
|
344
372
|
activityActions={actions}
|
|
345
|
-
|
|
373
|
+
timerExecutionMsg={timerExecutionMessage}
|
|
374
|
+
statusMessage={
|
|
375
|
+
hideMessageOnStatus(activityStatus?.concreteStatus) ? undefined : activityStatus?.message
|
|
376
|
+
}
|
|
346
377
|
{...visualizationProps}
|
|
347
378
|
{...otherLayoutConfig}
|
|
348
379
|
/>
|
|
@@ -363,16 +394,17 @@ export function useSilkActivityControl({
|
|
|
363
394
|
);
|
|
364
395
|
|
|
365
396
|
return {
|
|
366
|
-
elapsedDateTime:
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
397
|
+
elapsedDateTime:
|
|
398
|
+
activityStatus?.startTime && elapsedTimeOfLastStart ? (
|
|
399
|
+
<ElapsedDateTimeDisplay
|
|
400
|
+
dateTime={activityStatus.startTime}
|
|
401
|
+
translateUnits={elapsedTimeOfLastStart.translate}
|
|
402
|
+
/>
|
|
403
|
+
) : (
|
|
404
|
+
<></>
|
|
405
|
+
),
|
|
374
406
|
intent,
|
|
375
|
-
widget
|
|
407
|
+
widget,
|
|
376
408
|
} as const;
|
|
377
409
|
}
|
|
378
410
|
|
|
@@ -2,7 +2,7 @@ import React, {useEffect, useState} from "react";
|
|
|
2
2
|
import {TestableComponent} from "../../components/interfaces";
|
|
3
3
|
|
|
4
4
|
// @deprecated use `ElapsedDateTimeDisplayUnits`
|
|
5
|
-
export type TimeUnits = "minute" | "minutes" | "hour" | "hours" | "day" | "days"
|
|
5
|
+
export type TimeUnits = "second"| "seconds" | "minute" | "minutes" | "hour" | "hours" | "day" | "days"
|
|
6
6
|
export type ElapsedDateTimeDisplayUnits = TimeUnits;
|
|
7
7
|
|
|
8
8
|
export interface ElapsedDateTimeDisplayProps extends TestableComponent {
|
|
@@ -16,6 +16,7 @@ export interface ElapsedDateTimeDisplayProps extends TestableComponent {
|
|
|
16
16
|
showDateTimeTooltip?: boolean
|
|
17
17
|
// Translate time related vocabulary
|
|
18
18
|
translateUnits: (unit: ElapsedDateTimeDisplayUnits) => string
|
|
19
|
+
includeSeconds?:boolean
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
const dateTimeToElapsedTimeInMs = (dateTime: string | number) => {
|
|
@@ -46,14 +47,20 @@ export const elapsedTimeSegmented = (elapsedTimeInMs: number): number[] => {
|
|
|
46
47
|
* Returns the simplified elapsed time
|
|
47
48
|
* @deprecated moved to `elapsedDateTimeDisplayUtils.simplifiedElapsedTime`
|
|
48
49
|
*/
|
|
49
|
-
export const simplifiedElapsedTime = (timeSegments: number[], translateUnits: (unit: ElapsedDateTimeDisplayUnits) => string) => {
|
|
50
|
+
export const simplifiedElapsedTime = (timeSegments: number[], translateUnits: (unit: ElapsedDateTimeDisplayUnits) => string, includeSeconds = false) => {
|
|
50
51
|
const units: ElapsedDateTimeDisplayUnits[] = ["day", "hour", "minute"]
|
|
52
|
+
|
|
53
|
+
if(includeSeconds){
|
|
54
|
+
units.push("second")
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
// Find first non-null value
|
|
52
58
|
let idx = 0
|
|
53
59
|
while(idx < 3 && timeSegments[idx] === 0) {
|
|
54
60
|
idx++
|
|
55
61
|
}
|
|
56
|
-
|
|
62
|
+
|
|
63
|
+
if(idx === 3 && !includeSeconds) {
|
|
57
64
|
// Do not show exact seconds
|
|
58
65
|
return `< 1 ${translateUnits("minute")}`
|
|
59
66
|
} else {
|
|
@@ -70,6 +77,7 @@ export const ElapsedDateTimeDisplay = ({
|
|
|
70
77
|
suffix = "",
|
|
71
78
|
showDateTimeTooltip = true,
|
|
72
79
|
translateUnits,
|
|
80
|
+
includeSeconds,
|
|
73
81
|
...otherProps
|
|
74
82
|
}: ElapsedDateTimeDisplayProps) => {
|
|
75
83
|
const [elapsedTime, setElapsedTime] = useState<number>(dateTimeToElapsedTimeInMs(dateTime))
|
|
@@ -82,7 +90,7 @@ export const ElapsedDateTimeDisplay = ({
|
|
|
82
90
|
}, [dateTime])
|
|
83
91
|
|
|
84
92
|
return <span data-test-id={otherProps["data-test-id"]} title={showDateTimeTooltip ? new Date(dateTime).toString() : ""}>
|
|
85
|
-
{prefix + simplifiedElapsedTime(elapsedTimeSegmented(elapsedTime), translateUnits) + suffix}
|
|
93
|
+
{prefix + simplifiedElapsedTime(elapsedTimeSegmented(elapsedTime), translateUnits, includeSeconds) + suffix}
|
|
86
94
|
</span>
|
|
87
95
|
}
|
|
88
96
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { CarbonIconType } from "./canonicalIconNames"
|
|
2
|
+
|
|
4
3
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
5
4
|
|
|
5
|
+
import BaseIcon, { BaseIconProps } from "./BaseIcon";
|
|
6
|
+
import { CarbonIconType } from "./canonicalIconNames";
|
|
7
|
+
|
|
6
8
|
export interface TestIconProps extends Omit<BaseIconProps, "iconComponent"> {
|
|
7
9
|
/**
|
|
8
10
|
* Carbon icon that is used instead of the via `name` defined canonical named icon.
|
|
@@ -16,24 +18,18 @@ export interface TestIconProps extends Omit<BaseIconProps, "iconComponent"> {
|
|
|
16
18
|
* Example usage:
|
|
17
19
|
* ```
|
|
18
20
|
* import { LogoReact } from "@carbon/icons-react";
|
|
19
|
-
*
|
|
21
|
+
* import { TestIcon } from "@eccenca/gui-elements";
|
|
22
|
+
* const testIcon = <TestIcon tryout={LogoReact} />;
|
|
20
23
|
* ```
|
|
21
24
|
*/
|
|
22
|
-
export const TestIcon = ({
|
|
23
|
-
className = "",
|
|
24
|
-
tryout,
|
|
25
|
-
...otherBaseIconProps
|
|
26
|
-
}: TestIconProps) => {
|
|
25
|
+
export const TestIcon = ({ className = "", tryout, ...otherBaseIconProps }: TestIconProps) => {
|
|
27
26
|
return (
|
|
28
27
|
<BaseIcon
|
|
29
28
|
iconComponent={tryout}
|
|
30
|
-
className={
|
|
31
|
-
`${eccgui}-icon--test` +
|
|
32
|
-
(className ? ` ${className}` : "")
|
|
33
|
-
}
|
|
29
|
+
className={`${eccgui}-icon--test` + (className ? ` ${className}` : "")}
|
|
34
30
|
{...otherBaseIconProps}
|
|
35
31
|
/>
|
|
36
32
|
);
|
|
37
|
-
}
|
|
33
|
+
};
|
|
38
34
|
|
|
39
35
|
export default TestIcon;
|
|
@@ -45,6 +45,11 @@ export type ValidIconName =
|
|
|
45
45
|
| "artefact-workflow"
|
|
46
46
|
| "data-sourcepath"
|
|
47
47
|
| "data-targetpath"
|
|
48
|
+
| "data-string"
|
|
49
|
+
| "data-date"
|
|
50
|
+
| "data-time"
|
|
51
|
+
| "data-datetime"
|
|
52
|
+
| "data-number"
|
|
48
53
|
| "entity-human"
|
|
49
54
|
| "entity-robot"
|
|
50
55
|
| "item-add-artefact"
|
|
@@ -201,6 +206,11 @@ const canonicalIconNames: Record<ValidIconName, CarbonIconType> = {
|
|
|
201
206
|
|
|
202
207
|
"data-sourcepath": icons.Data_2,
|
|
203
208
|
"data-targetpath": icons.Data_1,
|
|
209
|
+
"data-string": icons.StringText,
|
|
210
|
+
"data-date": icons.Calendar,
|
|
211
|
+
"data-time": icons.Time,
|
|
212
|
+
"data-datetime": icons.EventSchedule,
|
|
213
|
+
"data-number": icons.StringInteger,
|
|
204
214
|
|
|
205
215
|
"entity-human": icons.User,
|
|
206
216
|
"entity-robot": icons.Bot,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
Icon,
|
|
6
|
-
Button,
|
|
7
|
-
} from "../../../index";
|
|
8
|
-
import canonicalIcons, { ValidIconName } from "./../canonicalIconNames";
|
|
9
4
|
import { Definitions } from "../../../common/Intent";
|
|
5
|
+
import { Button, Icon } from "../../../index";
|
|
6
|
+
|
|
7
|
+
import canonicalIcons, { ValidIconName } from "./../canonicalIconNames";
|
|
10
8
|
|
|
11
9
|
export default {
|
|
12
10
|
title: "Components/Icon",
|
|
@@ -14,25 +12,23 @@ export default {
|
|
|
14
12
|
argTypes: {
|
|
15
13
|
name: {
|
|
16
14
|
control: "select",
|
|
17
|
-
options: [...
|
|
15
|
+
options: [...Object.keys(canonicalIcons)],
|
|
18
16
|
},
|
|
19
17
|
intent: {
|
|
20
18
|
control: "select",
|
|
21
|
-
options: {...Definitions},
|
|
19
|
+
options: { ...Definitions },
|
|
22
20
|
},
|
|
23
21
|
},
|
|
24
|
-
} as
|
|
22
|
+
} as Meta<typeof Icon>;
|
|
25
23
|
|
|
26
|
-
const Template:
|
|
27
|
-
<Icon {...args} tooltipText={args.name?.toString()}/>
|
|
28
|
-
);
|
|
24
|
+
const Template: StoryFn<typeof Icon> = (args) => <Icon {...args} tooltipText={args.name?.toString()} />;
|
|
29
25
|
|
|
30
26
|
export const Default = Template.bind({});
|
|
31
27
|
Default.args = {
|
|
32
|
-
name: "undefined"
|
|
33
|
-
}
|
|
28
|
+
name: "undefined",
|
|
29
|
+
};
|
|
34
30
|
|
|
35
|
-
const TemplateSizes:
|
|
31
|
+
const TemplateSizes: StoryFn<typeof Icon> = (args) => (
|
|
36
32
|
<>
|
|
37
33
|
<Icon {...args} small />
|
|
38
34
|
<Icon {...args} />
|
|
@@ -42,24 +38,15 @@ const TemplateSizes: ComponentStory<typeof Icon> = (args) => (
|
|
|
42
38
|
|
|
43
39
|
export const IconSizes = TemplateSizes.bind({});
|
|
44
40
|
IconSizes.args = {
|
|
45
|
-
name: "undefined"
|
|
46
|
-
}
|
|
41
|
+
name: "undefined",
|
|
42
|
+
};
|
|
47
43
|
|
|
48
44
|
export const IconsOverview = () => {
|
|
49
45
|
return (
|
|
50
46
|
<>
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<Button
|
|
55
|
-
icon={iconName as ValidIconName}
|
|
56
|
-
outlined
|
|
57
|
-
large
|
|
58
|
-
tooltip={iconName}
|
|
59
|
-
/>
|
|
60
|
-
)
|
|
61
|
-
})
|
|
62
|
-
}
|
|
47
|
+
{Object.keys(canonicalIcons).map((iconName) => {
|
|
48
|
+
return <Button icon={iconName as ValidIconName} outlined large tooltip={iconName} />;
|
|
49
|
+
})}
|
|
63
50
|
</>
|
|
64
51
|
);
|
|
65
|
-
}
|
|
52
|
+
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
2
|
import { LogoReact } from "@carbon/icons-react";
|
|
4
|
-
import {
|
|
3
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
4
|
+
|
|
5
5
|
import { Definitions } from "../../../common/Intent";
|
|
6
|
+
import { TestIcon } from "../../../index";
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
|
-
title: "Components/Icon",
|
|
9
|
+
title: "Components/Icon/TestIcon",
|
|
9
10
|
component: TestIcon,
|
|
10
11
|
argTypes: {
|
|
11
12
|
tryout: {
|
|
@@ -13,16 +14,14 @@ export default {
|
|
|
13
14
|
},
|
|
14
15
|
intent: {
|
|
15
16
|
control: "select",
|
|
16
|
-
options: {...Definitions},
|
|
17
|
+
options: { ...Definitions },
|
|
17
18
|
},
|
|
18
19
|
},
|
|
19
|
-
} as
|
|
20
|
+
} as Meta<typeof TestIcon>;
|
|
20
21
|
|
|
21
|
-
const Template:
|
|
22
|
-
<TestIcon {...args} />
|
|
23
|
-
);
|
|
22
|
+
const Template: StoryFn<typeof TestIcon> = (args) => <TestIcon {...args} />;
|
|
24
23
|
|
|
25
24
|
export const TestingAnIcon = Template.bind({});
|
|
26
25
|
TestingAnIcon.args = {
|
|
27
26
|
tryout: LogoReact,
|
|
28
|
-
}
|
|
27
|
+
};
|