Commit 16327644 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '982-add-an-icon-next-to-locker-icon-in-userview-to-enter-admin-panel' into 'master'

Resolve "Add an icon next to locker icon in USERview to enter admin panel"

Closes #982

See merge request minerva/core!988
parents f67c36ac b0553187
......@@ -11,6 +11,9 @@ minerva (15.0.0~alpha.0) stable; urgency=medium
* Small improvement: list of submaps is sorted alphabetically (#962)
* Small improvement: notification about new releases of minerva added in
admin panel (#961)
* Small improvement: font awesome upgraded to 5.1 (new icon styles)
* Small improvement: header contains login/logout button and access admin
panel button (#982)
* Bug fix: position of structural state is preserved on upload CellDesigner
file (#671)
* Bug fix: problematic notes doesn't crash CellDesigner upload (#968)
......
......@@ -4,6 +4,11 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@fortawesome/fontawesome-free": {
"version": "5.11.2",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.11.2.tgz",
"integrity": "sha512-XiUPoS79r1G7PcpnNtq85TJ7inJWe0v+b5oZJZKb0pGHNIV6+UiNeQWiFGmuQ0aj7GEhnD/v9iqxIsjuRKtEnQ=="
},
"@nodelib/fs.scandir": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.1.tgz",
......
......@@ -37,6 +37,7 @@
"uglifyjs": "^2.4.10"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^5.11.2",
"autocomplete.js": "^0.36.0",
"bootstrap": "^4.3.1",
"csv-stringify": "^5.3.1",
......
......@@ -4,6 +4,7 @@ var fs = require('fs');
var CleanCSS = require('clean-css');
var files = [
{source: "node_modules/@fortawesome/fontawesome-free/css/all.css", targetBase: "../../minerva/resources/css/"},
{source: "node_modules/spectrum-colorpicker/spectrum.css"},
{source: "node_modules/bootstrap/dist/css/bootstrap.css"},
{source: "node_modules/jquery-ui/themes/base/jquery.ui.all.css", targetBase: "../../minerva/resources/jquery-ui/"},
......
......@@ -35,6 +35,8 @@ h5 {
background-color: #333333;
color: #ffffff;
display: block;
padding-left: 8px;
padding-right: 8px;
}
.minerva-header a:link, .minerva-header a:visited {
......@@ -46,7 +48,8 @@ h5 {
transition: background-color 0.4s ease-in-out 0s;
font-size: 13px;
font-weight: 900;
padding-left: 15px;
padding-left: 8px;
padding-right: 8px;
}
.minerva-header-right-menu {
......@@ -77,7 +80,8 @@ h5 {
}
.minerva-header .minerva-menu-link {
padding-right: 5px;
padding-left: 8px;
padding-right: 8px;
float: right;
}
......@@ -211,7 +215,7 @@ h5 {
.minerva-extend-session-button {
background-color: #CC0000;
margin-left: 10px;
border: 0px;
border: 0;
}
.minerva-extend-session-button:hover {
......@@ -479,7 +483,7 @@ h5 {
}
table.minerva-publication-table td {
padding: 0px;
padding: 0;
}
input.minerva-input-text, input.minerva-input-password {
......@@ -1252,4 +1256,4 @@ input[type=file] {
a {
color: #337ab7;
}
\ No newline at end of file
}
......@@ -21,6 +21,7 @@ var xss = require('xss');
* @param {boolean} [params.optionsMenu=false]
* @param {Configuration} params.configuration
* @param {Project} [params.project]
* @param {LeftPanel} params.parent
* @param {ServerConnector} [params.serverConnector]
*
* @constructor
......@@ -35,7 +36,7 @@ function Header(params) {
optionsMenu: params.optionsMenu
};
self._createHeaderGui(guiParams);
self._createHeaderGui(guiParams, params.parent);
}
Header.prototype = Object.create(AbstractGuiElement.prototype);
......@@ -45,9 +46,10 @@ Header.prototype.constructor = Header;
*
* @param {Object} guiParams
* @param {boolean} guiParams.optionsMenu
* @param {LeftPanel} parent
* @private
*/
Header.prototype._createHeaderGui = function (guiParams) {
Header.prototype._createHeaderGui = function (guiParams, parent) {
var self = this;
self.getElement().className = "minerva-header";
......@@ -66,14 +68,40 @@ Header.prototype._createHeaderGui = function (guiParams) {
loadingDiv.appendChild(loadingImg);
this.setControlElement(PanelControlElementType.FOOTER_LOADING_DIV, loadingDiv);
var link = Functions.createElement({
self.getElement().appendChild(Functions.createElement({
type: "a",
style: "padding-right:15px; float:right",
content: '<i class="fa fa-lock" style="font-size:17px"></i>&nbsp;',
className: "minerva-menu-link",
content: '<i class="fa fa-user-cog" style="font-size:17px"></i>&nbsp;',
href: self.getServerConnector().getServerBaseUrl() + "admin.xhtml?id=" + projectId,
title: "Admin panel",
xss: false
});
link.href = self.getServerConnector().getServerBaseUrl() + "admin.xhtml?id=" + projectId;
self.getElement().appendChild(link);
}));
if (self.getServerConnector().getSessionData().getLogin() === "anonymous") {
self.getElement().appendChild(Functions.createElement({
type: "a",
className: "minerva-menu-link",
content: '<i class="fa fa-lock" style="font-size:17px"></i>&nbsp;',
href: "#",
onclick: function() {
return parent.getLoginDialog().open();
},
title: "Login",
xss: false
}));
} else {
self.getElement().appendChild(Functions.createElement({
type: "a",
className: "minerva-menu-link",
content: '<i class="fa fa-lock-open" style="font-size:17px"></i>&nbsp;',
href: "#",
onclick: function() {
return self.getServerConnector().logout().catch(GuiConnector.alert);
},
title: "Logout",
xss: false
}));
}
if (guiParams.optionsMenu) {
var optionsElement = Functions.createElement({type: "ul", className: "minerva-options-menu"});
......
......@@ -166,7 +166,7 @@ CommentsAdminPanel.prototype.commentToTableRow = function (comment, disable) {
if (comment.isRemoved()) {
remove = "YES (" + comment.getRemoveReason() + ")";
} else {
remove = "<button name='removeComment' data='" + comment.getId() + "'" + disabled + "><i class='fa fa-trash-o' style='font-size:17px'></button>";
remove = "<button name='removeComment' data='" + comment.getId() + "'" + disabled + "><i class='fa fa-trash-alt'></button>";
}
var author = comment.getAuthor();
......
......@@ -444,7 +444,7 @@ EditGenomeDialog.prototype.geneMappingToTableRow = function (geneMapping) {
row[0] = geneMapping.getName();
row[1] = geneMapping.getSourceUrl();
row[2] = geneMapping.getProgressStatus();
row[3] = "<button name='removeMapping' data='" + geneMapping.getId() + "'><i class='fa fa-trash-o' style='font-size:17px'></button>";
row[3] = "<button name='removeMapping' data='" + geneMapping.getId() + "'><i class='fa fa-trash-alt'></button>";
return row;
};
/**
......
......@@ -1022,7 +1022,7 @@ EditProjectDialog.prototype.overlayToTableRow = function (overlay, users) {
row[6] = downloadSourceButton;
row[7] = "<button name='removeOverlay' data='" + id + "'" + disabled + "><i class='fa fa-trash-o' style='font-size:17px'></button>";
row[7] = "<button name='removeOverlay' data='" + id + "'" + disabled + "><i class='fa fa-trash-alt'></button>";
return row;
};
......
......@@ -237,8 +237,8 @@ GenomeAdminPanel.prototype.genomeToTableRow = function (genome, user) {
if (user.hasPrivilege(self.getConfiguration().getPrivilegeType(PrivilegeType.IS_ADMIN))) {
disabled = "";
}
row[5] = "<button name='editGenome' data='" + genome.getId() + "'" + disabled + "><i class='fa fa-edit' style='font-size:17px'></i></button>";
row[6] = "<button name='removeGenome' data='" + genome.getId() + "'" + disabled + "><i class='fa fa-trash-o' style='font-size:17px'></button>";
row[5] = "<button name='editGenome' data='" + genome.getId() + "'" + disabled + "><i class='fa fa-edit'></i></button>";
row[6] = "<button name='removeGenome' data='" + genome.getId() + "'" + disabled + "><i class='fa fa-trash-alt'></button>";
return row;
};
......
......@@ -234,7 +234,7 @@ MapsAdminPanel.prototype.projectToTableRow = function (project, row, user) {
var icon;
if (project.hasLogEntries()) {
icon = "<i class='fa fa-exclamation-triangle' style='font-size:18px; font-weight:400; padding-right:10px;color:black'></i>";
icon = "<i class='fa fa-exclamation-triangle' style='font-size:18px; padding-right:10px;color:black'></i>";
if (isAdmin) {
status += "<a name='showLogEntries' href='#' data='" + project.getProjectId() + "'>" + icon + "</a>";
} else {
......@@ -275,12 +275,12 @@ MapsAdminPanel.prototype.projectToTableRow = function (project, row, user) {
disabledRemove = "";
}
row[7] = "<button name='showEditDialog' data='" + project.getProjectId() + "'" + disabledEdit + "><i class='fa fa-edit' style='font-size:17px'></i></button>";
row[7] = "<button name='showEditDialog' data='" + project.getProjectId() + "'" + disabledEdit + "><i class='fa fa-edit'></i></button>";
if (self.getConfiguration().getOption(ConfigurationType.DEFAULT_MAP).getValue() === projectId) {
disabledRemove = " disabled ";
}
row[8] = "<button name='removeProject' data='" + project.getProjectId() + "'" + disabledRemove + "><i class='fa fa-trash-o' style='font-size:17px'></button>";
row[8] = "<button name='removeProject' data='" + project.getProjectId() + "'" + disabledRemove + "><i class='fa fa-trash-alt'></button>";
return row;
};
......
......@@ -197,7 +197,7 @@ PluginAdminPanel.prototype.pluginToTableRow = function (plugin) {
row[0] = plugin.getName();
row[1] = plugin.getVersion();
row[2] = plugin.getUrls();
row[3] = "<button name='removePlugin' data='" + plugin.getHash() + "' ><i class='fa fa-trash-o' style='font-size:17px'></button>";
row[3] = "<button name='removePlugin' data='" + plugin.getHash() + "' ><i class='fa fa-trash-alt'></button>";
return row;
};
......
......@@ -345,12 +345,12 @@ UsersAdminPanel.prototype.userToTableRow = function (user, row) {
}
}
row[5] = "<button name='showEditDialog' data='" + user.getLogin() + "'><i class='fa fa-edit' style='font-size:17px'></i></button>";
row[5] = "<button name='showEditDialog' data='" + user.getLogin() + "'><i class='fa fa-edit'></i></button>";
var disabled = "";
if (user.getLogin() === "anonymous") {
disabled = " disabled ";
}
row[6] = "<button name='removeUser' " + disabled + " data='" + user.getLogin() + "'><i class='fa fa-trash-o' style='font-size:17px'></i></button>";
row[6] = "<button name='removeUser' " + disabled + " data='" + user.getLogin() + "'><i class='fa fa-trash-alt'></i></button>";
return row;
};
......
......@@ -59,7 +59,8 @@ LeftPanel.prototype._createPanelGui = function () {
element: headerDiv,
customMap: self.getMap(),
optionsMenu: true,
configuration: self.getConfiguration()
configuration: self.getConfiguration(),
parent: this
});
self.getElement().appendChild(headerDiv);
......
......@@ -262,7 +262,7 @@ OverlayPanel.prototype.createOverlayRow = function (overlay, checked, disabled)
if (disabled) {
var warningDiv = Functions.createElement({
type: "div",
content: "<i class='fa fa-exclamation-triangle' style='font-size:18px; font-weight:400; padding-right:10px;color:orange'></i>",
content: "<i class='fa fa-exclamation-triangle' style='font-size:18px; padding-right:10px;color:orange'></i>",
xss: false
});
warningDiv.title = "You did not consent to terms of the license of Google Maps Platform. Click the \"Edit\" button to do so.";
......@@ -331,7 +331,7 @@ OverlayPanel.prototype.overlayToDataRow = function (overlay, checked, disabled)
result[1] += overlay.getDeprecatedColumns()[j] + ", ";
}
result[1] += " This format will be not supported in minerva 16 and higher. Please re-upload data set using new format.'>" +
"<i class='fa fa-exclamation-triangle' style='font-size:18px; font-weight:400; padding-right:10px;color:orange'></i>" + overlay.getName() + "</div>"
"<i class='fa fa-exclamation-triangle' style='font-size:18px; padding-right:10px;color:orange'></i>" + overlay.getName() + "</div>"
} else {
result[1] = overlay.getName();
}
......@@ -339,7 +339,7 @@ OverlayPanel.prototype.overlayToDataRow = function (overlay, checked, disabled)
if (overlay.getInputDataAvailable()) {
if (disabled) {
result[2] = "<div title='You did not consent to terms of the license of Google Maps Platform. Click the \"Edit\" button to do so.'>" +
"<i class='fa fa-exclamation-triangle' style='font-size:18px; font-weight:400; padding-right:10px;color:orange'></i></div>";
"<i class='fa fa-exclamation-triangle' style='font-size:18px; padding-right:10px;color:orange'></i></div>";
} else {
var checkedString = "";
if (checked) {
......
......@@ -64,7 +64,13 @@ describe('Header', function () {
return header.init().then(function () {
assert.ok($(".dropdown-menu").css('display') === 'none');
return $(".minerva-menu-link", testDiv)[0].onclick();
var fun = null;
$(".minerva-menu-link", testDiv).each(function (k, v) {
if (v.innerHTML.indexOf("fa-bars") >= 0) {
fun = v.onclick;
}
});
return fun();
}).then(function () {
assert.notOk($(".dropdown-menu").css('display') === 'none');
return header.destroy();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment