FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
1,367 views 2 comments
by anonymous
Hi,
I'm wondering if it is possible to add (install) LUCI plugin (i mean add new element or tab to the current webUI) without the need to compile the entire image, just like creating and installing package?
by anonymous
To create and add a new tab element in a web UI, you can use HTML, CSS, and JavaScript. Here's an example of how to do it:

HTML:

<div class="tabs">

  <button class="tab-link" id="tab1">Tab 1</button>

  <button class="tab-link" id="tab2">Tab 2</button>

  <button class="tab-link" id="tab3">Tab 3</button>

  <div class="tab-content" id="content1">

    <p>Content for Tab 1</p>

  </div>

  <div class="tab-content" id="content2">

    <p>Content for Tab 2</p>

  </div>

  <div class="tab-content" id="content3">

    <p>Content for Tab 3</p>

  </div>

</div>

CSS:

.tabs {

  display: flex;

  flex-direction: row;

}

.tab-link {

  background-color: #ddd;

  color: black;

  padding: 14px 16px;

  border: none;

  outline: none;

  cursor: pointer;

  transition: 0.3s;

  font-size: 17px;

  width: 100px;

  text-align: center;

}

.tab-link:hover {

  background-color: #ccc;

}

.tab-content {

  display: none;

  padding: 6px 12px;

  border: 1px solid #ccc;

  border-top: none;

}

JavaScript:

var tabs = document.querySelectorAll(".tab-link");

for (var i = 0; i < tabs.length; i++) {

  tabs[i].addEventListener("click", function() {

    var current = document.getElementsByClassName("active");

    current[0].className = current[0].className.replace(" active", "");

    this.className += " active";

    

    var tabContent = document.getElementById(this.id + "-content");

    var tabContents = document.querySelectorAll(".tab-content");

    for (var j = 0; j < tabContents.length; j++) {

      tabContents[j].style.display = "none";

    }

    tabContent.style.display = "block";

  });

}

In this example, we have three buttons that act as tabs, and three content areas that will be shown or hidden based on which tab is selected. The CSS styles the appearance of the tabs and content, and the JavaScript code implements the functionality to show or hide the content when a tab is clicked.

Note: The above code is just a sample, you can modify it according to your requirements.

1 Answer

0 votes
by anonymous
Hi,

what do have in mind you want install service without LUCI and create it your self?
Regarding LUCI - it's possible because you can download additional services using "opkg" command and if that service is with LUCI you will see in WebUI additional tab.
Tell me more regarding challenge you are facing  

Regards
by anonymous

Thanks for the replay.
actually i found how to add tab to the current WebUI, it was kinda tricky (or confusing) for someone noob like me in LUCI and openwrt in general, all i had to do is just to create the LUCI CBI controller and the models files (.lua) and upload them to the correct path to teltonika, and because i'm already creating my package so i just had to add them to the install file and in the installation just copy them to the right folder (/usr/lib/lua/luci) via makefile and everything went good.

those links helped me a lot.
http://www.electronicsfaq.com/2018/01/adding-new-elements-to-openwrts-luci-on.html

https://oldwiki.archive.openwrt.org/doc/devel/luci
i'm posting this long comment so it may help someone else.
thankx