summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorAustin S. Hemmelgarn <austin@netdata.cloud>2020-03-31 06:53:48 -0400
committerGitHub <noreply@github.com>2020-03-31 06:53:48 -0400
commitcf948d42c22093db5d5085b3b453f7bcc2d52ae3 (patch)
treeca8dc8cfb31733aae499871f150760ca5db60690 /web
parent457bed556e87e9d92926b914dcea16fd3e11d053 (diff)
Switched to the new React dashboard code as the default dashboard. (#8363)
* Initial installer components for new dashboard. * Add script to switch between react and classic dashboards. * Update to newest version of react dashboard. * Properly substitute webdir. * Fix installation of dashboard switch script. * Properly handle file ownership and permissions. * Fix install of react dashboard. * Add dashboard_info.js to the react dashboard tree. * Update to version 0.3.2 of the React dashboard. * Switch using file lists instead of nuking old directory. * Properly handle updates. * Fix variable naming in switching script. * Fix copying of files in switching script. * Fix switching script invocation in installer. * update dashboard to v0.4.0 * v0.4.1 gauge & easypiechart width update proper centering when clicking alarm in alarms-log keep loader until react app is ready fix top bar not showing when highlighting (few lines of code) "check known URLs" issue "reset" options is not hooked up go to host node from streamed node (low priority, because that's removed on release) * Persist user selection of dashboard across updates. * update dashboard to v0.4.2 (temperature, units options fixed) * v0.4.5 fixed print modal progress text force reload on sync-selection option change * fix memory leak on firefox * fix active-alarms number in main.js header fix "back to normal" notifications constantly throwing in loop * fix active-alarms fetching * support subpaths Co-authored-by: Jacek Kolasa <jacek.kolasa@gmail.com>
Diffstat (limited to 'web')
-rw-r--r--web/Makefile.am13
-rw-r--r--web/netdata-switch-dashboard.sh.in60
2 files changed, 73 insertions, 0 deletions
diff --git a/web/Makefile.am b/web/Makefile.am
index ccaccd764c..0c8b0332c3 100644
--- a/web/Makefile.am
+++ b/web/Makefile.am
@@ -9,8 +9,20 @@ SUBDIRS = \
server \
$(NULL)
+CLEANFILES = \
+ netdata-switch-dashboard.sh \
+ $(NULL)
+
usersslconfigdir=$(configdir)/ssl
+include $(top_srcdir)/build/subst.inc
+SUFFIXES = .in
+
+scriptsdir=${prefix}/libexec/netdata
+scripts_SCRIPTS = \
+ netdata-switch-dashboard.sh \
+ $(NULL)
+
# Explicitly install directories to avoid permission issues due to umask
install-exec-local:
$(INSTALL) -d $(DESTDIR)$(usersslconfigdir)
@@ -19,4 +31,5 @@ dist_noinst_DATA = \
README.md \
gui/confluence/README.md \
gui/custom/README.md \
+ netdata-switch-dashboard.sh.in \
$(NULL)
diff --git a/web/netdata-switch-dashboard.sh.in b/web/netdata-switch-dashboard.sh.in
new file mode 100644
index 0000000000..c09ff6b936
--- /dev/null
+++ b/web/netdata-switch-dashboard.sh.in
@@ -0,0 +1,60 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-3.0-or-later
+# (c) 2020 Netdata Incorporated
+
+set -e
+
+webdir="@webdir_POST@"
+configdir="@configdir_POST@"
+
+usage() {
+ cat << EOF
+USAGE: switch-netdata-dashboard.sh <dashboard-name>
+
+<dashboard-name> is required, it specifies which dashboard to use. Valid
+arguments are 'react' to use the new React dashboard, and 'classic'
+to use the old dashboard.
+
+Once run, you can use the new dashboard by performing a valdiating reload
+in your browser (Ctrl-Shift-R in most browsers).
+EOF
+exit 1
+}
+
+switch_dashboard() {
+ new="${1}"
+ path="${webdir}-${new}"
+
+ echo "Switching to ${new} dashboard..."
+
+ for dashboard in classic react ; do
+ # shellcheck disable=SC2013
+ for item in $(cat ${webdir}-${dashboard}/.files) ; do
+ rm -f "${webdir}/${item}"
+ done
+ done
+
+ cp -a "${path}/." "${webdir}"
+
+ if [ -e "${configdir}/.environment" ] ; then
+ if grep -q NETDATA_SELECTED_DASHBOARD "${configdir}/.environment" ; then
+ sed -E "s/^NETDATA_SELECTED_DASHBOARD=\".*\"$/NETDATA_SELECTED_DASHBOARD=\"${new}\"/" "${configdir}/.environment"
+ else
+ echo "NETDATA_SELECTED_DASHBOARD=\"${new}\"" >> "${configdir}/.environment"
+ fi
+ fi
+
+ exit 0
+}
+
+case "${1}" in
+ react)
+ switch_dashboard react
+ ;;
+ classic)
+ switch_dashboard classic
+ ;;
+ *)
+ usage
+ ;;
+esac