From 6f8df9a2d64d65478354914f22ff931325aa69d8 Mon Sep 17 00:00:00 2001 From: Christoph Anderson Date: Sat, 23 Sep 2023 14:38:51 +0200 Subject: [PATCH] Fix missing badges in policies --- src/PoliciesTable.jsx | 40 ++++++++++++---------------------------- src/css/App.css | 7 +++++++ 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/src/PoliciesTable.jsx b/src/PoliciesTable.jsx index bc5102b..26467a4 100644 --- a/src/PoliciesTable.jsx +++ b/src/PoliciesTable.jsx @@ -120,36 +120,20 @@ export class PoliciesTable extends Component { }); } - policySummary(p) { + policySummary(policies) { + let bits = []; function isEmpty(obj) { for (var key in obj) { if (obj.hasOwnProperty(key)) return false; } - return true; } - - let bits = []; - if (!isEmpty(p.policy.retention)) { - bits.push(<>retention{' '}); - } - if (!isEmpty(p.policy.files)) { - bits.push(<>files{' '}); - } - if (!isEmpty(p.policy.errorHandling)) { - bits.push(<>errors{' '}); - } - if (!isEmpty(p.policy.compression)) { - bits.push(<>compression{' '}); - } - if (!isEmpty(p.policy.scheduling)) { - bits.push(<>scheduling{' '}); - } - if (!isEmpty(p.policy.upload)) { - bits.push(<>upload{' '}); + for (let pol in policies.policy) { + if (!isEmpty(policies.policy[pol])) { + bits.push(<>{pol}); + } } - return bits; } @@ -213,16 +197,16 @@ export class PoliciesTable extends Component { break; }; - policies.sort((l,r) => { - const hc = compare(l.target.host,r.target.host); + policies.sort((l, r) => { + const hc = compare(l.target.host, r.target.host); if (hc) { return hc; } - const uc = compare(l.target.userName,r.target.userName); + const uc = compare(l.target.userName, r.target.userName); if (uc) { return uc; } - return compare(l.target.path,r.target.path); + return compare(l.target.path, r.target.path); }); @@ -273,8 +257,8 @@ export class PoliciesTable extends Component { {(this.state.selectedOwner === localPolicies || this.state.selectedOwner === this.state.localSourceName || this.state.selectedOwner === applicablePolicies) ? <> this.setState({ policyPath: p })} - placeholder="enter directory to find or set policy" - name="policyPath" value={this.state.policyPath} onChange={this.handleChange} /> + placeholder="enter directory to find or set policy" + name="policyPath" value={this.state.policyPath} onChange={this.handleChange} /> diff --git a/src/css/App.css b/src/css/App.css index 221a26b..abe1f3a 100644 --- a/src/css/App.css +++ b/src/css/App.css @@ -327,6 +327,13 @@ div.tab-body { margin: 2px; } +.policy-badge { + margin-block-start: 5px; + margin-right: 5px; + background-color: var(--color-primary) !important; + color: var(--text-color) !important; +} + .page-title { margin-left: 10px; font-weight: bold;