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: ...@@ -13,21 +13,28 @@ variables:
#- apt-get install make xz-utils #- apt-get install make xz-utils
stages: stages:
- deps
- test - test
deps:
cache:
paths:
- /nix/store
- node_modules/
script:
- nix-env -i git
- nix-shell shell.nix --run 'yarn --skip-builds'
test: test:
cache: cache:
# cache per branch name # cache per branch name
# key: ${CI_COMMIT_REF_SLUG} # key: ${CI_COMMIT_REF_SLUG}
# paths: paths:
# - .stack-root/ - /nix/store
# - .stack-work/ - node_modules/
script: script:
# find 0.14.2 purescript version here: # find 0.14.5 purescript version here:
# https://lazamar.co.uk/nix-versions/ # 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 git
- nix-env -i nodejs - nix-shell shell.nix --run 'yarn --skip-builds'
- nix-env -i yarn
- yarn --skip-builds
- nix-shell shell.nix --run test-ps - nix-shell shell.nix --run test-ps
...@@ -5,8 +5,8 @@ import ...@@ -5,8 +5,8 @@ import
pkgs.fetchFromGitHub { pkgs.fetchFromGitHub {
owner = "justinwoo"; owner = "justinwoo";
repo = "easy-purescript-nix"; repo = "easy-purescript-nix";
rev = "d0f592b71b2be222f8dcfb4f4cefb52608bbc1ae"; rev = "678070816270726e2f428da873fe3f2736201f42";
sha256 = "0bq26y836bd1y8657f182wnsl4cdr1xxbykxdgz7xm9shpii48r5"; sha256 = "JEabdJ+3cZEYDVnzgMH/YFsaGtIBiCFcgvVO9XRgiY4=";
} }
) { ) {
inherit pkgs; inherit pkgs;
......
let upstream = 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 = let overrides =
{ globals = { globals =
......
...@@ -20,9 +20,9 @@ let ...@@ -20,9 +20,9 @@ let
echo "Compiling" echo "Compiling"
#build-purs #build-purs
spago build
echo "Bundling" echo "Bundling"
#pulp browserify --skip-compile -t dist/bundle.js --src-path output #pulp browserify --skip-compile -t dist/bundle.js --src-path output
spago build
browserify browserify
''; '';
...@@ -93,16 +93,19 @@ let ...@@ -93,16 +93,19 @@ let
set -e set -e
echo "Compiling" echo "Compiling"
build-purs yarn
spago build
#build-purs
echo "Testing" echo "Testing"
spago test
# pulp browserify --skip-compile -t dist/bundle.js --src-path output # pulp browserify --skip-compile -t dist/bundle.js --src-path output
# pulp test --src-path output --test-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 in
pkgs.mkShell { pkgs.mkShell {
buildInputs = [ buildInputs = [
easy-ps.purs-0_14_4 easy-ps.purs-0_14_5
easy-ps.psc-package easy-ps.psc-package
easy-ps.dhall-json-simple easy-ps.dhall-json-simple
easy-ps.zephyr easy-ps.zephyr
...@@ -117,6 +120,7 @@ pkgs.mkShell { ...@@ -117,6 +120,7 @@ pkgs.mkShell {
pkgs.closurecompiler pkgs.closurecompiler
pkgs.minify pkgs.minify
pkgs.nodejs pkgs.nodejs
pkgs.python # needed for msgpack etc
repl repl
serve serve
pkgs.pulp pkgs.pulp
......
...@@ -18,7 +18,7 @@ import Reactix.DOM.HTML as H ...@@ -18,7 +18,7 @@ import Reactix.DOM.HTML as H
import Toestand as T import Toestand as T
here :: R2.Here 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 -- | Action : Download
type ActionDownload = type ActionDownload =
...@@ -74,6 +74,11 @@ derive instance Eq NodeTextsDownloadFormat ...@@ -74,6 +74,11 @@ derive instance Eq NodeTextsDownloadFormat
derive instance Generic NodeTextsDownloadFormat _ derive instance Generic NodeTextsDownloadFormat _
instance Show NodeTextsDownloadFormat where show = genericShow instance Show NodeTextsDownloadFormat where show = genericShow
readDownloadFormat :: String -> NodeTextsDownloadFormat
readDownloadFormat "CSV" = CSV
readDownloadFormat "JSON" = JSON
readDownloadFormat _ = JSON
actionDownloadNodeTexts :: R2.Component ActionDownload actionDownloadNodeTexts :: R2.Component ActionDownload
actionDownloadNodeTexts = R.createElement actionDownloadNodeTextsCpt actionDownloadNodeTexts = R.createElement actionDownloadNodeTextsCpt
actionDownloadNodeTextsCpt :: R.Component ActionDownload actionDownloadNodeTextsCpt :: R.Component ActionDownload
...@@ -83,17 +88,19 @@ actionDownloadNodeTextsCpt = here.component "actionDownloadNodeTexts" cpt where ...@@ -83,17 +88,19 @@ actionDownloadNodeTextsCpt = here.component "actionDownloadNodeTexts" cpt where
downloadFormat' <- T.useLive T.unequal downloadFormat downloadFormat' <- T.useLive T.unequal downloadFormat
pure $ panel pure $ panel
[ R2.select { className: "form-control" } [ R2.select { className: "form-control"
[ opt CSV downloadFormat downloadFormat' , defaultValue: show downloadFormat'
, opt JSON downloadFormat downloadFormat' ] , on: { change: onChange downloadFormat } }
[ opt CSV downloadFormat
, opt JSON downloadFormat ]
, H.div {} [ H.text $ info downloadFormat' ] , H.div {} [ H.text $ info downloadFormat' ]
] ]
(submitButtonHref DownloadNode $ href downloadFormat') (submitButtonHref DownloadNode $ href downloadFormat')
where where
opt t downloadFormat df = H.option { on: { click: onClick } opt t downloadFormat = H.option { value: show t } [ H.text $ show t ]
, selected: df == t } [ H.text $ show t ]
where where
onClick _ = T.write_ t downloadFormat 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)) href t = url session $ Routes.NodeAPI GT.NodeTexts (Just id) ("export/" <> (toLower $ show t))
info t = "Info about the Documents as " <> show t <> " format" info t = "Info about the Documents as " <> show t <> " format"
......
...@@ -475,7 +475,6 @@ login' { backend, sessions, showLogin: visible } = ...@@ -475,7 +475,6 @@ login' { backend, sessions, showLogin: visible } =
routeFile :: R2.Component SessionNodeProps routeFile :: R2.Component SessionNodeProps
routeFile = R.createElement routeFileCpt routeFile = R.createElement routeFileCpt
routeFileCpt :: R.Component SessionNodeProps routeFileCpt :: R.Component SessionNodeProps
routeFileCpt = here.component "routeFile" cpt where routeFileCpt = here.component "routeFile" cpt where
cpt props@{ nodeId } _ = do cpt props@{ nodeId } _ = do
......
...@@ -36,7 +36,6 @@ type Choice = Maybe Score ...@@ -36,7 +36,6 @@ type Choice = Maybe Score
scoreEl :: R2.Component Props scoreEl :: R2.Component Props
scoreEl = R.createElement scoreElCpt scoreEl = R.createElement scoreElCpt
scoreElCpt :: R.Component Props scoreElCpt :: R.Component Props
scoreElCpt = R.hooksComponentWithModule thisModule "scoreEl" cpt scoreElCpt = R.hooksComponentWithModule thisModule "scoreEl" cpt
where where
......
...@@ -8741,9 +8741,9 @@ side-channel@^1.0.4: ...@@ -8741,9 +8741,9 @@ side-channel@^1.0.4:
get-intrinsic "^1.0.2" get-intrinsic "^1.0.2"
object-inspect "^1.9.0" 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" 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: signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.3" 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