فهرست منبع

HUE-8617 [frontend] Add pubSub to the context selector for setting cluster/compute/namespace

This adds support for the following:

huePubSub.publish('context.selector.set.namespace', 'default');
huePubSub.publish('context.selector.set.compute', 'default');
huePubSub.publish('context.selector.set.cluster', 'default');
Johan Ahlen 7 سال پیش
والد
کامیت
6914b41
1فایلهای تغییر یافته به همراه10 افزوده شده و 0 حذف شده
  1. 10 0
      desktop/core/src/desktop/templates/ko_components/ko_context_selector.mako

+ 10 - 0
desktop/core/src/desktop/templates/ko_components/ko_context_selector.mako

@@ -170,6 +170,16 @@ from desktop.views import _ko
               self.setMatchingCompute(selectedVal);
             }
           };
+          if (self[type.name]) {
+            huePubSub.subscribe('context.selector.set.' + type.name, function (id) {
+              self[type.available]().some(function (instance) {
+                if (instance.id === id) {
+                  self[type.name](instance);
+                  return true;
+                }
+              });
+            });
+          }
           self.reload(type);
         });