hostLogPopupBody_view.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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.WizardStep3HostLogPopupBody = Em.View.extend({
  20. templateName: require('templates/wizard/step3/step3_host_log_popup'),
  21. /**
  22. * Host's boot log
  23. * @type {string}
  24. */
  25. bootLog: function() {
  26. return this.get('parentView.host.bootLog');
  27. }.property('parentView.host.bootLog'),
  28. /**
  29. * Is textarea view active
  30. * @type {bool}
  31. */
  32. isTextArea: false,
  33. /**
  34. * Textbox with host's boot log
  35. * @type {Ember.TextArea}
  36. */
  37. textArea: Em.TextArea.extend({
  38. didInsertElement: function () {
  39. var element = $(this.get('element'));
  40. element.width($(this.get('parentView').get('element')).width() - 10);
  41. element.height($(this.get('parentView').get('element')).height());
  42. element.select();
  43. element.css('resize', 'none');
  44. },
  45. /**
  46. * Edit disabled
  47. * @type {bool}
  48. */
  49. readOnly: true,
  50. /**
  51. * <code>parentView.bootLog</code>
  52. * @type {string}
  53. */
  54. value: function () {
  55. return this.get('content');
  56. }.property('content')
  57. }),
  58. didInsertElement: function () {
  59. var self = this;
  60. var button = $(this.get('element')).find('.textTrigger');
  61. button.click(function () {
  62. $(this).text(self.get('isTextArea') ? Em.I18n.t('installer.step3.hostLogPopup.highlight') : Em.I18n.t('installer.step3.hostLogPopup.copy'));
  63. self.set('isTextArea', !self.get('isTextArea'));
  64. });
  65. $(this.get('element')).find('.content-area').mouseenter(
  66. function () {
  67. $(this).css('border', '1px solid #dcdcdc');
  68. button.css('visibility', 'visible');
  69. }).mouseleave(
  70. function () {
  71. $(this).css('border', 'none');
  72. button.css('visibility', 'hidden');
  73. })
  74. }
  75. });