Commit 5360925c authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch '339-dev-docs-download' of...

Merge branch '339-dev-docs-download' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into dev
parents a3104fb0 9ee9bf21
......@@ -13,21 +13,28 @@ variables:
#- apt-get install make xz-utils
stages:
- deps
- test
deps:
cache:
paths:
- /nix/store
- node_modules/
script:
- nix-env -i git
- nix-shell shell.nix --run 'yarn --skip-builds'
test:
cache:
# cache per branch name
# key: ${CI_COMMIT_REF_SLUG}
# paths:
# - .stack-root/
# - .stack-work/
paths:
- /nix/store
- node_modules/
script:
# find 0.14.2 purescript version here:
# find 0.14.5 purescript version here:
# https://lazamar.co.uk/nix-versions/
- nix-env -i purescript-0.14.4 -f https://github.com/NixOS/nixpkgs/archive/bed08131cd29a85f19716d9351940bdc34834492.tar.gz
- nix-env -i git
- nix-env -i nodejs
- nix-env -i yarn
- yarn --skip-builds
- nix-shell shell.nix --run 'yarn --skip-builds'
- nix-shell shell.nix --run test-ps
......@@ -5,8 +5,8 @@ import
pkgs.fetchFromGitHub {
owner = "justinwoo";
repo = "easy-purescript-nix";
rev = "d0f592b71b2be222f8dcfb4f4cefb52608bbc1ae";
sha256 = "0bq26y836bd1y8657f182wnsl4cdr1xxbykxdgz7xm9shpii48r5";
rev = "678070816270726e2f428da873fe3f2736201f42";
sha256 = "JEabdJ+3cZEYDVnzgMH/YFsaGtIBiCFcgvVO9XRgiY4=";
}
) {
inherit pkgs;
......
let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.14.4-20211030/packages.dhall sha256:5cd7c5696feea3d3f84505d311348b9e90a76c4ce3684930a0ff29606d2d816c
https://github.com/purescript/package-sets/releases/download/psc-0.14.5-20220110/packages.dhall sha256:8dbf71bfc6c7a11043619eebe90ff85f7d884541048aa8cc48eef1ee781cbc0e
let overrides =
{ globals =
......
......@@ -20,9 +20,9 @@ let
echo "Compiling"
#build-purs
spago build
echo "Bundling"
#pulp browserify --skip-compile -t dist/bundle.js --src-path output
spago build
browserify
'';
......@@ -93,16 +93,19 @@ let
set -e
echo "Compiling"
build-purs
yarn
spago build
#build-purs
echo "Testing"
spago test
# pulp browserify --skip-compile -t dist/bundle.js --src-path output
# pulp test --src-path output --test-path output
NODE_PATH=output node -e "require('Test.Main').main();"
#NODE_PATH=output node -e "require('Test.Main').main();"
'';
in
pkgs.mkShell {
buildInputs = [
easy-ps.purs-0_14_4
easy-ps.purs-0_14_5
easy-ps.psc-package
easy-ps.dhall-json-simple
easy-ps.zephyr
......@@ -117,6 +120,7 @@ pkgs.mkShell {
pkgs.closurecompiler
pkgs.minify
pkgs.nodejs
pkgs.python # needed for msgpack etc
repl
serve
pkgs.pulp
......
......@@ -18,7 +18,7 @@ import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Documentation"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Download"
-- | Action : Download
type ActionDownload =
......@@ -32,7 +32,7 @@ actionDownloadCpt :: R.Component ActionDownload
actionDownloadCpt = here.component "actionDownload" cpt where
cpt props@{ nodeType: GT.Corpus } _ = pure $ actionDownloadCorpus props []
cpt props@{ nodeType: GT.Graph } _ = pure $ actionDownloadGraph props []
cpt props@{ nodeType: GT.NodeList } _ = pure $ actionDownloadNodeList props []
cpt props@{ nodeType: GT.NodeList } _ = pure $ actionDownloadNodeList props []
cpt props@{ nodeType: GT.NodeTexts } _ = pure $ actionDownloadNodeTexts props []
cpt props@{ nodeType: _ } _ = pure $ actionDownloadOther props []
......@@ -74,6 +74,11 @@ derive instance Eq NodeTextsDownloadFormat
derive instance Generic NodeTextsDownloadFormat _
instance Show NodeTextsDownloadFormat where show = genericShow
readDownloadFormat :: String -> NodeTextsDownloadFormat
readDownloadFormat "CSV" = CSV
readDownloadFormat "JSON" = JSON
readDownloadFormat _ = JSON
actionDownloadNodeTexts :: R2.Component ActionDownload
actionDownloadNodeTexts = R.createElement actionDownloadNodeTextsCpt
actionDownloadNodeTextsCpt :: R.Component ActionDownload
......@@ -83,17 +88,19 @@ actionDownloadNodeTextsCpt = here.component "actionDownloadNodeTexts" cpt where
downloadFormat' <- T.useLive T.unequal downloadFormat
pure $ panel
[ R2.select { className: "form-control" }
[ opt CSV downloadFormat downloadFormat'
, opt JSON downloadFormat downloadFormat' ]
[ R2.select { className: "form-control"
, defaultValue: show downloadFormat'
, on: { change: onChange downloadFormat } }
[ opt CSV downloadFormat
, opt JSON downloadFormat ]
, H.div {} [ H.text $ info downloadFormat' ]
]
(submitButtonHref DownloadNode $ href downloadFormat')
where
opt t downloadFormat df = H.option { on: { click: onClick }
, selected: df == t } [ H.text $ show t ]
opt t downloadFormat = H.option { value: show t } [ H.text $ show t ]
where
onClick _ = T.write_ t downloadFormat
onChange downloadFormat e = T.write_ (readDownloadFormat $ R.unsafeEventValue e) downloadFormat
href t = url session $ Routes.NodeAPI GT.NodeTexts (Just id) ("export/" <> (toLower $ show t))
info t = "Info about the Documents as " <> show t <> " format"
......
......@@ -475,7 +475,6 @@ login' { backend, sessions, showLogin: visible } =
routeFile :: R2.Component SessionNodeProps
routeFile = R.createElement routeFileCpt
routeFileCpt :: R.Component SessionNodeProps
routeFileCpt = here.component "routeFile" cpt where
cpt props@{ nodeId } _ = do
......
......@@ -36,7 +36,6 @@ type Choice = Maybe Score
scoreEl :: R2.Component Props
scoreEl = R.createElement scoreElCpt
scoreElCpt :: R.Component Props
scoreElCpt = R.hooksComponentWithModule thisModule "scoreEl" cpt
where
......
......@@ -8741,9 +8741,9 @@ side-channel@^1.0.4:
get-intrinsic "^1.0.2"
object-inspect "^1.9.0"
"sigma@git://github.com/poorscript/sigma.js#garg":
"sigma@https://github.com/poorscript/sigma.js#garg":
version "1.2.1"
resolved "git://github.com/poorscript/sigma.js#624c611376dfb11cd34f1d01811d63dd5747ace7"
resolved "https://github.com/poorscript/sigma.js#624c611376dfb11cd34f1d01811d63dd5747ace7"
signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.3"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment