Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
minerva
core
Commits
eef9fb5d
There was a problem fetching the pipeline metadata.
Commit
eef9fb5d
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
plugins loaded few times have few entries in plugin dialog
parent
996f1e2d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!140
Plugin framework fixes
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend-js/src/main/js/gui/PluginDialog.js
+25
-52
25 additions, 52 deletions
frontend-js/src/main/js/gui/PluginDialog.js
frontend-js/src/test/js/gui/OptionsMenu-test.js
+1
-2
1 addition, 2 deletions
frontend-js/src/test/js/gui/OptionsMenu-test.js
with
26 additions
and
54 deletions
frontend-js/src/main/js/gui/PluginDialog.js
+
25
−
52
View file @
eef9fb5d
"
use strict
"
;
var
Promise
=
require
(
'
bluebird
'
);
var
AbstractGuiElement
=
require
(
'
./AbstractGuiElement
'
);
var
GuiConnector
=
require
(
'
../GuiConnector
'
);
var
GuiUtils
=
require
(
'
./leftPanel/GuiUtils
'
);
...
...
@@ -56,12 +53,10 @@ PluginDialog.prototype._createPluginGui = function () {
var
pluginManager
=
self
.
getPluginManager
();
var
loadedPlugins
=
[];
var
processedPlugins
=
[];
var
plugins
=
pluginManager
.
getPlugins
();
var
i
;
for
(
i
=
0
;
i
<
plugins
.
length
;
i
++
)
{
loadedPlugins
[
plugins
[
i
].
getOptions
().
url
]
=
true
;
processedPlugins
[
plugins
[
i
].
getOptions
().
url
]
=
false
;
}
for
(
i
=
0
;
i
<
self
.
_knownPlugins
.
length
;
i
++
)
{
...
...
@@ -75,23 +70,7 @@ PluginDialog.prototype._createPluginGui = function () {
});
pluginUrl
.
readOnly
=
true
;
var
button
;
if
(
loadedPlugins
[
url
])
{
button
=
Functions
.
createElement
({
type
:
"
button
"
,
content
:
"
UNLOAD
"
,
onclick
:
function
()
{
var
promises
=
[];
for
(
var
i
=
0
;
i
<
plugins
.
length
;
i
++
)
{
if
(
plugins
[
i
].
getOptions
().
url
===
$
(
this
).
data
(
"
url
"
))
{
promises
.
push
(
pluginManager
.
removePlugin
(
plugins
[
i
]));
}
}
return
Promise
.
all
(
promises
).
then
(
function
()
{
self
.
close
();
}).
then
(
null
,
GuiConnector
.
alert
);
}
});
}
else
{
if
(
!
loadedPlugins
[
url
])
{
button
=
Functions
.
createElement
({
type
:
"
button
"
,
content
:
"
LOAD
"
,
...
...
@@ -103,39 +82,33 @@ PluginDialog.prototype._createPluginGui = function () {
});
}
$
(
button
).
data
(
"
url
"
,
url
);
processedPlugins
[
url
]
=
true
;
pluginFormTab
.
appendChild
(
guiUtils
.
createTableRow
([
Functions
.
createElement
({
type
:
"
span
"
}),
pluginUrl
,
button
]));
}
for
(
url
in
loadedPlugins
)
{
if
(
loadedPlugins
.
hasOwnProperty
(
url
)
&&
!
processedPlugins
[
url
])
{
pluginUrl
=
Functions
.
createElement
({
type
:
"
input
"
,
value
:
url
,
style
:
"
color:#999999
"
});
pluginUrl
.
readOnly
=
true
;
button
=
Functions
.
createElement
({
type
:
"
button
"
,
content
:
"
UNLOAD
"
,
onclick
:
function
()
{
var
promises
=
[];
for
(
var
i
=
0
;
i
<
plugins
.
length
;
i
++
)
{
if
(
plugins
[
i
].
getOptions
().
url
===
$
(
this
).
data
(
"
url
"
))
{
promises
.
push
(
pluginManager
.
removePlugin
(
plugins
[
i
]));
}
}
return
Promise
.
all
(
promises
).
then
(
function
()
{
self
.
close
();
}).
then
(
null
,
GuiConnector
.
alert
);
}
});
$
(
button
).
data
(
"
url
"
,
url
);
for
(
i
=
0
;
i
<
plugins
.
length
;
i
++
)
{
var
plugin
=
plugins
[
i
];
var
removePlugin
=
(
function
()
{
var
pluginToRemove
=
plugin
;
return
function
()
{
return
pluginManager
.
removePlugin
(
pluginToRemove
).
then
(
function
()
{
self
.
close
();
}).
then
(
null
,
GuiConnector
.
alert
);
}
})();
pluginUrl
=
Functions
.
createElement
({
type
:
"
input
"
,
value
:
plugins
[
i
].
getOptions
().
url
,
style
:
"
color:#999999
"
});
pluginUrl
.
readOnly
=
true
;
button
=
Functions
.
createElement
({
type
:
"
button
"
,
content
:
"
UNLOAD
"
,
onclick
:
removePlugin
});
pluginFormTab
.
appendChild
(
guiUtils
.
createTableRow
([
Functions
.
createElement
({
type
:
"
span
"
}),
pluginUrl
,
button
]));
pluginFormTab
.
appendChild
(
guiUtils
.
createTableRow
([
Functions
.
createElement
({
type
:
"
span
"
}),
pluginUrl
,
button
]));
}
}
};
...
...
@@ -173,8 +146,8 @@ PluginDialog.prototype.close = function () {
PluginDialog
.
prototype
.
destroy
=
function
()
{
var
self
=
this
;
var
div
=
self
.
getElement
();
if
(
$
(
self
.
getElement
()
).
hasClass
(
"
ui-dialog-content
"
))
{
$
(
self
.
getElement
()
).
dialog
(
"
destroy
"
);
if
(
$
(
div
).
hasClass
(
"
ui-dialog-content
"
))
{
$
(
div
).
dialog
(
"
destroy
"
);
}
};
...
...
This diff is collapsed.
Click to expand it.
frontend-js/src/test/js/gui/OptionsMenu-test.js
+
1
−
2
View file @
eef9fb5d
...
...
@@ -47,5 +47,4 @@ describe('OptionsMenu', function () {
return
pluginManager
.
destroy
();
});
});
})
;
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment