feat: add Settings card to app detail page (repo, branch, port, memory, cpu)
https://claude.ai/code/session_01FKCW3FDjNFj6jve4niMFXH
This commit is contained in:
parent
eb9a500987
commit
54ceedbe5a
2 changed files with 32 additions and 0 deletions
|
|
@ -325,6 +325,8 @@ pub async fn app_detail(
|
|||
.replace("{{host}}", &host)
|
||||
.replace("{{app_id}}", &app.id)
|
||||
.replace("{{secret}}", &app.webhook_secret)
|
||||
.replace("{{memory_limit}}", &app.memory_limit)
|
||||
.replace("{{cpu_limit}}", &app.cpu_limit)
|
||||
.replace("{{deploy_rows}}", &deploy_rows)
|
||||
.replace("{{env_rows}}", &env_rows)
|
||||
.replace("{{c_badge}}", &container_badge(&container_state))
|
||||
|
|
|
|||
|
|
@ -35,6 +35,20 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>Settings</h2>
|
||||
<div class="row" style="margin-bottom:12px">
|
||||
<div style="flex:3"><label>Repo URL</label><input id="cfg-repo" type="text" value="{{repo}}"></div>
|
||||
<div style="flex:1"><label>Branch</label><input id="cfg-branch" type="text" value="{{branch}}"></div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom:12px">
|
||||
<div style="flex:1"><label>Port</label><input id="cfg-port" type="number" value="{{port}}"></div>
|
||||
<div style="flex:1"><label>Memory limit</label><input id="cfg-memory" type="text" value="{{memory_limit}}"></div>
|
||||
<div style="flex:1"><label>CPU limit</label><input id="cfg-cpu" type="text" value="{{cpu_limit}}"></div>
|
||||
</div>
|
||||
<button class="primary" onclick="saveSettings()">Save</button>
|
||||
</div>
|
||||
|
||||
{{db_card}}
|
||||
|
||||
<div class="card">
|
||||
|
|
@ -168,6 +182,22 @@ async function deprovisionDb() {
|
|||
else alert('Error: ' + await r.text());
|
||||
}
|
||||
const IS_PUBLIC = {{is_public_js}};
|
||||
async function saveSettings() {
|
||||
const body = {
|
||||
repo_url: document.getElementById('cfg-repo').value,
|
||||
branch: document.getElementById('cfg-branch').value,
|
||||
port: parseInt(document.getElementById('cfg-port').value, 10),
|
||||
memory_limit: document.getElementById('cfg-memory').value,
|
||||
cpu_limit: document.getElementById('cfg-cpu').value,
|
||||
};
|
||||
const r = await fetch('/api/apps/' + APP_ID, {
|
||||
method: 'PATCH',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
if (r.ok) window.location.reload();
|
||||
else alert('Error saving settings: ' + await r.text());
|
||||
}
|
||||
async function toggleVisibility() {
|
||||
const r = await fetch('/api/apps/' + APP_ID, {
|
||||
method: 'PATCH',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue