-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes at frontend and some improvements..
- Loading branch information
Łukasz Ciołecki
committed
Jul 1, 2021
1 parent
fabfc89
commit 938d7ed
Showing
43 changed files
with
325 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
engine/util/src/main/scala/pl/touk/nussknacker/engine/util/config/CustomFicusInstances.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {ThunkAction} from "../reduxTypes" | ||
import HttpService from "../../http/HttpService" | ||
|
||
export function loadProcessToolbarsConfiguration(processId): ThunkAction { | ||
return (dispatch) => | ||
HttpService.fetchProcessToolbarsConfiguration(processId).then((response) => dispatch({ | ||
type: "PROCESS_TOOLBARS_CONFIGURATION_LOADED", | ||
data: response.data, | ||
})) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React, {PropsWithChildren, useEffect, useState} from "react" | ||
import * as LoaderUtils from "../common/LoaderUtils" | ||
import {absoluteBePath} from "../common/UrlUtils" | ||
|
||
function UrlIcon({path, title, children}: PropsWithChildren<{path?: string, title?: string}>) { | ||
const [error, setError] = useState(!path) | ||
|
||
useEffect(() => { | ||
setError(!path) | ||
}, [path]) | ||
|
||
if (error) { | ||
return <>{children}</> | ||
} | ||
|
||
try { | ||
const svgContent = LoaderUtils.loadSvgContent(path) | ||
return <div dangerouslySetInnerHTML={{__html: svgContent}}/> | ||
} catch (e) { | ||
return <img onError={() => setError(true)} src={absoluteBePath(path)} title={title} /> | ||
} | ||
} | ||
|
||
export default UrlIcon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 13 additions & 35 deletions
48
ui/client/components/toolbarSettings/buttons/LinkButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,35 @@ | ||
import React, {PropsWithChildren, useEffect, useState} from "react" | ||
import {useDispatch, useSelector} from "react-redux" | ||
import React from "react" | ||
import {useDispatch} from "react-redux" | ||
import {reportEvent} from "../../../actions/nk" | ||
import {ReactComponent as FallbackIcon} from "../../../assets/img/toolbarButtons/link.svg" | ||
import * as LoaderUtils from "../../../common/LoaderUtils" | ||
import {absoluteBePath} from "../../../common/UrlUtils" | ||
import {PlainStyleLink} from "../../../containers/plainStyleLink" | ||
import {getProcessId} from "../../../reducers/selectors/graph" | ||
import ToolbarButton from "../../toolbarComponents/ToolbarButton" | ||
import UrlIcon from "../../UrlIcon" | ||
|
||
export interface LinkButtonProps { | ||
name: string, | ||
href: string, // template z processId | ||
icon?: string, // url albo default na podstawie typu | ||
disabled?: boolean, | ||
title?: string, | ||
url: string, | ||
icon?: string, | ||
disabled: boolean, | ||
} | ||
|
||
export function LinkButton({href, icon, name, disabled}: LinkButtonProps): JSX.Element { | ||
export function LinkButton({url, icon, name, title, disabled}: LinkButtonProps): JSX.Element { | ||
const dispatch = useDispatch() | ||
const processId = useSelector(getProcessId) | ||
|
||
const to = href.replace(/\{\{(\w+)\}\}/g, processId) | ||
|
||
return ( | ||
<PlainStyleLink disabled={disabled} to={to}> | ||
<PlainStyleLink disabled={disabled} to={url}> | ||
<ToolbarButton | ||
name={name || to} | ||
name={name} | ||
title={title || name} | ||
onClick={() => dispatch(reportEvent({ | ||
category: name, | ||
action: "custom-link-click", | ||
name: to, | ||
name: url, | ||
}))} | ||
disabled={disabled} | ||
icon={<Icon path={icon}><FallbackIcon/></Icon>} | ||
icon={<UrlIcon path={icon}><FallbackIcon/></UrlIcon>} | ||
/> | ||
</PlainStyleLink> | ||
) | ||
} | ||
|
||
function Icon({path, children}: PropsWithChildren<{path?: string}>) { | ||
const [error, setError] = useState(!path) | ||
|
||
useEffect(() => { | ||
setError(!path) | ||
}, [path]) | ||
|
||
if (error) { | ||
return <>{children}</> | ||
} | ||
|
||
try { | ||
const svgContent = LoaderUtils.loadSvgContent(path) | ||
return <div dangerouslySetInnerHTML={{__html: svgContent}}/> | ||
} catch (e) { | ||
return <img onError={() => setError(true)} src={absoluteBePath(path)}/> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.