Bläddra i källkod

HUE-9266 [jb] Add a skeleton Hive query plan component

Johan Ahlen 5 år sedan
förälder
incheckning
dde4d07b6b

+ 8 - 1
apps/jobbrowser/src/jobbrowser/templates/job_browser.mako

@@ -1806,7 +1806,14 @@ ${ render_bundle('jobBrowser') | n,unicode }
 
         <!-- ko if: $root.job().mainType() == 'queries-hive' -->
         <div class="tab-pane active" id="queries-page-hive-plan-text${ SUFFIX }" data-profile="plan">
-          <pre data-bind="text: properties.plan && properties.plan().plan"></pre>
+          <!-- ko if: properties.plan && properties.plan().plan -->
+            <!-- ko component: {
+              name: 'hive-query-plan',
+              params: {
+                plan: properties.plan().plan
+              }
+            } --><!-- /ko -->
+          <!-- /ko -->
         </div>
         <div class="tab-pane" id="queries-page-hive-stmt${ SUFFIX }" data-profile="stmt">
           <pre data-bind="text: (properties.plan && properties.plan().stmt) || _('The selected tab has no data')"></pre>

+ 3 - 0
desktop/core/src/desktop/js/apps/jobBrowser/components/__snapshots__/ko.hiveQueryPlan.test.js.snap

@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`ko.hiveQueryPlan.js should render component 1`] = `"<div data-bind=\\"descendantsComplete: descendantsComplete, component: { name: &quot;hive-query-plan&quot;, params: params }\\"><pre data-bind=\\"text: plan\\">foo</pre></div>"`;

+ 34 - 0
desktop/core/src/desktop/js/apps/jobBrowser/components/ko.hiveQueryPlan.js

@@ -0,0 +1,34 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import componentUtils from 'ko/components/componentUtils';
+import DisposableComponent from 'ko/components/DisposableComponent';
+
+export const HIVE_QUERY_PLAN_COMPONENT = 'hive-query-plan';
+
+// prettier-ignore
+const TEMPLATE = `
+  <pre data-bind="text: plan"></pre>
+`;
+
+class HiveQueryPlan extends DisposableComponent {
+  constructor(params) {
+    super();
+    this.plan = params.plan;
+  }
+}
+
+componentUtils.registerComponent(HIVE_QUERY_PLAN_COMPONENT, HiveQueryPlan, TEMPLATE);

+ 30 - 0
desktop/core/src/desktop/js/apps/jobBrowser/components/ko.hiveQueryPlan.test.js

@@ -0,0 +1,30 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import { koSetup } from 'jest/koTestUtils';
+import { HIVE_QUERY_PLAN_COMPONENT } from './ko.hiveQueryPlan';
+
+describe('ko.hiveQueryPlan.js', () => {
+  const setup = koSetup();
+
+  it('should render component', async () => {
+    const element = await setup.renderComponent(HIVE_QUERY_PLAN_COMPONENT, {
+      plan: 'foo'
+    });
+
+    expect(element.innerHTML).toMatchSnapshot();
+  });
+});

+ 16 - 0
desktop/core/src/desktop/js/apps/notebook2/components/ko.executableActions.test.js

@@ -1,3 +1,19 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 import huePubSub from 'utils/huePubSub';
 import { koSetup } from 'jest/koTestUtils';
 import { NAME } from './ko.executableActions';

+ 16 - 0
desktop/core/src/desktop/js/apps/notebook2/components/ko.executableProgressBar.test.js

@@ -1,3 +1,19 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 import huePubSub from 'utils/huePubSub';
 import { koSetup } from 'jest/koTestUtils';
 import { NAME } from './ko.executableProgressBar';

+ 16 - 0
desktop/core/src/desktop/js/apps/notebook2/components/ko.paginator.test.js

@@ -1,3 +1,19 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 import { koSetup } from 'jest/koTestUtils';
 import { NAME } from './ko.paginator';
 

+ 16 - 0
desktop/core/src/desktop/js/apps/notebook2/components/ko.queryHistory.test.js

@@ -1,3 +1,19 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 import { koSetup } from 'jest/koTestUtils';
 import { NAME } from './ko.queryHistory';
 

+ 16 - 0
desktop/core/src/desktop/js/apps/notebook2/components/ko.savedQueries.test.js

@@ -1,3 +1,19 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 import { koSetup } from 'jest/koTestUtils';
 import { NAME } from './ko.savedQueries';