aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/bootstrap.js
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-05-10 20:07:01 +0800
committerGitHub <noreply@github.com>2024-05-10 20:07:01 +0800
commit7424f27cf30065a1308aa3ba4d75ea82c0af4af9 (patch)
tree3fd5ab5670c1e13a6c6d1e030b9ab5d75b86f9c9 /web_src/js/bootstrap.js
parentb9396a9b852e4fea0e2c39ef3ef2fdfbc9ea248a (diff)
downloadgitea-7424f27cf30065a1308aa3ba4d75ea82c0af4af9.tar.gz
gitea-7424f27cf30065a1308aa3ba4d75ea82c0af4af9.zip
Check if reverse proxy is correctly configured (#30890)
Follow #27011 Follow #30885 --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'web_src/js/bootstrap.js')
-rw-r--r--web_src/js/bootstrap.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/web_src/js/bootstrap.js b/web_src/js/bootstrap.js
index 8339b4bd82..26627dfded 100644
--- a/web_src/js/bootstrap.js
+++ b/web_src/js/bootstrap.js
@@ -16,20 +16,20 @@ function shouldIgnoreError(err) {
return false;
}
-export function showGlobalErrorMessage(msg) {
+export function showGlobalErrorMessage(msg, msgType = 'error') {
const msgContainer = document.querySelector('.page-content') ?? document.body;
const msgCompact = msg.replace(/\W/g, '').trim(); // compact the message to a data attribute to avoid too many duplicated messages
let msgDiv = msgContainer.querySelector(`.js-global-error[data-global-error-msg-compact="${msgCompact}"]`);
if (!msgDiv) {
const el = document.createElement('div');
- el.innerHTML = `<div class="ui container negative message center aligned js-global-error tw-mt-[15px] tw-whitespace-pre-line"></div>`;
+ el.innerHTML = `<div class="ui container js-global-error tw-my-[--page-spacing]"><div class="ui ${msgType} message tw-text-center tw-whitespace-pre-line"></div></div>`;
msgDiv = el.childNodes[0];
}
// merge duplicated messages into "the message (count)" format
const msgCount = Number(msgDiv.getAttribute(`data-global-error-msg-count`)) + 1;
msgDiv.setAttribute(`data-global-error-msg-compact`, msgCompact);
msgDiv.setAttribute(`data-global-error-msg-count`, msgCount.toString());
- msgDiv.textContent = msg + (msgCount > 1 ? ` (${msgCount})` : '');
+ msgDiv.querySelector('.ui.message').textContent = msg + (msgCount > 1 ? ` (${msgCount})` : '');
msgContainer.prepend(msgDiv);
}