feat: make repo URL optional when creating an app
Useful for git-push-only deploys where no external repo URL is needed. - CreateApp.repo_url: String → Option<String> - DB schema default: repo_url TEXT NOT NULL DEFAULT '' - UI validation no longer requires the field - Label marked (optional) in the form https://claude.ai/code/session_01FKCW3FDjNFj6jve4niMFXH
This commit is contained in:
parent
bb26a81fe6
commit
5bc1948f1a
4 changed files with 5 additions and 5 deletions
|
|
@ -17,7 +17,7 @@ pub async fn migrate(pool: &DbPool) -> anyhow::Result<()> {
|
|||
r#"CREATE TABLE IF NOT EXISTS apps (
|
||||
id TEXT PRIMARY KEY,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
repo_url TEXT NOT NULL,
|
||||
repo_url TEXT NOT NULL DEFAULT '',
|
||||
branch TEXT NOT NULL DEFAULT 'main',
|
||||
port INTEGER NOT NULL,
|
||||
webhook_secret TEXT NOT NULL,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ pub struct App {
|
|||
#[derive(Debug, Deserialize)]
|
||||
pub struct CreateApp {
|
||||
pub name: String,
|
||||
pub repo_url: String,
|
||||
pub repo_url: Option<String>,
|
||||
pub branch: Option<String>,
|
||||
pub port: i64,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ pub async fn create(
|
|||
)
|
||||
.bind(&id)
|
||||
.bind(&payload.name)
|
||||
.bind(&payload.repo_url)
|
||||
.bind(payload.repo_url.unwrap_or_default())
|
||||
.bind(&branch)
|
||||
.bind(payload.port)
|
||||
.bind(&secret)
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ pub async fn index(State(s): State<AppState>) -> Result<Html<String>, StatusCode
|
|||
<h2>Add App</h2>
|
||||
<div class="grid2" style="margin-bottom:12px">
|
||||
<div><label>Name (slug)</label><input id="f-name" type="text" placeholder="my-api"></div>
|
||||
<div><label>GitHub Repo URL</label><input id="f-repo" type="text" placeholder="https://github.com/you/repo.git"></div>
|
||||
<div><label>GitHub Repo URL <span style="font-weight:normal;opacity:.6">(optional)</span></label><input id="f-repo" type="text" placeholder="https://github.com/you/repo.git"></div>
|
||||
</div>
|
||||
<div class="grid2" style="margin-bottom:16px">
|
||||
<div><label>Branch</label><input id="f-branch" type="text" value="main"></div>
|
||||
|
|
@ -266,7 +266,7 @@ pub async fn index(State(s): State<AppState>) -> Result<Html<String>, StatusCode
|
|||
branch: document.getElementById('f-branch').value.trim() || 'main',
|
||||
port: parseInt(document.getElementById('f-port').value),
|
||||
}};
|
||||
if (!data.name || !data.repo_url || !data.port) {{ alert('Fill in all fields'); return; }}
|
||||
if (!data.name || !data.port) {{ alert('Fill in all fields'); return; }}
|
||||
const r = await fetch('/api/apps', {{
|
||||
method: 'POST',
|
||||
headers: {{'Content-Type': 'application/json'}},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue