Commit 8421a112 authored by Joshua's avatar Joshua

Updated appcache file with proper filename of bundled react chart editor component

parent c0be6030
import json
doc = json.loads(context.getData())
AT_KEY_TO_CHANGE = 2
KEY_TO_CHANGE = 0
NEW_KEY_VAL = 1
LIST_OF_NESTED_KEYS = [
["layout", "title", "text"],
["layout", "xaxis", "title", "text"],
["layout", "yaxis", "title", "text"]
]
def nestedKeyExists (key_list, dictionary):
keyExists = False
currKey = key_list[0]
if type(dictionary) == dict:
if currKey in dictionary:
smaller_list = key_list[1:]
if len(smaller_list) == 0:
keyExists = True
else:
return nestedKeyExists(smaller_list, dictionary[currKey])
return keyExists
def changeKeysInDict(key_list, dictionary):
if len(key_list) == AT_KEY_TO_CHANGE:
dictionary[key_list[KEY_TO_CHANGE]] = dictionary[key_list[KEY_TO_CHANGE]][key_list[NEW_KEY_VAL]]
else:
return changeKeysInDict(key_list[1:], dictionary[key_list[0]])
for i in LIST_OF_NESTED_KEYS:
if nestedKeyExists(i, doc):
changeKeysInDict(i, doc)
doc['isPlotlyGraph'] = True;
return json.dumps(doc)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebChart_getData</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: here.getData()</string> </value> <value> <string>python: here.WebChart_getData()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -5,7 +5,7 @@ renderjs.js ...@@ -5,7 +5,7 @@ renderjs.js
rsvp.js rsvp.js
gadget_chart_editor.js gadget_chart_editor.js
static/css/main.88fa11bf.css static/css/main.88fa11bf.css
static/js/main.99e62089.js static/js/main.8b730bc1.js
NETWORK: NETWORK:
* *
\ No newline at end of file
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
<script src="rsvp.js" type="text/javascript"></script> <script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script> <script src="renderjs.js" type="text/javascript"></script>
<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script> <script src="https://unpkg.com/react@16.8.6/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script> <script src="https://unpkg.com/react-dom@16.8.6/umd/react-dom.development.js" crossorigin></script>
<script type="text/javascript" src="static/js/main.99e62089.js"></script> <script type="text/javascript" src="static/js/main.8b730bc1.js"></script>
<script src="gadget_chart_editor.js" type="text/javascript"></script> <script src="gadget_chart_editor.js" type="text/javascript"></script>
......
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
}) })
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
return this.changeState({ return this.changeState({
key: options.key, key: options.key,
value: options.value.value || "", value: options.value || "",
url: options.value.url || "",
editable: options.editable === undefined ? true : options.editable, editable: options.editable === undefined ? true : options.editable,
configuration: options.configuration, configuration: options.configuration,
configuration_mobile: options.configuration_mobile, configuration_mobile: options.configuration_mobile,
...@@ -60,14 +60,11 @@ ...@@ -60,14 +60,11 @@
modification_dict.hasOwnProperty('is_responsive') || modification_dict.hasOwnProperty('is_responsive') ||
modification_dict.hasOwnProperty('is_mobile') || modification_dict.hasOwnProperty('is_mobile') ||
modification_dict.hasOwnProperty('editable') || modification_dict.hasOwnProperty('editable') ||
modification_dict.hasOwnProperty('url')) { modification_dict.hasOwnProperty('value')) {
// Expected configuration changed. // Expected configuration changed.
if ("value" in modification_dict && modification_dict.value != ""){ if ("value" in modification_dict && modification_dict.value != ""){
props = {...props, ...JSON.parse(modification_dict.value)}; props = {...props, ...JSON.parse(modification_dict.value)};
} }
if ("url" in modification_dict){
props = {...props, ...{url: modification_dict.url}};
}
ReactDOM.unmountComponentAtNode(container); ReactDOM.unmountComponentAtNode(container);
gadget.state.component = ReactDOM.render(React.createElement(EntryPoint.default.App, props, null), container); gadget.state.component = ReactDOM.render(React.createElement(EntryPoint.default.App, props, null), container);
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
<value> <string>main.99e62089.js.map</string> </value> <value> <string>main.8b730bc1.js.map</string> </value>
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>main.99e62089.js.map</string> </value> <value> <string>main.8b730bc1.js.map</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
<value> <string>main.99e62089.js</string> </value> <value> <string>main.8b730bc1.js</string> </value>
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>main.99e62089.js</string> </value> <value> <string>main.8b730bc1.js</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
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