Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
154
Issues
154
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
7477bfd1
Commit
7477bfd1
authored
Jul 27, 2025
by
Karen Konou
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-support-emitting-warnings' into 'dev'
Dev support emitting warnings See merge request
!519
parents
fb187f54
8b09569f
Pipeline
#7811
failed with stages
in 22 minutes and 8 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
59 deletions
+26
-59
ErrorsView.purs
src/Gargantext/Components/ErrorsView.purs
+7
-40
Utils.purs
src/Gargantext/Config/Utils.purs
+3
-5
Types.purs
src/Gargantext/Types.purs
+16
-14
No files found.
src/Gargantext/Components/ErrorsView.purs
View file @
7477bfd1
...
@@ -36,53 +36,20 @@ componentCpt = here.component "main" cpt
...
@@ -36,53 +36,20 @@ componentCpt = here.component "main" cpt
{}
{}
(mapWithIndex (showError errors) errors')
(mapWithIndex (showError errors) errors')
showError errors i (FStringError { error }) =
showError errors i (FStringError { error }) = errorAlert errors i "danger" error
RB.alert
showError errors i (FStringWarning { warning }) = errorAlert errors i "warning" warning
{ dismissible: true
showError errors i (FRESTError { error }) = errorAlert errors i "danger" (show error)
, onClose
showError errors i (FOtherError { error }) = errorAlert errors i "danger" (show error)
, variant: "danger"
}
[ H.text error ]
where
onClose = do
here.error2 "click!" error
T.modify_
( \es -> case deleteAt i es of
Nothing -> es
Just es' -> es'
)
errors
showError errors i (FRESTError { error }) =
RB.alert
{ dismissible: true
, onClose
, variant: "danger"
}
[ H.text $ show error ]
where
onClose = do
here.error2 "click!" error
T.modify_
( \es -> case deleteAt i es of
Nothing -> es
Just es' -> es'
)
errors
showError errors i (FOtherError { error })
=
errorAlert errors i variant txt
=
RB.alert
RB.alert
{ dismissible: true
{ dismissible: true
, onClose
, onClose
, variant
: "danger"
, variant
}
}
[ H.text $ show error ]
[ H.text txt ]
where
where
onClose = do
onClose = do
here.error2 "click!" error
T.modify_
T.modify_
( \es -> case deleteAt i es of
( \es -> case deleteAt i es of
Nothing -> es
Nothing -> es
...
...
src/Gargantext/Config/Utils.purs
View file @
7477bfd1
...
@@ -6,11 +6,12 @@ import Data.Array as A
...
@@ -6,11 +6,12 @@ import Data.Array as A
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Foldable (foldl)
import Data.Foldable (foldl)
import Data.Maybe (fromMaybe, Maybe(..))
import Data.Maybe (fromMaybe, Maybe(..))
import Data.Traversable (traverse_)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Types (AsyncEvent(..), AsyncTaskLog(..), FrontendError(..), async
TaskLogEventsErrorMessage
)
import Gargantext.Types (AsyncEvent(..), AsyncTaskLog(..), FrontendError(..), async
ErrorToFrontendError, asyncTaskLogEventsErrors
)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Toestand as T
import Toestand as T
...
@@ -54,7 +55,4 @@ handleErrorInAsyncTaskLog
...
@@ -54,7 +55,4 @@ handleErrorInAsyncTaskLog
-> AsyncTaskLog
-> AsyncTaskLog
-> Effect Unit
-> Effect Unit
handleErrorInAsyncTaskLog errors atl =
handleErrorInAsyncTaskLog errors atl =
case asyncTaskLogEventsErrorMessage atl of
traverse_ (\e -> T.modify_ (A.cons $ asyncErrorToFrontendError e) errors) (asyncTaskLogEventsErrors atl)
Nothing -> pure unit
Just error ->
T.modify_ (A.cons $ FStringError { error }) errors
src/Gargantext/Types.purs
View file @
7477bfd1
...
@@ -838,8 +838,17 @@ derive instance Generic AsyncEvent _
...
@@ -838,8 +838,17 @@ derive instance Generic AsyncEvent _
derive instance Newtype AsyncEvent _
derive instance Newtype AsyncEvent _
derive newtype instance JSON.ReadForeign AsyncEvent
derive newtype instance JSON.ReadForeign AsyncEvent
asyncEventErrorMessage :: AsyncEvent -> Maybe String
data AsyncError
asyncEventErrorMessage (AsyncEvent { level: "ERROR", message }) = Just message
= AsyncErrorMessage String
| AsyncWarningMessage String
asyncErrorToFrontendError :: AsyncError -> FrontendError
asyncErrorToFrontendError (AsyncErrorMessage error) = FStringError { error }
asyncErrorToFrontendError (AsyncWarningMessage warning) = FStringWarning { warning }
asyncEventErrorMessage :: AsyncEvent -> Maybe AsyncError
asyncEventErrorMessage (AsyncEvent { level: "ERROR", message }) = Just $ AsyncErrorMessage message
asyncEventErrorMessage (AsyncEvent { level: "WARNING", message }) = Just $ AsyncWarningMessage message
asyncEventErrorMessage _ = Nothing
asyncEventErrorMessage _ = Nothing
newtype AsyncTaskLog = AsyncTaskLog
newtype AsyncTaskLog = AsyncTaskLog
...
@@ -853,17 +862,9 @@ derive instance Generic AsyncTaskLog _
...
@@ -853,17 +862,9 @@ derive instance Generic AsyncTaskLog _
derive instance Newtype AsyncTaskLog _
derive instance Newtype AsyncTaskLog _
derive newtype instance JSON.ReadForeign AsyncTaskLog
derive newtype instance JSON.ReadForeign AsyncTaskLog
asyncTaskLogEventsErrorMessage :: AsyncTaskLog -> Maybe String
asyncTaskLogEventsErrors :: AsyncTaskLog -> Array AsyncError
asyncTaskLogEventsErrorMessage (AsyncTaskLog { events }) =
asyncTaskLogEventsErrors (AsyncTaskLog { events }) =
foldl eventErrorMessage' Nothing events
A.mapMaybe asyncEventErrorMessage events
where
eventErrorMessage' acc ae =
case asyncEventErrorMessage ae of
Nothing -> acc
Just e' ->
case acc of
Nothing -> Just e'
Just acc' -> Just $ e' <> "\n" <> acc'
asyncTaskLogPercent :: AsyncTaskLog -> Number
asyncTaskLogPercent :: AsyncTaskLog -> Number
asyncTaskLogPercent (AsyncTaskLog { failed, remaining, succeeded }) = 100.0 * nom / denom
asyncTaskLogPercent (AsyncTaskLog { failed, remaining, succeeded }) = 100.0 * nom / denom
...
@@ -877,7 +878,7 @@ asyncTaskLogIsFinished (AsyncTaskLog { remaining }) = remaining == 0
...
@@ -877,7 +878,7 @@ asyncTaskLogIsFinished (AsyncTaskLog { remaining }) = remaining == 0
asyncTaskLogIsError :: AsyncTaskLog -> Boolean
asyncTaskLogIsError :: AsyncTaskLog -> Boolean
asyncTaskLogIsError atl@(AsyncTaskLog { events }) =
asyncTaskLogIsError atl@(AsyncTaskLog { events }) =
asyncTaskLogIsFinished atl
asyncTaskLogIsFinished atl
&& (A.length $ A.filter (\(AsyncEvent { level }) -> level == "ERROR") events)
&& (A.length $ A.filter (\(AsyncEvent { level }) -> level == "ERROR"
|| level == "WARNING"
) events)
> 0
> 0
-- New type tasks (async workers)
-- New type tasks (async workers)
...
@@ -920,6 +921,7 @@ toggleSidePanelState Opened = Closed
...
@@ -920,6 +921,7 @@ toggleSidePanelState Opened = Closed
data FrontendError
data FrontendError
= FStringError { error :: String }
= FStringError { error :: String }
| FStringWarning { warning :: String }
| FRESTError { error :: RESTError }
| FRESTError { error :: RESTError }
| FOtherError { error :: String }
| FOtherError { error :: String }
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment