Browse Source

import for portals

modals-to-spa
stingl 4 years ago
parent
commit
93b227e76e
  1. 13
      index.html
  2. 23
      js/app.js

13
index.html

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.4.0/css/iziToast.css">
</head>
<body oncontextmenu="return false;">
<body>
<div id="root">
<div class="container">
<link rel="stylesheet" :href="'https://bootswatch.com/5/' + theme + '/bootstrap.min.css'">
@ -272,6 +272,12 @@ @@ -272,6 +272,12 @@
</select>
</div>
<br/>
<div class="form-group">
<label>Portalnamen <a class="text-muted" href="https://settings.vemap.docker/?fetchPortals" target="_blank">(Import-String hier)</a></label>
<input v-model="importStringForPortals" class="form-control"/>
<a href="javascript:" @click="importPortalsJson" class="btn" v-if="this.importStringForPortals !== ''">Import</a>
</div>
<br/>
</div>
<div class="col-md-6">
<h5>Zurücksetzen & Löschen</h5>
@ -389,7 +395,10 @@ @@ -389,7 +395,10 @@
<div class="col-12">
<div class="form-group">
<label class="text-muted">Portalname:</label>
<input class="form-control" @change="updateStorage()" @keydown="updateStorage()" v-model="portal"/>
<input v-if="!portals || portals.length === 0" class="form-control" @change="updateStorage()" @keydown="updateStorage()" v-model="portal"/>
<select v-else v-model="portal" class="form-control">
<option v-for="selectablePortal in portals" value="selectablePortal">{{ selectablePortal }}</option>
</select>
</div>
</div>
<template v-if="portal && portal !== ''">

23
js/app.js

@ -14,7 +14,9 @@ const TimeTrack = { @@ -14,7 +14,9 @@ const TimeTrack = {
archive: [],
selectedTicket: null,
searchQuery: '',
portal: ''
portal: '',
portals: null,
importStringForPortals: ''
}
},
mounted() {
@ -58,10 +60,14 @@ const TimeTrack = { @@ -58,10 +60,14 @@ const TimeTrack = {
let storedPortal = localStorage.getItem('portal');
this.portal = storedPortal == null ? '' : storedPortal;
let storedPortals = JSON.parse(localStorage.getItem('portals'));
this.portals = storedPortals == null ? null : storedPortals;
},
updateStorage() {
localStorage.setItem('tickets', JSON.stringify(this.tickets));
localStorage.setItem('archive', JSON.stringify(this.archive));
localStorage.setItem('portals', JSON.stringify(this.portals));
localStorage.setItem('ticketSystemUrl', this.ticketSystemUrl);
localStorage.setItem('showPT', this.showPT);
localStorage.setItem('theme', this.theme);
@ -326,6 +332,21 @@ const TimeTrack = { @@ -326,6 +332,21 @@ const TimeTrack = {
});
vue.updateStorage();
})
},
importPortalsJson() {
let vue = this;
if (this.importStringForPortals !== '') {
this.portals = JSON.parse(this.importStringForPortals);
this.importStringForPortals = '';
console.log(vue.portals.length);
iziToast.show({
message: 'Portalnamen importiert',
color: 'green'
});
this.updateStorage();
}
}
},
watch: {