You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by kb...@apache.org on 2020/03/09 17:54:59 UTC
[atlas] branch master updated: ATLAS-3555 : UI: Make Beta UI as
primary UI for Atlas
This is an automated email from the ASF dual-hosted git repository.
kbhatt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/master by this push:
new aa4bbb0 ATLAS-3555 : UI: Make Beta UI as primary UI for Atlas
aa4bbb0 is described below
commit aa4bbb08f0b18cfbfc7e0f54e5021bf702445bec
Author: kevalbhatt <kb...@apache.org>
AuthorDate: Thu Mar 5 13:06:04 2020 +0530
ATLAS-3555 : UI: Make Beta UI as primary UI for Atlas
---
dashboardv2/public/css/scss/theme.scss | 8 ++
dashboardv2/public/index.html.tpl | 3 -
dashboardv2/public/js/main.js | 5 +-
dashboardv2/public/js/modules/atlasLogin.js | 138 +++++++++++++--------
dashboardv2/public/js/router/Router.js | 10 --
dashboardv2/public/js/templates/site/Header.html | 3 +-
dashboardv2/public/js/utils/Globals.js | 9 +-
dashboardv2/public/js/utils/Utils.js | 8 +-
dashboardv2/public/js/views/site/Header.js | 15 ++-
dashboardv3/public/index.html.tpl | 3 -
dashboardv3/public/js/main.js | 3 +
dashboardv3/public/js/modules/atlasLogin.js | 138 +++++++++++++--------
dashboardv3/public/js/router/Router.js | 10 --
dashboardv3/public/js/templates/site/Header.html | 1 +
dashboardv3/public/js/utils/Globals.js | 9 +-
dashboardv3/public/js/utils/Utils.js | 8 +-
dashboardv3/public/js/views/site/Header.js | 12 +-
distro/src/conf/atlas-application.properties | 5 +
.../apache/atlas/web/resources/AdminResource.java | 9 ++
19 files changed, 241 insertions(+), 156 deletions(-)
diff --git a/dashboardv2/public/css/scss/theme.scss b/dashboardv2/public/css/scss/theme.scss
index 0589e09..aad0dfa 100644
--- a/dashboardv2/public/css/scss/theme.scss
+++ b/dashboardv2/public/css/scss/theme.scss
@@ -26,6 +26,10 @@ header.atlas-header {
background-color: $white;
border-bottom: 1px $color_mystic_approx solid;
+ table {
+ width: 100%;
+ }
+
.navbar-nav {
display: table;
@@ -124,6 +128,10 @@ header.atlas-header {
overflow: hidden;
@include clearfix();
}
+
+ .tab-content>.tab-pane.active {
+ padding: 18px;
+ }
}
}
diff --git a/dashboardv2/public/index.html.tpl b/dashboardv2/public/index.html.tpl
index a6a999e..7cd86bd 100644
--- a/dashboardv2/public/index.html.tpl
+++ b/dashboardv2/public/index.html.tpl
@@ -73,9 +73,6 @@
</div>
</div>
</div>
- <div class="footer-content">
- <a href="javascript:void(0)" id="sUI">Switch to Beta UI</a>
- </div>
</div>
<!-- build:js scripts/main.js -->
<script data-main="js/main.js?bust=<%- bust %>" src="js/libs/requirejs/require.js?bust=<%- bust %>"></script>
diff --git a/dashboardv2/public/js/main.js b/dashboardv2/public/js/main.js
index 75e16c3..41af465 100644
--- a/dashboardv2/public/js/main.js
+++ b/dashboardv2/public/js/main.js
@@ -175,7 +175,7 @@ require.config({
'sparkline': 'libs/sparkline/jquery.sparkline.min',
'table-dragger': 'libs/table-dragger/table-dragger',
'jstree': 'libs/jstree/jstree.min',
- 'jquery-steps': 'libs/jquery-steps/jquery.steps.min',
+ 'jquery-steps': 'libs/jquery-steps/jquery.steps.min'
},
/**
@@ -252,6 +252,9 @@ require(['App',
}
}
}
+ if (response['atlas.ui.default.version'] !== undefined) {
+ Globals.DEFAULT_UI = response['atlas.ui.default.version'];
+ }
}
--that.asyncFetchCounter;
startApp();
diff --git a/dashboardv2/public/js/modules/atlasLogin.js b/dashboardv2/public/js/modules/atlasLogin.js
index b3c2776..d2d19d1 100644
--- a/dashboardv2/public/js/modules/atlasLogin.js
+++ b/dashboardv2/public/js/modules/atlasLogin.js
@@ -16,11 +16,10 @@
* limitations under the License.
*/
-
//Define indexOf for IE
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj, start) {
- for (var i = (start || 0); i < this.length; i++) {
+ for (var i = start || 0; i < this.length; i++) {
if (this[i] == obj) {
return i;
}
@@ -31,103 +30,128 @@ if (!Array.prototype.indexOf) {
if (!String.prototype.startsWith) {
String.prototype.startsWith = function(str, matchStr) {
- return str.lastIndexOf(matchStr, 0) === 0
- }
+ return str.lastIndexOf(matchStr, 0) === 0;
+ };
}
function doLogin() {
+ var userName = $("#username")
+ .val()
+ .trim();
+ var passwd = $("#password")
+ .val()
+ .trim();
- var userName = $('#username').val().trim();
- var passwd = $('#password').val().trim();
-
- if (userName === '' || passwd === '') {
- $('#errorBox').show();
- $('#signInLoading').hide();
- $('#signIn').removeAttr('disabled');
- $('#errorBox .errorMsg').text("The username or password you entered is blank..");
+ if (userName === "" || passwd === "") {
+ $("#errorBox").show();
+ $("#signInLoading").hide();
+ $("#signIn").removeAttr("disabled");
+ $("#errorBox .errorMsg").text("The username or password you entered is blank..");
return false;
}
var baseUrl = getBaseUrl();
- if (baseUrl.lastIndexOf('/') != (baseUrl.length - 1)) {
- if (baseUrl) {
- baseUrl = baseUrl + '/';
- } else {
- baseUrl = '/';
- }
- }
- var url = baseUrl + 'j_spring_security_check';
$.ajax({
data: {
j_username: userName,
j_password: passwd
},
- url: url,
- type: 'POST',
+ url: baseUrl + "j_spring_security_check",
+ type: "POST",
headers: {
"cache-control": "no-cache"
},
success: function() {
- var indexpath = "index.html";
- if (window.localStorage.atlas_ui === "beta") {
- //load beta version
- indexpath = '/n/index.html';
- }
- if (location.hash.length > 2) {
- window.location.replace((indexpath + location.hash));
- } else {
- window.location.replace(indexpath);
- }
+ redirect(baseUrl);
},
error: function(jqXHR, textStatus, err) {
- $('#signIn').removeAttr('disabled');
- $('#signInLoading').css("visibility", "hidden");
+ $("#signIn").removeAttr("disabled");
+ $("#signInLoading").css("visibility", "hidden");
if (jqXHR.status && jqXHR.status == 412) {
- $('#errorBox').hide();
- $('#errorBoxUnsynced').show();
+ $("#errorBox").hide();
+ $("#errorBoxUnsynced").show();
} else {
try {
var resp = JSON.parse(jqXHR.responseText);
if (resp.msgDesc.startsWith("Username not found") || resp.msgDesc.startsWith("Wrong password")) {
- $('#errorBox .errorMsg').text("Invalid User credentials. Please try again.");
+ $("#errorBox .errorMsg").text("Invalid User credentials. Please try again.");
} else if (resp.msgDesc.startsWith("User role credentials is not set properly")) {
- $('#errorBox .errorMsg').text("User role or credentials is not set properly");
+ $("#errorBox .errorMsg").text("User role or credentials is not set properly");
} else {
- $('#errorBox .errorMsg').text("Error while authentication");
+ $("#errorBox .errorMsg").text("Error while authentication");
}
} catch (err) {
- $('#errorBox .errorMsg').text("Something went wrong");
+ $("#errorBox .errorMsg").text("Something went wrong");
}
- $('#errorBox').show();
- $('#errorBoxUnsynced').hide();
+ $("#errorBox").show();
+ $("#errorBoxUnsynced").hide();
+ }
+ }
+ });
+}
+
+function redirect(baseUrl) {
+ $.ajax({
+ url: baseUrl + "api/atlas/admin/session",
+ success: function(data) {
+ var PRIMARY_UI = "v2",
+ indexpath = "/n/index.html";
+ if (data && data["atlas.ui.default.version"]) {
+ PRIMARY_UI = data["atlas.ui.default.version"];
+ }
+ if (PRIMARY_UI !== "v2") {
+ indexpath = "index.html";
+ }
+ if (window.localStorage.last_ui_load === "v1") {
+ indexpath = "index.html";
+ } else if (window.localStorage.last_ui_load === "v2") {
+ indexpath = "/n/index.html";
+ }
+ if (location.hash.length > 2) {
+ window.location.replace(indexpath + location.hash);
+ } else {
+ window.location.replace(indexpath);
}
+ },
+ error: function() {
+ window.location.replace("index.html");
}
});
}
function getBaseUrl() {
if (!window.location.origin) {
- window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
+ window.location.origin =
+ window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
+ }
+ var baseUrl = window.location.origin + window.location.pathname.substring(window.location.pathname.indexOf("/", 2) + 1, 0);
+
+ if (baseUrl.lastIndexOf("/") != baseUrl.length - 1) {
+ if (baseUrl) {
+ baseUrl = baseUrl + "/";
+ } else {
+ baseUrl = "/";
+ }
}
- return window.location.origin + window.location.pathname.substring(window.location.pathname
- .indexOf('/', 2) + 1, 0);
+ return baseUrl;
}
+
$(function() {
// register handlers
- if (!('placeholder' in HTMLInputElement.prototype)) {
+ if (!("placeholder" in HTMLInputElement.prototype)) {
$("#username , #password").placeholder();
}
- $('#signIn').on('click', function() {
- $('#signIn').attr('disabled', true);
- $('#signInLoading').css("visibility", "visible");
+ $("#signIn").on("click", function() {
+ $("#signIn").attr("disabled", true);
+ $("#signInLoading").css("visibility", "visible");
doLogin();
return false;
});
- $('#loginForm').each(function() {
- $('input').keypress(function(e) {
+ $("#loginForm").each(function() {
+ $("input").keypress(function(e) {
// Enter pressed?
if (e.which == 10 || e.which == 13) {
doLogin();
@@ -135,11 +159,15 @@ $(function() {
});
});
- $('#loginForm li[class^=control-group] > input').on('change', function(e) {
- if (e.target.value === '') {
- $(e.target).parent().addClass('error');
+ $("#loginForm li[class^=control-group] > input").on("change", function(e) {
+ if (e.target.value === "") {
+ $(e.target)
+ .parent()
+ .addClass("error");
} else {
- $(e.target).parent().removeClass('error');
+ $(e.target)
+ .parent()
+ .removeClass("error");
}
});
$("#password").on("keyup", function() {
diff --git a/dashboardv2/public/js/router/Router.js b/dashboardv2/public/js/router/Router.js
index 80efb54..74b99b8 100644
--- a/dashboardv2/public/js/router/Router.js
+++ b/dashboardv2/public/js/router/Router.js
@@ -45,7 +45,6 @@ define([
initialize: function(options) {
_.extend(this, _.pick(options, 'entityDefCollection', 'typeHeaders', 'enumDefCollection', 'classificationDefCollection', 'metricCollection'));
this.showRegions();
- this.bindFooterEvent();
this.bindCommonEvents();
this.listenTo(this, 'route', this.postRouteExecute, this);
this.searchVent = new Backbone.Wreqr.EventAggregator();
@@ -73,15 +72,6 @@ define([
}
}
},
- bindFooterEvent: function() {
- $("body").on("click", "#sUI", function() {
- var path = Utils.getBaseUrl(window.location.pathname) + "/n/index.html";
- if (window.location.hash.length > 2) {
- path += window.location.hash;
- }
- window.location.href = path;
- });
- },
bindCommonEvents: function() {
var that = this;
$('body').on('click', 'a.show-stat', function() {
diff --git a/dashboardv2/public/js/templates/site/Header.html b/dashboardv2/public/js/templates/site/Header.html
index c49072a..3467b4d 100644
--- a/dashboardv2/public/js/templates/site/Header.html
+++ b/dashboardv2/public/js/templates/site/Header.html
@@ -40,9 +40,10 @@
<td><a target="_blank" href="http://atlas.apache.org/"><i class="fa fa-question-circle"></i></a></td>
<td>
<a href="javascript:void(0);" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="user-dropdown"><i class="fa fa-user user-circle "></i><span class="userName"></span></a>
- <ul class="dropdown-menu">
+ <ul class="dropdown-menu pull-right multi-level">
<li class="aboutAtlas"><a href="javascript:void(0)">About</a></li>
<li role="separator" class="divider"></li>
+ <li><a data-id="uiSwitch" href="javascript:void(0)">Switch to New</a></li>
<li>
<a href="javascript:void(0)" data-id="signOut"><i class="fa fa-sign-out"></i>Logout</a>
</li>
diff --git a/dashboardv2/public/js/utils/Globals.js b/dashboardv2/public/js/utils/Globals.js
index 53bc51e..a454113 100644
--- a/dashboardv2/public/js/utils/Globals.js
+++ b/dashboardv2/public/js/utils/Globals.js
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-define(['require'], function(require) {
- 'use strict';
+define(["require"], function(require) {
+ "use strict";
var Globals = {};
Globals.settings = {};
@@ -35,7 +35,8 @@ define(['require'], function(require) {
Globals.userLogedIn = {
status: false,
response: {}
- }
- Globals.entityImgPath = "/img/entity-icon/"
+ };
+ Globals.entityImgPath = "/img/entity-icon/";
+ Globals.DEFAULT_UI = "v2";
return Globals;
});
\ No newline at end of file
diff --git a/dashboardv2/public/js/utils/Utils.js b/dashboardv2/public/js/utils/Utils.js
index 53b8714..20035d6 100644
--- a/dashboardv2/public/js/utils/Utils.js
+++ b/dashboardv2/public/js/utils/Utils.js
@@ -225,11 +225,15 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
skipDefaultError = options.skipDefaultError;
defaultErrorMessage = options.defaultErrorMessage;
}
+ var redirectToLoginPage = function() {
+ Utils.localStorage.setValue("last_ui_load", "v1");
+ window.location = 'login.jsp';
+ }
if (error && error.status) {
if (error.status == 401) {
- window.location = 'login.jsp'
+ redirectToLoginPage();
} else if (error.status == 419) {
- window.location = 'login.jsp'
+ redirectToLoginPage();
} else if (error.status == 403) {
Utils.serverErrorHandler(error, "You are not authorized");
} else if (error.status == "0" && error.statusText != "abort") {
diff --git a/dashboardv2/public/js/views/site/Header.js b/dashboardv2/public/js/views/site/Header.js
index e8dfd66..4dc17a4 100644
--- a/dashboardv2/public/js/views/site/Header.js
+++ b/dashboardv2/public/js/views/site/Header.js
@@ -34,7 +34,8 @@ define(['require',
menuHamburger: "[data-id='menuHamburger']",
globalSearch: "[data-id='globalSearch']",
clearGlobalSearch: "[data-id='clearGlobalSearch']",
- signOut: "[data-id='signOut']"
+ signOut: "[data-id='signOut']",
+ uiSwitch: "[data-id='uiSwitch']"
},
events: function() {
var events = {};
@@ -70,13 +71,19 @@ define(['require',
$('body').toggleClass("full-screen");
};
events['click ' + this.ui.signOut] = function() {
-
- Utils.localStorage.setValue("atlas_ui", "classic");
+ Utils.localStorage.setValue("last_ui_load", "v1");
var path = Utils.getBaseUrl(window.location.pathname);
window.location = path + "/logout.html";
};
- return events;
+ events["click " + this.ui.uiSwitch] = function() {
+ var path = Utils.getBaseUrl(window.location.pathname) + "/n/index.html";
+ if (window.location.hash.length > 2) {
+ path += window.location.hash;
+ }
+ window.location.href = path;
+ };
+ return events;
},
initialize: function(options) {
this.bindEvent();
diff --git a/dashboardv3/public/index.html.tpl b/dashboardv3/public/index.html.tpl
index 2edbb65..1baeb12 100644
--- a/dashboardv3/public/index.html.tpl
+++ b/dashboardv3/public/index.html.tpl
@@ -116,9 +116,6 @@
</div>
</div>
</div>
- <div class="footer-content">
- <a href="javascript:void(0)" id="sUI">Switch to Classic UI</a>
- </div>
</div>
<!-- build:js scripts/main.js -->
<script data-main="js/main.js?bust=<%- bust %>" src="js/libs/requirejs/require.js?bust=<%- bust %>"></script>
diff --git a/dashboardv3/public/js/main.js b/dashboardv3/public/js/main.js
index 26fd709..b83bcc3 100644
--- a/dashboardv3/public/js/main.js
+++ b/dashboardv3/public/js/main.js
@@ -262,6 +262,9 @@ require(['App',
}
}
}
+ if (response['atlas.ui.default.version'] !== undefined) {
+ Globals.DEFAULT_UI = response['atlas.ui.default.version'];
+ }
}
--that.asyncFetchCounter;
startApp();
diff --git a/dashboardv3/public/js/modules/atlasLogin.js b/dashboardv3/public/js/modules/atlasLogin.js
index b3c2776..d2d19d1 100644
--- a/dashboardv3/public/js/modules/atlasLogin.js
+++ b/dashboardv3/public/js/modules/atlasLogin.js
@@ -16,11 +16,10 @@
* limitations under the License.
*/
-
//Define indexOf for IE
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj, start) {
- for (var i = (start || 0); i < this.length; i++) {
+ for (var i = start || 0; i < this.length; i++) {
if (this[i] == obj) {
return i;
}
@@ -31,103 +30,128 @@ if (!Array.prototype.indexOf) {
if (!String.prototype.startsWith) {
String.prototype.startsWith = function(str, matchStr) {
- return str.lastIndexOf(matchStr, 0) === 0
- }
+ return str.lastIndexOf(matchStr, 0) === 0;
+ };
}
function doLogin() {
+ var userName = $("#username")
+ .val()
+ .trim();
+ var passwd = $("#password")
+ .val()
+ .trim();
- var userName = $('#username').val().trim();
- var passwd = $('#password').val().trim();
-
- if (userName === '' || passwd === '') {
- $('#errorBox').show();
- $('#signInLoading').hide();
- $('#signIn').removeAttr('disabled');
- $('#errorBox .errorMsg').text("The username or password you entered is blank..");
+ if (userName === "" || passwd === "") {
+ $("#errorBox").show();
+ $("#signInLoading").hide();
+ $("#signIn").removeAttr("disabled");
+ $("#errorBox .errorMsg").text("The username or password you entered is blank..");
return false;
}
var baseUrl = getBaseUrl();
- if (baseUrl.lastIndexOf('/') != (baseUrl.length - 1)) {
- if (baseUrl) {
- baseUrl = baseUrl + '/';
- } else {
- baseUrl = '/';
- }
- }
- var url = baseUrl + 'j_spring_security_check';
$.ajax({
data: {
j_username: userName,
j_password: passwd
},
- url: url,
- type: 'POST',
+ url: baseUrl + "j_spring_security_check",
+ type: "POST",
headers: {
"cache-control": "no-cache"
},
success: function() {
- var indexpath = "index.html";
- if (window.localStorage.atlas_ui === "beta") {
- //load beta version
- indexpath = '/n/index.html';
- }
- if (location.hash.length > 2) {
- window.location.replace((indexpath + location.hash));
- } else {
- window.location.replace(indexpath);
- }
+ redirect(baseUrl);
},
error: function(jqXHR, textStatus, err) {
- $('#signIn').removeAttr('disabled');
- $('#signInLoading').css("visibility", "hidden");
+ $("#signIn").removeAttr("disabled");
+ $("#signInLoading").css("visibility", "hidden");
if (jqXHR.status && jqXHR.status == 412) {
- $('#errorBox').hide();
- $('#errorBoxUnsynced').show();
+ $("#errorBox").hide();
+ $("#errorBoxUnsynced").show();
} else {
try {
var resp = JSON.parse(jqXHR.responseText);
if (resp.msgDesc.startsWith("Username not found") || resp.msgDesc.startsWith("Wrong password")) {
- $('#errorBox .errorMsg').text("Invalid User credentials. Please try again.");
+ $("#errorBox .errorMsg").text("Invalid User credentials. Please try again.");
} else if (resp.msgDesc.startsWith("User role credentials is not set properly")) {
- $('#errorBox .errorMsg').text("User role or credentials is not set properly");
+ $("#errorBox .errorMsg").text("User role or credentials is not set properly");
} else {
- $('#errorBox .errorMsg').text("Error while authentication");
+ $("#errorBox .errorMsg").text("Error while authentication");
}
} catch (err) {
- $('#errorBox .errorMsg').text("Something went wrong");
+ $("#errorBox .errorMsg").text("Something went wrong");
}
- $('#errorBox').show();
- $('#errorBoxUnsynced').hide();
+ $("#errorBox").show();
+ $("#errorBoxUnsynced").hide();
+ }
+ }
+ });
+}
+
+function redirect(baseUrl) {
+ $.ajax({
+ url: baseUrl + "api/atlas/admin/session",
+ success: function(data) {
+ var PRIMARY_UI = "v2",
+ indexpath = "/n/index.html";
+ if (data && data["atlas.ui.default.version"]) {
+ PRIMARY_UI = data["atlas.ui.default.version"];
+ }
+ if (PRIMARY_UI !== "v2") {
+ indexpath = "index.html";
+ }
+ if (window.localStorage.last_ui_load === "v1") {
+ indexpath = "index.html";
+ } else if (window.localStorage.last_ui_load === "v2") {
+ indexpath = "/n/index.html";
+ }
+ if (location.hash.length > 2) {
+ window.location.replace(indexpath + location.hash);
+ } else {
+ window.location.replace(indexpath);
}
+ },
+ error: function() {
+ window.location.replace("index.html");
}
});
}
function getBaseUrl() {
if (!window.location.origin) {
- window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
+ window.location.origin =
+ window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
+ }
+ var baseUrl = window.location.origin + window.location.pathname.substring(window.location.pathname.indexOf("/", 2) + 1, 0);
+
+ if (baseUrl.lastIndexOf("/") != baseUrl.length - 1) {
+ if (baseUrl) {
+ baseUrl = baseUrl + "/";
+ } else {
+ baseUrl = "/";
+ }
}
- return window.location.origin + window.location.pathname.substring(window.location.pathname
- .indexOf('/', 2) + 1, 0);
+ return baseUrl;
}
+
$(function() {
// register handlers
- if (!('placeholder' in HTMLInputElement.prototype)) {
+ if (!("placeholder" in HTMLInputElement.prototype)) {
$("#username , #password").placeholder();
}
- $('#signIn').on('click', function() {
- $('#signIn').attr('disabled', true);
- $('#signInLoading').css("visibility", "visible");
+ $("#signIn").on("click", function() {
+ $("#signIn").attr("disabled", true);
+ $("#signInLoading").css("visibility", "visible");
doLogin();
return false;
});
- $('#loginForm').each(function() {
- $('input').keypress(function(e) {
+ $("#loginForm").each(function() {
+ $("input").keypress(function(e) {
// Enter pressed?
if (e.which == 10 || e.which == 13) {
doLogin();
@@ -135,11 +159,15 @@ $(function() {
});
});
- $('#loginForm li[class^=control-group] > input').on('change', function(e) {
- if (e.target.value === '') {
- $(e.target).parent().addClass('error');
+ $("#loginForm li[class^=control-group] > input").on("change", function(e) {
+ if (e.target.value === "") {
+ $(e.target)
+ .parent()
+ .addClass("error");
} else {
- $(e.target).parent().removeClass('error');
+ $(e.target)
+ .parent()
+ .removeClass("error");
}
});
$("#password").on("keyup", function() {
diff --git a/dashboardv3/public/js/router/Router.js b/dashboardv3/public/js/router/Router.js
index 02a8fb0..20bb43f 100644
--- a/dashboardv3/public/js/router/Router.js
+++ b/dashboardv3/public/js/router/Router.js
@@ -59,7 +59,6 @@ define([
_.pick(options, "entityDefCollection", "typeHeaders", "enumDefCollection", "classificationDefCollection", "metricCollection", "nameSpaceCollection")
);
this.showRegions();
- this.bindFooterEvent();
this.bindCommonEvents();
this.listenTo(this, "route", this.postRouteExecute, this);
this.searchVent = new Backbone.Wreqr.EventAggregator();
@@ -89,15 +88,6 @@ define([
}
};
},
- bindFooterEvent: function() {
- $("body").on("click", "#sUI", function() {
- var path = Utils.getBaseUrl(window.location.pathname) + "/index.html";
- if (window.location.hash.length > 2) {
- path += window.location.hash;
- }
- window.location.href = path;
- });
- },
bindCommonEvents: function() {
var that = this;
$("body").on("click", "a.show-stat", function() {
diff --git a/dashboardv3/public/js/templates/site/Header.html b/dashboardv3/public/js/templates/site/Header.html
index 1eefe0d..ef670d6 100644
--- a/dashboardv3/public/js/templates/site/Header.html
+++ b/dashboardv3/public/js/templates/site/Header.html
@@ -51,6 +51,7 @@
</ul>
</li>
<li class="divider"></li>
+ <li><a data-id="uiSwitch" href="javascript:void(0)">Switch to Classic</a></li>
<li><a data-id="signOut" href="javascript:void(0)"><i class="fa fa-sign-out"></i>Logout</a></li>
</ul>
</td>
diff --git a/dashboardv3/public/js/utils/Globals.js b/dashboardv3/public/js/utils/Globals.js
index d90e262..bb515f0 100644
--- a/dashboardv3/public/js/utils/Globals.js
+++ b/dashboardv3/public/js/utils/Globals.js
@@ -16,8 +16,8 @@
* limitations under the License.
*/
-define(['require'], function(require) {
- 'use strict';
+define(["require"], function(require) {
+ "use strict";
var Globals = {};
Globals.settings = {};
@@ -36,7 +36,8 @@ define(['require'], function(require) {
Globals.userLogedIn = {
status: false,
response: {}
- }
- Globals.entityImgPath = "/img/entity-icon/"
+ };
+ Globals.entityImgPath = "/img/entity-icon/";
+ Globals.DEFAULT_UI = "v2";
return Globals;
});
\ No newline at end of file
diff --git a/dashboardv3/public/js/utils/Utils.js b/dashboardv3/public/js/utils/Utils.js
index 8f18fc5..bd3d6bf 100644
--- a/dashboardv3/public/js/utils/Utils.js
+++ b/dashboardv3/public/js/utils/Utils.js
@@ -231,11 +231,15 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
skipDefaultError = options.skipDefaultError;
defaultErrorMessage = options.defaultErrorMessage;
}
+ var redirectToLoginPage = function() {
+ Utils.localStorage.setValue("last_ui_load", "v2");
+ window.location = 'login.jsp';
+ }
if (error && error.status) {
if (error.status == 401) {
- window.location = 'login.jsp'
+ redirectToLoginPage();
} else if (error.status == 419) {
- window.location = 'login.jsp'
+ redirectToLoginPage();
} else if (error.status == 403) {
Utils.serverErrorHandler(error, "You are not authorized");
} else if (error.status == "0" && error.statusText != "abort") {
diff --git a/dashboardv3/public/js/views/site/Header.js b/dashboardv3/public/js/views/site/Header.js
index 06f1fe5..cce00c7 100644
--- a/dashboardv3/public/js/views/site/Header.js
+++ b/dashboardv3/public/js/views/site/Header.js
@@ -35,7 +35,8 @@ define(['require',
backButton: "[data-id='backButton']",
menuHamburger: "[data-id='menuHamburger']",
administrator: "[data-id='administrator']",
- signOut: "[data-id='signOut']"
+ signOut: "[data-id='signOut']",
+ uiSwitch: "[data-id='uiSwitch']"
},
events: function() {
var events = {};
@@ -49,7 +50,7 @@ define(['require',
$('body').toggleClass("full-screen");
};
events['click ' + this.ui.signOut] = function() {
- Utils.localStorage.setValue("atlas_ui", "beta");
+ Utils.localStorage.setValue("last_ui_load", "v2");
var path = Utils.getBaseUrl(window.location.pathname);
window.location = path + "/logout.html";
};
@@ -61,6 +62,13 @@ define(['require',
updateTabState: true
});
};
+ events["click " + this.ui.uiSwitch] = function() {
+ var path = Utils.getBaseUrl(window.location.pathname) + "/index.html";
+ if (window.location.hash.length > 2) {
+ path += window.location.hash;
+ }
+ window.location.href = path;
+ };
return events;
diff --git a/distro/src/conf/atlas-application.properties b/distro/src/conf/atlas-application.properties
index 7846452..e06e74a 100755
--- a/distro/src/conf/atlas-application.properties
+++ b/distro/src/conf/atlas-application.properties
@@ -271,3 +271,8 @@ atlas.search.gremlin.enable=false
#atlas.headers.Access-Control-Allow-Origin=*
#atlas.headers.Access-Control-Allow-Methods=GET,OPTIONS,HEAD,PUT,POST
#atlas.headers.<headerName>=<headerValue>
+
+
+######### UI Configuration ########
+
+#atlas.ui.default.version=v2
\ No newline at end of file
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
index 485d977..9bc7040 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
@@ -124,6 +124,8 @@ public class AdminResource {
private static final String isEntityCreateAllowed = "atlas.entity.create.allowed";
private static final String editableEntityTypes = "atlas.ui.editable.entity.types";
private static final String DEFAULT_EDITABLE_ENTITY_TYPES = "hdfs_path";
+ private static final String DEFAULT_UI_VERSION = "atlas.ui.default.version";
+ private static final String UI_VERSION_V2 = "v2";
private static final List TIMEZONE_LIST = Arrays.asList(TimeZone.getAvailableIDs());
@Context
@@ -148,6 +150,7 @@ public class AdminResource {
private final AtlasEntityStore entityStore;
private final AtlasPatchManager patchManager;
private final AtlasAuditService auditService;
+ private final String defaultUIVersion;
static {
try {
@@ -177,6 +180,11 @@ public class AdminResource {
this.importExportOperationLock = new ReentrantLock();
this.patchManager = patchManager;
this.auditService = auditService;
+ if (atlasProperties != null) {
+ defaultUIVersion = atlasProperties.getString(DEFAULT_UI_VERSION, UI_VERSION_V2);
+ } else {
+ defaultUIVersion = UI_VERSION_V2;
+ }
}
/**
@@ -317,6 +325,7 @@ public class AdminResource {
responseData.put(isEntityUpdateAllowed, isEntityUpdateAccessAllowed);
responseData.put(isEntityCreateAllowed, isEntityCreateAccessAllowed);
responseData.put(editableEntityTypes, getEditableEntityTypes(atlasProperties));
+ responseData.put(DEFAULT_UI_VERSION, defaultUIVersion);
responseData.put("userName", userName);
responseData.put("groups", groups);
responseData.put("timezones", TIMEZONE_LIST);