Skip to content

cats:lib: removed comma formatting from jobId attribute in list jobs output.#1126

Merged
arogge merged 3 commits intobareos:masterfrom
HediBenFraj:dev/HediBenFraj/master/remove-commas-in-list-jobs
Jun 21, 2022
Merged

cats:lib: removed comma formatting from jobId attribute in list jobs output.#1126
arogge merged 3 commits intobareos:masterfrom
HediBenFraj:dev/HediBenFraj/master/remove-commas-in-list-jobs

Conversation

@HediBenFraj
Copy link
Contributor

@HediBenFraj HediBenFraj commented Mar 15, 2022

Description

List jobs shows jobId with comma formatting.
This PR fixes the issue by removing the commas from jobid attribute in the command output".

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

If you have any questions or problems, please give a comment in the PR.

Helpful documentation and best practices

Checklist for the reviewer of the PR (will be processed by the Bareos team)

General
  • PR name is meaningful
  • Purpose of the PR is understood
  • Separate commit for this PR in the CHANGELOG.md, PR number referenced is same
  • Commit descriptions are understandable and well formatted
  • If backport: add original PR number and target branch at top of this file: Backport of PR#000 to bareos-2x
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR
  • bareos-check-sources --since-merge does not report any problems
  • git status should not report modifications in the source tree after building and testing
Tests
  • Decision taken that a system- or unittest is required (if not, then remove this paragraph)
  • The decision towards a systemtest is reasonable compared to a unittest
  • Testname matches exactly what is being tested
  • Output of the test leads quickly to the origin of the fault

@HediBenFraj HediBenFraj force-pushed the dev/HediBenFraj/master/remove-commas-in-list-jobs branch from 3cc50fb to a200d50 Compare March 15, 2022 21:34
@HediBenFraj HediBenFraj force-pushed the dev/HediBenFraj/master/remove-commas-in-list-jobs branch 2 times, most recently from 9797b07 to b5014c6 Compare March 16, 2022 11:05
@bruno-at-bareos
Copy link
Contributor

Just a question, but in our backlog, from what I read : the initial idea was to be able to copy and paste jobids so I don't see a point to replace comma by space ?

@HediBenFraj
Copy link
Contributor Author

Just a question, but in our backlog, from what I read : the initial idea was to be able to copy and paste jobids so I don't see a point to replace comma by space ?

yes it was suggested to remove the commas: they make it hard to copy and paste jobIds to use them in other commands (will require to manually remove the commas, I think )
we can also remove the separation altogether if necessary.

@HediBenFraj HediBenFraj force-pushed the dev/HediBenFraj/master/remove-commas-in-list-jobs branch 2 times, most recently from 851337e to 6ffe825 Compare March 18, 2022 09:09
@HediBenFraj HediBenFraj requested a review from arogge March 18, 2022 09:11
@HediBenFraj HediBenFraj force-pushed the dev/HediBenFraj/master/remove-commas-in-list-jobs branch 4 times, most recently from cf60f21 to 408be75 Compare March 24, 2022 21:30
@HediBenFraj
Copy link
Contributor Author

HediBenFraj commented Mar 24, 2022

@arogge By the way didn't need the trim method.
also i had to use the

if (jobid){
// do_not_add_commas
}else{
// add_commas
}

Copy link
Member

@arogge arogge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed a formatting issue with the table. It looks like the calculation for the width of the column still calculates it as if the commas were still these.
Note the excess spaces in this example:

+------------+------------------+-----------+---------------------+----------+------+-------+----------+----------+-----------+
| jobid      | name             | client    | starttime           | duration | type | level | jobfiles | jobbytes | jobstatus |
+------------+------------------+-----------+---------------------+----------+------+-------+----------+----------+-----------+
|   10000000 | backup-bareos-fd | bareos-fd | 2022-03-28 11:46:48 | 00:00:01 | B    | F     |       73 |  144,145 | T         |

Other than that we may want to not add commas to priorjobid as that will also contain a jobid value. (AFAIR only llist job displays that field)

CHANGELOG.md Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that doesn't describe the change correctly anymore

if (row[i] == NULL) {
value.bsprintf(" %-*s |", max_len, "NULL");
} else if (SqlFieldIsNumeric(field->type) && !jcr->gui
&& IsAnInteger(row[i])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the file's header doesn't have the right copyright years set.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as there's no other change in this file, we should also not change the header.

@HediBenFraj HediBenFraj force-pushed the dev/HediBenFraj/master/remove-commas-in-list-jobs branch 3 times, most recently from 68674a1 to b31efe3 Compare March 29, 2022 15:00
@HediBenFraj HediBenFraj force-pushed the dev/HediBenFraj/master/remove-commas-in-list-jobs branch 3 times, most recently from ac4888a to bc480d8 Compare April 5, 2022 10:05
@bruno-at-bareos bruno-at-bareos requested a review from arogge April 28, 2022 10:04
@HediBenFraj HediBenFraj force-pushed the dev/HediBenFraj/master/remove-commas-in-list-jobs branch from bc480d8 to 15f04f2 Compare May 2, 2022 08:43
@arogge arogge force-pushed the dev/HediBenFraj/master/remove-commas-in-list-jobs branch from 15f04f2 to 1d16dd1 Compare June 2, 2022 08:38
@HediBenFraj HediBenFraj changed the title cats:lib: replaced commas in list job output with space for numbers in the thousands. cats:lib: removed comma formatting from jobId attribute in list jobs output. Jun 9, 2022
@arogge arogge force-pushed the dev/HediBenFraj/master/remove-commas-in-list-jobs branch from 1d16dd1 to 1239b63 Compare June 21, 2022 14:07
@arogge arogge merged commit 4affb38 into bareos:master Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments