From d45f2f37c63641b69560415c4fb17cc8de5383e8 Mon Sep 17 00:00:00 2001 From: Sergio Eduardo Castro Ceballos <72516762+SergioCasCeb@users.noreply.github.com> Date: Fri, 19 Jan 2024 16:52:52 +0100 Subject: [PATCH] Added icon source links, and attribution in readme file --- packages/web-new/README.md | 21 +- packages/web-new/src/scripts/console.js | 16 +- packages/web-new/src/scripts/editor.js | 4 + packages/web-new/src/scripts/examples-menu.js | 6 +- packages/web-new/src/scripts/main.js | 16 +- packages/web-new/src/scripts/util.js | 146 +++---- packages/web-new/src/template.html | 378 +++++------------- 7 files changed, 197 insertions(+), 390 deletions(-) diff --git a/packages/web-new/README.md b/packages/web-new/README.md index 2f60e13fc..a36bdfb1e 100644 --- a/packages/web-new/README.md +++ b/packages/web-new/README.md @@ -22,14 +22,17 @@ This package provides the new web interface of the Web of Things Playground. It Licensed under the MIT license, see [License](../../LICENSE.md). +## Icon + +Icons used in this project (excluding the TD file icon) are sourced from FontAwesome Free 6.5.1 by @fontawesome - [FontAwesome](https://fontawesome.com). +License information can be found here: [FontAwesome License](https://fontawesome.com/license/free). Copyright © 2024 Fonticons, Inc. + ## How to use - Online: It is hosted [here](http://plugfest.thingweb.io/playground-new/) - Simply paste a TD or utilize an example from the examples menu and click on validate - The validation process will then start on the bottom console, where more information will be provided in case of errors or warnings -## Testing with Playwright - ## Webpack functionality and bundling This package is built by utilizing webpack, allowing to bundle and compile the projects JavaScript and CSS files. It also handles asset management and optimization. Below are the steps to understand the current configuration: @@ -50,27 +53,33 @@ The `webpack.config.js` file is used to set up Webpack for the project. It manag ### 3. Webpack Configuration Obejct **3.1 Entry Points** + - `entry`: Specifies the entry points for your application. In this case, there are two entry points: 'bundle' for JavaScript and 'styles' for CSS **3.2 Output** + - `output`: Specifies where Webpack should output the bundled files. The path property defines the output directory as 'dist', and the filename property determines the naming pattern for generated files. [name] is a placeholder for the entry point name, and [contenthash] is a unique hash based on file content - `clean`: Tells Webpack to clean the 'dist' directory before each build - `assetModuleFilename`: Specifies the filename for asset files **3.3 Development Server** + - `devServer`: Configures the development server with settings such as the port, compressing assets, and enabling history API fallback **3.4 Module Rules** + - `module`: Defines rules for how Webpack should process different file types. There are rules for JavaScript, images, CSS, and more. For example, it uses Babel to transpile JavaScript, handles image assets, and processes CSS with style loaders and sass loaders **3.5 Plugins** -- `plugins`: Lists the plugins used in the build process. Key plugins include - - `HtmlWebpackPlugin` for generating HTML files, - - `CopyWebpackPlugin` for copying assets, - - `MonacoWebpackPlugin` for the Monaco code editor integration, and + +- `plugins`: Lists the plugins used in the build process. Key plugins include + - `HtmlWebpackPlugin` for generating HTML files, + - `CopyWebpackPlugin` for copying assets, + - `MonacoWebpackPlugin` for the Monaco code editor integration, and - `MiniCssExtractPlugin` for extracting CSS into separate files **3.6 Optimization** + - `optimization`: Contains settings for optimizing the build, including minimizing CSS using `CssMinimizerPlugin` diff --git a/packages/web-new/src/scripts/console.js b/packages/web-new/src/scripts/console.js index e74c0947a..ca46cdb36 100644 --- a/packages/web-new/src/scripts/console.js +++ b/packages/web-new/src/scripts/console.js @@ -37,9 +37,7 @@ import { textIcon } from './main.js' //Main console elements const errorContainer = document.querySelector(".console__content #console-error") const errorTxt = document.querySelector(".console-error__txt") -const minMaxBtn = document.querySelector(".min-max") -export const collapseArrows = minMaxBtn.querySelector(".collapse-arrows") -export const expandArrows = minMaxBtn.querySelector(".expand-arrows") +export const minMaxBtn = document.querySelector(".min-max") export const visualizationOptions = document.querySelectorAll(".visualizations__option") export const visualizationContainers = document.querySelectorAll(".console-view") export const consoleElement = document.querySelector(".console") @@ -48,6 +46,7 @@ const mainContentElement = document.querySelector(".main-content") /** * Hides the text from the left control panel, updates the state of the console element * and adjusts the console size as well as the expand/collapse icon + * *Collapse arrows gotten from: https://fontawesome.com/icons/down-left-and-up-right-to-center?f=classic&s=solid */ function expandConsole() { textIcon.forEach(text => { @@ -60,14 +59,16 @@ function expandConsole() { setTimeout(() => { mainContentElement.style.flex = "0 210px" consoleElement.style.flex = `1 0` - collapseArrows.classList.remove("hidden") - expandArrows.classList.add("hidden") + minMaxBtn.children[0].children[0].setAttribute("d", "M439 7c9.4-9.4 24.6-9.4 33.9 0l32 32c9.4 9.4 9.4 24.6 0 33.9l-87 87 39 39c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8H296c-13.3 0-24-10.7-24-24V72c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2l39 39L439 7zM72 272H216c13.3 0 24 10.7 24 24V440c0 9.7-5.8 18.5-14.8 22.2s-19.3 1.7-26.2-5.2l-39-39L73 505c-9.4 9.4-24.6 9.4-33.9 0L7 473c-9.4-9.4-9.4-24.6 0-33.9l87-87L55 313c-6.9-6.9-8.9-17.2-5.2-26.2s12.5-14.8 22.2-14.8z") + minMaxBtn.children[0].classList.remove("expand-arrows") + minMaxBtn.children[0].classList.add("collapse-arrows") }, 100); } /** * Shows the text from the left control panel, updates the state of the console element * and adjusts the console size as well as the expand/collapse icon + * *Expand arrows gotten from: https://fontawesome.com/icons/up-right-and-down-left-from-center?f=classic&s=solid */ function collapseConsole() { textIcon.forEach(text => { @@ -79,8 +80,9 @@ function collapseConsole() { mainContentElement.style.flex = "1 0" consoleElement.style.flex = `0 39px` - collapseArrows.classList.add("hidden") - expandArrows.classList.remove("hidden") + minMaxBtn.children[0].children[0].setAttribute("d", "M344 0H488c13.3 0 24 10.7 24 24V168c0 9.7-5.8 18.5-14.8 22.2s-19.3 1.7-26.2-5.2l-39-39-87 87c-9.4 9.4-24.6 9.4-33.9 0l-32-32c-9.4-9.4-9.4-24.6 0-33.9l87-87L327 41c-6.9-6.9-8.9-17.2-5.2-26.2S334.3 0 344 0zM168 512H24c-13.3 0-24-10.7-24-24V344c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2l39 39 87-87c9.4-9.4 24.6-9.4 33.9 0l32 32c9.4 9.4 9.4 24.6 0 33.9l-87 87 39 39c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8z") + minMaxBtn.children[0].classList.add("expand-arrows") + minMaxBtn.children[0].classList.remove("collapse-arrows") } minMaxBtn.addEventListener("click", () => { diff --git a/packages/web-new/src/scripts/editor.js b/packages/web-new/src/scripts/editor.js index f37ee40b6..29a075aa3 100644 --- a/packages/web-new/src/scripts/editor.js +++ b/packages/web-new/src/scripts/editor.js @@ -94,6 +94,7 @@ function createTab(tabNumber, exampleName, thingType) { closeBtn.classList.add("close-tab") // Create the svg close icon + // Close icon gotten from: https://fontawesome.com/icons/xmark?f=classic&s=solid const closeIconSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg") closeIconSvg.setAttribute("xmlns", "http://www.w3.org/2000/svg") closeIconSvg.setAttribute("width", "100%") @@ -120,7 +121,9 @@ function createTab(tabNumber, exampleName, thingType) { const confirmTabClose = document.createElement("button") confirmTabClose.classList.add("confirm-tab-close") confirmTabClose.textContent = "Close" + // Create the svg confirm close icon + // Check icon gotten from: https://fontawesome.com/icons/check?f=classic&s=solid const confirmIconSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg") confirmIconSvg.setAttribute("xmlns", "http://www.w3.org/2000/svg") confirmIconSvg.setAttribute("width", "100%") @@ -145,6 +148,7 @@ function createTab(tabNumber, exampleName, thingType) { cancelTabClose.textContent = "Cancel" // Create the svg close cancel icon + // Close icon gotten from: https://fontawesome.com/icons/xmark?f=classic&s=solid const cancelIconSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg") cancelIconSvg.setAttribute("xmlns", "http://www.w3.org/2000/svg") cancelIconSvg.setAttribute("width", "100%") diff --git a/packages/web-new/src/scripts/examples-menu.js b/packages/web-new/src/scripts/examples-menu.js index 764a45e9e..aefa3228e 100644 --- a/packages/web-new/src/scripts/examples-menu.js +++ b/packages/web-new/src/scripts/examples-menu.js @@ -280,10 +280,6 @@ async function getAllExamples(categoryId, thingType) { tdFilePath.setAttribute("clip-rule", "evenodd") tdFilePath.setAttribute("d", "M184 0V95.9981C184 107.044 192.954 115.998 204 115.998H300V190H106C89.4315 190 76 203.431 76 220V379H40C17.9086 379 0 361.091 0 339V40C0 17.9086 17.9086 0 40 0H184ZM204 95.9981V4.28427L295.714 95.9981H204ZM189.758 379V265.724H231.32V243.922H189.758H162.019H121.105V265.724H162.019V379H189.758ZM275.017 379H288.654C297.808 379 306.158 377.485 313.703 374.454C321.311 371.362 327.836 367.001 333.278 361.373C338.783 355.683 343.02 348.88 345.988 340.963C349.019 333.046 350.534 324.295 350.534 314.708V308.307C350.534 298.658 349.019 289.907 345.988 282.052C343.02 274.135 338.783 267.332 333.278 261.642C327.774 255.951 321.249 251.591 313.703 248.561C306.219 245.468 297.963 243.922 288.933 243.922H275.017H258.688H247.185V379H259.245H275.017ZM275.017 357.291H288.654C295.952 357.291 302.106 355.652 307.116 352.374C312.126 349.034 315.899 344.179 318.435 337.809C321.032 331.438 322.331 323.738 322.331 314.708V308.121C322.331 301.194 321.589 295.102 320.104 289.845C318.682 284.588 316.548 280.165 313.703 276.578C310.858 272.991 307.364 270.3 303.22 268.507C299.076 266.651 294.313 265.724 288.933 265.724H275.017V357.291Z") - //Create and append Font Awesome attribution comment - const commentTDFile = document.createComment(" !Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc. ") - tdFileSvg.appendChild(commentTDFile) - // Append the path element to the SVG element tdFileSvg.appendChild(tdFilePath) @@ -300,6 +296,7 @@ async function getAllExamples(categoryId, thingType) { exampleName.appendChild(exampleNameTitle) //Create, populate and append the example title toggle arrow + // Arrow icon gotten from: https://fontawesome.com/icons/angle-down?f=classic&s=solid const exampleArrowSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg") exampleArrowSvg.setAttribute("xmlns", "http://www.w3.org/2000/svg") exampleArrowSvg.setAttribute("width", "100%") @@ -362,6 +359,7 @@ async function getAllExamples(categoryId, thingType) { exampleBtns.appendChild(exampleBtnUse) // create the svg icon for the apply button + // Apply icon gotten from: https://fontawesome.com/icons/file-import?f=classic&s=solid const applyIconSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg") applyIconSvg.setAttribute("xmlns", "http://www.w3.org/2000/svg") applyIconSvg.setAttribute("width", "100%") diff --git a/packages/web-new/src/scripts/main.js b/packages/web-new/src/scripts/main.js index 8c380d91b..5982fd101 100644 --- a/packages/web-new/src/scripts/main.js +++ b/packages/web-new/src/scripts/main.js @@ -26,7 +26,7 @@ import './json-yaml' import './settings-menu' import './save-menu' import './examples-menu' -import { consoleElement, expandArrows, collapseArrows } from './console' +import { consoleElement, minMaxBtn } from './console' import './open-api' import './async-api' import './aas' @@ -165,12 +165,13 @@ function onmousemoveY(e) { b.style.flex = `0 ${h < 50 ? 39 : h}px` t.style.flex = "1 0" - if(h < 39){ + if (h < 39) { consoleElement.classList.remove("expanded") consoleElement.classList.add("collapsed") - collapseArrows.classList.add("hidden") - expandArrows.classList.remove("hidden") + minMaxBtn.children[0].children[0].setAttribute("d", "M344 0H488c13.3 0 24 10.7 24 24V168c0 9.7-5.8 18.5-14.8 22.2s-19.3 1.7-26.2-5.2l-39-39-87 87c-9.4 9.4-24.6 9.4-33.9 0l-32-32c-9.4-9.4-9.4-24.6 0-33.9l87-87L327 41c-6.9-6.9-8.9-17.2-5.2-26.2S334.3 0 344 0zM168 512H24c-13.3 0-24-10.7-24-24V344c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2l39 39 87-87c9.4-9.4 24.6-9.4 33.9 0l32 32c9.4 9.4 9.4 24.6 0 33.9l-87 87 39 39c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8z") + minMaxBtn.children[0].classList.add("expand-arrows") + minMaxBtn.children[0].classList.remove("collapse-arrows") } if (h < 445) { @@ -185,12 +186,13 @@ function onmousemoveY(e) { t.style.flex = `0 ${h < 220 ? 210 : h}px` b.style.flex = "1 0" - if ( h > 714 ){ + if (h > 714) { consoleElement.classList.remove("collapsed") consoleElement.classList.add("expanded") - expandArrows.classList.add("hidden") - collapseArrows.classList.remove("hidden") + minMaxBtn.children[0].children[0].setAttribute("d", "M439 7c9.4-9.4 24.6-9.4 33.9 0l32 32c9.4 9.4 9.4 24.6 0 33.9l-87 87 39 39c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8H296c-13.3 0-24-10.7-24-24V72c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2l39 39L439 7zM72 272H216c13.3 0 24 10.7 24 24V440c0 9.7-5.8 18.5-14.8 22.2s-19.3 1.7-26.2-5.2l-39-39L73 505c-9.4 9.4-24.6 9.4-33.9 0L7 473c-9.4-9.4-9.4-24.6 0-33.9l87-87L55 313c-6.9-6.9-8.9-17.2-5.2-26.2s12.5-14.8 22.2-14.8z") + minMaxBtn.children[0].classList.remove("expand-arrows") + minMaxBtn.children[0].classList.add("collapse-arrows") } if (h < 310) { diff --git a/packages/web-new/src/scripts/util.js b/packages/web-new/src/scripts/util.js index aed76a227..48ebf8620 100644 --- a/packages/web-new/src/scripts/util.js +++ b/packages/web-new/src/scripts/util.js @@ -221,6 +221,10 @@ export function removeDefaultsUtil(editorInstance) { * @param {string} body Thing Description/Thing Model to validate * @param {string} docType "td" or "tm" * @param {*} source "manual" or "auto" + * *Neutral circle icon gotten from: https://fontawesome.com/icons/circle?f=classic&s=solid + * *Success circle icon gotten from: https://fontawesome.com/icons/circle-check?f=classic&s=solid + * *Warning circle icon gotten from: https://fontawesome.com/icons/circle-exclamation?f=classic&s=solid + * *Error circle icon gotten from: https://fontawesome.com/icons/circle-xmark?f=classic&s=solid */ export function validate(thingType, editorContent) { @@ -236,41 +240,25 @@ export function validate(thingType, editorContent) { Object.keys(result.report).forEach(el => { const spotName = "spot-" + el document.getElementById(spotName).removeAttribute('open') - const resultIcons = document.getElementById(spotName).children[0].children[0].querySelectorAll(".icon") - - resultIcons.forEach(icon => { - if (!icon.classList.contains("hidden")) { - icon.classList.add("hidden") - } - }) + const resultIcon = document.getElementById(spotName).children[0].children[0].children[0] if (result.report[el] === "passed") { - resultIcons.forEach(icon => { - if (icon.classList.contains("success-circle-icon")) { - icon.classList.remove("hidden") - } - }) + resultIcon.children[0].setAttribute("d", "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z") + resultIcon.classList.remove("neutral-circle-icon") + resultIcon.classList.add("success-circle-icon") } else if (result.report[el] === "warning") { - resultIcons.forEach(icon => { - if (icon.classList.contains("warning-circle-icon")) { - icon.classList.remove("hidden") - } - }) + resultIcon.children[0].setAttribute("d", "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z") + resultIcon.classList.remove("neutral-circle-icon") + resultIcon.classList.add("warning-circle-icon") } else if (result.report[el] === "failed") { - resultIcons.forEach(icon => { - if (icon.classList.contains("error-circle-icon")) { - icon.classList.remove("hidden") - } - }) + resultIcon.children[0].setAttribute("d", "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z") + resultIcon.classList.remove("neutral-circle-icon") + resultIcon.classList.add("error-circle-icon") } else if (result.report[el] === null) { - resultIcons.forEach(icon => { - if (icon.classList.contains("neutral-circle-icon")) { - icon.classList.remove("hidden") - } - }) + // do nothing } else { console.error("unknown report feedback value") @@ -281,41 +269,25 @@ export function validate(thingType, editorContent) { const detailsName = el + "-section" if (document.getElementById(detailsName)) { document.getElementById(detailsName).removeAttribute('open') - const detailsIcons = document.getElementById(detailsName).children[0].children[0].querySelectorAll(".icon") - - detailsIcons.forEach(icon => { - if (!icon.classList.contains("hidden")) { - icon.classList.add("hidden") - } - }) + const detailsIcon = document.getElementById(detailsName).children[0].children[0].children[0] if (result.details[el] === "passed") { - detailsIcons.forEach(icon => { - if (icon.classList.contains("success-circle-icon")) { - icon.classList.remove("hidden") - } - }) + detailsIcon.children[0].setAttribute("d", "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z") + detailsIcon.classList.remove("neutral-circle-icon") + detailsIcon.classList.add("success-circle-icon") } else if (result.details[el] === "warning" || result.details[el] === "not-impl") { - detailsIcons.forEach(icon => { - if (icon.classList.contains("warning-circle-icon")) { - icon.classList.remove("hidden") - } - }) + detailsIcon.children[0].setAttribute("d", "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z") + detailsIcon.classList.remove("neutral-circle-icon") + detailsIcon.classList.add("warning-circle-icon") } else if (result.details[el] === "failed") { - detailsIcons.forEach(icon => { - if (icon.classList.contains("error-circle-icon")) { - icon.classList.remove("hidden") - } - }) + detailsIcon.children[0].setAttribute("d", "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z") + detailsIcon.classList.remove("neutral-circle-icon") + detailsIcon.classList.add("error-circle-icon") } else if (result.details[el] === null) { - detailsIcons.forEach(icon => { - if (icon.classList.contains("neutral-circle-icon")) { - icon.classList.remove("hidden") - } - }) + // do nothing } else { console.error("unknown report feedback value") @@ -346,15 +318,13 @@ export function resetValidationStatus() { } sectionHeaders.forEach(header => { - const headerIcons = header.children[0].querySelectorAll(".icon") - headerIcons.forEach(icon => { - if (!icon.classList.contains("hidden")) { - icon.classList.add("hidden") - } - if (icon.classList.contains("neutral-circle-icon")) { - icon.classList.remove("hidden") - } - }) + const headerIcon = header.children[0].children[0] + + if(!headerIcon.classList.contains("neutral-circle-icon")){ + headerIcon.children[0].setAttribute("d", "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512z") + headerIcon.classList.remove("success-circle-icon", "warning-circle-icon", "error-circle-icon") + headerIcon.classList.add("neutral-circle-icon") + } }) document.querySelectorAll("#spot-json, #spot-schema, #spot-defaults, #spot-jsonld, #spot-additional").forEach(category => { @@ -386,33 +356,29 @@ function populateCategory(messagesList) { const categoryContainer = category.querySelector("ul.section-content") category.classList.remove("disabled") - const categoryIcons = category.children[0].children[0].querySelectorAll(".icon") - - categoryIcons.forEach(icon => { - if (!icon.classList.contains("hidden")) { - if (icon.classList.contains("error-circle-icon") || icon.classList.contains("warning-circle-icon")) { - const noticePrompt = document.createElement("p") - noticePrompt.textContent = "*This feature is still in the testing phase, and it may not refer to the correct source of the error*" - noticePrompt.classList.add("notice-prompt") - categoryContainer.append(noticePrompt) - messagesList.forEach(message => { - const listElement = document.createElement("li") - listElement.textContent = message - categoryContainer.append(listElement) - }) - } - else if (icon.classList.contains("success-circle-icon")) { - const successMessage = document.createElement("li") - successMessage.textContent = "Validated Successfully" - categoryContainer.append(successMessage) - } - else { - const nullMessage = document.createElement("li") - nullMessage.textContent = "A previous validation has failed or it is only available for Thing Descriptions" - categoryContainer.append(nullMessage) - } - } - }) + const categoryIcon = category.children[0].children[0].children[0] + + if (categoryIcon.classList.contains("error-circle-icon") || categoryIcon.classList.contains("warning-circle-icon")) { + const noticePrompt = document.createElement("p") + noticePrompt.textContent = "*This feature is still in the testing phase, and it may not refer to the correct source of the error*" + noticePrompt.classList.add("notice-prompt") + categoryContainer.append(noticePrompt) + messagesList.forEach(message => { + const listElement = document.createElement("li") + listElement.textContent = message + categoryContainer.append(listElement) + }) + } + else if (categoryIcon.classList.contains("success-circle-icon")) { + const successMessage = document.createElement("li") + successMessage.textContent = "Validated Successfully" + categoryContainer.append(successMessage) + } + else { + const nullMessage = document.createElement("li") + nullMessage.textContent = "A previous validation has failed or it is only available for Thing Descriptions" + categoryContainer.append(nullMessage) + } }) } diff --git a/packages/web-new/src/template.html b/packages/web-new/src/template.html index 643050b3e..1048c84c3 100644 --- a/packages/web-new/src/template.html +++ b/packages/web-new/src/template.html @@ -177,6 +177,7 @@

Thing Description Playground

+ @@ -187,6 +188,7 @@

Thing Description Playground

+ @@ -196,6 +198,7 @@

Thing Description Playground

+ @@ -215,6 +218,7 @@

Thing Description Playground

+ @@ -225,6 +229,7 @@

Thing Description Playground

+ @@ -235,6 +240,7 @@

Thing Description Playground

+ @@ -245,6 +251,7 @@

Thing Description Playground

+ @@ -259,6 +266,7 @@

Thing Description Playground

+ @@ -298,15 +306,11 @@

Thing Description Playground

+ + - @@ -319,32 +323,19 @@

Thing Description Playground

+ + + + - - -

JSON Validation

+ @@ -358,32 +349,19 @@

Thing Description Playground

+ + + + - - -

JSON Schema Validation

+ @@ -397,32 +375,19 @@

Thing Description Playground

+ + + + - - -

(With Defaults) JSON Schema Validation

+ @@ -436,32 +401,19 @@

Thing Description Playground

+ + + + - - -

JSON-LD Validation

+ @@ -475,32 +427,19 @@

Thing Description Playground

+ + + + - - -

Additional Checks

+ @@ -513,32 +452,19 @@

Thing Description Playground

+ + + + - - -

Enum/Const

+ @@ -554,32 +480,19 @@

Thing Description Playground

+ + + + - - -

Linked Affordances

+ @@ -595,32 +508,19 @@

Thing Description Playground

+ + + + - - -

Linked Structure

+ @@ -636,32 +536,19 @@

Thing Description Playground

+ + + + - - -

Links Rel:Type Count

+ @@ -677,32 +564,19 @@

Thing Description Playground

+ + + + - - -

Multi-Language Consistency

+ @@ -718,32 +592,19 @@

Thing Description Playground

+ + + + - - -

Properties Items

+ @@ -759,32 +620,19 @@

Thing Description Playground

+ + + + - - -

Properties Uniqueness

+ @@ -800,32 +648,19 @@

Thing Description Playground

+ + + + - - -

Read/WriteOnly

+ @@ -841,32 +676,19 @@

Thing Description Playground

+ + + + - - -

Security

+ @@ -882,32 +704,19 @@

Thing Description Playground

+ + + + - - -

URI Variable Security

+ @@ -933,6 +742,7 @@

Thing Description Playground

+ @@ -954,6 +764,7 @@

Thing Description Playground

+ @@ -973,6 +784,7 @@

Thing Description Playground

+ Download @@ -993,6 +805,7 @@

Thing Description Playground

+ @@ -1002,6 +815,7 @@

Thing Description Playground

+ @@ -1013,6 +827,7 @@

Thing Description Playground

+ @@ -1041,6 +856,7 @@

Thing Description Playground

+ @@ -1051,6 +867,7 @@

Thing Description Playground

+ @@ -1070,6 +887,7 @@

Thing Description Playground

+ @@ -1079,6 +897,7 @@

Thing Description Playground

+ @@ -1103,6 +922,7 @@

Thing Description Playground

+ @@ -1175,6 +995,7 @@

Preferences

+ @@ -1201,6 +1022,7 @@

Preferences

+ @@ -1241,6 +1063,7 @@

Search Results

+ @@ -1260,6 +1083,7 @@

Search Results

+ @@ -1270,6 +1094,7 @@

Search Results

+ @@ -1285,6 +1110,7 @@

Search Results

+