JS cleanup
JS cleanup
This commit is contained in:
parent
4abbd451b9
commit
b6d06a1f37
|
@ -93,9 +93,9 @@
|
||||||
<i class="fas fa-pen" title="edit"></i>
|
<i class="fas fa-pen" title="edit"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<i class="fas fa-plug mx-1" id="btn-{{$server->hostname}}"
|
<i class="fas fa-plug mx-1" id="{{$server->hostname}}"
|
||||||
title="check if up"
|
title="check if up"
|
||||||
@click="onClk">
|
@click="checkUp">
|
||||||
</i>
|
</i>
|
||||||
<i class="fas fa-trash text-danger ms-3" @click="modalForm"
|
<i class="fas fa-trash text-danger ms-3" @click="modalForm"
|
||||||
id="btn-{{$server->hostname}}" title="{{$server->id}}"></i>
|
id="btn-{{$server->hostname}}" title="{{$server->id}}"></i>
|
||||||
|
@ -175,9 +175,9 @@
|
||||||
<i class="fas fa-pen" title="edit"></i>
|
<i class="fas fa-pen" title="edit"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<i class="fas fa-plug mx-1" id="btn-{{$server->hostname}}"
|
<i class="fas fa-plug mx-1" id="{{$server->hostname}}"
|
||||||
title="check if up"
|
title="check if up"
|
||||||
@click="onClk">
|
@click="checkUp">
|
||||||
</i>
|
</i>
|
||||||
<i class="fas fa-trash text-danger ms-3" @click="modalForm"
|
<i class="fas fa-trash text-danger ms-3" @click="modalForm"
|
||||||
id="btn-{{$server->hostname}}" title="{{$server->id}}"></i>
|
id="btn-{{$server->hostname}}" title="{{$server->id}}"></i>
|
||||||
|
@ -203,7 +203,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
axios.defaults.headers.common = {
|
axios.defaults.headers.common = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
|
@ -221,12 +220,12 @@
|
||||||
showModal: false
|
showModal: false
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onClk(event) {
|
checkUp(event) {
|
||||||
var hostname = event.target.id.replace('btn-', '');
|
var hostname = event.target.id;
|
||||||
|
|
||||||
if (hostname) {
|
if (hostname) {
|
||||||
axios
|
axios
|
||||||
.get('/api/online/' + event.target.id.replace('btn-', ''), {headers: {'Authorization': 'Bearer ' + document.querySelector('meta[name="api_token"]').getAttribute('content')}})
|
.get('/api/online/' + event.target.id, {headers: {'Authorization': 'Bearer ' + document.querySelector('meta[name="api_token"]').getAttribute('content')}})
|
||||||
.then(response => (this.status = response.data.is_online))
|
.then(response => (this.status = response.data.is_online))
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
if (this.status) {
|
if (this.status) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user