Skip to content

Commit

Permalink
PLT-7563 Turned on formatters and checkers.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwbush committed Sep 27, 2023
1 parent 946e10b commit 7adc2fb
Show file tree
Hide file tree
Showing 12 changed files with 167 additions and 168 deletions.
9 changes: 5 additions & 4 deletions make-docker-image.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env sh
# shellcheck disable=SC3040

set -eo pipefail

Expand All @@ -10,12 +11,12 @@ webpack-cli bundle --mode=production -c webpack.js --no-watch
DOCKER_HASH=$(podman build --tag marlowe-runner . | tail -n 1)

echo 'Push to docker using the following command:'
echo ' podman push '"$DOCKER_HASH"' \'
echo ' podman push '"$DOCKER_HASH"' '\\
echo ' docker://docker.io/myrepo/marlowe-runner'
echo
echo 'To run the image, specify both the `MARLOWE_WEB_SERVER_URL` for the Marlowe'
echo 'To run the image, specify both the MARLOWE_WEB_SERVER_URL for the Marlowe'
echo 'Runtime web server instance and the port (default 8080) where the container'
echo 'exposes Marlower Runner. For example,'
echo ' podman run -p 8123:8080 \'
echo ' -e MARLOWE_WEB_SERVER_URL=http://192.168.0.12:13780 \'
echo ' podman run -p 8123:8080 '\\
echo ' -e MARLOWE_WEB_SERVER_URL=http://192.168.0.12:13780 '\\
echo " $DOCKER_HASH"
36 changes: 18 additions & 18 deletions nix/formatters.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,33 @@
{ iogxRepoRoot, repoRoot, inputs, inputs', pkgs, system, lib, ... }:

{
# cabal-fmt.enable = false;
# cabal-fmt.extraOptions = "";
# cabal-fmt.enable = false;
# cabal-fmt.extraOptions = "";

# stylish-haskell.enable = false;
# stylish-haskell.extraOptions = "";
# stylish-haskell.enable = false;
# stylish-haskell.extraOptions = "";

# shellcheck.enable = false;
# shellcheck.extraOptions = "";
shellcheck.enable = true;
shellcheck.extraOptions = "";

# prettier.enable = false;
# prettier.extraOptions = "";
# prettier.enable = false;
# prettier.extraOptions = "";

# editorconfig-checker.enable = false;
# editorconfig-checker.extraOptions = "";
# editorconfig-checker.enable = false;
# editorconfig-checker.extraOptions = "";

nixpkgs-fmt.enable = false;
nixpkgs-fmt.enable = true;
nixpkgs-fmt.extraOptions = "";

# png-optimization.enable = false;
# png-optimization.extraOptions = "";
# png-optimization.enable = false;
# png-optimization.extraOptions = "";

# fourmolu.enable = false;
# fourmolu.extraOptions = "";
# fourmolu.enable = false;
# fourmolu.extraOptions = "";

purs-tidy.enable = false;
purs-tidy.enable = true;
purs-tidy.extraOptions = "";

# hlint.enable = false;
# hlint.extraOptions = "";
# hlint.enable = false;
# hlint.extraOptions = "";
}
14 changes: 7 additions & 7 deletions src/Component/App.purs
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ mkApp = do
-- FIXME: Make this loop a bit smarter and after some time stop trying and notify
-- the user that we give up.
resyncLoop contractId = case possibleSyncFn of
Nothing -> pure unit
Just sync -> for_ (1..30) \_ -> do
delay (Milliseconds 5000.0)
sync contractId `catchError` \err -> do
traceM $ "error during sync" <> unsafeStringify err
pure unit
Nothing -> pure unit
Just sync -> for_ (1 .. 30) \_ -> do
delay (Milliseconds 5000.0)
sync contractId `catchError` \err -> do
traceM $ "error during sync" <> unsafeStringify err
pure unit

add :: ContractInfo.ContractCreated -> Effect Unit
add cc@(ContractInfo.ContractCreated { contractId }) = do
Expand All @@ -181,7 +181,7 @@ mkApp = do
ContractInfoMap.insertContractCreated cc contractMap /\ initialized

update :: ContractInfo.ContractUpdated -> Effect Unit
update cu@(ContractInfo.ContractUpdated { contractInfo: ContractInfo { contractId }}) = do
update cu@(ContractInfo.ContractUpdated { contractInfo: ContractInfo { contractId } }) = do
launchAff_ $ resyncLoop contractId
updateContractInfoMap $ \(contractMap /\ initialized) ->
ContractInfoMap.insertContractUpdated cu contractMap /\ initialized
Expand Down
86 changes: 43 additions & 43 deletions src/Component/ApplyInputs.purs
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,16 @@ mkChoiceFormComponent = do
]
pure $ wrappedContentWithFooter body actions

-- pure $ BodyLayout.component do
-- pure $ BodyLayout.component do

-- { title: DOM.div { className: "" }
-- [ DOM.div { className: "mb-3" } $ DOOM.img { src: "/images/magnifying_glass.svg" }
-- , DOM.div { className: "mb-3" } $ DOOM.text "Advance the contract"
-- ]
-- { title: DOM.div { className: "" }
-- [ DOM.div { className: "mb-3" } $ DOOM.img { src: "/images/magnifying_glass.svg" }
-- , DOM.div { className: "mb-3" } $ DOOM.text "Advance the contract"
-- ]

-- , description: DOM.p { className: "mb-3" } "Progress through the contract by delving into its specifics. Analyse the code, evaluate the graph and apply the required inputs. This stage is crucial for ensuring the contract advances correctly so take a moment to confirm all details."
-- , content: wrappedContentWithFooter body actions
-- }
-- , description: DOM.p { className: "mb-3" } "Progress through the contract by delving into its specifics. Analyse the code, evaluate the graph and apply the required inputs. This stage is crucial for ensuring the contract advances correctly so take a moment to confirm all details."
-- , content: wrappedContentWithFooter body actions
-- }

type NotifyFormComponentProps =
{ notifyInput :: NotifyInput
Expand Down Expand Up @@ -813,7 +813,6 @@ onStateTransition contractInfo onSuccess _ prevState (Machine.InputApplied ia) =
onStateTransition _ _ onErrors prev next = do
void $ for (Machine.stateErrors next) onErrors


mkComponent :: MkComponentM (Props -> JSX)
mkComponent = do
runtime <- asks _.runtime
Expand Down Expand Up @@ -934,7 +933,7 @@ mkComponent = do
environment <- Machine.stateEnvironment machine.state
inputChoices <- Machine.stateInputChoices machine.state
pure { environment, inputChoices }
case ctx of
case ctx of
Nothing -> DOOM.text "Should rather not happen ;-)"
Just { environment, inputChoices } -> do
let
Expand Down Expand Up @@ -989,39 +988,40 @@ mkComponent = do
setSubmitting true
applyPickInputSucceeded Nothing
}
-- Machine.PickingInput { errors: Just error } -> do
-- DOOM.text error
-- Machine.CreatingTx { errors } -> do
-- -- DetailedFlow _ -> do
-- -- creatingTxDetails Nothing onDismiss "createTx placeholder" $ case errors of
-- -- Just err -> Just $ err
-- -- Nothing -> Nothing
-- let
-- body = DOOM.text "Auto creating tx..."
-- showPossibleErrorAndDismiss "Creating Transaction" "" body onDismiss errors
-- -- SimplifiedFlow -> BodyLayout.component
-- -- { title: "Creating transaction"
-- -- , description: DOOM.text "We are creating the initial transaction."
-- -- , content: DOOM.text "Auto creating tx... (progress bar?)"
-- -- }
-- Machine.SigningTx { createTxResponse, errors } -> do
-- -- DetailedFlow { showPrevStep: true } -> do
-- -- creatingTxDetails (Just setNextFlow) onDismiss "createTx placeholder" $ Just createTxResponse
-- -- DetailedFlow _ ->
-- -- signingTransaction Nothing onDismiss Nothing
-- let
-- body = DOOM.text "Auto signing tx... (progress bar?)"
-- showPossibleErrorAndDismiss "Signing Transaction" "" body onDismiss errors
-- Machine.SubmittingTx { txWitnessSet, errors } ->
-- -- DetailedFlow { showPrevStep: true } -> do
-- -- signingTransaction (Just setNextFlow) onDismiss $ Just txWitnessSet
-- -- DetailedFlow _ ->
-- -- submittingTransaction onDismiss "Final request placeholder" $ errors
-- BodyLayout.component
-- { title: DOM.h3 {} $ DOOM.text "Submitting transaction"
-- , description: DOOM.text "We are submitting the initial transaction."
-- , content: DOOM.text "Auto submitting tx... (progress bar?)"
-- }

-- Machine.PickingInput { errors: Just error } -> do
-- DOOM.text error
-- Machine.CreatingTx { errors } -> do
-- -- DetailedFlow _ -> do
-- -- creatingTxDetails Nothing onDismiss "createTx placeholder" $ case errors of
-- -- Just err -> Just $ err
-- -- Nothing -> Nothing
-- let
-- body = DOOM.text "Auto creating tx..."
-- showPossibleErrorAndDismiss "Creating Transaction" "" body onDismiss errors
-- -- SimplifiedFlow -> BodyLayout.component
-- -- { title: "Creating transaction"
-- -- , description: DOOM.text "We are creating the initial transaction."
-- -- , content: DOOM.text "Auto creating tx... (progress bar?)"
-- -- }
-- Machine.SigningTx { createTxResponse, errors } -> do
-- -- DetailedFlow { showPrevStep: true } -> do
-- -- creatingTxDetails (Just setNextFlow) onDismiss "createTx placeholder" $ Just createTxResponse
-- -- DetailedFlow _ ->
-- -- signingTransaction Nothing onDismiss Nothing
-- let
-- body = DOOM.text "Auto signing tx... (progress bar?)"
-- showPossibleErrorAndDismiss "Signing Transaction" "" body onDismiss errors
-- Machine.SubmittingTx { txWitnessSet, errors } ->
-- -- DetailedFlow { showPrevStep: true } -> do
-- -- signingTransaction (Just setNextFlow) onDismiss $ Just txWitnessSet
-- -- DetailedFlow _ ->
-- -- submittingTransaction onDismiss "Final request placeholder" $ errors
-- BodyLayout.component
-- { title: DOM.h3 {} $ DOOM.text "Submitting transaction"
-- , description: DOOM.text "We are submitting the initial transaction."
-- , content: DOOM.text "Auto submitting tx... (progress bar?)"
-- }

address :: String
address = "addr_test1qz4y0hs2kwmlpvwc6xtyq6m27xcd3rx5v95vf89q24a57ux5hr7g3tkp68p0g099tpuf3kyd5g80wwtyhr8klrcgmhasu26qcn"
Expand Down
7 changes: 3 additions & 4 deletions src/Component/ApplyInputs/Machine.purs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ step state action = do
FetchRequiredWalletContextFailed error -> FetchingRequiredWalletContext $ r { errors = Just error }
FetchRequiredWalletContextSucceeded { requiredWalletContext, allInputsChoices, environment } -> case allInputsChoices of
Left contract -> do
let inputChoices = AdvanceContract contract
let inputChoices = AdvanceContract contract
PickingInput
{ autoRun
, errors: Nothing
Expand All @@ -250,10 +250,10 @@ step state action = do
let
countInputType :: forall a. Maybe a -> Int
countInputType = maybe 0 (const 1)
countInputType deposits + countInputType choices + countInputType notify
countInputType deposits + countInputType choices + countInputType notify

possibleInputChoices :: Maybe InputChoices
possibleInputChoices =
possibleInputChoices =
(DepositInputs <$> deposits)
<|> (ChoiceInputs <$> choices)
<|> (SpecificNotifyInput <$> notify)
Expand Down Expand Up @@ -415,7 +415,6 @@ nextRequest env state = do
Just $ RuntimeRequest $ SubmitTxRequest { txWitnessSet, createTxResponse, serverURL }
_ -> Nothing


-- This is pretty arbitrary choice - we should keep track which inputs are relevant
-- during the further steps.
mkEnvironment :: Effect V1.Environment
Expand Down
64 changes: 32 additions & 32 deletions src/Component/ConnectWallet.purs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type Props =
renderWallets :: Effect Unit -> WalletInfo Wallet -> JSX
renderWallets onSubmit (walletInfo@(WalletInfo { icon, name, wallet })) =
DOM.div { className: "row mt-2" }
[ DOM.div { className: "col-12 d-flex rounded p-2 align-items-center border border-2 border-secondary justify-content-between cursor-pointer", onClick: handler_ onSubmit }
[ DOM.div { className: "col-12 d-flex rounded p-2 align-items-center border border-2 border-secondary justify-content-between cursor-pointer", onClick: handler_ onSubmit }
[ DOOM.img { src: icon, alt: "Icon Before", className: "icon" }
, DOM.span { className: "text-start" } $ DOOM.text name
, DOM.div { className: "cardano-badge flex-8" }
Expand Down Expand Up @@ -186,34 +186,34 @@ mkConnectWallet = do
]

else
-- [ DOM.div { className: "card p-5 m-5" }
-- [ DOM.p { className: "h3 font-weight-bold" } [ DOOM.text "Choose a wallet" ]
-- , DOM.span { className: "h5 text-muted" } [ DOOM.text "Please select a wallet to deploy a contract" ]
-- , formBody
-- , formActions
-- ]
-- ] <>
DOM.div { className: "container" } $ DOM.div { className: "row justify-content-center mt-4" }
[ DOM.div { className: "col-12" }
[ DOM.div { className: "card" }
[ DOM.div { className: "card-body" }
[ DOM.div { className: "container" }
[ DOM.div { className: "row" }
[ DOM.div { className: "col-12" }
[ DOM.h5 { className: "card-title font-weight-bold text-left" } [ DOOM.text "Choose a wallet" ]
, DOM.p { className: "card-help-text text-muted text-left" } [ DOOM.text "Please select a wallet to deploy a contract." ]
]
]
, case possibleWallets of
Just wallets -> fragment $ (ArrayAL.toArray wallets) <#> \wallet -> do
renderWallets (submit $ Just wallet) wallet
Nothing -> mempty
, DOM.div { className: "row mt-4 d-none" }
[ DOM.div { className: "col-6 text-left p-0" } [ DOM.a { href: "#" } [ DOOM.text "Learn more" ] ]
, DOM.div { className: "col-6 p-0" } [ DOM.a { href: "#", className: "text-muted text-right text-decoration-none" } [ DOOM.text "I don't have a wallet" ] ]
]
]
]
]
]
]
-- [ DOM.div { className: "card p-5 m-5" }
-- [ DOM.p { className: "h3 font-weight-bold" } [ DOOM.text "Choose a wallet" ]
-- , DOM.span { className: "h5 text-muted" } [ DOOM.text "Please select a wallet to deploy a contract" ]
-- , formBody
-- , formActions
-- ]
-- ] <>
DOM.div { className: "container" } $ DOM.div { className: "row justify-content-center mt-4" }
[ DOM.div { className: "col-12" }
[ DOM.div { className: "card" }
[ DOM.div { className: "card-body" }
[ DOM.div { className: "container" }
[ DOM.div { className: "row" }
[ DOM.div { className: "col-12" }
[ DOM.h5 { className: "card-title font-weight-bold text-left" } [ DOOM.text "Choose a wallet" ]
, DOM.p { className: "card-help-text text-muted text-left" } [ DOOM.text "Please select a wallet to deploy a contract." ]
]
]
, case possibleWallets of
Just wallets -> fragment $ (ArrayAL.toArray wallets) <#> \wallet -> do
renderWallets (submit $ Just wallet) wallet
Nothing -> mempty
, DOM.div { className: "row mt-4 d-none" }
[ DOM.div { className: "col-6 text-left p-0" } [ DOM.a { href: "#" } [ DOOM.text "Learn more" ] ]
, DOM.div { className: "col-6 p-0" } [ DOM.a { href: "#", className: "text-muted text-right text-decoration-none" } [ DOOM.text "I don't have a wallet" ] ]
]
]
]
]
]
]
Loading

0 comments on commit 7adc2fb

Please sign in to comment.