Prechádzať zdrojové kódy

AMBARI-4092 Need tooltip showing error why local repo is bad. (ababiichuk)

aBabiichuk 11 rokov pred
rodič
commit
5229fb1beb

+ 2 - 0
ambari-web/app/controllers/installer.js

@@ -438,6 +438,8 @@ App.InstallerController = App.WizardController.extend({
     if (selectedStack && selectedStack.operatingSystems) {
       var os = selectedStack.operatingSystems.findProperty('osType', osType);
       os.validation = 'icon-exclamation-sign';
+      os.errorTitle = request.status + ":" + request.statusText;
+      os.errorContent = $.parseJSON(request.responseText).message;
       selectedStack.set('reload', !selectedStack.get('reload'));
       this.set('validationCnt', this.get('validationCnt') - 1);
       this.set('invalidCnt', this.get('invalidCnt') + 1);

+ 1 - 1
ambari-web/app/templates/wizard/step1.hbs

@@ -71,7 +71,7 @@
                   </td>
                   <td class="validation-results">
                     {{#if repoGroup.validation}}
-                      <i {{bindAttr class="repoGroup.validation"}}></i>
+                      {{view view.popoverView repoGroupBinding="repoGroup"}}
                     {{/if}}
                   </td>
                   <td  {{bindAttr class=":url-results repoGroup.checked::disabled-textfield repoGroup.empty-error:textfield-error repoGroup.invalid-error:textfield-error"}}>

+ 12 - 0
ambari-web/app/views/wizard/step1_view.js

@@ -86,6 +86,16 @@ App.WizardStep1View = Em.View.extend({
     }
     $("[rel=skip-validation-tooltip]").tooltip({ placement: 'right'});
   },
+
+  popoverView: Em.View.extend({
+    tagName: 'i',
+    classNameBindings: ['repoGroup.validation'],
+    attributeBindings: ['repoGroup.errorTitle:title', 'repoGroup.errorContent:data-content'],
+    didInsertElement: function() {
+      App.popover($(this.get('element')), {'trigger': 'hover'});
+    }
+  }),
+
   loadRepositories: function () {
     var selectedStack = this.get('controller.content.stacks').findProperty('isSelected', true);
     var reposGroup = [[],[],[]];
@@ -149,6 +159,8 @@ App.WizardStep1View = Em.View.extend({
     group.set('validation', os.validation);
     group.set('undo', os.baseUrl != os.defaultBaseUrl);
     group.set('clearAll', os.baseUrl);
+    group.set('errorTitle', os.errorTitle);
+    group.set('errorContent', os.errorContent);
     group.set('group-number', groupNumber);
   },
   /**