فهرست منبع

HUE-8330 [clusters] Preparing instances of Connector page

Romain Rigaux 6 سال پیش
والد
کامیت
47f941ad99

+ 2 - 3
desktop/core/src/desktop/lib/connectors/models.py

@@ -17,7 +17,6 @@
 
 import logging
 
-from django.urls import reverse, NoReverseMatch
 from django.db import connection, models, transaction
 from django.db.models import Q
 from django.db.models.query import QuerySet
@@ -37,6 +36,7 @@ class ImpalaConnector():
 
 
 class Connectors(models.Model):
+  type = models.CharField(max_length=32, db_index=True, help_text=_t('Type of connector, e.g. hive-tez, '))  # Must be in lib
 
   name = models.CharField(default='', max_length=255)
   description = models.TextField(default='')
@@ -44,8 +44,7 @@ class Connectors(models.Model):
 
   category = models.CharField(max_length=32, db_index=True, help_text=_t('Type of connector, e.g. query, browser, catalog...'))
   interface = models.CharField(max_length=32, db_index=True, help_text=_t('Type of connector, e.g. hiveserver2'))
-  type = models.CharField(max_length=32, db_index=True, help_text=_t('Type of connector, e.g. hive-tez, '))
 
-  data = models.TextField(default='{}')
+  settings = models.TextField(default='{}')
 
   last_modified = models.DateTimeField(auto_now=True, db_index=True, verbose_name=_t('Time last modified'))

+ 39 - 7
desktop/core/src/desktop/lib/connectors/views.py

@@ -29,14 +29,37 @@ def index(request):
     "timestamp": "2019-04-05T23:36:47.533981",
     "metric": [
       {"category": "Query Engines", "values": [
-        {"name": "Impala"},
-        {"name": "SQL Database"},
-        {"name": "Hive"}
+        {"name": "Impala", "id": 1, "instances": []},
+        {"name": "SQL Database", "id": 2, "instances": []},
+        {"name": "Hive", "id": 3, "instances": [1, 2]},
+        {"name": "Hive Tez", "id": 4, "instances": []},
+        {"name": "Hive LLAP", "id": 5, "instances": []},
+        {"name": "Druid", "id": 6, "instances": []},
+        {"name": "Kafka SQL", "id": 6, "instances": []},
+        {"name": "SparkSQL", "id": 6, "instances": []},
+        {"name": "Presto", "id": 6, "instances": []},
+        {"name": "Athena", "id": 6, "instances": []},
+        {"name": "Redshift", "id": 6, "instances": []},
+        {"name": "Big Query", "id": 6, "instances": []},
+        {"name": "Oracle", "id": 6, "instances": []},
+      ]},
+      {"category": "Browsers", "values": [
+        {"name": "HDFS", "id": 30, "instances": []},
+        {"name": "YARN", "id": 30, "instances": []},
+        {"name": "S3", "id": 31, "instances": []},
+        {"name": "ADLS", "id": 32, "instances": []}
+      ]},
+      {"category": "Catalogs", "values": [
+        {"name": "Navigator", "id": 7, "instances": []},
+        {"name": "Atlas", "id": 8, "instances": []}
+      ]},
+      {"category": "Optimizers", "values": [
+        {"name": "Optimizer", "id": 9, "instances": []}
+      ]},
+      {"category": "Schedulers", "values": [
+        {"name": "Oozie", "id": 10, "instances": []},
+        {"name": "Celery", "id": 11, "instances": []}
       ]},
-      {"category": "Browsers", "values": [{"name": "HDFS"}, {"name": "S3"}, {"name": "ADLS"}]},
-      {"category": "Catalogs", "values": [{"name": "Navigator"}, {"name": "Atlas"}]},
-      {"category": "Optimizers", "values": [{"name": "Optimizer"}]},
-      {"category": "Schedulers", "values": [{"name": "Oozie"}, {"name": "Celery"}]},
       {"category": "Apps", "values": []},
       {"category": "Plugins", "values": []},
     ]
@@ -46,3 +69,12 @@ def index(request):
     return JsonResponse(CONNECTORS)
   else:
     return render("connectors.mako", request, {'connectors': json.dumps(CONNECTORS), 'is_embeddable': request.GET.get('is_embeddable', False)})
+
+
+def instances(request):
+  insance = json.loads(request.POST.get('id', '{}'))
+
+  return JsonResponse({
+    'name': 'Impala',
+    'settings': []
+  })

+ 9 - 9
desktop/core/src/desktop/templates/connectors.mako

@@ -31,9 +31,9 @@ else:
 <%namespace name="actionbar" file="actionbar.mako" />
 <%namespace name="layout" file="about_layout.mako" />
 
-%if not is_embeddable:
+% if not is_embeddable:
 ${ commonheader(_('Connectors'), "about", user, request) | n,unicode }
-%endif
+% endif
 
 
 <script type="text/javascript">
@@ -95,14 +95,14 @@ ${layout.menubar(section='connectors')}
         <li data-bind="css: { 'active': $root.selectedMetric() === 'All' }">
           <a href="javascript:void(0)" data-bind="text: 'All', click: function(){ $root.selectedMetric('All') }"></a>
         </li>
-        <!-- ko foreach: metrics() -->
-        <li data-bind="css: { 'active': $root.selectedMetric() === $data.category }">
-          <a href="javascript:void(0)" data-bind="text: $data.category, click: function(){ $root.selectedMetric($data.category) }"></a>
+        <!-- ko foreach: filteredMetrics() -->
+        <li data-bind="css: { 'active': $root.selectedMetric() === category }">
+          <a href="javascript:void(0)" data-bind="text: category, click: function(){ $root.selectedMetric(category) }"></a>
         </li>
         <!-- /ko -->
       </ul>
       <input type="text" data-bind="clearable: metricsFilter, valueUpdate: 'afterkeydown'"
-          class="input-xlarge pull-right margin-bottom-10" placeholder="${ _('Filter metrics...') }">
+          class="input-xlarge pull-right margin-bottom-10" placeholder="${ _('Filter connectors...') }">
     </div>
 
     <div class="margin-top-10">
@@ -112,14 +112,14 @@ ${layout.menubar(section='connectors')}
           <thead>
             <tr>
               <th width="30%">${ _('Name') }</th>
-              <th>${ _('Value') }</th>
+              <th>${ _('Instances') }</th>
             </tr>
           </thead>
           <!-- ko if: $data.values -->
           <tbody data-bind="foreach: values">
             <tr>
               <td data-bind="text: name"></td>
-              <td data-bind="text: ''"></td>
+              <td data-bind="text: instances.length > 0 ? instances.length : ''"></td>
             </tr>
           </tbody>
           <!-- /ko -->
@@ -138,7 +138,7 @@ ${layout.menubar(section='connectors')}
         <thead>
           <tr>
             <th width="30%">${ _('Name') }</th>
-            <th>${ _('Value') }</th>
+            <th>${ _('Instances') }</th>
           </tr>
         </thead>
         <tfoot>