yarn-container.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import DS from 'ember-data';
  2. import Converter from 'yarn-ui/utils/converter';
  3. export default DS.JSONAPIAdapter.extend({
  4. headers: {
  5. Accept: 'application/json'
  6. },
  7. rmHost: 'http://localhost:1337/localhost:8088',
  8. tsHost: 'http://localhost:1337/localhost:8188',
  9. host: function() {
  10. return undefined
  11. }.property(),
  12. rmNamespace: 'ws/v1/cluster',
  13. tsNamespace: 'ws/v1/applicationhistory',
  14. namespace: function() {
  15. return undefined
  16. }.property(),
  17. urlForQuery(query, modelName) {
  18. if (query.is_rm) {
  19. this.set("host", this.rmHost);
  20. this.set("namespace", this.rmNamespace);
  21. } else {
  22. this.set("host", this.tsHost);
  23. this.set("namespace", this.tsNamespace);
  24. }
  25. var url = this._buildURL();
  26. url = url + '/apps/' + Converter.attemptIdToAppId(query.app_attempt_id)
  27. + "/appattempts/" + query.app_attempt_id + "/containers";
  28. console.log(url);
  29. return url;
  30. },
  31. ajax(url, method, hash) {
  32. hash = {};
  33. hash.crossDomain = true;
  34. hash.xhrFields = {withCredentials: true};
  35. hash.targetServer = "RM";
  36. return this._super(url, method, hash);
  37. }
  38. });