Usunięto requesty do bazy danych

This commit is contained in:
2020-08-23 21:18:52 +02:00
parent 5a9795f0a5
commit b5b5cb6f85
7 changed files with 1845 additions and 247 deletions
+6 -1
View File
@@ -53,6 +53,8 @@ import Loading from "@/components/App/Loading.vue";
import Clock from "@/components/App/Clock.vue";
// import firebase from "@/scripts/firebase/firebaseInit";
@Component({
components: { Error, Loading, Clock },
})
@@ -65,8 +67,11 @@ export default class App extends Vue {
errorMessage: string = "";
mounted() {
async mounted() {
this.initStations();
// const getData = firebase.functions.httpsCallable("getHistoryData");
// getData().then((res) => console.log(res.data));
}
}
</script>
-140
View File
@@ -4,57 +4,6 @@
<img :src="require('@/assets/icon-exit.svg')" alt="exit icon" />
</div>
<div class="card-history">
<div class="history-title">
<span class="title">DZIENNIK STACJI</span>
|
<span>Usługa czasowo wstrzymana </span>
</div>
<ul class="history-list">
<!-- <div
class="history-info"
>Wersja eksperymentalna! Dziennik aktualizuje się automatycznie co godzinę.</div>-->
<!-- <li class="history-log" v-for="(log, i) in computedHistory" :key="i">
<div class="log-time">
<div class="from">
<span>
{{ new Date(log.occupiedFrom).toLocaleDateString('pl-PL', {
day: "2-digit",
month: "2-digit",
year: "2-digit",
}) }}
</span>
<span>
{{ new Date(log.occupiedFrom).toLocaleTimeString('pl-PL', {
hour: "2-digit",
minute: "2-digit"
}) }}
</span>
</div>
<div class="to">
<span>
{{ new Date(log.occupiedTo).toLocaleDateString('pl-PL', {
day: "2-digit",
month: "2-digit",
year: "2-digit",
}) }}
</span>
<span>
{{ new Date(log.occupiedTo).toLocaleTimeString('pl-PL', {
hour: "2-digit",
minute: "2-digit"
}) }}
</span>
</div>
</div>
<div class="log-dispatcher">{{log.dispatcher}}</div>
</li>-->
</ul>
</div>
<div class="card-content" :class="{'offline': !stationInfo.online}">
<div class="main">
<div class="main-content">
@@ -190,8 +139,6 @@
import { Component, Prop, Watch } from "vue-property-decorator";
import styleMixin from "@/mixins/styleMixin";
import db from "@/scripts/firebase/firebaseInit";
@Component
export default class StationCard extends styleMixin {
@Prop() stationInfo;
@@ -283,8 +230,6 @@ export default class StationCard extends styleMixin {
gap: 1.5em;
margin-bottom: 2.5rem;
&.offline {
.users,
.spawns,
@@ -300,91 +245,6 @@ export default class StationCard extends styleMixin {
}
}
.card-history {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: space-between;
// height: 10%;
min-height: 0;
max-height: 90%;
min-width: 100%;
padding: 0.4rem;
// border-radius: 1em 1em 0 0;
z-index: 5;
background: rgba($color: #000000, $alpha: 0.9);
font-size: 1em;
transition: min-height 150ms ease-in, min-width 150ms ease-in,
font-size 150ms ease-in;
// &:hover {
// min-height: 90%;
// & > .history-list {
// opacity: 1;
// max-height: 350px;
// }
// & > .history-title {
// font-size: 2em;
// }
// }
}
.history {
&-title {
transition: font-size 150ms ease-in;
color: #999;
}
&-info {
font-size: 1em;
color: #999;
transition: all 150ms ease-in;
}
&-list {
max-height: 0;
opacity: 0;
transition: opacity 150ms;
font-size: 1em;
transition: max-height 150ms ease-in-out;
overflow: auto;
}
&-log {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.5em;
margin: 1em;
background: #333;
&:nth-child(odd) {
background: rgb(92, 92, 92);
}
}
}
.main {
grid-area: main;
text-align: center;
+5 -1
View File
@@ -1,5 +1,6 @@
import * as firebase from "firebase/app";
import "firebase/firestore";
import "firebase/functions";
require("dotenv").config();
@@ -10,4 +11,7 @@ firebase.initializeApp({
projectId: "stacjownik-td2",
});
export default firebase.firestore();
export default {
db: firebase.firestore(),
functions: firebase.functions(),
};
+1 -25
View File
@@ -4,12 +4,7 @@
<Error v-if="connectionState == 1" />
<transition name="card-anim">
<StationCard
v-if="focusedStationInfo"
:stationInfo="focusedStationInfo"
:dispatcherHistory="dispatcherHistory()"
:exit="closeCard"
/>
<StationCard v-if="focusedStationInfo" :stationInfo="focusedStationInfo" :exit="closeCard" />
</transition>
<!-- <div class="info" v-if="stations.length == 0">Ups! Brak stacji do wyświetlenia!</div> -->
@@ -35,7 +30,6 @@ import StationTable from "@/components/StationsView/StationTable.vue";
import StationCard from "@/components/StationsView/StationCard.vue";
import Options from "@/components/StationsView/Options.vue";
import db from "@/scripts/firebase/firebaseInit";
import inputData from "@/data/options.json";
enum ConnState {
@@ -109,24 +103,6 @@ export default class StationsView extends Vue {
else this.focusedStationName = name;
}
get dispatcherHistory() {
return async () => {
let history: any[] = [];
if (this.focusedStationName != "") {
const historyRef = await db
.collection("history")
.doc(this.focusedStationName)
.collection("dispatcherHistory")
.get();
history = historyRef.docs.map((doc) => doc.data());
}
return history;
};
}
get focusedStationInfo() {
return this.stations.find(
(station) => station.stationName === this.focusedStationName