Skip to content

Commit

Permalink
Merge pull request #115 from Tauffer-Consulting/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
vinicvaz authored Oct 20, 2023
2 parents 141ad69 + d41fa88 commit 66cb57c
Show file tree
Hide file tree
Showing 28 changed files with 676 additions and 100 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<br>

![create workflow](https://raw.githubusercontent.com/Tauffer-Consulting/domino/main/docs/source/_static/media/7_create_workflow.gif)
![create-workflow](https://github.com/Tauffer-Consulting/domino/assets/54302847/34d619fa-4b6c-4761-8b24-3ca829cfc28c)

# Table of contents
- [About](#about)
Expand Down Expand Up @@ -119,8 +119,8 @@ The Domino frontend service is a React application that provides the GUI for eas
</summary>
Create Workflows by dragging and dropping Pieces to the canvas, and connecting them. <br></br>

![create workflow](https://raw.githubusercontent.com/Tauffer-Consulting/domino/main/docs/source/_static/media/7_create_workflow.gif)

![create-workflow](https://github.com/Tauffer-Consulting/domino/assets/54302847/34d619fa-4b6c-4761-8b24-3ca829cfc28c)
</details>

<details>
Expand All @@ -129,7 +129,7 @@ The Domino frontend service is a React application that provides the GUI for eas
</summary>
Edit Pieces by changing their input. Outputs from upstream Pieces are automatically available as inputs for downstream Pieces. Pieces can pass forward any type of data, from simple strings to heavy files, all automatically handled by Domino shared storage system. <br></br>

![edit pieces](https://raw.githubusercontent.com/Tauffer-Consulting/domino/main/docs/source/_static/media/8_edit_pieces.gif)
![edit pieces](https://github.com/Tauffer-Consulting/domino/assets/54302847/d453ac81-5485-4159-b2f3-bf57eb969906)

</details>

Expand All @@ -139,7 +139,8 @@ The Domino frontend service is a React application that provides the GUI for eas
</summary>
Schedule Workflows to run periodically, at a specific date/time, or trigger them manually. <br></br>

![schedule workflows](https://raw.githubusercontent.com/Tauffer-Consulting/domino/main/docs/source/_static/media/9_edit_workflow.gif)
![schedule workflows](https://github.com/Tauffer-Consulting/domino/assets/54302847/e881d225-e8e0-4344-bc3f-c170cb820274)

</details>

<details>
Expand All @@ -148,7 +149,7 @@ The Domino frontend service is a React application that provides the GUI for eas
</summary>
Monitor Workflows in real time, including the status of each Piece, the logs and results of each run. <br></br>

![monitor workflow](https://raw.githubusercontent.com/Tauffer-Consulting/domino/main/docs/source/_static/media/10_monitor_workflow.gif)
![run-pieces7](https://github.com/Tauffer-Consulting/domino/assets/54302847/fb5a30c5-0314-4271-bb46-81a159ab2696)

</details>

Expand Down
6 changes: 3 additions & 3 deletions docker-compose-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ services:
# Modified Airflow Scheduler with Domino
airflow-scheduler:
<<: *airflow-common
image: ghcr.io/tauffer-consulting/domino-airflow-base:latest
# # image: ghcr.io/tauffer-consulting/domino-airflow-base:latest
build:
context: .
dockerfile: Dockerfile-airflow-domino.dev
Expand Down Expand Up @@ -260,7 +260,7 @@ services:
# Modified Airflow Worker with Domino
airflow-worker:
<<: *airflow-common
image: ghcr.io/tauffer-consulting/domino-airflow-base:latest
# image: ghcr.io/tauffer-consulting/domino-airflow-base:latest
build:
context: .
dockerfile: Dockerfile-airflow-domino.dev
Expand Down Expand Up @@ -309,7 +309,7 @@ services:
- DOMINO_DB_HOST=domino_postgres
- DOMINO_DB_PORT=5432
- DOMINO_DB_NAME=postgres
- DOMINO_DEFAULT_PIECES_REPOSITORY_VERSION=0.3.12
- DOMINO_DEFAULT_PIECES_REPOSITORY_VERSION=0.3.14
- DOMINO_DEFAULT_PIECES_REPOSITORY_TOKEN=${DOMINO_DEFAULT_PIECES_REPOSITORY_TOKEN}
- DOMINO_GITHUB_ACCESS_TOKEN_WORKFLOWS=${DOMINO_GITHUB_ACCESS_TOKEN_WORKFLOWS}
- DOMINO_GITHUB_WORKFLOWS_REPOSITORY=${DOMINO_GITHUB_WORKFLOWS_REPOSITORY}
Expand Down
2 changes: 1 addition & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<script src="https://use.fontawesome.com/releases/v5.15.4/js/all.js" data-auto-a11y="true"></script>
<script>
globalThis.import_meta_env = JSON.parse('"import_meta_env_placeholder"')
</script>
Expand All @@ -16,6 +15,7 @@
<!-- Icons to support Material Design -->
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />


<title>Domino</title>
</head>

Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"dependencies": {
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@iconify/react": "^4.1.1",
"@import-meta-env/cli": "^0.6.6",
"@import-meta-env/unplugin": "^0.4.10",
"@material-ui/core": "^4.12.4",
Expand Down
43 changes: 23 additions & 20 deletions frontend/src/components/CodeEditorInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,29 @@ import {
useFormContext,
} from "react-hook-form";

const CodeEditorItem = React.forwardRef(({ ...register }) => (
<CodeEditor
language="python"
placeholder="Enter Python code."
padding={15}
style={{
fontSize: 12,
backgroundColor: "#f5f5f5",
fontFamily:
"ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace",
borderRadius: 4,
border: "1px solid #ddd",
width: "100%",
minHeight: "200px",
maxHeight: "400px",
overflowY: "scroll",
}}
{...register}
/>
));
const CodeEditorItem = React.forwardRef<HTMLTextAreaElement>(
({ ...register }, ref) => (
<CodeEditor
language="python"
placeholder="Enter Python code."
padding={15}
style={{
fontSize: 12,
backgroundColor: "#f5f5f5",
fontFamily:
"ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace",
borderRadius: 4,
border: "1px solid #ddd",
width: "100%",
minHeight: "200px",
maxHeight: "400px",
overflowY: "scroll",
}}
ref={ref}
{...register}
/>
),
);

CodeEditorItem.displayName = "CodeEditorItem";

Expand Down
18 changes: 18 additions & 0 deletions frontend/src/components/WorkflowPanel/DefaultNode/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Icon } from "@iconify/react";
import { Paper, Typography } from "@mui/material";
import theme from "providers/theme.config";
import React, { type CSSProperties, memo, useMemo } from "react";
Expand Down Expand Up @@ -74,6 +75,8 @@ export const CustomNode = memo<DefaultNodeProps>(({ id, data, selected }) => {
alignItems: "center",

position: "relative",
padding: 1,
textAlign: "center",
width: 150,
height: 70,
lineHeight: "60px",
Expand Down Expand Up @@ -103,6 +106,20 @@ export const CustomNode = memo<DefaultNodeProps>(({ id, data, selected }) => {
[data],
);

const icon = useMemo(() => {
if (data.style.useIcon) {
const name = data.style.iconClassName;
return {
name,
style: {
width: "20px",
height: "20px",
...data.style.iconStyle,
},
};
}
}, [data]);

return (
<>
{nodeTypeRenderHandleMap[extendedClassExt].renderSourceHandle && (
Expand All @@ -122,6 +139,7 @@ export const CustomNode = memo<DefaultNodeProps>(({ id, data, selected }) => {
/>
)}
<Paper elevation={selected ? 12 : 3} sx={nodeStyle} ref={ElementRef}>
{icon && <Icon icon={icon.name} style={icon.style} />}
<div
style={{
display: "flex",
Expand Down
16 changes: 16 additions & 0 deletions frontend/src/components/WorkflowPanel/RunNode/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable no-prototype-builtins */
import { Icon } from "@iconify/react";
import { Paper, Typography } from "@mui/material";
import { taskState } from "features/workflows/types";
import theme from "providers/theme.config";
Expand Down Expand Up @@ -117,6 +118,20 @@ const RunNode = memo<RunNodeProps>(({ id, data, selected }) => {
[data],
);

const icon = useMemo(() => {
if (data.style.useIcon) {
const name = data.style.iconClassName;
return {
name,
style: {
width: "20px",
height: "20px",
...data.style.iconStyle,
},
};
}
}, [data]);

return (
<>
{nodeTypeRenderHandleMap[extendedClassExt].renderSourceHandle && (
Expand All @@ -136,6 +151,7 @@ const RunNode = memo<RunNodeProps>(({ id, data, selected }) => {
/>
)}
<Paper elevation={selected ? 12 : 3} sx={nodeStyle}>
{icon && <Icon icon={icon.name} style={icon.style} />}
<div
style={{
display: "flex",
Expand Down
11 changes: 1 addition & 10 deletions frontend/src/context/authentication/authentication.context.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { AxiosError } from "axios";
import localforage from "localforage";
import React, {
type ReactNode,
Expand Down Expand Up @@ -70,20 +69,12 @@ export const AuthenticationProvider: React.FC<{ children: ReactNode }> = ({
const authenticate = useCallback(
async (email: string, password: string) => {
setAuthLoading(true);
postAuthLogin({ email, password })
void postAuthLogin({ email, password })
.then((res) => {
if (res.status === 200) {
login(res.data.access_token, res.data.user_id);
}
})
.catch((e) => {
if (e instanceof AxiosError) {
toast.error(
e.response?.data?.detail ??
"Error on login, please review your inputs and try again",
);
}
})
.finally(() => {
setAuthLoading(false);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export const WorkflowsEditorComponent: React.FC = () => {
} catch (err) {
setBackdropIsOpen(false);
if (err instanceof AxiosError) {
toast.error(JSON.stringify(err?.response?.data));
console.log(err);
} else if (err instanceof Error) {
console.log(err);
toast.error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ interface UiSchema {

interface WorkflowSharedStorageDataModel {
source: StorageSourcesLocal | StorageSourcesAWS;
base_folder?: string;

mode: StorageAccessModes;
provider_options?: Record<string, unknown>;
provider_options?: ProviderOptionS3;
}

interface ProviderOptionS3 {
bucket?: string;
base_folder?: string;
}

interface SystemRequirementsModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,10 @@ const WorkflowsEditorProvider: FC<{ children?: React.ReactNode }> = ({

const workflowSharedStorage = {
source: storageSource,
...(baseFolder !== "" ? { base_folder: baseFolder } : {}),
...{ mode: elementData?.storage?.storageAccessMode },
provider_options: {
...(providerOptions && providerOptions.bucket !== ""
? { bucket: providerOptions.bucket }
? { bucket: providerOptions.bucket, base_folder: baseFolder }
: {}),
},
};
Expand Down
11 changes: 1 addition & 10 deletions frontend/src/features/workflows/api/workflow/deleteWorkflowId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,7 @@ export const useAuthenticatedDeleteWorkflowId = () => {
})
.catch((e) => {
if (e instanceof AxiosError) {
if (e?.response?.status === 403) {
toast.error("You are not allowed to delete this workflow.");
} else if (e?.response?.status === 404) {
toast.error("Workflow not found.");
} else if (e?.response?.status === 409) {
toast.error("Workflow is not in a valid state. ");
} else {
console.error(e);
toast.error("Something went wrong. ");
}
console.error(e);
} else {
throw e;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,7 @@ export const useAuthenticatedPostWorkflowRunId = () => {
})
.catch((e) => {
if (e instanceof AxiosError) {
if (e?.response?.status === 403) {
toast.error("You are not allowed to run this workflow.");
} else if (e?.response?.status === 404) {
toast.error("Workflow not found.");
} else if (e?.response?.status === 409) {
toast.error("Workflow is not in a valid state. ");
} else {
console.error(e);
toast.error("Something went wrong. ");
}
console.error(e);
} else {
throw e;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,7 @@ export const TaskResult = (props: ITaskResultProps) => {
}

if (!base64_content || !file_type) {
return (
<Container
sx={{
height: "90%",
width: "100%",
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
<Typography variant="h2">No content</Typography>
</Container>
);
return <Typography variant="h2">No content</Typography>;
}

switch (file_type) {
Expand Down Expand Up @@ -106,6 +94,7 @@ export const TaskResult = (props: ITaskResultProps) => {
height: "90%",
width: "100%",
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
}}
Expand Down
14 changes: 14 additions & 0 deletions frontend/src/services/clients/domino.client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import axios from "axios";
import { environment } from "config/environment.config";
import { dispatchLogout } from "context/authentication";
import { toast } from "react-toastify";

import { endpoints } from "../config/endpoints.config";

Expand All @@ -26,6 +27,19 @@ dominoApiClient.interceptors.response.use(
if (error.response.status === 401) {
dispatchLogout();
}

const message =
error.response?.data?.detail ||
error.response?.data?.message ||
error?.message ||
"Something went wrong";

if (Array.isArray(message)) {
toast.error(message[0].msg);
} else {
toast.error(message);
}

return await Promise.reject(error);
},
);
Expand Down
Loading

0 comments on commit 66cb57c

Please sign in to comment.