@cundi/refine-xaf 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -1
- package/dist/antd-column-ext.d.ts +16 -0
- package/dist/index.css +90 -0
- package/dist/index.d.mts +145 -7
- package/dist/index.d.ts +145 -7
- package/dist/index.js +641 -276
- package/dist/index.mjs +580 -222
- package/package.json +9 -2
package/dist/index.mjs
CHANGED
|
@@ -4,6 +4,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4
4
|
|
|
5
5
|
// src/utils/httpClient.ts
|
|
6
6
|
var TOKEN_KEY = "refine-auth";
|
|
7
|
+
var MAX_RETRIES = 3;
|
|
8
|
+
var BASE_RETRY_DELAY = 1e3;
|
|
7
9
|
var HttpError = class _HttpError extends Error {
|
|
8
10
|
constructor(statusCode, message2, body) {
|
|
9
11
|
super(message2);
|
|
@@ -19,8 +21,15 @@ var HttpError = class _HttpError extends Error {
|
|
|
19
21
|
var getBaseUrl = () => {
|
|
20
22
|
return import.meta.env?.VITE_API_URL || "";
|
|
21
23
|
};
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
+
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
25
|
+
var isRetryableError = (error) => {
|
|
26
|
+
if (error instanceof HttpError) {
|
|
27
|
+
return error.statusCode >= 500;
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
};
|
|
31
|
+
var httpClient = async (endpoint, options = {}, retryCount = 0) => {
|
|
32
|
+
const { skipAuth, noRetry, headers, ...restOptions } = options;
|
|
24
33
|
const baseUrl = getBaseUrl();
|
|
25
34
|
const url = endpoint.startsWith("http") ? endpoint : `${baseUrl}${endpoint.startsWith("/") ? "" : "/"}${endpoint}`;
|
|
26
35
|
const defaultHeaders = {
|
|
@@ -49,7 +58,14 @@ var httpClient = async (endpoint, options = {}) => {
|
|
|
49
58
|
} catch {
|
|
50
59
|
parsedError = errorBody;
|
|
51
60
|
}
|
|
52
|
-
|
|
61
|
+
const error = new HttpError(response.status, response.statusText, parsedError);
|
|
62
|
+
if (!noRetry && retryCount < MAX_RETRIES && isRetryableError(error)) {
|
|
63
|
+
const retryDelay = BASE_RETRY_DELAY * Math.pow(2, retryCount);
|
|
64
|
+
console.warn(`Request failed with ${response.status}, retrying in ${retryDelay}ms... (${retryCount + 1}/${MAX_RETRIES})`);
|
|
65
|
+
await delay(retryDelay);
|
|
66
|
+
return httpClient(endpoint, options, retryCount + 1);
|
|
67
|
+
}
|
|
68
|
+
throw error;
|
|
53
69
|
}
|
|
54
70
|
if (response.status === 204) {
|
|
55
71
|
return null;
|
|
@@ -59,6 +75,12 @@ var httpClient = async (endpoint, options = {}) => {
|
|
|
59
75
|
if (error instanceof HttpError) {
|
|
60
76
|
throw error;
|
|
61
77
|
}
|
|
78
|
+
if (!noRetry && retryCount < MAX_RETRIES && isRetryableError(error)) {
|
|
79
|
+
const retryDelay = BASE_RETRY_DELAY * Math.pow(2, retryCount);
|
|
80
|
+
console.warn(`Network error, retrying in ${retryDelay}ms... (${retryCount + 1}/${MAX_RETRIES})`);
|
|
81
|
+
await delay(retryDelay);
|
|
82
|
+
return httpClient(endpoint, options, retryCount + 1);
|
|
83
|
+
}
|
|
62
84
|
throw new HttpError(500, "Network Error", error);
|
|
63
85
|
}
|
|
64
86
|
};
|
|
@@ -116,22 +138,207 @@ var authService = {
|
|
|
116
138
|
}
|
|
117
139
|
};
|
|
118
140
|
|
|
141
|
+
// src/utils/pkceUtils.ts
|
|
142
|
+
var STORAGE_KEY_CODE_VERIFIER = "pkce_code_verifier";
|
|
143
|
+
var STORAGE_KEY_STATE = "pkce_state";
|
|
144
|
+
function generateRandomString(length) {
|
|
145
|
+
const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";
|
|
146
|
+
const randomValues = new Uint8Array(length);
|
|
147
|
+
crypto.getRandomValues(randomValues);
|
|
148
|
+
let result = "";
|
|
149
|
+
for (let i = 0; i < length; i++) {
|
|
150
|
+
result += charset[randomValues[i] % charset.length];
|
|
151
|
+
}
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
154
|
+
async function sha256(plain) {
|
|
155
|
+
const encoder = new TextEncoder();
|
|
156
|
+
const data = encoder.encode(plain);
|
|
157
|
+
const hash = await crypto.subtle.digest("SHA-256", data);
|
|
158
|
+
const base64 = btoa(String.fromCharCode(...new Uint8Array(hash)));
|
|
159
|
+
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
160
|
+
}
|
|
161
|
+
function generateCodeVerifier() {
|
|
162
|
+
return generateRandomString(128);
|
|
163
|
+
}
|
|
164
|
+
async function generateCodeChallenge(verifier) {
|
|
165
|
+
return await sha256(verifier);
|
|
166
|
+
}
|
|
167
|
+
function generateState() {
|
|
168
|
+
return generateRandomString(32);
|
|
169
|
+
}
|
|
170
|
+
function saveCodeVerifier(verifier) {
|
|
171
|
+
sessionStorage.setItem(STORAGE_KEY_CODE_VERIFIER, verifier);
|
|
172
|
+
}
|
|
173
|
+
function getCodeVerifier() {
|
|
174
|
+
return sessionStorage.getItem(STORAGE_KEY_CODE_VERIFIER);
|
|
175
|
+
}
|
|
176
|
+
function clearCodeVerifier() {
|
|
177
|
+
sessionStorage.removeItem(STORAGE_KEY_CODE_VERIFIER);
|
|
178
|
+
}
|
|
179
|
+
function saveState(state) {
|
|
180
|
+
sessionStorage.setItem(STORAGE_KEY_STATE, state);
|
|
181
|
+
}
|
|
182
|
+
function getState() {
|
|
183
|
+
return sessionStorage.getItem(STORAGE_KEY_STATE);
|
|
184
|
+
}
|
|
185
|
+
function clearState() {
|
|
186
|
+
sessionStorage.removeItem(STORAGE_KEY_STATE);
|
|
187
|
+
}
|
|
188
|
+
function clearPKCEData() {
|
|
189
|
+
clearCodeVerifier();
|
|
190
|
+
clearState();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// src/services/keycloakService.ts
|
|
194
|
+
function getEnvConfig() {
|
|
195
|
+
const env = import.meta.env;
|
|
196
|
+
const config = {
|
|
197
|
+
keycloakUrl: env.VITE_KEYCLOAK_URL || "http://localhost:8080",
|
|
198
|
+
realm: env.VITE_KEYCLOAK_REALM || "cundi",
|
|
199
|
+
clientId: env.VITE_KEYCLOAK_CLIENT_ID || "cundi-web",
|
|
200
|
+
redirectUri: env.VITE_REDIRECT_URI || `${window.location.origin}/auth/callback`
|
|
201
|
+
};
|
|
202
|
+
const missingVars = [];
|
|
203
|
+
if (!env.VITE_KEYCLOAK_URL) missingVars.push("VITE_KEYCLOAK_URL");
|
|
204
|
+
if (!env.VITE_KEYCLOAK_REALM) missingVars.push("VITE_KEYCLOAK_REALM");
|
|
205
|
+
if (!env.VITE_KEYCLOAK_CLIENT_ID) missingVars.push("VITE_KEYCLOAK_CLIENT_ID");
|
|
206
|
+
if (missingVars.length > 0) {
|
|
207
|
+
console.warn(
|
|
208
|
+
`[Keycloak] Missing environment variables: ${missingVars.join(", ")}. Using default values. Please configure these in your .env file for production.`
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
return config;
|
|
212
|
+
}
|
|
213
|
+
var keycloakService = {
|
|
214
|
+
/**
|
|
215
|
+
* Start Authorization Code Flow with PKCE
|
|
216
|
+
* Redirects user to Keycloak login page
|
|
217
|
+
*/
|
|
218
|
+
startAuthorizationFlow: async () => {
|
|
219
|
+
const { keycloakUrl, realm, clientId, redirectUri } = getEnvConfig();
|
|
220
|
+
const codeVerifier = generateCodeVerifier();
|
|
221
|
+
const codeChallenge = await generateCodeChallenge(codeVerifier);
|
|
222
|
+
const state = generateState();
|
|
223
|
+
saveCodeVerifier(codeVerifier);
|
|
224
|
+
saveState(state);
|
|
225
|
+
const authUrl = new URL(`${keycloakUrl}/realms/${realm}/protocol/openid-connect/auth`);
|
|
226
|
+
authUrl.searchParams.append("client_id", clientId);
|
|
227
|
+
authUrl.searchParams.append("redirect_uri", redirectUri);
|
|
228
|
+
authUrl.searchParams.append("response_type", "code");
|
|
229
|
+
authUrl.searchParams.append("scope", "openid profile email");
|
|
230
|
+
authUrl.searchParams.append("code_challenge", codeChallenge);
|
|
231
|
+
authUrl.searchParams.append("code_challenge_method", "S256");
|
|
232
|
+
authUrl.searchParams.append("state", state);
|
|
233
|
+
window.location.href = authUrl.toString();
|
|
234
|
+
},
|
|
235
|
+
/**
|
|
236
|
+
* Handle callback from Keycloak
|
|
237
|
+
* Exchange authorization code for access token
|
|
238
|
+
*/
|
|
239
|
+
handleCallback: async (code, state) => {
|
|
240
|
+
const { keycloakUrl, realm, clientId, redirectUri } = getEnvConfig();
|
|
241
|
+
const savedState = getState();
|
|
242
|
+
if (!savedState || savedState !== state) {
|
|
243
|
+
clearPKCEData();
|
|
244
|
+
throw new Error("Invalid state parameter - possible CSRF attack");
|
|
245
|
+
}
|
|
246
|
+
const codeVerifier = getCodeVerifier();
|
|
247
|
+
if (!codeVerifier) {
|
|
248
|
+
throw new Error("Code verifier not found - session may have expired");
|
|
249
|
+
}
|
|
250
|
+
const tokenUrl = `${keycloakUrl}/realms/${realm}/protocol/openid-connect/token`;
|
|
251
|
+
const formData = new URLSearchParams();
|
|
252
|
+
formData.append("grant_type", "authorization_code");
|
|
253
|
+
formData.append("client_id", clientId);
|
|
254
|
+
formData.append("code", code);
|
|
255
|
+
formData.append("redirect_uri", redirectUri);
|
|
256
|
+
formData.append("code_verifier", codeVerifier);
|
|
257
|
+
const response = await fetch(tokenUrl, {
|
|
258
|
+
method: "POST",
|
|
259
|
+
headers: {
|
|
260
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
261
|
+
},
|
|
262
|
+
body: formData.toString()
|
|
263
|
+
});
|
|
264
|
+
clearPKCEData();
|
|
265
|
+
if (!response.ok) {
|
|
266
|
+
const error = await response.text();
|
|
267
|
+
throw new Error(`Token exchange failed: ${error}`);
|
|
268
|
+
}
|
|
269
|
+
const data = await response.json();
|
|
270
|
+
return {
|
|
271
|
+
accessToken: data.access_token,
|
|
272
|
+
idToken: data.id_token || data.access_token
|
|
273
|
+
// Fallback to access token if no id_token
|
|
274
|
+
};
|
|
275
|
+
},
|
|
276
|
+
/**
|
|
277
|
+
* Logout from Keycloak
|
|
278
|
+
* Redirects to Keycloak logout endpoint to properly clear the session
|
|
279
|
+
*/
|
|
280
|
+
logout: (idToken) => {
|
|
281
|
+
const { keycloakUrl, realm } = getEnvConfig();
|
|
282
|
+
clearPKCEData();
|
|
283
|
+
const logoutUrl = new URL(`${keycloakUrl}/realms/${realm}/protocol/openid-connect/logout`);
|
|
284
|
+
const appBaseUrl = window.location.origin;
|
|
285
|
+
logoutUrl.searchParams.append("post_logout_redirect_uri", `${appBaseUrl}/login`);
|
|
286
|
+
if (idToken) {
|
|
287
|
+
logoutUrl.searchParams.append("id_token_hint", idToken);
|
|
288
|
+
}
|
|
289
|
+
window.location.href = logoutUrl.toString();
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
|
|
119
293
|
// src/authProvider.ts
|
|
120
294
|
var authProvider = {
|
|
121
|
-
login: async ({ username, password }) => {
|
|
295
|
+
login: async ({ username, password, provider, code, state }) => {
|
|
122
296
|
try {
|
|
123
|
-
|
|
297
|
+
let token;
|
|
298
|
+
let idToken;
|
|
299
|
+
if (provider === "keycloak") {
|
|
300
|
+
if (code && state) {
|
|
301
|
+
const result = await keycloakService.handleCallback(code, state);
|
|
302
|
+
token = result.accessToken;
|
|
303
|
+
idToken = result.idToken;
|
|
304
|
+
} else {
|
|
305
|
+
await keycloakService.startAuthorizationFlow();
|
|
306
|
+
return {
|
|
307
|
+
success: false,
|
|
308
|
+
error: {
|
|
309
|
+
message: "Redirecting to Keycloak...",
|
|
310
|
+
name: "Redirect"
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
} else {
|
|
315
|
+
token = await authService.login({ username, password });
|
|
316
|
+
}
|
|
124
317
|
if (token) {
|
|
125
318
|
localStorage.setItem(TOKEN_KEY, token);
|
|
319
|
+
if (idToken) {
|
|
320
|
+
localStorage.setItem("id_token", idToken);
|
|
321
|
+
}
|
|
126
322
|
const claims = parseJwt(token);
|
|
127
323
|
const userId = claims["http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"] || claims.sub || claims.id || claims.Oid;
|
|
128
|
-
const claimName = claims["http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"] || claims.unique_name || claims.name || username;
|
|
324
|
+
const claimName = claims["http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"] || claims.unique_name || claims.preferred_username || claims.name || username;
|
|
129
325
|
try {
|
|
130
326
|
let user = null;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
327
|
+
let retries = provider === "keycloak" ? 3 : 1;
|
|
328
|
+
for (let i = 0; i < retries; i++) {
|
|
329
|
+
if (i > 0) {
|
|
330
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
331
|
+
}
|
|
332
|
+
if (provider === "keycloak") {
|
|
333
|
+
user = await authService.getUserByUsername(claimName || username);
|
|
334
|
+
} else if (userId) {
|
|
335
|
+
user = await authService.getUserById(userId);
|
|
336
|
+
} else {
|
|
337
|
+
user = await authService.getUserByUsername(claimName || username);
|
|
338
|
+
}
|
|
339
|
+
if (user && user.Roles && user.Roles.length > 0) {
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
135
342
|
}
|
|
136
343
|
if (user) {
|
|
137
344
|
if (user.Photo) {
|
|
@@ -148,6 +355,7 @@ var authProvider = {
|
|
|
148
355
|
isAdmin = user.Roles.some((r) => r.IsAdministrative);
|
|
149
356
|
}
|
|
150
357
|
localStorage.setItem("user_is_admin", isAdmin ? "true" : "false");
|
|
358
|
+
localStorage.setItem("auth_provider", provider || "local");
|
|
151
359
|
}
|
|
152
360
|
} catch (error) {
|
|
153
361
|
console.error("Failed to fetch user details", error);
|
|
@@ -175,12 +383,22 @@ var authProvider = {
|
|
|
175
383
|
}
|
|
176
384
|
},
|
|
177
385
|
logout: async () => {
|
|
386
|
+
const authProvider2 = localStorage.getItem("auth_provider");
|
|
387
|
+
const idToken = localStorage.getItem("id_token");
|
|
178
388
|
localStorage.removeItem(TOKEN_KEY);
|
|
389
|
+
localStorage.removeItem("id_token");
|
|
179
390
|
localStorage.removeItem("user_photo");
|
|
180
391
|
localStorage.removeItem("user_name");
|
|
181
392
|
localStorage.removeItem("user_id");
|
|
182
393
|
localStorage.removeItem("user_roles");
|
|
183
394
|
localStorage.removeItem("user_is_admin");
|
|
395
|
+
localStorage.removeItem("auth_provider");
|
|
396
|
+
if (authProvider2 === "keycloak") {
|
|
397
|
+
keycloakService.logout(idToken || void 0);
|
|
398
|
+
return {
|
|
399
|
+
success: true
|
|
400
|
+
};
|
|
401
|
+
}
|
|
184
402
|
return {
|
|
185
403
|
success: true,
|
|
186
404
|
redirectTo: "/login"
|
|
@@ -292,7 +510,6 @@ var mapOperator = (operator) => {
|
|
|
292
510
|
return "ge";
|
|
293
511
|
case "in":
|
|
294
512
|
return "in";
|
|
295
|
-
// OData v4.01 usually, or handled manually
|
|
296
513
|
case "contains":
|
|
297
514
|
return "contains";
|
|
298
515
|
case "startswith":
|
|
@@ -475,8 +692,35 @@ var SecurityPermissionState = /* @__PURE__ */ ((SecurityPermissionState2) => {
|
|
|
475
692
|
return SecurityPermissionState2;
|
|
476
693
|
})(SecurityPermissionState || {});
|
|
477
694
|
|
|
695
|
+
// src/utils/passwordUtils.ts
|
|
696
|
+
var generatePassword = (length = 12) => {
|
|
697
|
+
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+";
|
|
698
|
+
const array = new Uint32Array(length);
|
|
699
|
+
crypto.getRandomValues(array);
|
|
700
|
+
return Array.from(array, (num) => charset[num % charset.length]).join("");
|
|
701
|
+
};
|
|
702
|
+
var validatePasswordStrength = (password) => {
|
|
703
|
+
if (password.length < 8) {
|
|
704
|
+
return { isValid: false, message: "Password must be at least 8 characters long" };
|
|
705
|
+
}
|
|
706
|
+
const hasUpperCase = /[A-Z]/.test(password);
|
|
707
|
+
const hasLowerCase = /[a-z]/.test(password);
|
|
708
|
+
const hasNumbers = /\d/.test(password);
|
|
709
|
+
const hasSpecialChar = /[!@#$%^&*()_+]/.test(password);
|
|
710
|
+
if (!hasUpperCase || !hasLowerCase) {
|
|
711
|
+
return { isValid: false, message: "Password must contain both uppercase and lowercase letters" };
|
|
712
|
+
}
|
|
713
|
+
if (!hasNumbers) {
|
|
714
|
+
return { isValid: false, message: "Password must contain at least one number" };
|
|
715
|
+
}
|
|
716
|
+
if (!hasSpecialChar) {
|
|
717
|
+
return { isValid: false, message: "Password must contain at least one special character" };
|
|
718
|
+
}
|
|
719
|
+
return { isValid: true, message: "Password is strong" };
|
|
720
|
+
};
|
|
721
|
+
|
|
478
722
|
// src/components/Header.tsx
|
|
479
|
-
import React3, { useState as useState2 } from "react";
|
|
723
|
+
import React3, { useState as useState2, useEffect as useEffect2 } from "react";
|
|
480
724
|
import { useLogout, useGetIdentity, useInvalidate, useUpdatePassword } from "@refinedev/core";
|
|
481
725
|
import { Layout, Button, Space, Typography, Avatar, theme as theme2, Dropdown, Modal, Form, Input, message } from "antd/lib";
|
|
482
726
|
import { LogoutOutlined, UserOutlined, DownOutlined, SunOutlined, MoonOutlined, CameraOutlined, LockOutlined, ThunderboltOutlined } from "@ant-design/icons";
|
|
@@ -578,6 +822,12 @@ var Header = () => {
|
|
|
578
822
|
const { mode, setMode } = useColorMode();
|
|
579
823
|
const { token } = useToken();
|
|
580
824
|
const invalidate = useInvalidate();
|
|
825
|
+
const [authProvider2, setAuthProvider] = useState2(null);
|
|
826
|
+
useEffect2(() => {
|
|
827
|
+
if (user) {
|
|
828
|
+
setAuthProvider(localStorage.getItem("auth_provider"));
|
|
829
|
+
}
|
|
830
|
+
}, [user]);
|
|
581
831
|
const [isPhotoModalOpen, setIsPhotoModalOpen] = useState2(false);
|
|
582
832
|
const [isPhotoLoading, setIsPhotoLoading] = useState2(false);
|
|
583
833
|
const [photoForm] = Form.useForm();
|
|
@@ -607,14 +857,8 @@ var Header = () => {
|
|
|
607
857
|
setIsPhotoModalOpen(false);
|
|
608
858
|
}
|
|
609
859
|
};
|
|
610
|
-
const
|
|
611
|
-
|
|
612
|
-
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+";
|
|
613
|
-
let retVal = "";
|
|
614
|
-
for (let i = 0, n = charset.length; i < length; ++i) {
|
|
615
|
-
retVal += charset.charAt(Math.floor(Math.random() * n));
|
|
616
|
-
}
|
|
617
|
-
passwordForm.setFieldsValue({ password: retVal });
|
|
860
|
+
const handleGeneratePassword = () => {
|
|
861
|
+
passwordForm.setFieldsValue({ password: generatePassword() });
|
|
618
862
|
};
|
|
619
863
|
const handlePasswordSubmit = async (values) => {
|
|
620
864
|
setIsPasswordLoading(true);
|
|
@@ -657,11 +901,18 @@ var Header = () => {
|
|
|
657
901
|
},
|
|
658
902
|
{
|
|
659
903
|
key: "change-password",
|
|
660
|
-
label: "Change Password",
|
|
904
|
+
label: authProvider2 === "keycloak" ? "Manage Account in Keycloak" : "Change Password",
|
|
661
905
|
icon: /* @__PURE__ */ React3.createElement(LockOutlined, null),
|
|
662
906
|
onClick: () => {
|
|
663
|
-
|
|
664
|
-
|
|
907
|
+
if (authProvider2 === "keycloak") {
|
|
908
|
+
const env = import.meta.env;
|
|
909
|
+
const keycloakUrl = env?.VITE_KEYCLOAK_URL || "http://localhost:8080";
|
|
910
|
+
const realm = env?.VITE_KEYCLOAK_REALM || "cundi";
|
|
911
|
+
window.open(`${keycloakUrl}/realms/${realm}/account`, "_blank");
|
|
912
|
+
} else {
|
|
913
|
+
passwordForm.resetFields();
|
|
914
|
+
setIsPasswordModalOpen(true);
|
|
915
|
+
}
|
|
665
916
|
}
|
|
666
917
|
},
|
|
667
918
|
{
|
|
@@ -725,13 +976,13 @@ var Header = () => {
|
|
|
725
976
|
rules: [{ required: true, message: "Please input the new password!" }]
|
|
726
977
|
},
|
|
727
978
|
/* @__PURE__ */ React3.createElement(Input.Password, { placeholder: "Enter new password" })
|
|
728
|
-
), /* @__PURE__ */ React3.createElement(Button, { icon: /* @__PURE__ */ React3.createElement(ThunderboltOutlined, null), onClick:
|
|
979
|
+
), /* @__PURE__ */ React3.createElement(Button, { icon: /* @__PURE__ */ React3.createElement(ThunderboltOutlined, null), onClick: handleGeneratePassword })))
|
|
729
980
|
)
|
|
730
981
|
);
|
|
731
982
|
};
|
|
732
983
|
|
|
733
984
|
// src/components/SmartList.tsx
|
|
734
|
-
import React4, { useState as useState3, useEffect as
|
|
985
|
+
import React4, { useState as useState3, useEffect as useEffect3, useMemo } from "react";
|
|
735
986
|
import {
|
|
736
987
|
List,
|
|
737
988
|
useTable
|
|
@@ -743,7 +994,7 @@ var SmartList = ({
|
|
|
743
994
|
resource,
|
|
744
995
|
searchFields
|
|
745
996
|
}) => {
|
|
746
|
-
const { tableProps, searchFormProps,
|
|
997
|
+
const { tableProps, searchFormProps, tableQuery, setFilters } = useTable({
|
|
747
998
|
resource,
|
|
748
999
|
syncWithLocation: true,
|
|
749
1000
|
onSearch: (params) => {
|
|
@@ -762,17 +1013,25 @@ var SmartList = ({
|
|
|
762
1013
|
return filters;
|
|
763
1014
|
}
|
|
764
1015
|
});
|
|
765
|
-
const columns =
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
1016
|
+
const columns = useMemo(
|
|
1017
|
+
() => React4.Children.toArray(children).map((child) => {
|
|
1018
|
+
const props = child.props || {};
|
|
1019
|
+
return {
|
|
1020
|
+
key: String(props.dataIndex || props.title || "unknown"),
|
|
1021
|
+
title: props.title,
|
|
1022
|
+
dataIndex: props.dataIndex,
|
|
1023
|
+
defaultVisible: props.defaultVisible
|
|
1024
|
+
};
|
|
1025
|
+
}),
|
|
1026
|
+
[children]
|
|
1027
|
+
);
|
|
773
1028
|
const [visibleColumns, setVisibleColumns] = useState3([]);
|
|
774
|
-
|
|
775
|
-
|
|
1029
|
+
const columnKeysString = useMemo(
|
|
1030
|
+
() => columns.map((c) => c.key).join(","),
|
|
1031
|
+
[columns]
|
|
1032
|
+
);
|
|
1033
|
+
useEffect3(() => {
|
|
1034
|
+
const allKeys = columns.map((c) => c.key);
|
|
776
1035
|
const storageKey = `table-columns-${resource}`;
|
|
777
1036
|
const saved = localStorage.getItem(storageKey);
|
|
778
1037
|
if (saved) {
|
|
@@ -787,9 +1046,9 @@ var SmartList = ({
|
|
|
787
1046
|
console.error("Failed to parse saved columns", e);
|
|
788
1047
|
}
|
|
789
1048
|
}
|
|
790
|
-
const defaultVisible = columns.filter((c) => c.defaultVisible || c.dataIndex === "actions").map((c) => c.key
|
|
1049
|
+
const defaultVisible = columns.filter((c) => c.defaultVisible || c.dataIndex === "actions").map((c) => c.key);
|
|
791
1050
|
setVisibleColumns(defaultVisible);
|
|
792
|
-
}, [
|
|
1051
|
+
}, [columnKeysString, resource, columns]);
|
|
793
1052
|
const handleColumnChange = (key, checked) => {
|
|
794
1053
|
let newVisible;
|
|
795
1054
|
if (checked) {
|
|
@@ -855,7 +1114,7 @@ var SmartList = ({
|
|
|
855
1114
|
}
|
|
856
1115
|
}
|
|
857
1116
|
}
|
|
858
|
-
))), /* @__PURE__ */ React4.createElement(Space2, null, /* @__PURE__ */ React4.createElement(Button2, { icon: /* @__PURE__ */ React4.createElement(ReloadOutlined, null), onClick: () =>
|
|
1117
|
+
))), /* @__PURE__ */ React4.createElement(Space2, null, /* @__PURE__ */ React4.createElement(Button2, { icon: /* @__PURE__ */ React4.createElement(ReloadOutlined, null), onClick: () => tableQuery?.refetch() }, "Refresh"), /* @__PURE__ */ React4.createElement(Popover, { content, title: "Columns", trigger: "click", placement: "bottomRight" }, /* @__PURE__ */ React4.createElement(Button2, { icon: /* @__PURE__ */ React4.createElement(SettingOutlined, null) }, "Columns")))), /* @__PURE__ */ React4.createElement(Table, { ...tableProps, rowKey: "Oid" }, filteredChildren));
|
|
859
1118
|
};
|
|
860
1119
|
|
|
861
1120
|
// src/components/RelatedList.tsx
|
|
@@ -1004,7 +1263,7 @@ var RelatedList = ({
|
|
|
1004
1263
|
};
|
|
1005
1264
|
|
|
1006
1265
|
// src/components/TiptapEditor.tsx
|
|
1007
|
-
import React6, { useEffect as
|
|
1266
|
+
import React6, { useEffect as useEffect4 } from "react";
|
|
1008
1267
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
1009
1268
|
import StarterKit from "@tiptap/starter-kit";
|
|
1010
1269
|
import Image from "@tiptap/extension-image";
|
|
@@ -10496,10 +10755,10 @@ editHandlers.compositionend = (view, event) => {
|
|
|
10496
10755
|
scheduleComposeEnd(view, 20);
|
|
10497
10756
|
}
|
|
10498
10757
|
};
|
|
10499
|
-
function scheduleComposeEnd(view,
|
|
10758
|
+
function scheduleComposeEnd(view, delay2) {
|
|
10500
10759
|
clearTimeout(view.input.composingTimeout);
|
|
10501
|
-
if (
|
|
10502
|
-
view.input.composingTimeout = setTimeout(() => endComposition(view),
|
|
10760
|
+
if (delay2 > -1)
|
|
10761
|
+
view.input.composingTimeout = setTimeout(() => endComposition(view), delay2);
|
|
10503
10762
|
}
|
|
10504
10763
|
function clearComposition(view) {
|
|
10505
10764
|
if (view.composing) {
|
|
@@ -18317,7 +18576,7 @@ var TiptapEditor = ({ value, onChange, disabled }) => {
|
|
|
18317
18576
|
}
|
|
18318
18577
|
}
|
|
18319
18578
|
});
|
|
18320
|
-
|
|
18579
|
+
useEffect4(() => {
|
|
18321
18580
|
if (editor && value !== void 0 && value !== editor.getHTML()) {
|
|
18322
18581
|
if (editor.getText() === "" && value) {
|
|
18323
18582
|
editor.commands.setContent(value);
|
|
@@ -18592,87 +18851,12 @@ var TiptapEditor = ({ value, onChange, disabled }) => {
|
|
|
18592
18851
|
}
|
|
18593
18852
|
))),
|
|
18594
18853
|
/* @__PURE__ */ React6.createElement("style", null, `
|
|
18595
|
-
|
|
18596
|
-
|
|
18597
|
-
|
|
18598
|
-
|
|
18599
|
-
|
|
18600
|
-
|
|
18601
|
-
}
|
|
18602
|
-
.ProseMirror pre code {
|
|
18603
|
-
color: inherit;
|
|
18604
|
-
padding: 0;
|
|
18605
|
-
background: none;
|
|
18606
|
-
font-size: 0.8rem;
|
|
18607
|
-
}
|
|
18608
|
-
.ProseMirror p {
|
|
18609
|
-
margin-bottom: 0px;
|
|
18610
|
-
}
|
|
18611
|
-
.ProseMirror:focus {
|
|
18612
|
-
outline: none;
|
|
18613
|
-
}
|
|
18614
|
-
.ProseMirror table {
|
|
18615
|
-
border-collapse: collapse;
|
|
18616
|
-
table-layout: fixed;
|
|
18617
|
-
width: 100%;
|
|
18618
|
-
margin: 0;
|
|
18619
|
-
overflow: hidden;
|
|
18620
|
-
}
|
|
18621
|
-
.ProseMirror td, .ProseMirror th {
|
|
18622
|
-
min-width: 1em;
|
|
18623
|
-
border: 2px solid ${token.colorBorder};
|
|
18624
|
-
padding: 3px 5px;
|
|
18625
|
-
vertical-align: top;
|
|
18626
|
-
box-sizing: border-box;
|
|
18627
|
-
position: relative;
|
|
18628
|
-
}
|
|
18629
|
-
.ProseMirror th {
|
|
18630
|
-
font-weight: bold;
|
|
18631
|
-
text-align: left;
|
|
18632
|
-
background-color: ${token.colorFillQuaternary};
|
|
18633
|
-
}
|
|
18634
|
-
.ProseMirror .selectedCell:after {
|
|
18635
|
-
z-index: 2;
|
|
18636
|
-
position: absolute;
|
|
18637
|
-
content: "";
|
|
18638
|
-
left: 0; right: 0; top: 0; bottom: 0;
|
|
18639
|
-
background: rgba(200, 200, 255, 0.4);
|
|
18640
|
-
pointer-events: none;
|
|
18641
|
-
}
|
|
18642
|
-
.ProseMirror .column-resize-handle {
|
|
18643
|
-
position: absolute;
|
|
18644
|
-
right: -2px;
|
|
18645
|
-
top: 0;
|
|
18646
|
-
bottom: -2px;
|
|
18647
|
-
width: 4px;
|
|
18648
|
-
background-color: #adf;
|
|
18649
|
-
pointer-events: none;
|
|
18650
|
-
}
|
|
18651
|
-
ul[data-type="taskList"] {
|
|
18652
|
-
list-style: none;
|
|
18653
|
-
padding: 0;
|
|
18654
|
-
}
|
|
18655
|
-
ul[data-type="taskList"] li {
|
|
18656
|
-
display: flex;
|
|
18657
|
-
align-items: center;
|
|
18658
|
-
}
|
|
18659
|
-
ul[data-type="taskList"] li > label {
|
|
18660
|
-
flex: 0 0 auto;
|
|
18661
|
-
margin-right: 0.5rem;
|
|
18662
|
-
user-select: none;
|
|
18663
|
-
}
|
|
18664
|
-
ul[data-type="taskList"] li > div {
|
|
18665
|
-
flex: 1 1 auto;
|
|
18666
|
-
}
|
|
18667
|
-
ul[data-type="taskList"] input[type="checkbox"] {
|
|
18668
|
-
cursor: pointer;
|
|
18669
|
-
}
|
|
18670
|
-
.ProseMirror p.is-editor-empty:first-child::before {
|
|
18671
|
-
color: ${token.colorTextPlaceholder};
|
|
18672
|
-
content: attr(data-placeholder);
|
|
18673
|
-
float: left;
|
|
18674
|
-
height: 0;
|
|
18675
|
-
pointer-events: none;
|
|
18854
|
+
:root {
|
|
18855
|
+
--tiptap-code-bg: ${token.colorFillTertiary};
|
|
18856
|
+
--tiptap-code-text: ${token.colorText};
|
|
18857
|
+
--tiptap-border: ${token.colorBorder};
|
|
18858
|
+
--tiptap-header-bg: ${token.colorFillQuaternary};
|
|
18859
|
+
--tiptap-placeholder: ${token.colorTextPlaceholder};
|
|
18676
18860
|
}
|
|
18677
18861
|
`),
|
|
18678
18862
|
/* @__PURE__ */ React6.createElement("div", { style: {
|
|
@@ -18687,8 +18871,9 @@ var TiptapEditor = ({ value, onChange, disabled }) => {
|
|
|
18687
18871
|
// src/pages/login/index.tsx
|
|
18688
18872
|
import React7 from "react";
|
|
18689
18873
|
import { useLogin, useTranslate } from "@refinedev/core";
|
|
18690
|
-
import { Button as Button5, Form as Form4, Input as Input4, Card, Typography as Typography2, Layout as Layout2, theme as theme4, Checkbox as Checkbox2 } from "antd/lib";
|
|
18874
|
+
import { Button as Button5, Form as Form4, Input as Input4, Card, Typography as Typography2, Layout as Layout2, theme as theme4, Checkbox as Checkbox2, Divider } from "antd/lib";
|
|
18691
18875
|
import { ThemedTitle } from "@refinedev/antd";
|
|
18876
|
+
import { useNavigate } from "react-router";
|
|
18692
18877
|
var { Title, Link } = Typography2;
|
|
18693
18878
|
var LoginPage = () => {
|
|
18694
18879
|
const [form] = Form4.useForm();
|
|
@@ -18696,6 +18881,7 @@ var LoginPage = () => {
|
|
|
18696
18881
|
const isLoading = isPending;
|
|
18697
18882
|
const translate = useTranslate();
|
|
18698
18883
|
const { token } = theme4.useToken();
|
|
18884
|
+
const navigate = useNavigate();
|
|
18699
18885
|
const onFinish = async (values) => {
|
|
18700
18886
|
login(values);
|
|
18701
18887
|
};
|
|
@@ -18726,7 +18912,7 @@ var LoginPage = () => {
|
|
|
18726
18912
|
boxShadow: "0 4px 24px -4px rgba(0, 0, 0, 0.1)"
|
|
18727
18913
|
}
|
|
18728
18914
|
},
|
|
18729
|
-
/* @__PURE__ */ React7.createElement("div", { style: { textAlign: "center", marginBottom: "32px" } }, /* @__PURE__ */ React7.createElement(Title, { level: 3, style: { color: token.colorPrimary, margin: 0 } }, translate("pages.login.title", "Sign in to your account"))),
|
|
18915
|
+
/* @__PURE__ */ React7.createElement("div", { style: { textAlign: "center", marginBottom: "32px" } }, /* @__PURE__ */ React7.createElement(Title, { level: 3, style: { color: token.colorPrimary, margin: 0 } }, translate("pages.login.title", "Sign in to your account")), /* @__PURE__ */ React7.createElement(Typography2.Text, { type: "secondary", style: { fontSize: "14px", marginTop: "8px", display: "block" } }, "Log in using a local account")),
|
|
18730
18916
|
/* @__PURE__ */ React7.createElement(
|
|
18731
18917
|
Form4,
|
|
18732
18918
|
{
|
|
@@ -18801,21 +18987,194 @@ var LoginPage = () => {
|
|
|
18801
18987
|
size: "large"
|
|
18802
18988
|
},
|
|
18803
18989
|
translate("pages.login.signin", "Sign in")
|
|
18804
|
-
))
|
|
18990
|
+
)),
|
|
18991
|
+
/* @__PURE__ */ React7.createElement(Divider, { plain: true }, "or"),
|
|
18992
|
+
/* @__PURE__ */ React7.createElement(
|
|
18993
|
+
Button5,
|
|
18994
|
+
{
|
|
18995
|
+
block: true,
|
|
18996
|
+
size: "large",
|
|
18997
|
+
onClick: () => navigate("/login")
|
|
18998
|
+
},
|
|
18999
|
+
"Log in using a Keycloak account"
|
|
19000
|
+
)
|
|
19001
|
+
)
|
|
19002
|
+
)
|
|
19003
|
+
);
|
|
19004
|
+
};
|
|
19005
|
+
|
|
19006
|
+
// src/pages/login/keycloak.tsx
|
|
19007
|
+
import React8 from "react";
|
|
19008
|
+
import { useLogin as useLogin2, useTranslate as useTranslate2 } from "@refinedev/core";
|
|
19009
|
+
import { Button as Button6, Card as Card2, Typography as Typography3, Layout as Layout3, theme as theme5, Divider as Divider2 } from "antd/lib";
|
|
19010
|
+
import { ThemedTitle as ThemedTitle2 } from "@refinedev/antd";
|
|
19011
|
+
import { useNavigate as useNavigate2 } from "react-router";
|
|
19012
|
+
var { Title: Title2 } = Typography3;
|
|
19013
|
+
var KeycloakLoginPage = () => {
|
|
19014
|
+
const { mutate: login, isPending } = useLogin2();
|
|
19015
|
+
const isLoading = isPending;
|
|
19016
|
+
const translate = useTranslate2();
|
|
19017
|
+
const { token } = theme5.useToken();
|
|
19018
|
+
const navigate = useNavigate2();
|
|
19019
|
+
const handleKeycloakLogin = () => {
|
|
19020
|
+
login({ provider: "keycloak" });
|
|
19021
|
+
};
|
|
19022
|
+
return /* @__PURE__ */ React8.createElement(
|
|
19023
|
+
Layout3,
|
|
19024
|
+
{
|
|
19025
|
+
style: {
|
|
19026
|
+
height: "100vh",
|
|
19027
|
+
justifyContent: "center",
|
|
19028
|
+
alignItems: "center",
|
|
19029
|
+
backgroundColor: token.colorBgContainer
|
|
19030
|
+
}
|
|
19031
|
+
},
|
|
19032
|
+
/* @__PURE__ */ React8.createElement("div", { style: { marginBottom: "24px" } }, /* @__PURE__ */ React8.createElement(
|
|
19033
|
+
ThemedTitle2,
|
|
19034
|
+
{
|
|
19035
|
+
collapsed: false,
|
|
19036
|
+
wrapperStyles: { fontSize: "22px", justifyContent: "center" }
|
|
19037
|
+
}
|
|
19038
|
+
)),
|
|
19039
|
+
/* @__PURE__ */ React8.createElement(
|
|
19040
|
+
Card2,
|
|
19041
|
+
{
|
|
19042
|
+
style: {
|
|
19043
|
+
width: "100%",
|
|
19044
|
+
maxWidth: "400px",
|
|
19045
|
+
padding: "20px",
|
|
19046
|
+
boxShadow: "0 4px 24px -4px rgba(0, 0, 0, 0.1)"
|
|
19047
|
+
}
|
|
19048
|
+
},
|
|
19049
|
+
/* @__PURE__ */ React8.createElement("div", { style: { textAlign: "center", marginBottom: "32px" } }, /* @__PURE__ */ React8.createElement(Title2, { level: 3, style: { color: token.colorPrimary, margin: 0 } }, translate("pages.login.title", "Sign in to your account")), /* @__PURE__ */ React8.createElement(Typography3.Text, { type: "secondary", style: { fontSize: "14px", marginTop: "8px", display: "block" } }, "Choose your authentication method")),
|
|
19050
|
+
/* @__PURE__ */ React8.createElement(
|
|
19051
|
+
Button6,
|
|
19052
|
+
{
|
|
19053
|
+
type: "primary",
|
|
19054
|
+
block: true,
|
|
19055
|
+
size: "large",
|
|
19056
|
+
onClick: handleKeycloakLogin,
|
|
19057
|
+
loading: isLoading,
|
|
19058
|
+
style: { marginBottom: "16px" }
|
|
19059
|
+
},
|
|
19060
|
+
"Sign in with Keycloak"
|
|
19061
|
+
),
|
|
19062
|
+
/* @__PURE__ */ React8.createElement(Divider2, { plain: true }, "or"),
|
|
19063
|
+
/* @__PURE__ */ React8.createElement(
|
|
19064
|
+
Button6,
|
|
19065
|
+
{
|
|
19066
|
+
block: true,
|
|
19067
|
+
size: "large",
|
|
19068
|
+
onClick: () => navigate("/login/api")
|
|
19069
|
+
},
|
|
19070
|
+
"Log in using a local account"
|
|
18805
19071
|
)
|
|
18806
19072
|
)
|
|
18807
19073
|
);
|
|
18808
19074
|
};
|
|
18809
19075
|
|
|
19076
|
+
// src/pages/auth/AuthCallback.tsx
|
|
19077
|
+
import React9, { useEffect as useEffect5, useState as useState4, useRef } from "react";
|
|
19078
|
+
import { useLogin as useLogin3 } from "@refinedev/core";
|
|
19079
|
+
import { Spin, Result } from "antd";
|
|
19080
|
+
var AuthCallback = () => {
|
|
19081
|
+
const { mutate: login } = useLogin3();
|
|
19082
|
+
const [error, setError] = useState4(null);
|
|
19083
|
+
const [processing, setProcessing] = useState4(false);
|
|
19084
|
+
const hasProcessed = useRef(false);
|
|
19085
|
+
useEffect5(() => {
|
|
19086
|
+
if (hasProcessed.current || processing) {
|
|
19087
|
+
return;
|
|
19088
|
+
}
|
|
19089
|
+
const handleCallback = async () => {
|
|
19090
|
+
setProcessing(true);
|
|
19091
|
+
hasProcessed.current = true;
|
|
19092
|
+
try {
|
|
19093
|
+
const params = new URLSearchParams(window.location.search);
|
|
19094
|
+
const code = params.get("code");
|
|
19095
|
+
const state = params.get("state");
|
|
19096
|
+
const errorParam = params.get("error");
|
|
19097
|
+
const errorDescription = params.get("error_description");
|
|
19098
|
+
if (errorParam) {
|
|
19099
|
+
setError(errorDescription || errorParam);
|
|
19100
|
+
setProcessing(false);
|
|
19101
|
+
return;
|
|
19102
|
+
}
|
|
19103
|
+
if (!code || !state) {
|
|
19104
|
+
setError("Missing authorization code or state parameter");
|
|
19105
|
+
setProcessing(false);
|
|
19106
|
+
return;
|
|
19107
|
+
}
|
|
19108
|
+
login({
|
|
19109
|
+
code,
|
|
19110
|
+
state,
|
|
19111
|
+
provider: "keycloak"
|
|
19112
|
+
}, {
|
|
19113
|
+
onError: (err) => {
|
|
19114
|
+
console.error("Login failed:", err);
|
|
19115
|
+
setError(err?.message || "Authentication failed. The authorization code may have been used already.");
|
|
19116
|
+
setProcessing(false);
|
|
19117
|
+
}
|
|
19118
|
+
});
|
|
19119
|
+
} catch (err) {
|
|
19120
|
+
console.error("Callback handling error:", err);
|
|
19121
|
+
setError("Failed to process authentication callback");
|
|
19122
|
+
setProcessing(false);
|
|
19123
|
+
}
|
|
19124
|
+
};
|
|
19125
|
+
handleCallback();
|
|
19126
|
+
}, [login, processing]);
|
|
19127
|
+
if (error) {
|
|
19128
|
+
return /* @__PURE__ */ React9.createElement(
|
|
19129
|
+
Result,
|
|
19130
|
+
{
|
|
19131
|
+
status: "error",
|
|
19132
|
+
title: "Authentication Failed",
|
|
19133
|
+
subTitle: error,
|
|
19134
|
+
extra: /* @__PURE__ */ React9.createElement(
|
|
19135
|
+
"button",
|
|
19136
|
+
{
|
|
19137
|
+
onClick: () => window.location.href = "/login",
|
|
19138
|
+
style: {
|
|
19139
|
+
padding: "8px 16px",
|
|
19140
|
+
background: "#1890ff",
|
|
19141
|
+
color: "white",
|
|
19142
|
+
border: "none",
|
|
19143
|
+
borderRadius: "4px",
|
|
19144
|
+
cursor: "pointer"
|
|
19145
|
+
}
|
|
19146
|
+
},
|
|
19147
|
+
"Back to Login"
|
|
19148
|
+
)
|
|
19149
|
+
}
|
|
19150
|
+
);
|
|
19151
|
+
}
|
|
19152
|
+
return /* @__PURE__ */ React9.createElement(
|
|
19153
|
+
"div",
|
|
19154
|
+
{
|
|
19155
|
+
style: {
|
|
19156
|
+
display: "flex",
|
|
19157
|
+
justifyContent: "center",
|
|
19158
|
+
alignItems: "center",
|
|
19159
|
+
height: "100vh",
|
|
19160
|
+
flexDirection: "column",
|
|
19161
|
+
gap: "16px"
|
|
19162
|
+
}
|
|
19163
|
+
},
|
|
19164
|
+
/* @__PURE__ */ React9.createElement(Spin, { size: "large" }),
|
|
19165
|
+
/* @__PURE__ */ React9.createElement("p", null, "Completing authentication...")
|
|
19166
|
+
);
|
|
19167
|
+
};
|
|
19168
|
+
|
|
18810
19169
|
// src/pages/application-users/list.tsx
|
|
18811
|
-
import
|
|
19170
|
+
import React10, { useState as useState5 } from "react";
|
|
18812
19171
|
import { useNotification } from "@refinedev/core";
|
|
18813
19172
|
import { EditButton, DeleteButton } from "@refinedev/antd";
|
|
18814
19173
|
import {
|
|
18815
19174
|
Table as Table4,
|
|
18816
19175
|
Checkbox as Checkbox3,
|
|
18817
19176
|
Space as Space6,
|
|
18818
|
-
Button as
|
|
19177
|
+
Button as Button7,
|
|
18819
19178
|
Modal as Modal3,
|
|
18820
19179
|
Input as Input5,
|
|
18821
19180
|
Form as Form5,
|
|
@@ -18823,24 +19182,18 @@ import {
|
|
|
18823
19182
|
} from "antd/lib";
|
|
18824
19183
|
import { KeyOutlined, ThunderboltOutlined as ThunderboltOutlined2 } from "@ant-design/icons";
|
|
18825
19184
|
var ApplicationUserList = () => {
|
|
18826
|
-
const [isModalOpen, setIsModalOpen] =
|
|
18827
|
-
const [selectedUser, setSelectedUser] =
|
|
19185
|
+
const [isModalOpen, setIsModalOpen] = useState5(false);
|
|
19186
|
+
const [selectedUser, setSelectedUser] = useState5(null);
|
|
18828
19187
|
const [form] = Form5.useForm();
|
|
18829
19188
|
const { open } = useNotification();
|
|
18830
|
-
const [isLoading, setIsLoading] =
|
|
19189
|
+
const [isLoading, setIsLoading] = useState5(false);
|
|
18831
19190
|
const handleResetPasswordClick = (user) => {
|
|
18832
19191
|
setSelectedUser(user);
|
|
18833
19192
|
setIsModalOpen(true);
|
|
18834
19193
|
form.resetFields();
|
|
18835
19194
|
};
|
|
18836
|
-
const
|
|
18837
|
-
|
|
18838
|
-
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+";
|
|
18839
|
-
let retVal = "";
|
|
18840
|
-
for (let i = 0, n = charset.length; i < length; ++i) {
|
|
18841
|
-
retVal += charset.charAt(Math.floor(Math.random() * n));
|
|
18842
|
-
}
|
|
18843
|
-
form.setFieldsValue({ password: retVal });
|
|
19195
|
+
const handleGeneratePassword = () => {
|
|
19196
|
+
form.setFieldsValue({ password: generatePassword() });
|
|
18844
19197
|
};
|
|
18845
19198
|
const handleResetPasswordSubmit = async (values) => {
|
|
18846
19199
|
if (!selectedUser) return;
|
|
@@ -18863,20 +19216,20 @@ var ApplicationUserList = () => {
|
|
|
18863
19216
|
setIsLoading(false);
|
|
18864
19217
|
}
|
|
18865
19218
|
};
|
|
18866
|
-
return /* @__PURE__ */
|
|
19219
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(
|
|
18867
19220
|
SmartList,
|
|
18868
19221
|
{
|
|
18869
19222
|
searchFields: ["UserName", "DisplayName", "Email"]
|
|
18870
19223
|
},
|
|
18871
|
-
/* @__PURE__ */
|
|
19224
|
+
/* @__PURE__ */ React10.createElement(
|
|
18872
19225
|
Table4.Column,
|
|
18873
19226
|
{
|
|
18874
19227
|
dataIndex: "Photo",
|
|
18875
19228
|
title: "Photo",
|
|
18876
|
-
render: (value) => value ? /* @__PURE__ */
|
|
19229
|
+
render: (value) => value ? /* @__PURE__ */ React10.createElement("img", { src: `data:image/png;base64,${value}`, alt: "User", style: { height: 40, width: 40, objectFit: "cover", borderRadius: "50%" } }) : "-"
|
|
18877
19230
|
}
|
|
18878
19231
|
),
|
|
18879
|
-
/* @__PURE__ */
|
|
19232
|
+
/* @__PURE__ */ React10.createElement(
|
|
18880
19233
|
Table4.Column,
|
|
18881
19234
|
{
|
|
18882
19235
|
dataIndex: "DisplayName",
|
|
@@ -18886,7 +19239,7 @@ var ApplicationUserList = () => {
|
|
|
18886
19239
|
defaultVisible: true
|
|
18887
19240
|
}
|
|
18888
19241
|
),
|
|
18889
|
-
/* @__PURE__ */
|
|
19242
|
+
/* @__PURE__ */ React10.createElement(
|
|
18890
19243
|
Table4.Column,
|
|
18891
19244
|
{
|
|
18892
19245
|
dataIndex: "UserName",
|
|
@@ -18895,7 +19248,7 @@ var ApplicationUserList = () => {
|
|
|
18895
19248
|
defaultVisible: true
|
|
18896
19249
|
}
|
|
18897
19250
|
),
|
|
18898
|
-
/* @__PURE__ */
|
|
19251
|
+
/* @__PURE__ */ React10.createElement(
|
|
18899
19252
|
Table4.Column,
|
|
18900
19253
|
{
|
|
18901
19254
|
dataIndex: "Email",
|
|
@@ -18903,38 +19256,38 @@ var ApplicationUserList = () => {
|
|
|
18903
19256
|
sorter: true
|
|
18904
19257
|
}
|
|
18905
19258
|
),
|
|
18906
|
-
/* @__PURE__ */
|
|
19259
|
+
/* @__PURE__ */ React10.createElement(
|
|
18907
19260
|
Table4.Column,
|
|
18908
19261
|
{
|
|
18909
19262
|
dataIndex: "IsActive",
|
|
18910
19263
|
title: "Active",
|
|
18911
|
-
render: (value) => /* @__PURE__ */
|
|
19264
|
+
render: (value) => /* @__PURE__ */ React10.createElement(Checkbox3, { checked: value, disabled: true }),
|
|
18912
19265
|
sorter: true
|
|
18913
19266
|
}
|
|
18914
19267
|
),
|
|
18915
|
-
/* @__PURE__ */
|
|
19268
|
+
/* @__PURE__ */ React10.createElement(
|
|
18916
19269
|
Table4.Column,
|
|
18917
19270
|
{
|
|
18918
19271
|
dataIndex: "AccessFailedCount",
|
|
18919
19272
|
title: "Access Failed Count"
|
|
18920
19273
|
}
|
|
18921
19274
|
),
|
|
18922
|
-
/* @__PURE__ */
|
|
19275
|
+
/* @__PURE__ */ React10.createElement(
|
|
18923
19276
|
Table4.Column,
|
|
18924
19277
|
{
|
|
18925
19278
|
title: "Actions",
|
|
18926
19279
|
dataIndex: "actions",
|
|
18927
|
-
render: (_, record) => /* @__PURE__ */
|
|
18928
|
-
|
|
19280
|
+
render: (_, record) => /* @__PURE__ */ React10.createElement(Space6, null, /* @__PURE__ */ React10.createElement(Tooltip, { title: "Reset Password" }, /* @__PURE__ */ React10.createElement(
|
|
19281
|
+
Button7,
|
|
18929
19282
|
{
|
|
18930
19283
|
size: "small",
|
|
18931
|
-
icon: /* @__PURE__ */
|
|
19284
|
+
icon: /* @__PURE__ */ React10.createElement(KeyOutlined, null),
|
|
18932
19285
|
onClick: () => handleResetPasswordClick(record)
|
|
18933
19286
|
}
|
|
18934
|
-
)), /* @__PURE__ */
|
|
19287
|
+
)), /* @__PURE__ */ React10.createElement(EditButton, { hideText: true, size: "small", recordItemId: record.Oid }), /* @__PURE__ */ React10.createElement(DeleteButton, { hideText: true, size: "small", recordItemId: record.Oid }))
|
|
18935
19288
|
}
|
|
18936
19289
|
)
|
|
18937
|
-
), /* @__PURE__ */
|
|
19290
|
+
), /* @__PURE__ */ React10.createElement(
|
|
18938
19291
|
Modal3,
|
|
18939
19292
|
{
|
|
18940
19293
|
title: `Reset Password for ${selectedUser?.DisplayName || selectedUser?.UserName}`,
|
|
@@ -18943,7 +19296,7 @@ var ApplicationUserList = () => {
|
|
|
18943
19296
|
onOk: () => form.submit(),
|
|
18944
19297
|
confirmLoading: isLoading
|
|
18945
19298
|
},
|
|
18946
|
-
/* @__PURE__ */
|
|
19299
|
+
/* @__PURE__ */ React10.createElement(Form5, { form, onFinish: handleResetPasswordSubmit, layout: "vertical" }, /* @__PURE__ */ React10.createElement("div", { style: { display: "flex", gap: 8, alignItems: "flex-end" } }, /* @__PURE__ */ React10.createElement(
|
|
18947
19300
|
Form5.Item,
|
|
18948
19301
|
{
|
|
18949
19302
|
name: "password",
|
|
@@ -18951,18 +19304,18 @@ var ApplicationUserList = () => {
|
|
|
18951
19304
|
style: { flex: 1, marginBottom: 0 },
|
|
18952
19305
|
rules: [{ required: true, message: "Please input the new password!" }]
|
|
18953
19306
|
},
|
|
18954
|
-
/* @__PURE__ */
|
|
18955
|
-
), /* @__PURE__ */
|
|
19307
|
+
/* @__PURE__ */ React10.createElement(Input5.Password, { placeholder: "Enter new password" })
|
|
19308
|
+
), /* @__PURE__ */ React10.createElement(Tooltip, { title: "Generate Complex Password" }, /* @__PURE__ */ React10.createElement(Button7, { icon: /* @__PURE__ */ React10.createElement(ThunderboltOutlined2, null), onClick: handleGeneratePassword }))))
|
|
18956
19309
|
));
|
|
18957
19310
|
};
|
|
18958
19311
|
|
|
18959
19312
|
// src/pages/application-users/create.tsx
|
|
18960
|
-
import
|
|
19313
|
+
import React11 from "react";
|
|
18961
19314
|
import { Create, useForm } from "@refinedev/antd";
|
|
18962
19315
|
import { Form as Form6, Input as Input6, Checkbox as Checkbox4 } from "antd/lib";
|
|
18963
19316
|
var ApplicationUserCreate = () => {
|
|
18964
19317
|
const { formProps, saveButtonProps } = useForm();
|
|
18965
|
-
return /* @__PURE__ */
|
|
19318
|
+
return /* @__PURE__ */ React11.createElement(Create, { saveButtonProps }, /* @__PURE__ */ React11.createElement(Form6, { ...formProps, layout: "vertical" }, /* @__PURE__ */ React11.createElement(
|
|
18966
19319
|
Form6.Item,
|
|
18967
19320
|
{
|
|
18968
19321
|
label: "User Name",
|
|
@@ -18973,15 +19326,15 @@ var ApplicationUserCreate = () => {
|
|
|
18973
19326
|
}
|
|
18974
19327
|
]
|
|
18975
19328
|
},
|
|
18976
|
-
/* @__PURE__ */
|
|
18977
|
-
), /* @__PURE__ */
|
|
19329
|
+
/* @__PURE__ */ React11.createElement(Input6, null)
|
|
19330
|
+
), /* @__PURE__ */ React11.createElement(
|
|
18978
19331
|
Form6.Item,
|
|
18979
19332
|
{
|
|
18980
19333
|
label: "Display Name",
|
|
18981
19334
|
name: "DisplayName"
|
|
18982
19335
|
},
|
|
18983
|
-
/* @__PURE__ */
|
|
18984
|
-
), /* @__PURE__ */
|
|
19336
|
+
/* @__PURE__ */ React11.createElement(Input6, null)
|
|
19337
|
+
), /* @__PURE__ */ React11.createElement(
|
|
18985
19338
|
Form6.Item,
|
|
18986
19339
|
{
|
|
18987
19340
|
label: "Email",
|
|
@@ -18992,8 +19345,8 @@ var ApplicationUserCreate = () => {
|
|
|
18992
19345
|
}
|
|
18993
19346
|
]
|
|
18994
19347
|
},
|
|
18995
|
-
/* @__PURE__ */
|
|
18996
|
-
), /* @__PURE__ */
|
|
19348
|
+
/* @__PURE__ */ React11.createElement(Input6, null)
|
|
19349
|
+
), /* @__PURE__ */ React11.createElement(
|
|
18997
19350
|
Form6.Item,
|
|
18998
19351
|
{
|
|
18999
19352
|
label: "Is Active",
|
|
@@ -19001,19 +19354,19 @@ var ApplicationUserCreate = () => {
|
|
|
19001
19354
|
valuePropName: "checked",
|
|
19002
19355
|
initialValue: true
|
|
19003
19356
|
},
|
|
19004
|
-
/* @__PURE__ */
|
|
19005
|
-
), /* @__PURE__ */
|
|
19357
|
+
/* @__PURE__ */ React11.createElement(Checkbox4, null, "Active")
|
|
19358
|
+
), /* @__PURE__ */ React11.createElement(
|
|
19006
19359
|
Form6.Item,
|
|
19007
19360
|
{
|
|
19008
19361
|
label: "Photo",
|
|
19009
19362
|
name: "Photo"
|
|
19010
19363
|
},
|
|
19011
|
-
/* @__PURE__ */
|
|
19364
|
+
/* @__PURE__ */ React11.createElement(Base64Upload, null)
|
|
19012
19365
|
)));
|
|
19013
19366
|
};
|
|
19014
19367
|
|
|
19015
19368
|
// src/pages/application-users/edit.tsx
|
|
19016
|
-
import
|
|
19369
|
+
import React12 from "react";
|
|
19017
19370
|
import { Edit, useForm as useForm2, useSelect } from "@refinedev/antd";
|
|
19018
19371
|
import { Form as Form7, Input as Input7, Checkbox as Checkbox5, Select, App } from "antd/lib";
|
|
19019
19372
|
var ApplicationUserEdit = () => {
|
|
@@ -19056,7 +19409,7 @@ var ApplicationUserEdit = () => {
|
|
|
19056
19409
|
const { Roles, ...userValues } = values;
|
|
19057
19410
|
formProps.onFinish?.(userValues);
|
|
19058
19411
|
};
|
|
19059
|
-
return /* @__PURE__ */
|
|
19412
|
+
return /* @__PURE__ */ React12.createElement(Edit, { saveButtonProps }, /* @__PURE__ */ React12.createElement(Form7, { ...formProps, layout: "vertical", onFinish: handleOnFinish }, /* @__PURE__ */ React12.createElement(
|
|
19060
19413
|
Form7.Item,
|
|
19061
19414
|
{
|
|
19062
19415
|
label: "User Name",
|
|
@@ -19067,15 +19420,15 @@ var ApplicationUserEdit = () => {
|
|
|
19067
19420
|
}
|
|
19068
19421
|
]
|
|
19069
19422
|
},
|
|
19070
|
-
/* @__PURE__ */
|
|
19071
|
-
), /* @__PURE__ */
|
|
19423
|
+
/* @__PURE__ */ React12.createElement(Input7, null)
|
|
19424
|
+
), /* @__PURE__ */ React12.createElement(
|
|
19072
19425
|
Form7.Item,
|
|
19073
19426
|
{
|
|
19074
19427
|
label: "Display Name",
|
|
19075
19428
|
name: "DisplayName"
|
|
19076
19429
|
},
|
|
19077
|
-
/* @__PURE__ */
|
|
19078
|
-
), /* @__PURE__ */
|
|
19430
|
+
/* @__PURE__ */ React12.createElement(Input7, null)
|
|
19431
|
+
), /* @__PURE__ */ React12.createElement(
|
|
19079
19432
|
Form7.Item,
|
|
19080
19433
|
{
|
|
19081
19434
|
label: "Email",
|
|
@@ -19086,16 +19439,16 @@ var ApplicationUserEdit = () => {
|
|
|
19086
19439
|
}
|
|
19087
19440
|
]
|
|
19088
19441
|
},
|
|
19089
|
-
/* @__PURE__ */
|
|
19090
|
-
), /* @__PURE__ */
|
|
19442
|
+
/* @__PURE__ */ React12.createElement(Input7, null)
|
|
19443
|
+
), /* @__PURE__ */ React12.createElement(
|
|
19091
19444
|
Form7.Item,
|
|
19092
19445
|
{
|
|
19093
19446
|
label: "Is Active",
|
|
19094
19447
|
name: "IsActive",
|
|
19095
19448
|
valuePropName: "checked"
|
|
19096
19449
|
},
|
|
19097
|
-
/* @__PURE__ */
|
|
19098
|
-
), /* @__PURE__ */
|
|
19450
|
+
/* @__PURE__ */ React12.createElement(Checkbox5, null, "Active")
|
|
19451
|
+
), /* @__PURE__ */ React12.createElement(
|
|
19099
19452
|
Form7.Item,
|
|
19100
19453
|
{
|
|
19101
19454
|
label: "Roles",
|
|
@@ -19114,49 +19467,49 @@ var ApplicationUserEdit = () => {
|
|
|
19114
19467
|
return { value: [] };
|
|
19115
19468
|
}
|
|
19116
19469
|
},
|
|
19117
|
-
/* @__PURE__ */
|
|
19118
|
-
), /* @__PURE__ */
|
|
19470
|
+
/* @__PURE__ */ React12.createElement(Select, { ...roleSelectProps, mode: "multiple" })
|
|
19471
|
+
), /* @__PURE__ */ React12.createElement(
|
|
19119
19472
|
Form7.Item,
|
|
19120
19473
|
{
|
|
19121
19474
|
label: "Photo",
|
|
19122
19475
|
name: "Photo"
|
|
19123
19476
|
},
|
|
19124
|
-
/* @__PURE__ */
|
|
19477
|
+
/* @__PURE__ */ React12.createElement(Base64Upload, null)
|
|
19125
19478
|
)));
|
|
19126
19479
|
};
|
|
19127
19480
|
|
|
19128
19481
|
// src/pages/roles/list.tsx
|
|
19129
|
-
import
|
|
19482
|
+
import React13 from "react";
|
|
19130
19483
|
import { useTable as useTable2, List as List2, EditButton as EditButton2, DeleteButton as DeleteButton2 } from "@refinedev/antd";
|
|
19131
19484
|
import { Table as Table5, Space as Space7, Checkbox as Checkbox6 } from "antd/lib";
|
|
19132
19485
|
var RoleList = () => {
|
|
19133
19486
|
const { tableProps } = useTable2({
|
|
19134
19487
|
syncWithLocation: true
|
|
19135
19488
|
});
|
|
19136
|
-
return /* @__PURE__ */
|
|
19489
|
+
return /* @__PURE__ */ React13.createElement(List2, null, /* @__PURE__ */ React13.createElement(Table5, { ...tableProps, rowKey: "Oid" }, /* @__PURE__ */ React13.createElement(Table5.Column, { dataIndex: "Name", title: "Name" }), /* @__PURE__ */ React13.createElement(
|
|
19137
19490
|
Table5.Column,
|
|
19138
19491
|
{
|
|
19139
19492
|
dataIndex: "IsAdministrative",
|
|
19140
19493
|
title: "Is Administrative",
|
|
19141
|
-
render: (value) => /* @__PURE__ */
|
|
19494
|
+
render: (value) => /* @__PURE__ */ React13.createElement(Checkbox6, { checked: value, disabled: true })
|
|
19142
19495
|
}
|
|
19143
|
-
), /* @__PURE__ */
|
|
19496
|
+
), /* @__PURE__ */ React13.createElement(Table5.Column, { dataIndex: "PermissionPolicy", title: "Permission Policy" }), /* @__PURE__ */ React13.createElement(
|
|
19144
19497
|
Table5.Column,
|
|
19145
19498
|
{
|
|
19146
19499
|
title: "Actions",
|
|
19147
19500
|
dataIndex: "actions",
|
|
19148
|
-
render: (_, record) => /* @__PURE__ */
|
|
19501
|
+
render: (_, record) => /* @__PURE__ */ React13.createElement(Space7, null, /* @__PURE__ */ React13.createElement(EditButton2, { hideText: true, size: "small", recordItemId: record.Oid }), /* @__PURE__ */ React13.createElement(DeleteButton2, { hideText: true, size: "small", recordItemId: record.Oid }))
|
|
19149
19502
|
}
|
|
19150
19503
|
)));
|
|
19151
19504
|
};
|
|
19152
19505
|
|
|
19153
19506
|
// src/pages/roles/create.tsx
|
|
19154
|
-
import
|
|
19507
|
+
import React15 from "react";
|
|
19155
19508
|
import { Create as Create2, useForm as useForm3 } from "@refinedev/antd";
|
|
19156
19509
|
import { Form as Form9, Input as Input8, Checkbox as Checkbox7, Select as Select3 } from "antd/lib";
|
|
19157
19510
|
|
|
19158
19511
|
// src/pages/roles/TypePermissionList.tsx
|
|
19159
|
-
import
|
|
19512
|
+
import React14 from "react";
|
|
19160
19513
|
import { Form as Form8, Select as Select2, Table as Table6 } from "antd/lib";
|
|
19161
19514
|
import { useTable as useTable3 } from "@refinedev/antd";
|
|
19162
19515
|
|
|
@@ -19185,7 +19538,7 @@ var useModelTypes = () => {
|
|
|
19185
19538
|
};
|
|
19186
19539
|
|
|
19187
19540
|
// src/pages/roles/TypePermissionList.tsx
|
|
19188
|
-
var PermissionSelect = (props) => /* @__PURE__ */
|
|
19541
|
+
var PermissionSelect = (props) => /* @__PURE__ */ React14.createElement(
|
|
19189
19542
|
Select2,
|
|
19190
19543
|
{
|
|
19191
19544
|
...props,
|
|
@@ -19197,14 +19550,14 @@ var PermissionSelect = (props) => /* @__PURE__ */ React12.createElement(
|
|
|
19197
19550
|
}
|
|
19198
19551
|
);
|
|
19199
19552
|
var TypePermissionFormFields = ({ typeOptions }) => {
|
|
19200
|
-
return /* @__PURE__ */
|
|
19553
|
+
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(
|
|
19201
19554
|
Form8.Item,
|
|
19202
19555
|
{
|
|
19203
19556
|
label: "Target Type",
|
|
19204
19557
|
name: "TargetTypeFullName",
|
|
19205
19558
|
rules: [{ required: true }]
|
|
19206
19559
|
},
|
|
19207
|
-
/* @__PURE__ */
|
|
19560
|
+
/* @__PURE__ */ React14.createElement(
|
|
19208
19561
|
Select2,
|
|
19209
19562
|
{
|
|
19210
19563
|
showSearch: true,
|
|
@@ -19212,7 +19565,7 @@ var TypePermissionFormFields = ({ typeOptions }) => {
|
|
|
19212
19565
|
filterOption: (input, option) => (option?.label ?? "").toLowerCase().includes(input.toLowerCase())
|
|
19213
19566
|
}
|
|
19214
19567
|
)
|
|
19215
|
-
), /* @__PURE__ */
|
|
19568
|
+
), /* @__PURE__ */ React14.createElement(Form8.Item, { label: "Read State", name: "ReadState" }, /* @__PURE__ */ React14.createElement(PermissionSelect, null)), /* @__PURE__ */ React14.createElement(Form8.Item, { label: "Write State", name: "WriteState" }, /* @__PURE__ */ React14.createElement(PermissionSelect, null)), /* @__PURE__ */ React14.createElement(Form8.Item, { label: "Create State", name: "CreateState" }, /* @__PURE__ */ React14.createElement(PermissionSelect, null)), /* @__PURE__ */ React14.createElement(Form8.Item, { label: "Delete State", name: "DeleteState" }, /* @__PURE__ */ React14.createElement(PermissionSelect, null)));
|
|
19216
19569
|
};
|
|
19217
19570
|
var TypePermissionList = ({ masterId }) => {
|
|
19218
19571
|
const { data: modelTypes } = useModelTypes();
|
|
@@ -19232,17 +19585,17 @@ var TypePermissionList = ({ masterId }) => {
|
|
|
19232
19585
|
mode: "off"
|
|
19233
19586
|
}
|
|
19234
19587
|
});
|
|
19235
|
-
const typeOptions =
|
|
19236
|
-
const FormFieldsWrapper =
|
|
19237
|
-
return ({ mode }) => /* @__PURE__ */
|
|
19588
|
+
const typeOptions = React14.useMemo(() => modelTypes?.filter((t) => t.IsCreatable && !t.IsDeprecated).map((t) => ({ label: t.Caption, value: t.Name })) || [], [modelTypes]);
|
|
19589
|
+
const FormFieldsWrapper = React14.useMemo(() => {
|
|
19590
|
+
return ({ mode }) => /* @__PURE__ */ React14.createElement(TypePermissionFormFields, { typeOptions });
|
|
19238
19591
|
}, [typeOptions]);
|
|
19239
|
-
const dataSource =
|
|
19592
|
+
const dataSource = React14.useMemo(() => {
|
|
19240
19593
|
return (tableProps.dataSource || []).map((p) => ({
|
|
19241
19594
|
...p,
|
|
19242
19595
|
TargetType: p.TargetType || p.TargetTypeFullName || ""
|
|
19243
19596
|
}));
|
|
19244
19597
|
}, [tableProps.dataSource]);
|
|
19245
|
-
return /* @__PURE__ */
|
|
19598
|
+
return /* @__PURE__ */ React14.createElement(
|
|
19246
19599
|
RelatedList,
|
|
19247
19600
|
{
|
|
19248
19601
|
resource: "PermissionPolicyTypePermissionObject",
|
|
@@ -19253,7 +19606,7 @@ var TypePermissionList = ({ masterId }) => {
|
|
|
19253
19606
|
modalTitle: "Type Permission",
|
|
19254
19607
|
FormFields: FormFieldsWrapper
|
|
19255
19608
|
},
|
|
19256
|
-
/* @__PURE__ */
|
|
19609
|
+
/* @__PURE__ */ React14.createElement(
|
|
19257
19610
|
Table6.Column,
|
|
19258
19611
|
{
|
|
19259
19612
|
dataIndex: "TargetType",
|
|
@@ -19261,10 +19614,10 @@ var TypePermissionList = ({ masterId }) => {
|
|
|
19261
19614
|
render: (value) => typeOptions.find((t) => t.value === value)?.label || value
|
|
19262
19615
|
}
|
|
19263
19616
|
),
|
|
19264
|
-
/* @__PURE__ */
|
|
19265
|
-
/* @__PURE__ */
|
|
19266
|
-
/* @__PURE__ */
|
|
19267
|
-
/* @__PURE__ */
|
|
19617
|
+
/* @__PURE__ */ React14.createElement(Table6.Column, { dataIndex: "ReadState", title: "Read" }),
|
|
19618
|
+
/* @__PURE__ */ React14.createElement(Table6.Column, { dataIndex: "WriteState", title: "Write" }),
|
|
19619
|
+
/* @__PURE__ */ React14.createElement(Table6.Column, { dataIndex: "CreateState", title: "Create" }),
|
|
19620
|
+
/* @__PURE__ */ React14.createElement(Table6.Column, { dataIndex: "DeleteState", title: "Delete" })
|
|
19268
19621
|
);
|
|
19269
19622
|
};
|
|
19270
19623
|
|
|
@@ -19275,7 +19628,7 @@ var RoleCreate = () => {
|
|
|
19275
19628
|
const handleSave = () => {
|
|
19276
19629
|
form.submit();
|
|
19277
19630
|
};
|
|
19278
|
-
return /* @__PURE__ */
|
|
19631
|
+
return /* @__PURE__ */ React15.createElement(Create2, { saveButtonProps: { ...saveButtonProps, onClick: handleSave } }, /* @__PURE__ */ React15.createElement(
|
|
19279
19632
|
Form9,
|
|
19280
19633
|
{
|
|
19281
19634
|
...formProps,
|
|
@@ -19285,25 +19638,25 @@ var RoleCreate = () => {
|
|
|
19285
19638
|
return formProps.onFinish && formProps.onFinish(values);
|
|
19286
19639
|
}
|
|
19287
19640
|
},
|
|
19288
|
-
/* @__PURE__ */
|
|
19641
|
+
/* @__PURE__ */ React15.createElement(
|
|
19289
19642
|
Form9.Item,
|
|
19290
19643
|
{
|
|
19291
19644
|
label: "Name",
|
|
19292
19645
|
name: "Name",
|
|
19293
19646
|
rules: [{ required: true }]
|
|
19294
19647
|
},
|
|
19295
|
-
/* @__PURE__ */
|
|
19648
|
+
/* @__PURE__ */ React15.createElement(Input8, null)
|
|
19296
19649
|
),
|
|
19297
|
-
/* @__PURE__ */
|
|
19650
|
+
/* @__PURE__ */ React15.createElement(
|
|
19298
19651
|
Form9.Item,
|
|
19299
19652
|
{
|
|
19300
19653
|
label: "Is Administrative",
|
|
19301
19654
|
name: "IsAdministrative",
|
|
19302
19655
|
valuePropName: "checked"
|
|
19303
19656
|
},
|
|
19304
|
-
/* @__PURE__ */
|
|
19657
|
+
/* @__PURE__ */ React15.createElement(Checkbox7, null, "Is Administrative")
|
|
19305
19658
|
),
|
|
19306
|
-
/* @__PURE__ */
|
|
19659
|
+
/* @__PURE__ */ React15.createElement(
|
|
19307
19660
|
Form9.Item,
|
|
19308
19661
|
{
|
|
19309
19662
|
label: "Permission Policy",
|
|
@@ -19311,7 +19664,7 @@ var RoleCreate = () => {
|
|
|
19311
19664
|
initialValue: "DenyAllByDefault" /* DenyAllByDefault */,
|
|
19312
19665
|
rules: [{ required: true }]
|
|
19313
19666
|
},
|
|
19314
|
-
/* @__PURE__ */
|
|
19667
|
+
/* @__PURE__ */ React15.createElement(
|
|
19315
19668
|
Select3,
|
|
19316
19669
|
{
|
|
19317
19670
|
options: [
|
|
@@ -19322,12 +19675,12 @@ var RoleCreate = () => {
|
|
|
19322
19675
|
}
|
|
19323
19676
|
)
|
|
19324
19677
|
),
|
|
19325
|
-
/* @__PURE__ */
|
|
19678
|
+
/* @__PURE__ */ React15.createElement(TypePermissionList, null)
|
|
19326
19679
|
));
|
|
19327
19680
|
};
|
|
19328
19681
|
|
|
19329
19682
|
// src/pages/roles/edit.tsx
|
|
19330
|
-
import
|
|
19683
|
+
import React16 from "react";
|
|
19331
19684
|
import { Edit as Edit2, useForm as useForm4 } from "@refinedev/antd";
|
|
19332
19685
|
import { Form as Form10, Input as Input9, Checkbox as Checkbox8, Select as Select4 } from "antd/lib";
|
|
19333
19686
|
var RoleEdit = () => {
|
|
@@ -19335,7 +19688,7 @@ var RoleEdit = () => {
|
|
|
19335
19688
|
const handleSave = () => {
|
|
19336
19689
|
formProps.form?.submit();
|
|
19337
19690
|
};
|
|
19338
|
-
return /* @__PURE__ */
|
|
19691
|
+
return /* @__PURE__ */ React16.createElement(Edit2, { saveButtonProps: { ...saveButtonProps, onClick: handleSave } }, /* @__PURE__ */ React16.createElement(
|
|
19339
19692
|
Form10,
|
|
19340
19693
|
{
|
|
19341
19694
|
...formProps,
|
|
@@ -19345,32 +19698,32 @@ var RoleEdit = () => {
|
|
|
19345
19698
|
return formProps.onFinish && formProps.onFinish(rest);
|
|
19346
19699
|
}
|
|
19347
19700
|
},
|
|
19348
|
-
/* @__PURE__ */
|
|
19701
|
+
/* @__PURE__ */ React16.createElement(
|
|
19349
19702
|
Form10.Item,
|
|
19350
19703
|
{
|
|
19351
19704
|
label: "Name",
|
|
19352
19705
|
name: "Name",
|
|
19353
19706
|
rules: [{ required: true }]
|
|
19354
19707
|
},
|
|
19355
|
-
/* @__PURE__ */
|
|
19708
|
+
/* @__PURE__ */ React16.createElement(Input9, null)
|
|
19356
19709
|
),
|
|
19357
|
-
/* @__PURE__ */
|
|
19710
|
+
/* @__PURE__ */ React16.createElement(
|
|
19358
19711
|
Form10.Item,
|
|
19359
19712
|
{
|
|
19360
19713
|
label: "Is Administrative",
|
|
19361
19714
|
name: "IsAdministrative",
|
|
19362
19715
|
valuePropName: "checked"
|
|
19363
19716
|
},
|
|
19364
|
-
/* @__PURE__ */
|
|
19717
|
+
/* @__PURE__ */ React16.createElement(Checkbox8, null, "Is Administrative")
|
|
19365
19718
|
),
|
|
19366
|
-
/* @__PURE__ */
|
|
19719
|
+
/* @__PURE__ */ React16.createElement(
|
|
19367
19720
|
Form10.Item,
|
|
19368
19721
|
{
|
|
19369
19722
|
label: "Permission Policy",
|
|
19370
19723
|
name: "PermissionPolicy",
|
|
19371
19724
|
rules: [{ required: true }]
|
|
19372
19725
|
},
|
|
19373
|
-
/* @__PURE__ */
|
|
19726
|
+
/* @__PURE__ */ React16.createElement(
|
|
19374
19727
|
Select4,
|
|
19375
19728
|
{
|
|
19376
19729
|
options: [
|
|
@@ -19381,7 +19734,7 @@ var RoleEdit = () => {
|
|
|
19381
19734
|
}
|
|
19382
19735
|
)
|
|
19383
19736
|
),
|
|
19384
|
-
/* @__PURE__ */
|
|
19737
|
+
/* @__PURE__ */ React16.createElement(
|
|
19385
19738
|
TypePermissionList,
|
|
19386
19739
|
{
|
|
19387
19740
|
masterId: id?.toString()
|
|
@@ -19393,11 +19746,13 @@ export {
|
|
|
19393
19746
|
ApplicationUserCreate,
|
|
19394
19747
|
ApplicationUserEdit,
|
|
19395
19748
|
ApplicationUserList,
|
|
19749
|
+
AuthCallback,
|
|
19396
19750
|
Base64Upload,
|
|
19397
19751
|
ColorModeContext,
|
|
19398
19752
|
ColorModeContextProvider,
|
|
19399
19753
|
Header,
|
|
19400
19754
|
HttpError,
|
|
19755
|
+
KeycloakLoginPage,
|
|
19401
19756
|
LoginPage,
|
|
19402
19757
|
RelatedList,
|
|
19403
19758
|
RoleCreate,
|
|
@@ -19411,9 +19766,12 @@ export {
|
|
|
19411
19766
|
authProvider,
|
|
19412
19767
|
authService,
|
|
19413
19768
|
dataProvider,
|
|
19769
|
+
generatePassword,
|
|
19414
19770
|
getBaseUrl,
|
|
19415
19771
|
httpClient,
|
|
19772
|
+
keycloakService,
|
|
19416
19773
|
parseJwt,
|
|
19417
19774
|
useColorMode,
|
|
19418
|
-
useModelTypes
|
|
19775
|
+
useModelTypes,
|
|
19776
|
+
validatePasswordStrength
|
|
19419
19777
|
};
|