TEZ-3064. Tez UI 2: Add All DAGs filters (sree)
Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/7040bbda Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/7040bbda Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/7040bbda Branch: refs/heads/TEZ-2980 Commit: 7040bbda2c456cedb700d9d13c73589664ae327a Parents: 5e4d542 Author: Sreenath Somarajapuram <s...@apache.org> Authored: Thu Jan 21 19:20:43 2016 +0530 Committer: Sreenath Somarajapuram <s...@apache.org> Committed: Thu Feb 25 03:32:52 2016 +0530 ---------------------------------------------------------------------- TEZ-2980-CHANGES.txt | 1 + .../src/main/webapp/app/adapters/timeline.js | 7 +- .../webapp/app/components/dags-page-search.js | 44 ++++++++++ .../webapp/app/components/dags-pagination-ui.js | 92 ++++++++++++++++++++ .../main/webapp/app/components/tab-n-refresh.js | 4 +- .../src/main/webapp/app/controllers/app/dags.js | 4 +- tez-ui2/src/main/webapp/app/controllers/dags.js | 39 ++++++++- tez-ui2/src/main/webapp/app/models/dag.js | 2 +- tez-ui2/src/main/webapp/app/models/timeline.js | 2 +- tez-ui2/src/main/webapp/app/routes/dags.js | 62 +++++++++++-- tez-ui2/src/main/webapp/app/serializers/dag.js | 2 +- tez-ui2/src/main/webapp/app/styles/app.less | 1 + .../webapp/app/styles/dags-page-search.less | 50 +++++++++++ .../main/webapp/app/styles/tab-n-refresh.less | 2 + .../templates/components/dags-page-search.hbs | 74 ++++++++++++++++ .../templates/components/dags-pagination-ui.hbs | 27 ++++++ .../app/templates/components/tab-n-refresh.hbs | 8 +- tez-ui2/src/main/webapp/app/templates/dags.hbs | 6 +- .../components/dags-page-search-test.js | 45 ++++++++++ .../components/dags-pagination-ui-test.js | 47 ++++++++++ .../webapp/tests/unit/controllers/dags-test.js | 7 +- .../main/webapp/tests/unit/routes/dags-test.js | 24 +++++ 22 files changed, 531 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/TEZ-2980-CHANGES.txt ---------------------------------------------------------------------- diff --git a/TEZ-2980-CHANGES.txt b/TEZ-2980-CHANGES.txt index 6a2b343..e34c0fd 100644 --- a/TEZ-2980-CHANGES.txt +++ b/TEZ-2980-CHANGES.txt @@ -23,3 +23,4 @@ ALL CHANGES: TEZ-3043. Tez UI 2: Create configurations page TEZ-3049. Tez UI 2: Add column selector TEZ-3050. Tez UI 2: Add counter columns + TEZ-3064. Tez UI 2: Add All DAGs filters http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/adapters/timeline.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/adapters/timeline.js b/tez-ui2/src/main/webapp/app/adapters/timeline.js index 6e06c7b..93e83cb 100644 --- a/tez-ui2/src/main/webapp/app/adapters/timeline.js +++ b/tez-ui2/src/main/webapp/app/adapters/timeline.js @@ -31,7 +31,12 @@ export default AbstractAdapter.extend({ taskID: 'TEZ_TASK_ID', attemptID: 'TEZ_TASK_ATTEMPT_ID', hiveQueryID: 'HIVE_QUERY_ID', - appID: 'applicationId' + appID: 'applicationId', + + dagName: 'dagName', + user: "user", + status: "status", + contextID: "callerId" }, stringifyFilters: function (filters) { http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/components/dags-page-search.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/components/dags-page-search.js b/tez-ui2/src/main/webapp/app/components/dags-page-search.js new file mode 100644 index 0000000..c9c01e3 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/components/dags-page-search.js @@ -0,0 +1,44 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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 Ember from 'ember'; + +export default Ember.Component.extend({ + classNames: ['dags-page-search'], + + actions: { + dagNameChanged: function (value) { + this.get('targetObject.targetObject').send('searchChanged', 'dagName', value); + }, + dagIDChanged: function (value) { + this.get('targetObject.targetObject').send('searchChanged', 'dagID', value); + }, + submitterChanged: function (value) { + this.get('targetObject.targetObject').send('searchChanged', 'submitter', value); + }, + statusChanged: function (value) { + this.get('targetObject.targetObject').send('searchChanged', 'status', value); + }, + appIDChanged: function (value) { + this.get('targetObject.targetObject').send('searchChanged', 'appID', value); + }, + contextIDChanged: function (value) { + this.get('targetObject.targetObject').send('searchChanged', 'contextID', value); + }, + } +}); http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/components/dags-pagination-ui.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/components/dags-pagination-ui.js b/tez-ui2/src/main/webapp/app/components/dags-pagination-ui.js new file mode 100644 index 0000000..bedb6cb --- /dev/null +++ b/tez-ui2/src/main/webapp/app/components/dags-pagination-ui.js @@ -0,0 +1,92 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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 Ember from 'ember'; + +export default Ember.Component.extend({ + tableDefinition: null, + dataProcessor: null, + + classNames: ['pagination-ui'], + isVisible: Ember.computed.alias('tableDefinition.enablePagination'), + + atFirst: Ember.computed('tableDefinition.pageNum', function () { + return this.get('tableDefinition.pageNum') === 1; + }), + + atLast: Ember.computed('tableDefinition.pageNum', 'dataProcessor.totalPages', function () { + return this.get('tableDefinition.pageNum') === this.get('dataProcessor.totalPages'); + }), + + rowCountOptions: Ember.computed('tableDefinition.rowCountOptions', 'tableDefinition.rowCount', function () { + var options = this.get('tableDefinition.rowCountOptions'), + rowCount = this.get('tableDefinition.rowCount'); + + return options.map(function (option) { + return { + value: option, + selected: option === rowCount + }; + }); + }), + + _possiblePages: Ember.computed('tableDefinition.pageNum', 'dataProcessor.totalPages', function () { + var pageNum = this.get('tableDefinition.pageNum'), + totalPages = this.get('dataProcessor.totalPages'), + possiblePages = [], + startPage = 1, + endPage = totalPages, + delta = 0; + + if(totalPages > 5) { + startPage = pageNum - 2; + endPage = pageNum + 2; + + if(startPage < 1) { + delta = 1 - startPage; + } + else if(endPage > totalPages) { + delta = totalPages - endPage; + } + + startPage += delta; + endPage += delta; + } + + while(startPage <= endPage) { + possiblePages.push({ + isCurrent: startPage === pageNum, + pageNum: startPage++ + }); + } + + return possiblePages; + }), + + actions: { + rowSelected: function (value) { + value = parseInt(value); + if(this.get('tableDefinition.rowCount') !== value) { + this.get('parentView').send('rowChanged', value); + } + }, + changePage: function (value) { + this.get('parentView').send('pageChanged', value); + } + } +}); http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/components/tab-n-refresh.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/components/tab-n-refresh.js b/tez-ui2/src/main/webapp/app/components/tab-n-refresh.js index 3f05371..555418e 100644 --- a/tez-ui2/src/main/webapp/app/components/tab-n-refresh.js +++ b/tez-ui2/src/main/webapp/app/components/tab-n-refresh.js @@ -24,13 +24,15 @@ export default Ember.Component.extend({ this.setApplication(); }, + autoRefreshEnabled: true, + setApplication: function () { var application = this.get("targetObject.container").lookup('controller:application'); this.set("application", application); }, normalizedTabs: Ember.computed("tabs", "application.currentPath", function () { - var tabs = this.get("tabs"), + var tabs = this.get("tabs") || [], activeRouteName = this.get("application.currentPath"); return tabs.map(function (tab) { http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/controllers/app/dags.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/controllers/app/dags.js b/tez-ui2/src/main/webapp/app/controllers/app/dags.js index 04f8f43..547c4ee 100644 --- a/tez-ui2/src/main/webapp/app/controllers/app/dags.js +++ b/tez-ui2/src/main/webapp/app/controllers/app/dags.js @@ -42,9 +42,9 @@ export default TablePageController.extend({ headerTitle: 'Id', contentPath: 'entityID' },{ - id: 'user', + id: 'submitter', headerTitle: 'Submitter', - contentPath: 'user' + contentPath: 'submitter' },{ id: 'status', headerTitle: 'Status', http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/controllers/dags.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/controllers/dags.js b/tez-ui2/src/main/webapp/app/controllers/dags.js index 7d5f1d9..d35d8f7 100644 --- a/tez-ui2/src/main/webapp/app/controllers/dags.js +++ b/tez-ui2/src/main/webapp/app/controllers/dags.js @@ -16,13 +16,41 @@ * limitations under the License. */ +import Ember from 'ember'; + import TablePageController from './table-page'; import ColumnDefinition from 'em-table/utils/column-definition'; +import TableDefinition from 'em-table/utils/table-definition'; export default TablePageController.extend({ + queryParams: ["dagName", "dagID", "submitter", "status", "appID", "contextID", "pageNo"], + dagName: "", + dagID: "", + submitter: "", + status: "", + appID: "", + contextID: "", + pageNo: 1, + breadcrumbs: [], + headerComponentNames: ['dags-page-search', 'table-controls', 'dags-pagination-ui'], + + definition: Ember.computed("dagName", "dagID", "submitter", "status", "appID", "contextID", "pageNo", function () { + return TableDefinition.create({ + dagName: this.get("dagName"), + dagID: this.get("dagID"), + submitter: this.get("submitter"), + status: this.get("status"), + appID: this.get("appID"), + contextID: this.get("contextID"), + + pageNum: this.get("pageNo"), + rowCountOptions: [5, 10, 25, 50, 100, 250, 500] + }); + }), + columns: ColumnDefinition.make([{ id: 'name', headerTitle: 'Dag Name', @@ -40,9 +68,9 @@ export default TablePageController.extend({ headerTitle: 'Id', contentPath: 'entityID' },{ - id: 'user', + id: 'submitter', headerTitle: 'Submitter', - contentPath: 'user' + contentPath: 'submitter' },{ id: 'status', headerTitle: 'Status', @@ -107,5 +135,12 @@ export default TablePageController.extend({ getCounterColumns: function () { return this._super().concat(this.get('env.app.tables.defaultColumns.dagCounters')); + }, + + actions: { + searchChanged: function (propertyName, value) { + this.set(propertyName, value); + }, } + }); http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/models/dag.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/models/dag.js b/tez-ui2/src/main/webapp/app/models/dag.js index 2efb65f..e0a4b55 100644 --- a/tez-ui2/src/main/webapp/app/models/dag.js +++ b/tez-ui2/src/main/webapp/app/models/dag.js @@ -40,7 +40,7 @@ import TimelineModel from './timeline'; export default TimelineModel.extend({ name: DS.attr("string"), - user: DS.attr("string"), + submitter: DS.attr("string"), contextID: DS.attr("string"), domain: DS.attr("string"), http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/models/timeline.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/models/timeline.js b/tez-ui2/src/main/webapp/app/models/timeline.js index 6f9ddb7..cdd8d22 100644 --- a/tez-ui2/src/main/webapp/app/models/timeline.js +++ b/tez-ui2/src/main/webapp/app/models/timeline.js @@ -67,7 +67,7 @@ export default AbstractModel.extend({ counterGroups: DS.attr('object'), counterHash: Ember.computed("counterGroups", function () { var counterHash = {}, - counterGroups = this.get("counterGroups"); + counterGroups = this.get("counterGroups") || []; counterGroups.forEach(function (group) { var counters = group.counters, http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/routes/dags.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/dags.js b/tez-ui2/src/main/webapp/app/routes/dags.js index ecd1b00..b9484be 100644 --- a/tez-ui2/src/main/webapp/app/routes/dags.js +++ b/tez-ui2/src/main/webapp/app/routes/dags.js @@ -20,17 +20,33 @@ import Ember from 'ember'; import AbstractRoute from './abstract'; +const REFRESH = {refreshModel: true}; + export default AbstractRoute.extend({ title: "All DAGs", queryParams: { - rowCount: { - refreshModel: true - } + dagName: REFRESH, + dagID: REFRESH, + submitter: REFRESH, + status: REFRESH, + appID: REFRESH, + contextID: REFRESH, + pageNo: REFRESH, + + rowCount: REFRESH, }, loaderQueryParams: { - rowCount: "rowCount" + dagName: "dagName", + dagID: "dagID", + user: "submitter", + status: "status", + appID: "appID", + contextID: "contextID", + + pageNo: "pageNo", + limit: "rowCount", }, setupController: function (controller, model) { @@ -38,7 +54,43 @@ export default AbstractRoute.extend({ Ember.run.later(this, "startCrumbBubble"); }, + // Client side filtering to ensure that records are relevant after status correction + filterRecords: function (records, query) { + query = { + name: query.dagName, + entityID: query.dagID, + submitter: query.submitter, + status: query.status, + appID: query.appID, + contextID: query.contextID + }; + + return records.filter(function (record) { + for(var propName in query) { + if(query[propName] && query[propName] !== record.get(propName)) { + return false; + } + } + return true; + }); + }, + load: function (value, query) { - return this.get("loader").query('dag', query); + var loader, + that = this; + + if(query.dagID) { + that.set("loadedRecords", []); + loader = this.get("loader").queryRecord('dag', query.dagID).then(function (record) { + return [record]; + }); + } + else { + loader = this.get("loader").query('dag', query); + } + + return loader.then(function (records) { + return that.filterRecords(records, query); + }); } }); http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/serializers/dag.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/serializers/dag.js b/tez-ui2/src/main/webapp/app/serializers/dag.js index 00113e4..9da7bb5 100644 --- a/tez-ui2/src/main/webapp/app/serializers/dag.js +++ b/tez-ui2/src/main/webapp/app/serializers/dag.js @@ -106,7 +106,7 @@ export default TimelineSerializer.extend({ maps: { name: 'primaryfilters.dagName.0', - user: 'primaryfilters.user.0', + submitter: 'primaryfilters.user.0', contextID: 'primaryfilters.callerId.0', atsStatus: getStatus, http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/styles/app.less ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/styles/app.less b/tez-ui2/src/main/webapp/app/styles/app.less index d697ba7..758d1ab 100644 --- a/tez-ui2/src/main/webapp/app/styles/app.less +++ b/tez-ui2/src/main/webapp/app/styles/app.less @@ -22,6 +22,7 @@ @import "tooltip"; @import "tab-n-refresh"; +@import "dags-page-search"; @import "page-layout"; @import "details-page"; http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/styles/dags-page-search.less ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/styles/dags-page-search.less b/tez-ui2/src/main/webapp/app/styles/dags-page-search.less new file mode 100644 index 0000000..2fa0216 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/styles/dags-page-search.less @@ -0,0 +1,50 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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. + */ + +@media screen and (min-width: 1500px) { + .dags-page-search{ + float: left; + width: 1000px; + + .form-group { + margin-bottom: 0px; + } + } + + .all-dags-table { + .pagination-ui, .table-controls { + margin-top: 21px; + } + } +} + +.dags-page-search { + text-align: justify; + + + .search-element { + display: inline-block; + width: 16.66%; + + padding-left: 3px; + } + + .dag-name { + padding-left: 0px; + } +} http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/styles/tab-n-refresh.less ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/styles/tab-n-refresh.less b/tez-ui2/src/main/webapp/app/styles/tab-n-refresh.less index 698f8f3..ab930f2 100644 --- a/tez-ui2/src/main/webapp/app/styles/tab-n-refresh.less +++ b/tez-ui2/src/main/webapp/app/styles/tab-n-refresh.less @@ -22,6 +22,8 @@ margin-bottom: 10px; position: relative; + height: 42px; + .refresh-ui { position: absolute; right: 0px; http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/templates/components/dags-page-search.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/components/dags-page-search.hbs b/tez-ui2/src/main/webapp/app/templates/components/dags-page-search.hbs new file mode 100644 index 0000000..0c118e4 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/templates/components/dags-page-search.hbs @@ -0,0 +1,74 @@ +{{! + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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. +}} + +<div class="form-group"> + <div class="search-element dag-name"> + <label for="pwd">DAG Name:</label> + <input + type="text" + class="form-control input-sm" + placeholder="Search..." + value={{tableDefinition.dagName}} + onchange={{action "dagNameChanged" value="target.value"}}> + </div><div class="search-element"> + <label for="pwd">ID:</label> + <input + type="text" + class="form-control input-sm" + placeholder="Search..." + value={{tableDefinition.dagID}} + onchange={{action "dagIDChanged" value="target.value"}}> + </div><div class="search-element"> + <label for="pwd">Submitter:</label> + <input + type="text" + class="form-control input-sm" + placeholder="Search..." + value={{tableDefinition.submitter}} + onchange={{action "submitterChanged" value="target.value"}}> + </div><div class="search-element"> + <label for="pwd">Status:</label> + <select + class="form-control input-sm" + value={{tableDefinition.status}} + onchange={{action "statusChanged" value="target.value"}}> + <option value="">All</option> + <option value="SUBMITTED">Submitted</option> + <option value="RUNNING">Running</option> + <option value="SUCCEEDED">Succeeded</option> + <option value="FAILED">Failed</option> + <option value="ERROR">Error</option> + </select> + </div><div class="search-element"> + <label for="pwd">Application ID:</label> + <input + type="text" + class="form-control input-sm" + placeholder="Search..." + value={{tableDefinition.appID}} + onchange={{action "appIDChanged" value="target.value"}}> + </div><div class="search-element"> + <label for="pwd">Context ID:</label> + <input + type="text" + class="form-control input-sm" + placeholder="Search..." + value={{tableDefinition.contextID}} + onchange={{action "contextIDChanged" value="target.value"}}> + </div> +</div> http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/templates/components/dags-pagination-ui.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/components/dags-pagination-ui.hbs b/tez-ui2/src/main/webapp/app/templates/components/dags-pagination-ui.hbs new file mode 100644 index 0000000..60b3bee --- /dev/null +++ b/tez-ui2/src/main/webapp/app/templates/components/dags-pagination-ui.hbs @@ -0,0 +1,27 @@ +{{! + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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. +}} + +<div class='row-select'> + <select class="form-control" onchange={{action "rowSelected" value="target.value"}}> + {{#each rowCountOptions as |option|}} + <option value={{option.value}} selected={{option.selected}}> + {{option.value}} Rows + </option> + {{/each}} + </select> +</div> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/templates/components/tab-n-refresh.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/components/tab-n-refresh.hbs b/tez-ui2/src/main/webapp/app/templates/components/tab-n-refresh.hbs index 4075c54..6b9c822 100644 --- a/tez-ui2/src/main/webapp/app/templates/components/tab-n-refresh.hbs +++ b/tez-ui2/src/main/webapp/app/templates/components/tab-n-refresh.hbs @@ -26,9 +26,11 @@ {{/each}} <span class="refresh-ui"> <span class="text-elements"> - {{input type="checkbox" name="autoEnabled" checked=autoEnabled}} - Auto Refresh - <br/> + <span class="auto-refresh {{unless autoRefreshEnabled 'no-visible'}}"> + {{input type="checkbox" name="autoEnabled" checked=autoEnabled}} + Auto Refresh + <br/> + </span> {{#if displayTime}} Last refreshed at <b>{{displayTime}}</b> {{else}} http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/app/templates/dags.hbs ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/templates/dags.hbs b/tez-ui2/src/main/webapp/app/templates/dags.hbs index 1fd0eef..3e64a7e 100644 --- a/tez-ui2/src/main/webapp/app/templates/dags.hbs +++ b/tez-ui2/src/main/webapp/app/templates/dags.hbs @@ -16,15 +16,19 @@ * limitations under the License. }} +{{tab-n-refresh tabs=tabs autoRefreshEnabled=false}} + {{#if loaded}} {{em-table columns=visibleColumns rows=model rowCount=rowCount + classNames="all-dags-table" + headerComponentNames=headerComponentNames - enableSearch=false + definition=definition enableSort=false searchAction="searchChanged" http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/tests/integration/components/dags-page-search-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/integration/components/dags-page-search-test.js b/tez-ui2/src/main/webapp/tests/integration/components/dags-page-search-test.js new file mode 100644 index 0000000..def7413 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/integration/components/dags-page-search-test.js @@ -0,0 +1,45 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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 { moduleForComponent, test } from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; + +moduleForComponent('dags-page-search', 'Integration | Component | dags page search', { + integration: true +}); + +test('Basic creation test', function(assert) { + + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.on('myAction', function(val) { ... });" + EOL + EOL + + + this.render(hbs`{{dags-page-search}}`); + + assert.equal(this.$("input").length, 5); + assert.equal(this.$("select").length, 1); + + // Template block usage:" + EOL + + this.render(hbs` + {{#dags-page-search}} + template block text + {{/dags-page-search}} + `); + + assert.equal(this.$("input").length, 5); + assert.equal(this.$("select").length, 1); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/tests/integration/components/dags-pagination-ui-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/integration/components/dags-pagination-ui-test.js b/tez-ui2/src/main/webapp/tests/integration/components/dags-pagination-ui-test.js new file mode 100644 index 0000000..b4c192a --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/integration/components/dags-pagination-ui-test.js @@ -0,0 +1,47 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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 { moduleForComponent, test } from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; + +moduleForComponent('dags-pagination-ui', 'Integration | Component | dags pagination ui', { + integration: true +}); + +test('Basic creation test', function(assert) { + + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.on('myAction', function(val) { ... });" + EOL + EOL + + + this.set("rowCountOptions", { + rowCountOptions: [1, 2] + }); + + this.render(hbs`{{dags-pagination-ui rowCountOptions=rowCountOptions}}`); + + assert.equal(this.$('select').length, 1); + + // Template block usage:" + EOL + + this.render(hbs` + {{#dags-pagination-ui rowCountOptions=rowCountOptions}} + template block text + {{/dags-pagination-ui}} + `); + + assert.equal(this.$('select').length, 1); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/tests/unit/controllers/dags-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/controllers/dags-test.js b/tez-ui2/src/main/webapp/tests/unit/controllers/dags-test.js index 21dbc96..996dd39 100644 --- a/tez-ui2/src/main/webapp/tests/unit/controllers/dags-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/controllers/dags-test.js @@ -26,7 +26,7 @@ moduleFor('controller:dags', 'Unit | Controller | dags', { }); test('Basic creation test', function(assert) { - assert.expect(2 + 3); + assert.expect(2 + 3 + 4); let controller = this.subject({ initVisibleColumns: Ember.K, @@ -39,4 +39,9 @@ test('Basic creation test', function(assert) { assert.ok(controller); assert.ok(controller.columns); assert.ok(controller.getCounterColumns); + + assert.ok(controller.queryParams); + assert.ok(controller.headerComponentNames); + assert.ok(controller.definition); + assert.ok(controller.actions.searchChanged); }); http://git-wip-us.apache.org/repos/asf/tez/blob/7040bbda/tez-ui2/src/main/webapp/tests/unit/routes/dags-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/routes/dags-test.js b/tez-ui2/src/main/webapp/tests/unit/routes/dags-test.js index 8b99a7f..baadf16 100644 --- a/tez-ui2/src/main/webapp/tests/unit/routes/dags-test.js +++ b/tez-ui2/src/main/webapp/tests/unit/routes/dags-test.js @@ -16,6 +16,7 @@ * limitations under the License. */ +import Ember from 'ember'; import { moduleFor, test } from 'ember-qunit'; moduleFor('route:dags', 'Unit | Route | dags', { @@ -28,7 +29,30 @@ test('Basic creation test', function(assert) { assert.ok(route); assert.ok(route.title); + + assert.ok(route.queryParams); assert.ok(route.loaderQueryParams); assert.ok(route.setupController); assert.ok(route.load); + + assert.ok(route.filterRecords); +}); + +test('filterRecords test', function(assert) { + let route = this.subject(), + testRecords = [Ember.Object.create({ + name: "test" + }), Ember.Object.create({ + + }),Ember.Object.create({ + name: "notest" + })], + testQuery = { + dagName: "test" + }; + + let filteredRecords = route.filterRecords(testRecords, testQuery); + + assert.equal(filteredRecords.length, 1); + assert.equal(filteredRecords[0].name, "test"); });