update templates + try fix element not into view

* now show on flash message when overlap services on pro version
* update home card to take care of expire case
* add alert when pro plugins without pro license on plugins page
* add alert when accessing pro plugins settings without pro license
* try to move to button element before clicking on it to avoid not in viewport exception
This commit is contained in:
Jordan Blasenhauer 2024-02-28 18:27:46 +01:00
parent 5213c63d8d
commit f7a5c3a6b6
8 changed files with 22 additions and 10 deletions

View file

@ -150,7 +150,7 @@
{% if pro_overlapped %}
<p class="my-2 mr-2 text-red-500 font-bold dark:brightness-95 text-center">
You have more services than allowed by your license. Upgrade your license or move some services to draft mode before your license lockout.
You have more services than allowed by your pro license. Upgrade your license or move some services to draft mode before your license lockout.
</p>
{% endif %}
</div>

View file

@ -1,5 +1,9 @@
<!-- float button-->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if is_pro_version and pro_status and pro_overlapped %}
{% set messages = messages.append(('error', 'You have more services than allowed by your pro license. Upgrade your license or move some services to draft mode before your license lockout.'))%}
{% endif %}
<div data-flash-group
class="transition-all group group-hover hover:brightness-75 dark:hover:brightness-105 fixed top-[4.5rem] right-20 sm:right-24 xl:right-24 z-990">
<button aria-controls="sidebar-flash"

View file

@ -1,7 +1,7 @@
{% extends "base.html" %}
{% block content %}
{% set cards = [
{'name' : 'Version', 'title' : 'PRO' if is_pro_version else 'FREE', 'link' : '#' if is_pro_version else 'https://github.com/bunkerity/bunkerweb', 'subtitle' : 'all features available' if is_pro_version else 'upgrade to pro', 'subtitle_color' : 'success' if is_pro_version else 'warning' },
{'name' : 'Version', 'title' : 'PRO' if is_pro_version and pro_status else 'EXPIRED' if is_pro_version and not pro_status else 'FREE', 'link' : '#' if is_pro_version and pro_status else 'https://github.com/bunkerity/bunkerweb', 'subtitle' : 'all features available' if is_pro_version and pro_status else 'renew your license' if is_pro_version and not pro_status else 'upgrade to pro', 'subtitle_color' : 'success' if is_pro_version and pro_status else 'warning' },
{'name' : 'Version number', 'title' : version, 'link' : 'https://github.com/bunkerity/bunkerweb', 'subtitle' : "couldn'd fint remote" if not remote_version else "latest version" if remote_version and check_version else 'Update to ' + remote_version , 'subtitle_color' : "error" if not remote_version else "success" if remote_version and check_version else 'warning'},
{'name' : 'Instances', 'title' : instances_number, 'link' : 'loading?next=' + url_for('instances') , 'subtitle' : instance_health_count|string + ' / ' + instances_number|string + ' is working' , 'subtitle_color' : "info",},
{'name' : 'Services', 'title' : services_number, 'link' : 'loading?next=' + url_for('services') , 'subtitle' : services_ui_count|string + ' ui, ' + services_scheduler_count|string + ' scheduler, ' + services_autoconf_count|string + ' autoconf ' , 'subtitle_color' : "info"},
@ -23,7 +23,7 @@
<div role="img"
aria-label="version"
class="home-card-svg-container {{ card['name'].replace(' ', '-') |lower }}">
{% if card['name'] == "Version" and is_pro_version %}
{% if card['name'] == "Version" and is_pro_version and pro_status %}
<svg class="leading-none text-lg relative scale-[0.6]"
viewBox="0 0 48 46"
fill="none"
@ -32,7 +32,7 @@
<path class="fill-white" d="M21.2803 45.5H26.7198C33.8098 45.5 37.3545 45.5 39.7198 43.383C40.7523 42.4588 41.4057 40.793 41.8775 38.625H6.1224C6.59413 40.793 7.24783 42.4588 8.2802 43.383C10.6454 45.5 14.1903 45.5 21.2803 45.5Z" fill="#1C274C" />
</svg>
{% endif %}
{% if card['name'] == "Version" and not is_pro_version %}
{% if card['name'] == "Version" and not is_pro_version or card['name'] == "Version" and is_pro_version and not pro_status %}
<svg class="leading-none fill-white text-yellow-500 text-lg relative scale-[0.6]"
xmlns="http://www.w3.org/2000/svg"
fill="none"

View file

@ -21,6 +21,11 @@
</p>
</div>
{% endfor %}
{% if (plugins_count_pro > 0 and not is_pro_version) or (plugins_count_pro > 0 and is_pro_version and not pro_status) %}
<p class="ml-2 mt-0 mb-2 mr-2 text-red-500 font-bold dark:brightness-95 text-sm">
You have pro plugins without pro version.
</p>
{% endif %}
</div>
<!-- end info -->
<!-- upload layout -->
@ -151,6 +156,7 @@
<div data-plugins-list-container
class="min-h-[55vh] max-h-80 overflow-hidden overflow-y-auto p-4 col-span-12 relative min-w-0 break-words bg-white shadow-xl dark:bg-slate-850 dark:shadow-dark-xl rounded-2xl bg-clip-border">
<h5 class="mb-4 mt-2 font-bold dark:text-white/90 mx-2">LIST</h5>
<div data-plugins-list class="grid grid-cols-12 gap-3">
{% for plugin in plugins %}
<div data-plugins-type="{{ plugin['type'] }}"

View file

@ -7,9 +7,9 @@
<!-- title and desc -->
<div class="col-span-12" data-setting-header>
{% if (plugin['type'] == "pro" and not is_pro_version) or (plugin['type'] == "pro" and is_pro_version and not pro_status) %}
<p class="ml-2 mt-0 mb-2 mr-2 text-red-500 font-bold dark:brightness-95 text-sm">
You need a valid pro license to use this plugin
</p>
<p class="ml-2 mt-0 mb-2 mr-2 text-red-500 font-bold dark:brightness-95 text-sm">
You need a valid pro license to use this plugin
</p>
{% endif %}
<div class="flex justify-start items-center">
<h5 class="transition duration-300 ease-in-out ml-2 font-bold text-md uppercase dark:text-white/90 mb-0">

View file

@ -59,8 +59,6 @@ try:
for item in select_filters:
DRIVER.execute_script(f"""document.querySelector('[data-plugins-setting-select-dropdown-btn="{item["id"]}"][value="{item["value"]}"]').click()""")
verify_select_filters(DRIVER, "plugins", select_filters)
log_info("The filter is working, trying to add a bad plugin ...")
file_input = safe_get_element(DRIVER, By.XPATH, "//input[@type='file' and @name='file']")

View file

@ -324,6 +324,8 @@ try:
assert_button_click(DRIVER, delete_button)
sleep(0.1)
access_page(DRIVER, "//form[@data-services-modal-form-delete='']//button[@type='submit']", "services", False)
if TEST_TYPE == "linux":

View file

@ -8,6 +8,7 @@ from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import ElementClickInterceptedException, TimeoutException, WebDriverException
from selenium.webdriver.common.action_chains import ActionChains
def safe_get_element(driver, by: str, selector: str, *, driver_wait: Optional[WebDriverWait] = None, multiple: bool = False, error: bool = False) -> Union[WebElement, List[WebElement]]:
@ -60,7 +61,8 @@ def assert_button_click(driver, button: Union[str, WebElement], by: str = "xpath
sleep(0.5)
button.click()
ActionChains(driver).move_to_element(button).click(button).perform()
clicked = True
return clicked