Skip to content

Commit 9b5f244

Browse files
authored
Merge pull request #33 from gregPerlinLi/dev
Update Project Version, Fix Certificate Validity, and Enhance OIDC Support
2 parents 6e31351 + 596335f commit 9b5f244

File tree

19 files changed

+178
-91
lines changed

19 files changed

+178
-91
lines changed

frontend/auto-imports.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,6 @@ declare global {
297297
// for type re-export
298298
declare global {
299299
// @ts-ignore
300-
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
300+
export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
301301
import('vue')
302302
}

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"format": "prettier --write ."
1212
},
1313
"dependencies": {
14-
"@vueuse/core": "^13.0.0",
14+
"@vueuse/core": "^13.1.0",
1515
"nanoid": "^5.1.5",
1616
"primeicons": "^7.0.0",
1717
"primevue": "^4.3.3",
@@ -21,7 +21,7 @@
2121
"vue-router": "^4.5.0"
2222
},
2323
"devDependencies": {
24-
"@primeuix/themes": "^1.0.1",
24+
"@primeuix/themes": "^1.0.2",
2525
"@primevue/auto-import-resolver": "^4.3.3",
2626
"@tailwindcss/vite": "^4.1.3",
2727
"@vitejs/plugin-vue": "^5.2.3",

frontend/pnpm-lock.yaml

Lines changed: 40 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
1+
import type { PaginationVO, UserProfileDTO } from "@/api/types";
12
import { callRestfulApi } from "@/api";
23

4+
export const getAllCaBindedUsrs = (
5+
uuid: string,
6+
page: number,
7+
limit: number,
8+
keyword?: string
9+
) =>
10+
callRestfulApi<PaginationVO<UserProfileDTO>>({
11+
method: "GET",
12+
baseUrl: "/api/v1/admin/cert/ca/{uuid}/bind",
13+
pathNames: { uuid },
14+
searchParams: { page, limit, keyword }
15+
});
16+
317
export const bindCaToUsrs = (caUuid: string, usernames: string[]) =>
418
callRestfulApi({
519
method: "POST",

frontend/src/api/admin/stats.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,10 @@ export const countCaRequestedCerts = (uuid: string, caOrSsl: boolean) =>
1616
pathNames: { uuid },
1717
searchParams: { caOrSsl }
1818
});
19+
20+
export const countAllUsrs = (role: 1 | 2 | 3 | 0 = 0) =>
21+
callRestfulApi<number>({
22+
method: "GET",
23+
baseUrl: "/api/v1/superadmin/user/count",
24+
searchParams: { role }
25+
});

frontend/src/api/authentication/oauth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ export const getOidcProvider = () =>
77
});
88

99
export const oidcLogin = async () => {
10-
await fetch("/api/v1/auth/oauth/login");
10+
window.open("/api/v1/auth/oauth/login", "_self", "noopener=true");
1111
};

frontend/src/api/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import type { ResultVO } from "@/api/types";
22
import { useUserStore } from "@/stores/user";
33
import router from "@/router";
44

5+
let noTimeout = false;
6+
export const setNoTimeout = (b: boolean) => (noTimeout = b);
7+
58
export const createURLSearchParams = (
69
params: Record<string, any>
710
): URLSearchParams => {
@@ -35,7 +38,7 @@ export const callRestfulApi = async <U = null>(
3538
? { "Content-Type": "application/json" }
3639
: undefined,
3740
body: opts.payload !== undefined ? JSON.stringify(opts.payload) : undefined,
38-
signal: AbortSignal.timeout(10000)
41+
signal: noTimeout ? undefined : AbortSignal.timeout(10000)
3942
} satisfies RequestInit;
4043

4144
const resp = await fetch(uri, req);

frontend/src/api/superadmin/stats.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,3 @@ export const countAllSslCerts = () =>
1414
method: "GET",
1515
baseUrl: "/api/v1/superadmin/cert/ssl/count"
1616
});
17-
18-
export const countAllUsrs = (role: 1 | 2 | 3 | 0 = 0) =>
19-
callRestfulApi<number>({
20-
method: "GET",
21-
baseUrl: "/api/v1/superadmin/user/count",
22-
searchParams: { role }
23-
});

frontend/src/stores/user.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { UpdateProfileRequestPayload } from "@/api/user/user";
22
import type { ToastServiceMethods } from "primevue";
3+
import { setNoTimeout } from "@/api";
34
import { login, logout } from "@/api/authentication";
5+
import { getOidcProvider } from "@/api/authentication/oauth";
46
import { getProfile, updateProfile } from "@/api/user/user";
57

68
// Type
@@ -10,6 +12,7 @@ export type Role = "User" | "Admin" | "Superadmin";
1012
export const useUserStore = createGlobalState(() => {
1113
// States
1214
const initialized = ref(false);
15+
const oidcProvider = ref<string | null>(null);
1316
const signedIn = ref(false);
1417
const username = ref<string | null>(null);
1518
const displayName = ref<string | null>(null);
@@ -43,8 +46,21 @@ export const useUserStore = createGlobalState(() => {
4346
return;
4447
}
4548

49+
setNoTimeout(true);
50+
try {
51+
oidcProvider.value = await getOidcProvider();
52+
} catch (err: unknown) {
53+
toast?.add({
54+
severity: "error",
55+
summary: "Failed to Get OIDC Provider",
56+
detail: (err as Error).message,
57+
life: 5000
58+
});
59+
}
60+
4661
const err = await syncFromRemote();
4762
initialized.value = true;
63+
setNoTimeout(false);
4864
if (err !== null) {
4965
toast?.add({
5066
severity: "error",
@@ -170,6 +186,7 @@ export const useUserStore = createGlobalState(() => {
170186
// Returns
171187
return {
172188
initialized,
189+
oidcProvider,
173190
signedIn,
174191
username,
175192
displayName,

0 commit comments

Comments
 (0)