@cartanova/qgrid-cli 2.11.0 → 2.11.1
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/bundle/web-dist/client/assets/index-C96h3feE.js +32 -0
- package/bundle/web-dist/client/assets/logs-DBM6U0QD.js +1 -0
- package/bundle/web-dist/client/assets/monit-BBjXa7vB.js +1 -0
- package/bundle/web-dist/client/assets/plus-BsQdY7PS.js +1 -0
- package/bundle/web-dist/client/assets/refresh-cw-D9IUmT23.js +1 -0
- package/bundle/web-dist/client/assets/request-model-Bpp_rkK8.js +1 -0
- package/bundle/web-dist/client/assets/routes-Crz_PQzi.js +5 -0
- package/bundle/web-dist/client/assets/{services.generated-CefiDXEv.js → services.generated-B5lc3aIC.js} +1 -1
- package/bundle/web-dist/client/assets/settings-Cdwm3OBB.js +1 -0
- package/bundle/web-dist/client/assets/show-DBUhALT1.js +2 -0
- package/bundle/web-dist/client/assets/tokens-CVQAVJTo.js +1 -0
- package/bundle/web-dist/client/assets/use-oauth-login-flow-BfxYI4Oh.js +1 -0
- package/bundle/web-dist/client/assets/use-update-token-mutation-qKBC2sn7.js +1 -0
- package/bundle/web-dist/client/assets/vendor-react-DH4kUfK2.js +9 -0
- package/bundle/web-dist/client/assets/vendor-tanstack-DRPs09ai.js +1 -0
- package/bundle/web-dist/client/index.html +4 -4
- package/bundle/web-dist/server/assets/{lazyRouteComponent-D8iTIHyn.js → lazyRouteComponent-AKiHfZWp.js} +2 -2
- package/bundle/web-dist/server/assets/logs-B7QmGJq3.js +513 -0
- package/bundle/web-dist/server/assets/{monit-B2hqorPe.js → monit-DFt7x3bh.js} +117 -375
- package/bundle/web-dist/server/assets/plus-DaYQRpBt.js +19 -0
- package/bundle/web-dist/server/assets/{react-dom-BIYQzBqG.js → react-dom-Cv23mm1K.js} +1 -1
- package/bundle/web-dist/server/assets/refresh-cw-BpXNsAy-.js +23 -0
- package/bundle/web-dist/server/assets/{request-model-I6OdODSH.js → request-model-eHE6YbaF.js} +6 -15
- package/bundle/web-dist/server/assets/{routes-B95YlUv2.js → routes-_Y-PJfgO.js} +203 -679
- package/bundle/web-dist/server/assets/{services.generated-DQATJ6qf.js → services.generated-CMJ8AHbO.js} +3796 -4012
- package/bundle/web-dist/server/assets/settings-JwJKxn2e.js +461 -0
- package/bundle/web-dist/server/assets/{show-Bxaj3rhH.js → show-BEv6z1v_.js} +368 -1270
- package/bundle/web-dist/server/assets/tokens-CNT4mI-f.js +560 -0
- package/bundle/web-dist/server/assets/{use-oauth-login-flow-CKDHgc3U.js → use-oauth-login-flow-jkAkT3X6.js} +16 -50
- package/bundle/web-dist/server/assets/{use-update-token-mutation-BEbgOzaa.js → use-update-token-mutation-Sm6kh02m.js} +1 -1
- package/bundle/web-dist/server/entry-server.generated.js +1130 -2626
- package/package.json +1 -1
- package/bundle/web-dist/client/assets/index-BA7uQ-6c.js +0 -31
- package/bundle/web-dist/client/assets/logs-C47OJGEI.js +0 -1
- package/bundle/web-dist/client/assets/monit-BS9no0dU.js +0 -4
- package/bundle/web-dist/client/assets/plus-sdACTfH0.js +0 -1
- package/bundle/web-dist/client/assets/refresh-cw-CY8o_1cT.js +0 -1
- package/bundle/web-dist/client/assets/request-model-BRtFuZvj.js +0 -1
- package/bundle/web-dist/client/assets/routes-kqgkUxE8.js +0 -5
- package/bundle/web-dist/client/assets/settings-DNDvFGSw.js +0 -1
- package/bundle/web-dist/client/assets/show-u8Np69q3.js +0 -2
- package/bundle/web-dist/client/assets/tokens-QvP410NW.js +0 -1
- package/bundle/web-dist/client/assets/use-oauth-login-flow-Bzdh28Ws.js +0 -1
- package/bundle/web-dist/client/assets/use-update-token-mutation-CfJKaxmR.js +0 -1
- package/bundle/web-dist/client/assets/vendor-react-CUFFrVN9.js +0 -244
- package/bundle/web-dist/client/assets/vendor-tanstack-Bf_jag9G.js +0 -1
- package/bundle/web-dist/server/assets/logs-B3OTd9hy.js +0 -825
- package/bundle/web-dist/server/assets/plus-DwG7h9kq.js +0 -28
- package/bundle/web-dist/server/assets/refresh-cw-mMBkwOq0.js +0 -44
- package/bundle/web-dist/server/assets/settings-C3gbGk0m.js +0 -830
- package/bundle/web-dist/server/assets/tokens-CZjH3cB7.js +0 -1038
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
import { $ as __toESM, M as require_jsx_runtime, N as require_react, a as SettingService, j as useQueryClient, o as TokenService } from "./services.generated-CMJ8AHbO.js";
|
|
2
|
+
import { s as lucideRotateCcw } from "../entry-server.generated.js";
|
|
3
|
+
import { t as useUpdateTokenMutation } from "./use-update-token-mutation-Sm6kh02m.js";
|
|
4
|
+
import { t as lucidePlus } from "./plus-DaYQRpBt.js";
|
|
5
|
+
//#region ~icons/lucide/eye.jsx
|
|
6
|
+
var import_react = /* @__PURE__ */ __toESM(require_react());
|
|
7
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
8
|
+
var lucideEye = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
width: "1.2em",
|
|
11
|
+
height: "1.2em",
|
|
12
|
+
...props,
|
|
13
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
14
|
+
fill: "none",
|
|
15
|
+
stroke: "currentColor",
|
|
16
|
+
strokeLinecap: "round",
|
|
17
|
+
strokeLinejoin: "round",
|
|
18
|
+
strokeWidth: 2,
|
|
19
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", {
|
|
20
|
+
cx: 12,
|
|
21
|
+
cy: 12,
|
|
22
|
+
r: 3
|
|
23
|
+
})]
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region ~icons/lucide/eye-off.jsx
|
|
28
|
+
var lucideEyeOff = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
|
|
29
|
+
viewBox: "0 0 24 24",
|
|
30
|
+
width: "1.2em",
|
|
31
|
+
height: "1.2em",
|
|
32
|
+
...props,
|
|
33
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
34
|
+
fill: "none",
|
|
35
|
+
stroke: "currentColor",
|
|
36
|
+
strokeLinecap: "round",
|
|
37
|
+
strokeLinejoin: "round",
|
|
38
|
+
strokeWidth: 2,
|
|
39
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575a1 1 0 0 1 0 .696a10.8 10.8 0 0 1-1.444 2.49m-6.41-.679a3 3 0 0 1-4.242-4.242" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 4.446-5.143M2 2l20 20" })]
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region ~icons/lucide/minus.jsx
|
|
44
|
+
var lucideMinus = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
|
|
45
|
+
viewBox: "0 0 24 24",
|
|
46
|
+
width: "1.2em",
|
|
47
|
+
height: "1.2em",
|
|
48
|
+
...props,
|
|
49
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
|
|
50
|
+
fill: "none",
|
|
51
|
+
stroke: "currentColor",
|
|
52
|
+
strokeLinecap: "round",
|
|
53
|
+
strokeLinejoin: "round",
|
|
54
|
+
strokeWidth: 2,
|
|
55
|
+
d: "M5 12h14"
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/components/qgrid/SettingsPanel.tsx
|
|
60
|
+
var GROUP_LABELS = new Map([
|
|
61
|
+
["qgrid", "Qgrid"],
|
|
62
|
+
["slack", "Slack 알림"],
|
|
63
|
+
["slackConnection", "Slack 연결"]
|
|
64
|
+
]);
|
|
65
|
+
function maskValue(value) {
|
|
66
|
+
if (!value) return "";
|
|
67
|
+
if (value.length <= 12) return "•".repeat(value.length);
|
|
68
|
+
return `${value.slice(0, 8)}${"•".repeat(12)}${value.slice(-4)}`;
|
|
69
|
+
}
|
|
70
|
+
/** 정수·실수는 타이핑보다 증감이 빠르다. 범위도 버튼이 알아서 지킨다. */
|
|
71
|
+
function Stepper({ value, min, max, step, disabled, onChange }) {
|
|
72
|
+
const current = Number(value);
|
|
73
|
+
const valid = Number.isFinite(current);
|
|
74
|
+
const lower = min ?? Number.NEGATIVE_INFINITY;
|
|
75
|
+
const upper = max ?? Number.POSITIVE_INFINITY;
|
|
76
|
+
const adjust = (delta) => {
|
|
77
|
+
const next = Math.min(Math.max((valid ? current : min ?? 0) + delta, lower), upper);
|
|
78
|
+
onChange(String(Number(next.toFixed(2))));
|
|
79
|
+
};
|
|
80
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
81
|
+
className: "inline-flex items-center rounded-lg border border-sand-200/80 bg-white overflow-hidden",
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
84
|
+
type: "button",
|
|
85
|
+
"aria-label": "감소",
|
|
86
|
+
onClick: () => adjust(-step),
|
|
87
|
+
disabled: disabled || valid && current <= lower,
|
|
88
|
+
className: "size-7 grid place-items-center text-sand-500 hover:bg-sand-100 disabled:opacity-30 disabled:hover:bg-transparent transition-colors duration-150",
|
|
89
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(lucideMinus, { className: "size-3" })
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
92
|
+
value,
|
|
93
|
+
onChange: (e) => onChange(e.target.value),
|
|
94
|
+
disabled,
|
|
95
|
+
inputMode: "decimal",
|
|
96
|
+
className: "w-12 text-center text-[12px] tabular-nums text-sand-800 bg-transparent border-x border-sand-200/80 py-1 focus:outline-none focus:bg-sand-50"
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
99
|
+
type: "button",
|
|
100
|
+
"aria-label": "증가",
|
|
101
|
+
onClick: () => adjust(step),
|
|
102
|
+
disabled: disabled || valid && current >= upper,
|
|
103
|
+
className: "size-7 grid place-items-center text-sand-500 hover:bg-sand-100 disabled:opacity-30 disabled:hover:bg-transparent transition-colors duration-150",
|
|
104
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(lucidePlus, { className: "size-3" })
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/** 고정 선택지. 자유 입력보다 고르는 편이 빠르고, 범위를 벗어난 값이 생기지 않는다. */
|
|
110
|
+
function PresetGroup({ value, presets, disabled, onChange }) {
|
|
111
|
+
const current = Number(value);
|
|
112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
113
|
+
className: "segmented-control inline-flex",
|
|
114
|
+
children: presets.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
115
|
+
type: "button",
|
|
116
|
+
disabled,
|
|
117
|
+
"data-active": current === preset,
|
|
118
|
+
onClick: () => onChange(String(preset)),
|
|
119
|
+
className: "rounded-[6px] px-2.5 py-1 text-[11px] font-medium tabular-nums text-sand-500 transition-colors hover:text-sand-800 disabled:opacity-50 data-[active=true]:text-sand-900",
|
|
120
|
+
children: preset >= 60 ? `${preset / 60}시간` : `${preset}분`
|
|
121
|
+
}, preset))
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/** 값이 어디서 왔는지. 되돌림 버튼이 무엇을 지우는지 이 배지가 설명한다. */
|
|
125
|
+
function SourceBadge({ source }) {
|
|
126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
127
|
+
className: `text-[10px] px-1.5 py-0.5 rounded ${source === "db" ? "bg-sienna-50 text-sienna-600" : "bg-sand-100 text-sand-500"}`,
|
|
128
|
+
children: source === "db" ? "저장값" : source === "env" ? "환경변수" : "기본값"
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function Toggle({ on, disabled, onChange }) {
|
|
132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
133
|
+
type: "button",
|
|
134
|
+
role: "switch",
|
|
135
|
+
"aria-checked": on,
|
|
136
|
+
disabled,
|
|
137
|
+
onClick: () => onChange(!on),
|
|
138
|
+
className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors duration-200 disabled:opacity-50 ${on ? "bg-sage-400" : "bg-sand-300"}`,
|
|
139
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform duration-200 ${on ? "translate-x-4.5" : "translate-x-0.5"}` })
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function SettingRow({ item, disabled = false }) {
|
|
143
|
+
const [draft, setDraft] = (0, import_react.useState)(null);
|
|
144
|
+
const [revealed, setRevealed] = (0, import_react.useState)(false);
|
|
145
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
146
|
+
const queryClient = useQueryClient();
|
|
147
|
+
const updateMutation = SettingService.useUpdateSettingMutation();
|
|
148
|
+
const resetMutation = SettingService.useResetSettingMutation();
|
|
149
|
+
const pending = disabled || updateMutation.isPending || resetMutation.isPending;
|
|
150
|
+
const value = draft ?? item.value;
|
|
151
|
+
const dirty = draft !== null && draft !== item.value;
|
|
152
|
+
const invalidate = () => queryClient.invalidateQueries({ queryKey: SettingService.getSettingListQueryOptions().queryKey });
|
|
153
|
+
const commit = async (next) => {
|
|
154
|
+
setError(null);
|
|
155
|
+
try {
|
|
156
|
+
await updateMutation.mutateAsync({
|
|
157
|
+
key: item.key,
|
|
158
|
+
value: next
|
|
159
|
+
});
|
|
160
|
+
await invalidate();
|
|
161
|
+
setDraft(null);
|
|
162
|
+
} catch (e) {
|
|
163
|
+
setError(e instanceof Error ? e.message : String(e));
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const reset = async () => {
|
|
167
|
+
setError(null);
|
|
168
|
+
try {
|
|
169
|
+
await resetMutation.mutateAsync({ key: item.key });
|
|
170
|
+
await invalidate();
|
|
171
|
+
setDraft(null);
|
|
172
|
+
} catch (e) {
|
|
173
|
+
setError(e instanceof Error ? e.message : String(e));
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
const isSecret = item.kind === "secret";
|
|
177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
178
|
+
className: "px-4 py-3 sm:px-5",
|
|
179
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
180
|
+
className: "flex items-start gap-4",
|
|
181
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
182
|
+
className: "min-w-0 flex-1",
|
|
183
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
184
|
+
className: "flex items-center gap-2",
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
187
|
+
className: "text-[13px] text-sand-800",
|
|
188
|
+
children: item.label
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SourceBadge, { source: item.source }),
|
|
191
|
+
item.applies === "restart" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
192
|
+
className: "text-[10px] text-caution-500",
|
|
193
|
+
title: "저장해도 다음 재시작부터 반영됩니다",
|
|
194
|
+
children: "재시작 필요"
|
|
195
|
+
})
|
|
196
|
+
]
|
|
197
|
+
}), item.help && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
198
|
+
className: "mt-0.5 text-[11px] text-sand-500",
|
|
199
|
+
children: item.help
|
|
200
|
+
})]
|
|
201
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
202
|
+
className: "flex items-center gap-1.5 shrink-0",
|
|
203
|
+
children: [
|
|
204
|
+
item.kind === "boolean" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toggle, {
|
|
205
|
+
on: value === "true",
|
|
206
|
+
disabled: pending,
|
|
207
|
+
onChange: (next) => void commit(String(next))
|
|
208
|
+
}),
|
|
209
|
+
item.kind === "preset" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PresetGroup, {
|
|
210
|
+
value,
|
|
211
|
+
presets: item.presets,
|
|
212
|
+
disabled: pending,
|
|
213
|
+
onChange: (next) => void commit(next)
|
|
214
|
+
}),
|
|
215
|
+
(item.kind === "integer" || item.kind === "number") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Stepper, {
|
|
216
|
+
value,
|
|
217
|
+
min: item.min,
|
|
218
|
+
max: item.max,
|
|
219
|
+
step: item.kind === "integer" ? 1 : .5,
|
|
220
|
+
disabled: pending,
|
|
221
|
+
onChange: setDraft
|
|
222
|
+
}),
|
|
223
|
+
(item.kind === "string" || isSecret) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
224
|
+
className: "relative",
|
|
225
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
226
|
+
value: isSecret && !revealed ? maskValue(value) : value,
|
|
227
|
+
onChange: (e) => setDraft(e.target.value),
|
|
228
|
+
onFocus: () => isSecret && setRevealed(true),
|
|
229
|
+
disabled: pending,
|
|
230
|
+
className: `w-48 sm:w-64 rounded-lg border border-sand-200/80 bg-white py-1.5 pl-2.5 text-[12px] text-sand-800 focus:outline-none focus:border-sienna-300 ${isSecret ? "pr-8 font-mono" : "pr-2.5"}`
|
|
231
|
+
}), isSecret && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
232
|
+
type: "button",
|
|
233
|
+
"aria-label": revealed ? "값 숨기기" : "값 보기",
|
|
234
|
+
onClick: () => setRevealed((r) => !r),
|
|
235
|
+
className: "absolute right-1.5 top-1/2 -translate-y-1/2 size-6 grid place-items-center text-sand-400 hover:text-sand-600 transition-colors duration-150",
|
|
236
|
+
children: revealed ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(lucideEyeOff, { className: "size-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(lucideEye, { className: "size-3.5" })
|
|
237
|
+
})]
|
|
238
|
+
}),
|
|
239
|
+
dirty && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
240
|
+
type: "button",
|
|
241
|
+
onClick: () => void commit(value),
|
|
242
|
+
disabled: pending,
|
|
243
|
+
className: "px-2.5 py-1.5 text-[11px] font-medium rounded-lg bg-sienna-400 text-white hover:bg-sienna-500 disabled:opacity-50 transition-colors duration-150",
|
|
244
|
+
children: updateMutation.isPending ? "저장 중" : "저장"
|
|
245
|
+
}),
|
|
246
|
+
!dirty && item.source === "db" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
247
|
+
type: "button",
|
|
248
|
+
title: "저장값을 지웁니다 — 환경변수 또는 기본값으로 돌아갑니다",
|
|
249
|
+
onClick: () => void reset(),
|
|
250
|
+
disabled: pending,
|
|
251
|
+
className: "size-7 grid place-items-center rounded-lg text-sand-400 hover:text-sand-600 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150",
|
|
252
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(lucideRotateCcw, { className: "size-3.5" })
|
|
253
|
+
})
|
|
254
|
+
]
|
|
255
|
+
})]
|
|
256
|
+
}), error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
257
|
+
className: "mt-1.5 text-[11px] text-red-500",
|
|
258
|
+
children: error
|
|
259
|
+
})]
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
function KeepaliveTokenSettings({ runnerEnabled }) {
|
|
263
|
+
const queryClient = useQueryClient();
|
|
264
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
265
|
+
const tokensQuery = TokenService.useTokens("A", {
|
|
266
|
+
orderBy: "ord-asc",
|
|
267
|
+
num: 100
|
|
268
|
+
});
|
|
269
|
+
const updateMutation = useUpdateTokenMutation();
|
|
270
|
+
const anthropicTokens = (tokensQuery.data?.rows ?? []).filter((token) => token.provider === "anthropic");
|
|
271
|
+
const toggle = async (id, keepaliveEnabled) => {
|
|
272
|
+
setError(null);
|
|
273
|
+
try {
|
|
274
|
+
await updateMutation.mutateAsync({
|
|
275
|
+
id,
|
|
276
|
+
keepaliveEnabled
|
|
277
|
+
});
|
|
278
|
+
await queryClient.invalidateQueries({ queryKey: ["Token", "getTokens"] });
|
|
279
|
+
} catch (cause) {
|
|
280
|
+
setError(cause instanceof Error ? cause.message : String(cause));
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
284
|
+
className: "border-t border-sand-100/80 bg-sand-50/40 px-4 py-3 sm:px-5",
|
|
285
|
+
children: [
|
|
286
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
287
|
+
className: "mb-2 flex items-center justify-between gap-3",
|
|
288
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
289
|
+
className: "text-[11px] font-medium text-sand-600",
|
|
290
|
+
children: "토큰별 keepalive"
|
|
291
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
292
|
+
className: "mt-0.5 text-[10px] text-sand-400",
|
|
293
|
+
children: runnerEnabled ? "켜진 활성 Anthropic 토큰만 5시간 윈도우를 유지합니다" : "이 인스턴스는 keepalive runner로 지정되지 않았습니다"
|
|
294
|
+
})] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
295
|
+
className: `shrink-0 rounded px-1.5 py-0.5 text-[10px] ${runnerEnabled ? "bg-sage-50 text-sage-600" : "bg-sand-100 text-sand-500"}`,
|
|
296
|
+
children: runnerEnabled ? "runner" : "실행 안 함"
|
|
297
|
+
})]
|
|
298
|
+
}),
|
|
299
|
+
tokensQuery.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
300
|
+
className: "py-2 text-[11px] text-sand-400",
|
|
301
|
+
children: "토큰을 불러오는 중…"
|
|
302
|
+
}) : anthropicTokens.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
303
|
+
className: "py-2 text-[11px] text-sand-400",
|
|
304
|
+
children: "등록된 Anthropic 토큰이 없습니다"
|
|
305
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
306
|
+
className: "overflow-hidden rounded-lg border border-sand-200/70 bg-white",
|
|
307
|
+
children: anthropicTokens.map((token) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
308
|
+
className: "flex items-center justify-between gap-4 border-b border-sand-100/80 px-3 py-2 last:border-b-0",
|
|
309
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
310
|
+
className: "min-w-0",
|
|
311
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
312
|
+
className: "block truncate text-[12px] text-sand-700",
|
|
313
|
+
children: token.name
|
|
314
|
+
}), !token.active && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
315
|
+
className: "text-[10px] text-sand-400",
|
|
316
|
+
children: "토큰 비활성"
|
|
317
|
+
})]
|
|
318
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toggle, {
|
|
319
|
+
on: token.keepalive_enabled,
|
|
320
|
+
disabled: !runnerEnabled || updateMutation.isPending,
|
|
321
|
+
onChange: (next) => void toggle(token.id, next)
|
|
322
|
+
})]
|
|
323
|
+
}, token.id))
|
|
324
|
+
}),
|
|
325
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
326
|
+
className: "mt-2 text-[11px] text-red-500",
|
|
327
|
+
children: error
|
|
328
|
+
})
|
|
329
|
+
]
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
/** 만료 알림을 주기를 기다리지 않고 지금 보낸다. 설정이 제대로 붙었는지 확인하는 용도. */
|
|
333
|
+
function TriggerReminderButton() {
|
|
334
|
+
const [result, setResult] = (0, import_react.useState)(null);
|
|
335
|
+
const mutation = SettingService.useTriggerExpiryReminderMutation();
|
|
336
|
+
const trigger = async () => {
|
|
337
|
+
setResult(null);
|
|
338
|
+
try {
|
|
339
|
+
const { sent } = await mutation.mutateAsync();
|
|
340
|
+
setResult(sent === 0 ? "재로그인이 필요한 토큰이 없습니다" : `${sent}건 발송`);
|
|
341
|
+
} catch (e) {
|
|
342
|
+
setResult(e instanceof Error ? e.message : String(e));
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
346
|
+
className: "flex items-center gap-2",
|
|
347
|
+
children: [result && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
348
|
+
className: "text-[11px] text-sand-500",
|
|
349
|
+
children: result
|
|
350
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
351
|
+
type: "button",
|
|
352
|
+
onClick: () => void trigger(),
|
|
353
|
+
disabled: mutation.isPending,
|
|
354
|
+
className: "px-2 py-1 text-[11px] rounded-lg border border-sand-200/80 text-sand-600 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150",
|
|
355
|
+
children: mutation.isPending ? "보내는 중" : "지금 보내기"
|
|
356
|
+
})]
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function SettingsPanel() {
|
|
360
|
+
const settingsQuery = SettingService.useSettingList();
|
|
361
|
+
const { data, isLoading } = settingsQuery;
|
|
362
|
+
if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
363
|
+
className: "space-y-4",
|
|
364
|
+
children: [0, 1].map((i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
365
|
+
className: "panel overflow-hidden",
|
|
366
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
367
|
+
className: "panel-header px-4 py-2.5 sm:px-5",
|
|
368
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-3 w-24 rounded bg-sand-200 animate-pulse" })
|
|
369
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
370
|
+
className: "divide-y divide-sand-100/80",
|
|
371
|
+
children: [
|
|
372
|
+
0,
|
|
373
|
+
1,
|
|
374
|
+
2
|
|
375
|
+
].map((j) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
376
|
+
className: "px-4 py-3 sm:px-5 flex items-center justify-between gap-4",
|
|
377
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-3 w-40 rounded bg-sand-100 animate-pulse" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-7 w-24 rounded-lg bg-sand-100 animate-pulse" })]
|
|
378
|
+
}, j))
|
|
379
|
+
})]
|
|
380
|
+
}, i))
|
|
381
|
+
});
|
|
382
|
+
if (settingsQuery.isError && !data) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
383
|
+
className: "panel px-5 py-6 text-center",
|
|
384
|
+
children: [
|
|
385
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
386
|
+
className: "text-[13px] font-medium text-sand-800",
|
|
387
|
+
children: "설정을 불러오지 못했습니다"
|
|
388
|
+
}),
|
|
389
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
390
|
+
className: "mt-1 text-[11px] text-red-500",
|
|
391
|
+
children: settingsQuery.error.message
|
|
392
|
+
}),
|
|
393
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
394
|
+
type: "button",
|
|
395
|
+
onClick: () => void settingsQuery.refetch(),
|
|
396
|
+
disabled: settingsQuery.isFetching,
|
|
397
|
+
className: "mt-3 px-3 py-1.5 text-[12px] rounded-lg border border-sand-200 text-sand-600 hover:bg-sand-100 disabled:opacity-50",
|
|
398
|
+
children: settingsQuery.isFetching ? "다시 불러오는 중" : "다시 시도"
|
|
399
|
+
})
|
|
400
|
+
]
|
|
401
|
+
});
|
|
402
|
+
const settings = data?.settings ?? [];
|
|
403
|
+
const runtime = data?.runtime ?? [];
|
|
404
|
+
const groups = [...new Set(settings.map((s) => s.group))];
|
|
405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
406
|
+
className: "space-y-4",
|
|
407
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
408
|
+
className: "panel overflow-hidden",
|
|
409
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
410
|
+
className: "panel-header flex items-center justify-between px-4 py-2.5 sm:px-5",
|
|
411
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
412
|
+
className: "text-[13px] font-medium text-sand-700",
|
|
413
|
+
children: "환경"
|
|
414
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
415
|
+
className: "text-[11px] text-sand-400",
|
|
416
|
+
children: "기동 시점 값"
|
|
417
|
+
})]
|
|
418
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dl", {
|
|
419
|
+
className: "px-4 py-3 sm:px-5 grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-1.5",
|
|
420
|
+
children: runtime.map((info) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
421
|
+
className: "flex items-baseline justify-between gap-3 min-w-0",
|
|
422
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", {
|
|
423
|
+
className: "text-[11px] text-sand-500 shrink-0",
|
|
424
|
+
children: info.label
|
|
425
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", {
|
|
426
|
+
className: "text-[12px] font-mono text-sand-700 truncate",
|
|
427
|
+
children: info.value
|
|
428
|
+
})]
|
|
429
|
+
}, info.label))
|
|
430
|
+
})]
|
|
431
|
+
}), groups.map((group) => {
|
|
432
|
+
const items = settings.filter((s) => s.group === group);
|
|
433
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
434
|
+
className: "panel overflow-hidden",
|
|
435
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
436
|
+
className: "panel-header flex items-center justify-between px-4 py-2.5 sm:px-5",
|
|
437
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
438
|
+
className: "text-[13px] font-medium text-sand-700",
|
|
439
|
+
children: GROUP_LABELS.get(group) ?? group
|
|
440
|
+
}), group === "slack" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TriggerReminderButton, {})]
|
|
441
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
442
|
+
className: "divide-y divide-sand-100/80",
|
|
443
|
+
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SettingRow, {
|
|
444
|
+
item,
|
|
445
|
+
disabled: item.key === "qgrid.tokenWindowKeepaliveEnabled" && !data?.keepaliveRunnerEnabled
|
|
446
|
+
}), item.key === "qgrid.tokenWindowKeepaliveEnabled" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeepaliveTokenSettings, { runnerEnabled: data?.keepaliveRunnerEnabled ?? false })] }, item.key))
|
|
447
|
+
})]
|
|
448
|
+
}, group);
|
|
449
|
+
})]
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region src/routes/settings.tsx?tsr-split=component
|
|
454
|
+
function SettingsPage() {
|
|
455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
456
|
+
className: "max-w-4xl mx-auto",
|
|
457
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SettingsPanel, {})
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
//#endregion
|
|
461
|
+
export { SettingsPage as component };
|