Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Non-Auth changes #340

Open
wants to merge 5 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions js/app/Data/BaseTiledFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,11 @@ define([
if (request.status == 403) {
data.level = 'info';
data.toString = function () {
var res = $("<span>You have to be registered on GFW in order to see vessel information. You can <a href='javascript: void(0);'>register here</a>. If you are already registred, you need to <a href='javascript: void(0);'>login</a>.");
var res = $("<span class='auth_required'><a href='javascript: void(0);'>Log in</a><br /> to view vessel identity<br /> or<br /> <a href='javascript: void(0);'>Sign up</a> for free.");
res.find('a').click(function () {
new PopupAuth(data.auth_location, function (success) {
if (success) {
new PopupAuth(data.auth_location, function (args) {
if (args) {
if (args.headers != undefined) self.manager.setHeaders(args.headers);
cb(null, null);
getSelectionInfo(fallbackLevel, withCredentials);
}
Expand Down
1 change: 1 addition & 0 deletions js/app/Data/DataManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ define([
var formatClass = Format.formatClasses[source.spec.type];

source.source = new formatClass(source.spec.args);
source.source.manager = self;
source.source.setHeaders(self.headers);
source.source.events.on({
error: self.handleError.bind(self, source),
Expand Down
27 changes: 21 additions & 6 deletions js/app/PopupAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,29 @@ define([
self.id = 'pelagos-client-auth-' + self.guuid()
PopupAuth.open_dialogs[self.id] = self;

self.window = window.open(login_url, self.id, 'directories=0,titlebar=0,toolbar=0,location=0,status=0,menubar=0,scrollbars=no,resizable=no,width=400,height=350');
var options = {
directories: 0,
titlebar: 0,
toolbar: 0,
location: 0,
status: 0,
menubar: 0,
scrollbars: "yes",
resizable: "yes",
fullscreen: "yes",
width: screen.width,
height: screen.height
};
options = Object.keys(options).map(function (key) { return key + "=" + options[key].toString(); }).join(",");

self.window = window.open(login_url, self.id, options);
},

done: function (success) {
done: function (args) {
var self = this;
if (success == undefined) success = true;
if (args == undefined) args = true;
delete PopupAuth.open_dialogs[self.id];
self.cb(success);
self.cb(args);
},

guuid: function () {
Expand All @@ -34,8 +49,8 @@ define([
});
PopupAuth.open_dialogs = {};

window.popup_auth_done = function (window_name, success) {
PopupAuth.open_dialogs[window_name].done(success);
window.popup_auth_done = function (window_name, args) {
PopupAuth.open_dialogs[window_name].done(args);
};

return PopupAuth;
Expand Down
9 changes: 9 additions & 0 deletions js/app/Visualization/UI/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,15 @@ hyperwall is: 3 1280px screens wide and 3 720pxs screens high.
display: none;
}

.auth_required {
text-align: center;
display: block;
width: 100%;
a {
text-decoration: underline;
}
}

#w {
position: absolute;
pointer-events: none;
Expand Down