Skip to content

Commit

Permalink
Icones paramètrables
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvaner committed May 3, 2020
1 parent e3533ad commit fccefc3
Show file tree
Hide file tree
Showing 85 changed files with 112 additions and 73 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion dash/css/app.448fa9de.css → dash/css/app.161a255e.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed dash/img/door-off.849f629c.png
Diff not rendered.
Binary file removed dash/img/door-on.7a4e8176.png
Diff not rendered.
Binary file removed dash/img/fan-0.3fa3dbe2.png
Diff not rendered.
Binary file removed dash/img/fan-100.ec6fe551.png
Diff not rendered.
Binary file removed dash/img/fan-50.7a6efdd0.png
Diff not rendered.
Binary file removed dash/img/light-off.0d39c1fe.png
Diff not rendered.
Binary file removed dash/img/light-on.a035c773.png
Diff not rendered.
Binary file removed dash/img/play-off.44c57fc8.png
Diff not rendered.
Binary file removed dash/img/play-on.8f622009.png
Diff not rendered.
Binary file removed dash/img/pump-off.5d91d1a3.png
Diff not rendered.
Binary file removed dash/img/pump-on.5fa26c75.png
Diff not rendered.
Binary file removed dash/img/shutter-0.c8b261d4.png
Diff not rendered.
Binary file removed dash/img/shutter-10.718dfa21.png
Diff not rendered.
Binary file removed dash/img/shutter-100.667a287c.png
Diff not rendered.
Binary file removed dash/img/shutter-20.c6fadfce.png
Diff not rendered.
Binary file removed dash/img/shutter-30.638eabfb.png
Diff not rendered.
Binary file removed dash/img/shutter-40.b14d8bf1.png
Diff not rendered.
Binary file removed dash/img/shutter-50.f7f69192.png
Diff not rendered.
Binary file removed dash/img/shutter-60.69f34cc0.png
Diff not rendered.
Binary file removed dash/img/shutter-70.f7137e1f.png
Diff not rendered.
Binary file removed dash/img/shutter-80.9caa43b3.png
Diff not rendered.
Binary file removed dash/img/switch1-off.1c3ea2e1.png
Diff not rendered.
Binary file removed dash/img/switch1-on.0efda217.png
Diff not rendered.
Binary file removed dash/img/switch2-off.a93e03d4.png
Diff not rendered.
Binary file removed dash/img/switch2-on.5e859eb4.png
Diff not rendered.
Binary file removed dash/img/thermo-off.774245ff.png
Diff not rendered.
Binary file removed dash/img/thermo-on.358a99eb.png
Diff not rendered.
Binary file removed dash/img/v1-off.734362bf.png
Diff not rendered.
Binary file removed dash/img/v1-on.427dc6d1.png
Diff not rendered.
Binary file removed dash/img/v2-off.84bf76d8.png
Diff not rendered.
Binary file removed dash/img/v2-on.1674941c.png
Diff not rendered.
Binary file removed dash/img/window-off.32205b12.png
Diff not rendered.
Binary file removed dash/img/window-on.57150857.png
Diff not rendered.
2 changes: 1 addition & 1 deletion dash/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/dash/favicon.ico><title>dash</title><link rel=stylesheet href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"><link rel=stylesheet href=https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css><link href=/dash/css/app.448fa9de.css rel=preload as=style><link href=/dash/css/chunk-vendors.7469a8f1.css rel=preload as=style><link href=/dash/js/app.5a81bcfc.js rel=preload as=script><link href=/dash/js/chunk-vendors.8cc3cdae.js rel=preload as=script><link href=/dash/css/chunk-vendors.7469a8f1.css rel=stylesheet><link href=/dash/css/app.448fa9de.css rel=stylesheet></head><body><noscript><strong>We're sorry but dash doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/dash/js/chunk-vendors.8cc3cdae.js></script><script src=/dash/js/app.5a81bcfc.js></script></body></html>
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/dash/favicon.ico><title>dash</title><link rel=stylesheet href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"><link rel=stylesheet href=https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css><link href=/dash/css/app.161a255e.css rel=preload as=style><link href=/dash/css/chunk-vendors.7469a8f1.css rel=preload as=style><link href=/dash/js/app.e62f6579.js rel=preload as=script><link href=/dash/js/chunk-vendors.ab6a1ffc.js rel=preload as=script><link href=/dash/css/chunk-vendors.7469a8f1.css rel=stylesheet><link href=/dash/css/app.161a255e.css rel=stylesheet></head><body><noscript><strong>We're sorry but dash doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/dash/js/chunk-vendors.ab6a1ffc.js></script><script src=/dash/js/app.e62f6579.js></script></body></html>
2 changes: 0 additions & 2 deletions dash/js/app.5a81bcfc.js

This file was deleted.

1 change: 0 additions & 1 deletion dash/js/app.5a81bcfc.js.map

This file was deleted.

2 changes: 2 additions & 0 deletions dash/js/app.e62f6579.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dash/js/app.e62f6579.js.map

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions dash/js/chunk-vendors.8cc3cdae.js

This file was deleted.

1 change: 0 additions & 1 deletion dash/js/chunk-vendors.8cc3cdae.js.map

This file was deleted.

14 changes: 14 additions & 0 deletions dash/js/chunk-vendors.ab6a1ffc.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dash/js/chunk-vendors.ab6a1ffc.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/Rest/DashRest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Exception;
use NextDom\Exceptions\CoreException;
use NextDom\Helpers\DBHelper;
use NextDom\Helpers\FileSystemHelper;
use NextDom\Helpers\Utils;
use NextDom\Managers\DashManager;
use NextDom\Managers\JeeObjectManager;
Expand Down Expand Up @@ -67,4 +68,10 @@ public static function save(Request $request)
$dash->save();
return true;
}

public static function pictures($path = '')
{
$path = Utils::sanitizeString($path);
return FileSystemHelper::ls(NEXTDOM_DATA . '/data/pictures/' . $path, '*', true);
}
}
6 changes: 6 additions & 0 deletions src/Rest/rest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,9 @@ dash_save:
path: '/dash/save'
controller: NextDom\Rest\DashRest::save
methods: POST
dash_pictures:
path: '/dash/pictures/{path}'
controller: NextDom\Rest\DashRest::pictures
methods: GET
requirements:
path: "[a-zA-Z0-9\\-_]+"
2 changes: 1 addition & 1 deletion src/dash/src/components/Widgets/InfoBinaryImg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default {
} else {
picture += "-off";
}
return require("../../assets/buttons/on-off/" + picture + ".png");
return "/data/pictures/on-off/" + picture + ".png";
}
}
};
Expand Down
17 changes: 8 additions & 9 deletions src/dash/src/components/Widgets/InfoNumericImg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
</template>

<script>
import Data from "@/libs/Data";
export default {
name: "InfoNumericImg",
props: {
widgetData: {}
},
data: () => ({
mult: 1
mult: 1,
pictureCode: ""
}),
mounted() {
if (!this.widgetData.percent) {
Expand All @@ -27,16 +26,16 @@ export default {
},
computed: {
icon() {
let picture = this.widgetData.picture;
return require("../../assets/buttons/var/" +
picture +
return (
"/data/pictures/level/" +
this.widgetData.picture.name +
"-" +
this.getClosest(
this.widgetData.state * this.mult,
Data.assets.var.list[picture]
this.widgetData.picture.values
) +
".png");
".png"
);
}
},
methods: {
Expand Down
59 changes: 40 additions & 19 deletions src/dash/src/components/Wizards/Helpers/LevelImgStyle.vue
Original file line number Diff line number Diff line change
@@ -1,41 +1,62 @@
<template>
<v-radio-group v-model="picture" row>
<v-radio v-for="(pictures, name, index) in picturesList" v-bind:key="`pictures-${index}`" v-bind:value="name">
<v-radio v-for="(pictureData, index) in picturesList" v-bind:key="`pictures-${index}`" v-bind:value="index">
<template v-slot:label>
<img v-bind:src="pictures.min" />/
<img v-bind:src="pictures.max" />
<img v-bind:src="'/data/pictures/level/' + pictureData.name + '-0.png'" />/
<img v-bind:src="'/data/pictures/level/' + pictureData.name + '-100.png'" />/
</template>
</v-radio>
</v-radio-group>
</template>

<script>
import Data from "@/libs/Data";
import Communication from "@/libs/Communication";
export default {
name: "LevelImgStyle",
props: {
value: String
value: Object
},
data: () => ({
basePath: "/data/pictures/level/",
picturesListCache: {},
picturesList: []
}),
mounted() {
if (Object.keys(this.picturesListCache).length === 0) {
Communication.get("/api/dash/pictures/level", files => {
const codeExtract = /(.*)-(\d+)\.png/;
let indexes = {};
for (let pictureIndex in files) {
const code = files[pictureIndex].match(codeExtract);
// Objet pour retrouver l'index des images
if (code.length > 2) {
if (code[1] in indexes) {
this.picturesList[indexes[code[1]]].values.push(code[2]);
} else {
// Créer l'info si un fichier avec ce code n'a jamais été trouvé
indexes[code[1]] = this.picturesList.length;
this.picturesList.push({
name: code[1],
values: [code[2]]
});
}
}
}
// Définir les valeurs par défaut
if (this.value.name in indexes) {
this.$emit("input", this.picturesList[indexes[this.value.name]]);
}
});
}
},
computed: {
picturesList() {
let result = {};
for (let pictureCode in Data.assets.var.list) {
result[pictureCode] = {
min: require("../../../assets/buttons/var/" + pictureCode + "-0.png"),
max: require("../../../assets/buttons/var/" +
pictureCode +
"-100.png")
};
}
return result;
},
picture: {
get() {
return this.value;
return this.picturesList[this.value.name];
},
set(newValue) {
this.$emit("input", newValue);
this.$emit("input", this.picturesList[newValue]);
}
}
}
Expand Down
40 changes: 21 additions & 19 deletions src/dash/src/components/Wizards/Helpers/OnOffImgStyle.vue
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
<template>
<v-radio-group v-model="picture" row>
<v-radio
v-for="(pictures, name, index) in picturesList"
v-bind:key="`pictures-${index}`"
v-bind:value="name"
>
<v-radio v-for="(picture, index) in picturesList" v-bind:key="`pictures-${index}`" v-bind:value="picture">
<template v-slot:label>
<img v-bind:src="pictures.on" />/
<img v-bind:src="pictures.off" />
<img v-bind:src="basePath + picture + '-on.png'" />/
<img v-bind:src="basePath + picture + '-off.png'" />/
</template>
</v-radio>
</v-radio-group>
</template>

<script>
import Data from "@/libs/Data";
import Communication from "@/libs/Communication";
export default {
name: "OnOffImgStyle",
props: {
value: String
},
computed: {
picturesList() {
let result = {};
for (let pictureIndex in Data.assets.buttons.list) {
const code = Data.assets.buttons.list[pictureIndex];
result[code] = {
on: require("../../../assets/buttons/on-off/" + code + "-on.png"),
off: require("../../../assets/buttons/on-off/" + code + "-off.png")
};
data: () => ({
picturesList: [],
basePath: "/data/pictures/on-off/"
}),
created() {
Communication.get("/api/dash/pictures/on-off", files => {
let result = [];
const codeExtract = /(.*)-o(?:n|ff)\.png/;
for (let pictureIndex in files) {
const code = files[pictureIndex].match(codeExtract);
if (code.length > 1) {
result.push(code[1]);
}
}
return result;
},
this.picturesList = Array.from(new Set(result));
});
},
computed: {
picture: {
get() {
return this.value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ export default {
WidgetPreview
},
data: () => ({
command: []
command: [],
previewData: {}
}),
watch: {
previewData: function(newData) {
console.log(newData);
},
step: function(newStep) {
switch (newStep) {
case 1:
Expand Down Expand Up @@ -93,7 +97,7 @@ export default {
type: "InfoNumericImg",
cmdId: -1,
pos: { top: 0, left: 0 },
picture: "shutter",
picture: { name: "shutter", values: [0, 100] },
title: "",
unit: "%",
percent: false,
Expand Down
4 changes: 2 additions & 2 deletions src/dash/src/components/Wizards/SelectItemToAddWizard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ export default {
data: {
title: "Information",
hideBorder: true,
state: 0,
state: 20,
percent: true,
unit: "%",
picture: "shutter",
picture: { name: "shutter", values: [0, 20, 100] },
style: {
titleSize: 20,
contentSize: 52
Expand Down
2 changes: 1 addition & 1 deletion views/commons/AdminLTE_sidebar.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</ul>
</li>
<li id="side2">
<a href="/dash/index.html"><i class="fas fa-picture-o spacing-right"></i><span>{{ 'Dash'|trans }}</span><span class="pull-right-container"><i class="fas fa-angle-left pull-right"></i></span></a>
<a href="/dash/index.html" target="_blank"><i class="fas fa-picture-o spacing-right"></i><span>{{ 'Dash'|trans }}</span><span class="pull-right-container"><i class="fas fa-angle-left pull-right"></i></span></a>
</li>
<li class="treeview" id="side2">
<a href="#"><i class="fas fa-picture-o spacing-right"></i><span>{{ 'sidebar.view'|trans }}</span><span class="pull-right-container"><i class="fas fa-angle-left pull-right"></i></span></a>
Expand Down

0 comments on commit fccefc3

Please sign in to comment.