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
132
Issues
132
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
ae221fac
Commit
ae221fac
authored
Jan 22, 2025
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidy
parent
b41ffafb
Pipeline
#7255
passed with stages
in 19 minutes and 13 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
128 additions
and
124 deletions
+128
-124
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+107
-103
SubcorpusCreation.purs
src/Gargantext/Components/DocsTable/SubcorpusCreation.purs
+20
-21
Types.purs
src/Gargantext/Components/DocsTable/Types.purs
+1
-0
No files found.
src/Gargantext/Components/DocsTable.purs
View file @
ae221fac
...
@@ -193,18 +193,17 @@ docViewCpt = R2.hereComponent here "docView" hCpt
...
@@ -193,18 +193,17 @@ docViewCpt = R2.hereComponent here "docView" hCpt
liftEffect $ do
liftEffect $ do
case res of
case res of
Left err -> here.warn2 "[docsTable subSorpusButton RESTError]" err
Left err -> here.warn2 "[docsTable subSorpusButton RESTError]" err
Right id -> do
Right id -> do
T2.reload reloadForest
T2.reload reloadForest
goToRoute $ Routes.Corpus (sessionId session) id
goToRoute $ Routes.Corpus (sessionId session) id
-- handleRESTError hp errors eTask
-- handleRESTError hp errors eTask
-- \t -> liftEffect $ launchDocumentCreationProgress
-- \t -> liftEffect $ launchDocumentCreationProgress
-- errors
-- errors
-- session
-- session
-- nodeId
-- nodeId
-- t
-- t
-- onCreateDocumentEnd
-- onCreateDocumentEnd
-- Render
-- Render
pure $
pure $
...
@@ -262,38 +261,36 @@ docViewCpt = R2.hereComponent here "docView" hCpt
...
@@ -262,38 +261,36 @@ docViewCpt = R2.hereComponent here "docView" hCpt
, status: onDocumentCreationPending ? Deferred $ Enabled
, status: onDocumentCreationPending ? Deferred $ Enabled
}
}
]
]
,
,
-- Document Creation Modal
-- Document Creation Modal
B.baseModal
B.baseModal
{ isVisibleBox: isDocumentModalVisibleBox
{ isVisibleBox: isDocumentModalVisibleBox
, title: Just "Add a new document"
, title: Just "Add a new document"
, hasCollapsibleBackground: false
, hasCollapsibleBackground: false
, size: LargeModalSize
, size: LargeModalSize
}
}
[
[ DFC.documentFormCreation
DFC.documentFormCreation
{ callback: createDocumentCallback
{ callback: createDocumentCallback
, status: onDocumentCreationPending ? Deferred $ Enabled
, status: onDocumentCreationPending ? Deferred $ Enabled
}
}
]
,
-- Subcorpus Creation Modal
B.baseModal
{ isVisibleBox: isSubcorpusModalVisibleBox
, title: Just "Create a subcorpus"
, hasCollapsibleBackground: false
, size: MediumModalSize
}
[ subcorpusCreation
{ callback: createSubcorpusCallback
, query'
, reuseParentList
, reuseParentList'
, onSubcorpusCreationPending'
}
]
]
]
,
-- Subcorpus Creation Modal
B.baseModal
{ isVisibleBox: isSubcorpusModalVisibleBox
, title: Just "Create a subcorpus"
, hasCollapsibleBackground: false
, size: MediumModalSize
}
[
subcorpusCreation
{ callback: createSubcorpusCallback
, query'
, reuseParentList
, reuseParentList'
, onSubcorpusCreationPending'
}
]
]
-- launchDocumentCreationProgress ::
-- launchDocumentCreationProgress ::
-- T.Box (Array GT.FrontendError)
-- T.Box (Array GT.FrontendError)
...
@@ -337,7 +334,7 @@ docViewCpt = R2.hereComponent here "docView" hCpt
...
@@ -337,7 +334,7 @@ docViewCpt = R2.hereComponent here "docView" hCpt
---------------------------------------------------
---------------------------------------------------
type SearchBarProps =
type SearchBarProps =
(
query :: T.Box Query, isSubcorpusModalVisibleBox :: T.Box Boolean
)
(
query :: T.Box Query, isSubcorpusModalVisibleBox :: T.Box Boolean
)
searchBar :: R2.Component SearchBarProps
searchBar :: R2.Component SearchBarProps
searchBar = R.createElement searchBarCpt
searchBar = R.createElement searchBarCpt
...
@@ -345,72 +342,79 @@ searchBar = R.createElement searchBarCpt
...
@@ -345,72 +342,79 @@ searchBar = R.createElement searchBarCpt
searchBarCpt :: R.Component SearchBarProps
searchBarCpt :: R.Component SearchBarProps
searchBarCpt = here.component "searchBar" cpt
searchBarCpt = here.component "searchBar" cpt
where
where
cpt { query, isSubcorpusModalVisibleBox} _children = do
cpt { query, isSubcorpusModalVisibleBox } _children = do
query' <- T.useLive T.unequal query
query' <- T.useLive T.unequal query
queryText <- T.useBox query'
queryText <- T.useBox query'
queryText' <- T.useLive T.unequal queryText
queryText' <- T.useLive T.unequal queryText
pure $ R.fragment [
pure $ R.fragment
H.div {className: "input-group px-5"}
[ H.div { className: "input-group px-5" }
[ H.input { className: "form-control"
[ H.input
, id: "docs-input-search"
{ className: "form-control"
, defaultValue: query'
, id: "docs-input-search"
, on: { change: onSearchChange queryText
, defaultValue: query'
, keyUp: onSearchKeyup query queryText' }
, on:
, placeholder: "Search in documents"
{ change: onSearchChange queryText
, type: "text" }
, keyUp: onSearchKeyup query queryText'
, H.div {className: "input-group-append"}
}
[
, placeholder: "Search in documents"
if query' /= ""
, type: "text"
then
}
R.fragment
, H.div { className: "input-group-append" }
[ clearButton query
[ if query' /= "" then
, searchButton query queryText'
R.fragment
, subCorpusButton isSubcorpusModalVisibleBox queryText' query
[ clearButton query
]
, searchButton query queryText'
else
, subCorpusButton isSubcorpusModalVisibleBox queryText' query
R.fragment
]
[ searchButton query queryText'
else
, subCorpusButton isSubcorpusModalVisibleBox queryText' query
R.fragment
]
[ searchButton query queryText'
]
, subCorpusButton isSubcorpusModalVisibleBox queryText' query
]
]
-- , H.div {className: "col-md-1"} [ searchButton query queryText' ]
-- , H.div {className: "col-md-1"} [ searchButton query queryText' ]
]
]
]
]
onSearchChange :: forall e. T.Box Query -> e -> Effect Unit
onSearchChange :: forall e. T.Box Query -> e -> Effect Unit
onSearchChange queryText e =
onSearchChange queryText e =
T.write_ (R.unsafeEventValue e) queryText
T.write_ (R.unsafeEventValue e) queryText
onSearchKeyup :: T.Box Query -> Query -> DE.KeyboardEvent -> Effect Unit
onSearchKeyup :: T.Box Query -> Query -> DE.KeyboardEvent -> Effect Unit
onSearchKeyup query queryText e =
onSearchKeyup query queryText e =
if DE.key e == "Enter" then
if DE.key e == "Enter" then
T.write_ queryText query
T.write_ queryText query
else
else
pure unit
pure unit
searchButton query queryText' =
searchButton query queryText' =
H.button
H.button
{ className: "input-group-text btn btn-light text-secondary"
{ className: "input-group-text btn btn-light text-secondary"
, on: { click: \_ -> T.write_ queryText' query }
, on: { click: \_ -> T.write_ queryText' query }
, type: "submit"
, type: "submit"
}
}
[ H.span { className: "fa fa-search" } [] ]
[ H.span { className: "fa fa-search" } [] ]
clearButton query =
clearButton query =
H.button
H.button
{ className: "input-group-text btn btn-light"
{ className: "input-group-text btn btn-light"
, on: { click: \_ -> T.write_ "" query }
, on: { click: \_ -> T.write_ "" query }
}
}
[ H.span { className: "text-danger fa fa-times" } [] ]
[ H.span { className: "text-danger fa fa-times" } [] ]
subCorpusButton modalVisible queryText' query =
subCorpusButton modalVisible queryText' query =
H.button { className: "input-group-text btn btn-light text-secondary"
H.button
, on: { click: \_ -> do
{ className: "input-group-text btn btn-light text-secondary"
T.write_ queryText' query
, on:
T.write_ true modalVisible }
{ click: \_ -> do
, type: "submit" }
T.write_ queryText' query
[ H.span {className: "fa fa-filter"} [] ]
T.write_ true modalVisible
}
, type: "submit"
, title: "Create a subcorpus"
}
[ H.span { className: "fa fa-filter" } [] ]
mock :: Boolean
mock :: Boolean
mock = false
mock = false
...
...
src/Gargantext/Components/DocsTable/SubcorpusCreation.purs
View file @
ae221fac
...
@@ -11,8 +11,8 @@ import Reactix.DOM.HTML as H
...
@@ -11,8 +11,8 @@ import Reactix.DOM.HTML as H
import Toestand as T
import Toestand as T
type Props =
type Props =
( callback
:: String -> Boolean -> Effect Unit
( callback :: String -> Boolean -> Effect Unit
, query'
:: String
, query' :: String
, reuseParentList :: T.Box Boolean
, reuseParentList :: T.Box Boolean
, reuseParentList' :: Boolean
, reuseParentList' :: Boolean
, onSubcorpusCreationPending' :: Boolean
, onSubcorpusCreationPending' :: Boolean
...
@@ -22,26 +22,25 @@ subcorpusCreation :: R2.Leaf Props
...
@@ -22,26 +22,25 @@ subcorpusCreation :: R2.Leaf Props
subcorpusCreation = R2.leaf component
subcorpusCreation = R2.leaf component
component :: R.Component Props
component :: R.Component Props
component = R.hooksComponent "subcorpusCreation" cpt
where
component = R.hooksComponent "subcorpusCreation" cpt
cpt {query', reuseParentList, reuseParentList', onSubcorpusCreationPending', callback} _ = do
where
pure $ H.div {} [
cpt { query', reuseParentList, reuseParentList', onSubcorpusCreationPending', callback } _ = do
H.div {className: "form-group"} [
pure $ H.div {}
H.label {} [ H.text $ "Creating subcorpus from query: " <> query' ]
[ H.div { className: "form-group" }
]
[ H.label {} [ H.text $ "Creating subcorpus from query: " <> query'
]
,
]
H.div {className: "form-check" } [
, H.div { className: "form-check" }
B.formCheckbox
[
B.formCheckbox
{ value: reuseParentList'
{ value: reuseParentList'
, callback: \_ -> T.modify_ not reuseParentList
, callback: \_ -> T.modify_ not reuseParentList
}
}
, H.label { className: "form-check-label"} [H.text "Reuse parent list?"]
, H.label { className: "form-check-label" } [ H.text "Reuse parent list?" ]
]
]
,
, B.button
B.button
{ callback: \_ -> callback query' reuseParentList'
{ callback: \_ -> callback query' reuseParentList'
, type: "submit"
, type: "submit"
, variant: ButtonVariant Primary
, variant: ButtonVariant Primary
, status: if query' == "" then Disabled else if onSubcorpusCreationPending' then Deferred else Enabled
, status: if query' == "" then Disabled else if onSubcorpusCreationPending' then Deferred else Enabled
}
}
[ H.text "Create!" ]
[ H.text "Create!"]
]
]
src/Gargantext/Components/DocsTable/Types.purs
View file @
ae221fac
...
@@ -124,6 +124,7 @@ newtype SubcorpusParams = SubcorpusParams
...
@@ -124,6 +124,7 @@ newtype SubcorpusParams = SubcorpusParams
{ query :: Query
{ query :: Query
, reuseParentList :: Boolean
, reuseParentList :: Boolean
}
}
derive instance Eq SubcorpusParams
derive instance Eq SubcorpusParams
derive instance Generic SubcorpusParams _
derive instance Generic SubcorpusParams _
derive newtype instance JSON.ReadForeign SubcorpusParams
derive newtype instance JSON.ReadForeign SubcorpusParams
...
...
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