Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn widget to version 2 and add more customization options #3

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<widget xmlns="http://wirecloud.conwet.fi.upm.es/ns/macdescription/1" vendor="CoNWeT" name="panel" version="1.1.0">
<widget xmlns="http://wirecloud.conwet.fi.upm.es/ns/macdescription/1" vendor="CoNWeT" name="panel" version="2.0.0">
<macversion>2</macversion>

<details>
<title>Panel</title>
<email>[email protected]</email>
Expand All @@ -20,17 +22,29 @@
</requirements>

<preferences>
<preference name="title" type="text" label="Title" default="Panel" />
<preference name="default-value" type="text" label="Default Value" default="--" />
<preference name="default-unit" type="text" label="Default Unit" default="" />
<preference name="max-height" type="text" label="Max height (Percentage)" default="60" />
<preference name="min-height" type="text" label="Min height (Percentage)" default="10" />
<preference name="decimals" type="text" label="Decimals" description="Number of decimals to use for number values. Empty for using all the available decimals" default="1" />
<preference name="background-color" type="text" label="Background color" default="#FFFFFFFF" />
<preference name="text-color" type="text" label="Text color" default="#333333FF" />
<preference name="bar-color" type="text" label="Bar color" default="#DDDDDDFF" />
<preference name="min-value" type="text" label="Minimum possible value" default="" />
<preference name="max-value" type="text" label="Maximum possible value" default="" />
<preference name="left-tag-text" type="text" label="Left tag text" default="" />
<preference name="right-tag-text" type="text" label="Right tag text" default="" />
</preferences>

<wiring>
<inputendpoint name="textinput" type="text" label="Contents" description="Contents" friendcode="panel-content"/>
</wiring>

<contents src="index.html" useplatformstyle="true"/>
<scripts>
<script src="js/main.js" />
</scripts>
<entrypoint name="CoNWeT_Panel" />
<rendering height="200px" width="400px"/>
</widget>
59 changes: 59 additions & 0 deletions src/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,62 @@ h1 {
h1 > span {
font-size: 60%;
}

h4 {
margin-top: 10px;
margin-bottom: 0;
width: 100%;
}

.minmax-container {
width: 100%;
position: relative;
margin: 10px auto 10px auto;
display: flex;
justify-content: space-between;
line-height: 0;
position: absolute;
bottom: 0;
padding: 0 10px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
}

.minmax-bar-container {
flex-grow: 1;
transform: translateY(-50%);
}

.minmax-bar {
width: 100%;
height: 6px;
/* background-color: #ddd; */
border-radius: 5px;
}

.minmax-indicator {
width: 12px;
height: 12px;
/* background-color: #4caf50; */
border-radius: 50%;
position: absolute;
top: 50%;
transform: translateY(-50%);
transition: left 0.5s ease;
left: 0;
}

.bar-tag {
/* color: #000; */
font-weight: bold;
font-size: 12px;
}

.bar-tag-left {
margin-right: 5px;
}

.bar-tag-right {
margin-left: 5px;
}
8 changes: 8 additions & 0 deletions src/doc/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 2.0.0

- Updates the widget to `macversion` 2.
- Adds the ability to customize colors.
- Adds the ability to add a title to the panel.
- Adds the ability to add a bar that shows the current value in relation to a
minimum and maximum value.

## 1.1.0

- Add a preference for controlling how many decimals to use when displaying
Expand Down
8 changes: 8 additions & 0 deletions src/doc/userguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@ The panel widget is a WireCloud widget that provides an easy way to display simp

## Settings

- `Title`: Title to show in the panel (empty for not showing any title).
- `Min height (Percentage)`: Minimal font-size to use. This value is a percentage relative to the available height.
- `Max height (Percentage)`: Maximal font-size to use. This value is a percentage relative to the available height.
- `Decimals`: Number of decimals to use for number values. Empty for using all the available decimals.
- `Background color`: Background color to use for the panel.
- `Text color`: Text color to use for the panel.
- `Bar color`: Color to use for the bar that shows the current value in relation to a minimum and maximum value.
- `Min value`: Minimum value to use for the bar.
- `Max value`: Maximum value to use for the bar.
- `Left tag text`: Text to show on the left side of the bar.
- `Right tag text`: Text to show on the right side of the bar.

## Wiring

Expand Down
25 changes: 15 additions & 10 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<html>
<head>
<meta content="charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/styles.css">
</head>
<body>
<h1 id="message"><span id="unit"></span></h1>
<script src="js/main.js"></script>
</body>
</html>
<link rel="stylesheet" type="text/css" href="css/styles.css">

<body>
<h4 id="title"></h4>
<h1 id="message"><span id="unit"></span></h1>
<div class="minmax-container" id="minmax-container" style="display: none;">
<div class="bar-tag bar-tag-left" id="bar-tag-left"></div>
<div class="minmax-bar-container">
<div class="minmax-bar" id="bar">
<div class="minmax-indicator" id="bar-indicator"></div>
</div>
</div>
<div class="bar-tag bar-tag-right" id="bar-tag-right"></div>
</div>
</body>
Loading