@oktis-works/admin 0.1.7 → 0.1.8
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/dist/client/_astro/ContentEditor.C9TSxsGW.js +1 -0
- package/dist/client/_astro/ContentList.e1datweV.js +1 -0
- package/dist/client/_astro/DashboardHome.CqnldWlv.js +1 -0
- package/dist/client/_astro/{DashboardLayout.astro_astro_type_script_index_0_lang.B663y3aY.js → DashboardLayout.astro_astro_type_script_index_0_lang.sNve10RH.js} +1 -1
- package/dist/client/_astro/GeneralSettings.D-ALN9_r.js +1 -0
- package/dist/client/_astro/MediaLibrary.NQ1lF95i.js +1 -0
- package/dist/client/_astro/PostTypesManager.CdMx_Nxn.js +1 -0
- package/dist/client/_astro/TaxonomiesManager.BU7A02Ay.js +1 -0
- package/dist/client/_astro/UserCreateForm.BvDn97aZ.js +1 -0
- package/dist/client/_astro/UsersManager.CFBCKO-t.js +1 -0
- package/dist/client/_astro/api.DCaprPaL.js +1 -0
- package/dist/client/_astro/client.BY0Z100j.js +1 -0
- package/dist/client/_astro/dist.B3u752Tx.js +1 -0
- package/dist/client/_astro/extensions.PfWqwyUU.js +1 -0
- package/dist/client/_astro/{login.astro_astro_type_script_index_0_lang.ozrnjgkA.js → login.astro_astro_type_script_index_0_lang.BZaUVRCc.js} +1 -1
- package/dist/client/_astro/{web.BRlgYXBp.js → web.D_vCtCLj.js} +1 -1
- package/dist/server/chunks/{ContentEditor_DwBpNq-K.mjs → ContentEditor_CrO12IkK.mjs} +516 -20
- package/dist/server/chunks/DashboardLayout_h9iqOf7E.mjs +524 -0
- package/dist/server/chunks/MediaLibrary_Ctc5H6Od.mjs +309 -0
- package/dist/server/chunks/_slug__FVgVdi48.mjs +30 -0
- package/dist/server/chunks/{api_BWOj0bUJ.mjs → api_C1VC3OiH.mjs} +12 -0
- package/dist/server/chunks/{edit_DNavSwFw.mjs → edit_Dau0tASP.mjs} +2 -2
- package/dist/server/chunks/{general_r50g45qE.mjs → general_DOXmhv-h.mjs} +57 -50
- package/dist/server/chunks/{index_yiAU3Mfy.mjs → index_B26K6w42.mjs} +160 -48
- package/dist/server/chunks/{index_B50u2M3P.mjs → index_BYBvZsat.mjs} +1 -1
- package/dist/server/chunks/index_D9OGVvPs.mjs +275 -0
- package/dist/server/chunks/{index_6G7rXrus.mjs → index_Owj31XBA.mjs} +2 -2
- package/dist/server/chunks/{index_qxSk7_hO.mjs → index_oZK1qJym.mjs} +2 -2
- package/dist/server/chunks/{new_BWcSqoqV.mjs → new_2mb-n_fU.mjs} +2 -2
- package/dist/server/chunks/{new_h8TItZZ9.mjs → new_BhA9pTES.mjs} +2 -2
- package/dist/server/chunks/{post-types_BSobAovm.mjs → post-types_B4rrV0WI.mjs} +2 -2
- package/dist/server/chunks/{taxonomies_Ij7CReDF.mjs → taxonomies_Bdxv94jK.mjs} +2 -2
- package/dist/server/chunks/{upload_16xg6koU.mjs → upload_RgdwSWbY.mjs} +2 -2
- package/dist/server/entry.mjs +52 -22
- package/package.json +5 -5
- package/dist/client/_astro/ContentEditor.DOcUnkMP.js +0 -1
- package/dist/client/_astro/ContentList.KzxsMMxH.js +0 -1
- package/dist/client/_astro/DashboardHome.DFRZ_yyM.js +0 -1
- package/dist/client/_astro/GeneralSettings.gbcKHf_p.js +0 -1
- package/dist/client/_astro/MediaLibrary.BtCjwNlR.js +0 -1
- package/dist/client/_astro/PostTypesManager.DsxV-sF3.js +0 -1
- package/dist/client/_astro/TaxonomiesManager.DqnwUCtt.js +0 -1
- package/dist/client/_astro/UserCreateForm.BLaiQTzI.js +0 -1
- package/dist/client/_astro/UsersManager.BPRG8tjn.js +0 -1
- package/dist/client/_astro/api.BegLcOlq.js +0 -1
- package/dist/client/_astro/client.D7G9q8lk.js +0 -1
- package/dist/server/chunks/DashboardLayout_DO66tdeZ.mjs +0 -43
- package/dist/server/chunks/MediaLibrary_DEi9k6ms.mjs +0 -179
- package/dist/server/chunks/index_DUzUgyr4.mjs +0 -155
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { r as __exportAll } from "./rolldown-runtime_BMI-E3GI.mjs";
|
|
2
2
|
import { d as maybeRenderHead, i as renderComponent, u as renderTemplate } from "./server_CnzC2Y0K.mjs";
|
|
3
3
|
import { t as createComponent$1 } from "./compiler_CYjwXhLT.mjs";
|
|
4
|
-
import { t as $$DashboardLayout } from "./
|
|
5
|
-
import { t as apiClient } from "./
|
|
4
|
+
import { a as For2, c as Select, f as createSignal, l as Show2, n as Badge, o as Input, p as onMount, r as Button, s as Pagination, t as $$DashboardLayout } from "./DashboardLayout_h9iqOf7E.mjs";
|
|
5
|
+
import { t as apiClient } from "./api_C1VC3OiH.mjs";
|
|
6
6
|
import { createComponent, escape, ssr, ssrAttribute, ssrHydrationKey } from "solid-js/web";
|
|
7
|
-
import { For, Show, createSignal, onMount } from "solid-js";
|
|
8
7
|
//#region src/components/apps/users/UsersManager.tsx
|
|
9
8
|
var _tmpl$ = [
|
|
10
9
|
"<div",
|
|
@@ -22,31 +21,19 @@ var _tmpl$3 = [
|
|
|
22
21
|
"</tbody></table>"
|
|
23
22
|
];
|
|
24
23
|
var _tmpl$4 = [
|
|
25
|
-
"<div",
|
|
26
|
-
" class=\"pagination\"><button class=\"btn btn-secondary btn-sm\" type=\"button\"",
|
|
27
|
-
">← Anterior</button><span class=\"muted\">Página <!--$-->",
|
|
28
|
-
"<!--/--> de <!--$-->",
|
|
29
|
-
"<!--/--></span><button class=\"btn btn-secondary btn-sm\" type=\"button\"",
|
|
30
|
-
">Próxima →</button></div>"
|
|
31
|
-
];
|
|
32
|
-
var _tmpl$5 = [
|
|
33
24
|
"<div",
|
|
34
25
|
" class=\"users-manager\"><!--$-->",
|
|
35
26
|
"<!--/--><!--$-->",
|
|
36
|
-
"<!--/--><div class=\"toolbar\"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
27
|
+
"<!--/--><div class=\"toolbar\"><!--$-->",
|
|
28
|
+
"<!--/--><!--$-->",
|
|
29
|
+
"<!--/--><a class=\"btn btn-primary\" href=\"/users/new\">+ Novo usuário</a><!--$-->",
|
|
30
|
+
"<!--/--></div><!--$-->",
|
|
39
31
|
"<!--/--><!--$-->",
|
|
40
32
|
"<!--/--><!--$-->",
|
|
41
33
|
"<!--/--></div>"
|
|
42
34
|
];
|
|
43
|
-
var _tmpl$
|
|
44
|
-
var _tmpl$
|
|
45
|
-
"<span",
|
|
46
|
-
" class=\"badge\">",
|
|
47
|
-
"</span>"
|
|
48
|
-
];
|
|
49
|
-
var _tmpl$8 = [
|
|
35
|
+
var _tmpl$5 = ["<p", " class=\"muted\">Nenhum usuário encontrado.</p>"];
|
|
36
|
+
var _tmpl$6 = [
|
|
50
37
|
"<tr",
|
|
51
38
|
" class=\"",
|
|
52
39
|
"\"><td>",
|
|
@@ -55,10 +42,12 @@ var _tmpl$8 = [
|
|
|
55
42
|
"</td><td><span class=\"",
|
|
56
43
|
"\"></span><!--$-->",
|
|
57
44
|
"<!--/--></td><td class=\"muted\">",
|
|
58
|
-
"</td><td class=\"users-table__actions\"
|
|
45
|
+
"</td><td class=\"users-table__actions\"><!--$-->",
|
|
46
|
+
"<!--/--><!--$-->",
|
|
47
|
+
"<!--/--></td></tr>"
|
|
59
48
|
];
|
|
60
|
-
var _tmpl$
|
|
61
|
-
var _tmpl$
|
|
49
|
+
var _tmpl$7 = ["<span", " class=\"muted\">sem papel</span>"];
|
|
50
|
+
var _tmpl$8 = [
|
|
62
51
|
"<div",
|
|
63
52
|
" class=\"card user-details\"><h3>Gerenciar usuário</h3><div class=\"form-grid\"><label>Nome<input class=\"input\"",
|
|
64
53
|
"></label><label>Email<input class=\"input\" type=\"email\"",
|
|
@@ -68,12 +57,12 @@ var _tmpl$0 = [
|
|
|
68
57
|
"><option value>— sem papel —</option><!--$-->",
|
|
69
58
|
"<!--/--></select></label></div><p class=\"muted\">Criado em <!--$-->",
|
|
70
59
|
"<!--/--> · último acesso <!--$-->",
|
|
71
|
-
"<!--/--></p><div class=\"media-details__actions\"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
60
|
+
"<!--/--></p><div class=\"media-details__actions\"><!--$-->",
|
|
61
|
+
"<!--/--><!--$-->",
|
|
62
|
+
"<!--/--><!--$-->",
|
|
63
|
+
"<!--/--></div></div>"
|
|
75
64
|
];
|
|
76
|
-
var _tmpl$
|
|
65
|
+
var _tmpl$9 = [
|
|
77
66
|
"<option",
|
|
78
67
|
"><!--$-->",
|
|
79
68
|
"<!--/--> (<!--$-->",
|
|
@@ -116,64 +105,187 @@ function UsersManager() {
|
|
|
116
105
|
setRoles(await apiClient.listRoles());
|
|
117
106
|
} catch {}
|
|
118
107
|
});
|
|
119
|
-
const
|
|
108
|
+
const searchNow = async () => {
|
|
109
|
+
setPage(1);
|
|
110
|
+
await load();
|
|
111
|
+
};
|
|
112
|
+
const resetPassword = async (user) => {
|
|
113
|
+
const password = prompt(`Nova senha para ${user.email} (mínimo 8 caracteres):`);
|
|
114
|
+
if (!password) return;
|
|
115
|
+
if (password.length < 8) {
|
|
116
|
+
setError("A senha precisa de pelo menos 8 caracteres");
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
setBusy(true);
|
|
120
|
+
setError("");
|
|
121
|
+
try {
|
|
122
|
+
await apiClient.setUserPassword(user.id, password);
|
|
123
|
+
setInfo(`Senha de ${user.name} alterada ✓`);
|
|
124
|
+
} catch (err) {
|
|
125
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
126
|
+
} finally {
|
|
127
|
+
setBusy(false);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const saveUser = async (user) => {
|
|
131
|
+
setBusy(true);
|
|
132
|
+
setError("");
|
|
133
|
+
try {
|
|
134
|
+
await apiClient.updateUser(user.id, {
|
|
135
|
+
name: user.name,
|
|
136
|
+
email: user.email,
|
|
137
|
+
status: user.status
|
|
138
|
+
});
|
|
139
|
+
setInfo(`Usuário ${user.name} salvo ✓`);
|
|
140
|
+
setSelected(null);
|
|
141
|
+
await load();
|
|
142
|
+
} catch (err) {
|
|
143
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
144
|
+
} finally {
|
|
145
|
+
setBusy(false);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
const removeUser = async (user) => {
|
|
149
|
+
if (!confirm(`Excluir o usuário ${user.email}?`)) return;
|
|
150
|
+
setBusy(true);
|
|
151
|
+
setError("");
|
|
152
|
+
try {
|
|
153
|
+
await apiClient.deleteUser(user.id);
|
|
154
|
+
if (selected()?.id === user.id) setSelected(null);
|
|
155
|
+
setInfo(`Usuário ${user.name} excluído ✓`);
|
|
156
|
+
await load();
|
|
157
|
+
} catch (err) {
|
|
158
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
159
|
+
} finally {
|
|
160
|
+
setBusy(false);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
120
163
|
const currentRole = (user) => roles().find((r) => r.slug === user.roles[0]);
|
|
121
|
-
return ssr(_tmpl$
|
|
164
|
+
return ssr(_tmpl$4, ssrHydrationKey(), escape(createComponent(Show2, {
|
|
122
165
|
get when() {
|
|
123
166
|
return error();
|
|
124
167
|
},
|
|
125
168
|
get children() {
|
|
126
169
|
return ssr(_tmpl$, ssrHydrationKey(), escape(error()));
|
|
127
170
|
}
|
|
128
|
-
})), escape(createComponent(
|
|
171
|
+
})), escape(createComponent(Show2, {
|
|
129
172
|
get when() {
|
|
130
173
|
return info();
|
|
131
174
|
},
|
|
132
175
|
get children() {
|
|
133
176
|
return ssr(_tmpl$2, ssrHydrationKey(), escape(info()));
|
|
134
177
|
}
|
|
135
|
-
})),
|
|
178
|
+
})), escape(createComponent(Input, {
|
|
179
|
+
name: "user-search",
|
|
180
|
+
placeholder: "Buscar por nome ou email…",
|
|
181
|
+
get value() {
|
|
182
|
+
return search();
|
|
183
|
+
},
|
|
184
|
+
onInput: (value) => {
|
|
185
|
+
setSearch(value);
|
|
186
|
+
searchNow();
|
|
187
|
+
}
|
|
188
|
+
})), escape(createComponent(Select, {
|
|
189
|
+
name: "user-status",
|
|
190
|
+
placeholder: "Todos os status",
|
|
191
|
+
get value() {
|
|
192
|
+
return status();
|
|
193
|
+
},
|
|
194
|
+
options: [{
|
|
195
|
+
value: "ACTIVE",
|
|
196
|
+
label: "Ativos"
|
|
197
|
+
}, {
|
|
198
|
+
value: "INACTIVE",
|
|
199
|
+
label: "Inativos"
|
|
200
|
+
}],
|
|
201
|
+
onChange: (value) => {
|
|
202
|
+
setStatus(value);
|
|
203
|
+
searchNow();
|
|
204
|
+
}
|
|
205
|
+
})), escape(createComponent(Button, {
|
|
206
|
+
variant: "secondary",
|
|
207
|
+
onClick: () => void searchNow(),
|
|
208
|
+
children: "Buscar"
|
|
209
|
+
})), escape(createComponent(Show2, {
|
|
136
210
|
get when() {
|
|
137
211
|
return users().length > 0;
|
|
138
212
|
},
|
|
139
213
|
get fallback() {
|
|
140
|
-
return ssr(_tmpl$
|
|
214
|
+
return ssr(_tmpl$5, ssrHydrationKey());
|
|
141
215
|
},
|
|
142
216
|
get children() {
|
|
143
|
-
return ssr(_tmpl$3, ssrHydrationKey(), escape(createComponent(
|
|
217
|
+
return ssr(_tmpl$3, ssrHydrationKey(), escape(createComponent(For2, {
|
|
144
218
|
get each() {
|
|
145
219
|
return users();
|
|
146
220
|
},
|
|
147
|
-
children: (user) => ssr(_tmpl$
|
|
221
|
+
children: (user) => ssr(_tmpl$6, ssrHydrationKey(), selected()?.id === user.id ? "users-table__row--selected" : "", escape(user.name), escape(user.email), escape(createComponent(Show2, {
|
|
148
222
|
get when() {
|
|
149
223
|
return user.roles.length > 0;
|
|
150
224
|
},
|
|
151
225
|
get fallback() {
|
|
152
|
-
return ssr(_tmpl$
|
|
226
|
+
return ssr(_tmpl$7, ssrHydrationKey());
|
|
153
227
|
},
|
|
154
228
|
get children() {
|
|
155
|
-
return
|
|
229
|
+
return createComponent(Badge, { get children() {
|
|
230
|
+
return user.roles.join(", ");
|
|
231
|
+
} });
|
|
156
232
|
}
|
|
157
|
-
})), `status-dot ${user.status === "ACTIVE" ? "status-dot--active" : ""}`, escape(user.status), escape(formatDate(user.last_login_at))
|
|
233
|
+
})), `status-dot ${user.status === "ACTIVE" ? "status-dot--active" : ""}`, escape(user.status), escape(formatDate(user.last_login_at)), escape(createComponent(Button, {
|
|
234
|
+
variant: "secondary",
|
|
235
|
+
size: "sm",
|
|
236
|
+
onClick: () => setSelected(user),
|
|
237
|
+
children: "Gerenciar"
|
|
238
|
+
})), escape(createComponent(Button, {
|
|
239
|
+
variant: "danger",
|
|
240
|
+
size: "sm",
|
|
241
|
+
onClick: () => void removeUser(user),
|
|
242
|
+
children: "Excluir"
|
|
243
|
+
})))
|
|
158
244
|
})));
|
|
159
245
|
}
|
|
160
|
-
})), escape(createComponent(
|
|
161
|
-
get
|
|
162
|
-
return
|
|
246
|
+
})), escape(createComponent(Pagination, {
|
|
247
|
+
get page() {
|
|
248
|
+
return page();
|
|
163
249
|
},
|
|
164
|
-
|
|
165
|
-
|
|
250
|
+
limit,
|
|
251
|
+
get total() {
|
|
252
|
+
return total();
|
|
253
|
+
},
|
|
254
|
+
onPageChange: (next) => {
|
|
255
|
+
setPage(next);
|
|
256
|
+
load();
|
|
166
257
|
}
|
|
167
|
-
})), escape(createComponent(
|
|
258
|
+
})), escape(createComponent(Show2, {
|
|
168
259
|
get when() {
|
|
169
260
|
return selected();
|
|
170
261
|
},
|
|
171
|
-
children: (user) => ssr(_tmpl$
|
|
262
|
+
children: (user) => ssr(_tmpl$8, ssrHydrationKey(), ssrAttribute("value", escape(user().name, true), false), ssrAttribute("value", escape(user().email, true), false), ssrAttribute("value", escape(user().status, true), false), ssrAttribute("value", escape(currentRole(user())?.id ?? "", true), false), ssrAttribute("disabled", busy(), true), escape(createComponent(For2, {
|
|
172
263
|
get each() {
|
|
173
264
|
return roles();
|
|
174
265
|
},
|
|
175
|
-
children: (role) => ssr(_tmpl$
|
|
176
|
-
})), escape(formatDate(user().created_at)), escape(formatDate(user().last_login_at)),
|
|
266
|
+
children: (role) => ssr(_tmpl$9, ssrHydrationKey() + ssrAttribute("value", escape(role.id, true), false), escape(role.name), escape(role.slug))
|
|
267
|
+
})), escape(formatDate(user().created_at)), escape(formatDate(user().last_login_at)), escape(createComponent(Button, {
|
|
268
|
+
variant: "primary",
|
|
269
|
+
get disabled() {
|
|
270
|
+
return busy();
|
|
271
|
+
},
|
|
272
|
+
get loading() {
|
|
273
|
+
return busy();
|
|
274
|
+
},
|
|
275
|
+
onClick: () => void saveUser(user()),
|
|
276
|
+
children: "Salvar"
|
|
277
|
+
})), escape(createComponent(Button, {
|
|
278
|
+
variant: "secondary",
|
|
279
|
+
get disabled() {
|
|
280
|
+
return busy();
|
|
281
|
+
},
|
|
282
|
+
onClick: () => void resetPassword(user()),
|
|
283
|
+
children: "Redefinir senha"
|
|
284
|
+
})), escape(createComponent(Button, {
|
|
285
|
+
variant: "secondary",
|
|
286
|
+
onClick: () => setSelected(null),
|
|
287
|
+
children: "Fechar"
|
|
288
|
+
})))
|
|
177
289
|
})));
|
|
178
290
|
}
|
|
179
291
|
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as __exportAll } from "./rolldown-runtime_BMI-E3GI.mjs";
|
|
2
2
|
import { d as maybeRenderHead, i as renderComponent, u as renderTemplate } from "./server_CnzC2Y0K.mjs";
|
|
3
3
|
import { t as createComponent } from "./compiler_CYjwXhLT.mjs";
|
|
4
|
-
import { t as $$DashboardLayout } from "./
|
|
4
|
+
import { t as $$DashboardLayout } from "./DashboardLayout_h9iqOf7E.mjs";
|
|
5
5
|
//#region src/pages/settings/index.astro
|
|
6
6
|
var settings_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
default: () => $$Index,
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { r as __exportAll } from "./rolldown-runtime_BMI-E3GI.mjs";
|
|
2
|
+
import { d as maybeRenderHead, i as renderComponent, u as renderTemplate } from "./server_CnzC2Y0K.mjs";
|
|
3
|
+
import { t as createComponent$1 } from "./compiler_CYjwXhLT.mjs";
|
|
4
|
+
import { c as Select, f as createSignal, i as Card, l as Show2, n as Badge, o as Input, p as onMount, r as Button, s as Pagination, t as $$DashboardLayout, u as Table } from "./DashboardLayout_h9iqOf7E.mjs";
|
|
5
|
+
import { t as apiClient } from "./api_C1VC3OiH.mjs";
|
|
6
|
+
import { createComponent, escape, ssr, ssrHydrationKey } from "solid-js/web";
|
|
7
|
+
//#region src/components/content/ContentList.tsx
|
|
8
|
+
var _tmpl$ = [
|
|
9
|
+
"<span",
|
|
10
|
+
" class=\"muted\">",
|
|
11
|
+
"</span>"
|
|
12
|
+
];
|
|
13
|
+
var _tmpl$2 = [
|
|
14
|
+
"<div",
|
|
15
|
+
" class=\"users-table__actions\"><a class=\"btn btn-secondary btn-sm\" href=\"",
|
|
16
|
+
"\">Editar</a><!--$-->",
|
|
17
|
+
"<!--/--><!--$-->",
|
|
18
|
+
"<!--/--></div>"
|
|
19
|
+
];
|
|
20
|
+
var _tmpl$3 = [
|
|
21
|
+
"<div",
|
|
22
|
+
" class=\"notice notice--error\">",
|
|
23
|
+
"</div>"
|
|
24
|
+
];
|
|
25
|
+
var _tmpl$4 = [
|
|
26
|
+
"<div",
|
|
27
|
+
" class=\"notice\">",
|
|
28
|
+
"</div>"
|
|
29
|
+
];
|
|
30
|
+
var _tmpl$5 = [
|
|
31
|
+
"<div",
|
|
32
|
+
" class=\"content-list\"><!--$-->",
|
|
33
|
+
"<!--/--><!--$-->",
|
|
34
|
+
"<!--/--><div class=\"toolbar\"><!--$-->",
|
|
35
|
+
"<!--/--><!--$-->",
|
|
36
|
+
"<!--/--><!--$-->",
|
|
37
|
+
"<!--/--><a class=\"btn btn-primary\" href=\"/content/new\">+ Novo conteúdo</a><!--$-->",
|
|
38
|
+
"<!--/--></div><!--$-->",
|
|
39
|
+
"<!--/--></div>"
|
|
40
|
+
];
|
|
41
|
+
function raw(row) {
|
|
42
|
+
return row;
|
|
43
|
+
}
|
|
44
|
+
function formatDate(row) {
|
|
45
|
+
const value = raw(row)["updated_at"] ?? raw(row)["updatedAt"] ?? raw(row)["created_at"];
|
|
46
|
+
if (typeof value !== "string") return "—";
|
|
47
|
+
const date = new Date(value);
|
|
48
|
+
return Number.isNaN(date.getTime()) ? "—" : date.toLocaleString("pt-BR");
|
|
49
|
+
}
|
|
50
|
+
function ContentList() {
|
|
51
|
+
const [items, setItems] = createSignal([]);
|
|
52
|
+
const [types, setTypes] = createSignal([]);
|
|
53
|
+
const [total, setTotal] = createSignal(0);
|
|
54
|
+
const [page, setPage] = createSignal(1);
|
|
55
|
+
const [search, setSearch] = createSignal("");
|
|
56
|
+
const [type, setType] = createSignal("");
|
|
57
|
+
const [status, setStatus] = createSignal("");
|
|
58
|
+
const [error, setError] = createSignal("");
|
|
59
|
+
const [info, setInfo] = createSignal("");
|
|
60
|
+
const [busyId, setBusyId] = createSignal("");
|
|
61
|
+
const limit = 20;
|
|
62
|
+
const load = async () => {
|
|
63
|
+
try {
|
|
64
|
+
const result = await apiClient.getContent({
|
|
65
|
+
page: page(),
|
|
66
|
+
limit,
|
|
67
|
+
type: type() || void 0,
|
|
68
|
+
status: status() || void 0,
|
|
69
|
+
search: search() || void 0
|
|
70
|
+
});
|
|
71
|
+
setItems(result.data ?? []);
|
|
72
|
+
setTotal(result.total ?? 0);
|
|
73
|
+
} catch (err) {
|
|
74
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
onMount(async () => {
|
|
78
|
+
await load();
|
|
79
|
+
try {
|
|
80
|
+
setTypes(await apiClient.getContentTypes());
|
|
81
|
+
} catch {}
|
|
82
|
+
});
|
|
83
|
+
const searchNow = async () => {
|
|
84
|
+
setPage(1);
|
|
85
|
+
await load();
|
|
86
|
+
};
|
|
87
|
+
const togglePublish = async (row) => {
|
|
88
|
+
const isPublished = raw(row)["status"] === "PUBLISHED";
|
|
89
|
+
setBusyId(row.id);
|
|
90
|
+
setError("");
|
|
91
|
+
setInfo("");
|
|
92
|
+
try {
|
|
93
|
+
await apiClient.publishToggle(row.id, isPublished);
|
|
94
|
+
setInfo(isPublished ? "Conteúdo despublicado ✓" : "Conteúdo publicado ✓");
|
|
95
|
+
await load();
|
|
96
|
+
} catch (err) {
|
|
97
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
98
|
+
} finally {
|
|
99
|
+
setBusyId("");
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const remove = async (row) => {
|
|
103
|
+
const title = String(raw(row)["title"] ?? row.id);
|
|
104
|
+
if (!confirm(`Excluir "${title}"?`)) return;
|
|
105
|
+
try {
|
|
106
|
+
await apiClient.deleteContent(row.id);
|
|
107
|
+
await load();
|
|
108
|
+
} catch (err) {
|
|
109
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const columns = [
|
|
113
|
+
{
|
|
114
|
+
key: "title",
|
|
115
|
+
label: "Título"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
key: "type",
|
|
119
|
+
label: "Tipo"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
key: "status",
|
|
123
|
+
label: "Status",
|
|
124
|
+
render: (_value, row) => {
|
|
125
|
+
const statusValue = String(row["status"] ?? "");
|
|
126
|
+
return createComponent(Badge, {
|
|
127
|
+
variant: statusValue === "PUBLISHED" ? "success" : statusValue === "ARCHIVED" ? "warning" : "secondary",
|
|
128
|
+
children: statusValue
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
key: "updated_at",
|
|
134
|
+
label: "Atualizado",
|
|
135
|
+
render: (_value, row) => ssr(_tmpl$, ssrHydrationKey(), escape(formatDate(row)))
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
key: "actions",
|
|
139
|
+
label: "",
|
|
140
|
+
render: (_value, row) => {
|
|
141
|
+
const content = row;
|
|
142
|
+
const isPublished = raw(content)["status"] === "PUBLISHED";
|
|
143
|
+
return ssr(_tmpl$2, ssrHydrationKey(), `/content/edit?id=${escape(encodeURIComponent(content.id), true)}`, escape(createComponent(Button, {
|
|
144
|
+
variant: isPublished ? "secondary" : "primary",
|
|
145
|
+
size: "sm",
|
|
146
|
+
get loading() {
|
|
147
|
+
return busyId() === content.id;
|
|
148
|
+
},
|
|
149
|
+
onClick: () => void togglePublish(content),
|
|
150
|
+
children: isPublished ? "Despublicar" : "Publicar"
|
|
151
|
+
})), escape(createComponent(Button, {
|
|
152
|
+
variant: "danger",
|
|
153
|
+
size: "sm",
|
|
154
|
+
onClick: () => void remove(content),
|
|
155
|
+
children: "Excluir"
|
|
156
|
+
})));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
];
|
|
160
|
+
return ssr(_tmpl$5, ssrHydrationKey(), escape(createComponent(Show2, {
|
|
161
|
+
get when() {
|
|
162
|
+
return error();
|
|
163
|
+
},
|
|
164
|
+
get children() {
|
|
165
|
+
return ssr(_tmpl$3, ssrHydrationKey(), escape(error()));
|
|
166
|
+
}
|
|
167
|
+
})), escape(createComponent(Show2, {
|
|
168
|
+
get when() {
|
|
169
|
+
return info();
|
|
170
|
+
},
|
|
171
|
+
get children() {
|
|
172
|
+
return ssr(_tmpl$4, ssrHydrationKey(), escape(info()));
|
|
173
|
+
}
|
|
174
|
+
})), escape(createComponent(Input, {
|
|
175
|
+
name: "search",
|
|
176
|
+
placeholder: "Buscar conteúdo…",
|
|
177
|
+
get value() {
|
|
178
|
+
return search();
|
|
179
|
+
},
|
|
180
|
+
onInput: (value) => {
|
|
181
|
+
setSearch(value);
|
|
182
|
+
searchNow();
|
|
183
|
+
}
|
|
184
|
+
})), escape(createComponent(Select, {
|
|
185
|
+
name: "type",
|
|
186
|
+
placeholder: "Todos os tipos",
|
|
187
|
+
get value() {
|
|
188
|
+
return type();
|
|
189
|
+
},
|
|
190
|
+
get options() {
|
|
191
|
+
return types().map((t) => ({
|
|
192
|
+
value: t.slug,
|
|
193
|
+
label: t.pluralLabel || t.name
|
|
194
|
+
}));
|
|
195
|
+
},
|
|
196
|
+
onChange: (value) => {
|
|
197
|
+
setType(value);
|
|
198
|
+
searchNow();
|
|
199
|
+
}
|
|
200
|
+
})), escape(createComponent(Select, {
|
|
201
|
+
name: "status",
|
|
202
|
+
placeholder: "Todos os status",
|
|
203
|
+
get value() {
|
|
204
|
+
return status();
|
|
205
|
+
},
|
|
206
|
+
options: [
|
|
207
|
+
{
|
|
208
|
+
value: "DRAFT",
|
|
209
|
+
label: "Rascunho"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
value: "PUBLISHED",
|
|
213
|
+
label: "Publicado"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
value: "ARCHIVED",
|
|
217
|
+
label: "Arquivado"
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
onChange: (value) => {
|
|
221
|
+
setStatus(value);
|
|
222
|
+
searchNow();
|
|
223
|
+
}
|
|
224
|
+
})), escape(createComponent(Button, {
|
|
225
|
+
variant: "secondary",
|
|
226
|
+
onClick: () => void searchNow(),
|
|
227
|
+
children: "Buscar"
|
|
228
|
+
})), escape(createComponent(Card, { get children() {
|
|
229
|
+
return [createComponent(Table, {
|
|
230
|
+
columns,
|
|
231
|
+
get data() {
|
|
232
|
+
return items();
|
|
233
|
+
},
|
|
234
|
+
emptyMessage: "Nenhum conteúdo encontrado."
|
|
235
|
+
}), createComponent(Pagination, {
|
|
236
|
+
get page() {
|
|
237
|
+
return page();
|
|
238
|
+
},
|
|
239
|
+
limit,
|
|
240
|
+
get total() {
|
|
241
|
+
return total();
|
|
242
|
+
},
|
|
243
|
+
onPageChange: (next) => {
|
|
244
|
+
setPage(next);
|
|
245
|
+
load();
|
|
246
|
+
}
|
|
247
|
+
})];
|
|
248
|
+
} })));
|
|
249
|
+
}
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region src/pages/content/index.astro
|
|
252
|
+
var content_exports = /* @__PURE__ */ __exportAll({
|
|
253
|
+
default: () => $$Index,
|
|
254
|
+
file: () => $$file,
|
|
255
|
+
url: () => $$url
|
|
256
|
+
});
|
|
257
|
+
var $$Index = createComponent$1(($$result, $$props, $$slots) => {
|
|
258
|
+
return renderTemplate`${renderComponent($$result, "DashboardLayout", $$DashboardLayout, {
|
|
259
|
+
"title": "Content",
|
|
260
|
+
"data-astro-cid-qhu5jad5": true
|
|
261
|
+
}, { "default": ($$result) => renderTemplate`${maybeRenderHead($$result)}<div class="content-page" data-astro-cid-qhu5jad5><div class="page-header" data-astro-cid-qhu5jad5><h2 data-astro-cid-qhu5jad5>Conteúdo</h2><p data-astro-cid-qhu5jad5>Busque, filtre, edite e publique seu conteúdo.</p></div>${renderComponent($$result, "ContentList", ContentList, {
|
|
262
|
+
"client:load": true,
|
|
263
|
+
"data-astro-cid-qhu5jad5": true,
|
|
264
|
+
"client:component-hydration": "load",
|
|
265
|
+
"client:component-path": "/home/runner/work/cms/cms/apps/admin/src/components/content/ContentList.tsx",
|
|
266
|
+
"client:component-export": "ContentList"
|
|
267
|
+
})}</div>` })}`;
|
|
268
|
+
}, "/home/runner/work/cms/cms/apps/admin/src/pages/content/index.astro", void 0);
|
|
269
|
+
var $$file = "/home/runner/work/cms/cms/apps/admin/src/pages/content/index.astro";
|
|
270
|
+
var $$url = "/content";
|
|
271
|
+
//#endregion
|
|
272
|
+
//#region \0virtual:astro:page:src/pages/content/index@_@astro
|
|
273
|
+
var page = () => content_exports;
|
|
274
|
+
//#endregion
|
|
275
|
+
export { page };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as __exportAll } from "./rolldown-runtime_BMI-E3GI.mjs";
|
|
2
2
|
import { d as maybeRenderHead, i as renderComponent, u as renderTemplate } from "./server_CnzC2Y0K.mjs";
|
|
3
3
|
import { t as createComponent$1 } from "./compiler_CYjwXhLT.mjs";
|
|
4
|
-
import { t as $$DashboardLayout } from "./
|
|
5
|
-
import { t as apiClient } from "./
|
|
4
|
+
import { t as $$DashboardLayout } from "./DashboardLayout_h9iqOf7E.mjs";
|
|
5
|
+
import { t as apiClient } from "./api_C1VC3OiH.mjs";
|
|
6
6
|
import { createComponent, escape, ssr, ssrHydrationKey } from "solid-js/web";
|
|
7
7
|
import { For, Show, createSignal, onMount } from "solid-js";
|
|
8
8
|
//#region src/components/apps/dashboard/DashboardHome.tsx
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as __exportAll } from "./rolldown-runtime_BMI-E3GI.mjs";
|
|
2
2
|
import { d as maybeRenderHead, i as renderComponent, u as renderTemplate } from "./server_CnzC2Y0K.mjs";
|
|
3
3
|
import { t as createComponent } from "./compiler_CYjwXhLT.mjs";
|
|
4
|
-
import { t as $$DashboardLayout } from "./
|
|
5
|
-
import { t as MediaLibrary } from "./
|
|
4
|
+
import { t as $$DashboardLayout } from "./DashboardLayout_h9iqOf7E.mjs";
|
|
5
|
+
import { t as MediaLibrary } from "./MediaLibrary_Ctc5H6Od.mjs";
|
|
6
6
|
//#region src/pages/media/index.astro
|
|
7
7
|
var media_exports = /* @__PURE__ */ __exportAll({
|
|
8
8
|
default: () => $$Index,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as __exportAll } from "./rolldown-runtime_BMI-E3GI.mjs";
|
|
2
2
|
import { d as maybeRenderHead, i as renderComponent, u as renderTemplate } from "./server_CnzC2Y0K.mjs";
|
|
3
3
|
import { t as createComponent$1 } from "./compiler_CYjwXhLT.mjs";
|
|
4
|
-
import { t as $$DashboardLayout } from "./
|
|
5
|
-
import { t as apiClient } from "./
|
|
4
|
+
import { t as $$DashboardLayout } from "./DashboardLayout_h9iqOf7E.mjs";
|
|
5
|
+
import { t as apiClient } from "./api_C1VC3OiH.mjs";
|
|
6
6
|
import { createComponent, escape, ssr, ssrAttribute, ssrHydrationKey } from "solid-js/web";
|
|
7
7
|
import { For, Show, createSignal, onMount } from "solid-js";
|
|
8
8
|
//#region src/components/apps/users/UserCreateForm.tsx
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as __exportAll } from "./rolldown-runtime_BMI-E3GI.mjs";
|
|
2
2
|
import { d as maybeRenderHead, i as renderComponent, u as renderTemplate } from "./server_CnzC2Y0K.mjs";
|
|
3
3
|
import { t as createComponent } from "./compiler_CYjwXhLT.mjs";
|
|
4
|
-
import { t as $$DashboardLayout } from "./
|
|
5
|
-
import { t as ContentEditor } from "./
|
|
4
|
+
import { t as $$DashboardLayout } from "./DashboardLayout_h9iqOf7E.mjs";
|
|
5
|
+
import { t as ContentEditor } from "./ContentEditor_CrO12IkK.mjs";
|
|
6
6
|
//#region src/pages/content/new.astro
|
|
7
7
|
var new_exports = /* @__PURE__ */ __exportAll({
|
|
8
8
|
default: () => $$New,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as __exportAll } from "./rolldown-runtime_BMI-E3GI.mjs";
|
|
2
2
|
import { d as maybeRenderHead, i as renderComponent, u as renderTemplate } from "./server_CnzC2Y0K.mjs";
|
|
3
3
|
import { t as createComponent$1 } from "./compiler_CYjwXhLT.mjs";
|
|
4
|
-
import { t as $$DashboardLayout } from "./
|
|
5
|
-
import { t as apiClient } from "./
|
|
4
|
+
import { t as $$DashboardLayout } from "./DashboardLayout_h9iqOf7E.mjs";
|
|
5
|
+
import { t as apiClient } from "./api_C1VC3OiH.mjs";
|
|
6
6
|
import { createComponent, escape, ssr, ssrAttribute, ssrHydrationKey } from "solid-js/web";
|
|
7
7
|
import { For, Show, createSignal, onMount } from "solid-js";
|
|
8
8
|
//#region src/components/apps/settings/PostTypesManager.tsx
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as __exportAll } from "./rolldown-runtime_BMI-E3GI.mjs";
|
|
2
2
|
import { d as maybeRenderHead, i as renderComponent, u as renderTemplate } from "./server_CnzC2Y0K.mjs";
|
|
3
3
|
import { t as createComponent$1 } from "./compiler_CYjwXhLT.mjs";
|
|
4
|
-
import { t as $$DashboardLayout } from "./
|
|
5
|
-
import { t as apiClient } from "./
|
|
4
|
+
import { t as $$DashboardLayout } from "./DashboardLayout_h9iqOf7E.mjs";
|
|
5
|
+
import { t as apiClient } from "./api_C1VC3OiH.mjs";
|
|
6
6
|
import { createComponent, escape, ssr, ssrAttribute, ssrHydrationKey, ssrStyleProperty } from "solid-js/web";
|
|
7
7
|
import { For, Show, createSignal, onMount } from "solid-js";
|
|
8
8
|
//#region src/components/apps/settings/TaxonomiesManager.tsx
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as __exportAll } from "./rolldown-runtime_BMI-E3GI.mjs";
|
|
2
2
|
import { d as maybeRenderHead, i as renderComponent, u as renderTemplate } from "./server_CnzC2Y0K.mjs";
|
|
3
3
|
import { t as createComponent } from "./compiler_CYjwXhLT.mjs";
|
|
4
|
-
import { t as $$DashboardLayout } from "./
|
|
5
|
-
import { t as MediaLibrary } from "./
|
|
4
|
+
import { t as $$DashboardLayout } from "./DashboardLayout_h9iqOf7E.mjs";
|
|
5
|
+
import { t as MediaLibrary } from "./MediaLibrary_Ctc5H6Od.mjs";
|
|
6
6
|
//#region src/pages/media/upload.astro
|
|
7
7
|
var upload_exports = /* @__PURE__ */ __exportAll({
|
|
8
8
|
default: () => $$Upload,
|