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
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
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
91b05e79
Verified
Commit
91b05e79
authored
Jun 24, 2025
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[node] add commit hash (with expert feature flag)
Related to
#747
Needs corresponding backend API changes.
parent
76a7b40f
Pipeline
#7697
passed with stages
in 29 minutes and 46 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
37 deletions
+55
-37
flake.nix
flake.nix
+2
-0
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+42
-33
Version.js
src/Gargantext/Hooks/Version.js
+4
-2
Version.purs
src/Gargantext/Hooks/Version.purs
+7
-2
No files found.
flake.nix
View file @
91b05e79
...
...
@@ -116,7 +116,9 @@
# compile
echo "Bundling"
echo "{\"commit_hash\": \"$(git rev-parse HEAD)\"}" > .commit-hash.json
npm run bundle
rm .commit-hash.json
''
;
};
test-ps
=
pkgs
.
writeShellApplication
{
...
...
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
91b05e79
...
...
@@ -11,6 +11,7 @@ import Data.Foldable (intercalate)
import Data.Map as Map
import Data.Maybe (Maybe(..), maybe)
import Data.String.Regex as Regex
import Data.Tuple (Tuple(..))
import Effect (Effect)
import Effect.Aff (Aff, launchAff)
import Effect.Class (liftEffect)
...
...
@@ -36,6 +37,7 @@ import Gargantext.Context.Progress (asyncContext, asyncProgress)
import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.UpdateEffect (useUpdateEffect1')
import Gargantext.Hooks.UseFeatureFlag as Feature
import Gargantext.Hooks.Version (Version, useVersion)
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId)
...
...
@@ -738,7 +740,9 @@ listNodeActionsLoadedCpt = here.component "listNodeActionsLoaded" cpt
type VersionComparatorProps =
( clientVersion :: Version
, clientCommit :: String
, remoteVersion :: Version
, remoteCommit :: String
)
versionComparator :: R2.Leaf VersionComparatorProps
...
...
@@ -747,41 +751,46 @@ versionComparator = R2.leaf versionComparatorCpt
versionComparatorCpt :: R.Component VersionComparatorProps
versionComparatorCpt = here.component "versionComparator" cpt
where
cpt { clientVersion, remoteVersion } _
| clientVersion == remoteVersion = pure $
B.caveat
{ variant: Success
, className: "mainleaf__version-comparator"
}
[ B.b_ "Versions match"
, content clientVersion remoteVersion
]
| otherwise = pure $
B.caveat
{ variant: Warning
, className: "mainleaf__version-comparator"
}
[ B.b_ "Versions mismatch"
, content clientVersion remoteVersion
cpt { clientCommit, clientVersion, remoteVersion, remoteCommit } _ = do
let
Tuple variant msg =
if clientVersion == remoteVersion then Tuple Success "Versions match"
else Tuple Warning "Versions mismatch"
commitEl hash =
H.span {}
[ H.text " ("
, B.code_ hash
, H.text ")"
]
content :: Version -> Version -> R.Element
content clientVersion remoteVersion =
H.ul
{}
[ H.li
{}
[ B.span_ "frontend: "
, H.text $ nbsp 1
, B.code_ clientVersion
]
, H.li
{}
[ B.span_ "backend: "
, H.text $ nbsp 1
, B.code_ remoteVersion
]
]
pure $
B.caveat
{ variant
, className: "mainleaf__version-comparator"
}
[ B.b_ msg
, H.ul {}
[ H.li {}
[ B.span_ "frontend: "
, H.text $ nbsp 1
, B.code_ clientVersion
, Feature.hide
{ keys: [ "expert" ]
, render: commitEl clientCommit
}
]
, H.li {}
[ B.span_ "backend: "
, H.text $ nbsp 1
, B.code_ remoteVersion
, Feature.hide
{ keys: [ "expert" ]
, render: commitEl remoteCommit
}
]
]
]
-------------------------------------------------------
...
...
src/Gargantext/Hooks/Version.js
View file @
91b05e79
'use strict'
;
import
pkg
from
'../../package.json'
;
import
ch
from
'../../.commit-hash.json'
;
let
version
=
pkg
.
version
let
version
=
pkg
.
version
;
let
commitHash
=
ch
.
commit_hash
;
export
{
version
};
export
{
version
,
commitHash
};
src/Gargantext/Hooks/Version.purs
View file @
91b05e79
...
...
@@ -22,6 +22,7 @@ import Toestand as T
-- | (ie. Frontend Version)
foreign import version :: Version
foreign import commitHash :: String
type Version = String
...
...
@@ -33,7 +34,9 @@ type R_Input =
type Output = Maybe R_Output
type R_Output =
{ clientVersion :: String
, clientCommit :: String
, remoteVersion :: String
, remoteCommit :: String
}
-- | Conditional Hooks checking release version match between client and remove
...
...
@@ -49,7 +52,9 @@ useVersion mInput = do
Left err -> liftEffect $ log2 "[version] error" err
Right v -> liftEffect $ flip T.write_ mOutputBox $ Just
{ clientVersion: version
, remoteVersion: v
, clientCommit: commitHash
, remoteVersion: v.version
, remoteCommit: v.commitHash
}
-- Hooks
useFirstEffect' $ case mInput of
...
...
@@ -58,5 +63,5 @@ useVersion mInput = do
-- Output
pure mOutput
getBackendVersion :: Session -> REST.AffRESTError
Version
getBackendVersion :: Session -> REST.AffRESTError
{ version :: Version, commitHash :: String }
getBackendVersion (Session { backend }) = REST.get Nothing (toUrl backend "version")
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