From 4d7605f21d873a635676bb9b904549d9e59a8d84 Mon Sep 17 00:00:00 2001 From: Zachary Keeping Date: Wed, 4 Oct 2023 11:20:22 +1100 Subject: [PATCH 1/4] Update modal styling and wording --- ui/src/components/misccomponents/Modal.svelte | 2 +- .../misccomponents/UpdateIgnoreUrl.svelte | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ui/src/components/misccomponents/Modal.svelte b/ui/src/components/misccomponents/Modal.svelte index 1707ab73..4d917077 100644 --- a/ui/src/components/misccomponents/Modal.svelte +++ b/ui/src/components/misccomponents/Modal.svelte @@ -50,7 +50,7 @@ class="modal-content py-4 text-left px-6" class:fullheight={full === true}> -
+

{header}

diff --git a/ui/src/components/misccomponents/UpdateIgnoreUrl.svelte b/ui/src/components/misccomponents/UpdateIgnoreUrl.svelte index c94beb9f..e38b7caf 100644 --- a/ui/src/components/misccomponents/UpdateIgnoreUrl.svelte +++ b/ui/src/components/misccomponents/UpdateIgnoreUrl.svelte @@ -84,20 +84,24 @@ mainAction="Save" on:action={updateIgnore} on:dismiss={dismiss}> -
+
+
+ Ignoring a URL here will prevent CodeAuditor from scanning it for future scans. A URL can be ignored + for a specified period of time, for either all sites or just the current site. +
-
+
You can use glob matching, e.g. https://twitter.com/** will match with https://twitter.com/users/john or https://twitter.com/login
-
+
To see more supported Glob patterns, check out CodeAuditor KB
- -
    + +
    • -
      +
      {#if scanUrl}
    • -
      +
      Date: Thu, 5 Oct 2023 17:40:20 +1100 Subject: [PATCH 2/4] Add implementation --- .../misccomponents/IgnoreLists.svelte | 29 +++++++---- ui/src/components/misccomponents/Modal.svelte | 4 +- .../misccomponents/TextField.svelte | 2 + .../misccomponents/UpdateIgnoreUrl.svelte | 51 +++++++++++++++---- ui/src/containers/Settings.svelte | 19 ++++++- 5 files changed, 81 insertions(+), 24 deletions(-) diff --git a/ui/src/components/misccomponents/IgnoreLists.svelte b/ui/src/components/misccomponents/IgnoreLists.svelte index 22f278e9..f39de48c 100644 --- a/ui/src/components/misccomponents/IgnoreLists.svelte +++ b/ui/src/components/misccomponents/IgnoreLists.svelte @@ -4,9 +4,12 @@ import LoadingCircle from "./LoadingCircle.svelte"; import Icon from "./Icon.svelte"; import { userSession$, deleteIgnoreUrl } from "../../stores"; + import { createEventDispatcher } from 'svelte'; export let builds = []; + const dispatch = createEventDispatcher(); + $: numberOfIgnored = builds.length; let addedFailedToast; @@ -76,16 +79,22 @@ {#if loading && val.urlToIgnore === deleteUrl} {:else} - deleteIgnore(val, $userSession$)}> - - - - + {/if} diff --git a/ui/src/components/misccomponents/Modal.svelte b/ui/src/components/misccomponents/Modal.svelte index 4d917077..9e65bc1b 100644 --- a/ui/src/components/misccomponents/Modal.svelte +++ b/ui/src/components/misccomponents/Modal.svelte @@ -1,5 +1,5 @@ @@ -62,9 +68,14 @@ transition: background 0.2s, transform 0.2s; } - input[type="radio"] + label span:hover, - input[type="radio"] + label:hover span { + input[type="radio"] + label:not(.disabled) span:hover, + input[type="radio"] + label:hover:not(.disabled) span { transform: scale(1.2); + cursor: pointer; + } + + input[type="radio"] + label:hover:not(.disabled) { + cursor: pointer; } input[type="radio"]:checked + label span { @@ -72,9 +83,23 @@ box-shadow: 0px 0px 0px 2px white inset; } + input[type="radio"]:checked + label.disabled span { + background-color: #ccc; + border-color: #ccc; + } + + input[type="radio"] + label.disabled span { + background-color: white; + border-color: #ccc; + } + input[type="radio"]:checked + label { color: #414141; } + + input[type="radio"] + label.disabled { + color: #ccc; + } - +
      You can use glob matching, e.g. https://twitter.com/** will match with https://twitter.com/users/john or https://twitter.com/login @@ -107,12 +132,14 @@ type="radio" class="hidden" value={'all'} - bind:group={ignoreOn} /> + bind:group={ignoreOn} + disabled={editing} + /> -
      @@ -125,11 +152,13 @@ class="hidden" id="radio2" bind:group={ignoreOn} - value={url} /> -
      diff --git a/ui/src/containers/Settings.svelte b/ui/src/containers/Settings.svelte index 60f9a2a2..5eb8017f 100644 --- a/ui/src/containers/Settings.svelte +++ b/ui/src/containers/Settings.svelte @@ -10,6 +10,9 @@ import UpdateIgnoreUrl from "../components/misccomponents/UpdateIgnoreUrl.svelte"; let ignoreUrlShown; + let urlToIgnore; + let ignoreDuration; + let scanUrl; let loading = false; $: if ($userSession$) { @@ -23,6 +26,13 @@ loading = false; }, 300); }; + + const editIgnore = (e) => { + urlToIgnore = e.detail.urlToIgnore; + ignoreDuration = e.detail.ignoreDuration; + scanUrl = e.detail.ignoreOn; + ignoreUrlShown = true; + };
      @@ -41,7 +51,10 @@
      - + {:else}
      You must be logged in to use this feature
      {/if} @@ -50,4 +63,8 @@ \ No newline at end of file From cf623e3e0b28a499432243ad0b48ec958d50ba19 Mon Sep 17 00:00:00 2001 From: Zachary Keeping Date: Thu, 5 Oct 2023 17:46:57 +1100 Subject: [PATCH 3/4] Fix add URL button --- ui/src/containers/Settings.svelte | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ui/src/containers/Settings.svelte b/ui/src/containers/Settings.svelte index 5eb8017f..33d6ab69 100644 --- a/ui/src/containers/Settings.svelte +++ b/ui/src/containers/Settings.svelte @@ -14,6 +14,7 @@ let ignoreDuration; let scanUrl; let loading = false; + let editing = false; $: if ($userSession$) { load(); @@ -27,7 +28,16 @@ }, 300); }; + const addIgnore = () => { + editing = false; + urlToIgnore = "https://"; + ignoreDuration = null; + scanUrl = null; + ignoreUrlShown = true; + }; + const editIgnore = (e) => { + editing = true; urlToIgnore = e.detail.urlToIgnore; ignoreDuration = e.detail.ignoreDuration; scanUrl = e.detail.ignoreOn; @@ -44,7 +54,7 @@