11<template >
2- <div
3- v-if =" publicMessages.length && !loading"
4- class =" my-1"
5- >
6- <!-- eslint-disable vue/no-v-html -->
7- <v-alert
8- v-for =" (messageObj,index) in publicMessages"
9- :key =" messageObj.message+'_'+index"
10- dense
11- type =" warning"
12- class =" mb-2 mx-2 flex-grow-1"
13- v-html =" `${moment(messageObj.updatedAt)}: ${messageObj.message}`"
14- />
15- <!-- eslint-enable vue/no-v-html -->
2+ <div >
3+ <div v-if =" publicMessages.length && !loading" >
4+ <!-- eslint-disable vue/no-v-html -->
5+ <v-alert
6+ v-for =" (messageObj, index) in publicMessages"
7+ :key =" messageObj.message + '_' + index"
8+ dense
9+ type =" warning"
10+ class =" mt-2 mb-2 mx-2 flex-grow-1 text-center"
11+ v-html =" `${moment(messageObj.updatedAt)}: ${messageObj.message}`"
12+ />
13+ <!-- eslint-enable vue/no-v-html -->
14+ </div >
15+ <div v-if =" is_development()" >
16+ <v-alert
17+ key =" localhost_warning"
18+ dense
19+ type =" warning"
20+ class =" mt-2 mb-2 mx-2 flex-grow-1 text-center"
21+ >
22+ You are using dev-api.fairsharing.org; changes will not appear in
23+ production and will be lost when this server is updated.
24+ </v-alert >
25+ </div >
26+ <div v-if =" is_localhost()" >
27+ <v-alert
28+ key =" dev_server_warning"
29+ dense
30+ type =" warning"
31+ class =" mt-2 mb-2 mx-2 flex-grow-1 text-center"
32+ >
33+ You are using localhost; changes will not appear in production and will
34+ be lost when this server is updated.
35+ </v-alert >
36+ </div >
1637 </div >
1738</template >
1839
1940<script >
2041// no-v-html allowed as the text will come only from super_curators...
2142import moment from " moment" ;
22- import {mapState } from " vuex" ;
43+ import { mapState } from " vuex" ;
2344
2445export default {
2546 name: " PublicMessages" ,
2647 computed: {
27- ... mapState (' messages' , [" publicMessages" , " loading" ])
48+ ... mapState (" messages" , [" publicMessages" , " loading" ]),
2849 },
2950 methods: {
3051 moment (date ) {
31- return moment (date).format (' dddd, MMMM Do YYYY, H:mm' );
32- }
33- }
34- }
52+ return moment (date).format (" dddd, MMMM Do YYYY, H:mm" );
53+ },
54+ is_development () {
55+ if (process .env .VUE_APP_API_ENDPOINT .includes (" dev-api" )) {
56+ return true ;
57+ }
58+ return false ;
59+ },
60+ is_localhost () {
61+ if (
62+ process .env .VUE_APP_API_ENDPOINT .includes (" localhost:3000" ) ||
63+ process .env .VUE_APP_API_ENDPOINT .includes (" 127.0.0.1:3000" )
64+ ) {
65+ return true ;
66+ }
67+ return false ;
68+ },
69+ },
70+ };
3571 </script >
3672
37- <style scoped>
38-
39- </style >
73+ <style scoped></style >
0 commit comments