From ea96e5b3f1290d2cc187458da004315ec79d3129 Mon Sep 17 00:00:00 2001 From: TripleThreads Date: Tue, 11 Aug 2020 12:41:43 +0300 Subject: [PATCH 01/18] add initial components refactor router --- .idea/workspace.xml | 28 ++-------- covid-19-app-web/src/router/admin.js | 16 ++++++ covid-19-app-web/src/router/index.js | 53 ++++--------------- covid-19-app-web/src/router/user-routes.js | 46 ++++++++++++++++ .../src/views-admin/auth/CreateAccount.vue | 11 ++++ .../src/views-admin/dashboard/Dashboard.vue | 43 +++++++++++++++ .../views-admin/symptoms/SymptomDetails.vue | 11 ++++ .../src/views-admin/symptoms/Symptoms.vue | 11 ++++ 8 files changed, 153 insertions(+), 66 deletions(-) create mode 100644 covid-19-app-web/src/router/admin.js create mode 100644 covid-19-app-web/src/router/user-routes.js create mode 100644 covid-19-app-web/src/views-admin/auth/CreateAccount.vue create mode 100644 covid-19-app-web/src/views-admin/dashboard/Dashboard.vue create mode 100644 covid-19-app-web/src/views-admin/symptoms/SymptomDetails.vue create mode 100644 covid-19-app-web/src/views-admin/symptoms/Symptoms.vue diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ec3faa46..b12a5363 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,30 +2,8 @@ + - - - - - - - - - - - - - - - - - - - - - - - + + + @@ -96,6 +77,7 @@ + 1587545660857 diff --git a/covid-19-app-web/src/router/admin.js b/covid-19-app-web/src/router/admin.js new file mode 100644 index 00000000..eb099013 --- /dev/null +++ b/covid-19-app-web/src/router/admin.js @@ -0,0 +1,16 @@ +const Dashboard = () => import("../views-admin/dashboard/Dashboard.vue"); +const CreateAccount = () => import("../views-admin/auth/CreateAccount.vue"); +const Symptoms = () => import("../views-admin/symptoms/Symptoms.vue"); +const SymptomDetails = () => + import("../views-admin/symptoms/SymptomDetails.vue"); + +export const admin = [ + {name: "CreateAccount", path: "register", component: CreateAccount}, + {name: "Symptoms", path: "symptoms", component: Symptoms}, + { + name: "SymptomDetails", + path: "symptoms/:id/details", + component: SymptomDetails + }, + {name: "Dashboard", path: "/", component: Dashboard} +]; diff --git a/covid-19-app-web/src/router/index.js b/covid-19-app-web/src/router/index.js index 9668dcd6..51cc325a 100644 --- a/covid-19-app-web/src/router/index.js +++ b/covid-19-app-web/src/router/index.js @@ -1,20 +1,9 @@ import Vue from "vue"; import VueRouter from "vue-router"; import store from "@/store/"; -import { languages } from "@/plugins/i18n"; -import { ifAuthenticated, ifNotAuthenticated } from "../auth/login-checker"; - -const NotFound = () => import("@/views/Errors/404.vue"); -const Home = () => import("@/views/Home/Home.vue"); -const Information = () => import("@/views/Information/Information.vue"); -const About = () => import("@/views/About/About.vue"); -const News = () => import("@/views/News/News.vue"); -const HeatMap = () => import("@/views/HeatMap/HeatMap.vue"); -const Profile = () => import("@/views/Profile/Profile.vue"); -const References = () => import("@/views/References/References.vue"); -const PrivacyPolicy = () => import("@/views/PrivacyPolicy/PrivacyPolicy.vue"); -const Login = () => import("@/views/Auth/Login.vue"); -const Register = () => import("@/views/Auth/Register.vue"); +import {languages} from "@/plugins/i18n"; +import {admin} from "./admin"; +import {userRoutes} from "./user-routes"; Vue.use(VueRouter); @@ -45,36 +34,14 @@ const routes = [ return next({ path: `${store.getters.getLanguagePreference}` }); }, children: [ - { path: "information", name: "Learn", component: Information }, - { - path: "privacy-policy", - name: "PrivacyPolicy", - component: PrivacyPolicy - }, - { path: "references", name: "References", component: References }, - { - path: "profile", - name: "Profile", - component: Profile, - beforeEnter: ifAuthenticated - }, - { - path: "register", - name: "Register", - component: Register, - beforeEnter: ifNotAuthenticated - }, { - path: "login", - name: "Login", - component: Login, - beforeEnter: ifNotAuthenticated + path: "admin", + component: { + template: "" + }, + children: [...admin] }, - { path: "about", name: "About", component: About }, - { path: "news", name: "News", component: News }, - { path: "map", name: "Map", component: HeatMap }, - { path: "", name: "Home", component: Home }, - { path: "*", name: "404", component: NotFound } + ...userRoutes ] } ]; @@ -83,5 +50,5 @@ const router = new VueRouter({ mode: "history", routes }); - +console.log(router); export default router; diff --git a/covid-19-app-web/src/router/user-routes.js b/covid-19-app-web/src/router/user-routes.js new file mode 100644 index 00000000..e12b7600 --- /dev/null +++ b/covid-19-app-web/src/router/user-routes.js @@ -0,0 +1,46 @@ +import {ifAuthenticated, ifNotAuthenticated} from "../auth/login-checker"; + +const NotFound = () => import("@/views/Errors/404.vue"); +const Home = () => import("@/views/Home/Home.vue"); +const Information = () => import("@/views/Information/Information.vue"); +const About = () => import("@/views/About/About.vue"); +const News = () => import("@/views/News/News.vue"); +const HeatMap = () => import("@/views/HeatMap/HeatMap.vue"); +const Profile = () => import("@/views/Profile/Profile.vue"); +const References = () => import("@/views/References/References.vue"); +const PrivacyPolicy = () => import("@/views/PrivacyPolicy/PrivacyPolicy.vue"); +const Login = () => import("@/views/Auth/Login.vue"); +const Register = () => import("@/views/Auth/Register.vue"); + +export const userRoutes = [ + {path: "information", name: "Learn", component: Information}, + { + path: "privacy-policy", + name: "PrivacyPolicy", + component: PrivacyPolicy + }, + {path: "references", name: "References", component: References}, + { + path: "profile", + name: "Profile", + component: Profile, + beforeEnter: ifAuthenticated + }, + { + path: "register", + name: "Register", + component: Register, + beforeEnter: ifNotAuthenticated + }, + { + path: "login", + name: "Login", + component: Login, + beforeEnter: ifNotAuthenticated + }, + {path: "about", name: "About", component: About}, + {path: "news", name: "News", component: News}, + {path: "map", name: "Map", component: HeatMap}, + {path: "", name: "Home", component: Home}, + {path: "*", name: "404", component: NotFound} +]; diff --git a/covid-19-app-web/src/views-admin/auth/CreateAccount.vue b/covid-19-app-web/src/views-admin/auth/CreateAccount.vue new file mode 100644 index 00000000..df933759 --- /dev/null +++ b/covid-19-app-web/src/views-admin/auth/CreateAccount.vue @@ -0,0 +1,11 @@ + + + + + diff --git a/covid-19-app-web/src/views-admin/dashboard/Dashboard.vue b/covid-19-app-web/src/views-admin/dashboard/Dashboard.vue new file mode 100644 index 00000000..9dd0e10c --- /dev/null +++ b/covid-19-app-web/src/views-admin/dashboard/Dashboard.vue @@ -0,0 +1,43 @@ + + + diff --git a/covid-19-app-web/src/views-admin/symptoms/SymptomDetails.vue b/covid-19-app-web/src/views-admin/symptoms/SymptomDetails.vue new file mode 100644 index 00000000..1dd7dafb --- /dev/null +++ b/covid-19-app-web/src/views-admin/symptoms/SymptomDetails.vue @@ -0,0 +1,11 @@ + + + + + diff --git a/covid-19-app-web/src/views-admin/symptoms/Symptoms.vue b/covid-19-app-web/src/views-admin/symptoms/Symptoms.vue new file mode 100644 index 00000000..80d86668 --- /dev/null +++ b/covid-19-app-web/src/views-admin/symptoms/Symptoms.vue @@ -0,0 +1,11 @@ + + + + + From 12177850c74f825c64657db7f88da2168e141db7 Mon Sep 17 00:00:00 2001 From: TripleThreads Date: Tue, 11 Aug 2020 12:42:43 +0300 Subject: [PATCH 02/18] fix lint --- covid-19-app-web/src/router/admin.js | 8 +-- covid-19-app-web/src/router/index.js | 6 +- covid-19-app-web/src/router/user-routes.js | 16 ++--- .../src/views-admin/auth/CreateAccount.vue | 6 +- .../src/views-admin/dashboard/Dashboard.vue | 70 +++++++++---------- .../views-admin/symptoms/SymptomDetails.vue | 6 +- .../src/views-admin/symptoms/Symptoms.vue | 6 +- 7 files changed, 59 insertions(+), 59 deletions(-) diff --git a/covid-19-app-web/src/router/admin.js b/covid-19-app-web/src/router/admin.js index eb099013..12ce5726 100644 --- a/covid-19-app-web/src/router/admin.js +++ b/covid-19-app-web/src/router/admin.js @@ -2,15 +2,15 @@ const Dashboard = () => import("../views-admin/dashboard/Dashboard.vue"); const CreateAccount = () => import("../views-admin/auth/CreateAccount.vue"); const Symptoms = () => import("../views-admin/symptoms/Symptoms.vue"); const SymptomDetails = () => - import("../views-admin/symptoms/SymptomDetails.vue"); + import("../views-admin/symptoms/SymptomDetails.vue"); export const admin = [ - {name: "CreateAccount", path: "register", component: CreateAccount}, - {name: "Symptoms", path: "symptoms", component: Symptoms}, + { name: "CreateAccount", path: "register", component: CreateAccount }, + { name: "Symptoms", path: "symptoms", component: Symptoms }, { name: "SymptomDetails", path: "symptoms/:id/details", component: SymptomDetails }, - {name: "Dashboard", path: "/", component: Dashboard} + { name: "Dashboard", path: "/", component: Dashboard } ]; diff --git a/covid-19-app-web/src/router/index.js b/covid-19-app-web/src/router/index.js index 51cc325a..3990c268 100644 --- a/covid-19-app-web/src/router/index.js +++ b/covid-19-app-web/src/router/index.js @@ -1,9 +1,9 @@ import Vue from "vue"; import VueRouter from "vue-router"; import store from "@/store/"; -import {languages} from "@/plugins/i18n"; -import {admin} from "./admin"; -import {userRoutes} from "./user-routes"; +import { languages } from "@/plugins/i18n"; +import { admin } from "./admin"; +import { userRoutes } from "./user-routes"; Vue.use(VueRouter); diff --git a/covid-19-app-web/src/router/user-routes.js b/covid-19-app-web/src/router/user-routes.js index e12b7600..b95ca268 100644 --- a/covid-19-app-web/src/router/user-routes.js +++ b/covid-19-app-web/src/router/user-routes.js @@ -1,4 +1,4 @@ -import {ifAuthenticated, ifNotAuthenticated} from "../auth/login-checker"; +import { ifAuthenticated, ifNotAuthenticated } from "../auth/login-checker"; const NotFound = () => import("@/views/Errors/404.vue"); const Home = () => import("@/views/Home/Home.vue"); @@ -13,13 +13,13 @@ const Login = () => import("@/views/Auth/Login.vue"); const Register = () => import("@/views/Auth/Register.vue"); export const userRoutes = [ - {path: "information", name: "Learn", component: Information}, + { path: "information", name: "Learn", component: Information }, { path: "privacy-policy", name: "PrivacyPolicy", component: PrivacyPolicy }, - {path: "references", name: "References", component: References}, + { path: "references", name: "References", component: References }, { path: "profile", name: "Profile", @@ -38,9 +38,9 @@ export const userRoutes = [ component: Login, beforeEnter: ifNotAuthenticated }, - {path: "about", name: "About", component: About}, - {path: "news", name: "News", component: News}, - {path: "map", name: "Map", component: HeatMap}, - {path: "", name: "Home", component: Home}, - {path: "*", name: "404", component: NotFound} + { path: "about", name: "About", component: About }, + { path: "news", name: "News", component: News }, + { path: "map", name: "Map", component: HeatMap }, + { path: "", name: "Home", component: Home }, + { path: "*", name: "404", component: NotFound } ]; diff --git a/covid-19-app-web/src/views-admin/auth/CreateAccount.vue b/covid-19-app-web/src/views-admin/auth/CreateAccount.vue index df933759..909d3de4 100644 --- a/covid-19-app-web/src/views-admin/auth/CreateAccount.vue +++ b/covid-19-app-web/src/views-admin/auth/CreateAccount.vue @@ -3,9 +3,9 @@ diff --git a/covid-19-app-web/src/views-admin/dashboard/Dashboard.vue b/covid-19-app-web/src/views-admin/dashboard/Dashboard.vue index 9dd0e10c..9bee94d2 100644 --- a/covid-19-app-web/src/views-admin/dashboard/Dashboard.vue +++ b/covid-19-app-web/src/views-admin/dashboard/Dashboard.vue @@ -1,43 +1,43 @@ diff --git a/covid-19-app-web/src/views-admin/symptoms/SymptomDetails.vue b/covid-19-app-web/src/views-admin/symptoms/SymptomDetails.vue index 1dd7dafb..a55920c2 100644 --- a/covid-19-app-web/src/views-admin/symptoms/SymptomDetails.vue +++ b/covid-19-app-web/src/views-admin/symptoms/SymptomDetails.vue @@ -3,9 +3,9 @@ diff --git a/covid-19-app-web/src/views-admin/symptoms/Symptoms.vue b/covid-19-app-web/src/views-admin/symptoms/Symptoms.vue index 80d86668..94724dca 100644 --- a/covid-19-app-web/src/views-admin/symptoms/Symptoms.vue +++ b/covid-19-app-web/src/views-admin/symptoms/Symptoms.vue @@ -3,9 +3,9 @@ From f63ab9008b86c537c192595139d30015d8ca8030 Mon Sep 17 00:00:00 2001 From: TripleThreads Date: Tue, 11 Aug 2020 12:57:28 +0300 Subject: [PATCH 03/18] gitignore updated --- covid-19-app-web/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/covid-19-app-web/.gitignore b/covid-19-app-web/.gitignore index c2b66ff6..fa16334e 100644 --- a/covid-19-app-web/.gitignore +++ b/covid-19-app-web/.gitignore @@ -12,6 +12,7 @@ yarn-error.log* # Editor directories and files .idea +covid-19-app-web/.idea .vscode *.suo *.ntvs* From d401741bb0b10b03de289c11cc73d9b33561fa71 Mon Sep 17 00:00:00 2001 From: TripleThreads Date: Wed, 12 Aug 2020 11:23:12 +0300 Subject: [PATCH 04/18] design dashboard components --- .../src/components/core/DateRangePicker.vue | 65 ++++++++++ .../views-admin/dashboard/DailyStatistics.vue | 88 +++++++++++++ .../src/views-admin/dashboard/Dashboard.vue | 102 ++++++++++----- .../views-admin/dashboard/GreatestHitCity.vue | 51 ++++++++ .../views-admin/dashboard/TotalStatistics.vue | 116 ++++++++++++++++++ 5 files changed, 388 insertions(+), 34 deletions(-) create mode 100644 covid-19-app-web/src/components/core/DateRangePicker.vue create mode 100644 covid-19-app-web/src/views-admin/dashboard/DailyStatistics.vue create mode 100644 covid-19-app-web/src/views-admin/dashboard/GreatestHitCity.vue create mode 100644 covid-19-app-web/src/views-admin/dashboard/TotalStatistics.vue diff --git a/covid-19-app-web/src/components/core/DateRangePicker.vue b/covid-19-app-web/src/components/core/DateRangePicker.vue new file mode 100644 index 00000000..1a09da01 --- /dev/null +++ b/covid-19-app-web/src/components/core/DateRangePicker.vue @@ -0,0 +1,65 @@ + + + + diff --git a/covid-19-app-web/src/views-admin/dashboard/DailyStatistics.vue b/covid-19-app-web/src/views-admin/dashboard/DailyStatistics.vue new file mode 100644 index 00000000..c5f5f3df --- /dev/null +++ b/covid-19-app-web/src/views-admin/dashboard/DailyStatistics.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/covid-19-app-web/src/views-admin/dashboard/Dashboard.vue b/covid-19-app-web/src/views-admin/dashboard/Dashboard.vue index 9bee94d2..40efbf64 100644 --- a/covid-19-app-web/src/views-admin/dashboard/Dashboard.vue +++ b/covid-19-app-web/src/views-admin/dashboard/Dashboard.vue @@ -1,43 +1,77 @@ diff --git a/covid-19-app-web/src/views-admin/dashboard/GreatestHitCity.vue b/covid-19-app-web/src/views-admin/dashboard/GreatestHitCity.vue new file mode 100644 index 00000000..6ee1610c --- /dev/null +++ b/covid-19-app-web/src/views-admin/dashboard/GreatestHitCity.vue @@ -0,0 +1,51 @@ + + + + + diff --git a/covid-19-app-web/src/views-admin/dashboard/TotalStatistics.vue b/covid-19-app-web/src/views-admin/dashboard/TotalStatistics.vue new file mode 100644 index 00000000..631372f9 --- /dev/null +++ b/covid-19-app-web/src/views-admin/dashboard/TotalStatistics.vue @@ -0,0 +1,116 @@ + + + + + From 4264e93204c7db20715c0a281942d321fe6de013 Mon Sep 17 00:00:00 2001 From: TripleThreads Date: Wed, 12 Aug 2020 11:26:14 +0300 Subject: [PATCH 05/18] fix lint --- .idea/workspace.xml | 120 -------------- .../src/components/core/DateRangePicker.vue | 86 +++++----- .../views-admin/dashboard/DailyStatistics.vue | 88 +++++----- .../src/views-admin/dashboard/Dashboard.vue | 50 +++--- .../views-admin/dashboard/GreatestHitCity.vue | 50 +++--- .../views-admin/dashboard/TotalStatistics.vue | 156 +++++++++--------- 6 files changed, 213 insertions(+), 337 deletions(-) delete mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index b12a5363..00000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1586208441737 - - - 1587545660857 - - - 1587585466267 - - - - - - - - - - - - \ No newline at end of file diff --git a/covid-19-app-web/src/components/core/DateRangePicker.vue b/covid-19-app-web/src/components/core/DateRangePicker.vue index 1a09da01..d23ca18b 100644 --- a/covid-19-app-web/src/components/core/DateRangePicker.vue +++ b/covid-19-app-web/src/components/core/DateRangePicker.vue @@ -1,30 +1,30 @@ diff --git a/covid-19-app-web/src/views-admin/dashboard/Dashboard.vue b/covid-19-app-web/src/views-admin/dashboard/Dashboard.vue index 40efbf64..09a880ee 100644 --- a/covid-19-app-web/src/views-admin/dashboard/Dashboard.vue +++ b/covid-19-app-web/src/views-admin/dashboard/Dashboard.vue @@ -2,19 +2,19 @@ - + - + - + @@ -23,19 +23,19 @@ diff --git a/covid-19-app-web/src/views-admin/dashboard/GreatestHitCity.vue b/covid-19-app-web/src/views-admin/dashboard/GreatestHitCity.vue index 6ee1610c..7ea23273 100644 --- a/covid-19-app-web/src/views-admin/dashboard/GreatestHitCity.vue +++ b/covid-19-app-web/src/views-admin/dashboard/GreatestHitCity.vue @@ -2,15 +2,15 @@ City with greatest covid-19 case count + >City with greatest covid-19 case count

Addis Ababa

123, 345

diff --git a/covid-19-app-web/src/views-admin/dashboard/TotalStatistics.vue b/covid-19-app-web/src/views-admin/dashboard/TotalStatistics.vue index 631372f9..e41011ad 100644 --- a/covid-19-app-web/src/views-admin/dashboard/TotalStatistics.vue +++ b/covid-19-app-web/src/views-admin/dashboard/TotalStatistics.vue @@ -5,35 +5,33 @@ {{ item.title }}
{{ item.totalNum }}
- +

{{ mdiArrowUpThick }} - + {{ mdiArrowDownThick }} - + {{ item.increaseRate + "%" }}

@@ -43,74 +41,74 @@ From 7c771eaf9b133a0318fe54a4c208495eace4ace3 Mon Sep 17 00:00:00 2001 From: TripleThreads Date: Wed, 12 Aug 2020 13:21:52 +0300 Subject: [PATCH 06/18] add create account --- covid-19-app-web/src/views-admin/auth/Verify.vue | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 covid-19-app-web/src/views-admin/auth/Verify.vue diff --git a/covid-19-app-web/src/views-admin/auth/Verify.vue b/covid-19-app-web/src/views-admin/auth/Verify.vue new file mode 100644 index 00000000..ec7e3b51 --- /dev/null +++ b/covid-19-app-web/src/views-admin/auth/Verify.vue @@ -0,0 +1,13 @@ + + + + + \ No newline at end of file From a7ee74e1bf4d42fde0733a4258e1d6d57a781dd1 Mon Sep 17 00:00:00 2001 From: TripleThreads Date: Wed, 12 Aug 2020 13:50:12 +0300 Subject: [PATCH 07/18] add create account --- covid-19-app-web/src/router/admin.js | 4 ++ .../src/views-admin/auth/CreateAccount.vue | 68 ++++++++++++++++++- .../src/views-admin/auth/Verify.vue | 27 ++++++-- .../views-admin/dashboard/GreatestHitCity.vue | 4 +- 4 files changed, 93 insertions(+), 10 deletions(-) diff --git a/covid-19-app-web/src/router/admin.js b/covid-19-app-web/src/router/admin.js index 12ce5726..c2dfe6f7 100644 --- a/covid-19-app-web/src/router/admin.js +++ b/covid-19-app-web/src/router/admin.js @@ -1,11 +1,15 @@ const Dashboard = () => import("../views-admin/dashboard/Dashboard.vue"); + const CreateAccount = () => import("../views-admin/auth/CreateAccount.vue"); +const Verify = () => import("../views-admin/auth/Verify.vue"); + const Symptoms = () => import("../views-admin/symptoms/Symptoms.vue"); const SymptomDetails = () => import("../views-admin/symptoms/SymptomDetails.vue"); export const admin = [ { name: "CreateAccount", path: "register", component: CreateAccount }, + { name: "Verify", path: "verify", component: Verify }, { name: "Symptoms", path: "symptoms", component: Symptoms }, { name: "SymptomDetails", diff --git a/covid-19-app-web/src/views-admin/auth/CreateAccount.vue b/covid-19-app-web/src/views-admin/auth/CreateAccount.vue index 909d3de4..ab2474c5 100644 --- a/covid-19-app-web/src/views-admin/auth/CreateAccount.vue +++ b/covid-19-app-web/src/views-admin/auth/CreateAccount.vue @@ -1,5 +1,58 @@ - + diff --git a/covid-19-app-web/src/views-admin/auth/Verify.vue b/covid-19-app-web/src/views-admin/auth/Verify.vue index ec7e3b51..a32cff07 100644 --- a/covid-19-app-web/src/views-admin/auth/Verify.vue +++ b/covid-19-app-web/src/views-admin/auth/Verify.vue @@ -1,13 +1,28 @@ \ No newline at end of file +.container { + max-width: 30rem; +} +.container { + color: #455d7a; +} + diff --git a/covid-19-app-web/src/views-admin/dashboard/GreatestHitCity.vue b/covid-19-app-web/src/views-admin/dashboard/GreatestHitCity.vue index 7ea23273..bf1664e4 100644 --- a/covid-19-app-web/src/views-admin/dashboard/GreatestHitCity.vue +++ b/covid-19-app-web/src/views-admin/dashboard/GreatestHitCity.vue @@ -4,8 +4,8 @@ City with greatest covid-19 case count -

Addis Ababa

-

123, 345

+

Addis Ababa

+

123, 345

Date: Wed, 12 Aug 2020 23:21:26 +0300 Subject: [PATCH 08/18] make responsive for mobile --- .../src/views-admin/auth/CreateAccount.vue | 14 +++++++------- .../src/views-admin/dashboard/DailyStatistics.vue | 5 ++++- .../src/views-admin/dashboard/Dashboard.vue | 2 +- .../src/views-admin/dashboard/GreatestHitCity.vue | 4 ++-- .../src/views-admin/dashboard/TotalStatistics.vue | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/covid-19-app-web/src/views-admin/auth/CreateAccount.vue b/covid-19-app-web/src/views-admin/auth/CreateAccount.vue index ab2474c5..f8ef294f 100644 --- a/covid-19-app-web/src/views-admin/auth/CreateAccount.vue +++ b/covid-19-app-web/src/views-admin/auth/CreateAccount.vue @@ -7,25 +7,25 @@ - + - + - + - + - + - + - + + + diff --git a/covid-19-app-web/src/views-admin/auth/CreateAccount.vue b/covid-19-app-web/src/views-admin/auth/CreateAccount.vue index ec949b8e..8df8786c 100644 --- a/covid-19-app-web/src/views-admin/auth/CreateAccount.vue +++ b/covid-19-app-web/src/views-admin/auth/CreateAccount.vue @@ -75,7 +75,7 @@ @click:append="show_password = !show_password" /> - + diff --git a/covid-19-app-web/src/router/admin.js b/covid-19-app-web/src/router/admin.js index f3b8863a..64e88d57 100644 --- a/covid-19-app-web/src/router/admin.js +++ b/covid-19-app-web/src/router/admin.js @@ -11,24 +11,70 @@ const SymptomDetails = () => import("../views-admin/symptoms/SymptomDetails.vue"); export const admin = [ - { name: "AdminLogin", path: "login", component: Login }, - { name: "CreateAccount", path: "register", component: CreateAccount }, + { + name: "AdminLogin", + path: "login", + component: Login, + meta: { + guest: true + } + }, + { + name: "CreateAccount", + path: "register", + component: CreateAccount, + meta: { + guest: true + } + }, { name: "ChangePassword", path: "change-password", - component: ChangePassword + component: ChangePassword, + meta: { + requiresAuth: true, + roles: ["ephi_user"] + } }, { name: "ResetPassword", path: "reset-password", - component: ForgotPassword + component: ForgotPassword, + meta: { + requiresAuth: true, + roles: ["ephi_user"] + } + }, + { + name: "Symptoms", + path: "symptoms", + component: Symptoms, + meta: { + requiresAuth: true, + roles: ["ephi_user"] + } + }, + { + name: "InviteAdmin", + path: "invite-admin", + component: InviteAdmin, + meta: { + requiresAuth: true, + roles: ["ephi_user"] + } }, - { name: "Symptoms", path: "symptoms", component: Symptoms }, - { name: "InviteAdmin", path: "invite-admin", component: InviteAdmin }, { name: "SymptomDetails", path: "symptoms/:id/details", component: SymptomDetails }, - { name: "Dashboard", path: "/", component: Dashboard } + { + name: "Dashboard", + path: "/", + component: Dashboard, + meta: { + requiresAuth: true, + roles: ["ephi_user"] + } + } ]; diff --git a/covid-19-app-web/src/router/index.js b/covid-19-app-web/src/router/index.js index 3990c268..6f78f7e5 100644 --- a/covid-19-app-web/src/router/index.js +++ b/covid-19-app-web/src/router/index.js @@ -4,6 +4,7 @@ import store from "@/store/"; import { languages } from "@/plugins/i18n"; import { admin } from "./admin"; import { userRoutes } from "./user-routes"; +import { checkRole } from "../auth/login-checker"; Vue.use(VueRouter); @@ -50,5 +51,7 @@ const router = new VueRouter({ mode: "history", routes }); -console.log(router); + +router.beforeEach(checkRole); + export default router; diff --git a/covid-19-app-web/src/router/user-routes.js b/covid-19-app-web/src/router/user-routes.js index b95ca268..5f9e8f68 100644 --- a/covid-19-app-web/src/router/user-routes.js +++ b/covid-19-app-web/src/router/user-routes.js @@ -1,5 +1,3 @@ -import { ifAuthenticated, ifNotAuthenticated } from "../auth/login-checker"; - const NotFound = () => import("@/views/Errors/404.vue"); const Home = () => import("@/views/Home/Home.vue"); const Information = () => import("@/views/Information/Information.vue"); @@ -13,34 +11,86 @@ const Login = () => import("@/views/Auth/Login.vue"); const Register = () => import("@/views/Auth/Register.vue"); export const userRoutes = [ - { path: "information", name: "Learn", component: Information }, + { + path: "information", + name: "Learn", + component: Information, + meta: { + guest: true + } + }, { path: "privacy-policy", name: "PrivacyPolicy", - component: PrivacyPolicy + component: PrivacyPolicy, + meta: { + guest: true + } }, { path: "references", name: "References", component: References }, { path: "profile", name: "Profile", component: Profile, - beforeEnter: ifAuthenticated + meta: { + requiresAuth: true, + roles: ["ephi_user", "basic"] + } }, { path: "register", name: "Register", component: Register, - beforeEnter: ifNotAuthenticated + meta: { + guest: true + } }, { path: "login", name: "Login", component: Login, - beforeEnter: ifNotAuthenticated + meta: { + guest: true + } + }, + { + path: "about", + name: "About", + component: About, + meta: { + guest: true + } + }, + { + path: "news", + name: "News", + component: News, + meta: { + guest: true + } + }, + { + path: "map", + name: "Map", + component: HeatMap, + meta: { + guest: true + } }, - { path: "about", name: "About", component: About }, - { path: "news", name: "News", component: News }, - { path: "map", name: "Map", component: HeatMap }, - { path: "", name: "Home", component: Home }, - { path: "*", name: "404", component: NotFound } + { + path: "", + name: "Home", + component: Home, + meta: { + guest: true + } + }, + { + path: "*", + name: "404", + component: NotFound, + meta: { + notFound: true + } + } ]; diff --git a/covid-19-app-web/src/views-admin/auth/Login.vue b/covid-19-app-web/src/views-admin/auth/Login.vue index f511f82f..a38502b4 100644 --- a/covid-19-app-web/src/views-admin/auth/Login.vue +++ b/covid-19-app-web/src/views-admin/auth/Login.vue @@ -57,14 +57,6 @@ > {{ $t("auth.login") }} - - {{ $t("auth.goToSignUp") }} - @@ -105,9 +97,13 @@ export default { store.dispatch("setUser", { user: res.data.user }); store.dispatch("setToken", { token: res.data.token }); store.dispatch("setStateMessage", "Successfully logged in"); - if (res.data.user.role === "ephi_user") + if (this.$route.query.nextUrl !== null) { + this.$router.push(this.$route.query.nextUrl); + } else if (res.data.user.role === "ephi_user") { this.$router.push({ name: "Dashboard" }); - else this.$router.push({ name: "Home" }); + } else { + this.$router.push({ name: "Home" }); + } }, error => { store.dispatch("setStateMessage", error.response.data); diff --git a/covid-19-app-web/src/views/Auth/Login.vue b/covid-19-app-web/src/views/Auth/Login.vue index a0d20f29..7c020f7e 100644 --- a/covid-19-app-web/src/views/Auth/Login.vue +++ b/covid-19-app-web/src/views/Auth/Login.vue @@ -85,9 +85,14 @@ export default { rules: Rules }; }, + created() { + console.log(this.$route.query.nextUrl); + }, methods: { submit() { this.loading = true; + let query = this.$route.query; + console.log(query); ajax .post("auth/login", this.user) .then( @@ -95,9 +100,13 @@ export default { store.dispatch("setUser", { user: res.data.user }); store.dispatch("setToken", { token: res.data.token }); store.dispatch("setStateMessage", "Successfully logged in"); - if (res.data.user.role === "ephi_user") + if (query.nextUrl) { + this.$router.push(query.nextUrl); + } else if (res.data.user.role === "ephi_user") { this.$router.push({ name: "Dashboard" }); - else this.$router.push({ name: "Home" }); + } else { + this.$router.push({ name: "Home" }); + } }, error => { store.dispatch("setStateMessage", error.response.data); From 918bd38a2d106395d0ed8f667956b5d7652e360b Mon Sep 17 00:00:00 2001 From: TripleThreads Date: Wed, 26 Aug 2020 15:09:47 +0300 Subject: [PATCH 18/18] ui changes on symptom statistics --- .../views-admin/symptoms/DetailSidebar.vue | 117 +++++++++++------- .../symptoms/DetailSidebarSmall.vue | 83 +++++++++++++ .../symptoms/HighLevelStatistics.vue | 19 ++- .../src/views-admin/symptoms/Symptoms.vue | 49 ++++++-- 4 files changed, 209 insertions(+), 59 deletions(-) create mode 100644 covid-19-app-web/src/views-admin/symptoms/DetailSidebarSmall.vue diff --git a/covid-19-app-web/src/views-admin/symptoms/DetailSidebar.vue b/covid-19-app-web/src/views-admin/symptoms/DetailSidebar.vue index 22b50992..d8c798bf 100644 --- a/covid-19-app-web/src/views-admin/symptoms/DetailSidebar.vue +++ b/covid-19-app-web/src/views-admin/symptoms/DetailSidebar.vue @@ -1,65 +1,72 @@