Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: Dependency Age Gate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
Expand All @@ -28,7 +28,7 @@ jobs:
name: Lint (TypeScript)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '20'
Expand All @@ -44,7 +44,7 @@ jobs:
name: Lint (Rust)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: rustfmt, clippy
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
Expand All @@ -106,7 +106,7 @@ jobs:
name: Test Frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '20'
Expand All @@ -133,7 +133,7 @@ jobs:
runs-on: ubuntu-latest
needs: [test-rust, test-frontend]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-22.04'
Expand Down
5 changes: 1 addition & 4 deletions src-tauri/crates/mas-admin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,7 @@ impl AdminService {
) -> Result<(), CoreError> {
tracing::info!(process_id = process_id, "Killing MySQL process");
let pool = self.connection_manager.get_pool(connection_id)?;
let result = sqlx::query("KILL ?")
.bind(process_id)
.execute(&pool)
.await;
let result = sqlx::query("KILL ?").bind(process_id).execute(&pool).await;
match result {
Ok(_) => {
tracing::info!(process_id = process_id, "Process killed successfully");
Expand Down
14 changes: 11 additions & 3 deletions src-tauri/crates/mas-core/src/connection/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ impl ConnectionManager {
"Creating connection pool"
);

let charset = profile.charset.clone().unwrap_or_else(|| "utf8mb4".to_string());
let charset = profile
.charset
.clone()
.unwrap_or_else(|| "utf8mb4".to_string());
let mut options = MySqlConnectOptions::new()
.host(&profile.host)
.port(profile.port)
Expand Down Expand Up @@ -64,7 +67,9 @@ impl ConnectionManager {
.after_connect(move |conn, _meta| {
let charset = charset_for_after_connect.clone();
Box::pin(async move {
sqlx::query(&format!("SET NAMES {}", charset)).execute(&mut *conn).await?;
sqlx::query(&format!("SET NAMES {}", charset))
.execute(&mut *conn)
.await?;
Ok(())
})
})
Expand Down Expand Up @@ -150,7 +155,10 @@ impl ConnectionManager {
) -> Result<TestConnectionResult, CoreError> {
let start = Instant::now();

let charset = profile.charset.clone().unwrap_or_else(|| "utf8mb4".to_string());
let charset = profile
.charset
.clone()
.unwrap_or_else(|| "utf8mb4".to_string());
let mut options = MySqlConnectOptions::new()
.host(&profile.host)
.port(profile.port)
Expand Down
21 changes: 15 additions & 6 deletions src-tauri/crates/mas-core/src/connection/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,21 @@ impl ConnectionStore {
db.execute("ALTER TABLE connection_profiles ADD COLUMN env TEXT", [])
.ok();
// Migration: add advanced settings columns if missing
db.execute("ALTER TABLE connection_profiles ADD COLUMN connect_timeout_secs INTEGER", [])
.ok();
db.execute("ALTER TABLE connection_profiles ADD COLUMN query_timeout_secs INTEGER", [])
.ok();
db.execute("ALTER TABLE connection_profiles ADD COLUMN charset TEXT", [])
.ok();
db.execute(
"ALTER TABLE connection_profiles ADD COLUMN connect_timeout_secs INTEGER",
[],
)
.ok();
db.execute(
"ALTER TABLE connection_profiles ADD COLUMN query_timeout_secs INTEGER",
[],
)
.ok();
db.execute(
"ALTER TABLE connection_profiles ADD COLUMN charset TEXT",
[],
)
.ok();
tracing::debug!("Connection profiles table initialized");
Ok(())
}
Expand Down
3 changes: 3 additions & 0 deletions src-tauri/crates/mas-core/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ fn test_profile() -> ConnectionProfile {
pool_min: 1,
pool_max: 5,
read_only: false,
connect_timeout_secs: None,
query_timeout_secs: None,
charset: None,
environment: None,
created_at: Utc::now(),
updated_at: Utc::now(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ fn test_profile() -> ConnectionProfile {
pool_min: 1,
pool_max: 5,
read_only: false,
connect_timeout_secs: None,
query_timeout_secs: None,
charset: None,
environment: None,
created_at: Utc::now(),
updated_at: Utc::now(),
Expand Down
4 changes: 3 additions & 1 deletion src-tauri/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,9 @@ pub async fn write_file_contents(path: String, contents: String) -> Result<(), S
.ok_or_else(|| "Invalid path: missing file name".to_string())?,
)
} else {
path_buf.canonicalize().map_err(|e| format!("Invalid path: {e}"))?
path_buf
.canonicalize()
.map_err(|e| format!("Invalid path: {e}"))?
};
tokio::fs::write(&resolved, &contents).await.map_err(|e| {
tracing::error!(error = %e, path = %path, "Failed to write file");
Expand Down
4 changes: 2 additions & 2 deletions src/components/editor/__tests__/QueryToolbar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,10 @@ describe("QueryToolbar", () => {
expect(screen.getByText("Save").closest("button")).toBeDisabled();
});

it("shows Running state when executing", () => {
it("shows Cancel button when executing", () => {
mockIsExecuting = true;
render(<QueryToolbar />);
expect(screen.getByText("Running...")).toBeInTheDocument();
expect(screen.getByText("Cancel")).toBeInTheDocument();
expect(screen.queryByText("Run")).not.toBeInTheDocument();
});

Expand Down
15 changes: 13 additions & 2 deletions src/hooks/useGridEditing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export function useGridEditing() {
setDeletes(new Set());
undoStack.current = [];
redoStack.current = [];
bumpVersion();
}, []);

const applyAction = useCallback((action: EditAction): EditAction => {
Expand All @@ -143,7 +144,11 @@ export function useGridEditing() {
const next = new Map(prev);
const rowChanges = [...(next.get(action.rowIndex) ?? [])];
const existing = rowChanges.findIndex((c) => c.column === action.column);
if (action.newValue === action.oldValue || (action.oldValue === undefined && action.newValue === action.oldValue)) {
if (existing >= 0 && action.newValue === rowChanges[existing].originalValue) {
rowChanges.splice(existing, 1);
if (rowChanges.length === 0) next.delete(action.rowIndex);
else next.set(action.rowIndex, rowChanges);
} else if (action.newValue === action.oldValue) {
if (existing >= 0) {
rowChanges.splice(existing, 1);
if (rowChanges.length === 0) next.delete(action.rowIndex);
Expand Down Expand Up @@ -172,6 +177,10 @@ export function useGridEditing() {
return { ...action, index: -1 };
}
case "deleteRow": {
if (action.rowIndex === -1) {
setInserts((prev) => prev.slice(0, -1));
return { type: "insertRow", index: 0 }; // forward action for redo
}
setDeletes((prev: Set<number>) => {
const next = new Set(prev);
if (next.has(action.rowIndex)) next.delete(action.rowIndex);
Expand All @@ -194,7 +203,9 @@ export function useGridEditing() {
const redo = useCallback(() => {
const action = redoStack.current.pop();
if (!action) return;
const reverse = applyAction(reverseAction(action));
const reverse = action.type === "insertRow"
? applyAction(action)
: applyAction(reverseAction(action));
undoStack.current.push(reverse);
bumpVersion();
}, [applyAction]);
Expand Down
Loading