Bug 332193

Summary: software repositories: maintain entry selection common sense position after delete
Product: [openSUSE] openSUSE 10.3 Reporter: macias - <bluedzins>
Component: YaST2Assignee: Ladislav Slezák <lslezak>
Status: RESOLVED WONTFIX QA Contact: Jiri Srain <jsrain>
Severity: Enhancement    
Priority: P5 - None    
Version: Final   
Target Milestone: ---   
Hardware: PC   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description macias - 2007-10-09 13:57:43 UTC
Let's say you have list of repos:
a
b
c
d
e
f
g
h

you click on d and delete it. Which repo should now be selected. Me? --> e.

But SR randomly picks next entry -- it could be h or b, it makes navigation really hard.
Comment 1 Cyril Hrubis 2007-10-10 17:47:36 UTC
Please attach y2logs. If you are in doubt follow:

http://en.opensuse.org/Bugs/YaST

Thanks!
Comment 2 macias - 2007-10-10 18:57:44 UTC
It is quite easy to reproduce -- launch SR, sort repos by status (disabled/enabled) and delete any.
Comment 3 Cyril Hrubis 2007-10-10 19:11:33 UTC
OK reproduced, looks like yast is being confused by sorting them.

It behaves same on my x86_64 so it seems to be hw independent.
Comment 4 Ladislav Slezák 2008-04-25 15:02:06 UTC
This cannot be fixed because the yast script cannot get the current sorting from UI when the table is sorted by user manually.

(I can only disable sorting but that's a bad idea...)
Comment 5 macias - 2008-04-25 15:28:06 UTC
Ladislav, _EVEN_ if yast is composition of backend and frontend...

user: delete entry -> UI: delete entry X -> backend: delete X

reverse direction
a) backend: success -> UI: delete it visually -> UI: skip to next item
b) backend: failure -> UI: do nothing

Comment 6 Ladislav Slezák 2008-04-25 15:38:05 UTC
I'm sorry but I don't understand comment #5 at all...

The problem is that the backend (Yast script) cannot get the current order of the table items after sorting it by another column in UI. It simply doesn't know order of the items in the table.

The only thing which script can read or set is the selected item or set content of a cell. See http://forgeftp.novell.com/yast/doc/SL10.2/tdg/Table_widget.html
Comment 7 macias - 2008-04-25 16:07:07 UTC
Ladislav, I showed you steps in such case, i.e. there is some backend, and this backend does not know anything about sorting.

How it is done -- I (user) click to delete repo. This is at GUI level right? So GUI calls backend to delete the item, if this succeeds then _GUI_ (not yast) removes the repo _visually_. And it is GUI part job to jump to next item.

Yast script (backend) should not know anything about table, list, whatever -- it should handle low-level primitives functions, like:
a) get repo list
b) change repo attributes
c) add repo
d) remove repo
Comment 8 Ladislav Slezák 2008-04-28 10:58:24 UTC
(In reply to comment #7 from Maciej Pilichowski)
> This is at GUI level right? So GUI calls backend to delete the item, if this
> succeeds then _GUI_ (not yast) removes the repo _visually_.

No, the problem is here: The item is deleted by the Yast script. Actually the item is not deleted, the _whole_ table content is _replaced_.

UI doesn't support removing of a single line from the table widget. It would need to be implemented in 3 frontends (Qt, GTK, ncurses). I think it's not worth of doing it, the effort is much bigger than the benefit.
Comment 9 macias - 2008-04-28 11:25:13 UTC
Ok, but UI handles deleting item, right? So it takes (at UI level) only getting item number from the list (table) before the delete, deleting, getting whole table back, restoring sorting, and setting the item number to previously stored value.

Problem solved (reopening).
Comment 10 Ladislav Slezák 2008-04-28 13:06:44 UTC
Please, see http://forgeftp.novell.com/yast/doc/SL10.2/tdg/Table_widget.html
for list of supported operations (section Properties).

No, sorry, this really cannot be simply implemented. The table widget doesn't allow to set or get the current sorting.
Comment 11 macias - 2008-04-28 16:20:35 UTC
Ladislav, this is not ironic, or anything, just compare:

Possible things:
* OCR, voice recognition, auto-driven vehicles (Darpa Challenge), machine translation, google search (in split second), CGI (movies), flight to Mars and to the Moon

Impossible things:
* maintaining position in table


Ladislav, does sorting change when delete is done? If not, you can skip this step too. Just reset the position back.
Comment 12 Ladislav Slezák 2008-04-29 06:02:15 UTC
Of coure it _IS_ possible, but the effort to implement it would be very high, it's not worth of doing it as I have written in comment #8. Sorry, but we have more important problems than sorting table items. (BTW yast is open source, your patch will be welcomed.)

I resolved the bug as WONTFIX, that means that the bug report is valid 
but for some reason it will not be fixed. (As opposed to INVALID which means the bug is not a bug.)

The position is set back when you delete some item from the table. It works if you do not change sorting. If you change sorting it breaks because the yast script doesn't know that sorting has changed and set the new item according to the  original sorting.
Comment 13 macias - 2008-04-29 07:49:58 UTC
> The position is set back when you delete some item from the table. It works
> if you do not change sorting. 

I did the test -- I added an item, it was put as the last one, I deleted it. The first item gets selected.

I did not change any sorting. Just started SR, added repo, deleted it. So it does not maintain position (even without changing order).