Skip to content

Commit

Permalink
Merge pull request #49 from KunalSin9h/import
Browse files Browse the repository at this point in the history
added import settings
  • Loading branch information
KunalSin9h authored Oct 31, 2023
2 parents b94dd3c + d2c1cbc commit af9a64c
Show file tree
Hide file tree
Showing 10 changed files with 258 additions and 118 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
"lucide-react": "^0.269.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.17.0",
"react-router-dom": "^6.18.0",
"tailwind-merge": "^1.14.0",
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
"@tauri-apps/cli": "^1.5.6",
"@types/node": "^20.8.9",
"@types/node": "^20.8.10",
"@types/react": "^18.2.33",
"@types/react-dom": "^18.2.14",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@vitejs/plugin-react": "^4.1.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.52.0",
Expand Down Expand Up @@ -58,5 +58,5 @@
"preview": "vite preview",
"tauri": "tauri"
},
"version": "0.12.0"
"version": "0.13.0"
}
162 changes: 81 additions & 81 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ features = ['derive']
version = '1.0'

[dependencies.tauri]
features = ['fs-copy-file', 'dialog-save', 'shell-open', 'fs-write-file', 'fs-read-dir', 'fs-read-file']
features = ['dialog-open', 'fs-copy-file', 'dialog-save', 'shell-open', 'fs-write-file', 'fs-read-dir', 'fs-read-file']
version = '1.4'

[dependencies.tokio]
Expand All @@ -35,7 +35,7 @@ edition = '2021'
license = 'MIT'
name = 'secops'
repository = 'https://github.com/kunalsin9h/secops'
version = '0.12.0'
version = '0.13.0'

[profile]
[profile.ci]
Expand Down
3 changes: 2 additions & 1 deletion src-tauri/src/commands/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,12 @@ fn disable_camera_command() -> AppCommand {
#[tauri::command(async)]
pub async fn revert_commit(
file: String,
prefix: String,
app: tauri::AppHandle,
state: tauri::State<'_, Application>,
) -> Result<(), rspc::Error> {
let home_dir = state.home_dir.lock().unwrap().clone();
revert_state(&app, &home_dir, &file).map_err(RspcError::internal_server_error)?;
revert_state(&app, &home_dir, &file, &prefix).map_err(RspcError::internal_server_error)?;

Ok(())
}
13 changes: 9 additions & 4 deletions src-tauri/src/core/state/revert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ use crate::core::{
get_state_file, write_state_file, Action, AppCommand, Instruction, CURRENT_STATE_FILE,
};

pub fn revert_state(app: &AppHandle, home_dir: &Path, file_name: &str) -> Result<(), String> {
pub fn revert_state(
app: &AppHandle,
home_dir: &Path,
file_name: &str,
prefix: &str,
) -> Result<(), String> {
let mut current_state =
get_state_file(home_dir, CURRENT_STATE_FILE).map_err(|e| e.to_string())?;
let revert_file_state = get_state_file(home_dir, file_name).map_err(|e| e.to_string())?;
Expand All @@ -24,7 +29,7 @@ pub fn revert_state(app: &AppHandle, home_dir: &Path, file_name: &str) -> Result

let mut command = AppCommand::new(
"reverting.settings",
&format!(r#"Reverting settings of: "{}""#, revert_file_state.message),
&format!(r#"{} settings of: "{}""#, prefix, revert_file_state.message),
vec![],
);
for cmd in commands_to_run {
Expand All @@ -38,8 +43,8 @@ pub fn revert_state(app: &AppHandle, home_dir: &Path, file_name: &str) -> Result
command.execute(app, home_dir)?;

current_state.message = format!(
r#"Current settings, reverted from: "{}""#,
revert_file_state.message
r#"Current settings, {} from: "{}""#,
prefix, revert_file_state.message
);
current_state.commands = revert_file_state.commands;
write_state_file(home_dir, current_state, CURRENT_STATE_FILE).map_err(|e| e.to_string())?;
Expand Down
3 changes: 2 additions & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
},
"package": {
"productName": "Secops",
"version": "0.12.0"
"version": "0.13.0"
},
"tauri": {
"allowlist": {
"all": false,
"dialog": {
"open": true,
"save": true
},
"fs": {
Expand Down
1 change: 1 addition & 0 deletions src/components/Header/ExportCommit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ function RevertBox({
}
invoke("revert_commit", {
file: value.fileName,
prefix: "Revert",
})
.then(() =>
toastInfoReload({
Expand Down
Loading

0 comments on commit af9a64c

Please sign in to comment.