Skip to content

Commit 347d282

Browse files
authored
Merge pull request #200 from fttx-gr/revert-199-master
Revert "feat: cache slow pages that aren't updated frequently anyway"
2 parents 3c00d06 + c595de7 commit 347d282

File tree

7 files changed

+10711
-9919
lines changed

7 files changed

+10711
-9919
lines changed

assets/css/main.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

nuxt.config.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,11 @@ export default {
108108
/*
109109
** Global CSS
110110
*/
111-
css: [
112-
"@/assets/css/main.css",
113-
],
111+
css: [],
114112

115113
loading: {
116114
color: "#109E92"
117115
},
118-
119116

120117
/*
121118
** Plugins to load before mounting the App
@@ -136,8 +133,8 @@ export default {
136133
** Nuxt.js dev-modules
137134
*/
138135
buildModules: [
139-
"@nuxt/postcss8",
140136
// Doc: https://github.com/nuxt-community/eslint-module
137+
"@nuxtjs/tailwindcss",
141138
"@nuxtjs/pwa"
142139
],
143140

@@ -196,15 +193,7 @@ export default {
196193
** Build configuration
197194
** See https://nuxtjs.org/api/configuration-build/
198195
*/
199-
build: {
200-
transpile: [/^vue2-google-maps($|\/)/],
201-
postcss: {
202-
plugins: {
203-
tailwindcss: {},
204-
autoprefixer: {}
205-
}
206-
}
207-
},
196+
build: { transpile: [/^vue2-google-maps($|\/)/] },
208197
env: {
209198
VUE_APP_GOOGLE_MAPS_API_KEY:
210199
process.env.NODE_ENV === "development"

package.json

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,34 @@
99
"generate": "nuxt generate"
1010
},
1111
"dependencies": {
12-
"@nuxtjs/axios": "5.13.6",
13-
"@nuxtjs/sitemap": "2.4.0",
14-
"@supabase/supabase-js": "1.35.4",
15-
"animated-number-vue": "1.0.0",
16-
"cookie-parser": "1.4.6",
17-
"discord.js": "12.5.3",
18-
"dotenv": "16.0.1",
19-
"express": "4.18.1",
20-
"express-rate-limit": "6.4.0",
21-
"helmet": "5.1.0",
22-
"hpp": "0.2.3",
23-
"lru-cache": "7.14.0",
24-
"marker-clusterer-plus": "2.1.4",
25-
"morgan": "1.10.0",
26-
"node-geocoder": "4.1.0",
27-
"nuxt": "2.15.8",
28-
"shrink-ray-current": "4.1.3",
29-
"vue-browser-geolocation": "1.8.0",
30-
"vue-toastification": "1.7.14",
31-
"vue2-google-maps": "0.10.7",
32-
"xss-clean": "0.1.1"
12+
"@nuxtjs/axios": "^5.13.6",
13+
"@nuxtjs/sitemap": "^2.4.0",
14+
"@supabase/supabase-js": "^1.35.4",
15+
"animated-number-vue": "^1.0.0",
16+
"cookie-parser": "^1.4.6",
17+
"discord.js": "^12.5.3",
18+
"dotenv": "^16.0.1",
19+
"express": "^4.18.1",
20+
"express-rate-limit": "^6.4.0",
21+
"helmet": "^5.1.0",
22+
"hpp": "^0.2.3",
23+
"marker-clusterer-plus": "^2.1.4",
24+
"morgan": "^1.10.0",
25+
"node-geocoder": "^4.1.0",
26+
"nuxt": "^2.15.8",
27+
"shrink-ray-current": "^4.1.3",
28+
"vue-browser-geolocation": "^1.8.0",
29+
"vue-toastification": "^1.7.14",
30+
"vue2-google-maps": "^0.10.7",
31+
"xss-clean": "^0.1.1"
3332
},
3433
"devDependencies": {
35-
"@nuxtjs/dotenv": "1.4.1",
36-
"@nuxt/postcss8": "^1.1.3",
37-
"autoprefixer": "^10.4.5",
38-
"@nuxtjs/pwa": "3.3.5",
39-
"prettier": "^2.6.2",
40-
"prettier-plugin-tailwindcss": "^0.1.10",
41-
"tailwindcss": "^3.0.24",
42-
"postcss": "8.4.14",
43-
"sass": "1.53.0",
44-
"sass-loader": "13.0.2"
34+
"@nuxtjs/dotenv": "^1.4.1",
35+
"@nuxtjs/pwa": "^3.3.5",
36+
"@nuxtjs/tailwindcss": "^5.1.3",
37+
"postcss": "^8.4.14",
38+
"sass": "^1.53.0",
39+
"sass-loader": "^13.0.2"
4540
},
4641
"optionalDependencies": {
4742
"iltorb": "~2.4.5",

pages/index.vue

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,24 @@
11
<template>
2-
32
<Map :cabinets="cabinets" :dslam="dslam" />
4-
53
</template>
64

75
<script>
86
import { supabase } from "../utils/supabase-client";
9-
import LRU from "lru-cache";
10-
11-
const options = {
12-
max: 500,
13-
ttl: 1000 * 60 * 60 * 2
14-
};
15-
16-
const cache = new LRU(options);
17-
187
export default {
198
async asyncData() {
20-
const check = cache.get("index");
21-
if (check) return check;
9+
// DSLAM LOADING
2210
const { data: dslam } = await supabase.from("centers").select("*");
2311
12+
// Cabinets
2413
const { data: cabinets } = await supabase
2514
.from("cabinets")
2615
.select("*")
2716
.neq("type", "DSLAM");
2817
29-
cache.set("index", { dslam, cabinets });
30-
3118
return {
3219
dslam,
3320
cabinets
3421
};
3522
}
3623
};
3724
</script>
38-

pages/stats.vue

Lines changed: 33 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,173 +1,115 @@
11
<template>
2-
3-
<div v-if="data.vf" class="mx-8 mt-4 max-w-4xl md:mx-auto">
4-
5-
<h1 class="my-4 text-center text-4xl font-semibold">
6-
Stats of the FTTx.gr Database
2+
<div v-if="data.vf" class="max-w-4xl mx-8 mt-4 md:mx-auto">
3+
<h1 class="my-4 text-4xl font-semibold text-center">
4+
Stats of the FTTx.gr Database
75
</h1>
8-
9-
<div class="mx-auto grid max-w-md grid-cols-1 gap-4 md:grid-cols-2">
10-
6+
<div class="grid max-w-md grid-cols-1 gap-4 mx-auto md:grid-cols-2">
117
<div
12-
class="flex flex-col items-center justify-center rounded-md border border-red-500 bg-red-500/25 p-2"
8+
class="flex flex-col items-center justify-center p-2 border border-red-500 rounded-md bg-red-500/25"
139
>
14-
15-
<h1 class="py-2 text-center font-bold uppercase text-red-500">
16-
Vodafone
10+
<h1 class="py-2 font-bold text-center text-red-500 uppercase">
11+
Vodafone
1712
</h1>
18-
1913
<img
20-
class="my-2 w-6"
14+
class="w-6 my-2"
2115
src="@/static/img/vf-marker-minified.png"
2216
alt="Vodafone Cabinets"
2317
/>
24-
2518
<span class="font-semibold">{{ data.vf }}</span>
26-
2719
</div>
28-
2920
<div
30-
class="flex flex-col items-center justify-center rounded-md border border-blue-500 bg-blue-500/25 p-2"
21+
class="flex flex-col items-center justify-center p-2 border border-blue-500 rounded-md bg-blue-500/25"
3122
>
32-
33-
<h1 class="py-2 text-center font-bold uppercase text-blue-500">
34-
COSMOTE
23+
<h1 class="py-2 font-bold text-center text-blue-500 uppercase">
24+
COSMOTE
3525
</h1>
36-
3726
<img
38-
class="my-2 w-6"
27+
class="w-6 my-2"
3928
src="@/static/img/ote-marker-minified.png"
4029
alt="COSMOTE Cabinets"
4130
/>
42-
4331
<span class="font-semibold">{{ data.ote }}</span>
44-
4532
</div>
46-
4733
<div
48-
class="flex flex-col items-center justify-center rounded-md border border-blue-600 bg-blue-600/30 p-2"
34+
class="flex flex-col items-center justify-center p-2 border border-blue-600 rounded-md bg-blue-600/30"
4935
>
50-
51-
<h1 class="py-2 text-center font-bold uppercase text-blue-600">
52-
WIND
36+
<h1 class="py-2 font-bold text-center text-blue-600 uppercase">
37+
WIND
5338
</h1>
54-
5539
<img
56-
class="my-2 w-6"
40+
class="w-6 my-2"
5741
src="@/static/img/wind-marker-minified.png"
5842
alt="WIND Cabinets"
5943
/>
60-
6144
<span class="font-semibold">{{ data.wind }}</span>
62-
6345
</div>
64-
6546
<div
66-
class="flex flex-col items-center justify-center rounded-md border border-orange-500 bg-orange-500/25 p-2"
47+
class="flex flex-col items-center justify-center p-2 border border-orange-500 rounded-md bg-orange-500/25"
6748
>
68-
69-
<h1 class="py-2 text-center font-bold uppercase text-orange-500">
70-
RURAL CONNECT
49+
<h1 class="py-2 font-bold text-center text-orange-500 uppercase">
50+
RURAL CONNECT
7151
</h1>
72-
7352
<img
74-
class="my-2 w-6"
53+
class="w-6 my-2"
7554
src="@/static/img/rurcon-marker-minified.png"
7655
alt="Rural Connect Cabinets"
7756
/>
78-
7957
<span class="font-semibold">{{ data.rurcon }}</span>
80-
8158
</div>
82-
8359
<div
84-
class="flex flex-col items-center justify-center rounded-md border border-gray-500 bg-gray-500/25 p-2"
60+
class="flex flex-col items-center justify-center p-2 border border-gray-500 rounded-md bg-gray-500/25"
8561
>
86-
87-
<h1 class="py-2 text-center font-bold uppercase text-gray-500">
88-
UNKNOWN
62+
<h1 class="py-2 font-bold text-center text-gray-500 uppercase">
63+
UNKNOWN
8964
</h1>
90-
91-
<img class="my-2 w-6" src="@/static/img/g-marker.png" alt="Unknown" />
92-
65+
<img class="w-6 my-2" src="@/static/img/g-marker.png" alt="Unknown" />
9366
<span class="font-semibold">{{ data.unknown }}</span>
94-
9567
</div>
96-
9768
<div
98-
class="flex flex-col items-center justify-center rounded-md border border-sky-500 bg-sky-500/25 p-2"
69+
class="flex flex-col items-center justify-center p-2 border rounded-md bg-sky-500/25 border-sky-500"
9970
>
100-
101-
<h1 class="py-2 text-center font-bold uppercase text-sky-500">
102-
CENTERS
71+
<h1 class="py-2 font-bold text-center uppercase text-sky-500">
72+
CENTERS
10373
</h1>
104-
10574
<img
106-
class="my-2 w-6"
75+
class="w-6 my-2"
10776
src="@/static/img/ote-marker-center-minified.png"
10877
alt="A.K Centers"
10978
/>
110-
11179
<span class="font-semibold">{{ data.centers }}</span>
112-
11380
</div>
114-
115-
<div class="col-span-full flex justify-between">
116-
81+
<div class="flex justify-between col-span-full">
11782
<div>
118-
ADSL:
119-
<span class="font-semibold">{{ data.adsl }}</span>
120-
83+
ADSL: <span class="font-semibold">{{ data.adsl }}</span>
12184
</div>
122-
12385
<div>
124-
VDSL:
125-
<span class="font-semibold">{{ data.vdsl }}</span>
126-
86+
VDSL: <span class="font-semibold">{{ data.vdsl }}</span>
12787
</div>
128-
12988
<div>
130-
FTTH:
131-
<span class="font-semibold">{{ data.ftth }}</span>
132-
89+
FTTH: <span class="font-semibold">{{ data.ftth }}</span>
13390
</div>
134-
13591
</div>
136-
13792
</div>
138-
13993
</div>
140-
14194
</template>
14295

14396
<script>
14497
import { supabase } from "@/utils/supabase-client";
145-
import LRU from "lru-cache";
146-
147-
const options = {
148-
max: 500,
149-
ttl: 1000 * 60 * 60 * 2
150-
};
151-
152-
const cache = new LRU(options);
15398
export default {
15499
data() {
155100
return {
156101
data: null
157102
};
158103
},
159104
async fetch() {
160-
const check = cache.get("stats");
161-
if (check) return (this.data = check);
162-
163105
const { data } = await supabase
164106
.from("cabinets")
165107
.select("*", { count: "exact" });
166108
const { count: centers } = await supabase
167109
.from("centers")
168110
.select("*", { count: "exact" });
169111
170-
const payload = {
112+
this.data = {
171113
vf: data.filter(c => c.isp === "Vodafone").length.toLocaleString(),
172114
ote: data.filter(c => c.isp === "OTE").length.toLocaleString(),
173115
rurcon: data
@@ -180,11 +122,8 @@ export default {
180122
adsl: data.filter(c => c.type === "ADSL").length.toLocaleString(),
181123
ftth: data.filter(c => c.type === "FTTH").length.toLocaleString()
182124
};
183-
cache.set("stats", payload);
184-
this.data = payload;
185125
}
186126
};
187127
</script>
188128

189129
<style></style>
190-

tailwind.config.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
const colors = require("tailwindcss/colors");
22

33
module.exports = {
4-
content: [
5-
"./components/**/*.{js,vue,ts}",
6-
"./layouts/**/*.vue",
7-
"./pages/**/*.vue",
8-
"./plugins/**/*.{js,ts}",
9-
"./nuxt.config.{js,ts}",
10-
"./content/**/*.md"
11-
],
4+
mode: "jit",
5+
purge: [],
6+
darkMode: false, // or 'media' or 'class'
127
theme: {
138
extend: {
149
colors: {

0 commit comments

Comments
 (0)