fix init edit on variable editor

This commit is contained in:
Ruben Fiszel
2022-12-30 16:59:04 +01:00
parent 54a5e73117
commit a1fec7c4b7
3 changed files with 13 additions and 12 deletions
+5 -5
View File
@@ -364,11 +364,6 @@ async fn update_resource(
let mut tx = user_db.begin(&authed).await?;
let sql = sqlb.sql().map_err(|e| Error::InternalErr(e.to_string()))?;
let npath_o: Option<String> = sqlx::query_scalar(&sql).fetch_optional(&mut tx).await?;
let npath = not_found_if_none(npath_o, "Resource", path)?;
if let Some(npath) = ns.path {
if npath != path {
check_path_conflict(&mut tx, &w_id, &npath).await?;
@@ -387,6 +382,11 @@ async fn update_resource(
}
}
let sql = sqlb.sql().map_err(|e| Error::InternalErr(e.to_string()))?;
let npath_o: Option<String> = sqlx::query_scalar(&sql).fetch_optional(&mut tx).await?;
let npath = not_found_if_none(npath_o, "Resource", path)?;
audit_log(
&mut tx,
&authed.username,
+4 -4
View File
@@ -370,10 +370,6 @@ async fn update_variable(
}
sqlb.returning("path");
let sql = sqlb.sql().map_err(|e| Error::InternalErr(e.to_string()))?;
let npath_o: Option<String> = sqlx::query_scalar(&sql).fetch_optional(&mut tx).await?;
if let Some(npath) = ns.path {
if npath != path {
check_path_conflict(&mut tx, &w_id, &npath).await?;
@@ -391,6 +387,10 @@ async fn update_variable(
}
}
let sql = sqlb.sql().map_err(|e| Error::InternalErr(e.to_string()))?;
let npath_o: Option<String> = sqlx::query_scalar(&sql).fetch_optional(&mut tx).await?;
let npath = not_found_if_none(npath_o, "Variable", path)?;
audit_log(
@@ -49,11 +49,11 @@
drawer.openDrawer()
}
export async function editVariable(path: string): Promise<void> {
export async function editVariable(edit_path: string): Promise<void> {
edit = true
const getV = await VariableService.getVariable({
workspace: $workspaceStore ?? '',
path,
path: edit_path,
decryptSecret: false
})
can_write =
@@ -64,7 +64,8 @@
is_secret: getV.is_secret,
description: getV.description ?? ''
}
initialPath = path
initialPath = edit_path
path = edit_path
drawer.openDrawer()
}