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
138
Issues
138
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
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
18aab30e
Commit
18aab30e
authored
May 27, 2025
by
Fabien Maniere
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-flags-hide' into 'dev'
Feature flags hide See merge request
!511
parents
3f014a95
b3fad287
Pipeline
#7626
passed with stages
in 23 minutes and 2 seconds
Changes
12
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
225 additions
and
173 deletions
+225
-173
.gitignore
.gitignore
+4
-4
package.json
package.json
+1
-0
Layout.purs
src/Gargantext/Components/Corpus/Layout.purs
+31
-22
Types.purs
src/Gargantext/Components/Document/Types.purs
+0
-37
SearchField.purs
...omponents/Forest/Tree/Node/Action/Search/SearchField.purs
+15
-4
Update.purs
...Gargantext/Components/Forest/Tree/Node/Action/Update.purs
+17
-7
WriteNodesDocuments.purs
...mponents/Forest/Tree/Node/Action/WriteNodesDocuments.purs
+3
-3
Tools.purs
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
+16
-6
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+17
-6
Home.purs
src/Gargantext/Components/Nodes/Home.purs
+2
-1
TopBar.purs
src/Gargantext/Components/TopBar.purs
+112
-83
UseFeatureFlag.purs
src/Gargantext/Hooks/UseFeatureFlag.purs
+7
-0
No files found.
.gitignore
View file @
18aab30e
...
...
@@ -49,7 +49,7 @@ bundle.js
/dist/bundle.min.js*
# IDE specific
.
idea/
.vscode/
.parcel-cache
/
.
vscode
dist/dev/bundle
dist/dev
.parcel-cache
package.json
View file @
18aab30e
...
...
@@ -21,6 +21,7 @@
"test"
:
"spago test"
,
"dev"
:
"concurrently
\"
npm run watch
\"
\"
npm run serve
\"
"
,
"serve"
:
"npx parcel serve --dist-dir ./dist/dev/bundle ./dist/dev/index.html"
,
"format-ps"
:
"purs-tidy format-in-place src"
,
"prepare"
:
"husky"
},
"dependencies"
:
{
...
...
src/Gargantext/Components/Corpus/Layout.purs
View file @
18aab30e
...
...
@@ -22,6 +22,7 @@ import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Hooks.UseFeatureFlag as Feature
type Props =
( nodeId :: ID
...
...
@@ -107,28 +108,11 @@ layoutCpt = here.component "layout" cpt
[ editionBlock
{ nodeId }
]
, H.div
{ className: "node-layout__code-section corpus-layout__code-section" }
[ tileMenu
{ boxes
, currentTile: Just corpusCodeRoute
, xTile: Just corpusCodeRoute
, yTile: Just corpusCodeRoute
}
[ B.button
{ callback: const $ pure unit
, status: Muted
, size: SmallSize
, variant: ButtonVariant Secondary
}
[ B.icon
{ name: "code" }
, B.wad_
[ "d-inline-block", "virtual-space", "w-1" ]
, H.text "Code section"
]
]
]
, Feature.hide
{ keys: [ "expert" ]
, render: viewCodeSectionButton boxes corpusCodeRoute
}
, H.div
{ className: "node-layout__folders corpus-layout__folders" }
[ FV.folderView
...
...
@@ -138,6 +122,31 @@ layoutCpt = here.component "layout" cpt
]
]
viewCodeSectionButton :: Record AppStore.Store -> (Unit -> Effect GR.AppRoute) -> R.Element
viewCodeSectionButton boxes corpusCodeRoute =
H.div
{ className: "node-layout__code-section corpus-layout__code-section" }
[ tileMenu
{ boxes
, currentTile: Just corpusCodeRoute
, xTile: Just corpusCodeRoute
, yTile: Just corpusCodeRoute
}
[ B.button
{ callback: const $ pure unit
, status: Muted
, size: SmallSize
, variant: ButtonVariant Secondary
}
[ B.icon
{ name: "code" }
, B.wad_
[ "d-inline-block", "virtual-space", "w-1" ]
, H.text "Code section"
]
]
]
onExpandTableEditionChange :: T.Change Boolean -> Effect Unit
onExpandTableEditionChange { new } = do
cache <- R2.loadLocalStorageState' R2.appParamsKey defaultCacheParams
...
...
src/Gargantext/Components/Document/Types.purs
View file @
18aab30e
...
...
@@ -86,43 +86,6 @@ derive instance Generic DocumentV3 _
derive instance Newtype DocumentV3 _
derive newtype instance JSON.ReadForeign DocumentV3
derive newtype instance JSON.WriteForeign DocumentV3
instance Show DocumentV3 where
show = genericShow
defaultNodeDocumentV3 :: NodePoly DocumentV3
defaultNodeDocumentV3 =
NodePoly
{ id: 0
, typename: 0
, userId: 0
, parentId: Just 0
, name: "Default name"
, date: "Default date"
, hyperdata: defaultDocumentV3
}
defaultDocumentV3 :: DocumentV3
defaultDocumentV3 =
DocumentV3
{ abstract: Nothing
, authors: Nothing
--, error : Nothing
, language_iso2: Nothing
, language_iso3: Nothing
, language_name: Nothing
, publication_date: Nothing
, publication_day: Nothing
, publication_hour: Nothing
, publication_minute: Nothing
, publication_month: Nothing
, publication_second: Nothing
, publication_year: Nothing
, realdate_full_: Nothing
, source: Nothing
, statuses: Nothing
, title: Nothing
}
newtype Document =
Document
{ abstract :: Maybe String
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/SearchField.purs
View file @
18aab30e
...
...
@@ -23,6 +23,7 @@ import Gargantext.Components.ListSelection as ListSelection
import Gargantext.Components.ListSelection.Types as ListSelection
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.UseFeatureFlag as Feature
import Gargantext.Sessions (Session(..))
import Gargantext.Types (FrontendError)
import Gargantext.Types as GT
...
...
@@ -324,7 +325,16 @@ dataFieldNavCpt = here.component "dataFieldNav" cpt
pure $ R.fragment
[ H.div { className: "text-primary text-bold p-1" } [ H.text "Search options:" ]
, H.div { className: "nav nav-tabs" } ((liItem search') <$> dataFields)
, Feature.feature
{ keys: [ "expert" ]
, render: \shouldRender ->
let
viewTabs d = H.div { className: "nav nav-tabs" } ((liItem search') <$> d)
in
if shouldRender then viewTabs dataFields
-- This hides the web tab in search
else viewTabs $ A.filter (\i -> i /= Web) dataFields
}
, H.div { className: "center p-1" }
[ H.text $ doc datafield
]
...
...
@@ -673,7 +683,7 @@ datafieldInputCpt = here.component "datafieldInput" cpt
else
H.div {} []
,
H.div {} [ searchIframes { iframeRef, search } [] ]
,
Feature.hide { keys: [ "expert" ], render: H.div {} [ searchIframes { iframeRef, search } [] ] }
]
type SearchInputProps =
...
...
@@ -741,11 +751,12 @@ submitButtonComponent = here.component "submitButton" cpt
cpt { errors, onSearch, search, selection, session } _ = do
search' <- T.useLive T.unequal search
selection' <- T.useLive T.unequal selection
{ datafield } <- T.read search
pure $
H.button
{ className: "btn btn-primary"
{ className: "btn btn-primary
" <> if datafield == External Empty then "disabled" else "
"
, "type": "button"
, "disabled": if datafield == External Empty then "true" else "false"
, on: { click: doSearch onSearch errors session selection' search' }
, style: { width: "100%" }
}
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Update.purs
View file @
18aab30e
...
...
@@ -17,6 +17,7 @@ import Gargantext.Components.PhyloExplorer.API as Phylo
import Gargantext.Components.PhyloExplorer.Config.ConfigForm as PhyloForm
import Gargantext.Components.PhyloExplorer.ConfigFormParser as PhyloHook
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Hooks.UseFeatureFlag as Feature
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Types (ID, NodeType(..))
...
...
@@ -263,16 +264,25 @@ updateNodeListCpt = here.component "updateNodeList" cpt
, iconName: "reload-with-settings"
, textTitle: "Update terms"
}
[ Tools.formChoiceSafe
{ items: [ Basic, Advanced, WithModel ]
, default: methodList'
, callback: \val -> T.write_ val methodList
, print: show
, label: "Update with:"
[ Feature.feature
{ keys: [ "expert" ]
, render: \shouldRender ->
if shouldRender then viewUpdateTermsOptions methodList' methodList [ Basic, Advanced, WithModel ]
else viewUpdateTermsOptions methodList' methodList [ Basic ]
}
[]
]
viewUpdateTermsOptions :: forall box11 t13. Show t13 => T.Write box11 t13 => t13 -> box11 -> Array t13 -> R.Element
viewUpdateTermsOptions methodList' methodList items =
Tools.formChoiceSafe
{ items: items
, default: methodList'
, callback: \val -> T.write_ val methodList
, print: show
, label: "Update with:"
}
[]
updateTexts :: R2.Component UpdateProps
updateTexts = R.createElement updateTextsCpt
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/WriteNodesDocuments.purs
View file @
18aab30e
...
...
@@ -92,7 +92,7 @@ actionWriteNodesDocumentsWithLangsCpt = here.component "actionWriteNodesDocument
[ H.div
{ className: "form-group__label" }
[ B.label_ $
"
Please s
elect the language of your current Notes:"
"
S
elect the language of your current Notes:"
]
, H.div
{ className: "form-group__field" }
...
...
@@ -111,7 +111,7 @@ actionWriteNodesDocumentsWithLangsCpt = here.component "actionWriteNodesDocument
[ H.div
{ className: "form-group__label" }
[ B.label_ $
"
Please set the document size you require
:"
"
Choose the length of the context window
:"
]
, H.div
{ className: "form-group__field" }
...
...
@@ -130,7 +130,7 @@ actionWriteNodesDocumentsWithLangsCpt = here.component "actionWriteNodesDocument
[ H.div
{ className: "form-group__label" }
[ B.label_ $
"
Please c
hoose the list of terms to use:"
"
C
hoose the list of terms to use:"
]
, H.div
{ className: "form-group__field" }
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
View file @
18aab30e
...
...
@@ -23,6 +23,7 @@ import Reactix as R
import Reactix.DOM.HTML as H
import Record.Extra as RX
import Toestand as T
import Gargantext.Hooks.UseFeatureFlag as Feature
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Tools"
...
...
@@ -280,7 +281,7 @@ formChoiceSafeCpt = here.component "formChoiceSafe" cpt
cpt { items, default, callback, print, label } _ = do
pure $ case items of
[] -> H.div {} []
[ n ] -> formButton { item: n, callback, print } []
--
[ n ] -> formButton { item: n, callback, print } []
_ -> formChoice { items, default, callback, print, label } []
type FormChoiceProps item m =
...
...
@@ -304,14 +305,23 @@ formChoiceCpt = here.component "formChoice" cpt
cpt { items, callback, default, print, label } _ = do
pure $ H.div { className: "form-group" }
[ H.label {} [ H.text label ]
, R2.select
{ className: "form-control with-icon-font"
, defaultValue: show default
, on: { change }
} $ map option items
, Feature.feature
{ keys: [ "expert" ]
, render: \shouldRender ->
if shouldRender then viewSelectNodeOptions $ map option items
else viewSelectNodeOptions $ map option (A.filter (\i -> print i `A.notElem` [ "Visio", "Annuaire" ]) items)
}
]
where
viewSelectNodeOptions options =
R2.select
{ className: "form-control with-icon-font"
, defaultValue: show default
, on: { change }
} $ options
change e = callback $ fromMaybe default $ reader $ R.unsafeEventValue e
option opt = H.option { value: show opt } [ H.text $ print opt ]
...
...
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
18aab30e
...
...
@@ -25,6 +25,7 @@ import Gargantext.Components.App.Store as AppStore
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), Elevation(..), Variant(..))
import Gargantext.Components.GraphExplorer.Sidebar.ContactList (contactListWrapper)
import Gargantext.Hooks.UseFeatureFlag as Feature
import Gargantext.Components.GraphExplorer.Sidebar.DocList (docListWrapper)
import Gargantext.Components.GraphExplorer.Sidebar.Legend as Legend
import Gargantext.Components.GraphExplorer.Store as GraphStore
...
...
@@ -101,12 +102,22 @@ sidebarCpt = here.component "sidebar" cpt
, callback: closeCallback
, className: "graph-sidebar__close"
}
,
-- Menu
B.tabs
{ value: sideTab'
, list: sideTabs
, callback: flip T.write_ sideTab
-- Menu
, Feature.feature
{ keys: [ "expert" ]
, render: \shouldRender ->
if shouldRender then B.tabs
{ value: sideTab'
, list: sideTabs
, callback: flip T.write_ sideTab
}
else B.tabs
{ value: sideTab'
, list: [ GET.SideTabLegend, GET.SideTabData ]
, callback: flip T.write_ sideTab
}
}
, case sideTab' of
GET.SideTabLegend -> sideTabLegend props
...
...
src/Gargantext/Components/Nodes/Home.purs
View file @
18aab30e
...
...
@@ -39,6 +39,7 @@ import Gargantext.Components.Bootstrap.Types (Elevation(..), Position(..), Toolt
import Gargantext.Components.Data.Landing (BlockText(..), BlockTexts(..), Button(..), LandingData(..))
import Gargantext.Components.FolderView as FV
import Gargantext.Components.Lang (LandingLang(..))
import Gargantext.Hooks.UseFeatureFlag as Feature
import Gargantext.Components.Lang.Landing.EnUS as En
import Gargantext.Components.Lang.Landing.FrFR as Fr
import Gargantext.Config as Config
...
...
@@ -138,7 +139,7 @@ homeLayoutCpt = here.component "homeLayout" cpt
]
-- @TODO
-- H.div { className: "home-research-form" } []
,
blocksRandomText' landingData
,
Feature.hide { keys: [ "expert" ], render: blocksRandomText' landingData }
, B.wad
[ "mt-8" ]
[ license
...
...
src/Gargantext/Components/TopBar.purs
View file @
18aab30e
module Gargantext.Components.TopBar (component) where
import Gargantext.Prelude
import Affjax.RequestBody (document)
import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..), isJust, fromMaybe)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Console (log)
import Gargantext.Components.App.Store as AppStore
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), Variant(..))
import Gargantext.Components.Themes (themeSwitcher, allThemes)
import Gargantext.Prelude
import Gargantext.Components.Themes as Themes
import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Hooks.UseFeatureFlag as Feature
import Gargantext.Sessions.Types (update)
import Gargantext.Types (Handed(..), defaultCacheParams)
import Gargantext.Utils (setter, (?))
import Gargantext.Utils.Reactix as R2
import Reactix (Hooks)
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
import Web.HTML (window)
import Web.HTML.Location (host, protocol)
import Web.HTML.Window as Window
here :: R2.Here
here = R2.here "Gargantext.Components.TopBar"
...
...
@@ -31,9 +44,15 @@ componentCpt = here.component "main" cpt
} <- AppStore.use
showTree' <- R2.useLive' showTree
(windowLocation /\ updateWindowLocation) <- R.useState' Nothing
-- | Effects
-- |
useFirstEffect' $ do
l <- window >>= Window.location >>= host
protocol <- window >>= Window.location >>= protocol
let url = protocol <> "//" <> l
updateWindowLocation (\_prev -> Just url)
-- | Behaviors
-- |
...
...
@@ -53,80 +72,19 @@ componentCpt = here.component "main" cpt
, role: "navigation"
}
[ logo
,
divDropdownLeft {} []
,
H.li
{ title: "If you are Left Handed you can change\n"
<> "the interface by clicking on me. Click\n"
<> "again to come back to previous state."
,
className: "nav-item main-topbar__hand-button"
,
viewSideBar showTree' onTreeToggleClick
,
viewChangeLayoutSide
, viewInfoMenu { location: windowLocation } []
, Feature.hide
{ keys: [ "expert" ]
,
render: viewQuestionMark
}
[ handedChooser
{}
]
, H.li
{ title: "Hello! Looking for the tree?\n"
<> "Just watch on the other side!\n"
<> "Click on the hand again to see it back."
, className: "nav-item main-topbar__help-button"
, Feature.hide
{ keys: [ "expert" ]
, render: viewThemeSelector theme
}
[ H.a
{ className: "nav-link navbar-text" }
[ H.span
{ className: "fa fa-question-circle-o" }
[]
]
]
, H.li { className: "nav-item" }
[ B.button
{ variant: showTree'
? ButtonVariant Light
$
OutlinedButtonVariant Light
, callback: onTreeToggleClick
, className: "main-topbar__tree-switcher rounded-circle-2"
, title:
if showTree' then "Hide Tree"
else "Show Tree"
}
[ B.icon
{ name: "sidebar"
, className: ""
}
-- ,
-- if showTree'
-- then H.text $ nbsp 1 <> "Hide Tree"
-- else H.text $ nbsp 1 <> "Show Tree"
]
]
, H.li
{ className: "nav-item main-topbar__theme-switcher" }
[ themeSwitcher
{ theme
, themes: allThemes
}
[]
]
{- ,
H.li { className: "nav-item main-topbar__lang-switcher" }
[ langSwitcher
{ lang
, langs: allFeLangs
} []
]-}
{- , B.button
{ variant: showTree' ?
ButtonVariant Light $
OutlinedButtonVariant Light
, callback: onTreeToggleClick
, className: "main-topbar__tree-switcher"
}
[
if showTree'
then H.text "Hide Tree"
else H.text "Show Tree"
]-}
, H.div
{ id: "portal-topbar"
, className: "ml-1 w-100 h-100"
...
...
@@ -134,6 +92,71 @@ componentCpt = here.component "main" cpt
[]
]
viewChangeLayoutSide :: R.Element
viewChangeLayoutSide =
H.li
{ title: "If you are Left Handed you can change\n"
<> "the interface by clicking on me. Click\n"
<> "again to come back to previous state."
, className: "nav-item main-topbar__hand-button"
}
[ handedChooser
{}
]
viewSideBar :: Boolean -> (Unit -> Effect Unit) -> R.Element
viewSideBar showTree' onTreeToggleClick =
H.li { className: "nav-item" }
[ B.button
{ variant: showTree'
? ButtonVariant Light
$
OutlinedButtonVariant Light
, callback: onTreeToggleClick
, className: "main-topbar__tree-switcher rounded-circle-2"
, title:
if showTree' then "Hide Tree"
else "Show Tree"
}
[ B.icon
{ name: "sidebar"
, className: ""
}
]
]
viewThemeSelector :: T.Box Themes.Theme -> R.Element
viewThemeSelector theme =
H.li
{ className: "nav-item main-topbar__theme-switcher" }
[ themeSwitcher
{ theme
, themes: allThemes
}
[]
]
empty :: R.Element
empty =
H.text ""
viewQuestionMark :: R.Element
viewQuestionMark =
H.li
{ title: "Hello! Looking for the tree?\n"
<> "Just watch on the other side!\n"
<> "Click on the hand again to see it back."
, className: "nav-item main-topbar__help-button"
}
[ H.a
{ className: "nav-link navbar-text" }
[ H.span
{ className: "fa fa-question-circle-o" }
[]
]
]
-- SB.searchBar {session, databases: allDatabases}
onTreeToggleChange :: Boolean -> Effect Unit
...
...
@@ -154,28 +177,28 @@ logo =
src = "images/logoSmall.png"
title = "Back to home"
divDropdownLeft :: R2.Component (
)
divDropdownLeft = R.createElement divDropdownLeftCpt
viewInfoMenu :: R2.Component (location :: Maybe String
)
viewInfoMenu = R.createElement viewInfoMenu'
divDropdownLeftCpt :: R.Component (
)
divDropdownLeftCpt
= here.component "divDropdownLeft" cpt
viewInfoMenu' :: R.Component (location :: Maybe String
)
viewInfoMenu'
= here.component "divDropdownLeft" cpt
where
cpt {} _ = do
cpt {
location
} _ = do
show <- T.useBox false
pure $ H.li { className: "nav-item dropdown" }
[ menuButton { element: menuElement, show } []
, menuElements { elements, show } []
, menuElements { elements
: elements location
, show } []
]
menuElement = LiNav
{ title: "GarganText"
, href: "#"
, icon: "fa fa-
navicon
"
, text: "
GarganText
"
, icon: "fa fa-
question-circle-o
"
, text: "
infos
"
}
elements =
elements
location
=
[ [ LiNav
{ title: "User documentation"
, href: "https://write.frame.gargantext.org/s/649a6d7e1db3b365d6d0b1430d9700cc0bb4fdb1348dd1040a94c95f98979abe"
...
...
@@ -228,7 +251,13 @@ divDropdownLeftCpt = here.component "divDropdownLeft" cpt
-}
, LiNav
{ title: "API documentation"
, href: "https://cnrs.gargantext.org/swagger-ui"
, href: case location of
Just l ->
l <> "/swagger-ui"
Nothing ->
"https://cnrs.gargantext.org/swagger-ui"
, icon: "fa fa-code-fork"
, text: "API documentation"
}
...
...
src/Gargantext/Hooks/UseFeatureFlag.purs
View file @
18aab30e
...
...
@@ -53,6 +53,13 @@ feature = R2.renderLeaf "" $
render shouldRender
)
hide = R2.renderLeaf "" $
( \{ keys, render } _ -> do
shouldRender <- useFeatureFlag keys
pure $
if shouldRender then render else H.text ""
)
hideBehind :: forall a. Array String -> R2.Component a -> R2.Component a
hideBehind keys cpt = R2.renderComponent "" \props children -> do
shouldRender <- useFeatureFlag keys
...
...
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