From e62fa738d32fdd5c48110432bbca137526f69eec Mon Sep 17 00:00:00 2001 From: Thomas Junk Date: Tue, 21 Nov 2023 17:40:27 +0100 Subject: [PATCH] Refactoring UI --- build/feed.html | 11 - docs/used_software.md | 1 - package-lock.json | 4 +- src/app.html | 12 +- src/lib/Back.svelte | 18 +- src/lib/Collapsible.svelte | 35 +- src/lib/KeyValue.svelte | 21 +- src/lib/Spinner.svelte | 23 - src/lib/UrlLoader.svelte | 86 +--- src/lib/ValueField.svelte | 11 - src/lib/ValueList.svelte | 13 +- src/lib/feedview/entries/Entry.svelte | 22 +- .../feedview/entries/URLCollapsible.svelte | 23 +- src/lib/feedview/feed/Category.svelte | 2 +- src/lib/feedview/feed/Feed.svelte | 6 +- src/lib/feedview/feed/Links.svelte | 9 - .../feed/distributions/Distribution.svelte | 36 -- src/lib/singleview/Droparea.svelte | 14 +- src/lib/singleview/SingleView.svelte | 33 +- src/lib/singleview/Upload.svelte | 43 +- .../acknowledgments/Acknowledgment.svelte | 2 +- src/lib/singleview/general/General.svelte | 40 -- .../singleview/general/RevisionHistory.svelte | 27 +- src/lib/singleview/notes/Note.svelte | 35 +- .../producttree/branch/Branch.svelte | 8 - .../producttree/product/FileHash.svelte | 6 +- .../producttree/product/Product.svelte | 4 +- .../ProductIdentificationHelper.svelte | 19 +- .../producttree/product/ProductName.svelte | 8 +- .../producttree/product/XGenericURI.svelte | 11 +- .../ProductVulnerabilities.svelte | 89 +--- .../singleview/references/Reference.svelte | 8 +- .../singleview/references/References.svelte | 2 +- .../vulnerability/GeneralSection.svelte | 2 +- .../vulnerabilities/vulnerability/ID.svelte | 1 - .../vulnerability/flags/Flags.svelte | 6 - .../productStatus/ProductStatus.svelte | 6 - .../ProductStatusValueList.svelte | 13 +- .../remediations/Remediation.svelte | 2 +- .../remediations/Remediations.svelte | 2 +- .../vulnerability/scores/Scores.svelte | 8 +- .../vulnerability/threats/Threats.svelte | 6 - src/routes/+layout.svelte | 55 +-- src/routes/+page.svelte | 6 +- src/routes/feed/+page.svelte | 6 +- static/css/main.css | 464 ++++++++++++++++++ 46 files changed, 588 insertions(+), 671 deletions(-) create mode 100644 static/css/main.css diff --git a/build/feed.html b/build/feed.html index 84ff8bd..1dee89c 100644 --- a/build/feed.html +++ b/build/feed.html @@ -67,15 +67,4 @@ - diff --git a/docs/used_software.md b/docs/used_software.md index 1dcb359..d5ef153 100644 --- a/docs/used_software.md +++ b/docs/used_software.md @@ -7,7 +7,6 @@ Software-Engineering: 2022 Intevation GmbH _CSAF Webview_ is built with the following components: - Framework: [Svelte (SvelteKit)](https://kit.svelte.dev/) -- CSS-Miniframework: [Chota](https://jenil.github.io/chota/) - Icons: [Boxicons](https://boxicons.com/) - Markdown: [marked.js](https://github.com/markedjs/marked) and [DOMPurify] (https://github.com/cure53/DOMPurify) diff --git a/package-lock.json b/package-lock.json index 9dc099f..817d960 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "csaf-webview", - "version": "0.8.1-dev", + "version": "0.9.0-dev", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "csaf-webview", - "version": "0.8.1-dev", + "version": "0.9.0-dev", "dependencies": { "boxicons": "^2.1.4", "chota": "^0.9.2", diff --git a/src/app.html b/src/app.html index e3fbae5..9e6c28b 100644 --- a/src/app.html +++ b/src/app.html @@ -12,6 +12,7 @@ CSAF 2 Webview + @@ -26,15 +27,4 @@
%sveltekit.body%
- diff --git a/src/lib/Back.svelte b/src/lib/Back.svelte index 802e6ab..7ea484c 100644 --- a/src/lib/Back.svelte +++ b/src/lib/Back.svelte @@ -34,21 +34,5 @@ {#if $appStore.ui.history.length > 0} - Last pos. + Last pos. {/if} - - diff --git a/src/lib/Collapsible.svelte b/src/lib/Collapsible.svelte index 26e0dd6..619ef93 100644 --- a/src/lib/Collapsible.svelte +++ b/src/lib/Collapsible.svelte @@ -48,7 +48,7 @@ } -
+
{#if level == "2"} @@ -74,41 +74,12 @@
-
{header}
+
{header}
{/if} {#if visibility === "block"} -
+
{/if}
- - diff --git a/src/lib/KeyValue.svelte b/src/lib/KeyValue.svelte index 8904c9b..acbc9aa 100644 --- a/src/lib/KeyValue.svelte +++ b/src/lib/KeyValue.svelte @@ -13,10 +13,7 @@ import DOMPurify from "dompurify"; export let keys: Array; export let values: any; - export let compact = false; - let width = compact ? "width:10rem" : "width: 15vw;"; marked.use({ gfm: true }); - $: keyStyle = `padding: 0.2rem; ${width}`; {#each keys as key, index} @@ -24,9 +21,9 @@ {#if key == "text" || key == "Text"} {key} - Markdown -
+ >{key} + Markdown +
{@html DOMPurify.sanitize( marked.parse(values[index].replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, "")) )} @@ -34,18 +31,8 @@ {:else} - {key}{values[index]} + {key}{values[index]} {/if} {/each} - - diff --git a/src/lib/Spinner.svelte b/src/lib/Spinner.svelte index 58d674f..284a666 100644 --- a/src/lib/Spinner.svelte +++ b/src/lib/Spinner.svelte @@ -5,26 +5,3 @@ {#if open} {/if} - - diff --git a/src/lib/UrlLoader.svelte b/src/lib/UrlLoader.svelte index e2d4848..d077dc0 100644 --- a/src/lib/UrlLoader.svelte +++ b/src/lib/UrlLoader.svelte @@ -42,76 +42,28 @@ }; -
-
-
- - - URL - - - {#if url} - - - - {/if} +
+
+
+ + URL
+
+ +
+ {#if url} +
+ +
+ {/if}
{#if errormessage} -
-
-
{errormessage}
-
+
+ {errormessage}
{/if} - - diff --git a/src/lib/ValueField.svelte b/src/lib/ValueField.svelte index bc40451..019fb87 100644 --- a/src/lib/ValueField.svelte +++ b/src/lib/ValueField.svelte @@ -17,14 +17,3 @@
{label}

{value}

- - diff --git a/src/lib/ValueList.svelte b/src/lib/ValueList.svelte index 004f865..d78f735 100644 --- a/src/lib/ValueList.svelte +++ b/src/lib/ValueList.svelte @@ -14,19 +14,8 @@

{label}

-
    +
      {#each values as value}
    • {value}
    • {/each}
    - - diff --git a/src/lib/feedview/entries/Entry.svelte b/src/lib/feedview/entries/Entry.svelte index f5ffa25..665ea32 100644 --- a/src/lib/feedview/entries/Entry.svelte +++ b/src/lib/feedview/entries/Entry.svelte @@ -36,23 +36,14 @@ - + - + @@ -71,12 +62,3 @@ {/each} - - diff --git a/src/lib/feedview/entries/URLCollapsible.svelte b/src/lib/feedview/entries/URLCollapsible.svelte index 193349f..e0496cd 100644 --- a/src/lib/feedview/entries/URLCollapsible.svelte +++ b/src/lib/feedview/entries/URLCollapsible.svelte @@ -51,35 +51,20 @@ } -
    +
    {#if level == "4"} {/if} {#if visibility === "block"} -
    +
    {/if}
    - - diff --git a/src/lib/feedview/feed/Category.svelte b/src/lib/feedview/feed/Category.svelte index ad66c1d..d0fe036 100644 --- a/src/lib/feedview/feed/Category.svelte +++ b/src/lib/feedview/feed/Category.svelte @@ -14,5 +14,5 @@ {#each categories as category} - + {/each} diff --git a/src/lib/feedview/feed/Feed.svelte b/src/lib/feedview/feed/Feed.svelte index 8f91159..ae33d8e 100644 --- a/src/lib/feedview/feed/Feed.svelte +++ b/src/lib/feedview/feed/Feed.svelte @@ -21,11 +21,7 @@ {#if feed}
    - +
    diff --git a/src/lib/feedview/feed/Links.svelte b/src/lib/feedview/feed/Links.svelte index c7dc298..76764e2 100644 --- a/src/lib/feedview/feed/Links.svelte +++ b/src/lib/feedview/feed/Links.svelte @@ -22,12 +22,3 @@ {/each} - - diff --git a/src/lib/feedview/feed/distributions/Distribution.svelte b/src/lib/feedview/feed/distributions/Distribution.svelte index 4f794b9..ea6143b 100644 --- a/src/lib/feedview/feed/distributions/Distribution.svelte +++ b/src/lib/feedview/feed/distributions/Distribution.svelte @@ -57,39 +57,3 @@
    {/each} {/if} - - diff --git a/src/lib/singleview/Droparea.svelte b/src/lib/singleview/Droparea.svelte index 4717fb9..12eb0c8 100644 --- a/src/lib/singleview/Droparea.svelte +++ b/src/lib/singleview/Droparea.svelte @@ -49,8 +49,8 @@ title="Drop a CSAF file here" class="droparea" class:hover - class:bg-error={valid == false} - class:bg-primary={valid == true} + class:droparea-error={valid == false} + class:droparea-okay={valid == true} on:dragover|preventDefault={() => { hover = true; }} @@ -63,16 +63,6 @@
    diff --git a/src/lib/singleview/Upload.svelte b/src/lib/singleview/Upload.svelte index 56b0545..3ef1c6e 100644 --- a/src/lib/singleview/Upload.svelte +++ b/src/lib/singleview/Upload.svelte @@ -23,36 +23,13 @@ } - - - +
    + +
    diff --git a/src/lib/singleview/acknowledgments/Acknowledgment.svelte b/src/lib/singleview/acknowledgments/Acknowledgment.svelte index 514047c..d8b7603 100644 --- a/src/lib/singleview/acknowledgments/Acknowledgment.svelte +++ b/src/lib/singleview/acknowledgments/Acknowledgment.svelte @@ -29,7 +29,7 @@ } - + {#if ack.urls} {/if} diff --git a/src/lib/singleview/general/General.svelte b/src/lib/singleview/general/General.svelte index d5456c1..ca0c608 100644 --- a/src/lib/singleview/general/General.svelte +++ b/src/lib/singleview/general/General.svelte @@ -210,43 +210,3 @@
{/if} - - diff --git a/src/lib/singleview/general/RevisionHistory.svelte b/src/lib/singleview/general/RevisionHistory.svelte index d013aca..3851bc3 100644 --- a/src/lib/singleview/general/RevisionHistory.svelte +++ b/src/lib/singleview/general/RevisionHistory.svelte @@ -17,10 +17,10 @@ - - - + > + + + @@ -35,22 +35,3 @@
DateNumberSummaryLegacy_versionDateNumberSummaryLegacy_version
{/if} - - diff --git a/src/lib/singleview/notes/Note.svelte b/src/lib/singleview/notes/Note.svelte index 8159a71..686f5a5 100644 --- a/src/lib/singleview/notes/Note.svelte +++ b/src/lib/singleview/notes/Note.svelte @@ -27,33 +27,16 @@ } - +
-
Text
+
Text
-Markdown -
- {@html DOMPurify.sanitize( - marked.parse(note.text.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, "")) - )} +
+ Markdown +
+ {@html DOMPurify.sanitize( + marked.parse(note.text.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, "")) + )} +
- - diff --git a/src/lib/singleview/producttree/branch/Branch.svelte b/src/lib/singleview/producttree/branch/Branch.svelte index 3b4e3b2..6235291 100644 --- a/src/lib/singleview/producttree/branch/Branch.svelte +++ b/src/lib/singleview/producttree/branch/Branch.svelte @@ -28,11 +28,3 @@ {/if}
- - diff --git a/src/lib/singleview/producttree/product/FileHash.svelte b/src/lib/singleview/producttree/product/FileHash.svelte index dbac43e..f76a038 100644 --- a/src/lib/singleview/producttree/product/FileHash.svelte +++ b/src/lib/singleview/producttree/product/FileHash.svelte @@ -16,9 +16,5 @@ {#each hash as hashEntry} - + {/each} diff --git a/src/lib/singleview/producttree/product/Product.svelte b/src/lib/singleview/producttree/product/Product.svelte index d89543f..4ff5536 100644 --- a/src/lib/singleview/producttree/product/Product.svelte +++ b/src/lib/singleview/producttree/product/Product.svelte @@ -34,7 +34,7 @@ { @@ -44,7 +44,7 @@ }} >
- + {#if product.product_identification_helper} {/if} diff --git a/src/lib/singleview/producttree/product/ProductIdentificationHelper.svelte b/src/lib/singleview/producttree/product/ProductIdentificationHelper.svelte index 3677640..efb7a37 100644 --- a/src/lib/singleview/producttree/product/ProductIdentificationHelper.svelte +++ b/src/lib/singleview/producttree/product/ProductIdentificationHelper.svelte @@ -17,10 +17,14 @@
-
Product Version Helper
+ + + + +
Product Version Helper
{#if helper.cpe} - + {/if} {#if helper.hashes} {#each helper.hashes as hash} @@ -31,7 +35,7 @@ {/if} {#if helper.purl} - + {/if} {#if helper.sbom_urls} @@ -47,12 +51,3 @@ {/if}
- - diff --git a/src/lib/singleview/producttree/product/ProductName.svelte b/src/lib/singleview/producttree/product/ProductName.svelte index 4d36390..129b2fd 100644 --- a/src/lib/singleview/producttree/product/ProductName.svelte +++ b/src/lib/singleview/producttree/product/ProductName.svelte @@ -21,7 +21,7 @@
{ @@ -30,11 +30,7 @@ } }} > - + {#if product.product_identification_helper} {/if} diff --git a/src/lib/singleview/producttree/product/XGenericURI.svelte b/src/lib/singleview/producttree/product/XGenericURI.svelte index 6c34fae..275bdf4 100644 --- a/src/lib/singleview/producttree/product/XGenericURI.svelte +++ b/src/lib/singleview/producttree/product/XGenericURI.svelte @@ -18,15 +18,6 @@

X Generic URIs

{#each x_generic_uris as uri} - + {/each}
- - diff --git a/src/lib/singleview/productvulnerabilities/ProductVulnerabilities.svelte b/src/lib/singleview/productvulnerabilities/ProductVulnerabilities.svelte index d99f947..d151033 100644 --- a/src/lib/singleview/productvulnerabilities/ProductVulnerabilities.svelte +++ b/src/lib/singleview/productvulnerabilities/ProductVulnerabilities.svelte @@ -50,9 +50,9 @@ {#if productLines.length > 0}
- +
- + {#each headerColumns as column, index} {#if index == 0} @@ -71,7 +71,7 @@ {#each line as column, index} {#if index < 1} -
-
-
Legend
-
-
-
Fixed
-
-
Under investigation
-
-
Known affected
-
-
Not affected
-
-
Recommended
-
-
+
Legend
+
+
+
Fixed
+
+
Under investigation
+
+
Known affected
+
+
Not affected
+
+
Recommended
+
{/if} - - diff --git a/src/lib/singleview/references/Reference.svelte b/src/lib/singleview/references/Reference.svelte index cbc273d..f052dfa 100644 --- a/src/lib/singleview/references/Reference.svelte +++ b/src/lib/singleview/references/Reference.svelte @@ -25,11 +25,5 @@
- +
- - diff --git a/src/lib/singleview/references/References.svelte b/src/lib/singleview/references/References.svelte index 0857c55..2545b0b 100644 --- a/src/lib/singleview/references/References.svelte +++ b/src/lib/singleview/references/References.svelte @@ -17,7 +17,7 @@ {#each references as reference, index} {#if references.length > 1 && index < references.length - 1} -
+
{/if} {/each} {/if} diff --git a/src/lib/singleview/vulnerabilities/vulnerability/GeneralSection.svelte b/src/lib/singleview/vulnerabilities/vulnerability/GeneralSection.svelte index bb732f5..68a9f0b 100644 --- a/src/lib/singleview/vulnerabilities/vulnerability/GeneralSection.svelte +++ b/src/lib/singleview/vulnerabilities/vulnerability/GeneralSection.svelte @@ -35,4 +35,4 @@ } - + diff --git a/src/lib/singleview/vulnerabilities/vulnerability/ID.svelte b/src/lib/singleview/vulnerabilities/vulnerability/ID.svelte index 4e95c31..4cb2a3c 100644 --- a/src/lib/singleview/vulnerabilities/vulnerability/ID.svelte +++ b/src/lib/singleview/vulnerabilities/vulnerability/ID.svelte @@ -19,7 +19,6 @@ {#each vulnerabilityIds as vulnerabilityID} diff --git a/src/lib/singleview/vulnerabilities/vulnerability/flags/Flags.svelte b/src/lib/singleview/vulnerabilities/vulnerability/flags/Flags.svelte index c467ae8..4b6da9c 100644 --- a/src/lib/singleview/vulnerabilities/vulnerability/flags/Flags.svelte +++ b/src/lib/singleview/vulnerabilities/vulnerability/flags/Flags.svelte @@ -33,9 +33,3 @@ {/each} {/if} - - diff --git a/src/lib/singleview/vulnerabilities/vulnerability/productStatus/ProductStatus.svelte b/src/lib/singleview/vulnerabilities/vulnerability/productStatus/ProductStatus.svelte index a78e33d..32fdf25 100644 --- a/src/lib/singleview/vulnerabilities/vulnerability/productStatus/ProductStatus.svelte +++ b/src/lib/singleview/vulnerabilities/vulnerability/productStatus/ProductStatus.svelte @@ -64,9 +64,3 @@ {/if} - - diff --git a/src/lib/singleview/vulnerabilities/vulnerability/productStatus/ProductStatusValueList.svelte b/src/lib/singleview/vulnerabilities/vulnerability/productStatus/ProductStatusValueList.svelte index 2b81141..7286469 100644 --- a/src/lib/singleview/vulnerabilities/vulnerability/productStatus/ProductStatusValueList.svelte +++ b/src/lib/singleview/vulnerabilities/vulnerability/productStatus/ProductStatusValueList.svelte @@ -28,7 +28,7 @@ {#if $appStore.doc}

{label}

-
{column}
{$appStore.doc.productsByID[column]} ({column})