ajax_default_error_popup_body.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. App.AjaxDefaultErrorPopupBodyView = Em.View.extend({
  20. classNames: ['api-error'],
  21. templateName: require('templates/utils/ajax'),
  22. /**
  23. * HTTP request URL
  24. * @type {string}
  25. */
  26. url: '',
  27. /**
  28. * HTTP request type
  29. * @type {string}
  30. */
  31. type: '',
  32. /**
  33. * HTTP response status code
  34. * @type {number}
  35. */
  36. status: 0,
  37. /**
  38. * Received error message
  39. * @type {string}
  40. */
  41. message: '',
  42. /**
  43. * Status code string
  44. * @type {string}
  45. */
  46. statusCode: function () {
  47. return Em.I18n.t('utils.ajax.defaultErrorPopupBody.statusCode').format(this.get('status'));
  48. }.property('status'),
  49. /**
  50. * Indicates if error message should be displayed
  51. * @type {boolean}
  52. */
  53. showMessage: function () {
  54. return !!this.get('message');
  55. }.property('message'),
  56. /**
  57. * HTTP response error description
  58. * @type {string}
  59. */
  60. api: function () {
  61. return Em.I18n.t('utils.ajax.defaultErrorPopupBody.message').format(this.get('type'), this.get('url'));
  62. }.property('type', 'url')
  63. });