From 004033237ae61b7163dc4d183735a1e6d6898184 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Sep 07 2019 11:37:42 +0000 Subject: Issue 50546 - Fix various issues in UI Description: This patch addresses several issues: - #50546 - Exports from Cockpit can be stored outside of /var/lib/dirsrv/slapd-instance_name/ldif/ - #50418 - dsctl remove does not cleanup /etc/tmpfiles.d - #50554 - Cockpit incorrectly shows that a server is in read-only mode - #49856 - Changing port should adjust selinux labels - This also enforces a minimum password length for root DN - Added confirmation modal is you disable LDAPI(and UI) - Added port verification - Created new "view" modals for schema instead oi reusing edit forms - Improved instance creation form validation - Added a progress bar for doing the initial load of configuration relates: https://pagure.io/389-ds-base/issue/50546 Reviewed by: spichugi(Thanks!) --- diff --git a/src/cockpit/389-console/src/css/ds.css b/src/cockpit/389-console/src/css/ds.css index 3481db8..6da4b9d 100644 --- a/src/cockpit/389-console/src/css/ds.css +++ b/src/cockpit/389-console/src/css/ds.css @@ -317,6 +317,7 @@ td { width: 875px !important; min-width: 875px !important; vertical-align: middle; + margin-left: -100px !important; } .ds-button-right { @@ -686,6 +687,10 @@ option { text-align: center; } +.modal { + overflow-y:auto; +} + /* wizard accordions are narrower */ .ds-wiz-accordion { margin-top: 20px; @@ -826,6 +831,13 @@ option { transform: translate(-25%, -50%); } +.ds-loading { + position: fixed; + top: 25%; + left: 35%; + transform: translate(-25%, -35%); +} + .ds-popup { min-width: 350px !important; } @@ -885,10 +897,6 @@ option { } } -.control-label { - text-align: left !important; -} - .rbt-token { background-color: #ededed; color: #363636; diff --git a/src/cockpit/389-console/src/ds.js b/src/cockpit/389-console/src/ds.js index 47247e6..efe337c 100644 --- a/src/cockpit/389-console/src/ds.js +++ b/src/cockpit/389-console/src/ds.js @@ -76,8 +76,14 @@ function valid_dn (dn){ } function valid_num (val){ - // Validate value is a number - return !isNaN(val); + // Validate value is a number and between 1 and 65535 + let result = !isNaN(val); + if (result) { + if (val < 1 || val > 65535) { + result = false; + } + } + return result; } function tableize (val) { @@ -340,7 +346,27 @@ function popup_success(msg) { // This is called when any Save button is clicked on the main page. We call // all the save functions for all the pages here. This is not used for modal forms function save_all () { - save_config(); // Server Config Page + if ("nsslapd-ldapilisten" in config_values || "nsslapd-ldapiautobind" in config_values) { + if ( (!$("#nsslapd-ldapilisten").is(":checked") && config_values["nsslapd-ldapilisten"] == "on") || + (!$("#nsslapd-ldapiautobind").is(":checked") && config_values["nsslapd-ldapiautobind"] == "on") ) + { + // Okay we are disabling some form of LDAPI that will break the UI, warn the user + popup_confirm("Disabling LDAPI or LDAPI Autobind will make the UI unusable. Are you sure you want to proceed", + "Confirmation", function (yes) + { + if (yes) { + save_config(); + } else { + // No, reset config + get_and_set_config(); + } + }); + } else { + save_config(); + } + } else { + save_config(); + } } function load_repl_suffix_dropdowns() { @@ -374,6 +400,18 @@ function load_repl_suffix_dropdowns() { }); } +var progress = 10; + +function update_progress () { + progress += 10; + if (progress > 100) { + progress = 100; + } + $("#ds-progress-label").text(progress + "%"); + $("#ds-progress-bar").attr("aria-valuenow", progress); + $("#ds-progress-bar").css("width", progress + "%"); +} + var loading_cfg = 0; function load_config (refresh){ @@ -382,6 +420,8 @@ function load_config (refresh){ return; } loading_cfg = 1; + progress = 10; + update_progress(); // Load the configuration for all the pages. var dropdowns = ['local-pwp-suffix', 'select-repl-cfg-suffix']; @@ -415,15 +455,18 @@ function load_config (refresh){ get_and_set_config(); get_and_set_sasl(); get_and_set_localpwp(); + update_progress(); // Schema page get_and_set_schema_tables(); + update_progress(); // Replication page get_and_set_repl_config(); get_and_set_repl_agmts(); get_and_set_repl_winsync_agmts(); get_and_set_cleanallruv(); + update_progress(); // Initialize the tabs $(".ds-tab-list").css( 'color', '#777'); diff --git a/src/cockpit/389-console/src/index.html b/src/cockpit/389-console/src/index.html index eb7ea4a..1a42c97 100644 --- a/src/cockpit/389-console/src/index.html +++ b/src/cockpit/389-console/src/index.html @@ -33,9 +33,20 @@ -