Custom Asset Type Icon

Hi there,
I have successfully created a custom asset type with attributes. I also would like to have a custom icon for my asset type, therefore I added an svg icon to this path:
.\openremote\node_modules@mdi\svg\svg\octicon-container-24.svg

Then I ran

./gradlew clean installDist
docker-compose build manager

in order to build and compose the docker image.

However, the icon is not shown even though in the browser debug everything looks ok.

What could be the reason? Did I miss anything?

Thank you,
Alex

1 Like

Hi Alex,

Well done for getting so far, documentation is still lacking so it shows some perseverance on your part.

Interesting hack you are trying, without investigating why your icon doesn’t make it into the final image I would guess that the yarn install command which is run as part of ./gradlew clean installDist causes your modifications to the @mdi package in node_modules to be lost.

You can always do what your doing (placing the svg into the @mdi package and then generate the mdi-icons.json file using:

cd ui/component/core
npm run generate

The mdi-icon.json file will be in the dist folder, you can then copy this into a running manager container or use a volume mapping, the path within the manager container is:

/opt/web/shared/mdi-icons.json

The more structural approach is to use a custom icon set as demoed/tested in code at:

Inspired by what the old polymer iron icons used to do, you can essentially have sets of icons and mdi is set as the default in our UI components we also have an or icon set which just has OpenRemote logos in at the moment. To use an icon set you just prefix the icon name with the icon set name e.g.:

or:logo

Using this mechanism you could load your own iconset but you’d need to write some UI code to do this so your hack is the quickest approach.

Rich

1 Like

Hi albrundy,

Thanks for your post,

Kindly i need to know how you did create a custom asset type with attributes? because i tried many times to create a custom asset type by adding a new class:

model/src/main/java/org/openremote/model/asset/impl/MyNewAsset.java

and build the project and the docker image with

./gradlew clean installDist
docker-compose build manager

but with no luck.

Thanks