From e54c43593b3396eeff5c4eeb1f481b41b14d507c Mon Sep 17 00:00:00 2001 From: Ricardo M G da Silva Date: Tue, 9 Dec 2025 18:46:42 +0000 Subject: [PATCH 01/11] fix add getJsonldString for typescript check Signed-off-by: Ricardo Silva --- src/utils/arrays.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/utils/arrays.ts b/src/utils/arrays.ts index 1d3cb4f6..e3e735f3 100644 --- a/src/utils/arrays.ts +++ b/src/utils/arrays.ts @@ -45,3 +45,15 @@ export const getErrorSummary = (array: { errorCount, }; }; + +export function getJsonLdString( + obj: unknown, + path: string[] +): string | undefined { + let cur: any = obj; + for (const key of path) { + if (!cur || typeof cur !== "object") return undefined; + cur = cur[key]; + } + return typeof cur === "string" ? cur : undefined; +} From 239e3465a38d22df016042923a5c18bef288d8ea Mon Sep 17 00:00:00 2001 From: Ricardo M G da Silva Date: Tue, 9 Dec 2025 23:37:29 +0000 Subject: [PATCH 02/11] BREACKING CHANGE: refactor, extended typescript checks Signed-off-by: Ricardo M G da Silva --- src/components/App/AppHeader.tsx | 4 +- src/components/App/Button.tsx | 16 -- src/components/App/ContributeToCatalog.tsx | 139 +++++++++++ src/components/App/ConvertTm.tsx | 0 .../FormCreateTd.tsx => App/CreateTd.tsx} | 12 +- .../{Dialogs/base => App}/FormInteraction.tsx | 55 ++--- .../{Dialogs/base => App}/FormMetadata.tsx | 10 +- .../{Dialogs/base => App}/FormSubmission.tsx | 4 +- .../{Dialogs/base => App}/ProgressBar.tsx | 0 src/components/App/SendTD.tsx | 138 +++++++++++ src/components/App/base/Button.tsx | 29 +++ .../{Dialogs => App}/base/FormField.tsx | 0 src/components/App/{ => base}/TmInputForm.tsx | 0 ...alog.tsx => ContributeToCatalogDialog.tsx} | 114 ++++----- src/components/Dialogs/ConvertTmDialog.tsx | 3 +- src/components/Dialogs/CreateTdDialog.tsx | 6 +- src/components/Dialogs/SendTDDialog.tsx | 88 +------ src/context/ContributeToCatalogState.tsx | 55 ----- src/types/context.d.ts | 218 +++++++++++------- src/types/global.d.ts | 82 +++---- 20 files changed, 581 insertions(+), 392 deletions(-) delete mode 100644 src/components/App/Button.tsx create mode 100644 src/components/App/ContributeToCatalog.tsx create mode 100644 src/components/App/ConvertTm.tsx rename src/components/{Dialogs/base/FormCreateTd.tsx => App/CreateTd.tsx} (97%) rename src/components/{Dialogs/base => App}/FormInteraction.tsx (90%) rename src/components/{Dialogs/base => App}/FormMetadata.tsx (95%) rename src/components/{Dialogs/base => App}/FormSubmission.tsx (97%) rename src/components/{Dialogs/base => App}/ProgressBar.tsx (100%) create mode 100644 src/components/App/SendTD.tsx create mode 100644 src/components/App/base/Button.tsx rename src/components/{Dialogs => App}/base/FormField.tsx (100%) rename src/components/App/{ => base}/TmInputForm.tsx (100%) rename src/components/Dialogs/{ContributeToCatalog.tsx => ContributeToCatalogDialog.tsx} (85%) diff --git a/src/components/App/AppHeader.tsx b/src/components/App/AppHeader.tsx index 4fdb2a14..78e1924f 100644 --- a/src/components/App/AppHeader.tsx +++ b/src/components/App/AppHeader.tsx @@ -35,9 +35,9 @@ import ConvertTmDialog from "../Dialogs/ConvertTmDialog"; import CreateTdDialog from "../Dialogs/CreateTdDialog"; import SettingsDialog from "../Dialogs/SettingsDialog"; import ShareDialog from "../Dialogs/ShareDialog"; -import ContributeToCatalog from "../Dialogs/ContributeToCatalog"; +import ContributeToCatalog from "../Dialogs/ContributeToCatalogDialog"; import ErrorDialog from "../Dialogs/ErrorDialog"; -import Button from "./Button"; +import Button from "./base/Button"; import SendTDDialog from "../Dialogs/SendTDDialog"; import { getLocalStorage } from "../../services/localStorage"; import type { ThingDescription } from "wot-thing-description-types"; diff --git a/src/components/App/Button.tsx b/src/components/App/Button.tsx deleted file mode 100644 index bd175c85..00000000 --- a/src/components/App/Button.tsx +++ /dev/null @@ -1,16 +0,0 @@ -interface IButtonProps { - onClick: () => void; - children: React.ReactNode; -} - -const Button: React.FC = ({ onClick, children }) => { - return ( - - ); -}; - -export default Button; diff --git a/src/components/App/ContributeToCatalog.tsx b/src/components/App/ContributeToCatalog.tsx new file mode 100644 index 00000000..267092c1 --- /dev/null +++ b/src/components/App/ContributeToCatalog.tsx @@ -0,0 +1,139 @@ +import React from "react"; +import FormMetadata from "../App/FormMetadata"; +import FormInteraction from "../App/FormInteraction"; +import FormSubmission from "../App/FormSubmission"; +import type { FormElementBase } from "wot-thing-description-types"; + +interface ContributeToCatalogProps { + currentStep: number; + + // Step 1 - Metadata + metadata: { + model: string; + author: string; + manufacturer: string; + license: string; + copyrightYear: string; + holder: string; + validation: Validation; + errorMessage: string; + copied: boolean; + }; + onChangeModel: (e: React.ChangeEvent) => void; + onChangeAuthor: (e: React.ChangeEvent) => void; + onChangeManufacturer: (e: React.ChangeEvent) => void; + onChangeLicense: (e: React.ChangeEvent) => void; + onChangeCopyrightYear: (e: React.ChangeEvent) => void; + onChangeHolder: (e: React.ChangeEvent) => void; + onClickCatalogValidation: () => void; + onClickCopyThingModel: () => void; + + // Step 2 - Interaction + filteredHeaders: { key: string; text: string }[]; + filteredRows: (FormElementBase & { + id: string; + description: string; + propName: string; + title: string; + })[]; + backgroundTdToSend: ThingDescription; + interaction: ContributionToCatalogState["interaction"]; + dispatch: React.Dispatch; + handleFieldChange: (placeholder: string, value: string) => void; + + // Step 3 - Submission + submission: { + tmCatalogEndpoint: string; + tmCatalogEndpointError: string; + repository: string; + repositoryError: string; + submittedError: string; + submitted: boolean; + id: string; + link: string; + }; + handleTmCatalogEndpointChange: ( + e: React.ChangeEvent + ) => void; + handleRepositoryChange: (e: React.ChangeEvent) => void; + handleSubmit: () => Promise; +} + +const ContributeToCatalog: React.FC = ({ + currentStep, + metadata, + onChangeModel, + onChangeAuthor, + onChangeManufacturer, + onChangeLicense, + onChangeCopyrightYear, + onChangeHolder, + onClickCatalogValidation, + onClickCopyThingModel, + filteredHeaders, + filteredRows, + backgroundTdToSend, + interaction, + dispatch, + handleFieldChange, + submission, + handleTmCatalogEndpointChange, + handleRepositoryChange, + handleSubmit, +}) => { + return ( +
+ {currentStep === 1 && ( + + )} + + {currentStep === 2 && ( + + )} + + {currentStep === 3 && ( + + )} +
+ ); +}; + +export default ContributeToCatalog; diff --git a/src/components/App/ConvertTm.tsx b/src/components/App/ConvertTm.tsx new file mode 100644 index 00000000..e69de29b diff --git a/src/components/Dialogs/base/FormCreateTd.tsx b/src/components/App/CreateTd.tsx similarity index 97% rename from src/components/Dialogs/base/FormCreateTd.tsx rename to src/components/App/CreateTd.tsx index 0dcacff4..d7758386 100644 --- a/src/components/Dialogs/base/FormCreateTd.tsx +++ b/src/components/App/CreateTd.tsx @@ -12,13 +12,13 @@ ********************************************************************************/ import React from "react"; import { ChevronDown } from "react-feather"; -import { parseCsv, mapCsvToProperties } from "../../../utils/parser"; -import FormField from "./FormField"; -import BaseButton from "../../TDViewer/base/BaseButton"; +import { parseCsv, mapCsvToProperties } from "../../utils/parser"; +import FormField from "./base/FormField"; +import BaseButton from "../TDViewer/base/BaseButton"; type ThingType = "TD" | "TM"; -interface FormCreateTdProps { +interface CreateTdProps { type: ThingType; onChangeType: (e: React.ChangeEvent) => void; protocol: string; @@ -43,7 +43,7 @@ interface FormCreateTdProps { setThingSecurity: React.Dispatch>; } -const FormCreateTd: React.FC = ({ +const CreateTd: React.FC = ({ type, onChangeType, protocol, @@ -290,4 +290,4 @@ const FormCreateTd: React.FC = ({ ); }; -export default FormCreateTd; +export default CreateTd; diff --git a/src/components/Dialogs/base/FormInteraction.tsx b/src/components/App/FormInteraction.tsx similarity index 90% rename from src/components/Dialogs/base/FormInteraction.tsx rename to src/components/App/FormInteraction.tsx index b8104e58..15ffd34f 100644 --- a/src/components/Dialogs/base/FormInteraction.tsx +++ b/src/components/App/FormInteraction.tsx @@ -14,31 +14,27 @@ import React, { useRef, useContext, useEffect, useMemo } from "react"; import type { ThingDescription } from "wot-thing-description-types"; import { isEqual } from "lodash"; -import ediTDorContext from "../../../context/ediTDorContext"; -import BaseTable from "../../TDViewer/base/BaseTable"; -import BaseButton from "../../TDViewer/base/BaseButton"; -import { readPropertyWithServient } from "../../../services/form"; -import { extractIndexFromId } from "../../../utils/strings"; -import { getErrorSummary } from "../../../utils/arrays"; -import Settings, { SettingsData } from "../../App/Settings"; +import ediTDorContext from "../../context/ediTDorContext"; +import BaseTable from "../TDViewer/base/BaseTable"; +import BaseButton from "../TDViewer/base/BaseButton"; +import { readPropertyWithServient } from "../../services/form"; +import { extractIndexFromId } from "../../utils/strings"; +import { getErrorSummary } from "../../utils/arrays"; +import Settings, { SettingsData } from "./Settings"; import { ChevronDown, ChevronUp, AlertTriangle, RefreshCw, } from "react-feather"; -import TmInputForm from "../../App/TmInputForm"; -import { prepareTdForSubmission } from "../../../services/operations"; -import { readAllReadablePropertyForms } from "../../../services/thingsApiService"; +import TmInputForm from "./base/TmInputForm"; +import { prepareTdForSubmission } from "../../services/operations"; +import { readAllReadablePropertyForms } from "../../services/thingsApiService"; import { handleHttpRequest, fetchNorthboundTD, -} from "../../../services/thingsApiService"; -import { - ContributionToCatalogState, - ContributionToCatalogAction, -} from "../../../context/ContributeToCatalogState"; -import type { ActiveSection } from "../../../context/ContributeToCatalogState"; +} from "../../services/thingsApiService"; +import { ContributionToCatalogAction } from "../../context/ContributeToCatalogState"; interface IFormInteractionProps { filteredHeaders: { key: string; text: string }[]; @@ -126,26 +122,13 @@ const FormInteraction: React.FC = ({ }); return true; case "GATEWAY": - let gatewayIsValid = - settingsData.northboundUrl.trim() !== "" && - settingsData.southboundUrl.trim() !== "" && - settingsData.pathToValue.trim() !== ""; - if (!gatewayIsValid) { - dispatch({ - type: "SET_INTERACTION_SECTION_ERROR", - section: "gateway", - error: true, - message: "All fields in section Gateway must have values", - }); - return false; - } else { - dispatch({ - type: "SET_INTERACTION_SECTION_ERROR", - section: "gateway", - error: false, - message: "", - }); - } + dispatch({ + type: "SET_INTERACTION_SECTION_ERROR", + section: "gateway", + error: false, + message: "", + }); + return true; case "TABLE": return true; diff --git a/src/components/Dialogs/base/FormMetadata.tsx b/src/components/App/FormMetadata.tsx similarity index 95% rename from src/components/Dialogs/base/FormMetadata.tsx rename to src/components/App/FormMetadata.tsx index 3faaad00..2112dd74 100644 --- a/src/components/Dialogs/base/FormMetadata.tsx +++ b/src/components/App/FormMetadata.tsx @@ -11,11 +11,11 @@ * SPDX-License-Identifier: EPL-2.0 OR W3C-20150513 ********************************************************************************/ import React from "react"; -import DialogTextField from "./DialogTextField"; -import BaseButton from "../../TDViewer/base/BaseButton"; +import DialogTextField from "../Dialogs/base/DialogTextField"; +import BaseButton from "../TDViewer/base/BaseButton"; import { AlertTriangle, Check, RefreshCw } from "react-feather"; -import InfoIconWrapper from "../../InfoIcon/InfoIconWrapper"; -import { getValidateTMContent } from "../../InfoIcon/TooltipMapper"; +import InfoIconWrapper from "../InfoIcon/InfoIconWrapper"; +import { getValidateTMContent } from "../InfoIcon/TooltipMapper"; interface IFormMetadataProps { model: string; @@ -138,7 +138,7 @@ const FormMetadata: React.FC = ({
{isValidating ? ( <> - Validating + Validating ) : ( diff --git a/src/components/Dialogs/base/FormSubmission.tsx b/src/components/App/FormSubmission.tsx similarity index 97% rename from src/components/Dialogs/base/FormSubmission.tsx rename to src/components/App/FormSubmission.tsx index 65179ebf..35e3e6b0 100644 --- a/src/components/Dialogs/base/FormSubmission.tsx +++ b/src/components/App/FormSubmission.tsx @@ -11,8 +11,8 @@ * SPDX-License-Identifier: EPL-2.0 OR W3C-20150513 ********************************************************************************/ import React from "react"; -import DialogTextField from "./DialogTextField"; -import BaseButton from "../../TDViewer/base/BaseButton"; +import DialogTextField from "../Dialogs/base/DialogTextField"; +import BaseButton from "../TDViewer/base/BaseButton"; import { AlertTriangle, Check, Copy, ExternalLink } from "react-feather"; interface IFormSubmissionProps { diff --git a/src/components/Dialogs/base/ProgressBar.tsx b/src/components/App/ProgressBar.tsx similarity index 100% rename from src/components/Dialogs/base/ProgressBar.tsx rename to src/components/App/ProgressBar.tsx diff --git a/src/components/App/SendTD.tsx b/src/components/App/SendTD.tsx new file mode 100644 index 00000000..39d6b010 --- /dev/null +++ b/src/components/App/SendTD.tsx @@ -0,0 +1,138 @@ +import React from "react"; + +type RequestState = { + isLoading: boolean; + success: boolean; + message: string; + reason: string; +}; + +interface CreateTdProps { + isUpdate: boolean; + requestSend: RequestState; + requestUpdate: RequestState; + onSend: () => void; + onUpdate: () => void; + currentTdId: string; +} + +const RequestSuccessful: React.FC<{ message: string }> = ({ message }) => ( +
+ {message} +
+); + +const RequestFailed: React.FC<{ + errorMessage: string; + errorReason: string; +}> = ({ errorMessage, errorReason }) => ( +
+
Request failed
+
{errorMessage}
+ {errorReason && ( +
Reason: {errorReason}
+ )} +
+); + +const SpinnerTemplate: React.FC<{ fullScreen?: boolean }> = ({ + fullScreen, +}) => ( +
+
+
+); + +const CreateTd: React.FC = ({ + isUpdate, + requestSend, + requestUpdate, + onSend, + onUpdate, +}) => { + const renderDialogContent = () => { + const isLoading = requestUpdate.isLoading || requestSend.isLoading; + if (isLoading) return ; + + const displayRequest = + isUpdate && requestUpdate.message + ? requestUpdate + : requestSend.message + ? requestSend + : isUpdate + ? requestUpdate + : requestSend; + + if (!displayRequest || displayRequest.message === "") return <>; + + const operationType = displayRequest === requestSend ? "sent" : "updated"; + return displayRequest.success ? ( + + ) : ( + + ); + }; + + return ( +
+

Operation Details

+
+
+ Action: + + {isUpdate ? "Update Existing TD" : "Send New TD"} + +
+

+ {isUpdate + ? "You are updating an existing Thing Description that was previously sent to the server." + : "You are sending a new Thing Description to the server for the first time."} +

+
+ +
+

Result:

+
+

+ {requestSend.message + ? requestSend.message + : isUpdate + ? requestUpdate.message || "No update request made yet." + : "No send request made yet."} +

+ +
+ {isUpdate ? ( + + ) : ( + + )} +
+ +
{renderDialogContent()}
+
+
+
+ ); +}; + +export default CreateTd; diff --git a/src/components/App/base/Button.tsx b/src/components/App/base/Button.tsx new file mode 100644 index 00000000..53faea6b --- /dev/null +++ b/src/components/App/base/Button.tsx @@ -0,0 +1,29 @@ +/******************************************************************************** + * Copyright (c) 2025 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the W3C Software Notice and + * + * SPDX-License-Identifier: EPL-2.0 OR W3C-20150513 + ********************************************************************************/ + +interface IButtonProps { + onClick: () => void; + children: React.ReactNode; +} + +const Button: React.FC = ({ onClick, children }) => { + return ( + + ); +}; + +export default Button; diff --git a/src/components/Dialogs/base/FormField.tsx b/src/components/App/base/FormField.tsx similarity index 100% rename from src/components/Dialogs/base/FormField.tsx rename to src/components/App/base/FormField.tsx diff --git a/src/components/App/TmInputForm.tsx b/src/components/App/base/TmInputForm.tsx similarity index 100% rename from src/components/App/TmInputForm.tsx rename to src/components/App/base/TmInputForm.tsx diff --git a/src/components/Dialogs/ContributeToCatalog.tsx b/src/components/Dialogs/ContributeToCatalogDialog.tsx similarity index 85% rename from src/components/Dialogs/ContributeToCatalog.tsx rename to src/components/Dialogs/ContributeToCatalogDialog.tsx index 4f0b46ef..edfd657f 100644 --- a/src/components/Dialogs/ContributeToCatalog.tsx +++ b/src/components/Dialogs/ContributeToCatalogDialog.tsx @@ -25,7 +25,7 @@ import type { } from "wot-thing-description-types"; import Ajv2019 from "ajv/dist/2019"; import addFormats from "ajv-formats"; -import { ProgressBar, Step } from "./base/ProgressBar"; +import { ProgressBar, Step } from "../App/ProgressBar"; import ediTDorContext from "../../context/ediTDorContext"; import { @@ -33,10 +33,9 @@ import { initialState, } from "../../context/ContributeToCatalogState"; import DialogTemplate from "./DialogTemplate"; -import FormMetadata from "./base/FormMetadata"; -import FormSubmission from "./base/FormSubmission"; -import FormInteraction from "./base/FormInteraction"; +import ContributeToCatalog from "../App/ContributeToCatalog"; import { isValidUrl, formatText } from "../../utils/strings"; +import { getJsonLdString } from "../../utils/arrays"; import { requestWeb } from "../../services/thingsApiService"; import { normalizeContext, @@ -58,7 +57,7 @@ const VALIDATION_TM_JSON = const VALIDATION_MODBUS = "https://raw.githubusercontent.com/wot-oss/tmc/refs/heads/main/internal/commands/validate/modbus.schema.json"; -const ContributeToCatalog = forwardRef((props, ref) => { +const ContributeToCatalogDialog = forwardRef((props, ref) => { const context = useContext(ediTDorContext); const td: ThingDescription = context.parsedTD; const contributeCatalogData = context.contributeCatalog; @@ -92,21 +91,29 @@ const ContributeToCatalog = forwardRef((props, ref) => { const open = () => { const metadataFromTd = { - model: td["schema:mpn"] || contributeCatalogData.model || "", + model: + getJsonLdString(td, ["schema:mpn"]) ?? + contributeCatalogData.model ?? + "", author: - td["schema:author"]?.["schema:name"] || - contributeCatalogData.author || + getJsonLdString(td, ["schema:author", "schema:name"]) ?? + contributeCatalogData.author ?? "", manufacturer: - td["schema:manufacturer"]?.["schema:name"] || - contributeCatalogData.manufacturer || + getJsonLdString(td, ["schema:manufacturer", "schema:name"]) ?? + contributeCatalogData.manufacturer ?? + "", + license: + getJsonLdString(td, ["schema:license"]) ?? + contributeCatalogData.license ?? "", - license: td["schema:license"] || contributeCatalogData.license || "", copyrightYear: - td["schema:copyrightYear"] || contributeCatalogData.copyrightYear || "", + getJsonLdString(td, ["schema:copyrightYear"]) ?? + contributeCatalogData.copyrightYear ?? + "", holder: ( - td["schema:copyrightHolder"]?.["name"] || - contributeCatalogData.holder || + getJsonLdString(td, ["schema:copyrightHolder", "schema:name"]) ?? + contributeCatalogData.holder ?? "" ).trim(), }; @@ -593,59 +600,28 @@ const ContributeToCatalog = forwardRef((props, ref) => {
-
- {state.workflow.currentStep === 1 && ( - <> - - - )} - {state.workflow.currentStep === 2 && ( - - )} - {state.workflow.currentStep === 3 && ( - <> - - - )} -
+
); @@ -682,5 +658,5 @@ const ContributeToCatalog = forwardRef((props, ref) => { return null; }); -ContributeToCatalog.displayName = "ContributeToCatalog"; -export default ContributeToCatalog; +ContributeToCatalogDialog.displayName = "ContributeToCatalogDialog"; +export default ContributeToCatalogDialog; diff --git a/src/components/Dialogs/ConvertTmDialog.tsx b/src/components/Dialogs/ConvertTmDialog.tsx index 14a2f7ab..78059fd8 100644 --- a/src/components/Dialogs/ConvertTmDialog.tsx +++ b/src/components/Dialogs/ConvertTmDialog.tsx @@ -25,9 +25,8 @@ import { extractPlaceholders, isVersionValid, } from "../../services/operations"; -import TmInputForm from "../App/TmInputForm"; +import TmInputForm from "../App/base/TmInputForm"; import DialogTextField from "./base/DialogTextField"; -import type { IEdiTDorContext } from "../../types/context"; export interface ConvertTmDialogRef { openModal: () => void; diff --git a/src/components/Dialogs/CreateTdDialog.tsx b/src/components/Dialogs/CreateTdDialog.tsx index b9070aac..1e12a1d7 100644 --- a/src/components/Dialogs/CreateTdDialog.tsx +++ b/src/components/Dialogs/CreateTdDialog.tsx @@ -21,7 +21,7 @@ import ReactDOM from "react-dom"; import ediTDorContext from "../../context/ediTDorContext"; import DialogTemplate from "./DialogTemplate"; import ErrorDialog from "./ErrorDialog"; -import FormCreateTd from "./base/FormCreateTd"; +import CreateTd from "../App/CreateTd"; export interface CreateTdDialogRef { openModal: () => void; @@ -145,7 +145,7 @@ const CreateTdDialog = forwardRef((props, ref) => { "To quickly create a basis for your new Thing Description/Thing Model just fill out this little template and we'll get you going." } > - { setThingDescription={setThingDescription} thingSecurity={thingSecurity} setThingSecurity={setThingSecurity} - > + > , document.getElementById("modal-root") as HTMLElement )} diff --git a/src/components/Dialogs/SendTDDialog.tsx b/src/components/Dialogs/SendTDDialog.tsx index 7011d236..4bdf34c9 100644 --- a/src/components/Dialogs/SendTDDialog.tsx +++ b/src/components/Dialogs/SendTDDialog.tsx @@ -24,6 +24,7 @@ import { import RequestSuccessful from "./base/RequestSuccessful"; import RequestFailed from "./base/RequestFailed"; import { fetchNorthboundTD } from "../../services/thingsApiService"; +import SendTD from "../App/SendTD"; export interface SendTDDialogRef { openModal: () => void; @@ -250,85 +251,14 @@ const SendTDDialog = forwardRef( "The Thing Description will be sent to a Third-Party Service located at the endpoint configured in the Settings options under Southbound URL field. The proxied Thing will be interactable over HTTP in the left view." } > -
-

- Current Configuration Details -

-
- - - - - - - - - - - -
- Endpoint: - - {getLocalStorage("southbound") || - "(No endpoint configured)"} -
- TD ID: - - {currentTdId || "(No ID available)"} -
-
-
- -
-

Operation Details

-
-
- Action: - - {isUpdate ? "Update Existing TD" : "Send New TD"} - -
-

- {isUpdate - ? "You are updating an existing Thing Description that was previously sent to the server." - : "You are sending a new Thing Description to the server for the first time."} -

-
-
- -
-

Result:

-
-

- {requestSend.message - ? requestSend.message - : isUpdate - ? requestUpdate.message || "No update request made yet." - : "No send request made yet."} -

- -
- {isUpdate ? ( - - ) : ( - - )} -
-
{renderDialogContent()}
-
-
+ , document.getElementById("modal-root") as HTMLElement ); diff --git a/src/context/ContributeToCatalogState.tsx b/src/context/ContributeToCatalogState.tsx index a3ad5c48..b56467fb 100644 --- a/src/context/ContributeToCatalogState.tsx +++ b/src/context/ContributeToCatalogState.tsx @@ -13,61 +13,6 @@ import type { ThingDescription } from "wot-thing-description-types"; import { getLocalStorage } from "../services/localStorage"; -type Validation = "VALID" | "INVALID" | "VALIDATING" | null; -export type ActiveSection = "INSTANCE" | "GATEWAY" | "TABLE" | "SAVING_RESULTS"; -interface SectionError { - error: boolean; - message: string; -} -interface SettingsData { - northboundUrl: string; - southboundUrl: string; - pathToValue: string; -} - -// Define the shape of the state -export interface ContributionToCatalogState { - workflow: { - currentStep: number; - showDialog: boolean; - backgroundTdToSend: ThingDescription; - }; - metadata: { - model: string; - author: string; - manufacturer: string; - license: string; - copyrightYear: string; - holder: string; - copied: boolean; - validation: Validation; - errorMessage: string; - }; - interaction: { - activeSection: ActiveSection; - sectionErrors: { - instance: SectionError; - gateway: SectionError; - table: SectionError; - results: SectionError; - }; - isTestingAll: boolean; - settingsData: SettingsData; - placeholderValues: Record; - propertyResponseMap: Record; - }; - submission: { - tmCatalogEndpoint: string; - tmCatalogEndpointError: string; - repository: string; - repositoryError: string; - submitted: boolean; - submittedError: string; - id: string; - link: string; - }; -} - // Initial state export const initialState: ContributionToCatalogState = { workflow: { diff --git a/src/types/context.d.ts b/src/types/context.d.ts index b8740297..ebaf8bb0 100644 --- a/src/types/context.d.ts +++ b/src/types/context.d.ts @@ -1,17 +1,19 @@ -export interface IEdiTDorContext { - // offlineTD: Saving or displaying the TD as JSON For storage, sharing, or exporting Primary source of truth for the TD - offlineTD: string; - isValidJSON: boolean; - // ParsedTD: Accessing and modifying TD properties For programmatic manipulation JavaScript object Derived from offlineTD - parsedTD: IThingDescription; - isModified: boolean; - name: string; - fileHandle: string | null; - linkedTd: Record | undefined; - validationMessage: IValidationMessage; +export {}; +declare global { + declare interface IEdiTDorContext { + // offlineTD: Saving or displaying the TD as JSON For storage, sharing, or exporting Primary source of truth for the TD + offlineTD: string; + isValidJSON: boolean; + // ParsedTD: Accessing and modifying TD properties For programmatic manipulation JavaScript object Derived from offlineTD + parsedTD: IThingDescription; + isModified: boolean; + name: string; + fileHandle: string | null; + linkedTd: Record | undefined; + validationMessage: IValidationMessage; - northboundConnection: INorthboundConnection; - contributeCatalog: IContributeCatalog; + northboundConnection: INorthboundConnection; + contributeCatalog: IContributeCatalog; // Callback functions updateOfflineTD: (td: string) => void; @@ -28,7 +30,7 @@ export interface IEdiTDorContext { removeOneOfAKindReducer: (kind: string, oneOfAKind: string) => void; addLinkedTd: (linkedTd: Record) => void; updateLinkedTd: (linkedTd: Record) => void; - updateValidationMessage: (validationMessage: IValidationMessage) => void; + updateValidationMessage: (validationMessage?: any) => void; updateNorthboundConnection: ( northboundConnection: INorthboundConnection ) => void; @@ -49,7 +51,7 @@ interface IValidationMessage { security: null | string; propUniqueness: null | string; multiLangConsistency: null | string; - linksRelTypeCount: null | string; + linksRelTypeCount: null | string;s readWriteOnly: null | string; uriVariableSecurity: null | string; }; @@ -70,70 +72,130 @@ interface IValidationMessage { customMessage: string; // custom to editor } -interface INorthboundConnection { - message: string; - northboundTd: ThingDescription | {}; -} + interface INorthboundConnection { + message: string; + northboundTd: ThingDescription | {}; + } -interface IContributeCatalog { - model: string; - author: string; - manufacturer: string; - license: string; - copyrightYear: string; - holder: string; - tmCatalogEndpoint: string; - nameRepository: string; - dynamicValues: Record; -} + interface IContributeCatalog { + model: string; + author: string; + manufacturer: string; + license: string; + copyrightYear: string; + holder: string; + tmCatalogEndpoint: string; + nameRepository: string; + dynamicValues: Record; + } + + type EditorState = Omit< + IEdiTDorContext, + | "updateOfflineTD" + | "updateIsModified" + | "setFileHandle" + | "removeForm" + | "addForm" + | "removeLink" + | "removeOneOfAKindReducer" + | "addLinkedTd" + | "updateLinkedTd" + | "updateValidationMessage" + | "updateNorthboundConnection" + | "updateContributeCatalog" + >; + + type Action = + | { type: "UPDATE_OFFLINE_TD"; offlineTD: string } + | { type: "UPDATE_IS_MODIFIED"; isModified: boolean } + | { type: "SET_FILE_HANDLE"; fileHandle: any } + | { + type: "REMOVE_FORM_FROM_TD"; + level: "thing" | "properties" | "actions" | "events" | string; + interactionName: string; + toBeDeletedForm: any; + index: number; + } + | { type: "REMOVE_LINK_FROM_TD"; link: any } + | { + type: "REMOVE_ONE_OF_A_KIND_FROM_TD"; + kind: "thing" | "properties" | "actions" | "events" | string; + oneOfAKindName: string; + } + | { + type: "ADD_FORM_TO_TD"; + level: "thing" | "properties" | "actions" | "events" | string; + interactionName: string; + form: any; + } + | { type: "ADD_LINKED_TD"; linkedTd: any } + | { type: "UPDATE_LINKED_TD"; linkedTd: any } + | { type: "UPDATE_VALIDATION_MESSAGE"; validationMessage: any } + | { + type: "UPDATE_NORTHBOUND_CONNECTION"; + northboundConnection: INorthboundConnection; + } + | { + type: "UPDATE_CONTRIBUTE_CATALOG"; + contributeCatalog: IContributeCatalog; + }; -type EditorState = Omit< - IEdiTDorContext, - | "updateOfflineTD" - | "updateIsModified" - | "setFileHandle" - | "removeForm" - | "addForm" - | "removeLink" - | "removeOneOfAKindReducer" - | "addLinkedTd" - | "updateLinkedTd" - | "updateValidationMessage" - | "updateNorthboundConnection" - | "updateContributeCatalog" ->; + declare type Validation = "VALID" | "INVALID" | "VALIDATING" | null; + declare type ActiveSection = + | "INSTANCE" + | "GATEWAY" + | "TABLE" + | "SAVING_RESULTS"; + interface SectionError { + error: boolean; + message: string; + } + interface SettingsData { + northboundUrl: string; + southboundUrl: string; + pathToValue: string; + } -type Action = - | { type: "UPDATE_OFFLINE_TD"; offlineTD: string } - | { type: "UPDATE_IS_MODIFIED"; isModified: boolean } - | { type: "SET_FILE_HANDLE"; fileHandle: any } - | { - type: "REMOVE_FORM_FROM_TD"; - level: "thing" | "properties" | "actions" | "events" | string; - interactionName: string; - toBeDeletedForm: any; - index: number; - } - | { type: "REMOVE_LINK_FROM_TD"; link: any } - | { - type: "REMOVE_ONE_OF_A_KIND_FROM_TD"; - kind: "thing" | "properties" | "actions" | "events" | string; - oneOfAKindName: string; - } - | { - type: "ADD_FORM_TO_TD"; - level: "thing" | "properties" | "actions" | "events" | string; - interactionName: string; - form: any; - } - | { type: "ADD_LINKED_TD"; linkedTd: any } - | { type: "UPDATE_LINKED_TD"; linkedTd: any } - | { type: "UPDATE_VALIDATION_MESSAGE"; validationMessage: any } - | { - type: "UPDATE_NORTHBOUND_CONNECTION"; - northboundConnection: INorthboundConnection; - } - | { - type: "UPDATE_CONTRIBUTE_CATALOG"; - contributeCatalog: IContributeCatalog; + // Define the shape of the state + declare interface ContributionToCatalogState { + workflow: { + currentStep: number; + showDialog: boolean; + backgroundTdToSend: ThingDescription; }; + metadata: { + model: string; + author: string; + manufacturer: string; + license: string; + copyrightYear: string; + holder: string; + copied: boolean; + validation: Validation; + errorMessage: string; + }; + interaction: { + activeSection: ActiveSection; + sectionErrors: { + instance: SectionError; + gateway: SectionError; + table: SectionError; + results: SectionError; + }; + isTestingAll: boolean; + settingsData: SettingsData; + placeholderValues: Record; + propertyResponseMap: Record; + }; + submission: { + tmCatalogEndpoint: string; + tmCatalogEndpointError: string; + repository: string; + repositoryError: string; + submitted: boolean; + submittedError: string; + id: string; + link: string; + }; + } +} diff --git a/src/types/global.d.ts b/src/types/global.d.ts index ed54acea..fb0608f6 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -11,43 +11,47 @@ * SPDX-License-Identifier: EPL-2.0 OR W3C-20150513 ********************************************************************************/ import type { FormElementBase } from "wot-thing-description-types"; - -declare const APP_VERSION: string; - -declare module "*.png" { - const value: string; - export default value; -} - -declare module "*.png" { - const value: string; - export default value; -} - -export type Method = "GET" | "POST" | "PUT" | "DELETE"; - -export interface RequestWebOptions extends RequestInit { - queryParams?: Record; -} - -export interface HttpSuccessResponse { - data: Response; - headers: string; - status: number; -} - -export interface HttpErrorResponse { - message: string; - reason: string; - status?: number; -} - -export type HttpResponse = HttpSuccessResponse | HttpErrorResponse; - -export interface ResponseDataFromNorthbound { - [key: string]: unknown; - id?: string; - value?: unknown; - timestamp?: number; - quality?: number; +export {}; +declare global { + declare const APP_VERSION: string; + + declare module "*.png" { + const value: string; + export default value; + } + + declare module "*.png" { + const value: string; + export default value; + } + + declare type ThingDescription = WoT.ThingDescription; + + declare type Method = "GET" | "POST" | "PUT" | "DELETE"; + + declare interface RequestWebOptions extends RequestInit { + queryParams?: Record; + } + + declare interface HttpSuccessResponse { + data: Response; + headers: string; + status: number; + } + + declare interface HttpErrorResponse { + message: string; + reason: string; + status?: number; + } + + declare type HttpResponse = HttpSuccessResponse | HttpErrorResponse; + + declare interface ResponseDataFromNorthbound { + [key: string]: unknown; + id?: string; + value?: unknown; + timestamp?: number; + quality?: number; + } } From 151d3676a59e2044ff6db51e1d28b6813c27b685 Mon Sep 17 00:00:00 2001 From: Ricardo M G da Silva Date: Wed, 10 Dec 2025 16:05:19 +0000 Subject: [PATCH 03/11] BREACKING CHANGE: update imports Signed-off-by: Ricardo M G da Silva --- src/components/App/AppHeader.tsx | 2 +- src/components/App/CreateTd.tsx | 2 +- src/components/App/FormInteraction.tsx | 2 +- src/components/App/FormMetadata.tsx | 18 +++++++++--------- src/components/App/FormSubmission.tsx | 6 +++--- src/components/App/Settings.tsx | 10 +++++----- src/components/Dialogs/AddActionDialog.tsx | 8 ++++---- src/components/Dialogs/AddEventDialog.tsx | 8 ++++---- src/components/Dialogs/AddPropertyDialog.tsx | 18 +++++++++--------- src/components/Dialogs/ConvertTmDialog.tsx | 8 ++++---- src/components/Dialogs/SendTDDialog.tsx | 4 ++-- src/components/TDViewer/TDViewer.tsx | 4 ++-- src/components/TDViewer/base/BaseTable.tsx | 2 +- .../TDViewer/base/DoubleSwapButton.tsx | 2 +- .../TDViewer/base/SingleIncrementButton.tsx | 2 +- .../TDViewer/base/SingleSwapButton.tsx | 2 +- src/components/TDViewer/components/Action.tsx | 4 ++-- .../TDViewer/components/EditProperties.tsx | 2 +- src/components/TDViewer/components/Event.tsx | 4 ++-- .../TDViewer/components/InteractionSection.tsx | 4 ++-- .../TDViewer/components/LinkSection.tsx | 4 ++-- .../TDViewer/components/Property.tsx | 4 ++-- src/components/{App => }/base/Button.tsx | 0 .../DialogCheckbox.tsx => base/Checkbox.tsx} | 4 ++-- .../DialogDropdown.tsx => base/Dropdown.tsx} | 4 ++-- src/components/{App => }/base/FormField.tsx | 0 src/components/{InfoIcon => base}/Icon.tsx | 0 .../{InfoIcon => base}/InfoIconWrapper.tsx | 0 .../{Dialogs => }/base/RequestFailed.tsx | 2 +- .../{Dialogs => }/base/RequestSuccessful.tsx | 0 .../DialogTextArea.tsx => base/TextArea.tsx} | 4 ++-- .../DialogTextField.tsx => base/TextField.tsx} | 6 +++--- src/components/{App => }/base/TmInputForm.tsx | 0 .../InfoIcon => utils}/TooltipMapper.tsx | 0 34 files changed, 70 insertions(+), 70 deletions(-) rename src/components/{App => }/base/Button.tsx (100%) rename src/components/{Dialogs/base/DialogCheckbox.tsx => base/Checkbox.tsx} (93%) rename src/components/{Dialogs/base/DialogDropdown.tsx => base/Dropdown.tsx} (94%) rename src/components/{App => }/base/FormField.tsx (100%) rename src/components/{InfoIcon => base}/Icon.tsx (100%) rename src/components/{InfoIcon => base}/InfoIconWrapper.tsx (100%) rename src/components/{Dialogs => }/base/RequestFailed.tsx (96%) rename src/components/{Dialogs => }/base/RequestSuccessful.tsx (100%) rename src/components/{Dialogs/base/DialogTextArea.tsx => base/TextArea.tsx} (92%) rename src/components/{Dialogs/base/DialogTextField.tsx => base/TextField.tsx} (92%) rename src/components/{App => }/base/TmInputForm.tsx (100%) rename src/{components/InfoIcon => utils}/TooltipMapper.tsx (100%) diff --git a/src/components/App/AppHeader.tsx b/src/components/App/AppHeader.tsx index 78e1924f..507d22cb 100644 --- a/src/components/App/AppHeader.tsx +++ b/src/components/App/AppHeader.tsx @@ -37,7 +37,7 @@ import SettingsDialog from "../Dialogs/SettingsDialog"; import ShareDialog from "../Dialogs/ShareDialog"; import ContributeToCatalog from "../Dialogs/ContributeToCatalogDialog"; import ErrorDialog from "../Dialogs/ErrorDialog"; -import Button from "./base/Button"; +import Button from "../base/Button"; import SendTDDialog from "../Dialogs/SendTDDialog"; import { getLocalStorage } from "../../services/localStorage"; import type { ThingDescription } from "wot-thing-description-types"; diff --git a/src/components/App/CreateTd.tsx b/src/components/App/CreateTd.tsx index d7758386..e3c7f180 100644 --- a/src/components/App/CreateTd.tsx +++ b/src/components/App/CreateTd.tsx @@ -13,7 +13,7 @@ import React from "react"; import { ChevronDown } from "react-feather"; import { parseCsv, mapCsvToProperties } from "../../utils/parser"; -import FormField from "./base/FormField"; +import FormField from "../base/FormField"; import BaseButton from "../TDViewer/base/BaseButton"; type ThingType = "TD" | "TM"; diff --git a/src/components/App/FormInteraction.tsx b/src/components/App/FormInteraction.tsx index 15ffd34f..de475a84 100644 --- a/src/components/App/FormInteraction.tsx +++ b/src/components/App/FormInteraction.tsx @@ -27,7 +27,7 @@ import { AlertTriangle, RefreshCw, } from "react-feather"; -import TmInputForm from "./base/TmInputForm"; +import TmInputForm from "../base/TmInputForm"; import { prepareTdForSubmission } from "../../services/operations"; import { readAllReadablePropertyForms } from "../../services/thingsApiService"; import { diff --git a/src/components/App/FormMetadata.tsx b/src/components/App/FormMetadata.tsx index 2112dd74..b2cb2823 100644 --- a/src/components/App/FormMetadata.tsx +++ b/src/components/App/FormMetadata.tsx @@ -11,11 +11,11 @@ * SPDX-License-Identifier: EPL-2.0 OR W3C-20150513 ********************************************************************************/ import React from "react"; -import DialogTextField from "../Dialogs/base/DialogTextField"; +import TextField from "../base/TextField"; import BaseButton from "../TDViewer/base/BaseButton"; import { AlertTriangle, Check, RefreshCw } from "react-feather"; -import InfoIconWrapper from "../InfoIcon/InfoIconWrapper"; -import { getValidateTMContent } from "../InfoIcon/TooltipMapper"; +import InfoIconWrapper from "../base/InfoIconWrapper"; +import { getValidateTMContent } from "../../utils/TooltipMapper"; interface IFormMetadataProps { model: string; @@ -66,7 +66,7 @@ const FormMetadata: React.FC = ({ Models.
- = ({ onChange={onChangeModel} autoFocus={true} /> - = ({ onChange={onChangeAuthor} autoFocus={false} /> - = ({ onChange={onChangeManufacturer} autoFocus={false} /> - = ({ onChange={onChangeLicense} autoFocus={false} /> - = ({ onChange={onChangeCopyrightYear} autoFocus={false} /> - = ({ Add the TM Catalog Endpoint and Repository URL
- = ({ {tmCatalogEndpointError}
)} - = ({ of the initial TD is used to correlate both. - = ({
)} - = ({ {`If the gateway is wrapping the payloads in a JSON object, please provide the path to the value as a JSON pointer. For a JSON like {"foo": {"bar":"baz"}}, where baz is the value according the Data Schema of the TD, you should enter /foo/bar.`} - ((_, ref) => { const children = ( <> - clearErrorMessage()} /> - ((_, ref) => { const children = ( <> - clearErrorMessage()} /> - ( const children = ( <> - clearErrorMessage()} /> - - ( Additional:
- - + +
); diff --git a/src/components/Dialogs/ConvertTmDialog.tsx b/src/components/Dialogs/ConvertTmDialog.tsx index 78059fd8..8ab689fc 100644 --- a/src/components/Dialogs/ConvertTmDialog.tsx +++ b/src/components/Dialogs/ConvertTmDialog.tsx @@ -25,8 +25,8 @@ import { extractPlaceholders, isVersionValid, } from "../../services/operations"; -import TmInputForm from "../App/base/TmInputForm"; -import DialogTextField from "./base/DialogTextField"; +import TmInputForm from "../base/TmInputForm"; +import TextField from "../base/TextField"; export interface ConvertTmDialogRef { openModal: () => void; @@ -129,7 +129,7 @@ const ConvertTmDialog = forwardRef((props, ref) => { /> {!validVersion && ( - ((props, ref) => { placeholder="ex: 1.0.0" value={versionInput} helperText="The Thing Model contains a version without instance key and corresponding value. If you leave this field empty it will automatic generate a instance value." - > + > )}

Select/unselect the interaction affordances you would like to see in diff --git a/src/components/Dialogs/SendTDDialog.tsx b/src/components/Dialogs/SendTDDialog.tsx index 4bdf34c9..9af0780a 100644 --- a/src/components/Dialogs/SendTDDialog.tsx +++ b/src/components/Dialogs/SendTDDialog.tsx @@ -21,8 +21,8 @@ import { isSuccessResponse, handleHttpRequest, } from "../../services/thingsApiService"; -import RequestSuccessful from "./base/RequestSuccessful"; -import RequestFailed from "./base/RequestFailed"; +import RequestSuccessful from "../base/RequestSuccessful"; +import RequestFailed from "../base/RequestFailed"; import { fetchNorthboundTD } from "../../services/thingsApiService"; import SendTD from "../App/SendTD"; diff --git a/src/components/TDViewer/TDViewer.tsx b/src/components/TDViewer/TDViewer.tsx index 785b3659..6f9969c9 100644 --- a/src/components/TDViewer/TDViewer.tsx +++ b/src/components/TDViewer/TDViewer.tsx @@ -19,8 +19,8 @@ import { separateForms, } from "../../util"; import AddFormDialog from "../Dialogs/AddFormDialog"; -import InfoIconWrapper from "../InfoIcon/InfoIconWrapper"; -import { getFormsTooltipContent } from "../InfoIcon/TooltipMapper"; +import InfoIconWrapper from "../base/InfoIconWrapper"; +import { getFormsTooltipContent } from "../../utils/TooltipMapper"; import Form from "./components/Form"; import InteractionSection from "./components/InteractionSection"; import RenderedObject from "./components/RenderedObject"; diff --git a/src/components/TDViewer/base/BaseTable.tsx b/src/components/TDViewer/base/BaseTable.tsx index 2c992bc5..0c79e01c 100644 --- a/src/components/TDViewer/base/BaseTable.tsx +++ b/src/components/TDViewer/base/BaseTable.tsx @@ -13,7 +13,7 @@ import React, { useMemo, useState, useEffect } from "react"; import BasePagination from "./BasePagination"; import ButtonSwap from "./ButtonSwap"; -import Icon from "../../InfoIcon/Icon"; +import Icon from "../../base/Icon"; import { Edit, XCircle, diff --git a/src/components/TDViewer/base/DoubleSwapButton.tsx b/src/components/TDViewer/base/DoubleSwapButton.tsx index b9a65173..e0a29645 100644 --- a/src/components/TDViewer/base/DoubleSwapButton.tsx +++ b/src/components/TDViewer/base/DoubleSwapButton.tsx @@ -11,7 +11,7 @@ * SPDX-License-Identifier: EPL-2.0 OR W3C-20150513 ********************************************************************************/ import React from "react"; -import InfoIconWrapper from "../../InfoIcon/InfoIconWrapper"; +import InfoIconWrapper from "../../base/InfoIconWrapper"; import ButtonSwap from "../base/ButtonSwap"; interface IDoubleSwapButtonProps { diff --git a/src/components/TDViewer/base/SingleIncrementButton.tsx b/src/components/TDViewer/base/SingleIncrementButton.tsx index 51966e57..05b16876 100644 --- a/src/components/TDViewer/base/SingleIncrementButton.tsx +++ b/src/components/TDViewer/base/SingleIncrementButton.tsx @@ -12,7 +12,7 @@ ********************************************************************************/ import React from "react"; import IncrementButton from "../base/IncrementButton"; -import InfoIconWrapper from "../../InfoIcon/InfoIconWrapper"; +import InfoIconWrapper from "../../base/InfoIconWrapper"; interface SingleIncrementButtonProps { idIcon: string; diff --git a/src/components/TDViewer/base/SingleSwapButton.tsx b/src/components/TDViewer/base/SingleSwapButton.tsx index 408a38cb..a199ae2d 100644 --- a/src/components/TDViewer/base/SingleSwapButton.tsx +++ b/src/components/TDViewer/base/SingleSwapButton.tsx @@ -11,7 +11,7 @@ * SPDX-License-Identifier: EPL-2.0 OR W3C-20150513 ********************************************************************************/ import React from "react"; -import InfoIconWrapper from "../../InfoIcon/InfoIconWrapper"; +import InfoIconWrapper from "../../base/InfoIconWrapper"; import ButtonSwap from "../base/ButtonSwap"; interface SingleSwapButtonProps { diff --git a/src/components/TDViewer/components/Action.tsx b/src/components/TDViewer/components/Action.tsx index 2343a2ff..39059a34 100644 --- a/src/components/TDViewer/components/Action.tsx +++ b/src/components/TDViewer/components/Action.tsx @@ -15,8 +15,8 @@ import { Trash2 } from "react-feather"; import ediTDorContext from "../../../context/ediTDorContext"; import { buildAttributeListObject, separateForms } from "../../../util.js"; import AddFormDialog from "../../Dialogs/AddFormDialog"; -import InfoIconWrapper from "../../InfoIcon/InfoIconWrapper"; -import { getFormsTooltipContent } from "../../InfoIcon/TooltipMapper"; +import InfoIconWrapper from "../../base/InfoIconWrapper"; +import { getFormsTooltipContent } from "../../../utils/TooltipMapper"; import Form from "./Form"; import AddFormElement from "../base/AddFormElement"; diff --git a/src/components/TDViewer/components/EditProperties.tsx b/src/components/TDViewer/components/EditProperties.tsx index a1c31acb..f52837b5 100644 --- a/src/components/TDViewer/components/EditProperties.tsx +++ b/src/components/TDViewer/components/EditProperties.tsx @@ -16,7 +16,7 @@ import { getAddressOffsetTooltipContent, getEndiannessTooltipContent, getUniIdTooltipContent, -} from "../../InfoIcon/TooltipMapper"; +} from "../../../utils/TooltipMapper"; import type { ThingDescription } from "wot-thing-description-types"; import SingleIncrementButton from "../base/SingleIncrementButton"; import SingleSwapButton from "../base/SingleSwapButton"; diff --git a/src/components/TDViewer/components/Event.tsx b/src/components/TDViewer/components/Event.tsx index 97673134..afb89ded 100644 --- a/src/components/TDViewer/components/Event.tsx +++ b/src/components/TDViewer/components/Event.tsx @@ -15,8 +15,8 @@ import { Trash2 } from "react-feather"; import ediTDorContext from "../../../context/ediTDorContext"; import { buildAttributeListObject, separateForms } from "../../../util.js"; import AddFormDialog from "../../Dialogs/AddFormDialog"; -import InfoIconWrapper from "../../InfoIcon/InfoIconWrapper"; -import { getFormsTooltipContent } from "../../InfoIcon/TooltipMapper"; +import InfoIconWrapper from "../../base/InfoIconWrapper"; +import { getFormsTooltipContent } from "../../../utils/TooltipMapper"; import Form from "./Form"; import AddFormElement from "../base/AddFormElement"; diff --git a/src/components/TDViewer/components/InteractionSection.tsx b/src/components/TDViewer/components/InteractionSection.tsx index 0c523679..ee11ce37 100644 --- a/src/components/TDViewer/components/InteractionSection.tsx +++ b/src/components/TDViewer/components/InteractionSection.tsx @@ -16,8 +16,8 @@ import ediTDorContext from "../../../context/ediTDorContext"; import AddActionDialog from "../../Dialogs/AddActionDialog"; import AddEventDialog from "../../Dialogs/AddEventDialog"; import { AddPropertyDialog } from "../../Dialogs/AddPropertyDialog"; -import InfoIconWrapper from "../../InfoIcon/InfoIconWrapper"; -import { tooltipMapper } from "../../InfoIcon/TooltipMapper"; +import InfoIconWrapper from "../../base/InfoIconWrapper"; +import { tooltipMapper } from "../../../utils/TooltipMapper"; import Action from "./Action"; import Event from "./Event"; import Property from "./Property"; diff --git a/src/components/TDViewer/components/LinkSection.tsx b/src/components/TDViewer/components/LinkSection.tsx index a8207dc2..df772277 100644 --- a/src/components/TDViewer/components/LinkSection.tsx +++ b/src/components/TDViewer/components/LinkSection.tsx @@ -16,8 +16,8 @@ import React, { useContext, useEffect, useRef, useState } from "react"; import ediTDorContext from "../../../context/ediTDorContext"; import { changeBetweenTd } from "../../../util"; import AddLinkTdDialog from "../../Dialogs/AddLinkTdDialog"; -import InfoIconWrapper from "../../InfoIcon/InfoIconWrapper"; -import { getLinksTooltipContent } from "../../InfoIcon/TooltipMapper"; +import InfoIconWrapper from "../../base/InfoIconWrapper"; +import { getLinksTooltipContent } from "../../../utils/TooltipMapper"; import Link from "./Link"; import BaseButton from "../base/BaseButton"; diff --git a/src/components/TDViewer/components/Property.tsx b/src/components/TDViewer/components/Property.tsx index 2756c566..c4e91541 100644 --- a/src/components/TDViewer/components/Property.tsx +++ b/src/components/TDViewer/components/Property.tsx @@ -14,8 +14,8 @@ import React, { useContext, useState, useRef } from "react"; import { Trash2 } from "react-feather"; import ediTDorContext from "../../../context/ediTDorContext"; import { buildAttributeListObject, separateForms } from "../../../util.js"; -import InfoIconWrapper from "../../InfoIcon/InfoIconWrapper"; -import { getFormsTooltipContent } from "../../InfoIcon/TooltipMapper"; +import InfoIconWrapper from "../../base/InfoIconWrapper"; +import { getFormsTooltipContent } from "../../../utils/TooltipMapper"; import Form from "./Form"; import AddFormDialog from "../../Dialogs/AddFormDialog"; import AddFormElement from "../base/AddFormElement"; diff --git a/src/components/App/base/Button.tsx b/src/components/base/Button.tsx similarity index 100% rename from src/components/App/base/Button.tsx rename to src/components/base/Button.tsx diff --git a/src/components/Dialogs/base/DialogCheckbox.tsx b/src/components/base/Checkbox.tsx similarity index 93% rename from src/components/Dialogs/base/DialogCheckbox.tsx rename to src/components/base/Checkbox.tsx index ea87df36..8e3684b7 100644 --- a/src/components/Dialogs/base/DialogCheckbox.tsx +++ b/src/components/base/Checkbox.tsx @@ -16,7 +16,7 @@ interface ICheckboxProps { readOnly?: boolean; } -const DialogCheckbox: React.FC = (props) => { +const Checkbox: React.FC = (props) => { return (
{(props.readOnly ?? true) ? ( @@ -43,4 +43,4 @@ const DialogCheckbox: React.FC = (props) => { ); }; -export default DialogCheckbox; +export default Checkbox; diff --git a/src/components/Dialogs/base/DialogDropdown.tsx b/src/components/base/Dropdown.tsx similarity index 94% rename from src/components/Dialogs/base/DialogDropdown.tsx rename to src/components/base/Dropdown.tsx index 72903b8f..74d2fe5f 100644 --- a/src/components/Dialogs/base/DialogDropdown.tsx +++ b/src/components/base/Dropdown.tsx @@ -20,7 +20,7 @@ interface IDropdownProps { className?: string; } -const DialogDropdown: React.FC = (props) => { +const Dropdown: React.FC = (props) => { return ( <>