From fde7a55d16322f14b8caa458f551d1b61dc7047f Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Jun 23 2020 15:41:50 +0000 Subject: Issue 51169 - UI - attr uniqueness - selecting empty subtree crashes cockpit Description: When processing the typeAheadChange we need to check for a empty string before treating the array like a list of objects. Also updated README with contribution instructions relates: https://pagure.io/389-ds-base/issue/51169 Reviewed by: spichugi(Thanks!) Improve handling of typeAhead values. In some cases its an array of strings, and in some cases it's array of objects --- diff --git a/src/cockpit/389-console/README.md b/src/cockpit/389-console/README.md index 290160a..95648da 100644 --- a/src/cockpit/389-console/README.md +++ b/src/cockpit/389-console/README.md @@ -8,7 +8,6 @@ title: "Cockpit UI Design" The main layout consists of as tabbed panel for the following categories: - Server Configuration -- Security - Database - Replication - Schema @@ -30,17 +29,12 @@ This is the welcome page(panel). You select which local instance you want to co - General Configuration: port, hostname, LDAPI, various config settings under cn=config - SASL: SSL Settings and Mappings +- Security: Managed security settings and certificates - Password Policy: all things password related - Logs: access, error, audit/auditfail settings - Tasks: backups/restore, Create/delete instances, etc - Tuning and resource limits: size/time limits, max threads per conn, etc -## Security - -- Enable Security and configuration settings -- Manage Certificate Database -- Manage ciphers - ## Database - Mapping tree and backend are "linked". They are seen as a single object in the UI. If you create a new suffix, it creates the mapping tree entry and the backend entry. Delete removes both as well. @@ -53,7 +47,7 @@ This is the welcome page(panel). You select which local instance you want to co - Referrals - Indexes - Attr encryption -- Suffix Tree Node - right click: +- Suffix Tree Node - right click: - Import/Export - Backup/Restore - Reindex @@ -64,9 +58,9 @@ This is the welcome page(panel). You select which local instance you want to co ## Replication -Setup replication configuration, changelog, and agreements. Keep agmt setup wizard simple. Build in some simple monitoring and agreement status info. Save the real replication monitoring for the monitor tab panel. +Setup replication configuration, changelog, and agreements. Keep agmt setup wizard simple. Build in some simple monitoring and agreement status info. Save the real replication monitoring for the monitor tab panel. -- Build in cleanallruv task (and the abort task), and cleanallruv task monitoring! +- Build in cleanallruv task (and the abort task), and cleanallruv task monitoring - "Reinit all agmts" option?? - "test replication" operation (already exists in lib389) - monitoring page, or agreement dropdown(+1)? @@ -161,53 +155,22 @@ List: "items": [] } -# Misc ---------------------- - -No RESET buttons? Not yet at least... - - -LIB389 Requirements: - -- Consistent JSON representation of entries -- Retrieve schema: standard and custom (user-defined) -- Retrieve plugins -- Get attr syntaxes -- retreive indexes -- Retreive config (cn=config and friends) -- SASL mapping/priority -- Retrieve cleanAllRUV(and abort) tasks -- Get all user/subtree password policies -- Get SSL ciphers -- Get certificates: - - Get Trust Attrs - - Get CA certs: expireation dates - - Get Server Certs, exp dates, issue to, issued by - - Get Revoked Certs: isssued by, effective date, Next Update, Type - - - - -# To Do -------------------------------------- - -## wizard forms(modals) - -- Edit plugin (generic) -- Edit plugin (RI plugin) -- Edit plugin (Member Of) -- Edit plugin ... -- Add/edit SASL Mapiing -- Import/Export Certification (file location) -- All the cert stuff - - - +# Contributing +------------------------- +To test changes to the 389-console plugin, you can set up links from your workspace to a user's home directory +- Create cockpit directory under user's home directory + mkdir ~/.local/share/cockpit/389-console +- Link your workspace directory + ln -s /home/USERNAME/source/389-ds-base/src/cockpit/389-console/dist ~/.local/share/cockpit/389-console +- Then run the build & watch script. This builds the UI and "watches" it for changes + cd /home/USERNAME/source/389-ds-base/src/cockpit/389-console/ + ./buildAndRun.sh +- All changes to the source code will be reflected in the UI without having to reinstall any packages. You just need to reload the browser to see the changes. diff --git a/src/cockpit/389-console/buildAndRun.sh b/src/cockpit/389-console/buildAndRun.sh index 8021003..790741c 100755 --- a/src/cockpit/389-console/buildAndRun.sh +++ b/src/cockpit/389-console/buildAndRun.sh @@ -27,6 +27,7 @@ while (( "$#" )); do done printf "\nCleaning and installing npm packages ...\n\n" +rm -rf dist/* make -f node_modules.mk clean > /dev/null make -f node_modules.mk install > /dev/null if [ $? != 0 ]; then diff --git a/src/cockpit/389-console/src/lib/plugins/attributeUniqueness.jsx b/src/cockpit/389-console/src/lib/plugins/attributeUniqueness.jsx index af25ebb..12702aa 100644 --- a/src/cockpit/389-console/src/lib/plugins/attributeUniqueness.jsx +++ b/src/cockpit/389-console/src/lib/plugins/attributeUniqueness.jsx @@ -96,7 +96,12 @@ class AttributeUniqueness extends React.Component { // instead of string. Grab the "label" in this case let new_values = []; for (let val of values) { - new_values.push(val.label); + if (val != "") { + if (typeof val === 'object') { + val = val.label; + } + new_values.push(val); + } } this.setState({ subtrees: new_values