Code Monkey home page Code Monkey logo

editdor's Introduction

alt text Discord

A tool for simply designing W3C Thing Descriptions and Thing Models

Find the ediTDor here to try it out:

https://eclipse.github.io/editdor/

Using the AI Chat Function

The AI chat is currently implemented using Azures cognitive services API. To make use of the chat the app has to be compiled with two additional environment variables:

REACT_APP_OPENAI_KEY={api_key}
REACT_APP_OPENAI_URI={azure_resource_address}

About this project

The goal of this project is the easy creation of W3C Thing Description instances and Thing Models by providing a platform-independent ediTDor tool. The following features are addressed in this project

  • Creating a new Thing Description / ThingModel from scratch
  • Rendering a Thing Description / Thing Model
  • Editing the Thing Description / Thing Model
  • Validating the Thing Description / ThingModel
  • Exporting the Thing Description / ThingModel from the visual representation into JSON-LD

Technologies

  • React
  • TailwindCSS

Contribution guide

Any contribution to this project is welcome. If you want to report a bug or question, please check the issue list or create a new issue. If you want to contribute to this project by coding, please follow the general contribution guidelines described here. Note that you need to have an Eclipse account to make Pull Requests.

License

Prerequisites

To use with Node.js

All systems require the following:

  • NodeJS version 10+ (e.g., 10.13.0 LTS)

Install dependencies

npm install install all the dependencies listed within package.json

Start Locally

npm run start starts a local development server on Port 3000 (http://localhost:3000)

Build

npm install install all the dependencies listed within package.json

npm build builds the project for deployment

Implemented Features in the ediTDor:

  • JSON editor with JSON Schema support for TD (autocompletion)
  • Add Property, Action, Event by wizard
  • Render TD to be more human readable
  • Validate JSON Syntax and JSON Schema for TD (JSONLD and Additional Validation for nested TMs will be implemented in the future)

editdor's People

Contributors

alexbrdn avatar bessemmnif avatar danielpeintner avatar egekorkan avatar fatadel avatar fexpal avatar sebastiankb avatar spf00 avatar web-of-things avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

editdor's Issues

Request new Title and ID in dialog to generate a TD out of a TM

Thing Descriptions being generated out of Thing Models are keeping the title and id of the model. But typically you'll want different values for both fields. It would be nice to have to optional text boxes to define them in the "Generated TD from TM" dialog.

Warning for missing forms in TMs

Linking TDs to Playground

With @fexpal we have discussed the posibility to transfer TDs from Editdor to Playground and vice versa. TD Links in Playground are generated via https://www.npmjs.com/package/lz-string (also see eclipse-thingweb/playground#359) which has some advantages to usual URL encoding. A button can be placed that simply does the same encoding to the TD in the JSON Editor part and open a new tab with playground in it for future tests on the TD.

It might be also worthwhile to use the same compression here but we can do a more objective comparison first.

TM to TD generation improvements and bugs

I was generating the implementation report for editdor and found the following problems when looking at TM to TD generation specifically:

  • The pop up UI asks for "which placeholders to replace" even where there are no placeholders.
  • tm:extends is not removed when the TD is generated. TD spec says:

If used, links element entry with "rel":"tm:extends" MUST be removed from the current Partial TD

  • required affordances can be deselected and not carried over:

All required interactions (not listed in tm:optional) MUST be taken over to the Partial TD instance.

  • tm:extends is not resolved. So the final TD does not have those:

Copy all definitions from the input Thing Model to the resulting Partial TD instance. If used, the extension and imports feature MUST be resolved and represented in the Partial TD instance according to 9.3.2 Extension and Import.

  • TD generation fails in this specific case since the URL parsing fails:
{
    "@context": "https://www.w3.org/2019/wot/td/v1",
    "title": "ediTDor Thing",
    "@type": "tm:ThingModel",
    "securityDefinitions": {
        "nosec_sc": {
            "scheme": "nosec"
        }
    },
    "security": "nosec_sc",
    "properties": {
        "dim": {
            "title": "Dimming level",
            "type": "integer",
            "minimum": 0,
            "maximum": 100
        },
        "dim2": {
            "title": "Dimming level",
            "type": "integer",
            "minimum": 0,
            "maximum": 100
        }
    },
    "tm:optional": [
        "/properties/dim2"
    ]
}

This TM also is picked up as TD for some reason. It has correct @type

Sharing Thing Model

URI too long

@sebastiankb shared this link in a github comment. When clicking it the browser refuses to follow it and return simpy URI too long.

I tried with Brave and Chrome. Platfrom Windows.

CTRL+Enter for confirming

  • Feature request
  • Nice to have

When adding new affordances or any user interaction with a pop-up window, it would be nice to have CTRL+Enter as a shortcut to click on the (mostly) blue button that is for adding/confirming (see the screenshot below)
grafik

Add Property

As a User I want to have the option to add a property to the TD with a guided UI in order not to use a texteditor.

idea:
Use a popup window where you are able to add a Property with the mandatory fields and also to add forms if you like.

Sharing and converting TM/TD

Converting a TM to TD and then trying to share it results in an error. The reason is that after converting the TM to TD, the resulting URL is used as a base URL to construct the sharing URL. Also sharing a TD/TM two times results in the same problem.

Error reported on newly created TM

Asking for a New TM the resulting skeleton is being reported to be erroneous, though it looks good to me. The error message is also really weird "[...] should NOT be valid [...]" ๐Ÿคจ

Issue observed on currently deployed version 0.5.0.

How to reproduce it? Simply click on "New" and select "ThingModel" as type in the dialog without entering any other data.

See screenshot:

image

Swapping left and right windows

In a chat with @danielpeintner, @sebastiankb, and @wiresio , we discussed the possibility of swapping the place of the left and right windows since the current right-hand side is mainly used to create a TD. However, the intuition of some users might be to start from left.

In swagger editor or even latex editors, the output is on the right but those are really just the output. However, editdor excels at the creation of TDs and thus the workflow would make more sense in putting the interactable UI on the left side, making the TD a mere output. Given that this might be a change that some actually do not want, it would be nice to let users swap the place the order.

Resize text or box

Using the new feature to visualize the links entries may result to text overflow in some boxes:

image

Maybe the text font size have to be reduced or the box has to be scaled to a larger size. Another option would be to cut off the text when it starts to overflow.

Add new Link

beside of the "Add new (top level) Form" there should be "Add new "Add new top level Link. There we could apply the new relation types that are currently introduced in the TD: w3c/wot-thing-description#1034

The rendered version can be seen here: https://pr-preview.s3.amazonaws.com/w3c/wot-thing-description/pull/1034.html#links-relation-types-values

The process should be also part in the assistance when creating a new TD / TM. E.g., it can be asked if a TD instance is an instance of a Thing Model or a Thing Model extends another Thing Model etc.

Introduce permalink to associate a TD / TM example

The JSON-LD playground allows to generate a permalink that associate an example that was created like here.

It would be cool to have the same feature for the ediTDor. This would help to exchange examples without copying the whole TD / TM somewhere.

Sort Properties

As a User I want to have the possibility to sort the properties in order to get a better overview of all properties.

  • First step would be to add a button that can sort them alphabetically.

  • Second step could be to add a Drag and Drop option for the properties.

Label of the top level form

currently there is a label 'Add new Form'. It would be good to have more clear that this is a 'Add top level Form'.

Statistics

It would be great if we have a area that provides some information about the TD / TM like the number of defined properties, actions and events, TD size in bytes etc. This information can be relevant when you design instances that should be stored on resource constrained devices.

@type Thing not being specified generating TDs out of TMs in demo deployment

The current version of the Thing Description Working Draft states:

The tm:ThingModel value of the top-level @type MUST to be replaced by the value Thing in the Partial TD instance.

but the current demo deployment https://eclipse.github.io/editdor/ is not doing so.

I haven't found any code taking care of that replacement, therefore I suppose that it isn't a deployment issue (like in the case of #74), but a missing feature.

id field is optional

when creating new TD it seems the the ID field is mandatory. However, it is optional.

One idea how this can be reflected: If there is an optional field and the user do not enter a value this field is not generated.

Protocol selection and configuration support

When a new form entry is created, it would be great if there is an assistance that ask you what kind of protocol you like to define (e.g., HTTP, MQTT, OPC UA, Modbus, ...). Depending of the selected protocol corresponding fields should be generated like for Modbus' the offset and length.

Display version and link to github

It would be good to have a place (footer position?) to see the current version of the ediTDor + a link to this github to report issues

Caching issues with share TD button

I have to do a force refresh or clean the browser cache when I am sharing TDs as links. It is probably due to the change on how the links are created and something is using a cached version of something. We should either:

  • Change the underlying mechanism
  • Add a small warning to the pop up which currently says the following

Screenshot 2023-07-31 at 14 58 48

Note: After cleaning the cache, the issue disappears for good but not everyone will do that. For someone opening the page for the first time, this is of course not a real issue.

Hyperlink for logo

Currently, the logo on the top left is just an image with no hyperlink behind it. It would be nice to point to the website itself so that I can easily open another instance of the website in another tab or window. Now I need to open a new tab and enter the URL.

UX Improvement for Sharing

  • Minor improvement

Currently, when I click on the Share button, a link for the TD/TM is automatically copied to the clipboard. I think this is mostly fine but then the pop-up window should be improved:

  • More visual feedback that it is already copied. (see below for one option)
  • The Share button in the pop-up has no real use. I think that a small animation can be played in the beginning saying "Link Copied" instead of "Share"
  • Cancel should be replaced with Close since there is no way for the operation to be cancelled.

Adding a property with array or object can populate items and properties, respectively

  • nice to have

When I add a property, I choose a type that can have values of string, array, object etc. Currently, only this top-level type is manageable by the UI. This means that if I choose array or object as the type, I need to use the editor side to add more type description. It would be nice if I get an empty items or properties object.

Update Readme

Provide some basic information about the Eclipse EdiTDor project. Copy the content from the "old" README file.

Adding a copy button for affordances

There can be TDs that have similar affordances like turnOff and turnOn. With a text editor, I would write one and copy paste and edit for the second one. With editdor's right hand side, I cannot do this but have to resort to the text editor.

It is a nice to have but has impacts on usability/UX.

Adding links requires fetchable resources

I wanted to add some dummy TDs/TMs linked to a TD/TM via the links container. The pop-up of the user interface tries to actually fetch the resource even if the resource is located at example.com or localhost. When it cannot find it, it shows an error but it is actually added to the interface and to the editor side. I would need to understand why the fetching functionality is needed but I think that the error message can be extended by saying that the resource could not be fetched but the link is actually added

provide an online mode

For debugging and development purposes an online mode would be helpful.

Workflow:

  1. Prepare a Thing Description for a certain device which is available on the network
  2. Go online in editdor, which switches the view to a thing viewer mode
  3. Execute the InteractionAffordances on the thing: read/write/observe properties, invoke actions, subscribe/unsubscribe to events and get notifications; and show the results
  4. Also provide a log view to monitor what's happening on the wire.

Restrictions:

  • Support only a few selected protocols, e.g. just http for the beginning.

This could also be a separate tool complementing editdor or a plugin to it.

Provide ediTDor as npm package

It would be great if ediTDor could be split up into two standalone npm packages. One package for the viewer part and one providing the editor+viewer (analogue to swagger-ui and swagger-editor).

This would give us some greater flexibility:

  • ediTDor could be used inside other projects
  • the viewer could be used as a standalone component

I do see some difficulties in splitting up the components due to the usage of one global React Context. But a simpler solution could be to build only one ediTDor package and provide some configuration for hiding the editor part (something like a read only mode).

What do you all think about this idea?
Does anyone else have such requirements or might be interested in such a solution?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.