-
Notifications
You must be signed in to change notification settings - Fork 0
DRAFT: Feature/ssot #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DRAFT: Feature/ssot #134
Changes from 9 commits
17f7a63
154a1bb
f944bf7
ec478fe
15ce497
d6afb28
02f3145
77ee8cd
1acdf30
23e1986
6f9aa8c
e264325
f229c30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,21 @@ | ||
| import { useState } from "react"; | ||
| import { Button, Drawer } from "antd"; | ||
| import { usePackingData } from "../../state/store"; | ||
|
||
| import { JOB_STATUS } from "../../constants/aws"; | ||
| import "./style.css"; | ||
|
|
||
| interface ErrorLogsProps { | ||
| errorLogs: string; | ||
| } | ||
|
|
||
| const ErrorLogs = (props: ErrorLogsProps): JSX.Element => { | ||
| const { errorLogs } = props; | ||
| const ErrorLogs = (): JSX.Element => { | ||
| const [viewErrorLogs, setViewErrorLogs] = useState<boolean>(true); | ||
| const {jobStatus, jobLogs: errorLogs} = usePackingData(); | ||
|
||
|
|
||
| const toggleLogs = () => { | ||
| setViewErrorLogs(!viewErrorLogs); | ||
| }; | ||
|
|
||
| if (jobStatus !== JOB_STATUS.FAILED) { | ||
| return <></> | ||
| }; | ||
|
|
||
| return ( | ||
| <> | ||
| <Button color="primary" variant="filled" onClick={toggleLogs}> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,9 +3,9 @@ import { Input, InputNumber, Select, Slider } from "antd"; | |
| import { GradientOption } from "../../types"; | ||
| import { | ||
| useSelectedRecipeId, | ||
| useUpdateRecipeObj, | ||
| useEditRecipe, | ||
| useGetCurrentValue, | ||
| useCurrentRecipeString, | ||
| useRecipes, | ||
| } from "../../state/store"; | ||
| import GradientInput from "../GradientInput"; | ||
| import "./style.css"; | ||
|
|
@@ -25,12 +25,24 @@ interface InputSwitchProps { | |
| } | ||
|
|
||
| const InputSwitch = (props: InputSwitchProps): JSX.Element => { | ||
| const { displayName, inputType, dataType, description, min, max, options, id, gradientOptions, conversionFactor, unit } = props; | ||
| const { | ||
| displayName, | ||
| inputType, | ||
| dataType, | ||
| description, | ||
| min, | ||
| max, | ||
| options, | ||
| id, | ||
| gradientOptions, | ||
| conversionFactor, | ||
| unit | ||
| } = props; | ||
|
|
||
| const selectedRecipeId = useSelectedRecipeId(); | ||
| const updateRecipeObj = useUpdateRecipeObj(); | ||
| const editRecipe = useEditRecipe(); | ||
| const getCurrentValue = useGetCurrentValue(); | ||
| const recipeVersion = useCurrentRecipeString(); | ||
| const recipeVersion = useRecipes(); | ||
|
||
|
|
||
| // Conversion factor for numeric inputs where we want to display a | ||
| // different unit in the UI than is stored in the recipe | ||
|
|
@@ -64,11 +76,7 @@ const InputSwitch = (props: InputSwitchProps): JSX.Element => { | |
| const handleInputChange = (value: string | number | null) => { | ||
| if (value == null || !selectedRecipeId) return; | ||
| setValue(value); | ||
| if (typeof value === "number") { | ||
| // Convert back to original units for updating recipe object | ||
| value = value / conversion; | ||
| } | ||
| updateRecipeObj(selectedRecipeId, { [id]: value }); | ||
| editRecipe(selectedRecipeId, { [id]: value }); | ||
| }; | ||
|
|
||
| switch (inputType) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,22 +7,20 @@ import { | |
| returnOneElement, | ||
| } from "./formattingUtils"; | ||
| import "./style.css"; | ||
| import { useRecipes, useSelectedRecipeId } from "../../state/store"; | ||
| import { buildCurrentRecipeObject } from "../../state/utils"; | ||
|
|
||
| interface JSONViewerProps { | ||
| title: string; | ||
| content: string; | ||
| isEditable: boolean; | ||
| onChange: (value: string) => void; | ||
| } | ||
| const JSONViewer = (): JSX.Element | null => { | ||
| const selectedRecipeId = useSelectedRecipeId(); | ||
| const recipes = useRecipes(); | ||
|
|
||
| const JSONViewer = (props: JSONViewerProps): JSX.Element | null => { | ||
| const { content } = props; | ||
| const currentRecipe = recipes[selectedRecipeId]; | ||
|
||
|
|
||
| if (!content) { | ||
| if (!currentRecipe) { | ||
| return null; | ||
| } | ||
|
|
||
| const contentAsObj = JSON.parse(content); | ||
| const contentAsObj = buildCurrentRecipeObject(currentRecipe); | ||
|
|
||
| // descriptions for top level key-value pairs | ||
| const descriptions: DescriptionsItemProps[] = []; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure default value is sufficient here. Try using my changes for this file other than your name change from inputs to manifest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing it match your version