-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(admin-ui): Dashboard with monthly active users/clients. (#1983)
* fix: agama projects are not deploying properly * feat: dashboard with monthly active users * fix: show MAU when lock is configured
- Loading branch information
1 parent
f0d0c32
commit b0908ea
Showing
12 changed files
with
438 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
|
||
const JansLockClients = ({ className, style }) => { | ||
return ( | ||
<div className={className} style={style}> | ||
<svg | ||
version="1.0" | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="30pt" | ||
height="30pt" | ||
viewBox="0 0 900.000000 900.000000" | ||
preserveAspectRatio="xMidYMid meet" | ||
> | ||
<g | ||
transform="translate(0.000000,900.000000) scale(0.100000,-0.100000)" | ||
fill="#000000" | ||
stroke="none" | ||
> | ||
<path | ||
d="M2128 8430 c-90 -14 -233 -66 -311 -113 -193 -114 -347 -329 -394 | ||
-551 -22 -104 -13 -317 17 -411 46 -143 123 -268 231 -371 110 -104 201 -156 | ||
346 -200 115 -35 306 -40 423 -10 98 24 245 93 317 149 219 169 333 402 333 | ||
680 0 172 -45 318 -141 461 -84 126 -245 259 -373 309 -139 54 -322 77 -448 | ||
57z" | ||
/> | ||
<path | ||
d="M4373 8429 c-84 -12 -223 -63 -304 -110 -89 -51 -208 -164 -267 -253 | ||
-98 -146 -142 -294 -142 -474 0 -126 17 -211 60 -316 103 -247 303 -423 567 | ||
-498 112 -32 314 -32 426 0 264 75 464 251 567 498 43 105 60 190 60 316 0 | ||
125 -18 220 -62 325 -148 356 -521 567 -905 512z" | ||
/> | ||
<path | ||
d="M6630 8429 c-342 -50 -635 -323 -706 -658 -18 -87 -18 -262 1 -351 | ||
54 -255 227 -472 468 -585 136 -63 216 -80 372 -79 110 1 144 5 218 28 145 44 | ||
236 96 346 200 112 108 199 251 238 396 26 94 25 351 -1 435 -49 160 -130 290 | ||
-248 399 -183 170 -443 252 -688 215z" | ||
/> | ||
<path | ||
d="M1015 6455 c-194 -43 -334 -144 -401 -290 -55 -121 -55 -118 -52 | ||
-1280 l3 -1070 23 -69 c55 -163 167 -274 333 -332 41 -14 100 -29 132 -31 32 | ||
-3 60 -10 64 -16 3 -6 7 -639 7 -1406 l1 -1396 843 -3 842 -2 0 1124 0 1124 | ||
-72 12 c-207 35 -359 136 -430 286 -61 130 -59 62 -56 1692 l3 1487 27 88 c16 | ||
48 28 89 28 92 0 3 -278 5 -617 4 -473 0 -632 -4 -678 -14z" | ||
/> | ||
<path | ||
d="M3255 6454 c-169 -35 -321 -144 -382 -274 -60 -128 -58 -78 -58 | ||
-1265 0 -1030 1 -1093 18 -1150 38 -123 93 -203 185 -272 68 -51 202 -102 289 | ||
-110 35 -3 63 -11 64 -17 1 -6 2 -639 3 -1406 l1 -1395 754 -3 754 -2 74 -56 | ||
c112 -84 253 -171 393 -240 953 -474 2103 -296 2873 445 411 396 670 904 754 | ||
1476 25 170 24 515 0 690 -59 414 -212 792 -460 1140 l-72 100 -5 940 c-6 | ||
1047 -1 980 -77 1135 -45 93 -126 176 -215 219 -120 59 -140 61 -830 61 -346 | ||
0 -628 -2 -628 -5 0 -3 12 -44 27 -92 l28 -88 3 -615 3 -615 -280 0 -280 0 -3 | ||
470 c-4 520 -4 520 -72 660 -63 128 -158 211 -295 258 l-66 22 -1215 2 c-1031 | ||
1 -1226 -1 -1285 -13z m3540 -1983 c798 -134 1437 -751 1599 -1543 56 -271 56 | ||
-528 1 -792 -105 -505 -417 -966 -842 -1244 -365 -239 -807 -356 -1216 -323 | ||
-317 26 -605 114 -862 266 -503 296 -851 801 -946 1370 -161 972 420 1915 | ||
1358 2206 285 88 612 110 908 60z" | ||
/> | ||
<path | ||
d="M6315 3930 c-236 -37 -446 -166 -565 -347 -107 -163 -157 -345 -167 | ||
-605 l-6 -168 -119 0 -118 0 0 -700 0 -700 1125 0 1125 0 0 700 0 699 -117 3 | ||
-118 3 3 71 c2 39 -2 124 -8 190 -29 294 -136 528 -306 668 -150 123 -323 185 | ||
-539 191 -71 2 -157 0 -190 -5z m279 -571 c88 -22 154 -108 181 -236 8 -38 15 | ||
-123 15 -190 l0 -123 -320 0 -319 0 -7 37 c-10 52 2 221 21 294 31 118 86 189 | ||
166 214 54 17 204 19 263 4z" | ||
/> | ||
</g> | ||
</svg> | ||
</div> | ||
); | ||
}; | ||
|
||
export default JansLockClients; | ||
|
||
JansLockClients.propTypes = { | ||
style: PropTypes.object, | ||
className: PropTypes.string, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
|
||
const JansLockUsers = ({ className, style }) => { | ||
return ( | ||
<div className={className} style={style}> | ||
<svg | ||
version="1.0" | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="30pt" | ||
height="30pt" | ||
viewBox="0 0 512.000000 512.000000" | ||
preserveAspectRatio="xMidYMid meet" | ||
> | ||
<g | ||
transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)" | ||
fill="#000000" | ||
stroke="none" | ||
> | ||
<path | ||
d="M2250 5049 c-545 -62 -886 -381 -950 -892 -32 -258 14 -685 105 -961 | ||
133 -408 379 -674 705 -765 161 -44 418 -45 575 -1 415 117 697 503 789 1085 | ||
41 255 46 596 12 747 -76 334 -261 562 -562 692 -194 84 -450 120 -674 95z" | ||
/> | ||
<path | ||
d="M3847 2734 c-148 -27 -290 -87 -397 -169 -85 -65 -193 -185 -241 | ||
-266 -23 -41 -44 -75 -45 -77 -1 -2 -64 49 -140 113 l-137 116 -241 -240 -241 | ||
-241 -60 61 c-33 33 -144 141 -246 239 l-185 179 -141 -117 -140 -118 -323 | ||
-149 c-323 -149 -389 -187 -442 -257 -15 -20 -216 -352 -447 -737 l-419 -701 | ||
1436 -2 1437 -3 6 -46 c17 -114 111 -216 229 -248 34 -9 260 -11 910 -9 859 3 | ||
865 3 911 24 67 31 124 87 156 152 l28 57 3 679 c3 752 3 743 -61 828 -18 24 | ||
-55 58 -82 76 -28 18 -53 43 -56 55 -4 12 -16 63 -28 112 -22 95 -79 224 -132 | ||
301 -80 116 -224 241 -354 307 -113 56 -296 98 -423 96 -31 0 -92 -7 -135 -15z | ||
m318 -321 c100 -25 192 -79 275 -162 135 -136 180 -259 180 -493 l0 -138 100 | ||
0 100 0 0 -625 0 -625 -810 0 -810 0 0 625 0 625 100 0 100 0 0 138 c0 234 45 | ||
358 180 492 160 161 365 218 585 163z" | ||
/> | ||
<path | ||
d="M3915 2167 c-68 -23 -118 -54 -161 -99 -79 -82 -104 -165 -104 -345 | ||
l0 -103 360 0 360 0 0 103 c0 181 -24 259 -106 347 -83 88 -241 132 -349 97z" | ||
/> | ||
<path | ||
d="M3931 1142 c-89 -45 -124 -148 -81 -237 12 -25 31 -50 41 -56 17 -9 | ||
19 -22 19 -149 l0 -140 100 0 100 0 0 140 c0 127 2 140 19 149 26 14 61 90 61 | ||
132 0 42 -29 107 -61 136 -50 46 -137 57 -198 25z" | ||
/> | ||
</g> | ||
</svg> | ||
</div> | ||
); | ||
}; | ||
|
||
export default JansLockUsers; | ||
|
||
JansLockUsers.propTypes = { | ||
style: PropTypes.object, | ||
className: PropTypes.string, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { handleResponse } from "Utils/ApiUtils"; | ||
|
||
export default class LockApi { | ||
constructor(api) { | ||
this.api = api; | ||
} | ||
getLockMau = (opt) => { | ||
return new Promise((resolve, reject) => { | ||
this.api.getLockStat(opt, (error, data) => { | ||
handleResponse(error, reject, resolve, data); | ||
}); | ||
}); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { createSlice } from "@reduxjs/toolkit"; | ||
import reducerRegistry from "Redux/reducers/ReducerRegistry"; | ||
|
||
const initialState = { | ||
lockDetail: {}, | ||
loading: false, | ||
}; | ||
|
||
const lockSlice = createSlice({ | ||
name: "lock", | ||
initialState, | ||
reducers: { | ||
getLockStatus: (state) => { | ||
state.loading = true; | ||
}, | ||
getLockStatusResponse: (state, action) => { | ||
state.loading = false; | ||
if (action.payload?.data) { | ||
state.lockDetail = action.payload.data; | ||
} | ||
}, | ||
}, | ||
}); | ||
|
||
export const { getLockStatus, getLockStatusResponse } = lockSlice.actions; | ||
|
||
export default lockSlice.reducer; | ||
reducerRegistry.register("lockReducer", lockSlice.reducer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { call, all, put, fork, select, takeLatest } from "redux-saga/effects"; | ||
import { isFourZeroOneError } from "Utils/TokenController"; | ||
|
||
import { getAPIAccessToken } from "../features/authSlice"; | ||
import { getClient } from "../api/base"; | ||
import { initAudit } from "../sagas/SagaUtils"; | ||
import LockApi from "../api/LockApi"; | ||
import { getLockStatusResponse } from "../features/lockSlice"; | ||
const JansConfigApi = require("jans_config_api"); | ||
|
||
function* newFunction() { | ||
const token = yield select((state) => state.authReducer.token.access_token); | ||
const issuer = yield select((state) => state.authReducer.issuer); | ||
const api = new JansConfigApi.StatisticsApi( | ||
getClient(JansConfigApi, token, issuer) | ||
); | ||
return new LockApi(api); | ||
} | ||
|
||
export function* getLockMau({ payload }) { | ||
const audit = yield* initAudit(); | ||
try { | ||
const lockapi = yield* newFunction(); | ||
const data = yield call(lockapi.getLockMau,payload); | ||
yield put(getLockStatusResponse({ data })); | ||
} catch (e) { | ||
yield put(getLockStatusResponse(null)); | ||
if (isFourZeroOneError(e)) { | ||
const jwt = yield select((state) => state.authReducer.userinfo_jwt); | ||
yield put(getAPIAccessToken(jwt)); | ||
} | ||
} | ||
} | ||
|
||
export function* watchGetLockMau() { | ||
yield takeLatest("lock/getLockStatus", getLockMau); | ||
} | ||
|
||
export default function* rootSaga() { | ||
yield all([fork(watchGetLockMau)]); | ||
} |
Oops, something went wrong.