20190130_jeffrey - silenceuncrio/diary GitHub Wiki

0900

明後天要去幫小女兒報戶口

原以為戶口名簿還放在公司

老婆說在家裡小房間

今天回家找找看

0940

剛剛為了 M330 開了一下會

  • jffs2 可以用
  • squash 遇到 bad block 不能用
  • M330 的 uboot 是 qca 特別版
  • qca uboot 沒有對 bad block 做標記
  • 想改成 ubifs

目前我還沒有使力點

今天還是再重構一下 M300-wizard

0950

昨天提到以下這 5 個值如果能整成同一個的話 那 view 層取用會更方便

  • vm.step_2_1_syncing_chg_wproto
  • vm.step_2_1_syncing_pppoe
  • vm.step_2_1_syncing_dns_dhcpc
  • vm.step_2_1_syncing_wanst
  • vm.step_2_1_syncing_dns_static

作以下修改

diff --git a/proscend/prosrc/www/app/feature/wizard.html b/proscend/prosrc/www/app/feature/wizard.html
index a466e0f..78b06d8 100644
--- a/proscend/prosrc/www/app/feature/wizard.html
+++ b/proscend/prosrc/www/app/feature/wizard.html
@@ -182,23 +182,13 @@



-<section ng-show="vm.step === 'step_2_1' && (
-  vm.step_2_1_syncing_chg_wproto ||
-  vm.step_2_1_syncing_pppoe ||
-  vm.step_2_1_syncing_dns_dhcpc ||
-  vm.step_2_1_syncing_wanst ||
-  vm.step_2_1_syncing_dns_static )">
+<section ng-show="vm.step === 'step_2_1' && vm.step_2_1_syncing">^M
   <i class="fa fa-spinner fa-pulse"></i>
 </section>



-<section ng-show="vm.step === 'step_2_1' &&
-  !vm.step_2_1_syncing_chg_wproto &&
-  !vm.step_2_1_syncing_pppoe &&
-  !vm.step_2_1_syncing_dns_dhcpc &&
-  !vm.step_2_1_syncing_wanst &&
-  !vm.step_2_1_syncing_dns_static">
+<section ng-show="vm.step === 'step_2_1' && !vm.step_2_1_syncing">^M

   <h2>Step 2.1. WAN Setting - Ethernet</h2>

diff --git a/proscend/prosrc/www/app/feature/wizard.js b/proscend/prosrc/www/app/feature/wizard.js
index 45ec9b2..0acac72 100644
--- a/proscend/prosrc/www/app/feature/wizard.js
+++ b/proscend/prosrc/www/app/feature/wizard.js
@@ -102,6 +102,8 @@



+    vm.step_2_1_syncing = false;^M
+^M
     vm.step_2_1_syncing_chg_wproto = false;
     vm.step_2_1_syncing_pppoe = false;
     vm.step_2_1_syncing_dns_dhcpc = false;
@@ -109,7 +111,22 @@
     vm.step_2_1_syncing_dns_static = false;


+    vm.step_2_1_syncing_update = function() {^M
+      if (^M
+        vm.step_2_1_syncing_chg_wproto ||^M
+        vm.step_2_1_syncing_pppoe ||^M
+        vm.step_2_1_syncing_dns_dhcpc ||^M
+        vm.step_2_1_syncing_wanst ||^M
+        vm.step_2_1_syncing_dns_static ) {^M
+          vm.step_2_1_syncing = true;^M
+      } else {^M
+          vm.step_2_1_syncing = false;^M
+      }^M
+    }^M
+^M
+^M
     vm.step_2_1_sync_chg_wproto = function() {
+      vm.step_2_1_syncing = true;^M
       vm.step_2_1_syncing_chg_wproto = true;
       icos.connmgr.chg_wproto_config().then(function(result) {
         vm.chg_wproto = result.data.config;
@@ -122,44 +139,53 @@
           vm.shm.wan_protocol = 'pppoe';
         }
         vm.step_2_1_syncing_chg_wproto = false;
+        vm.step_2_1_syncing_update();^M
       });

     }


     vm.step_2_1_sync_pppoe = function() {
+      vm.step_2_1_syncing = true;^M
       vm.step_2_1_syncing_pppoe = true;
       icos.pppoe.config().then(function(result) {
         vm.pppoe = result.data.config;
         vm.step_2_1_syncing_pppoe = false;
+        vm.step_2_1_syncing_update();^M
       });
     }


     vm.step_2_1_sync_dns_dhcpc = function() {
+      vm.step_2_1_syncing = true;^M
       vm.step_2_1_syncing_dns_dhcpc = true;
       icos.dns_dhcpc.config().then(function(result) {
         vm.dns_dhcpc = result.data.config;
         vm.step_2_1_syncing_dns_dhcpc = false;
+        vm.step_2_1_syncing_update();^M
       });

     }


     vm.step_2_1_sync_wanst = function() {
+      vm.step_2_1_syncing = true;^M
       vm.step_2_1_syncing_wanst = true;
       icos.wanst.config().then(function(result) {
         vm.wanst = result.data.config;
         vm.step_2_1_syncing_wanst = false;
+        vm.step_2_1_syncing_update();^M
       });
     }


     vm.step_2_1_sync_dns_static = function() {
+      vm.step_2_1_syncing = true;^M
       vm.step_2_1_syncing_dns_static = true;
       icos.dns_static.config().then(function(result) {
         vm.dns_static = result.data.config;
         vm.step_2_1_syncing_dns_static = false;
+        vm.step_2_1_syncing_update();^M
       });
     };

測試 PASS

上 code

commit 5cf5d144003c5f086578d484d769e7b21afb14b0
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Jan 30 10:12:40 2019 +0800

    refactoring

 proscend/prosrc/www/app/feature/wizard.html | 14 ++------------
 proscend/prosrc/www/app/feature/wizard.js   | 26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 12 deletions(-)

再從 wizard.html 的角度盤一次 API

  • vm.step
    • 紀錄現在 wizard 進行到哪個 step 了
  • vm.step_skip()
    • 放棄 wizard 並回到 status
  • vm.step_1_init()
    • 準備顯示 step 1 給使用者前的前置作業
  • vm.step_2_init()
    • 準備顯示 step 2 給使用者前的前置作業
  • vm.step_2_reset()
    • 重新跟 device 要目前 step 2 的設定
  • vm.step_2_syncing
    • 目前是否還在跟 device 要目前 step 2 的設定
  • vm.step_2_1_init()
    • 準備顯示 step 2.1 給使用者前的前置作業
  • vm.step_2_1_reset()
    • 重新跟 device 要目前 step 2.1 的設定
  • vm.step_2_1_syncing
    • 目前是否還在跟 device 要目前 step 2 的設定
  • vm.step_2_2_init()
    • 準備顯示 step 2.2 給使用者前的前置作業
  • vm.step_2_2_reset()
    • 重新跟 device 要目前 step 2.2 的設定
  • vm.step_2_2_syncing
    • 目前是否還在跟 device 要目前 step 2.2 - chg_wproto 的設定
  • vm.step_3_init()
    • 準備顯示 step 3 給使用者前的前置作業
  • vm.step_3_reset()
    • 重新跟 device 要目前 step 3 的設定
  • vm.step_3_syncing
    • 目前是否還在跟 device 要目前 step 3 的設定
  • vm.step_4_init()
    • 準備顯示 step 4 給使用者前的前置作業
  • vm.step_4_reset()
    • 重新跟 device 要目前 step 4 的設定
  • vm.step_4_syncing
    • 目前是否還在跟 device 要目前 step 4 的設定
  • vm.step_5_init()
    • 準備顯示 step 5 給使用者前的前置作業
  • vm.step_5_reset()
    • 重新跟 device 要目前 step 5 的設定
  • vm.step_5_syncing
    • 目前是否還在跟 device 要目前 step 5 的設定
  • vm.step_review()
    • 準備顯示 review 給使用者前的前置作業
  • vm.step_apply()
    • 觸發 apply 的動作

針對名字來重構一下

  • vm.current_stepvm.step
    • 紀錄現在 wizard 進行到哪個 step 了
  • vm.cancel_wizard()vm.step_skip()
    • 放棄 wizard 並回到 status
  • vm.step_1.show()vm.step_1_init()
    • 準備顯示 step 1 給使用者前的前置作業
  • vm.step_2.show()vm.step_2_init()
    • 準備顯示 step 2 給使用者前的前置作業
  • vm.step_2.reset()vm.step_2_reset()
    • 重新跟 device 要目前 step 2 的設定
  • vm.step_2.is_updatingvm.step_2_syncing
    • 目前是否還在跟 device 要目前 step 2 的設定
  • vm.step_2_1.show()vm.step_2_1_init()
    • 準備顯示 step 2.1 給使用者前的前置作業
  • vm.step_2_1.reset()vm.step_2_1_reset()
    • 重新跟 device 要目前 step 2.1 的設定
  • vm.step_2_1.is_updatingvm.step_2_1_syncing
    • 目前是否還在跟 device 要目前 step 2 的設定
  • vm.step_2_2.show()vm.step_2_2_init()
    • 準備顯示 step 2.2 給使用者前的前置作業
  • vm.step_2_2.reset()vm.step_2_2_reset()
    • 重新跟 device 要目前 step 2.2 的設定
  • vm.step_2_2.is_updatingvm.step_2_2_syncing
    • 目前是否還在跟 device 要目前 step 2.2 - chg_wproto 的設定
  • vm.step_3.show()vm.step_3_init()
    • 準備顯示 step 3 給使用者前的前置作業
  • vm.step_3.reset()vm.step_3_reset()
    • 重新跟 device 要目前 step 3 的設定
  • vm.step_3.is_syncingvm.step_3_syncing
    • 目前是否還在跟 device 要目前 step 3 的設定
  • vm.step_4.show()vm.step_4_init()
    • 準備顯示 step 4 給使用者前的前置作業
  • vm.step_4.reset()vm.step_4_reset()
    • 重新跟 device 要目前 step 4 的設定
  • vm.step_4.is_updatingvm.step_4_syncing
    • 目前是否還在跟 device 要目前 step 4 的設定
  • vm.step_5.show()vm.step_5_init()
    • 準備顯示 step 5 給使用者前的前置作業
  • vm.step_5.reset()vm.step_5_reset()
    • 重新跟 device 要目前 step 5 的設定
  • vm.step_5.is_updatingvm.step_5_syncing
    • 目前是否還在跟 device 要目前 step 5 的設定
  • vm.review.show()vm.step_review()
    • 準備顯示 review 給使用者前的前置作業
  • vm.apply()vm.step_apply()
    • 觸發 apply 的動作

1315

重構完成

commit 399b5669525c340ef535fa5304821646f29d12ae
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Jan 30 13:16:42 2019 +0800

    refactoring

 proscend/prosrc/www/app/feature/wizard.html | 149 ++++---
 proscend/prosrc/www/app/feature/wizard.js   | 584 ++++++++++++++--------------
 2 files changed, 368 insertions(+), 365 deletions(-)

繼續整理 apply 的部分

1415

commit c33c20c84891bcbea793261a62163a9a2fd3aa86
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Jan 30 14:14:39 2019 +0800

    refactoring

 proscend/prosrc/www/app/feature/wizard.html |  82 ++--
 proscend/prosrc/www/app/feature/wizard.js   | 629 ++++++++++++----------------
 2 files changed, 315 insertions(+), 396 deletions(-)

1420

幫 wizard 在 iweb 註冊一下

diff --git a/proscend/prosrc/icos/iweb/iweb.c b/proscend/prosrc/icos/iweb/iweb.c
index 72d7beb..55c4bdd 100644
--- a/proscend/prosrc/icos/iweb/iweb.c
+++ b/proscend/prosrc/icos/iweb/iweb.c
@@ -1509,6 +1509,11 @@ static void _register_http_endpoint(struct mg_connection *nc)



+    // Wizard
+    mg_register_http_endpoint(nc, "/app/feature/wizard.html",   _handler_level_admin);
+
+
+
 }
commit 720abd79d1280d8834c5094641f379149b0e661e
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Jan 30 14:21:31 2019 +0800

    register the wizard endpoint

 proscend/prosrc/icos/iweb/iweb.c | 5 +++++
 1 file changed, 5 insertions(+)

重 build 個 image 試試

1425

盤一下這禮拜的工作狀態方便寫週報

  • M330
    • web server and GUI
    • GRE
    • PPTP
    • RIP 1/2
    • OSPF
    • BGP
  • M300
    • wizard
      • 已完成
    • MFG tool with UBI
      • 已完成
      • wiki 也完成
    • Cisco DMVPN
      • 取消 priority = 3

1530

commit 20c259747cc96fef8f611a8fd3d4d1a60db4e11a
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Jan 30 15:29:08 2019 +0800

    use cgi to register

 proscend/prosrc/icos/iweb/iweb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

1550

也 build 個非 wifi 的版本試試 wizard

變快許多的 mfgtool 用起來真舒服

1625

非 wifi 的 model 在 wizard 的 review 時顯示出 wifi 的部分

修正並驗證完畢

commit 89157abcad03d990b8982abdd4382c700c49d617
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Jan 30 16:24:42 2019 +0800

    hide 'wifi' part at non wifi model

 proscend/prosrc/www/app/feature/wizard.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
⚠️ **GitHub.com Fallback** ⚠️