Browse Source

Merge remote-tracking branch 'upstream/lcs2New'

Nikolay Suslov 5 years ago
parent
commit
d4a861e0d4
3 changed files with 158 additions and 161 deletions
  1. 12 156
      public/app.js
  2. 141 0
      public/lib/widgets.js
  3. 5 5
      public/vwf.js

+ 12 - 156
public/app.js

@@ -327,7 +327,7 @@ class App {
     el.setAttribute("id", "appGUI");
     document.body.appendChild(el);
 
-    _app.initReflectorGUI();
+    _cellWidgets.reflectorGUI();
 
   }
 
@@ -819,23 +819,18 @@ class App {
     console.log(loadObj);
 
     //temporary solution for syncing DB replicas using Gun.load()
-    _LCS_SYS_USER.get('proxy').load(res=>{
-      if (res) 
-      {console.log('proxy loaded');
-
-      _LCSDB.user(userPub).get('worlds').get(loadObj.path.public_path.slice(1)).load(w=>{
-        if (w) {
-          console.log('world files loaded');
-          vwf.ready( vwf.application, loadObj)
-        }
-      }, {wait: 200});
-
-      
-
-    }
-    }, {wait: 200});
+    // _LCS_SYS_USER.get('proxy').load(res=>{
+    //   if (res) 
+    //   {console.log('proxy loaded');
+    //   _LCSDB.user(userPub).get('worlds').get(loadObj.path.public_path.slice(1)).load(w=>{
+    //     if (w) {
+    //       console.log('world files loaded');
+    //       vwf.ready( vwf.application, loadObj)
+    //     }
+    //   }, {wait: 200});
+    // }
+    // }, {wait: 200});
 
-    
 
     return loadObj
 
@@ -1321,145 +1316,6 @@ class App {
   }
 
 
-  initReflectorGUI() {
-
-    let reflectorGUI =
-    {
-        $type: "div",
-        id: "reflectorGUI",
-        //style:"background-color: #efefef",
-        class: "mdc-layout-grid mdc-layout-grid--align-left",
-        _reflectorHost: null,
-        _dbHost: null,
-        _refHostField: null,
-        _dbHostField: null,
-        _initData: function () {
-            this._reflectorHost = '';
-            this._dbHost = '';
-
-            let config = JSON.parse(localStorage.getItem('lcs_config'));
-
-            if (config.reflector) {
-                this._reflectorHost = config.reflector
-            }
-            if (config.dbhost) {
-                this._dbHost =config.dbhost
-            }
-        },
-        $init: function () {
-            this._initData();
-        },
-        $update: function () {
-
-            this.$components = [
-                {
-                    $type: "div",
-                    class: "mdc-layout-grid__inner",
-                    $components: [
-                        {
-                            $type: "div",
-                            class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
-                            $components: [
-                            {
-                                $type: "h4",
-                                class: "mdc-typography--headline4",
-                                $text: "Connection settings"
-                            }
-                        ]
-                        },
-                        {
-                            $type: "div",
-                            class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
-                            $components: [
-                                {
-                                    $type: "span",
-                                    class: "mdc-typography--headline5",
-                                    $text: "Reflector: "
-                                },
-                                window._app.widgets.inputTextFieldOutlined({
-                                    "id": 'reflectorInput',
-                                    "label": "Reflector",
-                                    "value": this._reflectorHost,
-                                    "type": "text",
-                                    "init": function() {
-                                                this._refHostField = new mdc.textField.MDCTextField(this);
-                                            },
-                                    "style": 'width: 400px;'
-                                }),
-                            ]
-                        },
-                        {
-                            $type: "div",
-                            class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
-                            $components: [
-                                {
-                                    $type: "span",
-                                    class: "mdc-typography--headline5",
-                                    $text: "DB Host: "
-                                },
-                                window._app.widgets.inputTextFieldOutlined({
-                                    "id": 'dbhostInput',
-                                    "label": "DB Host",
-                                    "value": this._dbHost,
-                                    "type": "text",
-                                    "init": function() {
-                                        this._dbHostField = new mdc.textField.MDCTextField(this);
-                                    },
-                                    "style": 'width: 400px;'
-                                }),
-                            ]
-                        },
-                        {
-                            $type: "div",
-                            class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
-                            $components: [
-                                window._app.widgets.buttonRaised(
-                                    {
-                                        "label": 'Update',
-                                        "onclick": function (e) {
-                                            e.preventDefault();
-
-                                            let config = JSON.parse(localStorage.getItem('lcs_config'));
-
-                                            config.reflector = this._refHostField.value;
-                                            config.dbhost = this._dbHostField.value;
-
-                                            localStorage.setItem('lcs_config', JSON.stringify(config));
-                                            window.location.reload(true);
-                                        }
-                                    }),
-                                    {
-                                      $type: 'span',
-                                      $text: " "
-                                    },
-                                    {
-                                      $type: "button",
-                                      class: "mdc-button mdc-button--raised",
-                                      $text: "Close",
-                                      onclick: function (e) {
-                                          window.location.pathname = '/'
-                                      }
-                                    }
-                            ]
-                        }
-
-                    ]
-                }
-            ]
-        }
-
-    }
-
-    document.querySelector("#appGUI").$cell({
-        id: "appGUI",
-        $cell: true,
-        $type: "div",
-        $components: [reflectorGUI]
-    }
-    );
-
-}
-
 
 
 }

+ 141 - 0
public/lib/widgets.js

@@ -617,6 +617,147 @@
 
         }
 
+
+        reflectorGUI() {
+
+            let reflectorGUI =
+            {
+                $type: "div",
+                id: "reflectorGUI",
+                //style:"background-color: #efefef",
+                class: "mdc-layout-grid mdc-layout-grid--align-left",
+                _reflectorHost: null,
+                _dbHost: null,
+                _refHostField: null,
+                _dbHostField: null,
+                _initData: function () {
+                    this._reflectorHost = '';
+                    this._dbHost = '';
+        
+                    let config = JSON.parse(localStorage.getItem('lcs_config'));
+        
+                    if (config.reflector) {
+                        this._reflectorHost = config.reflector
+                    }
+                    if (config.dbhost) {
+                        this._dbHost =config.dbhost
+                    }
+                },
+                $init: function () {
+                    this._initData();
+                },
+                $update: function () {
+        
+                    this.$components = [
+                        {
+                            $type: "div",
+                            class: "mdc-layout-grid__inner",
+                            $components: [
+                                {
+                                    $type: "div",
+                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                    $components: [
+                                    {
+                                        $type: "h4",
+                                        class: "mdc-typography--headline4",
+                                        $text: "Connection settings"
+                                    }
+                                ]
+                                },
+                                {
+                                    $type: "div",
+                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                    $components: [
+                                        {
+                                            $type: "span",
+                                            class: "mdc-typography--headline5",
+                                            $text: "Reflector: "
+                                        },
+                                        window._app.widgets.inputTextFieldOutlined({
+                                            "id": 'reflectorInput',
+                                            "label": "Reflector",
+                                            "value": this._reflectorHost,
+                                            "type": "text",
+                                            "init": function() {
+                                                        this._refHostField = new mdc.textField.MDCTextField(this);
+                                                    },
+                                            "style": 'width: 400px;'
+                                        }),
+                                    ]
+                                },
+                                {
+                                    $type: "div",
+                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                    $components: [
+                                        {
+                                            $type: "span",
+                                            class: "mdc-typography--headline5",
+                                            $text: "DB Host: "
+                                        },
+                                        window._app.widgets.inputTextFieldOutlined({
+                                            "id": 'dbhostInput',
+                                            "label": "DB Host",
+                                            "value": this._dbHost,
+                                            "type": "text",
+                                            "init": function() {
+                                                this._dbHostField = new mdc.textField.MDCTextField(this);
+                                            },
+                                            "style": 'width: 400px;'
+                                        }),
+                                    ]
+                                },
+                                {
+                                    $type: "div",
+                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                    $components: [
+                                        window._app.widgets.buttonRaised(
+                                            {
+                                                "label": 'Update',
+                                                "onclick": function (e) {
+                                                    e.preventDefault();
+        
+                                                    let config = JSON.parse(localStorage.getItem('lcs_config'));
+        
+                                                    config.reflector = this._refHostField.value;
+                                                    config.dbhost = this._dbHostField.value;
+        
+                                                    localStorage.setItem('lcs_config', JSON.stringify(config));
+                                                    window.location.reload(true);
+                                                }
+                                            }),
+                                            {
+                                              $type: 'span',
+                                              $text: " "
+                                            },
+                                            {
+                                              $type: "button",
+                                              class: "mdc-button mdc-button--raised",
+                                              $text: "Close",
+                                              onclick: function (e) {
+                                                  window.location.pathname = '/'
+                                              }
+                                            }
+                                    ]
+                                }
+        
+                            ]
+                        }
+                    ]
+                }
+        
+            }
+        
+            document.querySelector("#appGUI").$cell({
+                id: "appGUI",
+                $cell: true,
+                $type: "div",
+                $components: [reflectorGUI]
+            }
+            );
+        
+        }
+
+
       }
 
    export { Widgets }

+ 5 - 5
public/vwf.js

@@ -812,9 +812,9 @@
                 callback(compatibilityStatus);
             }
 
-            await _app.getApplicationState();
-        //    await _app.getApplicationState()
-        //         .then(res => self.ready( application, res))
+            //await _app.getApplicationState();
+            await _app.getApplicationState()
+                .then(res => self.ready( application, res))
 
         };
 
@@ -4860,7 +4860,7 @@ if ( ! childComponent.source ) {
  
                      }
 
-                })
+                }, {wait: 200})
             }
 
         };
@@ -4912,7 +4912,7 @@ if ( ! childComponent.source ) {
                         errback_async( error );
                         queue.resume( "after loading " + scriptURI ); // resume the queue; may invoke dispatch(), so call last before returning to the host
                     }
-                })
+                }, {wait: 200})
             }
 
         };