Watson icon indicating copy to clipboard operation
Watson copied to clipboard

Some project-level useful actions (add/remove tags, list with ignore tags)

Open toolleeo opened this issue 4 years ago • 8 comments

There are some useful actions at project-level that are not yet supported by Watson and could add nice extra features.

PROBLEM 1: after some time, there are so many projects that a watson projects command returns too many rows to be useful (takes a lot to go through the list of projects). Moreover, some projects are no longer active. Although they must be kept for obvious reason (we want to keep the history of our activities), there is no reason to keep them in the list of active projects. There should be the possibility to close or hide a project, so that the frames still appear in logs/reports, but not in the list of projects.

SOLUTION TO 1: add a flag, e.g., --ignore-tag(s) to the projects command to exclude the visualization of projects whose frames have a specific tag; in this way, a tag such as +closed or +hidden could be added to the frames and prevent the visualization of the corresponding project.

PROBLEM 2: tags are associated to frames, not to projects. Therefore, a special command to add/remove a tag to/from ALL the frames of a project is necessary.

SOLUTION TO 2: add a new command, e.g., watson tag <project> <tag> to add a tag to all the frames of a project, and watson untag <project> <tag> to untag (or watson tag --remove <project> <tag>)

PROBLEM 3: during the "refactoring" of the organization of projects and tags, sometimes we want to add/remove a tag to every frame of a project.

SOLUTION TO 3: same solution as for problem 2. So that feature would address both problems.

I would be happy to contribute a patch if these ideas would be deemed as interesting.

toolleeo avatar Oct 11 '20 16:10 toolleeo

Thanks for your report @toolleeo :pray: It appears that the solution to all aforementioned problems is to add a new command that batch adds or removes tags from a selection of frames (as you suggested). Instead of adding a new command why not adding a --batch option along with selectors to the edit command? An example usage would be:

$ watson edit --batch -p myproject --add-tag archived

WDYT?

I would be happy to contribute a patch if these ideas would be deemed as interesting.

:heart:

jmaupetit avatar Oct 12 '20 09:10 jmaupetit

It appears that the solution to all aforementioned problems is to add a new command

Not to all the problems. Solution to PROBLEM 1 requires an option to exclude the listing of the projects where frames have some given associated tag.

Regarding the proposed solution, I see that you don't like the proliferation of new commands :-) I agree on the idea of keeping the list of commands as compact as possible. However I think the user would expect that the edit command would do what it says: editing the content, which means opening the editor and making changes. Which is the current behavior.

What we are actually doing it is a kind of "update", thus I suggest one of the possible options:

$ watson update project <myproject> --add-tag archived
$ watson update -p <myproject> --add-tag archived

The former format is similar to the rename command, to keep some coherence.

But if you don't like it, I am not gonna fight and would accept the edit --batch solution, which is better than nothing :-)

I can't say when I could start looking at the implementation: this is busy period :-/

toolleeo avatar Oct 12 '20 20:10 toolleeo

I have a small part already as edit command working, and my solution for mass-marking with single tag was a watson log with the required time and project filters, and the output is piped to grep " to " | awk {' print $1 '} | xargs -n1 watson edit --add-tag/--remove-tag because the format could be easily matched by the "from-to" lines starting the frame ids. But the next step would be to do the same matching if the batch switch enables the same filtering as it is available in log command

gnanet avatar Oct 17 '20 17:10 gnanet

Hi, since there are no such commands yet and I need a remove a tag, I would like to ask: Could I simply do search&replace for the tag name in the file ~/.config/watson/frames, given I pay attention only to replace the correct fields? Or could anything break because of this because the data is also stored/cached elsewhere?

mcrot avatar Aug 04 '22 09:08 mcrot

@mcrot in fact there are edit swutches for adding and removing tags and for log and report there is an ignore-tag switch in use by me since some time.

gnanet avatar Aug 04 '22 09:08 gnanet

@mcrot somehow i did not push te commit button, but right after you commented, i replied.

The edit command incorporates switches to add and remove a tag, also without specify a tag, the "billed" tag can quickly added or removed, the log and report commands include an ignore-tag switch, this fork is used by me for quite lot of time. The complete cleanup of a specific tag from all projects could be done by a log command grepped for that tag, and using all frame-id-s lopped an edit commend to remove that tag.

But you already seen it: this frames file is kind of a key-less array of values in a fixed order, as such you can edit it, as long as it follows the rules of a json array

gnanet avatar Aug 04 '22 15:08 gnanet

@gnanet Thanks! I've seen your branches, great, that it works. Have you thought about creating a pull request to get it into the original project? Until then I'm going with just editing the frames file, if I need to. I only had one tag which I didn't need any more, and removing it was simple this way.

mcrot avatar Aug 04 '22 18:08 mcrot

@gnanet Thanks! I've seen your branches, great, that it works. Have you thought about creating a pull request to get it into the original project? Until then I'm going with just editing the frames file, if I need to. I only had one tag which I didn't need any more, and removing it was simple this way.

It would require to resync the base code and reapply my changes to have them properly PR ready, and some of my changes are not QA fit for the projext.

gnanet avatar Aug 04 '22 18:08 gnanet