mirror of
https://github.com/opnsense/core.git
synced 2026-10-11 22:40:01 +00:00
system: revisit dashboard linting
This commit is contained in:
+12
-14
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2024 Franco Fichtner <[email protected]>
|
||||
# Copyright (c) 2024-2026 Franco Fichtner <[email protected]>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
@@ -42,33 +42,31 @@ for WIDGET in ${WIDGETS}; do
|
||||
continue
|
||||
fi
|
||||
|
||||
REGISTERED=
|
||||
SKIP=false
|
||||
REGISTERED=
|
||||
|
||||
for METAFILE in ${METADATA}; do
|
||||
if xmllint "${METAFILE}" --xpath 'boolean(//*[filename="'"${FILENAME}"'" and skiplint="true"])' 2>/dev/null | grep -q true; then
|
||||
SKIP=true
|
||||
break
|
||||
fi
|
||||
if ! grep -q "<filename>${FILENAME}</filename>" ${METAFILE}; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if grep -q "<filename>${FILENAME}</filename>" ${METAFILE}; then
|
||||
REGISTERED=$(xmllint ${METAFILE} --xpath '//*[filename="'"${FILENAME}"'"]//endpoints//endpoint' | \
|
||||
if [ "$(xmllint "${METAFILE}" --xpath 'count(//*[filename="'"${FILENAME}"'"]/endpoints/independent)')" != "0" ]; then
|
||||
continue 2
|
||||
fi
|
||||
|
||||
if [ "$(xmllint ${METAFILE} --xpath 'count(//*[filename="'"${FILENAME}"'"]/endpoints/endpoint)')" != "0" ]; then
|
||||
REGISTERED=$(xmllint ${METAFILE} --xpath '//*[filename="'"${FILENAME}"'"]/endpoints/endpoint' | \
|
||||
sed -e 's:^[^>]*>::' -e 's:<[^<]*$::' | sort)
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${SKIP}" = true ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
ENDPOINTS=$( (grep -o 'this\.ajaxCall([^,)]*' ${WIDGET} | cut -c 15-; \
|
||||
grep -o 'super\.openEventSource([^,)]*' ${WIDGET} | cut -c 23-) | \
|
||||
tr -d "'" | tr -d '`' | sed 's:\$.*:*:' | sort -u)
|
||||
|
||||
if [ -z "${ENDPOINTS}" ]; then
|
||||
echo "No endpoints found for ${WIDGET}"
|
||||
continue
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${REGISTERED}" ]; then
|
||||
|
||||
@@ -229,7 +229,9 @@
|
||||
<livelog>
|
||||
<filename>LiveLog.js</filename>
|
||||
<link>/ui/diagnostics/log/core/system</link>
|
||||
<skiplint>true</skiplint>
|
||||
<endpoints>
|
||||
<independent/>
|
||||
</endpoints>
|
||||
<translations>
|
||||
<title>Live Log</title>
|
||||
<noaccess>No access</noaccess>
|
||||
@@ -401,6 +403,9 @@
|
||||
</dnsmasqleases>
|
||||
<notes>
|
||||
<filename>Notes.js</filename>
|
||||
<endpoints>
|
||||
<independent/>
|
||||
</endpoints>
|
||||
<translations>
|
||||
<title>Notes</title>
|
||||
<titleedit>Note editor</titleedit>
|
||||
|
||||
Reference in New Issue
Block a user