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
ac0949fc
Commit
ac0949fc
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
data is updated in a table after project is saved
parent
7699180d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!115
Resolve "admin panel should use API"
,
!114
Resolve "admin panel should use API"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend-js/src/main/js/gui/admin/MapsAdminPanel.js
+51
-18
51 additions, 18 deletions
frontend-js/src/main/js/gui/admin/MapsAdminPanel.js
with
51 additions
and
18 deletions
frontend-js/src/main/js/gui/admin/MapsAdminPanel.js
+
51
−
18
View file @
ac0949fc
...
...
@@ -72,6 +72,7 @@ MapsAdminPanel.prototype._createMenuRow = function() {
};
MapsAdminPanel
.
prototype
.
_createProjectTableRow
=
function
()
{
var
self
=
this
;
var
projectsRow
=
Functions
.
createElement
({
type
:
"
div
"
,
style
:
"
display:table-row; width:100%
"
,
...
...
@@ -86,6 +87,9 @@ MapsAdminPanel.prototype._createProjectTableRow = function() {
projectsRow
.
appendChild
(
projectsTable
);
$
(
projectsTable
).
DataTable
({
fnRowCallback
:
function
(
nRow
,
aData
,
iDisplayIndex
)
{
nRow
.
setAttribute
(
'
id
'
,
aData
[
0
]);
},
columns
:
[
{
title
:
'
ProjectId
'
,
},
{
...
...
@@ -102,6 +106,16 @@ MapsAdminPanel.prototype._createProjectTableRow = function() {
title
:
'
Remove
'
,
},
],
});
$
(
projectsTable
).
on
(
"
click
"
,
"
[name='removeProject']
"
,
function
()
{
var
button
=
this
;
return
self
.
removeProject
(
$
(
button
).
attr
(
"
data
"
)).
then
(
null
,
GuiConnector
.
alert
);
});
$
(
projectsTable
).
on
(
"
click
"
,
"
[name='showEditDialog']
"
,
function
()
{
var
button
=
this
;
return
self
.
showEditDialog
(
$
(
button
).
attr
(
"
data
"
)).
then
(
null
,
GuiConnector
.
alert
);
});
return
projectsRow
;
};
...
...
@@ -114,19 +128,22 @@ MapsAdminPanel.prototype.init = function() {
});
};
MapsAdminPanel
.
prototype
.
projectToTableRow
=
function
(
project
)
{
MapsAdminPanel
.
prototype
.
projectToTableRow
=
function
(
project
,
row
)
{
var
self
=
this
;
var
disease
=
self
.
getHtmlStringLink
(
project
.
getDisease
());
var
organism
=
self
.
getHtmlStringLink
(
project
.
getOrganism
());
var
row
=
[
project
.
getProjectId
(),
//
project
.
getName
(),
//
disease
,
//
organism
,
//
project
.
getStatus
(),
//
"
<button name='showEditDialog' data='
"
+
project
.
getProjectId
()
+
"
'>EDIT</button>
"
,
//
"
<button name='removeProject' data='
"
+
project
.
getProjectId
()
+
"
'>REMOVE</button>
"
,
//
];
if
(
row
===
undefined
)
{
row
=
[];
}
row
[
0
]
=
project
.
getProjectId
();
row
[
1
]
=
project
.
getName
();
row
[
2
]
=
disease
;
row
[
3
]
=
organism
;
row
[
4
]
=
project
.
getStatus
();
row
[
5
]
=
"
<button name='showEditDialog' data='
"
+
project
.
getProjectId
()
+
"
'>EDIT</button>
"
;
row
[
6
]
=
"
<button name='removeProject' data='
"
+
project
.
getProjectId
()
+
"
'>REMOVE</button>
"
;
return
row
;
};
...
...
@@ -148,19 +165,35 @@ MapsAdminPanel.prototype.setProjects = function(projects) {
var
dataTable
=
$
(
$
(
"
[name='projectsTable']
"
,
self
.
getElement
())[
0
]).
DataTable
();
var
data
=
[];
for
(
var
i
=
0
;
i
<
projects
.
length
;
i
++
)
{
data
.
push
(
self
.
projectToTableRow
(
projects
[
i
]));
var
project
=
projects
[
i
];
var
rowData
=
self
.
projectToTableRow
(
project
)
self
.
addUpdateListener
(
project
,
rowData
);
data
.
push
(
rowData
);
}
dataTable
.
clear
().
rows
.
add
(
data
).
draw
();
$
(
"
[name='projectsTable']
"
,
self
.
getElement
()).
on
(
"
click
"
,
"
[name='removeProject']
"
,
function
()
{
var
button
=
this
;
return
self
.
removeProject
(
$
(
button
).
attr
(
"
data
"
)).
then
(
null
,
GuiConnector
.
alert
);
});
};
$
(
"
[name='projectsTable']
"
,
self
.
getElement
()).
on
(
"
click
"
,
"
[name='showEditDialog']
"
,
function
()
{
var
button
=
this
;
return
self
.
showEditDialog
(
$
(
button
).
attr
(
"
data
"
)).
then
(
null
,
GuiConnector
.
alert
);
});
MapsAdminPanel
.
prototype
.
addUpdateListener
=
function
(
project
,
dataTableRow
)
{
var
self
=
this
;
var
listenerName
=
"
PROJECT_LIST_LISTENER
"
;
var
listeners
=
project
.
getListeners
(
"
onreload
"
);
for
(
var
i
=
0
;
i
<
listeners
.
length
;
i
++
)
{
if
(
listeners
[
i
].
listenerName
===
listenerName
)
{
project
.
removeListener
(
"
onreload
"
,
listeners
[
i
]);
}
}
var
listener
=
function
()
{
self
.
projectToTableRow
(
project
,
dataTableRow
);
var
row
=
$
(
$
(
"
[name='projectsTable']
"
,
self
.
getElement
())[
0
]).
DataTable
().
row
(
"
#
"
+
project
.
getProjectId
());
if
(
row
.
length
>
0
)
{
row
.
data
(
dataTableRow
).
draw
();
}
};
listener
.
listenerName
=
listenerName
;
project
.
addListener
(
"
onreload
"
,
listener
);
};
MapsAdminPanel
.
prototype
.
onAddClicked
=
function
()
{
...
...
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