diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f372b2..895a46b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,8 +10,8 @@ jobs: - uses: actions/checkout@v2 - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - - uses: cachix/install-nix-action@v6 - - uses: cachix/cachix-action@v3 + - uses: cachix/install-nix-action@v13 + - uses: cachix/cachix-action@v10 with: name: zfs-snap-diff attributes: bindata diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index e15a0c7..69ac8c3 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -9,7 +9,7 @@ jobs: steps: - uses: actions/checkout@v2 - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - - uses: cachix/install-nix-action@v6 + - uses: cachix/install-nix-action@v13 - name: build run: nix-build -A site diff --git a/default.nix b/default.nix index ec35064..93102b9 100644 --- a/default.nix +++ b/default.nix @@ -1,22 +1,19 @@ { goos ? "linux", with-dev-tools ? false }: let - fetchNixpkgs = {rev, sha256}: builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs-channels/archive/${rev}.tar.gz"; - inherit sha256; - }; - - pkgs = import (fetchNixpkgs { - rev = "8a9807f1941d046f120552b879cf54a94fca4b38"; - sha256 = "0s8gj8b7y1w53ak138f3hw1fvmk40hkpzgww96qrsgf490msk236"; + pkgs = import (builtins.fetchGit { + name = "nixos-21.05"; + url = "https://github.com/nixos/nixpkgs/"; + ref = "refs/heads/nixos-21.05"; + rev = "a1007637cea374bd1bafd754cfd5388894c49129"; }) {}; # nix-prefetch-git https://github.com/justinwoo/easy-purescript-nix easy-ps = import (pkgs.fetchFromGitHub { owner = "justinwoo"; repo = "easy-purescript-nix"; - rev = "a09d4ff6a8e4a8a24b26f111c2a39d9ef7fed720"; - sha256 = "1iaid67vf8frsqfnw1vm313d50mdws9qg4bavrhfhmgjhcyqmb52"; + rev = "5e66c8fe92e80c054cd6ef7e9ac0e91de81175ca"; + sha256 = "1wr5gynay76623mnf0jz8adwvldk4qyqc96r3yp9qkql83gn3zpx"; }) { inherit pkgs; }; @@ -81,6 +78,7 @@ let rev = version; sha256 = "11j2cph5w042qx1d91gbwkcq884dlz0lc7ngq1xvyg5hhpd3j8qv"; }; + vendorSha256 = "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5"; modSha256 = "00zr3kpaywqi5kgjzvmf284njxl1fs1k9xaz1b8azwxnjpy77i0c"; }; in pkgs.runCommand "bindata.go" {} '' @@ -89,10 +87,11 @@ let ${go-bindata}/bin/go-bindata -pkg webapp -o $out/bindata.go . ''; - zfs-snap-diff = pkgs.buildGo112Module rec { + zfs-snap-diff = pkgs.buildGo115Module rec { pname = "zfs-snap-diff"; inherit version; src = pkgs.nix-gitignore.gitignoreSource [ ".gitignore" "/webapp/" ] ./.; + vendorSha256 = "1pr4xnm412ihmvxm3zygqsb34wabyxvs7dlnhbks3sxr0zsfp6fi"; modSha256 = "0k1sz9mnz09pgn4w3k2dx0grcb66xd3h0f6ccc2r76vz6mz1hpgf"; preBuild = '' diff --git a/webapp/default.nix b/webapp/default.nix index 64fef2e..64326c6 100644 --- a/webapp/default.nix +++ b/webapp/default.nix @@ -1,4 +1,4 @@ -# This file has been generated by node2nix 1.7.0. Do not edit! +# This file has been generated by node2nix 1.9.0. Do not edit! {pkgs ? import { inherit system; @@ -6,12 +6,12 @@ let nodeEnv = import ./node-env.nix { - inherit (pkgs) stdenv python2 utillinux runCommand writeTextFile; - inherit nodejs; + inherit (pkgs) stdenv lib python2 runCommand writeTextFile; + inherit pkgs nodejs; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; }; in import ./node-packages.nix { - inherit (pkgs) fetchurl fetchgit; + inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; inherit nodeEnv; -} \ No newline at end of file +} diff --git a/webapp/node-env.nix b/webapp/node-env.nix index 670556b..c2b7231 100644 --- a/webapp/node-env.nix +++ b/webapp/node-env.nix @@ -1,8 +1,11 @@ # This file originates from node2nix -{stdenv, nodejs, python2, utillinux, libtool, runCommand, writeTextFile}: +{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile}: let + # Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master + utillinux = if pkgs ? utillinux then pkgs.utillinux else pkgs.util-linux; + python = if nodejs ? python then nodejs.python else python2; # Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise @@ -38,8 +41,8 @@ let }; includeDependencies = {dependencies}: - stdenv.lib.optionalString (dependencies != []) - (stdenv.lib.concatMapStrings (dependency: + lib.optionalString (dependencies != []) + (lib.concatMapStrings (dependency: '' # Bundle the dependencies of the package mkdir -p node_modules @@ -57,7 +60,7 @@ let # Recursively composes the dependencies of a package composePackage = { name, packageName, src, dependencies ? [], ... }@args: - '' + builtins.addErrorContext "while evaluating node package '${packageName}'" '' DIR=$(pwd) cd $TMPDIR @@ -100,7 +103,7 @@ let cd "$DIR/${packageName}" ${includeDependencies { inherit dependencies; }} cd .. - ${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ''; pinpointDependencies = {dependencies, production}: @@ -161,12 +164,12 @@ let '' node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"} - ${stdenv.lib.optionalString (dependencies != []) + ${lib.optionalString (dependencies != []) '' if [ -d node_modules ] then cd node_modules - ${stdenv.lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies} + ${lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies} cd .. fi ''} @@ -183,7 +186,7 @@ let cd "${packageName}" ${pinpointDependencies { inherit dependencies production; }} cd .. - ${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} fi ''; @@ -242,8 +245,8 @@ let if(fs.existsSync("./package-lock.json")) { var packageLock = JSON.parse(fs.readFileSync("./package-lock.json")); - if(packageLock.lockfileVersion !== 1) { - process.stderr.write("Sorry, I only understand lock file version 1!\n"); + if(![1, 2].includes(packageLock.lockfileVersion)) { + process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); process.exit(1); } @@ -344,8 +347,8 @@ let cd "${packageName}" runHook preRebuild - ${stdenv.lib.optionalString bypassCache '' - ${stdenv.lib.optionalString reconstructLock '' + ${lib.optionalString bypassCache '' + ${lib.optionalString reconstructLock '' if [ -f package-lock.json ] then echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!" @@ -361,14 +364,14 @@ let node ${addIntegrityFieldsScript} ''} - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild + npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild - if [ "$dontNpmInstall" != "1" ] + if [ "''${dontNpmInstall-}" != "1" ] then # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. rm -f npm-shrinkwrap.json - npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install + npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install fi ''; @@ -396,10 +399,12 @@ let stdenv.mkDerivation ({ name = "node_${name}-${version}"; buildInputs = [ tarWrapper python nodejs ] - ++ stdenv.lib.optional (stdenv.isLinux) utillinux - ++ stdenv.lib.optional (stdenv.isDarwin) libtool + ++ lib.optional (stdenv.isLinux) utillinux + ++ lib.optional (stdenv.isDarwin) libtool ++ buildInputs; + inherit nodejs; + inherit dontStrip; # Stripping may fail a build for some package deployments inherit dontNpmInstall preRebuild unpackPhase buildPhase; @@ -443,8 +448,8 @@ let ''; } // extraArgs); - # Builds a development shell - buildNodeShell = + # Builds a node environment (a node_modules folder and a set of binaries) + buildNodeDependencies = { name , packageName , version @@ -463,13 +468,13 @@ let let extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; - - nodeDependencies = stdenv.mkDerivation ({ + in + stdenv.mkDerivation ({ name = "node-dependencies-${name}-${version}"; buildInputs = [ tarWrapper python nodejs ] - ++ stdenv.lib.optional (stdenv.isLinux) utillinux - ++ stdenv.lib.optional (stdenv.isDarwin) libtool + ++ lib.optional (stdenv.isLinux) utillinux + ++ lib.optional (stdenv.isDarwin) libtool ++ buildInputs; inherit dontStrip; # Stripping may fail a build for some package deployments @@ -489,7 +494,7 @@ let # Create fake package.json to make the npm commands work properly cp ${src}/package.json . chmod 644 package.json - ${stdenv.lib.optionalString bypassCache '' + ${lib.optionalString bypassCache '' if [ -f ${src}/package-lock.json ] then cp ${src}/package-lock.json . @@ -498,23 +503,44 @@ let # Go to the parent folder to make sure that all packages are pinpointed cd .. - ${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} # Expose the executables that were installed cd .. - ${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} mv ${packageName} lib ln -s $out/lib/node_modules/.bin $out/bin ''; } // extraArgs); + + # Builds a development shell + buildNodeShell = + { name + , packageName + , version + , src + , dependencies ? [] + , buildInputs ? [] + , production ? true + , npmFlags ? "" + , dontNpmInstall ? false + , bypassCache ? false + , reconstructLock ? false + , dontStrip ? true + , unpackPhase ? "true" + , buildPhase ? "true" + , ... }@args: + + let + nodeDependencies = buildNodeDependencies args; in stdenv.mkDerivation { name = "node-shell-${name}-${version}"; - buildInputs = [ python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ buildInputs; + buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs; buildCommand = '' mkdir -p $out/bin cat > $out/bin/shell <>$out echo "#!/usr/bin/env bash" - >>$out echo - >>$out echo "echo installing dependencies..." - >>$out echo "${builtins.toString ( - builtins.map cpPackage (builtins.attrValues inputs))}" - >>$out echo "echo done." - chmod +x $out + installSpagoStyle = pkgs.writeShellScriptBin "install-spago-style" '' + set -e + echo installing dependencies... + ${builtins.toString (builtins.map cpPackage (builtins.attrValues inputs))} + echo "echo done." ''; - buildSpagoStyle = pkgs.runCommand "build-spago-style" {} '' - >>$out echo "#!/usr/bin/env bash" - >>$out echo - >>$out echo "echo building project..." - >>$out echo "purs compile ${builtins.toString ( - builtins.map getGlob (builtins.attrValues inputs))}" \"\$@\" - >>$out echo "echo done." - chmod +x $out + buildSpagoStyle = pkgs.writeShellScriptBin "build-spago-style" '' + set -e + echo building project... + purs compile ${builtins.toString (builtins.map getGlob (builtins.attrValues inputs))} "$@" + echo done. ''; - buildFromNixStore = pkgs.runCommand "build-from-store" {} '' - >>$out echo "#!/usr/bin/env bash" - >>$out echo - >>$out echo "echo building project using sources from nix store..." - >>$out echo "purs compile ${builtins.toString ( - builtins.map getStoreGlob (builtins.attrValues inputs))}" \"\$@\" - >>$out echo "echo done." - chmod +x $out + buildFromNixStore = pkgs.writeShellScriptBin "build-from-store" '' + set -e + echo building project using sources from nix store... + purs compile ${builtins.toString ( + builtins.map getStoreGlob (builtins.attrValues inputs))} "$@" + echo done. ''; mkBuildProjectOutput = diff --git a/webapp/spago.dhall b/webapp/spago.dhall index d1ce5dc..b425c73 100644 --- a/webapp/spago.dhall +++ b/webapp/spago.dhall @@ -1,22 +1,53 @@ { name = "zfs-snap-diff-webapp" , dependencies = - [ "affjax" - , "console" - , "debug" - , "effect" - , "formatters" - , "js-timers" - , "now" - , "numbers" - , "psci-support" - , "react-basic" - , "react-basic-textf" - , "simple-json" - , "stringutils" - , "test-unit" - , "unfoldable" - , "unordered-collections" - ] + [ "aff" + , "affjax" + , "arrays" + , "bifunctors" + , "console" + , "control" + , "datetime" + , "debug" + , "effect" + , "either" + , "enums" + , "exceptions" + , "foldable-traversable" + , "foreign" + , "foreign-object" + , "formatters" + , "free" + , "integers" + , "js-date" + , "js-timers" + , "lists" + , "maybe" + , "newtype" + , "now" + , "numbers" + , "partial" + , "prelude" + , "psci-support" + , "quickcheck" + , "react-basic" + , "react-basic-classic" + , "react-basic-dom" + , "react-basic-textf" + , "record" + , "refs" + , "simple-json" + , "strings" + , "stringutils" + , "test-unit" + , "transformers" + , "tuples" + , "unfoldable" + , "unordered-collections" + , "unsafe-coerce" + , "web-dom" + , "web-file" + , "web-html" + ] , packages = ./packages.dhall , sources = [ "src/**/*.purs", "test/**/*.purs" ] } diff --git a/webapp/src/ZSD/Components/ActionButton.purs b/webapp/src/ZSD/Components/ActionButton.purs index 49381f8..59f0d6f 100644 --- a/webapp/src/ZSD/Components/ActionButton.purs +++ b/webapp/src/ZSD/Components/ActionButton.purs @@ -4,7 +4,8 @@ module ZSD.Components.ActionButton where import Prelude import Effect (Effect) import Effect.Timer (setTimeout) -import React.Basic (Component, JSX, Self, createComponent, make) +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, make, Self) import React.Basic.DOM as R import React.Basic.DOM.Events (capture_) import Data.Monoid (guard) diff --git a/webapp/src/ZSD/Components/Confirm.purs b/webapp/src/ZSD/Components/Confirm.purs index 49abea5..7a6b81d 100644 --- a/webapp/src/ZSD/Components/Confirm.purs +++ b/webapp/src/ZSD/Components/Confirm.purs @@ -4,7 +4,8 @@ import Prelude import Data.Maybe (Maybe(..)) import Effect (Effect) -import React.Basic (Component, JSX, createComponent, fragment, makeStateless) +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, fragment, makeStateless) import React.Basic.DOM as R import React.Basic.DOM.Events (capture_, key) import React.Basic.Events (handler) diff --git a/webapp/src/ZSD/Components/DropDownButton.purs b/webapp/src/ZSD/Components/DropDownButton.purs index 452d591..208706c 100644 --- a/webapp/src/ZSD/Components/DropDownButton.purs +++ b/webapp/src/ZSD/Components/DropDownButton.purs @@ -5,7 +5,8 @@ import Data.Monoid (guard) import Data.Tuple (Tuple(..)) import Effect (Effect) import Foreign.Object as O -import React.Basic (Component, JSX, createComponent, makeStateless) +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, makeStateless) import React.Basic.DOM as R import React.Basic.DOM.Events (capture_) diff --git a/webapp/src/ZSD/Components/Navbar.purs b/webapp/src/ZSD/Components/Navbar.purs index 377400a..a7f4b64 100644 --- a/webapp/src/ZSD/Components/Navbar.purs +++ b/webapp/src/ZSD/Components/Navbar.purs @@ -6,7 +6,8 @@ import Data.Foldable (foldMap) import Data.Monoid (guard) import Data.Tuple (Tuple(..)) import Effect (Effect) -import React.Basic (Component, JSX, createComponent, make) +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, make) import React.Basic.DOM as R import React.Basic.DOM.Events (capture_) diff --git a/webapp/src/ZSD/Components/Panel.purs b/webapp/src/ZSD/Components/Panel.purs index 8242b0b..692a896 100644 --- a/webapp/src/ZSD/Components/Panel.purs +++ b/webapp/src/ZSD/Components/Panel.purs @@ -6,7 +6,8 @@ module ZSD.Components.Panel where import Prelude import Data.Monoid (guard) import Effect (Effect) -import React.Basic (Component, JSX, createComponent, make) +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, make) import React.Basic.DOM as R import React.Basic.DOM.Events (capture_) diff --git a/webapp/src/ZSD/Components/Spinner.purs b/webapp/src/ZSD/Components/Spinner.purs index 7c64da5..111e86c 100644 --- a/webapp/src/ZSD/Components/Spinner.purs +++ b/webapp/src/ZSD/Components/Spinner.purs @@ -12,7 +12,8 @@ import Effect.Ref as Ref import Effect.Timer (setInterval) import Effect.Unsafe (unsafePerformEffect) import Foreign.Object as O -import React.Basic (JSX, createComponent, fragment, make) +import React.Basic (JSX) +import React.Basic.Classic (createComponent, fragment, make) import React.Basic.DOM as R display :: Effect Unit diff --git a/webapp/src/ZSD/Components/Table.purs b/webapp/src/ZSD/Components/Table.purs index 320ae73..c2e0bf6 100644 --- a/webapp/src/ZSD/Components/Table.purs +++ b/webapp/src/ZSD/Components/Table.purs @@ -3,7 +3,8 @@ module ZSD.Components.Table where import Prelude import Data.Array as A import Effect (Effect) -import React.Basic (Component, JSX, createComponent, makeStateless) +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, makeStateless) import React.Basic.DOM as R import React.Basic.DOM.Events (capture_) diff --git a/webapp/src/ZSD/Components/TableX.purs b/webapp/src/ZSD/Components/TableX.purs index 49e2d68..23da588 100644 --- a/webapp/src/ZSD/Components/TableX.purs +++ b/webapp/src/ZSD/Components/TableX.purs @@ -6,7 +6,8 @@ import Data.Maybe (Maybe(..)) import Data.Monoid (guard) import Data.Tuple (Tuple(..)) import Effect (Effect) -import React.Basic (Component, JSX, createComponent, makeStateless) +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, makeStateless) import React.Basic.DOM as R import React.Basic.DOM.Events (capture_) import ZSD.Utils.Ops (zipWithIndex) diff --git a/webapp/src/ZSD/Fragments/CreateSnapshotModal.purs b/webapp/src/ZSD/Fragments/CreateSnapshotModal.purs index ab5db99..998ec8c 100644 --- a/webapp/src/ZSD/Fragments/CreateSnapshotModal.purs +++ b/webapp/src/ZSD/Fragments/CreateSnapshotModal.purs @@ -9,7 +9,8 @@ import Data.Monoid (guard) import Effect (Effect) import Effect.Aff (launchAff_) import Effect.Class (liftEffect) -import React.Basic (Component, JSX, Self, createComponent, make) +import React.Basic (JSX) +import React.Basic.Classic (Component, Self, createComponent, make) import React.Basic.DOM as R import ZSD.Components.Confirm as Confirm import ZSD.Components.Spinner as Spinner diff --git a/webapp/src/ZSD/Fragments/DatasetSelector.purs b/webapp/src/ZSD/Fragments/DatasetSelector.purs index f5f41db..da6a25b 100644 --- a/webapp/src/ZSD/Fragments/DatasetSelector.purs +++ b/webapp/src/ZSD/Fragments/DatasetSelector.purs @@ -6,7 +6,8 @@ import Data.Maybe (Maybe(..), isNothing, maybe) import Data.Newtype (unwrap) import Data.Tuple (Tuple(..)) import Effect (Effect) -import React.Basic (Component, JSX, createComponent, empty, fragment, make) +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, empty, fragment, make) import React.Basic.DOM as R import React.Basic.DOM.Events (capture_) import ZSD.Components.Panel (panel) diff --git a/webapp/src/ZSD/Fragments/DirBrowser.purs b/webapp/src/ZSD/Fragments/DirBrowser.purs index 50dbb2b..cfd703e 100644 --- a/webapp/src/ZSD/Fragments/DirBrowser.purs +++ b/webapp/src/ZSD/Fragments/DirBrowser.purs @@ -14,8 +14,9 @@ import Effect (Effect) import Effect.Aff (launchAff_) import Effect.Class (liftEffect) import Effect.Unsafe (unsafePerformEffect) -import React.Basic (Component, JSX, createComponent, make, fragment) -import React.Basic as React +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, make, fragment) +import React.Basic.Classic as React import React.Basic.DOM as R import React.Basic.DOM.Events (capture_) import Unsafe.Coerce (unsafeCoerce) @@ -74,7 +75,6 @@ update self = case _ of let fh = FH.fromMountPoint mp update self $ ReadDir fh - bms <- BM.get self.props.ds self.setState _ { breadcrumb = [ fh ], selectedFile = Nothing } PickFromBreadcrumb fh -> update self (ReadDir fh) @@ -130,7 +130,7 @@ update self = case _ of self.setState _ { dirListing = ls, currentDir = fh } *> rebuildBreadcrumb self fh *> Spinner.remove - Left err -> + Left _ -> ( Messages.error $ "Directory " <> (unwrap >>> _.name) fh diff --git a/webapp/src/ZSD/Fragments/FileActions.purs b/webapp/src/ZSD/Fragments/FileActions.purs index ee38aa3..56e66a2 100644 --- a/webapp/src/ZSD/Fragments/FileActions.purs +++ b/webapp/src/ZSD/Fragments/FileActions.purs @@ -10,8 +10,9 @@ import Data.String as S import Effect (Effect) import Effect.Aff (launchAff_) import Effect.Class (liftEffect) -import React.Basic (Component, JSX, createComponent, empty, make, readState) -import React.Basic as React +import React.Basic (JSX) +import React.Basic.Classic (Component,createComponent, empty, make, readState) +import React.Basic.Classic as React import React.Basic.DOM as R import React.Basic.DOM.Events (capture_) import Web.HTML (window) diff --git a/webapp/src/ZSD/Fragments/FileActions/ViewBlob.purs b/webapp/src/ZSD/Fragments/FileActions/ViewBlob.purs index aff1bb9..b087e21 100644 --- a/webapp/src/ZSD/Fragments/FileActions/ViewBlob.purs +++ b/webapp/src/ZSD/Fragments/FileActions/ViewBlob.purs @@ -2,7 +2,8 @@ module ZSD.Fragments.FileActions.ViewBlob where import Prelude import Effect.Unsafe (unsafePerformEffect) -import React.Basic (Component, JSX, createComponent, makeStateless) +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, makeStateless) import React.Basic.DOM as R import Web.File.Blob (Blob) import Web.File.Url as Url diff --git a/webapp/src/ZSD/Fragments/FileActions/ViewDiff.purs b/webapp/src/ZSD/Fragments/FileActions/ViewDiff.purs index 9c8ccd3..e3fd122 100644 --- a/webapp/src/ZSD/Fragments/FileActions/ViewDiff.purs +++ b/webapp/src/ZSD/Fragments/FileActions/ViewDiff.purs @@ -9,8 +9,9 @@ import Data.Tuple (Tuple(..)) import Effect (Effect) import Effect.Aff (launchAff_) import Effect.Class (liftEffect) -import React.Basic (Component, JSX, createComponent, fragment, make) -import React.Basic as React +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, fragment, make) +import React.Basic.Classic as React import React.Basic.DOM as R import React.Basic.DOM.Events (capture_) import ZSD.Components.ActionButton (actionButton) @@ -76,7 +77,7 @@ viewDiff = make component { initialState, render, didMount, didUpdate } didMount self = update self Diff - didUpdate self { prevState, prevProps } = guard (self.props.version /= prevProps.version) $ update self Diff + didUpdate self { prevState: _, prevProps } = guard (self.props.version /= prevProps.version) $ update self Diff render self = case self.props.version of CurrentVersion _ -> diff --git a/webapp/src/ZSD/Fragments/FileActions/ViewText.purs b/webapp/src/ZSD/Fragments/FileActions/ViewText.purs index d14af9b..65f0d31 100644 --- a/webapp/src/ZSD/Fragments/FileActions/ViewText.purs +++ b/webapp/src/ZSD/Fragments/FileActions/ViewText.purs @@ -2,7 +2,8 @@ module ZSD.Fragments.FileActions.ViewText where import Effect (Effect) import Prelude (Unit, unit) -import React.Basic (Component, JSX, createComponent, make) +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, make) import React.Basic.DOM as R type Props diff --git a/webapp/src/ZSD/Fragments/SnapshotNameForm.purs b/webapp/src/ZSD/Fragments/SnapshotNameForm.purs index 41515a5..cdc2d35 100644 --- a/webapp/src/ZSD/Fragments/SnapshotNameForm.purs +++ b/webapp/src/ZSD/Fragments/SnapshotNameForm.purs @@ -16,7 +16,8 @@ import Data.String as S import Data.Traversable (traverse) import Effect (Effect) import Effect.Now (nowDateTime) -import React.Basic (Component, JSX, Self, createComponent, make) +import React.Basic (JSX) +import React.Basic.Classic (Component, Self, createComponent, make) import React.Basic.DOM as R import React.Basic.DOM.Events (capture, capture_, key, targetValue) import React.Basic.Events (handler) diff --git a/webapp/src/ZSD/Model/Diff.purs b/webapp/src/ZSD/Model/Diff.purs index 609b528..3d0fc8d 100644 --- a/webapp/src/ZSD/Model/Diff.purs +++ b/webapp/src/ZSD/Model/Diff.purs @@ -4,7 +4,7 @@ import Prelude import Affjax.ResponseFormat as ARF import Data.Either (Either(..)) import Data.Generic.Rep (class Generic) -import Data.Generic.Rep.Show (genericShow) +import Data.Show.Generic (genericShow) import Data.Newtype (unwrap) import Effect.Aff (Aff) import Foreign (ForeignError(..)) diff --git a/webapp/src/ZSD/Model/FH.purs b/webapp/src/ZSD/Model/FH.purs index 39a0bd6..9f68ebe 100644 --- a/webapp/src/ZSD/Model/FH.purs +++ b/webapp/src/ZSD/Model/FH.purs @@ -5,7 +5,7 @@ import Affjax.ResponseFormat as ARF import Data.Either (Either) import Data.Foldable (foldMap) import Data.Generic.Rep (class Generic) -import Data.Generic.Rep.Show (genericShow) +import Data.Show.Generic (genericShow) import Data.Maybe (Maybe, maybe) import Data.Newtype (class Newtype, over, unwrap) import Data.String as S diff --git a/webapp/src/ZSD/Model/FileVersion.purs b/webapp/src/ZSD/Model/FileVersion.purs index 2f9e1d1..1b9a903 100644 --- a/webapp/src/ZSD/Model/FileVersion.purs +++ b/webapp/src/ZSD/Model/FileVersion.purs @@ -5,7 +5,7 @@ import Affjax.ResponseFormat as ARF import Control.Alt ((<|>)) import Data.Either (Either(..)) import Data.Generic.Rep (class Generic) -import Data.Generic.Rep.Show (genericShow) +import Data.Show.Generic (genericShow) import Data.Maybe (maybe) import Data.Newtype (class Newtype, unwrap) import Data.String as S diff --git a/webapp/src/ZSD/Model/Kind.purs b/webapp/src/ZSD/Model/Kind.purs index 26fc138..f9cb6ea 100644 --- a/webapp/src/ZSD/Model/Kind.purs +++ b/webapp/src/ZSD/Model/Kind.purs @@ -2,7 +2,7 @@ module ZSD.Model.Kind where import Prelude import Data.Generic.Rep (class Generic) -import Data.Generic.Rep.Show (genericShow) +import Data.Show.Generic (genericShow) import Foreign (ForeignError(..)) import Foreign as Foreign import Simple.JSON (class ReadForeign, class WriteForeign) diff --git a/webapp/src/ZSD/Utils/Formatter.purs b/webapp/src/ZSD/Utils/Formatter.purs index de66c7e..04bf993 100644 --- a/webapp/src/ZSD/Utils/Formatter.purs +++ b/webapp/src/ZSD/Utils/Formatter.purs @@ -4,13 +4,13 @@ module ZSD.Utils.Formatter where import Data.Array as A import Data.Date (Date) import Data.DateTime as DT -import Data.Either (fromRight) -import Data.Formatter.DateTime (format, parseFormatString) +import Data.Either (either) +import Data.Formatter.DateTime (formatDateTime) import Data.Maybe (Maybe(..)) import Data.Newtype (unwrap) import Data.Number.Format (fixed, toStringWith) -import Partial.Unsafe (unsafePartial) -import Prelude (bottom, otherwise, ($), (/), (<), (<<<), (<>), (>)) +import Partial.Unsafe (unsafeCrashWith) +import Prelude (bottom, identity, otherwise, ($), (/), (<), (<<<), (<>), (>)) import ZSD.Model.DateTime (DateTime) -- | formats the given `Number` as a filesize with a unit prefix @@ -27,14 +27,14 @@ filesize = go [ "B", "K", "M", "G", "T", "P" ] -- | formats the given `ZSD.Model.DateTime` as "dd MMM DD HH:mm YYYY" dateTime :: DateTime -> String -dateTime = format fmt <<< unwrap +dateTime = fmt <<< unwrap where - fmt = unsafePartial $ fromRight <<< parseFormatString $ "ddd MMM DD HH:mm YYYY" + fmt dt = either (\msg -> unsafeCrashWith "Invalid dateTime: " <> msg) identity $ formatDateTime "ddd MMM DD HH:mm YYYY" dt date :: Date -> String -date d = format fmt $ DT.DateTime d bottom +date d = fmt $ DT.DateTime d bottom where - fmt = unsafePartial $ fromRight <<< parseFormatString $ "DD MMM YYYY" + fmt dt = either (\msg -> unsafeCrashWith "Invalid date: " <> msg) identity $ formatDateTime "DD MMM YYYY" dt -- | formats a duration in nanos duration :: Number -> String diff --git a/webapp/src/ZSD/Utils/Ops.purs b/webapp/src/ZSD/Utils/Ops.purs index 079b1fc..d4aabe2 100644 --- a/webapp/src/ZSD/Utils/Ops.purs +++ b/webapp/src/ZSD/Utils/Ops.purs @@ -2,8 +2,8 @@ module ZSD.Utils.Ops where import Prelude + import Data.Array as A -import Data.Either (Either, fromRight) import Data.Foldable (class Foldable) import Data.Foldable as F import Data.Maybe (Maybe(..), fromJust, fromMaybe, maybe) @@ -36,9 +36,6 @@ foldrSemigroup = F.foldr (\a b -> maybe (Just a) (\b' -> Just $ a <> b') b) Noth unsafeFromJust :: forall a. Maybe a -> a unsafeFromJust a = unsafePartial $ fromJust a -unsafeFromRight :: forall a b. Either a b -> b -unsafeFromRight e = unsafePartial $ fromRight e - checkAll :: forall a f. F.Foldable f => f (a -> Boolean) -> a -> Boolean checkAll fs a = F.foldl (\b f -> f a && b) true fs diff --git a/webapp/src/ZSD/Views/BrowseFilesystem.purs b/webapp/src/ZSD/Views/BrowseFilesystem.purs index 473f50c..909e2e2 100644 --- a/webapp/src/ZSD/Views/BrowseFilesystem.purs +++ b/webapp/src/ZSD/Views/BrowseFilesystem.purs @@ -9,8 +9,9 @@ import Data.Tuple.Nested (tuple2, uncurry2) import Effect (Effect) import Effect.Aff (launchAff_) import Effect.Class (liftEffect) -import React.Basic (Component, JSX, createComponent, make) -import React.Basic as React +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, make) +import React.Basic.Classic as React import React.Basic.DOM as R import ZSD.Fragments.DatasetSelector (datasetSelector) import ZSD.Fragments.DirBrowser (dirBrowser) @@ -60,7 +61,7 @@ update self = case _ of { selectedFile = Just f , selectedVersion = Nothing } - DirSelected d -> + DirSelected _ -> self.setState _ { selectedFile = Nothing diff --git a/webapp/src/ZSD/Views/BrowseFilesystem/FileVersionSelector.purs b/webapp/src/ZSD/Views/BrowseFilesystem/FileVersionSelector.purs index 5ee28f1..997dac1 100644 --- a/webapp/src/ZSD/Views/BrowseFilesystem/FileVersionSelector.purs +++ b/webapp/src/ZSD/Views/BrowseFilesystem/FileVersionSelector.purs @@ -12,8 +12,9 @@ import Data.Tuple (Tuple(..)) import Effect (Effect) import Effect.Aff (launchAff_) import Effect.Class (liftEffect) -import React.Basic (Component, JSX, createComponent, fragment, make, readState) -import React.Basic as React +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, fragment, make, readState) +import React.Basic.Classic as React import React.Basic.DOM as R import React.Basic.DOM.Events (capture_) import ZSD.Components.DropDownButton (dropDownButton) diff --git a/webapp/src/ZSD/Views/BrowseFilesystem/Stats.purs b/webapp/src/ZSD/Views/BrowseFilesystem/Stats.purs index f4f315c..5d18f98 100644 --- a/webapp/src/ZSD/Views/BrowseFilesystem/Stats.purs +++ b/webapp/src/ZSD/Views/BrowseFilesystem/Stats.purs @@ -3,7 +3,8 @@ module ZSD.Views.BrowseFilesystem.Stats where import Prelude import Data.Array as A import Data.Traversable (foldMap) -import React.Basic (JSX, createComponent, makeStateless) +import React.Basic (JSX) +import React.Basic.Classic (createComponent, makeStateless) import React.Basic.DOM as R import React.Basic.DOM.Textf as TF import ZSD.Model.DateRange (DateRange(..)) diff --git a/webapp/src/ZSD/Views/BrowseSnapshots.purs b/webapp/src/ZSD/Views/BrowseSnapshots.purs index d96f535..c190b43 100644 --- a/webapp/src/ZSD/Views/BrowseSnapshots.purs +++ b/webapp/src/ZSD/Views/BrowseSnapshots.purs @@ -9,8 +9,9 @@ import Data.Tuple.Nested (tuple2, tuple3, uncurry2, uncurry3) import Effect (Effect) import Effect.Aff (launchAff_) import Effect.Class (liftEffect) -import React.Basic (Component, JSX, createComponent, make) -import React.Basic as React +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, make) +import React.Basic.Classic as React import React.Basic.DOM as R import ZSD.Fragments.DatasetSelector (datasetSelector) import ZSD.Fragments.DirBrowser (dirBrowser) diff --git a/webapp/src/ZSD/Views/BrowseSnapshots/CloneSnapshot.purs b/webapp/src/ZSD/Views/BrowseSnapshots/CloneSnapshot.purs index 178bc8b..6d94bf6 100644 --- a/webapp/src/ZSD/Views/BrowseSnapshots/CloneSnapshot.purs +++ b/webapp/src/ZSD/Views/BrowseSnapshots/CloneSnapshot.purs @@ -2,17 +2,19 @@ module ZSD.BrowseSnapshots.CloneSnapshot where import Prelude -import Data.Array (foldMap, (..)) +import Data.Array ((..)) import Data.Array as A import Data.Either (Either(..), either) import Data.Enum (toEnumWithDefaults) +import Data.Foldable (foldMap) import Data.Maybe (Maybe(..), fromMaybe, isJust) import Data.Monoid (guard) import Data.String as S import Effect (Effect) import Effect.Aff (launchAff_) import Effect.Class (liftEffect) -import React.Basic (Component, JSX, Self, createComponent, make) +import React.Basic (JSX) +import React.Basic.Classic (Component, Self, createComponent, make) import React.Basic.DOM as R import React.Basic.DOM.Events (capture, capture_, key, targetValue) import React.Basic.Events (handler) @@ -51,8 +53,7 @@ update self = case _ of either (\error -> self.setState _ { error = Just error, fsName = Nothing }) (\fsName -> self.setState _ { fsName = Just fsName, error = Nothing }) $ validateName name - CloneSnapshot -> - flip foldMap self.state.fsName \name -> + CloneSnapshot -> flip foldMap self.state.fsName \name -> Spinner.display *> launchAff_ do let fsName = self.state.base <> "/" <> name res <- Dataset.cloneSnapshot self.props.dataset self.props.snap self.state.flags fsName diff --git a/webapp/src/ZSD/Views/BrowseSnapshots/DestroySnapshot.purs b/webapp/src/ZSD/Views/BrowseSnapshots/DestroySnapshot.purs index 17e3b5d..a94c8e9 100644 --- a/webapp/src/ZSD/Views/BrowseSnapshots/DestroySnapshot.purs +++ b/webapp/src/ZSD/Views/BrowseSnapshots/DestroySnapshot.purs @@ -7,7 +7,8 @@ import Data.Either (either) import Effect (Effect) import Effect.Aff (launchAff_) import Effect.Class (liftEffect) -import React.Basic (Component, JSX, Self, createComponent, make) +import React.Basic (JSX) +import React.Basic.Classic (Component, Self, createComponent, make) import React.Basic.DOM as R import ZSD.Components.Confirm as Confirm import ZSD.Components.Spinner as Spinner diff --git a/webapp/src/ZSD/Views/BrowseSnapshots/RenameSnapshot.purs b/webapp/src/ZSD/Views/BrowseSnapshots/RenameSnapshot.purs index 4c52bc0..6903056 100644 --- a/webapp/src/ZSD/Views/BrowseSnapshots/RenameSnapshot.purs +++ b/webapp/src/ZSD/Views/BrowseSnapshots/RenameSnapshot.purs @@ -8,7 +8,8 @@ import Data.Maybe (Maybe(..)) import Effect (Effect) import Effect.Aff (launchAff_) import Effect.Class (liftEffect) -import React.Basic (Component, JSX, Self, createComponent, fragment, make) +import React.Basic (JSX) +import React.Basic.Classic (Component, Self, createComponent, fragment, make) import React.Basic.DOM as R import ZSD.Components.Confirm as Confirm import ZSD.Fragments.SnapshotNameForm as SnapshotNameForm diff --git a/webapp/src/ZSD/Views/BrowseSnapshots/RollbackSnapshot.purs b/webapp/src/ZSD/Views/BrowseSnapshots/RollbackSnapshot.purs index 84fabe4..fc52247 100644 --- a/webapp/src/ZSD/Views/BrowseSnapshots/RollbackSnapshot.purs +++ b/webapp/src/ZSD/Views/BrowseSnapshots/RollbackSnapshot.purs @@ -7,7 +7,8 @@ import Data.Either (either) import Effect (Effect) import Effect.Aff (launchAff_) import Effect.Class (liftEffect) -import React.Basic (Component, JSX, Self, createComponent, make) +import React.Basic (JSX) +import React.Basic.Classic (Component, Self, createComponent, make) import React.Basic.DOM as R import ZSD.Components.Confirm as Confirm import ZSD.Components.Spinner as Spinner diff --git a/webapp/src/ZSD/Views/BrowseSnapshots/SnapshotSelector.purs b/webapp/src/ZSD/Views/BrowseSnapshots/SnapshotSelector.purs index 36cb7f1..6f79737 100644 --- a/webapp/src/ZSD/Views/BrowseSnapshots/SnapshotSelector.purs +++ b/webapp/src/ZSD/Views/BrowseSnapshots/SnapshotSelector.purs @@ -13,8 +13,9 @@ import Effect (Effect) import Effect.Aff (launchAff_) import Effect.Class (liftEffect) import Foreign.Object as O -import React.Basic (Component, JSX, createComponent, empty, fragment, make) -import React.Basic as React +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, empty, fragment, make) +import React.Basic.Classic as React import React.Basic.DOM as R import React.Basic.DOM.Events (capture_) import ZSD.BrowseSnapshots.CloneSnapshot as CloneSnapshot @@ -120,7 +121,7 @@ snapshotSelector = make component { initialState, didMount, didUpdate, render } didMount self = update self FetchSnapshots - didUpdate self { prevProps, prevState } = guard (prevProps.dataset /= self.props.dataset) $ update self FetchSnapshots + didUpdate self { prevProps, prevState: _ } = guard (prevProps.dataset /= self.props.dataset) $ update self FetchSnapshots render self = fragment diff --git a/webapp/src/ZSD/Views/Messages.purs b/webapp/src/ZSD/Views/Messages.purs index 9058720..d45682d 100644 --- a/webapp/src/ZSD/Views/Messages.purs +++ b/webapp/src/ZSD/Views/Messages.purs @@ -18,7 +18,8 @@ import Effect.Now (nowDateTime) import Effect.Ref (Ref) import Effect.Ref as Ref import Effect.Unsafe (unsafePerformEffect) -import React.Basic (JSX, createComponent, make, readState) +import React.Basic (JSX) +import React.Basic.Classic (createComponent, make, readState) import React.Basic.DOM as R import React.Basic.DOM.Events (capture_) import ZSD.Components.Table (table) diff --git a/webapp/src/ZSD/WebApp.purs b/webapp/src/ZSD/WebApp.purs index 7a9c437..4c88e59 100644 --- a/webapp/src/ZSD/WebApp.purs +++ b/webapp/src/ZSD/WebApp.purs @@ -7,7 +7,8 @@ module ZSD.WebApp where import Data.Maybe (Maybe(..)) import Data.Tuple (Tuple(..)) import Prelude (($)) -import React.Basic (Component, JSX, createComponent, empty, fragment, make) +import React.Basic (JSX) +import React.Basic.Classic (Component, createComponent, empty, fragment, make) import ZSD.Components.Navbar (navbar) import ZSD.Components.Spinner as Spinner import ZSD.Model.Config (Config)