YARN-4514. [YARN-3368] Cleanup hardcoded configurations, such as RM/ATS addresses. (Sunil G via wangda)
This commit is contained in:
parent
56654d8820
commit
b414b5f2cf
|
@ -0,0 +1,48 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import Ember from 'ember';
|
||||
|
||||
export default DS.JSONAPIAdapter.extend({
|
||||
address: null, //Must be set by inheriting classes
|
||||
restNameSpace: null, //Must be set by inheriting classes
|
||||
serverName: null, //Must be set by inheriting classes
|
||||
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
},
|
||||
|
||||
host: Ember.computed("address", function () {
|
||||
var address = this.get("address");
|
||||
return this.get(`hosts.${address}`);
|
||||
}),
|
||||
|
||||
namespace: Ember.computed("restNameSpace", function () {
|
||||
var serverName = this.get("restNameSpace");
|
||||
return this.get(`env.app.namespaces.${serverName}`);
|
||||
}),
|
||||
|
||||
ajax: function(url, method, options) {
|
||||
options = options || {};
|
||||
options.crossDomain = true;
|
||||
options.xhrFields = {
|
||||
withCredentials: true
|
||||
};
|
||||
options.targetServer = this.get('serverName');
|
||||
return this._super(url, method, options);
|
||||
}
|
||||
});
|
|
@ -16,23 +16,15 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import DS from 'ember-data';
|
||||
import Config from 'yarn-ui/config';
|
||||
import AbstractAdapter from './abstract';
|
||||
|
||||
export default DS.JSONAPIAdapter.extend({
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
},
|
||||
host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
|
||||
namespace: 'ws/v1/cluster', // common const
|
||||
export default AbstractAdapter.extend({
|
||||
address: "rmWebAddress",
|
||||
restNameSpace: "cluster",
|
||||
serverName: "RM",
|
||||
|
||||
// Any cluster-info specific adapter changes must be added here
|
||||
pathForType(modelName) {
|
||||
return ''; // move to some common place, return path by modelname.
|
||||
},
|
||||
ajax(url, method, hash) {
|
||||
hash = hash || {};
|
||||
hash.crossDomain = true;
|
||||
hash.xhrFields = {withCredentials: true};
|
||||
hash.targetServer = "RM";
|
||||
return this._super(url, method, hash);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -16,23 +16,15 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import DS from 'ember-data';
|
||||
import Config from 'yarn-ui/config';
|
||||
import AbstractAdapter from './abstract';
|
||||
|
||||
export default DS.JSONAPIAdapter.extend({
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
},
|
||||
host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
|
||||
namespace: 'ws/v1/cluster/metrics', // common const
|
||||
export default AbstractAdapter.extend({
|
||||
address: "rmWebAddress",
|
||||
restNameSpace: "metrics",
|
||||
serverName: "RM",
|
||||
|
||||
// Any cluster-metric specific adapter changes must be added here
|
||||
pathForType(modelName) {
|
||||
return ''; // move to some common place, return path by modelname.
|
||||
},
|
||||
ajax(url, method, hash) {
|
||||
hash = hash || {};
|
||||
hash.crossDomain = true;
|
||||
hash.xhrFields = {withCredentials: true};
|
||||
hash.targetServer = "RM";
|
||||
return this._super(url, method, hash);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -16,16 +16,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import DS from 'ember-data';
|
||||
import AbstractAdapter from './abstract';
|
||||
import Converter from 'yarn-ui/utils/converter';
|
||||
import Config from 'yarn-ui/config';
|
||||
|
||||
export default DS.JSONAPIAdapter.extend({
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
},
|
||||
host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
|
||||
namespace: 'ws/v1/cluster', // common const
|
||||
export default AbstractAdapter.extend({
|
||||
address: "rmWebAddress",
|
||||
restNameSpace: "cluster",
|
||||
serverName: "RM",
|
||||
|
||||
urlForQuery(query, modelName) {
|
||||
var url = this._buildURL();
|
||||
|
@ -36,15 +33,8 @@ export default DS.JSONAPIAdapter.extend({
|
|||
var url = this._buildURL();
|
||||
var url = url + '/apps/' +
|
||||
Converter.attemptIdToAppId(id) + "/appattempts/" + id;
|
||||
console.log(url);
|
||||
console.log('app-attempt url:',url);
|
||||
return url;
|
||||
},
|
||||
|
||||
ajax(url, method, hash) {
|
||||
hash = {};
|
||||
hash.crossDomain = true;
|
||||
hash.xhrFields = {withCredentials: true};
|
||||
hash.targetServer = "RM";
|
||||
return this._super(url, method, hash);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -16,29 +16,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import DS from 'ember-data';
|
||||
import Config from 'yarn-ui/config';
|
||||
import AbstractAdapter from './abstract';
|
||||
|
||||
export default AbstractAdapter.extend({
|
||||
address: "rmWebAddress",
|
||||
restNameSpace: "cluster",
|
||||
serverName: "RM",
|
||||
|
||||
export default DS.JSONAPIAdapter.extend({
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
},
|
||||
host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
|
||||
namespace: 'ws/v1/cluster', // common const
|
||||
pathForType(modelName) {
|
||||
return 'apps'; // move to some common place, return path by modelname.
|
||||
},
|
||||
/*
|
||||
urlForQuery(query, modelName) {
|
||||
var url = this._buildURL();
|
||||
return url + '/apps/' + query.appId + "/appattempts";
|
||||
},
|
||||
*/
|
||||
ajax(url, method, hash) {
|
||||
hash = hash || {};
|
||||
hash.crossDomain = true;
|
||||
hash.xhrFields = {withCredentials: true};
|
||||
hash.targetServer = "RM";
|
||||
return this._super(url, method, hash);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -28,8 +28,14 @@ export default DS.RESTAdapter.extend({
|
|||
headers: {
|
||||
Accept: 'text/plain'
|
||||
},
|
||||
host: 'http://localhost:1337/',
|
||||
namespace: 'ws/v1/node',
|
||||
|
||||
host: Ember.computed("address", function () {
|
||||
return this.get(`hosts.localBaseAddress`);
|
||||
}),
|
||||
|
||||
namespace: Ember.computed("restNameSpace", function () {
|
||||
return this.get(`env.app.namespaces.node`);
|
||||
}),
|
||||
|
||||
urlForFindRecord(id, modelName, snapshot) {
|
||||
var splits = Converter.splitForContainerLogs(id);
|
||||
|
|
|
@ -18,30 +18,32 @@
|
|||
|
||||
import DS from 'ember-data';
|
||||
import Converter from 'yarn-ui/utils/converter';
|
||||
import Config from 'yarn-ui/config';
|
||||
|
||||
export default DS.JSONAPIAdapter.extend({
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
},
|
||||
rmHost: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT,
|
||||
tsHost: 'http://localhost:1337/' + Config.TS_HOST + ':' + Config.TS_PORT,
|
||||
|
||||
host: function() {
|
||||
return undefined
|
||||
}.property(),
|
||||
rmNamespace: 'ws/v1/cluster',
|
||||
tsNamespace: 'ws/v1/applicationhistory',
|
||||
|
||||
namespace: function() {
|
||||
return undefined
|
||||
}.property(),
|
||||
|
||||
urlForQuery(query, modelName) {
|
||||
var rmHosts = this.get(`hosts.rmWebAddress`);
|
||||
var tsHosts = this.get(`hosts.timelineWebAddress`);
|
||||
var rmNamespaces = this.get(`env.app.namespaces.cluster`);
|
||||
var tsNamespaces = this.get(`env.app.namespaces.timeline`);
|
||||
|
||||
if (query.is_rm) {
|
||||
this.set("host", this.rmHost);
|
||||
this.set("namespace", this.rmNamespace);
|
||||
this.set("host", rmHosts);
|
||||
this.set("namespace", rmNamespaces);
|
||||
} else {
|
||||
this.set("host", this.tsHost);
|
||||
this.set("namespace", this.tsNamespace);
|
||||
this.set("host", tsHosts);
|
||||
this.set("namespace", tsNamespaces);
|
||||
}
|
||||
|
||||
var url = this._buildURL();
|
||||
|
|
|
@ -16,24 +16,23 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import DS from 'ember-data';
|
||||
import AbstractAdapter from './abstract';
|
||||
|
||||
export default DS.JSONAPIAdapter.extend({
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
},
|
||||
host: 'http://localhost:1337/',
|
||||
namespace: 'ws/v1/node',
|
||||
export default AbstractAdapter.extend({
|
||||
|
||||
address: "localBaseAddress",
|
||||
restNameSpace: "node",
|
||||
serverName: "NM",
|
||||
|
||||
urlForQuery(query) {
|
||||
this.host = this.host + query.nodeAddr;
|
||||
this.host = this.get("host") + query.nodeAddr;
|
||||
var url = this._buildURL();
|
||||
url = url + "/apps";
|
||||
return url;
|
||||
},
|
||||
|
||||
urlForQueryRecord: function (query) {
|
||||
this.host = this.host + query.nodeAddr;
|
||||
this.host = this.get("host") + query.nodeAddr;
|
||||
var url = this._buildURL();
|
||||
url = url + "/apps/" + query.appId;
|
||||
return url;
|
||||
|
@ -53,11 +52,4 @@ export default DS.JSONAPIAdapter.extend({
|
|||
return this.ajax(url, 'GET', { data: query });
|
||||
},
|
||||
|
||||
ajax(url, method, hash) {
|
||||
hash = hash || {};
|
||||
hash.crossDomain = true;
|
||||
hash.xhrFields = {withCredentials: true};
|
||||
hash.targetServer = "NM";
|
||||
return this._super(url, method, hash);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -16,24 +16,23 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import DS from 'ember-data';
|
||||
import AbstractAdapter from './abstract';
|
||||
|
||||
export default DS.JSONAPIAdapter.extend({
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
},
|
||||
host: 'http://localhost:1337/',
|
||||
namespace: 'ws/v1/node',
|
||||
export default AbstractAdapter.extend({
|
||||
|
||||
address: "localBaseAddress",
|
||||
restNameSpace: "node",
|
||||
serverName: "NM",
|
||||
|
||||
urlForQuery(query) {
|
||||
this.host = this.host + query.nodeHttpAddr;
|
||||
this.host = this.get("host") + query.nodeHttpAddr;
|
||||
var url = this._buildURL();
|
||||
url = url + "/containers";
|
||||
return url;
|
||||
},
|
||||
|
||||
urlForQueryRecord(query) {
|
||||
this.host = this.host + query.nodeHttpAddr;
|
||||
this.host = this.get("host") + query.nodeHttpAddr;
|
||||
var url = this._buildURL();
|
||||
url = url + "/containers/" + query.containerId;
|
||||
return url;
|
||||
|
@ -54,11 +53,4 @@ export default DS.JSONAPIAdapter.extend({
|
|||
return this.ajax(url, 'GET', { data: query });
|
||||
},
|
||||
|
||||
ajax(url, method, hash) {
|
||||
hash = hash || {};
|
||||
hash.crossDomain = true;
|
||||
hash.xhrFields = {withCredentials: true};
|
||||
hash.targetServer = "NM";
|
||||
return this._super(url, method, hash);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -16,25 +16,18 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import DS from 'ember-data';
|
||||
import AbstractAdapter from './abstract';
|
||||
|
||||
export default DS.JSONAPIAdapter.extend({
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
},
|
||||
host: 'http://localhost:1337/',
|
||||
namespace: 'ws/v1/node',
|
||||
export default AbstractAdapter.extend({
|
||||
|
||||
address: "localBaseAddress",
|
||||
restNameSpace: "node",
|
||||
serverName: "NM",
|
||||
|
||||
urlForFindRecord(id, modelName, snapshot) {
|
||||
this.host = this.host + id;
|
||||
this.host = this.get("host") + id;
|
||||
var url = this._buildURL();
|
||||
return url;
|
||||
},
|
||||
ajax(url, method, hash) {
|
||||
hash = hash || {};
|
||||
hash.crossDomain = true;
|
||||
hash.xhrFields = {withCredentials: true};
|
||||
hash.targetServer = "NM";
|
||||
return this._super(url, method, hash);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -16,23 +16,15 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import DS from 'ember-data';
|
||||
import Config from 'yarn-ui/config';
|
||||
import AbstractAdapter from './abstract';
|
||||
|
||||
export default AbstractAdapter.extend({
|
||||
address: "rmWebAddress",
|
||||
restNameSpace: "cluster",
|
||||
serverName: "RM",
|
||||
|
||||
export default DS.JSONAPIAdapter.extend({
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
},
|
||||
host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
|
||||
namespace: 'ws/v1/cluster', // common const
|
||||
pathForType(modelName) {
|
||||
return 'scheduler'; // move to some common place, return path by modelname.
|
||||
},
|
||||
ajax(url, method, hash) {
|
||||
hash = hash || {};
|
||||
hash.crossDomain = true;
|
||||
hash.xhrFields = {withCredentials: true};
|
||||
hash.targetServer = "RM";
|
||||
return this._super(url, method, hash);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -16,15 +16,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import DS from 'ember-data';
|
||||
import Config from 'yarn-ui/config';
|
||||
import AbstractAdapter from './abstract';
|
||||
|
||||
export default AbstractAdapter.extend({
|
||||
address: "rmWebAddress",
|
||||
restNameSpace: "cluster",
|
||||
serverName: "RM",
|
||||
|
||||
export default DS.JSONAPIAdapter.extend({
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
},
|
||||
host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT,
|
||||
namespace: 'ws/v1/cluster',
|
||||
pathForType(modelName) {
|
||||
return 'nodes';
|
||||
},
|
||||
|
@ -35,11 +33,4 @@ export default DS.JSONAPIAdapter.extend({
|
|||
return url;
|
||||
},
|
||||
|
||||
ajax(url, method, hash) {
|
||||
hash = hash || {};
|
||||
hash.crossDomain = true;
|
||||
hash.xhrFields = {withCredentials: true};
|
||||
hash.targetServer = "RM";
|
||||
return this._super(url, method, hash);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
import Ember from 'ember';
|
||||
import Resolver from 'ember/resolver';
|
||||
import Resolver from 'ember-resolver';
|
||||
import loadInitializers from 'ember/load-initializers';
|
||||
import config from './config/environment';
|
||||
import Sorter from 'yarn-ui/utils/sorter';
|
||||
|
@ -29,7 +29,7 @@ Ember.MODEL_FACTORY_INJECTIONS = true;
|
|||
App = Ember.Application.extend({
|
||||
modulePrefix: config.modulePrefix,
|
||||
podModulePrefix: config.podModulePrefix,
|
||||
Resolver: Resolver
|
||||
Resolver
|
||||
});
|
||||
|
||||
loadInitializers(App, config.modulePrefix);
|
||||
|
|
|
@ -19,9 +19,6 @@
|
|||
/**
|
||||
* Host and port configurations
|
||||
*/
|
||||
|
||||
export default {
|
||||
RM_HOST: 'localhost',
|
||||
RM_PORT: '8088',
|
||||
TS_HOST: 'localhost',
|
||||
TS_PORT: '8188',
|
||||
};
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
</head>
|
||||
<body>
|
||||
{{content-for 'body'}}
|
||||
<script src="config/configs.env" integrity=""></script>
|
||||
|
||||
<script src="assets/vendor.js"></script>
|
||||
<script src="assets/yarn-ui.js"></script>
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
export function initialize( application ) {
|
||||
application.inject('controller', 'env', 'service:env');
|
||||
application.inject('route', 'env', 'service:env');
|
||||
application.inject('adapter', 'env', 'service:env');
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'env',
|
||||
initialize
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export function initialize( application ) {
|
||||
application.inject('controller', 'hosts', 'service:hosts');
|
||||
application.inject('route', 'hosts', 'service:hosts');
|
||||
application.inject('adapter', 'hosts', 'service:hosts');
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'hosts',
|
||||
initialize
|
||||
};
|
|
@ -0,0 +1,59 @@
|
|||
/*global more*/
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
import environment from '../config/environment';
|
||||
|
||||
var MoreObject = more.Object;
|
||||
|
||||
export default Ember.Service.extend({
|
||||
ENV: null,
|
||||
|
||||
init: function () {
|
||||
this.collateConfigs();
|
||||
},
|
||||
|
||||
collateConfigs: function () {
|
||||
var collatedENV = {
|
||||
APP: {}
|
||||
},
|
||||
ENV = window.ENV;
|
||||
|
||||
MoreObject.merge(collatedENV, environment);
|
||||
|
||||
if(ENV) {
|
||||
MoreObject.merge(collatedENV.APP, ENV);
|
||||
}
|
||||
|
||||
this.setComputedENVs(collatedENV);
|
||||
|
||||
this.set("ENV", collatedENV);
|
||||
},
|
||||
|
||||
setComputedENVs: function (env) {
|
||||
var navigator = window.navigator;
|
||||
env.isIE = navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0;
|
||||
console.log('In setComputedENVs', env.isIE);
|
||||
},
|
||||
|
||||
app: Ember.computed("ENV.APP", function () {
|
||||
return this.get("ENV.APP");
|
||||
})
|
||||
});
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Service.extend({
|
||||
|
||||
env: Ember.inject.service("env"),
|
||||
|
||||
attachProtocolScheme: function (url) {
|
||||
var localProto = this.get("env.app.hosts.protocolScheme");
|
||||
|
||||
if(localProto === "") {
|
||||
localProto = "http:";
|
||||
}
|
||||
|
||||
if(url.match("://")) {
|
||||
url = url.substr(url.indexOf("://") + 3);
|
||||
}
|
||||
|
||||
return localProto + "//" + url;
|
||||
},
|
||||
|
||||
normalizeURL: function (url) {
|
||||
var address;
|
||||
|
||||
// If localBaseAddress is configured, then normalized URL has to
|
||||
// start with this address. For eg: when used with CORS proxy.
|
||||
// In any case, this fn will return with correct proto scheme.
|
||||
address = this.localAddress() + url;
|
||||
|
||||
// Remove trailing slash
|
||||
if(address && address.charAt(address.length - 1) === '/') {
|
||||
address = address.slice(0, -1);
|
||||
}
|
||||
return address;
|
||||
},
|
||||
|
||||
localAddress: function () {
|
||||
var localBaseAddressProto = "";
|
||||
|
||||
if (this.get("env.app.hosts.localBaseAddress").length > 0) {
|
||||
localBaseAddressProto = this.get("env.app.hosts.localBaseAddress") + '/';
|
||||
}
|
||||
return this.attachProtocolScheme(localBaseAddressProto);
|
||||
},
|
||||
|
||||
localBaseAddress: Ember.computed(function () {
|
||||
return this.localAddress();
|
||||
}),
|
||||
|
||||
timelineWebAddress: Ember.computed(function () {
|
||||
return this.normalizeURL(this.get("env.app.hosts.timelineWebAddress"));
|
||||
}),
|
||||
|
||||
rmWebAddress: Ember.computed(function () {
|
||||
return this.normalizeURL(this.get("env.app.hosts.rmWebAddress"));
|
||||
}),
|
||||
});
|
|
@ -1,18 +1,19 @@
|
|||
{
|
||||
"name": "yarn-ui",
|
||||
"dependencies": {
|
||||
"ember": "2.0.1",
|
||||
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.4",
|
||||
"ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
|
||||
"ember-data": "2.0.0",
|
||||
"ember-load-initializers": "ember-cli/ember-load-initializers#0.1.6",
|
||||
"ember-qunit": "0.4.9",
|
||||
"ember-qunit-notifications": "0.0.7",
|
||||
"ember-resolver": "~0.1.18",
|
||||
"jquery": "1.11.3",
|
||||
"loader.js": "ember-cli/loader.js#3.2.1",
|
||||
"qunit": "~1.18.0",
|
||||
"bootstrap": "~3.3.2",
|
||||
"ember": "2.2.0",
|
||||
"ember-cli-shims": "0.0.6",
|
||||
"ember-cli-test-loader": "0.2.1",
|
||||
"ember-data": "2.1.0",
|
||||
"ember-load-initializers": "0.1.7",
|
||||
"ember-qunit": "0.4.16",
|
||||
"ember-qunit-notifications": "0.1.0",
|
||||
"jquery": "2.1.4",
|
||||
"loader.js": "3.3.0",
|
||||
"qunit": "1.19.0",
|
||||
"jquery-ui": "1.11.4",
|
||||
"more-js": "0.8.2",
|
||||
"bootstrap": "3.3.6",
|
||||
"d3": "~3.5.6",
|
||||
"datatables": "~1.10.8",
|
||||
"spin.js": "~2.3.2",
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
ENV = {
|
||||
hosts: {
|
||||
/*
|
||||
* Local URL. This is empty by default. In case when ResourceManager
|
||||
* and Timeline Server (ATS) are running on same node, cross domain
|
||||
* requests has to be supported. In such cases, proxy URL can be configured
|
||||
* here to handle requests (CORS). For eg:"localhost:1337"
|
||||
*/
|
||||
//localBaseAddress: "localhost:1337",
|
||||
|
||||
/*
|
||||
* Timeline web interface can be configured below.
|
||||
* By default timeline server is set as localhost:8188, uncomment and change
|
||||
* the following value for pointing to a different address.
|
||||
*/
|
||||
//timelineWebAddress: "localhost:8188",
|
||||
|
||||
/*
|
||||
* RM web interface can be configured below.
|
||||
* By default RM web address is set as localhost:8088, uncomment and change
|
||||
* the following value for pointing to a different address.
|
||||
*/
|
||||
//rmWebAddress: "localhost:8088",
|
||||
|
||||
/*
|
||||
* Protocol scheme. It can be "http:" or "https:". By default, http is used.
|
||||
*/
|
||||
//protocolScheme: "http:"
|
||||
},
|
||||
};
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
module.exports = { // Yarn UI App configurations
|
||||
hosts: {
|
||||
localBaseAddress: "localhost:1337",
|
||||
timelineWebAddress: "localhost:8188",
|
||||
rmWebAddress: "localhost:8088",
|
||||
protocolScheme: "http:"
|
||||
},
|
||||
namespaces: {
|
||||
timeline: 'ws/v1/applicationhistory',
|
||||
cluster: 'ws/v1/cluster',
|
||||
metrics: 'ws/v1/cluster/metrics',
|
||||
node: 'ws/v1/node'
|
||||
},
|
||||
};
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
/* jshint node: true */
|
||||
|
||||
const DEFAULT_CONFIG = require('./default-config');
|
||||
|
||||
module.exports = function(environment) {
|
||||
var ENV = {
|
||||
modulePrefix: 'yarn-ui',
|
||||
|
@ -31,9 +33,12 @@ module.exports = function(environment) {
|
|||
}
|
||||
},
|
||||
|
||||
APP: {
|
||||
// Here you can pass flags/options to your application instance
|
||||
// when it is created
|
||||
APP: DEFAULT_CONFIG,
|
||||
contentSecurityPolicy: {
|
||||
'connect-src': "* 'self'",
|
||||
'child-src': "'self' 'unsafe-inline'",
|
||||
'style-src': "'self' 'unsafe-inline'",
|
||||
'script-src': "'self' 'unsafe-inline'"
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
/* global require, module */
|
||||
var Funnel = require("broccoli-funnel");
|
||||
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
|
||||
|
||||
module.exports = function(defaults) {
|
||||
|
@ -29,6 +30,8 @@ module.exports = function(defaults) {
|
|||
app.import("bower_components/momentjs/min/moment.min.js");
|
||||
app.import("bower_components/select2/dist/css/select2.min.css");
|
||||
app.import("bower_components/select2/dist/js/select2.min.js");
|
||||
app.import('bower_components/jquery-ui/jquery-ui.js');
|
||||
app.import('bower_components/more-js/dist/more.js');
|
||||
|
||||
// Use `app.import` to add additional libraries to the generated
|
||||
// output files.
|
||||
|
@ -42,6 +45,11 @@ module.exports = function(defaults) {
|
|||
// modules that you would like to import into your application
|
||||
// please specify an object with the list of modules as keys
|
||||
// along with the exports of each module as its value.
|
||||
var extraAssets = new Funnel('config', {
|
||||
srcDir: '/',
|
||||
include: ['*.env'],
|
||||
destDir: '/config'
|
||||
});
|
||||
|
||||
return app.toTree();
|
||||
return app.toTree(extraAssets);
|
||||
};
|
||||
|
|
|
@ -19,25 +19,28 @@
|
|||
"author": "",
|
||||
"license": "Apache",
|
||||
"devDependencies": {
|
||||
"broccoli-asset-rev": "^2.1.2",
|
||||
"ember-bootstrap": "0.2.0",
|
||||
"ember-cli": "1.13.8",
|
||||
"ember-cli-app-version": "0.5.0",
|
||||
"ember-cli-babel": "^5.1.3",
|
||||
"broccoli-asset-rev": "2.4.2",
|
||||
"broccoli-funnel": "1.0.1",
|
||||
"ember-bootstrap": "0.5.1",
|
||||
"ember-cli": "1.13.13",
|
||||
"ember-cli-app-version": "1.0.0",
|
||||
"ember-cli-babel": "5.1.6",
|
||||
"ember-cli-content-security-policy": "0.4.0",
|
||||
"ember-cli-dependency-checker": "^1.0.1",
|
||||
"ember-cli-htmlbars": "0.7.9",
|
||||
"ember-cli-htmlbars-inline-precompile": "^0.2.0",
|
||||
"ember-cli-dependency-checker": "1.2.0",
|
||||
"ember-cli-htmlbars": "1.0.2",
|
||||
"ember-cli-htmlbars-inline-precompile": "0.3.1",
|
||||
"ember-cli-ic-ajax": "0.2.1",
|
||||
"ember-cli-inject-live-reload": "^1.3.1",
|
||||
"ember-cli-qunit": "^1.0.0",
|
||||
"ember-cli-release": "0.2.3",
|
||||
"ember-cli-sri": "^1.0.3",
|
||||
"ember-cli-uglify": "^1.2.0",
|
||||
"ember-cli-inject-live-reload": "1.4.0",
|
||||
"ember-cli-jquery-ui": "0.0.20",
|
||||
"ember-cli-qunit": "1.2.1",
|
||||
"ember-cli-release": "0.2.8",
|
||||
"ember-cli-sri": "1.2.1",
|
||||
"ember-cli-uglify": "1.2.0",
|
||||
"ember-d3": "0.1.0",
|
||||
"ember-data": "1.13.8",
|
||||
"ember-disable-proxy-controllers": "^1.0.0",
|
||||
"ember-export-application-global": "^1.0.3",
|
||||
"ember-data": "2.1.0",
|
||||
"ember-disable-proxy-controllers": "1.0.1",
|
||||
"ember-export-application-global": "1.0.5",
|
||||
"ember-resolver": "2.0.3",
|
||||
"ember-spin-spinner": "0.2.3",
|
||||
"select2": "4.0.0"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Ember from 'ember';
|
||||
import { initialize } from '../../../initializers/env';
|
||||
import { module, test } from 'qunit';
|
||||
|
||||
var registry, application;
|
||||
|
||||
module('Unit | Initializer | env', {
|
||||
beforeEach: function() {
|
||||
Ember.run(function() {
|
||||
application = Ember.Application.create();
|
||||
registry = application.registry;
|
||||
application.deferReadiness();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it works', function(assert) {
|
||||
initialize(registry, application);
|
||||
|
||||
// you would normally confirm the results of the initializer here
|
||||
assert.ok(true);
|
||||
});
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Ember from 'ember';
|
||||
import { initialize } from '../../../initializers/hosts';
|
||||
import { module, test } from 'qunit';
|
||||
|
||||
var registry, application;
|
||||
|
||||
module('Unit | Initializer | hosts', {
|
||||
beforeEach: function() {
|
||||
Ember.run(function() {
|
||||
application = Ember.Application.create();
|
||||
registry = application.registry;
|
||||
application.deferReadiness();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it works', function(assert) {
|
||||
initialize(registry, application);
|
||||
|
||||
// you would normally confirm the results of the initializer here
|
||||
assert.ok(true);
|
||||
});
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Ember from 'ember';
|
||||
import { initialize } from '../../../initializers/jquery';
|
||||
import { module, test } from 'qunit';
|
||||
|
||||
var registry, application;
|
||||
|
||||
module('Unit | Initializer | jquery', {
|
||||
beforeEach: function() {
|
||||
Ember.run(function() {
|
||||
application = Ember.Application.create();
|
||||
registry = application.registry;
|
||||
application.deferReadiness();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it works', function(assert) {
|
||||
initialize(registry, application);
|
||||
|
||||
// you would normally confirm the results of the initializer here
|
||||
assert.ok(true);
|
||||
});
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('service:env', 'Unit | Service | env', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['service:foo']
|
||||
});
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
var service = this.subject();
|
||||
assert.ok(service);
|
||||
});
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('service:hosts', 'Unit | Service | hosts', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['service:foo']
|
||||
});
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
var service = this.subject();
|
||||
assert.ok(service);
|
||||
});
|
Loading…
Reference in New Issue