Resolves: rhbz#2222788

- Refreshing any page in pcs-web-ui no longer causes it to display a blank page
This commit is contained in:
Michal Pospisil 2023-07-14 17:25:42 +02:00
parent a8b1b4c1d8
commit e2c06194ee
2 changed files with 60 additions and 1 deletions

View File

@ -0,0 +1,53 @@
From 074e24f039a5bdfa81d17feb390dd342eda5ba73 Mon Sep 17 00:00:00 2001
From: Ivan Devat <idevat@redhat.com>
Date: Fri, 14 Jul 2023 14:44:20 +0200
Subject: [PATCH] fix assets url (relative -> absolute)
---
.bin/build.sh | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/.bin/build.sh b/.bin/build.sh
index 2113eaae..c7f0b4a0 100755
--- a/.bin/build.sh
+++ b/.bin/build.sh
@@ -74,10 +74,15 @@ inject_built_assets() {
}
fix_asset_paths() {
- # All assets in index.html uses absolute path. This function makes them
- # relative. The index.html is also used by development server which needs
- # absolute paths. There is no copy/edit phase in development server, so it is
- # done here.
+ # All assets in index.html uses absolute path. The index.html is also used by
+ # development server which needs absolute paths. There is no copy/edit phase
+ # in development server, so it is done here.
+ # Here is the absolute path prefixed according to pcsd url namespace for
+ # webui.
+ # WARNING: Don't use relative path. It works well in dashboard but in the
+ # cluster detail the resulting url contains word "cluster" inside, so instead
+ # of "/ui/static/..." we get "/ui/cluster/static" and asset loading fails.
+ # see: https://bugzilla.redhat.com/show_bug.cgi?id=2222788
html=$1
path_prefix=$2
js_path="$3/"
@@ -130,6 +135,7 @@ adapt_for_environment() {
}
use_current_node_modules=${BUILD_USE_CURRENT_NODE_MODULES:-"false"}
+url_prefix=${PCSD_BUILD_URL_PREFIX:-"/ui"}
node_modules=$(get_path "appNodeModules")
node_modules_backup="${node_modules}.build-backup"
export BUILD_DIR="${BUILD_DIR:-$(realpath "$(dirname "$0")"/../build)}"
@@ -155,7 +161,7 @@ adapt_for_environment \
static/js/adapterCockpit.js \
"${PCSD_UINIX_SOCKET:-"/var/run/pcsd.socket"}"
-fix_asset_paths "$BUILD_DIR"/index.html "." \
+fix_asset_paths "$BUILD_DIR"/index.html "$url_prefix" \
static/js \
static/css \
manifest.json \
--
2.41.0

View File

@ -1,6 +1,6 @@
Name: pcs Name: pcs
Version: 0.11.6 Version: 0.11.6
Release: 2%{?dist} Release: 3%{?dist}
# https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/ # https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/
# https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses # https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
# GPL-2.0-only: pcs # GPL-2.0-only: pcs
@ -107,6 +107,7 @@ Patch3: bz2219407-01-use-a-filter-when-extracting-a-config-backup-tarball.patch
# ui patches: >200 # ui patches: >200
# Patch201: bzNUMBER-01-name.patch # Patch201: bzNUMBER-01-name.patch
Patch201: bz2222788-01-fix-assets-url-relative-absolute.patch
# git for patches # git for patches
BuildRequires: git-core BuildRequires: git-core
@ -290,6 +291,7 @@ update_times_patch(){
%autosetup -D -T -b 100 -a 101 -S git -n %{ui_src_name} -N %autosetup -D -T -b 100 -a 101 -S git -n %{ui_src_name} -N
%autopatch -p1 -m 201 %autopatch -p1 -m 201
# update_times_patch %%{PATCH201} # update_times_patch %%{PATCH201}
update_times_patch %{PATCH201}
# patch pcs sources # patch pcs sources
%autosetup -S git -n %{pcs_source_name} -N %autosetup -S git -n %{pcs_source_name} -N
@ -535,6 +537,10 @@ run_all_tests
%license pyagentx_LICENSE.txt %license pyagentx_LICENSE.txt
%changelog %changelog
* Fri Jul 14 2023 Michal Pospisil <mpospisi@redhat.com> - 0.11.6-3
- Refreshing any page in pcs-web-ui no longer causes it to display a blank page
- Resolves: rhbz#2222788
* Mon Jul 10 2023 Michal Pospisil <mpospisi@redhat.com> - 0.11.6-2 * Mon Jul 10 2023 Michal Pospisil <mpospisi@redhat.com> - 0.11.6-2
- Added BuildRequires: debugedit - for generating MiniDebugInfo - triggered by removing find-debuginfo.sh from rpm - Added BuildRequires: debugedit - for generating MiniDebugInfo - triggered by removing find-debuginfo.sh from rpm
- Make use of filters when extracting tarballs to enhance security if provided by Python (pcs config restore command) - Make use of filters when extracting tarballs to enhance security if provided by Python (pcs config restore command)