Skip to content

Commit

Permalink
YARN-4517. Add nodes page and fix bunch of license issues. (Varun Sax…
Browse files Browse the repository at this point in the history
…ena via wangda)
  • Loading branch information
wangdatan committed Nov 6, 2016
1 parent 53e661f commit 0a5f652
Show file tree
Hide file tree
Showing 80 changed files with 3,840 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import DS from 'ember-data';
import Config from 'yarn-ui/config';

export default DS.JSONAPIAdapter.extend({
headers: {
Accept: 'application/json'
},
host: 'http://localhost:1337/localhost:8088', // configurable
host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
namespace: 'ws/v1/cluster', // common const
pathForType(modelName) {
return ''; // move to some common place, return path by modelname.
Expand All @@ -16,4 +17,4 @@ export default DS.JSONAPIAdapter.extend({
hash.targetServer = "RM";
return this._super(url, method, hash);
}
});
});
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import DS from 'ember-data';
import Config from 'yarn-ui/config';

export default DS.JSONAPIAdapter.extend({
headers: {
Accept: 'application/json'
},
host: 'http://localhost:1337/localhost:8088', // configurable
host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
namespace: 'ws/v1/cluster/metrics', // common const
pathForType(modelName) {
return ''; // move to some common place, return path by modelname.
Expand All @@ -16,4 +17,4 @@ export default DS.JSONAPIAdapter.extend({
hash.targetServer = "RM";
return this._super(url, method, hash);
}
});
});
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
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'
},
host: 'http://localhost:1337/localhost:8088', // configurable
host: 'http://localhost:1337/' + Config.RM_HOST + ':' + Config.RM_PORT, // configurable
namespace: 'ws/v1/cluster', // common const

urlForQuery(query, modelName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import DS from 'ember-data';
import Config from 'yarn-ui/config';

export default DS.JSONAPIAdapter.extend({
headers: {
Accept: 'application/json'
},
host: 'http://localhost:1337/localhost:8088', // configurable
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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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 DS from 'ember-data';
import Ember from 'ember';
import Converter from 'yarn-ui/utils/converter';

/**
* REST URL's response when fetching container logs will be
* in plain text format and not JSON.
*/
export default DS.RESTAdapter.extend({
headers: {
Accept: 'text/plain'
},
host: 'http://localhost:1337/',
namespace: 'ws/v1/node',

urlForFindRecord(id, modelName, snapshot) {
var splits = Converter.splitForContainerLogs(id);
var nodeHttpAddr = splits[0];
var containerId = splits[1];
var filename = splits[2];
this.host = this.host + nodeHttpAddr;
var url = this._buildURL();
url = url + "/containerlogs/" + containerId + "/" + filename;
return url;
},

ajax(url, method, hash) {
hash = hash || {};
hash.crossDomain = true;
hash.xhrFields = {withCredentials: true};
hash.targetServer = "NM";
return this._super(url, method, hash);
},

/**
* Override options so that result is not expected to be JSON
*/
ajaxOptions: function (url, type, options) {
var hash = options || {};
hash.url = url;
hash.type = type;
// Make sure jQuery does not try to convert response to JSON.
hash.dataType = 'text';
hash.context = this;

var headers = Ember.get(this, 'headers');
if (headers != undefined) {
hash.beforeSend = function (xhr) {
Object.keys(headers).forEach(function (key) {
return xhr.setRequestHeader(key, headers[key]);
});
};
}
return hash;
},
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
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/localhost:8088',
tsHost: 'http://localhost:1337/localhost:8188',
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(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**
* 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 DS from 'ember-data';

export default DS.JSONAPIAdapter.extend({
headers: {
Accept: 'application/json'
},
host: 'http://localhost:1337/',
namespace: 'ws/v1/node',

urlForQuery(query) {
this.host = this.host + query.nodeAddr;
var url = this._buildURL();
url = url + "/apps";
return url;
},

urlForQueryRecord: function (query) {
this.host = this.host + query.nodeAddr;
var url = this._buildURL();
url = url + "/apps/" + query.appId;
return url;
},

query: function (store, type, query) {
var url = this.urlForQuery(query);
// Query params not required.
query = null;
return this.ajax(url, 'GET', { data: query });
},

queryRecord: function (store, type, query) {
var url = this.urlForQueryRecord(query);
// Query params not required.
query = null;
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);
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* 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 DS from 'ember-data';

export default DS.JSONAPIAdapter.extend({
headers: {
Accept: 'application/json'
},
host: 'http://localhost:1337/',
namespace: 'ws/v1/node',

urlForQuery(query) {
this.host = this.host + query.nodeHttpAddr;
var url = this._buildURL();
url = url + "/containers";
return url;
},

urlForQueryRecord(query) {
this.host = this.host + query.nodeHttpAddr;
var url = this._buildURL();
url = url + "/containers/" + query.containerId;
return url;
},

query: function (store, type, query) {
var url = this.urlForQuery(query);
// Query params not required.
query = null;
return this.ajax(url, 'GET', { data: query });
},

queryRecord: function (store, type, query) {
var url = this.urlForQueryRecord(query);
// Query params not required.
query = null;
console.log(url);
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);
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* 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 DS from 'ember-data';

export default DS.JSONAPIAdapter.extend({
headers: {
Accept: 'application/json'
},
host: 'http://localhost:1337/',
namespace: 'ws/v1/node',

urlForFindRecord(id, modelName, snapshot) {
this.host = this.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);
}
});
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import DS from 'ember-data';
import Config from 'yarn-ui/config';

export default DS.JSONAPIAdapter.extend({
headers: {
Accept: 'application/json'
},
host: 'http://localhost:1337/localhost:8088', // configurable
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.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* 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 DS from 'ember-data';
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,
namespace: 'ws/v1/cluster',
pathForType(modelName) {
return 'nodes';
},

urlForFindRecord(id, modelName, snapshot) {
var url = this._buildURL();
url = url + "/nodes/" + id;
return url;
},

ajax(url, method, hash) {
hash = hash || {};
hash.crossDomain = true;
hash.xhrFields = {withCredentials: true};
hash.targetServer = "RM";
return this._super(url, method, hash);
}
});

0 comments on commit 0a5f652

Please sign in to comment.