Skip to content

Commit 032af4f

Browse files
add: status ping is now dynamic after moving to betterstatus
1 parent 92d2587 commit 032af4f

File tree

4 files changed

+50
-3
lines changed

4 files changed

+50
-3
lines changed

components/global/footer.vue

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@
183183
class="mt-4 transition transform hover:-translate-y-0.5 duration-200 cursor-pointer underline font-bold text-gray-200 flex justify-center items-center space-x-3">
184184
<p>Services Status</p>
185185
<div>
186-
<p class="w-3 h-3 rounded-full bg-green-400 animate-ping"></p>
187-
<p class="w-3 h-3 -mt-3 absolute z-10 rounded-full bg-green-400"></p>
186+
<p :class="getStatusColor() +' w-3 h-3 rounded-full animate-ping'"></p>
187+
<p :class="getStatusColor() +' w-3 h-3 -mt-3 absolute z-10 rounded-full'"></p>
188188
</div>
189189
</a>
190190

@@ -195,9 +195,45 @@
195195
</template>
196196

197197
<script>
198+
import {getBetterStatus} from "~/lib/checkout/productHelper";
199+
198200
export default {
199201
name: 'Footer',
202+
mounted() {
203+
this.getCurrentBetterStatus()
204+
},
205+
data() {
206+
return {
207+
status: ''
208+
}
209+
},
210+
watch: {
211+
status: {
212+
handler() {
213+
console.log('Status changed to ' + this.status)
214+
}
215+
}
216+
},
200217
methods: {
218+
getStatusColor() {
219+
switch (this.status) {
220+
case 'Up':
221+
return 'bg-green-400'
222+
case 'Down':
223+
return 'bg-red-400'
224+
case 'Degraded':
225+
return 'bg-yellow-400'
226+
default:
227+
return 'bg-gray-400'
228+
}
229+
},
230+
async getCurrentBetterStatus() {
231+
const status = await getBetterStatus(this.$axios)
232+
console.log({status})
233+
234+
this.status = status
235+
console.log({status_from_data: this.status})
236+
},
201237
getCurrentYear() {
202238
return new Date().getFullYear()
203239
}

lib/checkout/productHelper.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,14 @@ export const getProductNameWithId = (id) => {
1212
return 'Debian XFCE'
1313
}
1414
}
15+
16+
export const getBetterStatus = async (axios) => {
17+
try {
18+
const result = await axios.get('/better-status')
19+
console.log({status_data: result.data.response})
20+
return result.data.response
21+
} catch (e) {
22+
console.log(e)
23+
return false
24+
}
25+
}

store/misc.js

Whitespace-only changes.

tailwind.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = {
88
options: {
99
safelist: [
1010
'-rotate-3', 'rotate-2', '-rotate-3', 'rotate-3', 'from-violet', 'to-primary-500', 'bg-gradient-to-r', 'from-blue-700', 'to-blue-400', 'from-purple-700', 'to-pink-900', 'from-yellow-600', 'to-red-600',
11-
'bg-primary-400', 'bg-purple-600', 'text-teal-400', 'bg-blue-400', 'bg-purple-400', 'bg-green-400', 'bg-indigo-400', 'bg-pink-400', 'bg-red-400', 'w-10', 'w-6', 'stroke-current',
11+
'bg-primary-400', 'bg-purple-600', 'text-teal-400', 'bg-blue-400', 'bg-purple-400', 'bg-green-400', 'bg-indigo-400', 'bg-pink-400', 'bg-yellow-400', 'bg-red-400', 'w-10', 'w-6', 'stroke-current',
1212
'text-primary-400', 'text-blue-400', 'text-purple-400', 'text-green-400', 'text-indigo-400', 'text-pink-400', 'text-red-400'
1313
, 'text-pink-400', 'text-indigo-400', 'text-blue-400', 'text-teal-400', 'text-primary-400', 'text-purple-400', 'text-green-400', 'text-cyan-400'
1414
]

0 commit comments

Comments
 (0)