Skip to content

Commit

Permalink
Merge pull request #475 from jplomas/node-v12
Browse files Browse the repository at this point in the history
Inline form validations
  • Loading branch information
jplomas authored Mar 12, 2021
2 parents 218759f + 6cb9b0d commit d91b846
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 102 deletions.
187 changes: 87 additions & 100 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,117 +1,104 @@
version: 2
version: 2.1
orbs:
node: circleci/[email protected]
jobs:
build_wallet:
macos:
xcode: "12.2.0"

build:
executor:
name: node/default
tag: '12.14'
steps:
# Checkout repo
- checkout

# Save/Restore cache
#- save_cache:
# key: wallet_cache
# paths:
# - node_modules
# - ~/.npm
# - ~/.meteor

#- restore_cache:
# key: wallet_cache

# Install dependencies
- restore_cache:
key: build-temp-{{ checksum ".meteor/release" }}-{{ checksum ".circleci/config.yml" }}
- restore_cache:
key: meteor-release-{{ checksum ".meteor/release" }}-{{ checksum ".meteor/versions" }}-{{ checksum ".circleci/config.yml" }}
- restore_cache:
key: meteor-packages
- restore_cache:
key: npm-packages-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}-{{ checksum ".circleci/config.yml" }}
- run:
name: Install dependencies
name: restore cached meteor binary
command: |
npm install -g n
sudo n 8.11.4
brew update
brew cleanup
# brew cask install google-chrome
# brew cask install chromedriver
# Prepare app
if [ -e ~/build-temp/meteor-bin ]
then
echo "Cached Meteor bin found, restoring it."
sudo cp ~/build-temp/meteor-bin /usr/local/bin/meteor
else
echo "No cached Meteor bin found."
fi
- run:
name: Install meteor v1.8.0.2
name: install meteor
command: |
if [ -d ~/.meteor ]; then sudo ln -s ~/.meteor/meteor /usr/local/bin/meteor; fi
if [ ! -e $HOME/.meteor/meteor ]; then curl https://install.meteor.com/?release=1.8.0.2 | sh; fi
# - run:
# name: update npm to latest
# command: |
# npm i npm@latest -g
# only install meteor if bin isn't found
command -v meteor >/dev/null 2>&1 || curl https://install.meteor.com | /bin/sh
- run:
name: install snyk globally
name: check versions
command: |
npm i snyk -g && sudo chown -R $USER:$(id -gn $USER) /Users/distiller/.config
echo "Meteor version:"
# this forces Meteor to download whatever release your project is using
meteor --version
which meteor
echo "Meteor node version:"
meteor node -v
echo "Meteor npm version:"
meteor npm -v
- run:
name: install dependencies
name: copy meteor bin to build cache
command: |
rm package-lock.json && rm .electrify/package-lock.json && npm install
mkdir -p ~/build-temp
cp /usr/local/bin/meteor ~/build-temp/meteor-bin
- save_cache:
key: build-temp-{{ checksum ".meteor/release" }}-{{ checksum ".circleci/config.yml" }}
paths:
- ~/build-temp
- run:
name: install electrify-qrl globally
command: |
npm install -g electrify-qrl
name: install npm packages
command: meteor npm i
- save_cache:
key: npm-packages-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}-{{ checksum ".circleci/config.yml" }}
paths:
- ./node_modules/
- ~/.npm/
- run:
name: report meteor node version
command: |
meteor node -e 'console.log("I am Node.js %s!", process.version);'
name: run tests
command: meteor test
- save_cache:
key: meteor-release-{{ checksum ".meteor/release" }}-{{ checksum ".meteor/versions" }}-{{ checksum ".circleci/config.yml" }}
paths:
- ~/.meteor
- save_cache:
key: meteor-packages-{{ epoch }}
paths:
- .meteor/local

# Start meteor in background
#- run:
# name: Start Meteor
# command: |
# meteor npm install --unsafe-perm
# npm run dev
# background: true

# Run unit tests
#- run:
# name: Run selenium tests
# command: |
# until curl --max-time 300 http://localhost:3000/; do sleep 1; done
# #npm install -g chimp
# #npm install -g selenium-standalone
# #/usr/local/Cellar/node/8.7.0/bin/chimp --ddp=http://localhost:3000 --browser=chrome --path=tests
# version: 2
# machine:
# node:
# version: 0.10.43
# dependencies:
# override:
# - curl https://install.meteor.com | /bin/sh
# - npm install
# checkout:
# post:
# - git submodule update --init
# # Start meteor in background
# - run:
# name: Start Meteor
# command: |
# meteor npm install --unsafe-perm
# npm run dev
# background: true

# Create package on master
- deploy:
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
npm install -g electrify-qrl
npm install
export NODEPATH=/usr/local/Cellar/node/8.7.0
export PATH="$NODEPATH/bin:$PATH"
# Package Electron App
npm run cleanDist
npm run releaseready
npm run build
# Build Macos DMG
npm run installer
# Clear Electron build folder
rm -rf ./.electrify/.dist/QRLWallet-darwin-x64
fi
if [ "${CIRCLE_BRANCH}" == "devnet" ]; then
npm install -g electrify-qrl
npm install
export NODEPATH=/usr/local/Cellar/node/8.7.0
export PATH="$NODEPATH/bin:$PATH"
# Package Electron App
npm run cleanDist
npm run releaseready
npm run build
# Build Macos DMG
npm run installer
# Clear Electron build folder
rm -rf ./.electrify/.dist/QRLWallet-darwin-x64
fi
# Save artifacts
- store_artifacts:
path: .electrify/.dist/
destination: build
# # Test run
# - run:
# name: Ensure runs
# command: |
# until curl --max-time 300 http://localhost:3000/; do sleep 1; done

workflows:
version: 2
build_all:
jobs:
- build_wallet
# workflows:
# version: 2
# build_all:
# jobs:
# - build
23 changes: 21 additions & 2 deletions imports/ui/pages/transfer/transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,9 +863,13 @@ function initialiseFormValidation() {
validationRules['amounts' + id] = {
identifier: 'amounts_' + id,
rules: [
{
type: 'validFloat',
prompt: 'You must enter a valid amount to send',
},
{
type: 'empty',
prompt: 'You must enter an amount to send',
prompt: 'You must enter a valid amount to send',
},
{
type: 'number',
Expand Down Expand Up @@ -922,9 +926,22 @@ function initialiseFormValidation() {
],
}

// Valid float
$.fn.form.settings.rules.validFloat = function (value) {
// == is intended here
if (parseFloat(value) == value && parseFloat(value).toString().length === value.length) { // eslint-disable-line
return true
}
return false
}

// Max of 9 decimals
$.fn.form.settings.rules.maxDecimals = function (value) {
return countDecimals(value) <= 9
try {
return countDecimals(value) <= 9
} catch (e) {
return false
}
}

// Address Validation
Expand All @@ -942,6 +959,8 @@ function initialiseFormValidation() {
// Initialise the form validation
$('.ui.form').form({
fields: validationRules,
inline: true,
on: 'blur',
})
}

Expand Down

0 comments on commit d91b846

Please sign in to comment.