Bug 31855 - (singleton) Preventing certain UMC modules from being opened multiple times
(singleton)
Preventing certain UMC modules from being opened multiple times
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UCS 3.1
Other Linux
: P5 normal (vote)
: UCS 3.2-0-errata
Assigned To: Dirk Wiesenthal
Florian Best
:
: 31877 (view as bug list)
Depends on: 31662
Blocks: 34028
  Show dependency treegraph
 
Reported: 2013-06-28 16:46 CEST by Dirk Wiesenthal
Modified: 2014-02-12 10:27 CET (History)
6 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments
Support "unique" in a module; return the module of openModule() (1.92 KB, patch)
2014-01-31 15:54 CET, Dirk Wiesenthal
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Wiesenthal univentionstaff 2013-06-28 16:46:04 CEST
Maybe we should add a generic mechanism to prevent multiple tabs of the same module. This lead to problems in the App Center and UCS@school Schoolrooms. Both required an ugly hack (which could be included in the app.js#openModule function).

It could be stated in the XML file of that UMC module (<module unique="1">) or in the JS code ({unique: true}). I suggest the latter one because moving it in the "backend" module definition raises expectations that cannot be satisfied: The module can be initialised multiple times (once per session) but for the backend each frontend-tab of a module refers to the very same module, so stating unique=1 in the backend (I consider the XML file part of the backend although part of it is also passed to the frontend) is confusing.

+++ This bug was initially created as a clone of Bug #31662 +++

UCS 3.1-1 Errata 119

While installing Zarafa in one App Center, I started another App center module instance in the same browser/UMC which resultet in the following traceback:

Die Ausführung des Kommandos appcenter/packages/sections ist fehlgeschlagen:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/__init__.py", line 204, in execute
    func( request )
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py", line 282, in _response
    result = _multi_response(self, request)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py", line 384, in _response
    for res in function(self, iterator, *nones):
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py", line 266, in _fake_func
    yield function(self, *args)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/appcenter/__init__.py", line 293, in packages_sections
    for package in self.package_manager.packages():
  File "/usr/lib/pymodules/python2.6/univention/lib/package_manager.py", line 478, in packages
    for pkg in self.cache:
  File "/usr/lib/python2.6/dist-packages/apt/cache.py", line 173, in __iter__
    yield self[pkgname]
  File "/usr/lib/python2.6/dist-packages/apt/cache.py", line 161, in __getitem__
    raise KeyError('The cache has no package named %r' % key)
KeyError: "The cache has no package named 'libxss1'"
Comment 1 Alexander Kläser univentionstaff 2013-07-02 17:16:04 CEST
*** Bug 31877 has been marked as a duplicate of this bug. ***
Comment 2 Alexander Kläser univentionstaff 2013-07-05 13:44:52 CEST
Singleton... I was previously searching for this bug using "singleton". The next time I should be able to find :) .
Comment 3 Florian Best univentionstaff 2013-07-05 13:59:34 CEST
(In reply to Alexander Kläser from comment #2)
> Singleton... I was previously searching for this bug using "singleton". The
> next time I should be able to find :) .
Therefore you can use the 'Alias' field.
Comment 4 Alexander Kläser univentionstaff 2013-07-05 14:19:43 CEST
(In reply to Florian Best from comment #3)
> (In reply to Alexander Kläser from comment #2)
> > Singleton... I was previously searching for this bug using "singleton". The
> > next time I should be able to find :) .
> Therefore you can use the 'Alias' field.

Hm, not exactly… alias works similar to an ID, it is unique, not like tags, for instance.
Comment 5 Dirk Wiesenthal univentionstaff 2014-01-31 15:53:32 CET
Needed for the App Center: openModule needs to return the tab it creates in openModule() (first part of the patch).

But the "unique" workaround in the App Center would benefit from that (it somewhat prevents execution of openModule() if App Center is already opened), so openModule needs to natively support "unique: true" of a module (second part).
Comment 6 Dirk Wiesenthal univentionstaff 2014-01-31 15:54:50 CET
Created attachment 5766 [details]
Support "unique" in a module; return the module of openModule()
Comment 7 Dirk Wiesenthal univentionstaff 2014-02-03 10:58:23 CET
(In reply to Dirk Wiesenthal from comment #5)
> But the "unique" workaround in the App Center would benefit from that

But the "unique" workaround in the App Center would *not* benefit from that
Comment 8 Dirk Wiesenthal univentionstaff 2014-02-03 16:11:17 CET
Fixed in
  univention-management-console-frontend 3.0.152-20.817.201402031320

Can be enabled with

return declare("umc.modules.mymodule", Module, {
+ unique: true,
  [...]
});

And openModule returns the module it has opened (or the unique one...):
  require('umc/app').openModule('appcenter').selectComponentsPage()
Comment 9 Florian Best univentionstaff 2014-02-04 14:35:28 CET
Please consider also that modules can have UMC-flavors.
Comment 10 Dirk Wiesenthal univentionstaff 2014-02-04 15:19:37 CET
(In reply to Florian Best from comment #9)
> Please consider also that modules can have UMC-flavors.

Considered in
  univention-management-console-frontend 3.0.152-21.819.201402041443
Comment 11 Florian Best univentionstaff 2014-02-04 16:35:32 CET
OK
Comment 12 Moritz Muehlenhoff univentionstaff 2014-02-12 10:27:42 CET
http://errata.univention.de/ucs/3.2/61.html