@@ -22,6 +21,9 @@ import { Vue, Component } from "vue-property-decorator";
import { Getter, Action } from "vuex-class";
import Station from "@/scripts/interfaces/Station";
+import Train from "@/scripts/interfaces/Train";
+
+import inputData from "@/data/options.json";
import Loading from "@/components/App/Loading.vue";
import Error from "@/components/App/Error.vue";
@@ -30,8 +32,6 @@ import StationTable from "@/components/StationsView/StationTable.vue";
import StationCard from "@/components/StationsView/StationCard.vue";
import Options from "@/components/StationsView/Options.vue";
-import inputData from "@/data/options.json";
-
enum ConnState {
Loading = 0,
Error = 1,
diff --git a/src/views/TrainsView.vue b/src/views/TrainsView.vue
index c4b0001..04707ac 100644
--- a/src/views/TrainsView.vue
+++ b/src/views/TrainsView.vue
@@ -7,12 +7,28 @@
Szukaj składu
-
+
+
+
![exit-icon]()
searchedTrain = ''"
+ />
+
Szukaj maszynisty
-
+
+
+
![exit-icon]()
searchedDriver = ''"
+ />
+
@@ -48,7 +64,10 @@ import axios from "axios";
},
})
export default class TrainsView extends Vue {
+ exitIcon = require("@/assets/icon-exit.svg");
+
@Getter("trainsDataList") trains!: Train[];
+
@Getter("trainsDataState") connectionState;
@Action("fetchTrainsData") fetchTrainsData;
@@ -70,7 +89,9 @@ export default class TrainsView extends Vue {
? train.trainNo.toString().includes(this.searchedTrain)
: true) &&
(this.searchedDriver.length > 0
- ? train.driverName.includes(this.searchedDriver)
+ ? train.driverName
+ .toLowerCase()
+ .includes(this.searchedDriver.toLowerCase())
: true)
)
.sort((a, b) => {
@@ -107,12 +128,6 @@ export default class TrainsView extends Vue {
return 0;
});
}
-
- mounted() {
- this.fetchTrainsData();
-
- setInterval(this.fetchTrainsData, 5000);
- }
}
@@ -142,17 +157,34 @@ export default class TrainsView extends Vue {
}
.search {
- &-input {
+ &-box {
+ position: relative;
+
background: #333;
- border: none;
border-radius: 0.5em;
+ min-width: 150px;
+ }
+
+ &-input {
+ border: none;
padding: 0.5rem 1rem;
margin: 0;
font-size: 1em;
- min-width: 150px;
+ min-width: 85%;
+ }
+
+ &-exit {
+ position: absolute;
+ cursor: pointer;
+
+ top: 50%;
+ right: 10px;
+ transform: translateY(-50%);
+
+ width: 1em;
}
}
}