mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
Poprawki optymalizacyjne (1.3.3)
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"projects": {
|
||||
"default": "stacjownik-td2"
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"hosting": {
|
||||
"public": "dist",
|
||||
"site": "stacjownik-td2",
|
||||
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
|
||||
"rewrites": [
|
||||
{
|
||||
"source": "**",
|
||||
"destination": "/index.html"
|
||||
}
|
||||
]
|
||||
},
|
||||
"functions": {
|
||||
"predeploy": [
|
||||
"npm --prefix \"$RESOURCE_DIR\" run lint",
|
||||
"npm --prefix \"$RESOURCE_DIR\" run build"
|
||||
]
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Generated
-2371
File diff suppressed because it is too large
Load Diff
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"name": "functions",
|
||||
"scripts": {
|
||||
"lint": "tslint --project tsconfig.json",
|
||||
"build": "tsc",
|
||||
"serve": "npm run build && firebase emulators:start --only functions",
|
||||
"shell": "npm run build && firebase functions:shell",
|
||||
"start": "npm run shell",
|
||||
"deploy": "firebase deploy --only functions",
|
||||
"logs": "firebase functions:log"
|
||||
},
|
||||
"engines": {
|
||||
"node": "10"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"axios": "^0.19.2",
|
||||
"firebase-admin": "^8.10.0",
|
||||
"firebase-functions": "^3.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"firebase-functions-test": "^0.2.0",
|
||||
"tslint": "^5.12.0",
|
||||
"typescript": "^3.8.0"
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
// import * as functions from "firebase-functions";
|
||||
// import * as admin from "firebase-admin";
|
||||
|
||||
// admin.initializeApp();
|
||||
// const db = admin.firestore();
|
||||
|
||||
// import axios from "axios";
|
||||
|
||||
// import stationJSONList from "./stations.json";
|
||||
|
||||
// let stationAPIData: {
|
||||
// stationName: string;
|
||||
// dispatcherName: string;
|
||||
// isOnline: boolean;
|
||||
// region: string;
|
||||
// }[] = [];
|
||||
|
||||
// let previousOnlineStations: {
|
||||
// stationName: string;
|
||||
// dispatcherName: string;
|
||||
// occupiedFrom: number;
|
||||
// }[] = [];
|
||||
|
||||
// const API_URL = "https://api.td2.info.pl:9640/?method=getStationsOnline";
|
||||
|
||||
// exports.updateHistory = functions.pubsub
|
||||
// .schedule("*/5 * * * *")
|
||||
// .onRun(async (context) => {
|
||||
// try {
|
||||
// stationAPIData = await (await axios.get(API_URL)).data.message;
|
||||
// } catch (error) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // On server start
|
||||
// if (previousOnlineStations.length == 0) {
|
||||
// stationAPIData
|
||||
// .filter(
|
||||
// (station) =>
|
||||
// station.isOnline &&
|
||||
// station.region === "eu" &&
|
||||
// stationJSONList.some(
|
||||
// (data) => data.stationName === station.stationName
|
||||
// )
|
||||
// )
|
||||
// .forEach((station) => {
|
||||
// const occupiedFrom = Date.now();
|
||||
|
||||
// previousOnlineStations.push({
|
||||
// stationName: station.stationName,
|
||||
// dispatcherName: station.dispatcherName,
|
||||
// occupiedFrom,
|
||||
// });
|
||||
// });
|
||||
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // When array with previous stations isn't empty
|
||||
// previousOnlineStations.forEach((prevStation) => {
|
||||
// const currStationData = stationAPIData.find(
|
||||
// (currStation) => currStation.stationName === prevStation.stationName
|
||||
// );
|
||||
|
||||
// // Dispatcher left
|
||||
// if (!currStationData) {
|
||||
// previousOnlineStations = previousOnlineStations.filter(
|
||||
// (s) => s.stationName !== prevStation.stationName
|
||||
// );
|
||||
// }
|
||||
// // Dispatchers switched
|
||||
// else if (prevStation.dispatcherName !== currStationData.dispatcherName) {
|
||||
// previousOnlineStations = previousOnlineStations.filter(
|
||||
// (s) => s.stationName !== prevStation.stationName
|
||||
// );
|
||||
|
||||
// previousOnlineStations.push({
|
||||
// stationName: currStationData.stationName,
|
||||
// dispatcherName: currStationData.dispatcherName,
|
||||
// occupiedFrom: Date.now(),
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
// stationAPIData
|
||||
// .filter(
|
||||
// (stationData) =>
|
||||
// !previousOnlineStations.find(
|
||||
// (prevStation) => prevStation.stationName === stationData.stationName
|
||||
// )
|
||||
// )
|
||||
// .forEach((stationData) => {
|
||||
// previousOnlineStations.push({
|
||||
// stationName: stationData.stationName,
|
||||
// dispatcherName: stationData.dispatcherName,
|
||||
// occupiedFrom: Date.now(),
|
||||
// });
|
||||
// });
|
||||
|
||||
// const stationsDoc = db.collection("stations").doc("previous");
|
||||
|
||||
// stationsDoc.set({ previousOnlineStations });
|
||||
// });
|
||||
|
||||
// exports.test = functions.https.onRequest(async (req, res) => {
|
||||
// try {
|
||||
// stationAPIData = await (await axios.get(API_URL)).data.message;
|
||||
// } catch (error) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // On server start
|
||||
// if (previousOnlineStations.length == 0) {
|
||||
// stationAPIData
|
||||
// .filter(
|
||||
// (station) =>
|
||||
// station.isOnline &&
|
||||
// station.region === "eu" &&
|
||||
// stationJSONList.some(
|
||||
// (data) => data.stationName === station.stationName
|
||||
// )
|
||||
// )
|
||||
// .forEach((station) => {
|
||||
// const occupiedFrom = Date.now();
|
||||
|
||||
// previousOnlineStations.push({
|
||||
// stationName: station.stationName,
|
||||
// dispatcherName: station.dispatcherName,
|
||||
// occupiedFrom,
|
||||
// });
|
||||
// });
|
||||
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // When array with previous stations isn't empty
|
||||
// previousOnlineStations.forEach((prevStation) => {
|
||||
// const currStationData = stationAPIData.find(
|
||||
// (currStation) => currStation.stationName === prevStation.stationName
|
||||
// );
|
||||
|
||||
// // Dispatcher left
|
||||
// if (!currStationData) {
|
||||
// previousOnlineStations = previousOnlineStations.filter(
|
||||
// (s) => s.stationName !== prevStation.stationName
|
||||
// );
|
||||
// }
|
||||
// // Dispatchers switched
|
||||
// else if (prevStation.dispatcherName !== currStationData.dispatcherName) {
|
||||
// previousOnlineStations = previousOnlineStations.filter(
|
||||
// (s) => s.stationName !== prevStation.stationName
|
||||
// );
|
||||
|
||||
// previousOnlineStations.push({
|
||||
// stationName: currStationData.stationName,
|
||||
// dispatcherName: currStationData.dispatcherName,
|
||||
// occupiedFrom: Date.now(),
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
// stationAPIData
|
||||
// .filter(
|
||||
// (stationData) =>
|
||||
// !previousOnlineStations.find(
|
||||
// (prevStation) => prevStation.stationName === stationData.stationName
|
||||
// )
|
||||
// )
|
||||
// .forEach((stationData) => {
|
||||
// previousOnlineStations.push({
|
||||
// stationName: stationData.stationName,
|
||||
// dispatcherName: stationData.dispatcherName,
|
||||
// occupiedFrom: Date.now(),
|
||||
// });
|
||||
// });
|
||||
|
||||
// const stationsDoc = db.collection("stations").doc("previous");
|
||||
|
||||
// stationsDoc.set({ previousOnlineStations });
|
||||
|
||||
// res.status(200);
|
||||
// });
|
||||
|
||||
// // // const scheduledUpdate = functions.pubsub
|
||||
// // // .schedule("0 * * * *")
|
||||
// // // .onRun(async (context) => {
|
||||
// // // let stationData: {
|
||||
// // // stationName: string;
|
||||
// // // dispatcherName: string;
|
||||
// // // isOnline: boolean;
|
||||
// // // region: string;
|
||||
// // // }[];
|
||||
|
||||
// // // try {
|
||||
// // // stationData = await (
|
||||
// // // await axios.get(
|
||||
// // // "https://api.td2.info.pl:9640/?method=getStationsOnline"
|
||||
// // // )
|
||||
// // // ).data.message;
|
||||
// // // } catch (error) {
|
||||
// // // return;
|
||||
// // // }
|
||||
|
||||
// // // const historyRef = db.collection("history");
|
||||
|
||||
// // // stationData.forEach(async (station) => {
|
||||
// // // const docRef = historyRef.doc(station.stationName);
|
||||
// // // const docSnapshot = await docRef.get();
|
||||
|
||||
// // // if (!docSnapshot.exists) {
|
||||
// // // docRef.set({
|
||||
// // // occupiedFrom: Date.now(),
|
||||
// // // currentDispatcherName: station.dispatcherName,
|
||||
// // // });
|
||||
// // // return;
|
||||
// // // }
|
||||
// // // });
|
||||
|
||||
// // // const snapshot = await historyRef.get();
|
||||
|
||||
// // // snapshot.forEach(async (doc) => {
|
||||
// // // const docData = doc.data();
|
||||
// // // const docRef = historyRef.doc(doc.id);
|
||||
|
||||
// // // const APIStationData = stationData
|
||||
// // // .filter((station) => station.isOnline && station.region === "eu")
|
||||
// // // .find((station) => station.stationName == doc.id);
|
||||
|
||||
// // // if (docData.currentDispatcherName != "") {
|
||||
// // // if (
|
||||
// // // !APIStationData ||
|
||||
// // // APIStationData.dispatcherName != docData.currentDispatcherName
|
||||
// // // ) {
|
||||
// // // docRef.update({
|
||||
// // // currentDispatcherName: !APIStationData
|
||||
// // // ? ""
|
||||
// // // : APIStationData.dispatcherName,
|
||||
// // // occupiedFrom: !APIStationData ? 0 : Date.now(),
|
||||
// // // });
|
||||
|
||||
// // // docRef.collection("dispatcherHistory").add({
|
||||
// // // currentDispatcherName: docData.currentDispatcherName,
|
||||
// // // occupiedFrom: docData.occupiedFrom,
|
||||
// // // occupiedTo: Date.now(),
|
||||
// // // });
|
||||
// // // }
|
||||
// // // } else if (APIStationData) {
|
||||
// // // docRef.update({
|
||||
// // // currentDispatcherName: APIStationData.dispatcherName,
|
||||
// // // occupiedFrom: Date.now(),
|
||||
// // // });
|
||||
// // // }
|
||||
// // // });
|
||||
// // // });
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"noImplicitReturns": true,
|
||||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true,
|
||||
"noUnusedLocals": true,
|
||||
"outDir": "lib",
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"target": "es2017"
|
||||
},
|
||||
"compileOnSave": true,
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
{
|
||||
"rules": {
|
||||
// -- Strict errors --
|
||||
// These lint rules are likely always a good idea.
|
||||
|
||||
// Force function overloads to be declared together. This ensures readers understand APIs.
|
||||
"adjacent-overload-signatures": true,
|
||||
|
||||
// Do not allow the subtle/obscure comma operator.
|
||||
"ban-comma-operator": true,
|
||||
|
||||
// Do not allow internal modules or namespaces . These are deprecated in favor of ES6 modules.
|
||||
"no-namespace": true,
|
||||
|
||||
// Do not allow parameters to be reassigned. To avoid bugs, developers should instead assign new values to new vars.
|
||||
"no-parameter-reassignment": true,
|
||||
|
||||
// Force the use of ES6-style imports instead of /// <reference path=> imports.
|
||||
"no-reference": true,
|
||||
|
||||
// Do not allow type assertions that do nothing. This is a big warning that the developer may not understand the
|
||||
// code currently being edited (they may be incorrectly handling a different type case that does not exist).
|
||||
"no-unnecessary-type-assertion": true,
|
||||
|
||||
// Disallow nonsensical label usage.
|
||||
"label-position": true,
|
||||
|
||||
// Disallows the (often typo) syntax if (var1 = var2). Replace with if (var2) { var1 = var2 }.
|
||||
"no-conditional-assignment": true,
|
||||
|
||||
// Disallows constructors for primitive types (e.g. new Number('123'), though Number('123') is still allowed).
|
||||
"no-construct": true,
|
||||
|
||||
// Do not allow super() to be called twice in a constructor.
|
||||
"no-duplicate-super": true,
|
||||
|
||||
// Do not allow the same case to appear more than once in a switch block.
|
||||
"no-duplicate-switch-case": true,
|
||||
|
||||
// Do not allow a variable to be declared more than once in the same block. Consider function parameters in this
|
||||
// rule.
|
||||
"no-duplicate-variable": [true, "check-parameters"],
|
||||
|
||||
// Disallows a variable definition in an inner scope from shadowing a variable in an outer scope. Developers should
|
||||
// instead use a separate variable name.
|
||||
"no-shadowed-variable": true,
|
||||
|
||||
// Empty blocks are almost never needed. Allow the one general exception: empty catch blocks.
|
||||
"no-empty": [true, "allow-empty-catch"],
|
||||
|
||||
// Functions must either be handled directly (e.g. with a catch() handler) or returned to another function.
|
||||
// This is a major source of errors in Cloud Functions and the team strongly recommends leaving this rule on.
|
||||
"no-floating-promises": false,
|
||||
|
||||
// Do not allow any imports for modules that are not in package.json. These will almost certainly fail when
|
||||
// deployed.
|
||||
"no-implicit-dependencies": true,
|
||||
|
||||
// The 'this' keyword can only be used inside of classes.
|
||||
"no-invalid-this": true,
|
||||
|
||||
// Do not allow strings to be thrown because they will not include stack traces. Throw Errors instead.
|
||||
"no-string-throw": true,
|
||||
|
||||
// Disallow control flow statements, such as return, continue, break, and throw in finally blocks.
|
||||
"no-unsafe-finally": true,
|
||||
|
||||
// Expressions must always return a value. Avoids common errors like const myValue = functionReturningVoid();
|
||||
"no-void-expression": [true, "ignore-arrow-function-shorthand"],
|
||||
|
||||
// Disallow duplicate imports in the same file.
|
||||
"no-duplicate-imports": true,
|
||||
|
||||
// -- Strong Warnings --
|
||||
// These rules should almost never be needed, but may be included due to legacy code.
|
||||
// They are left as a warning to avoid frustration with blocked deploys when the developer
|
||||
// understand the warning and wants to deploy anyway.
|
||||
|
||||
// Warn when an empty interface is defined. These are generally not useful.
|
||||
"no-empty-interface": { "severity": "warning" },
|
||||
|
||||
// Warn when an import will have side effects.
|
||||
"no-import-side-effect": { "severity": "warning" },
|
||||
|
||||
// Warn when variables are defined with var. Var has subtle meaning that can lead to bugs. Strongly prefer const for
|
||||
// most values and let for values that will change.
|
||||
"no-var-keyword": { "severity": "warning" },
|
||||
|
||||
// Prefer === and !== over == and !=. The latter operators support overloads that are often accidental.
|
||||
"triple-equals": { "severity": "warning" },
|
||||
|
||||
// Warn when using deprecated APIs.
|
||||
"deprecation": { "severity": "warning" },
|
||||
|
||||
// -- Light Warnings --
|
||||
// These rules are intended to help developers use better style. Simpler code has fewer bugs. These would be "info"
|
||||
// if TSLint supported such a level.
|
||||
|
||||
// prefer for( ... of ... ) to an index loop when the index is only used to fetch an object from an array.
|
||||
// (Even better: check out utils like .map if transforming an array!)
|
||||
"prefer-for-of": { "severity": "warning" },
|
||||
|
||||
// Warns if function overloads could be unified into a single function with optional or rest parameters.
|
||||
"unified-signatures": { "severity": "warning" },
|
||||
|
||||
// Prefer const for values that will not change. This better documents code.
|
||||
"prefer-const": { "severity": "warning" },
|
||||
|
||||
// Multi-line object literals and function calls should have a trailing comma. This helps avoid merge conflicts.
|
||||
"trailing-comma": { "severity": "warning" }
|
||||
},
|
||||
|
||||
"defaultSeverity": "error"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
Web / API server started at http://localhost:4000
|
||||
Generated
+75
-683
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,6 @@
|
||||
"dependencies": {
|
||||
"core-js": "^3.6.5",
|
||||
"dotenv": "^8.2.0",
|
||||
"firebase": "^7.21.0",
|
||||
"howler": "^2.2.1",
|
||||
"vue": "^2.6.11",
|
||||
"vue-class-component": "^7.2.5",
|
||||
|
||||
@@ -1850,9 +1850,9 @@
|
||||
},
|
||||
{
|
||||
"stationName": "Sroka",
|
||||
"stationURL": "https://td2.info.pl/w-trakcie-prac/podg-sroka/",
|
||||
"stationURL": "https://td2.info.pl/scenerie/sroka-projekt-1001/",
|
||||
"stationLines": "",
|
||||
"reqLevel": "8",
|
||||
"reqLevel": "7",
|
||||
"supportersOnly": "NIE",
|
||||
"signalType": "współczesna",
|
||||
"controlType": "SCS",
|
||||
@@ -1870,7 +1870,6 @@
|
||||
},
|
||||
"default": false,
|
||||
"nonPublic": false,
|
||||
"unavailable": true,
|
||||
"subStations": ["Sroka, podg.", "Sroka Południe, podg."],
|
||||
"stops": ["Sroka, podg."]
|
||||
},
|
||||
|
||||
+6
-8
@@ -3,8 +3,6 @@ import VueRouter, { RouteConfig } from 'vue-router';
|
||||
|
||||
import StationsView from '../views/StationsView.vue';
|
||||
import TrainsView from '../views/TrainsView.vue';
|
||||
import TimetableView from '../views/TimetableView.vue';
|
||||
import SceneryView from '../views/SceneryView.vue';
|
||||
|
||||
Vue.use(VueRouter);
|
||||
|
||||
@@ -23,15 +21,15 @@ const routes: Array<RouteConfig> = [
|
||||
{
|
||||
path: '/timetable',
|
||||
name: 'TimetableView',
|
||||
component: TimetableView,
|
||||
props: true
|
||||
component: () => import('@/views/TimetableView.vue'),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: '/scenery',
|
||||
name: "SceneryView",
|
||||
component: SceneryView,
|
||||
props: true
|
||||
}
|
||||
name: 'SceneryView',
|
||||
component: () => import('@/views/SceneryView.vue'),
|
||||
props: true,
|
||||
},
|
||||
];
|
||||
|
||||
const router = new VueRouter({
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import * as firebase from "firebase/app";
|
||||
import "firebase/firestore";
|
||||
import "firebase/functions";
|
||||
|
||||
require("dotenv").config();
|
||||
|
||||
firebase.initializeApp({
|
||||
apiKey: process.env.API_KEY,
|
||||
authDomain: "stacjownik-td2.firebaseapp.com",
|
||||
databaseURL: "https://stacjownik-td2.firebaseio.com",
|
||||
projectId: "stacjownik-td2",
|
||||
});
|
||||
|
||||
export default {
|
||||
db: firebase.firestore(),
|
||||
functions: firebase.functions(),
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="stations_view" ref="view">
|
||||
<div class="stations_view">
|
||||
<div class="stations_wrapper">
|
||||
<div class="stations_body">
|
||||
<div class="body_bar">
|
||||
@@ -35,7 +35,6 @@
|
||||
:sorterActive="sorterActive"
|
||||
:setFocusedStation="setFocusedStation"
|
||||
:changeSorter="changeSorter"
|
||||
ref="table"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -140,8 +139,6 @@ export default class StationsView extends Vue {
|
||||
this.focusedStationName = "";
|
||||
}
|
||||
});
|
||||
|
||||
console.log((this.$refs.table as Vue).$el.clientWidth);
|
||||
}
|
||||
|
||||
toggleCardsState(name: string): void {
|
||||
|
||||
Reference in New Issue
Block a user