added info in admin

This commit is contained in:
2020-11-24 01:19:43 +01:00
parent d678547231
commit 75f43390e5
3 changed files with 34 additions and 11 deletions

1
.gitignore vendored
View File

@@ -2,5 +2,6 @@
/.idea/ /.idea/
/vendor/ /vendor/
data/* data/*
cron.log
!data/.keep !data/.keep
.DS_Store .DS_Store

View File

@@ -39,7 +39,8 @@ textarea:focus {
} }
.darker { .darker {
background-image: linear-gradient(#b1b1b1, #868686); background-image: linear-gradient(#b1b1b1, #868686);
padding: 4px 7px; width: 30px;
height: 30px;
} }
input, textarea { input, textarea {
background-color: #979ea5; background-color: #979ea5;

View File

@@ -11,20 +11,16 @@
<a v-on:click="sendsignal(item, item.oncommand)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-play" aria-hidden="true"></i></a> <a v-on:click="sendsignal(item, item.oncommand)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-play" aria-hidden="true"></i></a>
<a v-on:click="sendsignal(item, item.offcommand)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-stop" aria-hidden="true"></i></a> <a v-on:click="sendsignal(item, item.offcommand)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-stop" aria-hidden="true"></i></a>
</div> </div>
<?php if ($admin): ?> <div v-show="admin">
<div>
<a v-on:click="delitem(item)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-trash" aria-hidden="true"></i></a> <a v-on:click="delitem(item)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-trash" aria-hidden="true"></i></a>
<a v-on:click="showinfo(item)" href="javascript:void(0)" class="addbtn darker"><i class="fa fa-info" aria-hidden="true"></i></a>
</div> </div>
<?php endif ?>
</div> </div>
</div> </div>
<?php if ($admin): ?> <div v-if="admin">
<div>
<a href="javascript:void(0)" class="addbtn" v-on:click="add">{{addtext}}</a> <a href="javascript:void(0)" class="addbtn" v-on:click="add">{{addtext}}</a>
<div class="add" v-show="adding"> <div class="add" v-show="adding">
<form> <form>
@@ -102,9 +98,6 @@
</form> </form>
</div> </div>
</div> </div>
<?php endif ?>
</div> </div>
@@ -114,6 +107,7 @@ var app = new Vue({
el: '#app', el: '#app',
data: { data: {
items: [], items: [],
admin: <?php echo ($admin) ? 'true' : 'false' ?>,
sending: false, sending: false,
adding: false, adding: false,
messages: [], messages: [],
@@ -173,6 +167,33 @@ var app = new Vue({
}) })
} }
}, },
showinfo: function(item) {
alert(this.dump(item,2))
},
dump: function(arr,level) {
var dumped_text = "";
if(!level) level = 0;
//The padding given at the beginning of the line.
var level_padding = "";
for(var j=0;j<level+1;j++) level_padding += " ";
if(typeof(arr) == 'object') { //Array/Hashes/Objects
for(var item in arr) {
var value = arr[item];
if(typeof(value) == 'object') { //If it is an array,
dumped_text += level_padding + "'" + item + "' ...\n";
dumped_text += this.dump(value,level+1);
} else {
dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
}
}
} else { //Stings/Chars/Numbers etc.
dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
}
return dumped_text;
},
getitems: function() { getitems: function() {
axios axios
.get('api/items') .get('api/items')