Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Devrim Gunyel
core
Commits
0d2036e6
Commit
0d2036e6
authored
Feb 26, 2019
by
Piotr Gawron
Browse files
html nodes are removed from dom when plugin is removed
parent
42448fea
Changes
4
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
0d2036e6
minerva
(
12.2.0
~
beta
.2
)
unstable
;
urgency
=
medium
*
Bug
fix
:
when
plugin
is
removed
the
html
elements
associated
with
it
are
removed
as
well
(#
686
)
*
Bug
fix
:
when
creating
new
user
default
privileges
are
set
properly
(#
692
)
*
Bug
fix
:
import
from
SBML
issue
-
reaction
with
product
and
modifier
being
the
same
element
caused
exception
(#
703
)
...
...
frontend-js/src/main/js/gui/leftPanel/GuiUtils.js
View file @
0d2036e6
...
...
@@ -1140,6 +1140,23 @@ GuiUtils.prototype.hideTab = function (abstractGuiElement, panel) {
}
};
/**
*
* @param {AbstractGuiElement} abstractGuiElement
* @param {Panel|HTMLElement} panel
*/
GuiUtils
.
prototype
.
removeTab
=
function
(
abstractGuiElement
,
panel
)
{
var
panelId
=
getPanelId
(
panel
);
var
liElement
=
$
(
"
li:has(a[href='#
"
+
panelId
+
"
'])
"
,
$
(
abstractGuiElement
.
getElement
()))[
0
];
var
contentElement
=
$
(
"
#
"
+
panelId
,
$
(
abstractGuiElement
.
getElement
()))[
0
];
if
(
liElement
!==
undefined
&&
contentElement
!==
undefined
)
{
liElement
.
parentElement
.
removeChild
(
liElement
);
contentElement
.
parentElement
.
removeChild
(
contentElement
);
}
else
{
logger
.
warn
(
"
Cannot find tab for panel:
"
+
panel
);
}
};
/**
*
* @param {AbstractGuiElement} abstractGuiElement
...
...
frontend-js/src/main/js/plugin/PluginManager.js
View file @
0d2036e6
...
...
@@ -97,10 +97,7 @@ PluginManager.prototype.addPlugin = function (options) {
serverConnector
:
self
.
getServerConnector
()
});
plugin
.
addListener
(
"
onUnload
"
,
function
()
{
self
.
getGuiUtils
().
hideTab
(
self
,
element
);
if
(
$
(
"
li
"
,
self
.
getElement
()).
children
(
'
:visible
'
).
length
===
0
)
{
$
(
self
.
getElement
()).
hide
();
}
self
.
getGuiUtils
().
removeTab
(
self
,
element
);
});
if
(
!
self
.
isValidUrl
(
options
.
url
))
{
return
Promise
.
reject
(
new
InvalidArgumentError
(
"
url: '
"
+
options
.
url
+
"
' is invalid
"
));
...
...
@@ -189,6 +186,7 @@ PluginManager.prototype.removePlugin = function (plugin) {
GuiConnector
.
removeWindowResizeEvent
(
self
.
_pluginOnResizeHandlers
[
plugin
.
getPluginId
()]);
return
plugin
.
unload
().
then
(
function
()
{
if
(
self
.
_plugins
.
length
===
0
)
{
$
(
self
.
getElement
()).
hide
();
return
self
.
getMap
().
getMapCanvas
().
triggerListeners
(
"
resize
"
);
}
else
{
return
self
.
adjustMinWidth
();
...
...
frontend-js/src/test/js/plugin/PluginManager-test.js
View file @
0d2036e6
...
...
@@ -122,6 +122,7 @@ describe('PluginManager', function () {
return
manager
.
removePlugin
(
plugin
);
}).
then
(
function
()
{
assert
.
equal
(
0
,
manager
.
getPlugins
().
length
);
assert
.
equal
(
-
1
,
testDiv
.
innerHTML
.
indexOf
(
"
tab-pane
"
));
});
});
it
(
'
removing non existing plugin
'
,
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment