mirror of
https://github.com/unraid/api.git
synced 2026-01-07 00:59:48 -06:00
fix: improve vue mount speed by 10x
- Refactored teleport container management to be lazily created, improving performance by avoiding unnecessary DOM manipulations. - Updated `useTeleport` to dynamically determine the correct teleport target based on mounted components. - Removed the `ensureTeleportContainer` import from various components, streamlining the mounting process. - Adjusted the dropdown menu component to utilize a computed property for teleport target management. - Enhanced the component registry to support a unified app architecture, replacing legacy mounting functions with a more efficient approach. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Support bundles may include the GraphQL API log when present. * OS version data loads lazily when the header dropdown first opens. * Many UI components now load on demand via a unified mounting approach. * **Bug Fixes** * Dropdowns and modals consistently stack above other UI elements. * Server status layout fixes improve small-screen alignment. * **Breaking Changes** * Teleport/mounting APIs and public teleport helper were consolidated/removed; integrations may need update. * **Tests** * Extensive new unit tests added for mounting, teleport, modals, and REST log handling. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
@@ -40,7 +40,7 @@ if [ "$has_standalone" = true ]; then
|
||||
rsync -avz --delete -e "ssh" "$standalone_directory" "root@${server_name}:/usr/local/emhttp/plugins/dynamix.my.servers/unraid-components/standalone/"
|
||||
standalone_exit_code=$?
|
||||
# If standalone rsync failed, update exit_code
|
||||
if [ $standalone_exit_code -ne 0 ]; then
|
||||
if [ "$standalone_exit_code" -ne 0 ]; then
|
||||
exit_code=$standalone_exit_code
|
||||
fi
|
||||
fi
|
||||
@@ -49,7 +49,9 @@ fi
|
||||
update_auth_request() {
|
||||
local server_name="$1"
|
||||
# SSH into server and update auth-request.php
|
||||
ssh "root@${server_name}" bash -s << 'EOF'
|
||||
ssh "root@${server_name}" /bin/bash -s << 'EOF'
|
||||
set -euo pipefail
|
||||
set -o errtrace
|
||||
AUTH_REQUEST_FILE='/usr/local/emhttp/auth-request.php'
|
||||
UNRAID_COMPS_DIR='/usr/local/emhttp/plugins/dynamix.my.servers/unraid-components/'
|
||||
|
||||
@@ -76,8 +78,9 @@ update_auth_request() {
|
||||
# Clean up any existing temp file
|
||||
rm -f "$TEMP_FILE"
|
||||
|
||||
# Process the file through both stages using a pipeline
|
||||
# Process the file through both stages
|
||||
# First remove existing web component entries, then add new ones
|
||||
# Use a simpler approach without relying on PIPESTATUS
|
||||
awk '
|
||||
BEGIN { in_array = 0 }
|
||||
/\$arrWhitelist\s*=\s*\[/ {
|
||||
@@ -93,19 +96,40 @@ update_auth_request() {
|
||||
!in_array || !/\/plugins\/dynamix\.my\.servers\/unraid-components\/.*\.(m?js|css)/ {
|
||||
print $0
|
||||
}
|
||||
' "$AUTH_REQUEST_FILE" | \
|
||||
' "$AUTH_REQUEST_FILE" > "$TEMP_FILE.stage1" || {
|
||||
echo "Failed to process $AUTH_REQUEST_FILE (stage 1)" >&2
|
||||
rm -f "$TEMP_FILE.stage1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
awk -v files_to_add="$(printf '%s\n' "${FILES_TO_ADD[@]}" | sed "s/'/\\\\'/g" | sort -u | awk '{printf " \047%s\047,\n", $0}')" '
|
||||
/\$arrWhitelist\s*=\s*\[/ {
|
||||
/\$arrWhitelist[[:space:]]*=[[:space:]]*\[/ {
|
||||
print $0
|
||||
print files_to_add
|
||||
next
|
||||
}
|
||||
{ print }
|
||||
' > "$TEMP_FILE"
|
||||
|
||||
# Check pipeline succeeded and temp file is non-empty
|
||||
if [ ${PIPESTATUS[0]} -ne 0 ] || [ ${PIPESTATUS[1]} -ne 0 ] || [ ! -s "$TEMP_FILE" ]; then
|
||||
echo "Failed to process $AUTH_REQUEST_FILE" >&2
|
||||
' "$TEMP_FILE.stage1" > "$TEMP_FILE" || {
|
||||
echo "Failed to process $AUTH_REQUEST_FILE (stage 2)" >&2
|
||||
rm -f "$TEMP_FILE.stage1" "$TEMP_FILE"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Clean up intermediate file
|
||||
rm -f "$TEMP_FILE.stage1"
|
||||
|
||||
# Verify whitelist entries were actually injected
|
||||
if [ ${#FILES_TO_ADD[@]} -gt 0 ]; then
|
||||
if ! grep -qF "${FILES_TO_ADD[0]}" "$TEMP_FILE"; then
|
||||
echo "Failed to inject whitelist entries" >&2
|
||||
rm -f "$TEMP_FILE"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check temp file is non-empty
|
||||
if [ ! -s "$TEMP_FILE" ]; then
|
||||
echo "Failed to process $AUTH_REQUEST_FILE - empty result" >&2
|
||||
rm -f "$TEMP_FILE"
|
||||
exit 1
|
||||
fi
|
||||
@@ -136,7 +160,7 @@ update_auth_request "$server_name"
|
||||
auth_request_exit_code=$?
|
||||
|
||||
# If auth request update failed, update exit_code
|
||||
if [ $auth_request_exit_code -ne 0 ]; then
|
||||
if [ "$auth_request_exit_code" -ne 0 ]; then
|
||||
exit_code=$auth_request_exit_code
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user