Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
app-notes:dashboard [2023/10/31 15:07] – [Adding the SDK script] klueppelapp-notes:dashboard [2025/08/21 10:43] (current) – [Adding the SDK script] klueppel
Line 7: Line 7:
  
 {{ :app-notes:dashboard.png?800 |}} {{ :app-notes:dashboard.png?800 |}}
- 
 ===== Prerequierments ===== ===== Prerequierments =====
  
Line 70: Line 69:
         case "down":       return '<font color="red">down</font>';         case "down":       return '<font color="red">down</font>';
     }     }
- 
     return value;     return value;
 } }
Line 93: Line 91:
              nb_page_respond(page, '<tr>\n');              nb_page_respond(page, '<tr>\n');
              nb_page_respond(page, '<td>%s</td>', sprintf("%s", pp_var(substr(fields[i], 9))));              nb_page_respond(page, '<td>%s</td>', sprintf("%s", pp_var(substr(fields[i], 9))));
-         +             nb_page_respond(page, sprintf("<td align='right'>%s</td>", pp(struct_get(wan, fields[i])))); 
-             if(strstr(fields[i], "SIGNAL_LEVEL") > 0  && is_int(struct_get(wan, fields[i])) ) { +             nb_page_respond(page, '</tr>\n');
-                nb_page_respond(page, sprintf('<td align="right"><progress value="%s" max="100"> </progress></td>', struct_get(wan, fields[i]))); +
-                nb_page_respond(page, sprintf("<td align='right'>%s</td>", pp(struct_get(wan, fields[i])))); +
-             } else { +
-                nb_page_respond(page, sprintf("<td align='right'>%s</td>", pp(struct_get(wan, fields[i])))); +
-             } +
- +
-            nb_page_respond(page, '</tr>\n'); +
          }          }
  
Line 113: Line 103:
  
      /* register page */      /* register page */
-     page = nb_page_register(ID, "Interfaces", "Overview");+     page = nb_userpage_register(ID, "Wanlink", "Switch");
      if (is_void(page)) {      if (is_void(page)) {
          printf("unable to register page\n");          printf("unable to register page\n");
Line 128: Line 118:
            /* evaluate GET params */            /* evaluate GET params */
            GET = struct_get(request, "GET");            GET = struct_get(request, "GET");
-           printf("debug GET\n"); 
-           dump(GET); 
         }         }
         for (k = 0; k < length(GET); k++) {         for (k = 0; k < length(GET); k++) {
Line 143: Line 131:
         }         }
         if (hotlink != "") {         if (hotlink != "") {
-            printf("new hotlink is %s", hotlink); 
             nb_wanlink_priorize(hotlink, 2);             nb_wanlink_priorize(hotlink, 2);
             sleep(5);             sleep(5);
Line 175: Line 162:
                                     );                                     );
  
 +                wlan_array = mkarray(sprintf("%s_STATE", wan_idx), 
 +                                    sprintf("%s_TYPE", wan_idx), 
 +                                    sprintf("%s_NETWORK", wan_idx),
 +                                    sprintf("%s_SIGNAL_LEVEL", wan_idx), 
 +                                    sprintf("%s_SIGNAL_QUALITY", wan_idx) 
 +                                    );
  
                 type = struct_get(wan, sprintf("WANLINK%d_TYPE", i));                 type = struct_get(wan, sprintf("WANLINK%d_TYPE", i));
Line 181: Line 174:
                             break;                             break;
                     case "wwan": tmp_array = wan_array;                     case "wwan": tmp_array = wan_array;
 +                            break;
 +                    case "wlan": tmp_array = wlan_array;
                             break;                             break;
                 }                 }
Line 189: Line 184:
         nb_page_respond(page, '<table>\n');         nb_page_respond(page, '<table>\n');
         nb_page_respond(page, '<tr>\n');         nb_page_respond(page, '<tr>\n');
-        nb_page_respond(page, '<td>HOTLINK</td>');+        nb_page_respond(page, '<td>Hotlink</td>');
                  
         nb_page_respond(page, sprintf("<td align='right'>%s</td>", struct_get(wan, "WAN_HOTLINK")));         nb_page_respond(page, sprintf("<td align='right'>%s</td>", struct_get(wan, "WAN_HOTLINK")));
Line 196: Line 191:
  
         nb_page_respond(page, '<table>\n');         nb_page_respond(page, '<table>\n');
-        nb_page_respond(page,'<tr><td>REBOOT</td><td align="right">+        nb_page_respond(page,'<tr><td>Reebot</td><td align="right">
                              <form action="sdkPage.php" type="GET">                              <form action="sdkPage.php" type="GET">
                              <input type="hidden" id="id" name="id" value="00000001">                              <input type="hidden" id="id" name="id" value="00000001">
Line 243: Line 238:
 Navigate to HOME -> Overwiev -> Interfaces Navigate to HOME -> Overwiev -> Interfaces
  
 +{{ :app-notes:dashboard.png?800 |}}
  
  
 The page might look diffrent, depending on your number of wanlinks. The page might look diffrent, depending on your number of wanlinks.
  
-{{ :app-notes:dashboard.png?800 |}} 
  
  
 ==== Switch to another wanlink ==== ==== Switch to another wanlink ====
-Your current hotlink is displayed at the top. Also, each enabled wanlink will be listet on the new status page.+Your current hotlink is displayed at the top. Also, each enabled wanlink will be listed on the new status page.
 All links, except for the current hotlink, have a button "Use as hotlink". This can be used to change the current hotlink. All links, except for the current hotlink, have a button "Use as hotlink". This can be used to change the current hotlink.
 This may take some time, sometimes the hotlink will be shown as "n/a". Reload the page and the new hotlink will be displayed. This may take some time, sometimes the hotlink will be shown as "n/a". Reload the page and the new hotlink will be displayed.
Line 330: Line 325:
 </code> </code>
  
 +
 +Thats it. Enjoy your new status page.