From cc1685b518f1196fe01f4c992844034b2d348f1e Mon Sep 17 00:00:00 2001 From: liwenrui Date: Tue, 8 Aug 2023 16:06:29 +0800 Subject: [PATCH] * set loading properly. --- module/ai/view/promptmenu.html.php | 1 + module/ai/view/prompts.html.php | 1 + module/ai/view/promptview.html.php | 21 ++++++++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/module/ai/view/promptmenu.html.php b/module/ai/view/promptmenu.html.php index e1e2ecdd4f..18a8b77d28 100644 --- a/module/ai/view/promptmenu.html.php +++ b/module/ai/view/promptmenu.html.php @@ -59,6 +59,7 @@ $('body').addClass('load-indicator loading'); /* Checks for session storage to cancel loading status (see inputinject.html.php). */ + sessionStorage.removeItem('ai-prompt-data-injected'); const loadCheckInterval = setInterval(function() { if(sessionStorage.getItem('ai-prompt-data-injected')) diff --git a/module/ai/view/prompts.html.php b/module/ai/view/prompts.html.php index 62285c52e7..aee597e74c 100644 --- a/module/ai/view/prompts.html.php +++ b/module/ai/view/prompts.html.php @@ -175,6 +175,7 @@ $('body').addClass('load-indicator loading'); /* Checks for session storage to cancel loading status (see inputinject.html.php). */ + sessionStorage.removeItem('ai-prompt-data-injected'); const loadCheckInterval = setInterval(function() { if(sessionStorage.getItem('ai-prompt-data-injected')) diff --git a/module/ai/view/promptview.html.php b/module/ai/view/promptview.html.php index 36d68a5451..ed43202cf5 100644 --- a/module/ai/view/promptview.html.php +++ b/module/ai/view/promptview.html.php @@ -67,7 +67,7 @@ deleted):?> status == 'draft' && (common::hasPriv('ai', 'promptassignrole') || common::hasPriv('ai', 'promptaudit') || common::hasPriv('ai', 'publish'))) || ($prompt->status != 'draft' && common::hasPriv('ai', 'unpublish'))):?>
status == 'draft') echo html::a(helper::createLink('ai', 'promptassignrole', "prompt=$prompt->id"), ' ' . $lang->ai->prompts->action->design, '', "class='btn'");?> - status == 'draft' && $this->ai->isExecutable($prompt)) echo html::a($this->ai->getTestingLocation($prompt), ' ' . $lang->ai->prompts->action->test, '', "class='btn'");?> + status == 'draft' && $this->ai->isExecutable($prompt)) echo html::a($this->ai->getTestingLocation($prompt), ' ' . $lang->ai->prompts->action->test, '', "class='btn prompt-audit-btn'");?> status == 'draft' && $this->ai->isExecutable($prompt)) echo html::a(helper::createLink('ai', 'promptpublish', "id={$prompt->id}"), ' ' . $lang->ai->prompts->action->publish, '', "class='btn'");?> status == 'active') echo html::a(helper::createLink('ai', 'promptunpublish', "id={$prompt->id}"), ' ' . $lang->ai->prompts->action->unpublish, '', "class='btn' id='unpublish-btn'");?>
@@ -166,6 +166,7 @@ } return false; }); + $('#unpublish-btn').click(function() { if(confirm('ai->prompts->action->draftConfirm;?>')) @@ -178,6 +179,24 @@ } return false; }); + + $('.prompt-audit-btn').click(function() + { + $('body').attr('data-loading', 'ai->execute->loading;?>'); + $('body').addClass('load-indicator loading'); + + /* Checks for session storage to cancel loading status (see inputinject.html.php). */ + sessionStorage.removeItem('ai-prompt-data-injected'); + const loadCheckInterval = setInterval(function() + { + if(sessionStorage.getItem('ai-prompt-data-injected')) + { + $('body').removeClass('loading'); + sessionStorage.removeItem('ai-prompt-data-injected'); + clearInterval(loadCheckInterval); + } + }, 200); + }); });