add: app_data api
This commit is contained in:
parent
5c520f4308
commit
f423daf2fc
38 changed files with 410 additions and 91 deletions
|
@ -10,11 +10,27 @@
|
|||
(div
|
||||
("id" "manage_fields")
|
||||
("class" "card lowered flex flex-col gap-2")
|
||||
(div
|
||||
("class" "card-nest")
|
||||
(div
|
||||
("class" "card small flex items-center gap-2")
|
||||
(icon (text "database"))
|
||||
(b (str (text "developer:label.data_usage"))))
|
||||
(div
|
||||
("class" "card flex flex-col gap-2")
|
||||
(p ("class" "fade") (text "App data keys are not included in this metric, only stored values count towards your limit."))
|
||||
(text "{% set percentage = (data_limit / app.data_used) * 100 %}")
|
||||
(div ("class" "progress_bar") (div ("class" "poll_bar") ("style" "width: {{ percentage }}%")))
|
||||
(div
|
||||
("class" "w-full flex justify-between items-center")
|
||||
(span (text "{{ app.data_used|filesizeformat }}"))
|
||||
(span (text "{{ data_limit|filesizeformat }}")))))
|
||||
(text "{% if is_helper -%}")
|
||||
(div
|
||||
("class" "card-nest")
|
||||
(div
|
||||
("class" "card small")
|
||||
("class" "card small flex items-center gap-2")
|
||||
(icon (text "infinity"))
|
||||
(b (str (text "developer:label.change_quota_status"))))
|
||||
(div
|
||||
("class" "card")
|
||||
|
@ -32,7 +48,8 @@
|
|||
(div
|
||||
("class" "card-nest")
|
||||
(div
|
||||
("class" "card small")
|
||||
("class" "card small flex items-center gap-2")
|
||||
(icon (text "pencil"))
|
||||
(b (str (text "developer:label.change_title"))))
|
||||
(form
|
||||
("class" "card flex flex-col gap-2")
|
||||
|
@ -50,14 +67,14 @@
|
|||
("required" "")
|
||||
("minlength" "2")))
|
||||
(button
|
||||
("class" "primary")
|
||||
(text "{{ icon \"check\" }}")
|
||||
(span
|
||||
(text "{{ text \"general:action.save\" }}")))))
|
||||
(div
|
||||
("class" "card-nest")
|
||||
(div
|
||||
("class" "card small")
|
||||
("class" "card small flex items-center gap-2")
|
||||
(icon (text "house"))
|
||||
(b (str (text "developer:label.change_homepage"))))
|
||||
(form
|
||||
("class" "card flex flex-col gap-2")
|
||||
|
@ -75,14 +92,14 @@
|
|||
("required" "")
|
||||
("minlength" "2")))
|
||||
(button
|
||||
("class" "primary")
|
||||
(text "{{ icon \"check\" }}")
|
||||
(span
|
||||
(text "{{ text \"general:action.save\" }}")))))
|
||||
(div
|
||||
("class" "card-nest")
|
||||
(div
|
||||
("class" "card small")
|
||||
("class" "card small flex items-center gap-2")
|
||||
(icon (text "goal"))
|
||||
(b (str (text "developer:label.change_redirect"))))
|
||||
(form
|
||||
("class" "card flex flex-col gap-2")
|
||||
|
@ -100,14 +117,14 @@
|
|||
("required" "")
|
||||
("minlength" "2")))
|
||||
(button
|
||||
("class" "primary")
|
||||
(text "{{ icon \"check\" }}")
|
||||
(span
|
||||
(text "{{ text \"general:action.save\" }}")))))
|
||||
(div
|
||||
("class" "card-nest")
|
||||
(div
|
||||
("class" "card small")
|
||||
("class" "card small flex items-center gap-2")
|
||||
(icon (text "telescope"))
|
||||
(b (str (text "developer:label.manage_scopes"))))
|
||||
(form
|
||||
("class" "card flex flex-col gap-2")
|
||||
|
@ -140,10 +157,22 @@
|
|||
(icon (text "external-link")) (text "Docs"))))
|
||||
|
||||
(button
|
||||
("class" "primary")
|
||||
(text "{{ icon \"check\" }}")
|
||||
(span
|
||||
(text "{{ text \"general:action.save\" }}"))))))
|
||||
(text "{{ text \"general:action.save\" }}")))))
|
||||
(div
|
||||
("class" "card-nest")
|
||||
(div
|
||||
("class" "card small flex items-center gap-2")
|
||||
(icon (text "rotate-ccw-key"))
|
||||
(b (str (text "developer:label.secret_key"))))
|
||||
(div
|
||||
("class" "card flex flex-col gap-2")
|
||||
(p ("class" "fade") (text "Your app's API key can only be seen once, so don't lose it. Rolling the key will invalidate the old one."))
|
||||
(pre (code ("id" "new_key")))
|
||||
(button
|
||||
("onclick" "roll_key()")
|
||||
(str (text "developer:label.roll_key"))))))
|
||||
(div
|
||||
("class" "card flex flex-col gap-2")
|
||||
(ul
|
||||
|
@ -323,6 +352,31 @@
|
|||
});
|
||||
};
|
||||
|
||||
globalThis.roll_key = async () => {
|
||||
if (
|
||||
!(await trigger(\"atto::confirm\", [
|
||||
\"Are you sure you would like to do this?\",
|
||||
]))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(\"/api/v1/apps/{{ app.id }}/roll\", {
|
||||
method: \"POST\",
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
trigger(\"atto::toast\", [
|
||||
res.ok ? \"success\" : \"error\",
|
||||
res.message,
|
||||
]);
|
||||
|
||||
if (res.ok) {
|
||||
document.getElementById(\"new_key\").innerText = res.payload;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
globalThis.delete_app = async () => {
|
||||
if (
|
||||
!(await trigger(\"atto::confirm\", [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue