From b19effd58f4e21d42169c0358416a6bad8afde7c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 8 May 2019 18:51:52 +0200 Subject: [PATCH] Preparing to Save the strategy --- FloatingSpace/StrategyPart.js | 35 +++++++++-- StrategySpace/ConstDeleteStrategy.js | 0 StrategySpace/ConstGetStrategies.js | 85 +++++++++++++++++++++++++++ StrategySpace/ConstNewStrategy.js | 0 StrategySpace/ConstUpdateStrategy.js | 0 StrategySpace/Strategy.js | 8 +++ StrategySpace/StrategyCollection.js | 88 +--------------------------- 7 files changed, 123 insertions(+), 93 deletions(-) create mode 100644 StrategySpace/ConstDeleteStrategy.js create mode 100644 StrategySpace/ConstGetStrategies.js create mode 100644 StrategySpace/ConstNewStrategy.js create mode 100644 StrategySpace/ConstUpdateStrategy.js diff --git a/FloatingSpace/StrategyPart.js b/FloatingSpace/StrategyPart.js index 7642c3a7f..0eeb1ed7e 100644 --- a/FloatingSpace/StrategyPart.js +++ b/FloatingSpace/StrategyPart.js @@ -72,16 +72,28 @@ function newStrategyPart () { imagePath = 'Images/icons/style-01/quality.png' menuItemsInitialValues = [ { - action: 'Open Settings', + action: 'Reload Strategy', actionFunction: thisObject.payload.onMenuItemClick, - label: 'Settings', + label: 'Reload Last Saved', visible: false, - imagePathOn: 'Images/icons/style-01/tools.png', + imagePathOn: 'Images/icons/style-01/pixel.png', imagePathOff: 'Images/icons/style-01/target.png', rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: 20 + angle: -60 + }, + { + action: 'Save Strategy', + actionFunction: thisObject.payload.onMenuItemClick, + label: 'Save Changes', + visible: false, + imagePathOn: 'Images/icons/style-01/upload.png', + imagePathOff: 'Images/icons/style-01/target.png', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: -20 }, { action: 'Delete Strategy', @@ -93,7 +105,19 @@ function newStrategyPart () { rawRadius: 8, targetRadius: 0, currentRadius: 0, - angle: -20 + angle: 20 + }, + { + action: 'Open Settings', + actionFunction: thisObject.payload.onMenuItemClick, + label: 'Settings', + visible: false, + imagePathOn: 'Images/icons/style-01/tools.png', + imagePathOff: 'Images/icons/style-01/target.png', + rawRadius: 8, + targetRadius: 0, + currentRadius: 0, + angle: 60 }] break } @@ -582,4 +606,3 @@ function newStrategyPart () { } } } - diff --git a/StrategySpace/ConstDeleteStrategy.js b/StrategySpace/ConstDeleteStrategy.js new file mode 100644 index 000000000..e69de29bb diff --git a/StrategySpace/ConstGetStrategies.js b/StrategySpace/ConstGetStrategies.js new file mode 100644 index 000000000..46acca721 --- /dev/null +++ b/StrategySpace/ConstGetStrategies.js @@ -0,0 +1,85 @@ +const GRAPHQL_QUERY_GET_STRATEGIES = Apollo.gql` + query($fbSlug: String!){ + + strategizer_StrategyByFb(fbSlug: $fbSlug){ + subStrategies(activeOnly: true){ + name + entryPoint{ + situations{ + name + conditions{ + name + code + } + } + } + exitPoint{ + situations{ + name + conditions{ + name + code + } + } + } + sellPoint{ + situations{ + name + conditions{ + name + code + } + } + } + buyPoint{ + situations{ + name + conditions{ + name + code + } + } + } + stopLoss{ + phases{ + name + code + situations{ + name + conditions{ + name + code + } + } + } + } + buyOrder{ + phases{ + name + code + situations{ + name + conditions{ + name + code + } + } + } + } + sellOrder{ + phases{ + name + code + situations{ + name + conditions{ + name + code + } + } + } + } + } + } + } + ` diff --git a/StrategySpace/ConstNewStrategy.js b/StrategySpace/ConstNewStrategy.js new file mode 100644 index 000000000..e69de29bb diff --git a/StrategySpace/ConstUpdateStrategy.js b/StrategySpace/ConstUpdateStrategy.js new file mode 100644 index 000000000..e69de29bb diff --git a/StrategySpace/Strategy.js b/StrategySpace/Strategy.js index 14c9efb9c..af427bb89 100644 --- a/StrategySpace/Strategy.js +++ b/StrategySpace/Strategy.js @@ -241,6 +241,14 @@ function newStrategy () { break + case 'Reload Strategy': + + break + + case 'Save Strategy': + + break + case 'Edit Code': break diff --git a/StrategySpace/StrategyCollection.js b/StrategySpace/StrategyCollection.js index 0713e7918..c5f9075c6 100644 --- a/StrategySpace/StrategyCollection.js +++ b/StrategySpace/StrategyCollection.js @@ -85,96 +85,10 @@ function newStrategyCollection () { } }]) - const QUERY = Apollo.gql` - query($fbSlug: String!){ - - strategizer_StrategyByFb(fbSlug: $fbSlug){ - subStrategies(activeOnly: true){ - name - entryPoint{ - situations{ - name - conditions{ - name - code - } - } - } - exitPoint{ - situations{ - name - conditions{ - name - code - } - } - } - sellPoint{ - situations{ - name - conditions{ - name - code - } - } - } - buyPoint{ - situations{ - name - conditions{ - name - code - } - } - } - stopLoss{ - phases{ - name - code - situations{ - name - conditions{ - name - code - } - } - } - } - buyOrder{ - phases{ - name - code - situations{ - name - conditions{ - name - code - } - } - } - } - sellOrder{ - phases{ - name - code - situations{ - name - conditions{ - name - code - } - } - } - } - } - } - } - ` - const getStrategies = () => { return new Promise((resolve, reject) => { apolloClient.query({ - query: QUERY, + query: GRAPHQL_QUERY_GET_STRATEGIES, variables: { fbSlug: strategySimulationClone} }) .then(response => {