Skip to content

Commit

Permalink
separate EOL and deprecated devices
Browse files Browse the repository at this point in the history
  • Loading branch information
grische authored and T0biii committed Dec 19, 2023
1 parent 7e4a3cf commit 543053a
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ docker run -it --rm --name meshviewer-dev \

The configuration documentation is nowhere near finished.

### Deprecation Warning
### Deprecation and EOL Warning

The deprecation warning can be turned of with `"deprecation_enabled": false` - but we wouldn't suggest it.
Both the deprecation and the EOL warning can be turned off with `"deprecation_enabled": false` - but we wouldn't suggest it.

You can insert your own HTML into the deprecation warning via `"deprecation_text":""`.
You can insert custom HTML into the deprecation and eol warning via `"deprecation_text":""` and `"eol_text":""` respectively.

## Development

Expand Down
1 change: 1 addition & 0 deletions config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@
"devicePicturesLicense": "CC-BY-NC-SA 4.0",
"node_custom": "/[^a-z0-9\\-\\.]/ig",
"deprecation_text": "Hier kann ein eigener Text für die Deprecation Warning (inkl. HTML) stehen!",
"eol_text": "Hier kann ein eigener Text für die End-of-Life Warnung (inkl. HTML) stehen!",
"deprecation_enabled": true
}
15 changes: 14 additions & 1 deletion lib/config_default.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export const config = {
fillOpacity: 0.2,
},
},
deprecated: [
eol: [
"A5-V11",
"AP121",
"AP121U",
Expand Down Expand Up @@ -298,4 +298,17 @@ export const config = {
"VoCore 8M",
"VoCore 16M",
],
deprecated: [
"TP-Link RE200 v1",
"TP-Link RE200 v2",
"TP-Link RE200 v3",
"TP-Link RE200 v4",
"TP-Link RE305 v1",
"TP-Link RE305 v2",
"TP-Link RE305 v3",
"TP-Link RE355 v1",
"TP-Link RE450 v1",
"TP-Link RE450 v2",
"TP-Link RE450 v3",
],
};
12 changes: 10 additions & 2 deletions lib/infobox/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,17 @@ export function Node(el, node, linkScale, nodeDict) {
var deprecation = document.createElement("div");
deprecation.setAttribute("class", "deprecated");
deprecation.setAttribute("style", "display: none;");
deprecation.innerHTML = "<div>" + (config.deprecation_text || _.t("deprecation")) + "</div>";
deprecation.innerHTML = "<div>" + (config.deprecation_text || _.t("deprecation-text")) + "</div>";

var eol = document.createElement("div");
eol.setAttribute("class", "eol");
eol.setAttribute("style", "display: none;");
eol.innerHTML = "<div>" + (config.eol_text || _.t("eol-text")) + "</div>";

el.appendChild(header);
el.appendChild(devicePicture);
el.appendChild(deprecation);
el.appendChild(eol);
el.appendChild(table);
el.appendChild(neighbours);
el.appendChild(tableNeighbour.el);
Expand Down Expand Up @@ -206,7 +212,9 @@ export function Node(el, node, linkScale, nodeDict) {
// Check if device is in list of deprecated devices. If so, display the deprecation warning
if (config.deprecation_enabled) {
if (row.name === "node.hardware") {
if (config.deprecated && field && config.deprecated.includes(field)) {
if (config.eol && field && config.eol.includes(field)) {
eol.setAttribute("style", "display: block;");
} else if (config.deprecated && field && config.deprecated.includes(field)) {
deprecation.setAttribute("style", "display: block;");
}
}
Expand Down
6 changes: 5 additions & 1 deletion lib/proportions.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ export const Proportions = function (filterManager) {
var fwDict = count(nodes, ["firmware", "release"]);
var baseDict = count(nodes, ["firmware", "base"]);
var deprecationDict = count(nodes, ["model"], function (d) {
return config.deprecated && d && config.deprecated.includes(d) ? _.t("yes") : _.t("no");
if (config.deprecated && d && config.deprecated.includes(d)) return _.t("deprecation");

if (config.eol && d && config.eol.includes(d)) return _.t("eol");

return _.t("no");
});
var hwDict = count(nodes, ["model"]);
var geoDict = count(nodes, ["location"], function (d) {
Expand Down
5 changes: 4 additions & 1 deletion public/locale/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@
"none": "keine",
"remove": "entfernen",
"close": "schließen",
"deprecation": "Warnung: Dieser Knoten ist veraltet, und wird demnächst nicht mehr unterstützt. Mehr Infos unter <a href='https://openwrt.org/supported_devices/432_warning'>4/32 warning</a>. <br> Wenn du der Eigentümer des Gerätes bist, bitten wir dich, das Gerät zu ersetzen, um weiterhin am Netz teilnehmen zu können.",
"deprecation": "deprecated",
"deprecation-text": "Warnung: Dieser Knoten ist veraltet, und wird in Zukunft nicht mehr unterstützt. Mehr Infos unter <a href='https://openwrt.org/supported_devices/864_warning'>4/32 warning</a>. <br> Wenn du der Eigentümer des Gerätes bist, bitten wir dich, das Gerät zu ersetzen, um weiterhin am Netz teilnehmen zu können.",
"eol": "eol",
"eol-text": "Warnung: Dieser Knoten ist veraltet, und nicht mehr unterstützt. Mehr Infos unter <a href='https://openwrt.org/supported_devices/432_warning'>4/32 warning</a>. <br> Wenn du der Eigentümer des Gerätes bist, bitten wir dich, das Gerät zu ersetzen, um weiterhin am Netz teilnehmen zu können.",
"loading": "%{name} graph (wird generiert)"
}
5 changes: 4 additions & 1 deletion public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@
"none": "none",
"remove": "remove",
"close": "close",
"deprecation": "This node is deprecated, and will be out of support soon. More information under <a href='https://openwrt.org/supported_devices/432_warning'>4/32 warning</a>.<br>If you're the owner, please replace it with an modern device!",
"deprecation": "deprecated",
"deprecation-text": "This node is deprecated, and will be out of support soon. More information under <a href='https://openwrt.org/supported_devices/864_warning'>8/64 warning</a>.<br>If you're the owner, please replace it with an modern device!",
"eol": "eol",
"eol-text": "This node has reached end-of-life, and is not supported anymore. More information under <a href='https://openwrt.org/supported_devices/432_warning'>4/32 warning</a>.<br>If you're the owner, please replace it with an modern device!",
"loading": "%{name} graph (is generated)"
}
17 changes: 15 additions & 2 deletions scss/modules/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,11 @@ strong {
width: 1px;
}

.deprecated {
.deprecation_base {
padding-left: $button-distance;
padding-right: $button-distance;

div {
background: $color-warning;
border-radius: 5px;
color: $color-white;
font-size: 110%;
Expand All @@ -116,6 +115,20 @@ strong {
}
}

.deprecated {
@extend .deprecation_base;
div {
background: $color-warning;
}
}

.eol {
@extend .deprecation_base;
div {
background: $color-error;
}
}

.hw-img-container {
display: flex;
justify-content: center;
Expand Down
3 changes: 2 additions & 1 deletion scss/modules/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ $color-24ghz: $color-primary !default;
$color-5ghz: #e3a619 !default;
$color-others: #0a9c92 !default;

$color-warning: #c20000 !default;
$color-warning: Orange !default;
$color-error: #c20000 !default;

$color-map-background: #f8f4f0 !default;

Expand Down

0 comments on commit 543053a

Please sign in to comment.