summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources/ui.js
AgeCommit message (Collapse)Author
2020-01-16luci-base: remove hardcoded cgi-bin pathAnsuel Smith
Currently LuCI can be loaded only when placed in the root of the server as the cgi-bin path are hardcoded. Change the index.html to load the cgi-bin path from the current level. Also add a new entry in the env Object to make the cgi_base path easily accessible. This variable will be based on the position of /cgi-bin/luci. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2019-12-30luci-base: ui.js: implement UIDropdown.{add,clear}Choices()Jo-Philipp Wich
The new `addChoices()` and `clearChoices()` functions allow clearing and adding new options to existing dropdown instances respectively. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-30luci-base: ui.js: expose UIElement class as AbstractElementJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16luci-base: ui.js: allow custom validation in Dropdown and DynamicListJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-04luci-base: ui.js: ensure that select choice labels are properly escapedJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-04luci-base: ui.js: properly escape dynlist items for renderingJo-Philipp Wich
Ref: https://forum.openwrt.org/t/luci-theme-openwrt-reports-error/49736 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-15luci-base: Improve change application messageKevin Darbyshire-Bryant
As a native English speaker the luci message displayed when clicking 'Save & Apply' has a somewhat uncomfortable English phrasing of "Waiting for configuration to get applied". It could be improved by replacing 'get' with 'be' but once you've got that far you might as well replace this with the shorter & simpler "Applying configuration changes". This is also technically more correct since luci/openwrt should only be updating/restarting processes that are related to the changed areas, not changing the entire configuration. As a result of that, change both the 'success' and 'rolled back' messages to "Configuration changes have been applied" & "Configuration changes have been rolled back" Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2019-11-10luci-base: ui.js: show filename after selecting upload fileJo-Philipp Wich
Fixes: #3286 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-10luci-base: ui.js: add ComboButton widgetJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01luci-base, luci-mod-system: move file upload handling to ui.jsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-22luci-base: ui.js: prevent race condition in tab initializationJo-Philipp Wich
Fixes: #3150 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-07luci-base: ui.js: add pingDevice() and awaitReconnect() functionsJo-Philipp Wich
Import these functions from the flash.js for use with other views that might trigger a device reboot. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-07luci-base: ui.js: use common fs.js class for filebrowser operationsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-19luci-base: ui.js: mark user-changed widgetsJo-Philipp Wich
Set a `data-changed=true` attribute on the widget element when the user did any change to the default value. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-18luci-base: ensure that button labels are properly html escapedJo-Philipp Wich
Fixes: #3067 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-11luci-base: ui.js: implement addNotification() helperJo-Philipp Wich
The L.ui.addNotification() function pushes a dismissable banner message to the top of the view. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10luci-base: use cgi-io and rpcd-mod-file to handle file upload and browsingJo-Philipp Wich
Remove the old server side support for file browsing and file uploading and switch to a client side widget instead which uses XMLHTTPRequests to upload files via cgi-io and RPC calls for file listing and status queries. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10luci-base: ui.js: update tabs after initial renderJo-Philipp Wich
This ensures that the error badges are properly set. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10luci-base: ui.js: also handle failed promises in createHandlerFn()Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10luci-base: ui.js: ignore description when checking for empty tab panesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-19luci-base: ui.js: implement Textarea widgetJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14luci-base: ui.js: add createHandlerFn() helperJo-Philipp Wich
The createHandlerFn() helper function is useful to construct onclick or similar event handling functions. It will add a "spinning" CSS class on the event target element and disable the element, wrap the given function with Promise.resolv() and re-enable the target element once the promise is settled. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14luci-base: ui.js: rework tab state handlingJo-Philipp Wich
Properly preserve the selection state of nested tabs. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14luci-base: ui.js: UISelect: fix check for empty choicesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14luci-base: ui.js: do not forcibly sort synamic list itemsJo-Philipp Wich
Ref: https://forum.openwrt.org/t/cannot-save-certain-fields/42738/2 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-01luci-base: ui.js: tabs: fix empty pane checking, allow alternative query rootJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-01luci-base: ui.js: mark widget optional if empty choice is presentJo-Philipp Wich
Fixes: #2943 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-30luci-base: ui.js: do not save invalid dynlist valuesJo-Philipp Wich
Fixes: 3880c3f22 ("luci-base: ui.js: save filled out but not added dynlist items on submit") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-30luci-base: ui.js: save filled out but not added dynlist items on submitJo-Philipp Wich
Fixes: #2938 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-27luci-base: don't treat .rmempty flag as optional for ListValue widgetsJo-Philipp Wich
Restore the old CBI behaviour of not automatically rendering empty selection choices in ListValue select dropdowns when .rmempty is specified. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-26luci-base: keep polling confirmation endpoint on XHR failuresJo-Philipp Wich
Fixes: #2912 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-26luci-base: ui.js: HTML escape uci changelog valuesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-26luci-base: ui.js: HTML escape custom dropdown valuesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-26luci-base: ui.js: fix event binding for UISelectJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-19luci-base: ui.js: fix multi vs. multiple keyword confusionJo-Philipp Wich
The "luci.form" and "luci.tools.widgets" classes use the "multiple" keyword while ui.js uses "multi" internally, leading to single-value dropdowns widget values getting stored as uci lists. Fix the issue by using "multiple" everywhere. Fixes: #2871 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-13luci-base: fix translatable text in ui.jsINAGAKI Hiroshi
Removed unnecessary symbols ("%>") at the end of the text. Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2019-07-12luci-base: ui.js: fix UISelect.setValue()Jo-Philipp Wich
Fixes: #2852 Fixes: ce04d7f ("luci-base: fix label-to-input association in js cbi maps") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-11luci-base: ui.js: fix UISelect.getValue()Jo-Philipp Wich
Fixes: #2852 Fixes: ce04d7f04 ("luci-base: fix label-to-input association in js cbi maps") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-09luci-base: fix label-to-input association in js cbi mapsJo-Philipp Wich
Fixes: #2845 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: {ui,form}.js: allow passing additional CSS classes to modalsJo-Philipp Wich
Add the ability to pass additional CSS classes to modal dialogs and make use of this facility in form.js to annotate CBI map modals. This can be used later by themes to apply additional CSS rules. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: ui.js: fix rendering of rich dropdown placeholdersJo-Philipp Wich
Placeholders may be HTML elements instead of plain strings, so do not use innerHTML to assign them but rely on L.dom.content() instead. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: split off CBI validations into separate classJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: ui.js: improve dropdown behaviourJo-Philipp Wich
- Do not artificially cutoff dropdown items, use all available space - Close open dropdown when clicking into the preview area Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: cbi.js, ui.js: add custom validation callbacks, new ui widgetsJo-Philipp Wich
Implement further widget primitives like text inputs or checkboxes and support custom validation callback functions when instantiating CBI validators. Also add support initializing ui.js widgets from the "data-ui-widget" HTML attribute. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: replace uci change pages with client side modal dialogJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: move dropdown, combox and dynlist widget code to L.uiJo-Philipp Wich
Move the widget code to the ui class and replace it with compatibility shims in cbi.js Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: luci.js: split ui helper functions into external ui.jsJo-Philipp Wich
Use the new class loader infrastructure to move gui specific functionality out of the luci.js core and dispatch a new event 'luci-loaded' which is fired once all external classes have been fetched. Signed-off-by: Jo-Philipp Wich <jo@mein.io>