vorta icon indicating copy to clipboard operation
vorta copied to clipboard

Feat: script editor in `pre` and `post` backup scripts

Open SAMAD101 opened this issue 1 year ago • 16 comments

Description

I've added buttons beside the pre-backup and post-backup line edits in the Schedule tab in the Shell Commands section.

https://github.com/borgbase/vorta/assets/71956678/71676ac1-5db2-4a34-8adc-f7f3b9033907

image

Related Issue

#1945

Motivation and Context

Makes it more convenient to add the commands using a shell script.

How Has This Been Tested?

does effect much of the code, only extends some functionality

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [x] I have read the CONTRIBUTING guide.
  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

SAMAD101 avatar Feb 28 '24 17:02 SAMAD101

Oh even I was ready with a PR, I shared a screenshot in the issue thread. Could've saved one of us the work if you told me that you were working on this :sweat_smile:

shivansh02 avatar Feb 28 '24 18:02 shivansh02

Oh even I was ready with a PR, I shared a screenshot in the issue thread. Could've saved one of us the work if you told me that you were working on this 😅

damn 😔 yeah I should've. I just finished this one today.

SAMAD101 avatar Feb 28 '24 18:02 SAMAD101

To avoid overlaps, you can make sure the issue is assigned to you before working on it.

As for this implementation, it's reading a file. We should also look into having a larger editor window instead. Often it's hard to decide what's the best way without seeing it. So even PRs that aren't merged can help with discovering a good solution.

m3nu avatar Feb 29 '24 11:02 m3nu

To avoid overlaps, you can make sure the issue is assigned to you before working on it.

As for this implementation, it's reading a file. We should also look into having a larger editor window instead. Often it's hard to decide what's the best way without seeing it. So even PRs that aren't merged can help with discovering a good solution.

Thank you Will try implementing that as well.

PS: please assign me the issue #1945

SAMAD101 avatar Feb 29 '24 14:02 SAMAD101

Well, apparently I have exams starting soon and also have to ready my proposal for GSOC. So, I'll add this one along with some more issues in my proposal.

SAMAD101 avatar Mar 01 '24 09:03 SAMAD101

To avoid overlaps, you can make sure the issue is assigned to you before working on it.

As for this implementation, it's reading a file. We should also look into having a larger editor window instead. Often it's hard to decide what's the best way without seeing it. So even PRs that aren't merged can help with discovering a good solution.

Well, I snatched some time and implemented a small editor window for it. I've updated this PR. This is how it looks so far: Screenshot_20240303_012208 Screenshot_20240303_014727

PS: monospace fonts aren't installed in my system, so that must be why it is appearing in simple noto font.

SAMAD101 avatar Mar 02 '24 20:03 SAMAD101

Editor looks good. Just what I imagined.

I'd remove the "Load from file" button though. Since the problem it solves is very minor. One can easily copy and paste in the editor. Would just make sure the editor window can be resized.

m3nu avatar Mar 04 '24 07:03 m3nu

Editor looks good. Just what I imagined.

I'd remove the "Load from file" button though. Since the problem it solves is very minor. One can easily copy and paste in the editor. Would just make sure the editor window can be resized.

sure, that can be done. Yeah, The editor window is resizable, will make it wider ig.

SAMAD101 avatar Mar 04 '24 08:03 SAMAD101

Update: Screenshot_20240304_135711 Screenshot_20240304_135717

SAMAD101 avatar Mar 04 '24 08:03 SAMAD101

some spacing between the field and Save button would look good IMO.

shivansh02 avatar Mar 04 '24 08:03 shivansh02

Looks good to me. Will try it locally and then merge, if there are no other concerns or things that come up.

m3nu avatar Mar 04 '24 09:03 m3nu

Updated

Before Screenshot_20240304_135711
After Screenshot_20240304_152540

SAMAD101 avatar Mar 04 '24 09:03 SAMAD101

Updated:

  • Now the label does change depending upon the context (pre/post-backup script).
  • Controlled the spacing. Looks more aligned now.
  • Use of QDialogButtonBox for 'Save' and 'Cancel' buttons.

Screenshot_20240305_134224

SAMAD101 avatar Mar 05 '24 08:03 SAMAD101

Now that it's complete, how about I add some syntax highlighting to it as well? Need some thoughts.

SAMAD101 avatar Mar 05 '24 10:03 SAMAD101

Now that it's complete, how about I add some syntax highlighting to it as well? Need some thoughts.

Seems to much efford for such a small use case. Most people will copy paste the script from another editor anyways.

real-yfprojects avatar Apr 01 '24 14:04 real-yfprojects

Seems to much efford for such a small use case. Most people will copy paste the script from another editor anyways.

Yeah, I'll drop the idea. Its fine as it is.

SAMAD101 avatar Apr 01 '24 16:04 SAMAD101