|
@@ -20,6 +20,32 @@ App.deferReadiness();
|
|
|
|
|
|
var PATH_PARAM_NAME = "viewPath";
|
|
|
|
|
|
+/**
|
|
|
+ * Constructs URL for fetching Ambari view instance parameters.
|
|
|
+ * @return {String}
|
|
|
+ */
|
|
|
+function getStatusURL() {
|
|
|
+ var urlParts = location.pathname.split('/');
|
|
|
+
|
|
|
+ return "/api/v1/views/%@/versions/%@/instances/%@/resources/status".fmt(
|
|
|
+ urlParts[2],
|
|
|
+ urlParts[3],
|
|
|
+ urlParts[4]
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
+function getStatus() {
|
|
|
+ var hashArray = location.pathname.split('/');
|
|
|
+
|
|
|
+ return $.ajax({
|
|
|
+ type: 'GET',
|
|
|
+ dataType: 'json',
|
|
|
+ async: true,
|
|
|
+ context: this,
|
|
|
+ url: getStatusURL(),
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Creates an object from query string
|
|
|
* @param getQueryObject {String}
|
|
@@ -142,7 +168,7 @@ function scheduleChangeHandler(arguments) {
|
|
|
setTimeout(onPathChange, 100);
|
|
|
}
|
|
|
|
|
|
-function setConfigs() {
|
|
|
+function setConfigs(parameters) {
|
|
|
var host = window.location.protocol +
|
|
|
"//" +
|
|
|
window.location.hostname +
|
|
@@ -154,11 +180,14 @@ function setConfigs() {
|
|
|
urlParts[4]
|
|
|
);
|
|
|
|
|
|
+ parameters = parameters || {};
|
|
|
+
|
|
|
$.extend(true, App.Configs, {
|
|
|
envDefaults: {
|
|
|
isStandalone: false,
|
|
|
timelineBaseUrl: host,
|
|
|
RMWebUrl: host,
|
|
|
+ yarnProtocol: parameters["yarn.protocol"]
|
|
|
},
|
|
|
restNamespace: {
|
|
|
timeline: '%@atsproxy/ws/v1/timeline'.fmt(resourcesPrefix),
|
|
@@ -180,6 +209,13 @@ function setConfigs() {
|
|
|
App.advanceReadiness();
|
|
|
}
|
|
|
|
|
|
+function loadParams() {
|
|
|
+ getStatus().always(function(status) {
|
|
|
+ status = status || {};
|
|
|
+ setConfigs(status.parameters);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
if(!redirectionCheck()) {
|
|
|
App.ApplicationRoute.reopen({
|
|
|
actions: {
|
|
@@ -189,5 +225,5 @@ if(!redirectionCheck()) {
|
|
|
});
|
|
|
|
|
|
allowFullScreen();
|
|
|
- setConfigs();
|
|
|
+ loadParams();
|
|
|
}
|