Commit aa4bbb08 by kevalbhatt

ATLAS-3555 : UI: Make Beta UI as primary UI for Atlas

parent 30a275d4
...@@ -26,6 +26,10 @@ header.atlas-header { ...@@ -26,6 +26,10 @@ header.atlas-header {
background-color: $white; background-color: $white;
border-bottom: 1px $color_mystic_approx solid; border-bottom: 1px $color_mystic_approx solid;
table {
width: 100%;
}
.navbar-nav { .navbar-nav {
display: table; display: table;
...@@ -124,6 +128,10 @@ header.atlas-header { ...@@ -124,6 +128,10 @@ header.atlas-header {
overflow: hidden; overflow: hidden;
@include clearfix(); @include clearfix();
} }
.tab-content>.tab-pane.active {
padding: 18px;
}
} }
} }
......
...@@ -73,9 +73,6 @@ ...@@ -73,9 +73,6 @@
</div> </div>
</div> </div>
</div> </div>
<div class="footer-content">
<a href="javascript:void(0)" id="sUI">Switch to Beta UI</a>
</div>
</div> </div>
<!-- build:js scripts/main.js --> <!-- build:js scripts/main.js -->
<script data-main="js/main.js?bust=<%- bust %>" src="js/libs/requirejs/require.js?bust=<%- bust %>"></script> <script data-main="js/main.js?bust=<%- bust %>" src="js/libs/requirejs/require.js?bust=<%- bust %>"></script>
......
...@@ -175,7 +175,7 @@ require.config({ ...@@ -175,7 +175,7 @@ require.config({
'sparkline': 'libs/sparkline/jquery.sparkline.min', 'sparkline': 'libs/sparkline/jquery.sparkline.min',
'table-dragger': 'libs/table-dragger/table-dragger', 'table-dragger': 'libs/table-dragger/table-dragger',
'jstree': 'libs/jstree/jstree.min', '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', ...@@ -252,6 +252,9 @@ require(['App',
} }
} }
} }
if (response['atlas.ui.default.version'] !== undefined) {
Globals.DEFAULT_UI = response['atlas.ui.default.version'];
}
} }
--that.asyncFetchCounter; --that.asyncFetchCounter;
startApp(); startApp();
......
...@@ -16,11 +16,10 @@ ...@@ -16,11 +16,10 @@
* limitations under the License. * limitations under the License.
*/ */
//Define indexOf for IE //Define indexOf for IE
if (!Array.prototype.indexOf) { if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj, start) { 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) { if (this[i] == obj) {
return i; return i;
} }
...@@ -31,103 +30,128 @@ if (!Array.prototype.indexOf) { ...@@ -31,103 +30,128 @@ if (!Array.prototype.indexOf) {
if (!String.prototype.startsWith) { if (!String.prototype.startsWith) {
String.prototype.startsWith = function(str, matchStr) { String.prototype.startsWith = function(str, matchStr) {
return str.lastIndexOf(matchStr, 0) === 0 return str.lastIndexOf(matchStr, 0) === 0;
} };
} }
function doLogin() { function doLogin() {
var userName = $("#username")
.val()
.trim();
var passwd = $("#password")
.val()
.trim();
var userName = $('#username').val().trim(); if (userName === "" || passwd === "") {
var passwd = $('#password').val().trim(); $("#errorBox").show();
$("#signInLoading").hide();
if (userName === '' || passwd === '') { $("#signIn").removeAttr("disabled");
$('#errorBox').show(); $("#errorBox .errorMsg").text("The username or password you entered is blank..");
$('#signInLoading').hide();
$('#signIn').removeAttr('disabled');
$('#errorBox .errorMsg').text("The username or password you entered is blank..");
return false; return false;
} }
var baseUrl = getBaseUrl(); var baseUrl = getBaseUrl();
if (baseUrl.lastIndexOf('/') != (baseUrl.length - 1)) {
if (baseUrl) {
baseUrl = baseUrl + '/';
} else {
baseUrl = '/';
}
}
var url = baseUrl + 'j_spring_security_check';
$.ajax({ $.ajax({
data: { data: {
j_username: userName, j_username: userName,
j_password: passwd j_password: passwd
}, },
url: url, url: baseUrl + "j_spring_security_check",
type: 'POST', type: "POST",
headers: { headers: {
"cache-control": "no-cache" "cache-control": "no-cache"
}, },
success: function() { success: function() {
var indexpath = "index.html"; redirect(baseUrl);
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);
}
}, },
error: function(jqXHR, textStatus, err) { error: function(jqXHR, textStatus, err) {
$('#signIn').removeAttr('disabled'); $("#signIn").removeAttr("disabled");
$('#signInLoading').css("visibility", "hidden"); $("#signInLoading").css("visibility", "hidden");
if (jqXHR.status && jqXHR.status == 412) { if (jqXHR.status && jqXHR.status == 412) {
$('#errorBox').hide(); $("#errorBox").hide();
$('#errorBoxUnsynced').show(); $("#errorBoxUnsynced").show();
} else { } else {
try { try {
var resp = JSON.parse(jqXHR.responseText); var resp = JSON.parse(jqXHR.responseText);
if (resp.msgDesc.startsWith("Username not found") || resp.msgDesc.startsWith("Wrong password")) { 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")) { } 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 { } else {
$('#errorBox .errorMsg').text("Error while authentication"); $("#errorBox .errorMsg").text("Error while authentication");
} }
} catch (err) { } catch (err) {
$('#errorBox .errorMsg').text("Something went wrong"); $("#errorBox .errorMsg").text("Something went wrong");
}
$("#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"];
} }
$('#errorBox').show(); if (PRIMARY_UI !== "v2") {
$('#errorBoxUnsynced').hide(); 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() { function getBaseUrl() {
if (!window.location.origin) { 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() { $(function() {
// register handlers // register handlers
if (!('placeholder' in HTMLInputElement.prototype)) { if (!("placeholder" in HTMLInputElement.prototype)) {
$("#username , #password").placeholder(); $("#username , #password").placeholder();
} }
$('#signIn').on('click', function() { $("#signIn").on("click", function() {
$('#signIn').attr('disabled', true); $("#signIn").attr("disabled", true);
$('#signInLoading').css("visibility", "visible"); $("#signInLoading").css("visibility", "visible");
doLogin(); doLogin();
return false; return false;
}); });
$('#loginForm').each(function() { $("#loginForm").each(function() {
$('input').keypress(function(e) { $("input").keypress(function(e) {
// Enter pressed? // Enter pressed?
if (e.which == 10 || e.which == 13) { if (e.which == 10 || e.which == 13) {
doLogin(); doLogin();
...@@ -135,11 +159,15 @@ $(function() { ...@@ -135,11 +159,15 @@ $(function() {
}); });
}); });
$('#loginForm li[class^=control-group] > input').on('change', function(e) { $("#loginForm li[class^=control-group] > input").on("change", function(e) {
if (e.target.value === '') { if (e.target.value === "") {
$(e.target).parent().addClass('error'); $(e.target)
.parent()
.addClass("error");
} else { } else {
$(e.target).parent().removeClass('error'); $(e.target)
.parent()
.removeClass("error");
} }
}); });
$("#password").on("keyup", function() { $("#password").on("keyup", function() {
......
...@@ -45,7 +45,6 @@ define([ ...@@ -45,7 +45,6 @@ define([
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'entityDefCollection', 'typeHeaders', 'enumDefCollection', 'classificationDefCollection', 'metricCollection')); _.extend(this, _.pick(options, 'entityDefCollection', 'typeHeaders', 'enumDefCollection', 'classificationDefCollection', 'metricCollection'));
this.showRegions(); this.showRegions();
this.bindFooterEvent();
this.bindCommonEvents(); this.bindCommonEvents();
this.listenTo(this, 'route', this.postRouteExecute, this); this.listenTo(this, 'route', this.postRouteExecute, this);
this.searchVent = new Backbone.Wreqr.EventAggregator(); this.searchVent = new Backbone.Wreqr.EventAggregator();
...@@ -73,15 +72,6 @@ define([ ...@@ -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() { bindCommonEvents: function() {
var that = this; var that = this;
$('body').on('click', 'a.show-stat', function() { $('body').on('click', 'a.show-stat', function() {
......
...@@ -40,9 +40,10 @@ ...@@ -40,9 +40,10 @@
<td><a target="_blank" href="http://atlas.apache.org/"><i class="fa fa-question-circle"></i></a></td> <td><a target="_blank" href="http://atlas.apache.org/"><i class="fa fa-question-circle"></i></a></td>
<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> <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 class="aboutAtlas"><a href="javascript:void(0)">About</a></li>
<li role="separator" class="divider"></li> <li role="separator" class="divider"></li>
<li><a data-id="uiSwitch" href="javascript:void(0)">Switch to New</a></li>
<li> <li>
<a href="javascript:void(0)" data-id="signOut"><i class="fa fa-sign-out"></i>Logout</a> <a href="javascript:void(0)" data-id="signOut"><i class="fa fa-sign-out"></i>Logout</a>
</li> </li>
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
* limitations under the License. * limitations under the License.
*/ */
define(['require'], function(require) { define(["require"], function(require) {
'use strict'; "use strict";
var Globals = {}; var Globals = {};
Globals.settings = {}; Globals.settings = {};
...@@ -35,7 +35,8 @@ define(['require'], function(require) { ...@@ -35,7 +35,8 @@ define(['require'], function(require) {
Globals.userLogedIn = { Globals.userLogedIn = {
status: false, status: false,
response: {} response: {}
} };
Globals.entityImgPath = "/img/entity-icon/" Globals.entityImgPath = "/img/entity-icon/";
Globals.DEFAULT_UI = "v2";
return Globals; return Globals;
}); });
\ No newline at end of file
...@@ -225,11 +225,15 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -225,11 +225,15 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
skipDefaultError = options.skipDefaultError; skipDefaultError = options.skipDefaultError;
defaultErrorMessage = options.defaultErrorMessage; defaultErrorMessage = options.defaultErrorMessage;
} }
var redirectToLoginPage = function() {
Utils.localStorage.setValue("last_ui_load", "v1");
window.location = 'login.jsp';
}
if (error && error.status) { if (error && error.status) {
if (error.status == 401) { if (error.status == 401) {
window.location = 'login.jsp' redirectToLoginPage();
} else if (error.status == 419) { } else if (error.status == 419) {
window.location = 'login.jsp' redirectToLoginPage();
} else if (error.status == 403) { } else if (error.status == 403) {
Utils.serverErrorHandler(error, "You are not authorized"); Utils.serverErrorHandler(error, "You are not authorized");
} else if (error.status == "0" && error.statusText != "abort") { } else if (error.status == "0" && error.statusText != "abort") {
......
...@@ -34,7 +34,8 @@ define(['require', ...@@ -34,7 +34,8 @@ define(['require',
menuHamburger: "[data-id='menuHamburger']", menuHamburger: "[data-id='menuHamburger']",
globalSearch: "[data-id='globalSearch']", globalSearch: "[data-id='globalSearch']",
clearGlobalSearch: "[data-id='clearGlobalSearch']", clearGlobalSearch: "[data-id='clearGlobalSearch']",
signOut: "[data-id='signOut']" signOut: "[data-id='signOut']",
uiSwitch: "[data-id='uiSwitch']"
}, },
events: function() { events: function() {
var events = {}; var events = {};
...@@ -70,13 +71,19 @@ define(['require', ...@@ -70,13 +71,19 @@ define(['require',
$('body').toggleClass("full-screen"); $('body').toggleClass("full-screen");
}; };
events['click ' + this.ui.signOut] = function() { events['click ' + this.ui.signOut] = function() {
Utils.localStorage.setValue("last_ui_load", "v1");
Utils.localStorage.setValue("atlas_ui", "classic");
var path = Utils.getBaseUrl(window.location.pathname); var path = Utils.getBaseUrl(window.location.pathname);
window.location = path + "/logout.html"; 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) { initialize: function(options) {
this.bindEvent(); this.bindEvent();
......
...@@ -116,9 +116,6 @@ ...@@ -116,9 +116,6 @@
</div> </div>
</div> </div>
</div> </div>
<div class="footer-content">
<a href="javascript:void(0)" id="sUI">Switch to Classic UI</a>
</div>
</div> </div>
<!-- build:js scripts/main.js --> <!-- build:js scripts/main.js -->
<script data-main="js/main.js?bust=<%- bust %>" src="js/libs/requirejs/require.js?bust=<%- bust %>"></script> <script data-main="js/main.js?bust=<%- bust %>" src="js/libs/requirejs/require.js?bust=<%- bust %>"></script>
......
...@@ -262,6 +262,9 @@ require(['App', ...@@ -262,6 +262,9 @@ require(['App',
} }
} }
} }
if (response['atlas.ui.default.version'] !== undefined) {
Globals.DEFAULT_UI = response['atlas.ui.default.version'];
}
} }
--that.asyncFetchCounter; --that.asyncFetchCounter;
startApp(); startApp();
......
...@@ -16,11 +16,10 @@ ...@@ -16,11 +16,10 @@
* limitations under the License. * limitations under the License.
*/ */
//Define indexOf for IE //Define indexOf for IE
if (!Array.prototype.indexOf) { if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj, start) { 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) { if (this[i] == obj) {
return i; return i;
} }
...@@ -31,103 +30,128 @@ if (!Array.prototype.indexOf) { ...@@ -31,103 +30,128 @@ if (!Array.prototype.indexOf) {
if (!String.prototype.startsWith) { if (!String.prototype.startsWith) {
String.prototype.startsWith = function(str, matchStr) { String.prototype.startsWith = function(str, matchStr) {
return str.lastIndexOf(matchStr, 0) === 0 return str.lastIndexOf(matchStr, 0) === 0;
} };
} }
function doLogin() { function doLogin() {
var userName = $("#username")
.val()
.trim();
var passwd = $("#password")
.val()
.trim();
var userName = $('#username').val().trim(); if (userName === "" || passwd === "") {
var passwd = $('#password').val().trim(); $("#errorBox").show();
$("#signInLoading").hide();
if (userName === '' || passwd === '') { $("#signIn").removeAttr("disabled");
$('#errorBox').show(); $("#errorBox .errorMsg").text("The username or password you entered is blank..");
$('#signInLoading').hide();
$('#signIn').removeAttr('disabled');
$('#errorBox .errorMsg').text("The username or password you entered is blank..");
return false; return false;
} }
var baseUrl = getBaseUrl(); var baseUrl = getBaseUrl();
if (baseUrl.lastIndexOf('/') != (baseUrl.length - 1)) {
if (baseUrl) {
baseUrl = baseUrl + '/';
} else {
baseUrl = '/';
}
}
var url = baseUrl + 'j_spring_security_check';
$.ajax({ $.ajax({
data: { data: {
j_username: userName, j_username: userName,
j_password: passwd j_password: passwd
}, },
url: url, url: baseUrl + "j_spring_security_check",
type: 'POST', type: "POST",
headers: { headers: {
"cache-control": "no-cache" "cache-control": "no-cache"
}, },
success: function() { success: function() {
var indexpath = "index.html"; redirect(baseUrl);
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);
}
}, },
error: function(jqXHR, textStatus, err) { error: function(jqXHR, textStatus, err) {
$('#signIn').removeAttr('disabled'); $("#signIn").removeAttr("disabled");
$('#signInLoading').css("visibility", "hidden"); $("#signInLoading").css("visibility", "hidden");
if (jqXHR.status && jqXHR.status == 412) { if (jqXHR.status && jqXHR.status == 412) {
$('#errorBox').hide(); $("#errorBox").hide();
$('#errorBoxUnsynced').show(); $("#errorBoxUnsynced").show();
} else { } else {
try { try {
var resp = JSON.parse(jqXHR.responseText); var resp = JSON.parse(jqXHR.responseText);
if (resp.msgDesc.startsWith("Username not found") || resp.msgDesc.startsWith("Wrong password")) { 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")) { } 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 { } else {
$('#errorBox .errorMsg').text("Error while authentication"); $("#errorBox .errorMsg").text("Error while authentication");
} }
} catch (err) { } catch (err) {
$('#errorBox .errorMsg').text("Something went wrong"); $("#errorBox .errorMsg").text("Something went wrong");
}
$("#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"];
} }
$('#errorBox').show(); if (PRIMARY_UI !== "v2") {
$('#errorBoxUnsynced').hide(); 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() { function getBaseUrl() {
if (!window.location.origin) { 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() { $(function() {
// register handlers // register handlers
if (!('placeholder' in HTMLInputElement.prototype)) { if (!("placeholder" in HTMLInputElement.prototype)) {
$("#username , #password").placeholder(); $("#username , #password").placeholder();
} }
$('#signIn').on('click', function() { $("#signIn").on("click", function() {
$('#signIn').attr('disabled', true); $("#signIn").attr("disabled", true);
$('#signInLoading').css("visibility", "visible"); $("#signInLoading").css("visibility", "visible");
doLogin(); doLogin();
return false; return false;
}); });
$('#loginForm').each(function() { $("#loginForm").each(function() {
$('input').keypress(function(e) { $("input").keypress(function(e) {
// Enter pressed? // Enter pressed?
if (e.which == 10 || e.which == 13) { if (e.which == 10 || e.which == 13) {
doLogin(); doLogin();
...@@ -135,11 +159,15 @@ $(function() { ...@@ -135,11 +159,15 @@ $(function() {
}); });
}); });
$('#loginForm li[class^=control-group] > input').on('change', function(e) { $("#loginForm li[class^=control-group] > input").on("change", function(e) {
if (e.target.value === '') { if (e.target.value === "") {
$(e.target).parent().addClass('error'); $(e.target)
.parent()
.addClass("error");
} else { } else {
$(e.target).parent().removeClass('error'); $(e.target)
.parent()
.removeClass("error");
} }
}); });
$("#password").on("keyup", function() { $("#password").on("keyup", function() {
......
...@@ -59,7 +59,6 @@ define([ ...@@ -59,7 +59,6 @@ define([
_.pick(options, "entityDefCollection", "typeHeaders", "enumDefCollection", "classificationDefCollection", "metricCollection", "nameSpaceCollection") _.pick(options, "entityDefCollection", "typeHeaders", "enumDefCollection", "classificationDefCollection", "metricCollection", "nameSpaceCollection")
); );
this.showRegions(); this.showRegions();
this.bindFooterEvent();
this.bindCommonEvents(); this.bindCommonEvents();
this.listenTo(this, "route", this.postRouteExecute, this); this.listenTo(this, "route", this.postRouteExecute, this);
this.searchVent = new Backbone.Wreqr.EventAggregator(); this.searchVent = new Backbone.Wreqr.EventAggregator();
...@@ -89,15 +88,6 @@ define([ ...@@ -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() { bindCommonEvents: function() {
var that = this; var that = this;
$("body").on("click", "a.show-stat", function() { $("body").on("click", "a.show-stat", function() {
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
</ul> </ul>
</li> </li>
<li class="divider"></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> <li><a data-id="signOut" href="javascript:void(0)"><i class="fa fa-sign-out"></i>Logout</a></li>
</ul> </ul>
</td> </td>
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
* limitations under the License. * limitations under the License.
*/ */
define(['require'], function(require) { define(["require"], function(require) {
'use strict'; "use strict";
var Globals = {}; var Globals = {};
Globals.settings = {}; Globals.settings = {};
...@@ -36,7 +36,8 @@ define(['require'], function(require) { ...@@ -36,7 +36,8 @@ define(['require'], function(require) {
Globals.userLogedIn = { Globals.userLogedIn = {
status: false, status: false,
response: {} response: {}
} };
Globals.entityImgPath = "/img/entity-icon/" Globals.entityImgPath = "/img/entity-icon/";
Globals.DEFAULT_UI = "v2";
return Globals; return Globals;
}); });
\ No newline at end of file
...@@ -231,11 +231,15 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', ...@@ -231,11 +231,15 @@ define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums',
skipDefaultError = options.skipDefaultError; skipDefaultError = options.skipDefaultError;
defaultErrorMessage = options.defaultErrorMessage; defaultErrorMessage = options.defaultErrorMessage;
} }
var redirectToLoginPage = function() {
Utils.localStorage.setValue("last_ui_load", "v2");
window.location = 'login.jsp';
}
if (error && error.status) { if (error && error.status) {
if (error.status == 401) { if (error.status == 401) {
window.location = 'login.jsp' redirectToLoginPage();
} else if (error.status == 419) { } else if (error.status == 419) {
window.location = 'login.jsp' redirectToLoginPage();
} else if (error.status == 403) { } else if (error.status == 403) {
Utils.serverErrorHandler(error, "You are not authorized"); Utils.serverErrorHandler(error, "You are not authorized");
} else if (error.status == "0" && error.statusText != "abort") { } else if (error.status == "0" && error.statusText != "abort") {
......
...@@ -35,7 +35,8 @@ define(['require', ...@@ -35,7 +35,8 @@ define(['require',
backButton: "[data-id='backButton']", backButton: "[data-id='backButton']",
menuHamburger: "[data-id='menuHamburger']", menuHamburger: "[data-id='menuHamburger']",
administrator: "[data-id='administrator']", administrator: "[data-id='administrator']",
signOut: "[data-id='signOut']" signOut: "[data-id='signOut']",
uiSwitch: "[data-id='uiSwitch']"
}, },
events: function() { events: function() {
var events = {}; var events = {};
...@@ -49,7 +50,7 @@ define(['require', ...@@ -49,7 +50,7 @@ define(['require',
$('body').toggleClass("full-screen"); $('body').toggleClass("full-screen");
}; };
events['click ' + this.ui.signOut] = function() { 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); var path = Utils.getBaseUrl(window.location.pathname);
window.location = path + "/logout.html"; window.location = path + "/logout.html";
}; };
...@@ -61,6 +62,13 @@ define(['require', ...@@ -61,6 +62,13 @@ define(['require',
updateTabState: true 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; return events;
......
...@@ -271,3 +271,8 @@ atlas.search.gremlin.enable=false ...@@ -271,3 +271,8 @@ atlas.search.gremlin.enable=false
#atlas.headers.Access-Control-Allow-Origin=* #atlas.headers.Access-Control-Allow-Origin=*
#atlas.headers.Access-Control-Allow-Methods=GET,OPTIONS,HEAD,PUT,POST #atlas.headers.Access-Control-Allow-Methods=GET,OPTIONS,HEAD,PUT,POST
#atlas.headers.<headerName>=<headerValue> #atlas.headers.<headerName>=<headerValue>
######### UI Configuration ########
#atlas.ui.default.version=v2
\ No newline at end of file
...@@ -124,6 +124,8 @@ public class AdminResource { ...@@ -124,6 +124,8 @@ public class AdminResource {
private static final String isEntityCreateAllowed = "atlas.entity.create.allowed"; private static final String isEntityCreateAllowed = "atlas.entity.create.allowed";
private static final String editableEntityTypes = "atlas.ui.editable.entity.types"; 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_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()); private static final List TIMEZONE_LIST = Arrays.asList(TimeZone.getAvailableIDs());
@Context @Context
...@@ -148,6 +150,7 @@ public class AdminResource { ...@@ -148,6 +150,7 @@ public class AdminResource {
private final AtlasEntityStore entityStore; private final AtlasEntityStore entityStore;
private final AtlasPatchManager patchManager; private final AtlasPatchManager patchManager;
private final AtlasAuditService auditService; private final AtlasAuditService auditService;
private final String defaultUIVersion;
static { static {
try { try {
...@@ -177,6 +180,11 @@ public class AdminResource { ...@@ -177,6 +180,11 @@ public class AdminResource {
this.importExportOperationLock = new ReentrantLock(); this.importExportOperationLock = new ReentrantLock();
this.patchManager = patchManager; this.patchManager = patchManager;
this.auditService = auditService; 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 { ...@@ -317,6 +325,7 @@ public class AdminResource {
responseData.put(isEntityUpdateAllowed, isEntityUpdateAccessAllowed); responseData.put(isEntityUpdateAllowed, isEntityUpdateAccessAllowed);
responseData.put(isEntityCreateAllowed, isEntityCreateAccessAllowed); responseData.put(isEntityCreateAllowed, isEntityCreateAccessAllowed);
responseData.put(editableEntityTypes, getEditableEntityTypes(atlasProperties)); responseData.put(editableEntityTypes, getEditableEntityTypes(atlasProperties));
responseData.put(DEFAULT_UI_VERSION, defaultUIVersion);
responseData.put("userName", userName); responseData.put("userName", userName);
responseData.put("groups", groups); responseData.put("groups", groups);
responseData.put("timezones", TIMEZONE_LIST); responseData.put("timezones", TIMEZONE_LIST);
......
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