Skip to content

Commit b0908ea

Browse files
authored
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
1 parent f0d0c32 commit b0908ea

File tree

12 files changed

+438
-92
lines changed

12 files changed

+438
-92
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import React from "react";
2+
import PropTypes from "prop-types";
3+
4+
const JansLockClients = ({ className, style }) => {
5+
return (
6+
<div className={className} style={style}>
7+
<svg
8+
version="1.0"
9+
xmlns="http://www.w3.org/2000/svg"
10+
width="30pt"
11+
height="30pt"
12+
viewBox="0 0 900.000000 900.000000"
13+
preserveAspectRatio="xMidYMid meet"
14+
>
15+
<g
16+
transform="translate(0.000000,900.000000) scale(0.100000,-0.100000)"
17+
fill="#000000"
18+
stroke="none"
19+
>
20+
<path
21+
d="M2128 8430 c-90 -14 -233 -66 -311 -113 -193 -114 -347 -329 -394
22+
-551 -22 -104 -13 -317 17 -411 46 -143 123 -268 231 -371 110 -104 201 -156
23+
346 -200 115 -35 306 -40 423 -10 98 24 245 93 317 149 219 169 333 402 333
24+
680 0 172 -45 318 -141 461 -84 126 -245 259 -373 309 -139 54 -322 77 -448
25+
57z"
26+
/>
27+
<path
28+
d="M4373 8429 c-84 -12 -223 -63 -304 -110 -89 -51 -208 -164 -267 -253
29+
-98 -146 -142 -294 -142 -474 0 -126 17 -211 60 -316 103 -247 303 -423 567
30+
-498 112 -32 314 -32 426 0 264 75 464 251 567 498 43 105 60 190 60 316 0
31+
125 -18 220 -62 325 -148 356 -521 567 -905 512z"
32+
/>
33+
<path
34+
d="M6630 8429 c-342 -50 -635 -323 -706 -658 -18 -87 -18 -262 1 -351
35+
54 -255 227 -472 468 -585 136 -63 216 -80 372 -79 110 1 144 5 218 28 145 44
36+
236 96 346 200 112 108 199 251 238 396 26 94 25 351 -1 435 -49 160 -130 290
37+
-248 399 -183 170 -443 252 -688 215z"
38+
/>
39+
<path
40+
d="M1015 6455 c-194 -43 -334 -144 -401 -290 -55 -121 -55 -118 -52
41+
-1280 l3 -1070 23 -69 c55 -163 167 -274 333 -332 41 -14 100 -29 132 -31 32
42+
-3 60 -10 64 -16 3 -6 7 -639 7 -1406 l1 -1396 843 -3 842 -2 0 1124 0 1124
43+
-72 12 c-207 35 -359 136 -430 286 -61 130 -59 62 -56 1692 l3 1487 27 88 c16
44+
48 28 89 28 92 0 3 -278 5 -617 4 -473 0 -632 -4 -678 -14z"
45+
/>
46+
<path
47+
d="M3255 6454 c-169 -35 -321 -144 -382 -274 -60 -128 -58 -78 -58
48+
-1265 0 -1030 1 -1093 18 -1150 38 -123 93 -203 185 -272 68 -51 202 -102 289
49+
-110 35 -3 63 -11 64 -17 1 -6 2 -639 3 -1406 l1 -1395 754 -3 754 -2 74 -56
50+
c112 -84 253 -171 393 -240 953 -474 2103 -296 2873 445 411 396 670 904 754
51+
1476 25 170 24 515 0 690 -59 414 -212 792 -460 1140 l-72 100 -5 940 c-6
52+
1047 -1 980 -77 1135 -45 93 -126 176 -215 219 -120 59 -140 61 -830 61 -346
53+
0 -628 -2 -628 -5 0 -3 12 -44 27 -92 l28 -88 3 -615 3 -615 -280 0 -280 0 -3
54+
470 c-4 520 -4 520 -72 660 -63 128 -158 211 -295 258 l-66 22 -1215 2 c-1031
55+
1 -1226 -1 -1285 -13z m3540 -1983 c798 -134 1437 -751 1599 -1543 56 -271 56
56+
-528 1 -792 -105 -505 -417 -966 -842 -1244 -365 -239 -807 -356 -1216 -323
57+
-317 26 -605 114 -862 266 -503 296 -851 801 -946 1370 -161 972 420 1915
58+
1358 2206 285 88 612 110 908 60z"
59+
/>
60+
<path
61+
d="M6315 3930 c-236 -37 -446 -166 -565 -347 -107 -163 -157 -345 -167
62+
-605 l-6 -168 -119 0 -118 0 0 -700 0 -700 1125 0 1125 0 0 700 0 699 -117 3
63+
-118 3 3 71 c2 39 -2 124 -8 190 -29 294 -136 528 -306 668 -150 123 -323 185
64+
-539 191 -71 2 -157 0 -190 -5z m279 -571 c88 -22 154 -108 181 -236 8 -38 15
65+
-123 15 -190 l0 -123 -320 0 -319 0 -7 37 c-10 52 2 221 21 294 31 118 86 189
66+
166 214 54 17 204 19 263 4z"
67+
/>
68+
</g>
69+
</svg>
70+
</div>
71+
);
72+
};
73+
74+
export default JansLockClients;
75+
76+
JansLockClients.propTypes = {
77+
style: PropTypes.object,
78+
className: PropTypes.string,
79+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import React from "react";
2+
import PropTypes from "prop-types";
3+
4+
const JansLockUsers = ({ className, style }) => {
5+
return (
6+
<div className={className} style={style}>
7+
<svg
8+
version="1.0"
9+
xmlns="http://www.w3.org/2000/svg"
10+
width="30pt"
11+
height="30pt"
12+
viewBox="0 0 512.000000 512.000000"
13+
preserveAspectRatio="xMidYMid meet"
14+
>
15+
<g
16+
transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"
17+
fill="#000000"
18+
stroke="none"
19+
>
20+
<path
21+
d="M2250 5049 c-545 -62 -886 -381 -950 -892 -32 -258 14 -685 105 -961
22+
133 -408 379 -674 705 -765 161 -44 418 -45 575 -1 415 117 697 503 789 1085
23+
41 255 46 596 12 747 -76 334 -261 562 -562 692 -194 84 -450 120 -674 95z"
24+
/>
25+
<path
26+
d="M3847 2734 c-148 -27 -290 -87 -397 -169 -85 -65 -193 -185 -241
27+
-266 -23 -41 -44 -75 -45 -77 -1 -2 -64 49 -140 113 l-137 116 -241 -240 -241
28+
-241 -60 61 c-33 33 -144 141 -246 239 l-185 179 -141 -117 -140 -118 -323
29+
-149 c-323 -149 -389 -187 -442 -257 -15 -20 -216 -352 -447 -737 l-419 -701
30+
1436 -2 1437 -3 6 -46 c17 -114 111 -216 229 -248 34 -9 260 -11 910 -9 859 3
31+
865 3 911 24 67 31 124 87 156 152 l28 57 3 679 c3 752 3 743 -61 828 -18 24
32+
-55 58 -82 76 -28 18 -53 43 -56 55 -4 12 -16 63 -28 112 -22 95 -79 224 -132
33+
301 -80 116 -224 241 -354 307 -113 56 -296 98 -423 96 -31 0 -92 -7 -135 -15z
34+
m318 -321 c100 -25 192 -79 275 -162 135 -136 180 -259 180 -493 l0 -138 100
35+
0 100 0 0 -625 0 -625 -810 0 -810 0 0 625 0 625 100 0 100 0 0 138 c0 234 45
36+
358 180 492 160 161 365 218 585 163z"
37+
/>
38+
<path
39+
d="M3915 2167 c-68 -23 -118 -54 -161 -99 -79 -82 -104 -165 -104 -345
40+
l0 -103 360 0 360 0 0 103 c0 181 -24 259 -106 347 -83 88 -241 132 -349 97z"
41+
/>
42+
<path
43+
d="M3931 1142 c-89 -45 -124 -148 -81 -237 12 -25 31 -50 41 -56 17 -9
44+
19 -22 19 -149 l0 -140 100 0 100 0 0 140 c0 127 2 140 19 149 26 14 61 90 61
45+
132 0 42 -29 107 -61 136 -50 46 -137 57 -198 25z"
46+
/>
47+
</g>
48+
</svg>
49+
</div>
50+
);
51+
};
52+
53+
export default JansLockUsers;
54+
55+
JansLockUsers.propTypes = {
56+
style: PropTypes.object,
57+
className: PropTypes.string,
58+
};

admin-ui/app/locales/en/translation.json

+22-20
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"currentMonth": "Current Month",
2424
"currentYear": "Current Year",
2525
"choose": "Choose",
26-
"deploy":"Deploy",
26+
"deploy": "Deploy",
2727
"edit": "Edit",
2828
"next": "Next",
2929
"no": "No",
@@ -55,7 +55,7 @@
5555
"add_source_ldap_server": "Add source LDAP server",
5656
"remove_source_server": "Remove source server",
5757
"copy_to_clipboard": "Copy To Clipboard",
58-
"export_csv":"Export CSV"
58+
"export_csv": "Export CSV"
5959
},
6060
"dashboard": {
6161
"summary_title": "Actives Users & Access Token Stats",
@@ -80,14 +80,16 @@
8080
"start_date": "Start Date",
8181
"end_date": "End Date",
8282
"system_status": "System Status",
83-
"config_api":"Config API",
84-
"config_api_status":"Config API Status",
85-
"key_cloak":"Keycloak",
86-
"jans_lock":"Jans Lock",
87-
"jans_link":"Jans Link",
88-
"access_denied":"Access Denied",
89-
"access_denied_message":"You do not have permission to access this page",
90-
"access_contact_admin":"Please contact your administrator for more information"
83+
"config_api": "Config API",
84+
"config_api_status": "Config API Status",
85+
"key_cloak": "Keycloak",
86+
"jans_lock": "Jans Lock",
87+
"jans_link": "Jans Link",
88+
"access_denied": "Access Denied",
89+
"access_denied_message": "You do not have permission to access this page",
90+
"access_contact_admin": "Please contact your administrator for more information",
91+
"mau_users": "Max. MAU for LTM (Lock)",
92+
"mau_clients": "Max. MAC for LTM (Lock)"
9193
},
9294
"fields": {
9395
"access_token_signing_alg": "JWS alg for signing",
@@ -133,7 +135,7 @@
133135
"jans_assertion_consumer_service_post_url": "Jans Assertion Consumer Service POST URL",
134136
"jans_id": "Jans ID",
135137
"jans_state": "Jans State",
136-
"jans_sess_state":"Jans Session State",
138+
"jans_sess_state": "Jans Session State",
137139
"jans_user_dn": "Jans User DN",
138140
"permission_granted_map": "Permission Granted Map",
139141
"jans_sess_attr": "Jans Session Attributes",
@@ -658,9 +660,9 @@
658660
"source_backend_ldap_servers": "Source Backend LDAP Servers",
659661
"inum_db_server": "Inum DB Server",
660662
"static_configuration": "Static Configuration",
661-
"dynamic_configuration": "Dynamic Configuration",
662-
"upload_agama_project":"Upload Agama project",
663-
"add_community_project":"Add a Community Project"
663+
"dynamic_configuration": "Dynamic Configuration",
664+
"upload_agama_project": "Upload Agama project",
665+
"add_community_project": "Add a Community Project"
664666
},
665667
"messages": {
666668
"add_permission": "Add Permission",
@@ -809,7 +811,7 @@
809811
"search_reference": "Search by reference",
810812
"search_scope": "Search by scope",
811813
"search_token": "Search by token code",
812-
"search_date":"Search by creation date",
814+
"search_date": "Search by creation date",
813815
"sector_uri": "Enter the sector URI",
814816
"sender_email": "Enter the sender email",
815817
"sender_name": "Enter the sender name",
@@ -889,8 +891,8 @@
889891
"scopes": "Scopes",
890892
"scripts": "Custom Scripts",
891893
"schemaName": "Schema Name",
892-
"select_project_deploy":"Select a project to deploy",
893-
"add_new_agama_project":"Add a new Agama Project",
894+
"select_project_deploy": "Select a project to deploy",
895+
"add_new_agama_project": "Add a new Agama Project",
894896
"user_management": "User Management",
895897
"fido_management": "FIDO Configuration",
896898
"saml_management": "SAML",
@@ -919,7 +921,7 @@
919921
"edit_alias": "Edit Mapping",
920922
"export_csv": "Export CSV",
921923
"filters": "Filters",
922-
"expiration_date" : "Expiration Date",
924+
"expiration_date": "Expiration Date",
923925
"authentication_date": "Authentication Date",
924926
"creation_date": "Creation Date"
925927
},
@@ -1591,8 +1593,8 @@
15911593
"type": "Type",
15921594
"domain": "Domain"
15931595
},
1594-
"sessions":{
1595-
"expirationDate" : "Expiration Date",
1596+
"sessions": {
1597+
"expirationDate": "Expiration Date",
15961598
"jansId": "Jans Id",
15971599
"jansState": "Jans State",
15981600
"jansSessState": "Jans Session State",

admin-ui/app/locales/fr/translation.json

+9-7
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@
3232
"key_cloak": "Keycloak",
3333
"jans_lock": "Jans Lock",
3434
"jans_link": "Lien Jans",
35-
"access_denied":"Accès refusé",
36-
"access_denied_message":"Vous n'êtes pas autorisé à accéder à cette page",
37-
"access_contact_admin":"Veuillez contacter l'administrateur pour obtenir de l'aide"
35+
"access_denied": "Accès refusé",
36+
"access_denied_message": "Vous n'êtes pas autorisé à accéder à cette page",
37+
"access_contact_admin": "Veuillez contacter l'administrateur pour obtenir de l'aide",
38+
"mau_users": "Max. MAU pour LTM (Verrouillage)",
39+
"mau_clients": "Max. MAC pour LTM (Verrouillage)"
3840
},
3941
"menus": {
4042
"adminui": "Administratrice",
@@ -182,7 +184,7 @@
182184
"jans_assertion_consumer_service_post_url": "URL POST du service consommateur d'assertions Jans",
183185
"jans_id": "ID Jans",
184186
"jans_state": "État Jans",
185-
"jans_sess_state":"État de la session Jans",
187+
"jans_sess_state": "État de la session Jans",
186188
"jans_user_dn": "DN de l'utilisateur Jans",
187189
"permission_granted_map": "Carte des autorisations accordées",
188190
"jans_sess_attr": "Attributs de la session Jans",
@@ -812,7 +814,7 @@
812814
"jans_ink": "Jans Link",
813815
"change_backend_bind_password": "Modifier le mot de passe de liaison du backend",
814816
"add_agama_project": "Ajouter un projet Agama",
815-
"export_csv":"Exporter CSV"
817+
"export_csv": "Exporter CSV"
816818
},
817819
"links": {
818820
"support": "https://support.gluu.org/"
@@ -1521,8 +1523,8 @@
15211523
"type": "Type",
15221524
"domain": "Domaine"
15231525
},
1524-
"sessions":{
1525-
"expirationDate" : "Date d'expiration",
1526+
"sessions": {
1527+
"expirationDate": "Date d'expiration",
15261528
"jansId": "ID Jans",
15271529
"jansState": "État Jans",
15281530
"jansSessState": "État de la session Jans",

admin-ui/app/locales/pt/translation.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
"jans_link": "Link Jans",
3535
"access_denied":"Acesso negado",
3636
"access_denied_message":"Entre em contato com o administrador para obter ajuda",
37-
"access_contact_admin":"Se você acha que isso é um erro, entre em contato com o administrador"
37+
"access_contact_admin":"Se você acha que isso é um erro, entre em contato com o administrador",
38+
"mau_users": "Máx. MAU para LTM (Bloqueio)",
39+
"mau_clients": "Máx. MAC para LTM (Bloqueio)"
3840
},
3941
"menus": {
4042
"adminui": "Admin",

admin-ui/app/redux/api/LockApi.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { handleResponse } from "Utils/ApiUtils";
2+
3+
export default class LockApi {
4+
constructor(api) {
5+
this.api = api;
6+
}
7+
getLockMau = (opt) => {
8+
return new Promise((resolve, reject) => {
9+
this.api.getLockStat(opt, (error, data) => {
10+
handleResponse(error, reject, resolve, data);
11+
});
12+
});
13+
};
14+
}
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { createSlice } from "@reduxjs/toolkit";
2+
import reducerRegistry from "Redux/reducers/ReducerRegistry";
3+
4+
const initialState = {
5+
lockDetail: {},
6+
loading: false,
7+
};
8+
9+
const lockSlice = createSlice({
10+
name: "lock",
11+
initialState,
12+
reducers: {
13+
getLockStatus: (state) => {
14+
state.loading = true;
15+
},
16+
getLockStatusResponse: (state, action) => {
17+
state.loading = false;
18+
if (action.payload?.data) {
19+
state.lockDetail = action.payload.data;
20+
}
21+
},
22+
},
23+
});
24+
25+
export const { getLockStatus, getLockStatusResponse } = lockSlice.actions;
26+
27+
export default lockSlice.reducer;
28+
reducerRegistry.register("lockReducer", lockSlice.reducer);

admin-ui/app/redux/sagas/AuthSaga.js

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ function* putConfigWorker({ payload }) {
5757
return
5858
}
5959
} catch (error) {
60-
console.log('Problems udpating configuration.', error)
6160
yield put(updateToast(true, 'error'))
6261
if (isFourZeroOneError(error)) {
6362
const jwt = yield select((state) => state.authReducer.userinfo_jwt)

admin-ui/app/redux/sagas/LockSaga.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { call, all, put, fork, select, takeLatest } from "redux-saga/effects";
2+
import { isFourZeroOneError } from "Utils/TokenController";
3+
4+
import { getAPIAccessToken } from "../features/authSlice";
5+
import { getClient } from "../api/base";
6+
import { initAudit } from "../sagas/SagaUtils";
7+
import LockApi from "../api/LockApi";
8+
import { getLockStatusResponse } from "../features/lockSlice";
9+
const JansConfigApi = require("jans_config_api");
10+
11+
function* newFunction() {
12+
const token = yield select((state) => state.authReducer.token.access_token);
13+
const issuer = yield select((state) => state.authReducer.issuer);
14+
const api = new JansConfigApi.StatisticsApi(
15+
getClient(JansConfigApi, token, issuer)
16+
);
17+
return new LockApi(api);
18+
}
19+
20+
export function* getLockMau({ payload }) {
21+
const audit = yield* initAudit();
22+
try {
23+
const lockapi = yield* newFunction();
24+
const data = yield call(lockapi.getLockMau,payload);
25+
yield put(getLockStatusResponse({ data }));
26+
} catch (e) {
27+
yield put(getLockStatusResponse(null));
28+
if (isFourZeroOneError(e)) {
29+
const jwt = yield select((state) => state.authReducer.userinfo_jwt);
30+
yield put(getAPIAccessToken(jwt));
31+
}
32+
}
33+
}
34+
35+
export function* watchGetLockMau() {
36+
yield takeLatest("lock/getLockStatus", getLockMau);
37+
}
38+
39+
export default function* rootSaga() {
40+
yield all([fork(watchGetLockMau)]);
41+
}

0 commit comments

Comments
 (0)