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
Show 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 @@
...
@@ -116,7 +116,9 @@
# compile
# compile
echo "Bundling"
echo "Bundling"
echo "{\"commit_hash\": \"$(git rev-parse HEAD)\"}" > .commit-hash.json
npm run bundle
npm run bundle
rm .commit-hash.json
''
;
''
;
};
};
test-ps
=
pkgs
.
writeShellApplication
{
test-ps
=
pkgs
.
writeShellApplication
{
...
...
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
91b05e79
...
@@ -11,6 +11,7 @@ import Data.Foldable (intercalate)
...
@@ -11,6 +11,7 @@ import Data.Foldable (intercalate)
import Data.Map as Map
import Data.Map as Map
import Data.Maybe (Maybe(..), maybe)
import Data.Maybe (Maybe(..), maybe)
import Data.String.Regex as Regex
import Data.String.Regex as Regex
import Data.Tuple (Tuple(..))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff)
import Effect.Aff (Aff, launchAff)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
...
@@ -36,6 +37,7 @@ import Gargantext.Context.Progress (asyncContext, asyncProgress)
...
@@ -36,6 +37,7 @@ import Gargantext.Context.Progress (asyncContext, asyncProgress)
import Gargantext.Ends (Frontends, url)
import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.UpdateEffect (useUpdateEffect1')
import Gargantext.Hooks.UpdateEffect (useUpdateEffect1')
import Gargantext.Hooks.UseFeatureFlag as Feature
import Gargantext.Hooks.Version (Version, useVersion)
import Gargantext.Hooks.Version (Version, useVersion)
import Gargantext.Routes as Routes
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId)
import Gargantext.Sessions (Session, sessionId)
...
@@ -738,7 +740,9 @@ listNodeActionsLoadedCpt = here.component "listNodeActionsLoaded" cpt
...
@@ -738,7 +740,9 @@ listNodeActionsLoadedCpt = here.component "listNodeActionsLoaded" cpt
type VersionComparatorProps =
type VersionComparatorProps =
( clientVersion :: Version
( clientVersion :: Version
, clientCommit :: String
, remoteVersion :: Version
, remoteVersion :: Version
, remoteCommit :: String
)
)
versionComparator :: R2.Leaf VersionComparatorProps
versionComparator :: R2.Leaf VersionComparatorProps
...
@@ -747,39 +751,44 @@ versionComparator = R2.leaf versionComparatorCpt
...
@@ -747,39 +751,44 @@ versionComparator = R2.leaf versionComparatorCpt
versionComparatorCpt :: R.Component VersionComparatorProps
versionComparatorCpt :: R.Component VersionComparatorProps
versionComparatorCpt = here.component "versionComparator" cpt
versionComparatorCpt = here.component "versionComparator" cpt
where
where
cpt { clientVersion, remoteVersion } _
cpt { clientCommit, clientVersion, remoteVersion, remoteCommit } _ = do
| clientVersion == remoteVersion = pure $
let
B.caveat
Tuple variant msg =
{ variant: Success
if clientVersion == remoteVersion then Tuple Success "Versions match"
, className: "mainleaf__version-comparator"
else Tuple Warning "Versions mismatch"
}
[ B.b_ "Versions match"
commitEl hash =
, content clientVersion remoteVersion
H.span {}
[ H.text " ("
, B.code_ hash
, H.text ")"
]
]
| otherwise = pure $
pure $
B.caveat
B.caveat
{ variant: Warning
{ variant
, className: "mainleaf__version-comparator"
, className: "mainleaf__version-comparator"
}
}
[ B.b_ "Versions mismatch"
[ B.b_ msg
, content clientVersion remoteVersion
, H.ul {}
]
[ H.li {}
content :: Version -> Version -> R.Element
content clientVersion remoteVersion =
H.ul
{}
[ H.li
{}
[ B.span_ "frontend: "
[ B.span_ "frontend: "
, H.text $ nbsp 1
, H.text $ nbsp 1
, B.code_ clientVersion
, B.code_ clientVersion
, Feature.hide
{ keys: [ "expert" ]
, render: commitEl clientCommit
}
]
]
, H.li
, H.li {}
{}
[ B.span_ "backend: "
[ B.span_ "backend: "
, H.text $ nbsp 1
, H.text $ nbsp 1
, B.code_ remoteVersion
, B.code_ remoteVersion
, Feature.hide
{ keys: [ "expert" ]
, render: commitEl remoteCommit
}
]
]
]
]
]
...
...
src/Gargantext/Hooks/Version.js
View file @
91b05e79
'use strict'
;
'use strict'
;
import
pkg
from
'../../package.json'
;
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
...
@@ -22,6 +22,7 @@ import Toestand as T
-- | (ie. Frontend Version)
-- | (ie. Frontend Version)
foreign import version :: Version
foreign import version :: Version
foreign import commitHash :: String
type Version = String
type Version = String
...
@@ -33,7 +34,9 @@ type R_Input =
...
@@ -33,7 +34,9 @@ type R_Input =
type Output = Maybe R_Output
type Output = Maybe R_Output
type R_Output =
type R_Output =
{ clientVersion :: String
{ clientVersion :: String
, clientCommit :: String
, remoteVersion :: String
, remoteVersion :: String
, remoteCommit :: String
}
}
-- | Conditional Hooks checking release version match between client and remove
-- | Conditional Hooks checking release version match between client and remove
...
@@ -49,7 +52,9 @@ useVersion mInput = do
...
@@ -49,7 +52,9 @@ useVersion mInput = do
Left err -> liftEffect $ log2 "[version] error" err
Left err -> liftEffect $ log2 "[version] error" err
Right v -> liftEffect $ flip T.write_ mOutputBox $ Just
Right v -> liftEffect $ flip T.write_ mOutputBox $ Just
{ clientVersion: version
{ clientVersion: version
, remoteVersion: v
, clientCommit: commitHash
, remoteVersion: v.version
, remoteCommit: v.commitHash
}
}
-- Hooks
-- Hooks
useFirstEffect' $ case mInput of
useFirstEffect' $ case mInput of
...
@@ -58,5 +63,5 @@ useVersion mInput = do
...
@@ -58,5 +63,5 @@ useVersion mInput = do
-- Output
-- Output
pure mOutput
pure mOutput
getBackendVersion :: Session -> REST.AffRESTError
Version
getBackendVersion :: Session -> REST.AffRESTError
{ version :: Version, commitHash :: String }
getBackendVersion (Session { backend }) = REST.get Nothing (toUrl backend "version")
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