http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/helpers/number.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/helpers/number.js b/tez-ui/src/main/webapp/app/scripts/helpers/number.js deleted file mode 100644 index 3e5b3d3..0000000 --- a/tez-ui/src/main/webapp/app/scripts/helpers/number.js +++ /dev/null @@ -1,127 +0,0 @@ -/** - * 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. - */ - -App.Helpers.number = { - - MAX_SAFE_INTEGER: 9007199254740991, - - /** - * Convert byte size to other metrics. - * - * @param {Number} bytes to convert to string - * @param {Number} precision Number to adjust precision of return value. Default is 0. - * @param {String} parseType - * JS method name for parse string to number. Default is "parseInt". - * @param {Number} multiplyBy bytes by this number if given. This is needed - * as <code>null * 1024 = 0</null> - * @remarks The parseType argument can be "parseInt" or "parseFloat". - * @return {String} Returns converted value with abbreviation. - */ - bytesToSize: function (bytes, precision, parseType, multiplyBy) { - if (isNaN(bytes)) bytes = 0; - if (Em.isNone(bytes)) { - return 'n/a'; - } else { - if (arguments[2] === undefined) { - parseType = 'parseInt'; - } - if (arguments[3] === undefined) { - multiplyBy = 1; - } - var value = bytes * multiplyBy; - var sizes = [ 'Bytes', 'KB', 'MB', 'GB', 'TB', 'PB' ]; - var posttxt = 0; - while (value >= 1024) { - posttxt++; - value = value / 1024; - } - if (value === 0) { - precision = 0; - } - var parsedValue = window[parseType](value); - return parsedValue.toFixed(precision) + " " + sizes[posttxt]; - } - }, - - /** - * Validates if the given string or number is an integer between the - * values of min and max (inclusive). The minimum and maximum - * checks are ignored if their valid is NaN. - * - * @method validateInteger - * @param {string|number} str - input string - * @param {string|number} [min] - * @param {string|number} [max] - */ - validateInteger : function(str, min, max) { - if (Em.isNone(str) || (str + "").trim().length < 1) { - return Em.I18n.t('number.validate.empty'); - } - str = (str + "").trim(); - var number = parseInt(str); - if (isNaN(number)) { - return Em.I18n.t('number.validate.notValidNumber'); - } - if (str.length != (number + "").length) { - // parseInt("1abc") returns 1 as integer - return Em.I18n.t('number.validate.notValidNumber'); - } - if (!isNaN(min) && number < min) { - return Em.I18n.t('number.validate.lessThanMinumum').fmt(min); - } - if (!isNaN(max) && number > max) { - return Em.I18n.t('number.validate.moreThanMaximum').fmt(max); - } - return null; - }, - - /** - * Format value with US style thousands separator - * @param {string/number} value to be formatted - * @returns {string} Formatted string - */ - formatNumThousands: function (value) { - if(/^[\d\.]+$/.test(value)) { - var parts = value.toString().split("."); - parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); - return parts.join("."); - } - return value; - }, - - /** - * Checks if the value is an integer or can be converted to an integer. - * a value of NaN returns false. - * @method: isValidInt - * @param {string|number} value to check - * @return {boolean} - */ - isValidInt: function(value) { - return value % 1 == 0; - }, - - /** - * converts fraction to percentage. - * @param {number} fraction assumes < 1 - * @return {float} fixed decimal point formatted percentage - */ - fractionToPercentage: function(number, decimal) { - decimal = decimal || 2; - return parseFloat((number * 100).toFixed(decimal)) + ' %'; - } - -}; \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/helpers/pollster.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/helpers/pollster.js b/tez-ui/src/main/webapp/app/scripts/helpers/pollster.js deleted file mode 100644 index ee72f64..0000000 --- a/tez-ui/src/main/webapp/app/scripts/helpers/pollster.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * 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. - */ -App.Helpers.Pollster = Ember.Object.extend({ - interval: function() { - return this.get('_interval') || 10000; // Time between polls (in ms) - }.property().readOnly(), - - // Schedules the function `f` to be executed every `interval` time. - // if runImmediate is set first run is scheduled immedietly - schedule: function(f, runImmediete) { - var timer = this.get('timer'); - if(timer) { - return timer; - } - return Ember.run.later(this, function() { - f.apply(this); - this.set('timer', null); - this.set('timer', this.schedule(f)); - }, this.get('interval')); - }, - - // Stops the pollster - stop: function() { - Ember.run.cancel(this.get('timer')); - this.set('timer', null); - }, - - // Starts the pollster, i.e. executes the `onPoll` function every interval. - start: function(runImmediate, interval) { - if (!!interval && interval > 1000) { - this.set('_interval', interval) - } - var callback = this.get('onPoll'); - if (runImmediate) { - callback.apply(this); - } - this.set('timer', this.schedule(callback, runImmediate)); - }, - - onPoll: function(){ - // Issue JSON request and add data to the store - } -}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/helpers/translation.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/helpers/translation.js b/tez-ui/src/main/webapp/app/scripts/helpers/translation.js deleted file mode 100644 index ed32a39..0000000 --- a/tez-ui/src/main/webapp/app/scripts/helpers/translation.js +++ /dev/null @@ -1,119 +0,0 @@ -/** - * 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. - */ - -Ember.I18n.translations = { - - 'any': 'Any', - 'apply': 'Apply', - 'ok': 'Ok', - 'cancel': 'Cancel', - - 'common.id': 'Entity Id', - 'common.applicationId': 'Application Id', - 'common.status':'Status', - 'common.time.start': 'Start Time', - 'common.time.end': 'End Time', - 'common.name': 'Name', - 'common.tasks':'Tasks', - 'common.na': 'n/a', - 'common.value': 'Value', - 'common.user': 'User', - 'common.time.duration': 'Duration', - - 'number.validate.empty': 'cannot be empty', - 'number.validate.notValidNumber': 'not a valid number', - 'number.validate.lessThanMinumum': 'value less than %@1', - 'number.validate.moreThanMaximum': 'value greater than %@1', - - 'common.loading': 'Loading...', - 'http.error.400': 'Unable to load data.', - 'dags.nothingToShow': 'No Dags to display', - - 'jobs.type':'Jobs Type', - 'jobs.type.hive':'Hive', - 'jobs.show.up.to':'Show up to', - 'jobs.filtered.jobs':'%@ jobs showing', - 'jobs.filtered.clear':'clear filters', - 'jobs.column.id':'Id', - 'jobs.column.user':'User', - 'jobs.column.start.time':'Start Time', - 'jobs.column.end.time':'End Time', - 'jobs.column.duration':'Duration', - 'jobs.new_jobs.info':'New jobs available on server.', - 'jobs.loadingTasks': 'Loading...', - - 'jobs.nothingToShow': 'No jobs to display', - 'jobs.error.ats.down': 'Jobs data cannot be shown since YARN App Timeline Server is not running.', - 'jobs.error.400': 'Unable to load data.', - 'jobs.table.custom.date.am':'AM', - 'jobs.table.custom.date.pm':'PM', - 'jobs.table.custom.date.header':'Select Custom Dates', - 'jobs.table.job.fail':'Job failed to run', - 'jobs.customDateFilter.error.required':'This field is required', - 'jobs.customDateFilter.error.date.order':'End Date must be after Start Date', - 'jobs.customDateFilter.startTime':'Start Time', - 'jobs.customDateFilter.endTime':'End Time', - 'jobs.hive.failed':'JOB FAILED', - 'jobs.hive.more':'show more', - 'jobs.hive.less':'show less', - 'jobs.hive.query':'Hive Query', - 'jobs.hive.stages':'Stages', - 'jobs.hive.yarnApplication':'YARN Application', - 'jobs.hive.tez.tasks':'Tez Tasks', - 'jobs.hive.tez.hdfs':'HDFS', - 'jobs.hive.tez.localFiles':'Local Files', - 'jobs.hive.tez.spilledRecords':'Spilled Records', - 'jobs.hive.tez.records':'Records', - 'jobs.hive.tez.reads':'%@1 reads', - 'jobs.hive.tez.writes':'%@1 writes', - 'jobs.hive.tez.records.count':'%@1 Records', - 'jobs.hive.tez.operatorPlan':'Operator Plan', - 'jobs.hive.tez.dag.summary.metric':'Summary Metric', - 'jobs.hive.tez.dag.error.noDag.title':'No Tez Information', - 'jobs.hive.tez.dag.error.noDag.message':'This job does not identify any Tez information.', - 'jobs.hive.tez.dag.error.noDagId.title':'No Tez Information', - 'jobs.hive.tez.dag.error.noDagId.message':'No Tez information was found for this job. Either it is waiting to be run, or has exited unexpectedly.', - 'jobs.hive.tez.dag.error.noDagForId.title':'No Tez Information', - 'jobs.hive.tez.dag.error.noDagForId.message':'No details were found for the Tez ID given to this job.', - 'jobs.hive.tez.metric.input':'Input', - 'jobs.hive.tez.metric.output':'Output', - 'jobs.hive.tez.metric.recordsRead':'Records Read', - 'jobs.hive.tez.metric.recordsWrite':'Records Written', - 'jobs.hive.tez.metric.tezTasks':'Tez Tasks', - 'jobs.hive.tez.metric.spilledRecords':'Spilled Records', - 'jobs.hive.tez.edge.':'Unknown', - 'jobs.hive.tez.edge.contains':'Contains', - 'jobs.hive.tez.edge.broadcast':'Broadcast', - 'jobs.hive.tez.edge.scatter_gather':'Shuffle', - - 'app.loadingPlaceholder': 'Loading...', - 'apps.item.dag.job': 'Job', - 'apps.item.dag.jobId': 'Job Id', - 'apps.item.dag.type': 'Job Type', - 'apps.item.dag.status': 'Status', - 'apps.item.dag.num_stages': 'Total Stages', - 'apps.item.dag.stages': 'Tasks per Stage', - 'apps.item.dag.maps': 'Maps', - 'apps.item.dag.reduces': 'Reduces', - 'apps.item.dag.input': 'Input', - 'apps.item.dag.output': 'Output', - 'apps.item.dag.duration': 'Duration', - - 'menu.item.jobs':'Jobs' - -}; http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/mixins/auto-counter-column-mixin.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/mixins/auto-counter-column-mixin.js b/tez-ui/src/main/webapp/app/scripts/mixins/auto-counter-column-mixin.js deleted file mode 100644 index e868117..0000000 --- a/tez-ui/src/main/webapp/app/scripts/mixins/auto-counter-column-mixin.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * 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. - */ - -App.AutoCounterColumnMixin = Em.Mixin.create({ - - baseEntityType: null, // Must be set in the controller that uses this Mixin - - columnSelectorMessage: function () { - return "<span class='per-io'>Per-IO counter</span> selection wouldn't persist across %@.".fmt( - this.get('filterEntityType').pluralize() - ); - }.property('filterEntityType'), - - columnConfigs: function() { - var counterConfigs = App.Helpers.misc.normalizeCounterConfigs( - App.get('Configs.defaultCounters').concat( - App.get('Configs.tables.entity.' + this.get('baseEntityType')) || [], - App.get('Configs.tables.sharedColumns') || [] - ) - , this), dynamicCounterConfigs = []; - - this.get('data').forEach(function (row) { - var counterGroups = row.get('counterGroups'); - if(counterGroups) { - counterGroups.forEach(function (group) { - group.counters.forEach(function (counter) { - dynamicCounterConfigs.push({ - counterName: counter.counterName, - counterGroupName: group.counterGroupName - }); - }); - }); - } - }); - - return this.get('defaultColumnConfigs').concat( - App.Helpers.misc.getUniqueByProperty(counterConfigs.concat( - App.Helpers.misc.normalizeCounterConfigs(dynamicCounterConfigs) - ), 'id') - ); - }.property('data', 'defaultColumnConfigs', 'baseEntityType') - -}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/mixins/column-selector-mixin.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/mixins/column-selector-mixin.js b/tez-ui/src/main/webapp/app/scripts/mixins/column-selector-mixin.js deleted file mode 100644 index 34f2731..0000000 --- a/tez-ui/src/main/webapp/app/scripts/mixins/column-selector-mixin.js +++ /dev/null @@ -1,147 +0,0 @@ -/** - * 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. - */ - -function isObjectsDifferent(obj1, obj2) { - var property; - for(property in obj1) { - if(obj1[property] !== obj2[property]) { - return true; - } - } - for(property in obj2) { - if(obj1[property] !== obj2[property]) { - return true; - } - } - return false; -} - -App.ColumnSelectorMixin = Em.Mixin.create({ - - name: 'PaginatedContentMixin', - - _storeKey: '', - visibleColumnIds: {}, - columnConfigs: [], - selectOptions: [], - - columnSelectorTitle: 'Column Selector', - columnSelectorMessage: '', - - init: function(){ - var visibleColumnIds; - - this._storeKey = this.controllerName + ':visibleColumnIds'; - try { - visibleColumnIds = JSON.parse(localStorage.getItem(this._storeKey)); - }catch(e){} - - visibleColumnIds = visibleColumnIds || {}; - - this.get('defaultColumnConfigs').forEach(function (config) { - if(visibleColumnIds[config.id] != false) { - visibleColumnIds[config.id] = true; - } - }); - - this._super(); - this.set('visibleColumnIds', visibleColumnIds); - }.observes('defaultColumnConfigs'), //To reset on entity change - - columns: function() { - var visibleColumnConfigs = this.get('columnConfigs').filter(function (column) { - return this.visibleColumnIds[column.id]; - }, this); - - return App.Helpers.misc.createColumnDescription(visibleColumnConfigs); - }.property('visibleColumnIds', 'columnConfigs'), - - _getSelectOptions: function () { - var group = null, - highlight = false, - visibleColumnIds = this.get('visibleColumnIds'); - - return this.get('columnConfigs').map(function (config) { - var css = ''; - - highlight = highlight ^ (config.counterGroupName != group), - group = config.counterGroupName; - - if(highlight) { - css += ' highlight'; - } - if(group && App.Helpers.misc.checkIOCounterGroup(group)) { - css += ' per-io'; - } - - return Em.Object.create({ - id: config.id, - displayText: config.headerCellName, - css: css, - selected: visibleColumnIds[config.id] - }); - }); - }, - - actions: { - selectColumns: function () { - this.set('selectOptions', this._getSelectOptions()); - - Bootstrap.ModalManager.open( - 'columnSelector', - this.get('columnSelectorTitle'), - App.MultiSelectView.extend({ - options: this.get('selectOptions'), - message: this.get('columnSelectorMessage') - }), - [Ember.Object.create({ - title: 'Ok', - dismiss: 'modal', - clicked: 'selectionChange' - }), Ember.Object.create({ - title: 'Cancel', - dismiss: 'modal', - })], - this - ); - }, - - selectionChange: function () { - var visibleColumnIds = {}, - selectionToSave = {}; - - this.get('selectOptions').forEach(function (option) { - var isSelected = option.get('selected'), - id = option.get('id'), - groupName = id.split('/')[0]; - - visibleColumnIds[id] = isSelected; - if(!groupName.match('_INPUT_') && !groupName.match('_OUTPUT_')) { - selectionToSave[id] = isSelected; - } - }); - - if(isObjectsDifferent(visibleColumnIds, this.get('visibleColumnIds'))) { - try { - localStorage.setItem(this._storeKey , JSON.stringify(selectionToSave)); - }catch(e){} - this.set('visibleColumnIds', visibleColumnIds); - } - } - } -}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/mixins/data-array-loader-minxin.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/mixins/data-array-loader-minxin.js b/tez-ui/src/main/webapp/app/scripts/mixins/data-array-loader-minxin.js deleted file mode 100644 index 952ce74..0000000 --- a/tez-ui/src/main/webapp/app/scripts/mixins/data-array-loader-minxin.js +++ /dev/null @@ -1,125 +0,0 @@ -/** - * 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. - */ - -var dataCache = {}; - -App.DataArrayLoaderMixin = Em.Mixin.create({ - data: [], - loading: false, - - entityType: null, - filterEntityType: null, - filterEntityId: null, - - // At a time for an entity type, records under one single domain value will only be cached. - cacheDomain: undefined, - - isRefreshable: true, - - _cacheKey: function () { - return [ - this.get('filterEntityType'), - this.get('filterEntityId'), - this.get('entityType'), - ].join(':'); - }.property('filterEntityType', 'filterEntityId', 'entityType'), - - getFilter: function (limit) { - return { - limit: limit || App.Helpers.number.MAX_SAFE_INTEGER, - primaryFilter: '%@:%@'.fmt( - App.Helpers.misc.getTimelineFilterForType(this.get('filterEntityType')), - this.get('filterEntityId') - ) - }; - }, - - loadData: function (skipCache) { - var data; - - if(this.get('loading')) { - return false; - } - - if(!skipCache) { - data = dataCache[this.get('_cacheKey')]; - } - - if(data && data.get('content.length')) { - this.set('data', data); - } - else { - this.loadAllData(); - } - - return true; - }, - - loadAllData: function () { - this.set('loading', true); - - // Load all rows - return this.beforeLoad(). - then(this.load.bind(this, this.getFilter())). - then(this.afterLoad.bind(this)). - then(this.cacheData.bind(this)). - then(this.set.bind(this, 'loading', false)). - catch(this.errorHandler.bind(this)); - }, - - beforeLoad: function () { - return new Em.RSVP.resolve(); - }, - - load: function (filter) { - var entityType = this.get('entityType'), - store = this.get('store'), - data = dataCache[this.get('_cacheKey')], - domainKey = entityType + ":Domain"; - - if(this.get('cacheDomain') != dataCache[domainKey]) { - store.unloadAll(entityType); - dataCache[domainKey] = this.get('cacheDomain'); - } - else if(data) { - data.toArray().forEach(function (record) { - record.unloadRecord(); - }); - dataCache[this.get('_cacheKey')] = null; - } - - return store.findQuery(entityType, filter). - then(this.set.bind(this, 'data')). - catch(this.errorHandler.bind(this)); - }, - - cacheData: function () { - dataCache[this.get('_cacheKey')] = this.get('data'); - }, - - errorHandler: function (error) { - Em.Logger.error(error); - var err = App.Helpers.misc.formatError(error, 'Error while loading %@. CORS might not be enabled for YARN ResourceManager and/or Timeline Server.'.fmt(this.get('entityType'))); - var msg = 'Error code: %@, message: %@'.fmt(err.errCode, err.msg); - App.Helpers.ErrorBar.getInstance().show(msg, err.details); - }, - - afterLoad: function () { - return new Em.RSVP.resolve(); - }, -}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/mixins/display_helpers.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/mixins/display_helpers.js b/tez-ui/src/main/webapp/app/scripts/mixins/display_helpers.js deleted file mode 100644 index a89b597..0000000 --- a/tez-ui/src/main/webapp/app/scripts/mixins/display_helpers.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * 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. - */ - -// TODO : document -App.Helpers.DisplayHelper = Em.Mixin.create({ - startTimeDisplay: function() { - var startTime = this.get('startTime'); - return startTime > 0 ? App.Helpers.date.dateFormat(startTime) : ''; - }.property('startTime'), - - endtimeDisplay: function() { - var endTime = this.get('endTime'); - return endTime > 0 ? App.Helpers.date.dateFormat(endTime) : ''; - }.property('endTime'), - - duration: function() { - var startTime = this.get('startTime'); - var endTime = this.get('endTime'); - if(endTime < startTime || endTime == undefined) { - endTime = new Date().getTime(); - } - return App.Helpers.date.duration(startTime, endTime); - }.property('startTime', 'endTime') -}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/mixins/model-refresh-mixin.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/mixins/model-refresh-mixin.js b/tez-ui/src/main/webapp/app/scripts/mixins/model-refresh-mixin.js deleted file mode 100644 index 5ba120f..0000000 --- a/tez-ui/src/main/webapp/app/scripts/mixins/model-refresh-mixin.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * 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. - */ - -App.ModelRefreshMixin = Em.Mixin.create({ - isRefreshable: true, - - load: function () { - var model = this.get('content'); - if(model && $.isFunction(model.reload)) { - model.reload(); - } - }, - - actions: { - refresh: function () { - App.Helpers.ErrorBar.getInstance().hide(); - this.load(); - } - } -}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/mixins/paginated_content.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/mixins/paginated_content.js b/tez-ui/src/main/webapp/app/scripts/mixins/paginated_content.js deleted file mode 100644 index d393df7..0000000 --- a/tez-ui/src/main/webapp/app/scripts/mixins/paginated_content.js +++ /dev/null @@ -1,202 +0,0 @@ -/** - * 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. - */ - -App.PaginatedContentMixin = Em.Mixin.create({ - // paging related values. These are bound automatically to the values in url. via the queryParams - // defined in the route. - rowCount: 10, - - page: 1, - fromID: null, - - // The dropdown contents for number of items to show. - rowCountOptions: [5, 10, 25, 50, 100], - maxRowCount: function () { - return Math.max.apply(null, this.get('rowCountOptions')); - }.property('rowCountOptions'), - - isRefreshable: true, - - /* There is currently no efficient way in ATS to get pagination data, so we fake one. - * store the first dag id on a page so that we can navigate back and store the last one - * (not shown on page to get the id where next page starts) - */ - navIDs: [], - - queryParams: { - rowCount: true, - }, - - entities: [], - _paginationFilters: {}, - loading: false, - - load: function() { - if(!this.get('loading')) { - this.resetNavigation(); - this.loadEntities(); - } - }.observes('rowCount'), - - lastPage: function () { - return this.get('navIDs.length') + 1; - }.property('navIDs.length'), - - sortedContent: function() { - // convert to a ArrayController. we do not sort at this point as the data is - // not globally sorted, and the total number of elements in array is unknown - var sorted = Em.ArrayController.create({ - model: this.get('entities') - }); - this.updatePagination(sorted.toArray()); - return sorted.slice(0, this.rowCount); - }.property('entities', 'numEntities'), - - updateLoading: function () { - this.set('loading', false); - }, - - loadEntities: function() { - var that = this; - var childEntityType = this.get('childEntityType'); - var defaultErrMsg = 'Error while loading %@.' - .fmt(childEntityType); - - - that.set('loading', true); - - this.get('store').unloadAll(childEntityType); - this.get('store').findQuery(childEntityType, this.getFilterProperties()).then(function(entities){ - that.set('entities', entities); - var loaders = []; - try { - var loader = Em.tryInvoke(that, 'loadAdditional'); - if (!!loader) { - loaders.push(loader); - } - } catch(error) { - Em.Logger.error("Exception invoking additional load", error); - } - Em.RSVP.allSettled(loaders).then(function(){ - that.updateLoading(); - }); - }).catch(function(error){ - Em.Logger.error(error); - var err = App.Helpers.misc.formatError(error, defaultErrMsg); - var msg = 'error code: %@, message: %@'.fmt(err.errCode, err.msg); - App.Helpers.ErrorBar.getInstance().show(msg, err.details); - }); - }, - - setFiltersAndLoadEntities: function(filters) { - this._paginationFilters = filters; - this.load(); - }, - - resetNavigation: function() { - this.set('navIDs', []); - this.set('fromID', null); - this.set('page', 1); - }, - - updatePagination: function(dataArray) { - var nextFromId = null, - navIDs = this.get('navIDs'), - rowCount = this.get('rowCount'); - - if(dataArray && dataArray.length == rowCount + 1) { - nextFromId = dataArray.objectAt(rowCount).get('id'); - if (navIDs.indexOf(nextFromId) == -1 && - this.get('page') >= navIDs.get('length')) { - navIDs.pushObject(nextFromId); - } - } - }, - - actions:{ - refresh: function () { - this.load(); - }, - - changePage: function (pageNum) { - this.set('fromID', this.get('navIDs.' + (pageNum - 2)) || null); - this.set('loading', true); - this.set('page', pageNum); - this.loadEntities(); - } - }, - - _concatFilters: function(obj) { - var p = []; - for(var k in obj) { - if (!Em.empty(obj[k])) { - p.push(k + ':' + obj[k]); - } - } - return p.join(','); - }, - - getFilterProperties: function(fields) { - var params = { - limit: Math.min(this.rowCount, this.get('maxRowCount')) + 1 - }; - - var f = this._paginationFilters; - var primary = f.primary || {}; - var secondary = f.secondary || {}; - - // TimelineRest API allows only one primaryFilter but any number of - // secondary filters. secondary filters are first checked in otherInfo - // field and then in primaryFilter field. this is tricky (for ex. when - // otherInfo and primaryFilter has same key). so we move all filters - // other than first non null primary to secondary. - var foundOnePrimaryFilter = false; - $.each(primary, function(name, value) { - if (!value) { - delete primary[name]; - return true; - } - if (foundOnePrimaryFilter) { - secondary[name] = value; - delete primary[name]; - } - foundOnePrimaryFilter = true; - }); - - primary = this._concatFilters(primary); - secondary = this._concatFilters(secondary); - - if (!Em.empty(primary)) { - params['primaryFilter'] = primary; - } - - if (!Em.empty(secondary)) { - params['secondaryFilter'] = secondary; - } - - if (!Em.empty(this.get('fromID'))) { - params['fromId'] = this.get('fromID'); - } - - if (fields) { - params['fields'] = fields; - } - - return params; - }, -}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/models/TimelineRestAdapter.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/models/TimelineRestAdapter.js b/tez-ui/src/main/webapp/app/scripts/models/TimelineRestAdapter.js deleted file mode 100644 index 984dffc..0000000 --- a/tez-ui/src/main/webapp/app/scripts/models/TimelineRestAdapter.js +++ /dev/null @@ -1,723 +0,0 @@ -/** - * 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. - */ - -App.TimelineRESTAdapter = DS.RESTAdapter.extend({ - ajax: function(url, method, hash) { - hash = hash || {}; // hash may be undefined - hash.crossDomain = true; - hash.xhrFields = {withCredentials: true}; - hash.targetServer = "Timeline Server"; - return this._super(url, method, hash); - }, - namespace: App.Configs.restNamespace.timeline, - pathForType: App.Helpers.misc.timelinePathForType -}); - -App.TimelineSerializer = DS.RESTSerializer.extend({ - extractSingle: function(store, primaryType, rawPayload, recordId) { - // rest serializer expects singular form of model as the root key. - var payload = {}; - payload[primaryType.typeKey] = rawPayload; - return this._super(store, primaryType, payload, recordId); - }, - - extractArray: function(store, primaryType, rawPayload) { - // restserializer expects a plural of the model but TimelineServer returns - // it in entities. - var payload = {}; - payload[primaryType.typeKey.pluralize()] = rawPayload.entities; - return this._super(store, primaryType, payload); - }, - - // normalizes countergroups returns counterGroups and counters. - normalizeCounterGroupsHelper: function(parentType, parentID, entity) { - // create empty countergroups if not there - to make code below easier. - entity.otherinfo.counters = entity.otherinfo.counters || {} - entity.otherinfo.counters.counterGroups = entity.otherinfo.counters.counterGroups || []; - - var counterGroups = []; - var counters = []; - - var counterGroupsIDs = entity.otherinfo.counters.counterGroups.map(function(counterGroup) { - var cg = { - id: parentID + '/' + counterGroup.counterGroupName, - name: counterGroup.counterGroupName, - displayName: counterGroup.counterGroupDisplayName, - parentID: { // polymorphic requires type and id. - type: parentType, - id: parentID - } - }; - cg.counters = counterGroup.counters.map(function(counter){ - var c = { - id: cg.id + '/' + counter.counterName, - name: counter.counterName, - displayName: counter.counterName, - value: counter.counterValue, - parentID: cg.id - }; - counters.push(c); - return c.id; - }); - counterGroups.push(cg); - return cg.id; - }); - - return { - counterGroups: counterGroups, - counters: counters, - counterGroupsIDs: counterGroupsIDs - } - } -}); - -function getStatus(source) { - var status = Em.get(source, 'otherinfo.status') || Em.get(source, 'primaryfilters.status.0'), - event = source.events; - - if(!status && event) { - if(event.findBy('eventtype', 'DAG_STARTED')) { - status = 'RUNNING'; - } - } - - return status; -} - -var timelineJsonToDagMap = { - id: 'entity', - submittedTime: 'starttime', - - startTime: { - custom: function(source) { - var time = Em.get(source, 'otherinfo.startTime'), - event = source.events; - - if(!time && event) { - event = event.findBy('eventtype', 'DAG_STARTED'); - if(event) { - time = event.timestamp; - } - } - - return time; - } - }, - endTime: { - custom: function(source) { - var time = Em.get(source, 'otherinfo.endTime'), - event = source.events; - - if(!time && event) { - event = event.findBy('eventtype', 'DAG_FINISHED'); - if(event) { - time = event.timestamp; - } - } - - return time; - } - }, - - name: 'primaryfilters.dagName.0', - user: 'primaryfilters.user.0', - callerId: 'primaryfilters.callerId.0', - - status: { - custom: getStatus - }, - progress: { - custom: function(source) { - var status = getStatus(source); - return status == 'SUCCEEDED' ? 1 : null; - } - }, - - containerLogs: { - custom: function(source) { - var containerLogs = []; - var otherinfo = Em.get(source, 'otherinfo'); - if(!otherinfo) { - return undefined; - } - for (var key in otherinfo) { - if (key.indexOf('inProgressLogsURL_') === 0) { - var logs = Em.get(source, 'otherinfo.' + key); - if (logs.indexOf('http') !== 0) { - logs = 'http://' + logs; - } - var attemptid = key.substring(18); - containerLogs.push({id : attemptid, containerLog: logs}); - } - } - return containerLogs; - } - }, - hasFailedTaskAttempts: { - custom: function(source) { - // if no other info is available we say no failed tasks attempts. - // since otherinfo is populated only at the end. - var numFailedAttempts = Em.get(source, 'otherinfo.numFailedTaskAttempts'); - return !!numFailedAttempts && numFailedAttempts > 0; - } - }, - numFailedTasks: 'otherinfo.numFailedTasks', - diagnostics: 'otherinfo.diagnostics', - - counterGroups: { - custom: function(source) { - var otherinfo = source.otherinfo; - if(otherinfo) { - return Em.get(otherinfo, 'counters.counterGroups') || []; - } - } - }, - - planName: 'otherinfo.dagPlan.dagName', - planVersion: 'otherinfo.dagPlan.version', - amWebServiceVersion: { - custom: function(source) { - return Em.get(source, 'otherinfo.amWebServiceVersion') || '1'; - } - }, - appContextInfo: { - custom: function (source) { - var appType = undefined, - info = undefined; - var dagInfoStr = Em.get(source, 'otherinfo.dagPlan.dagInfo'); - if (!!dagInfoStr) { - try { - var dagInfo = $.parseJSON(dagInfoStr); - appType = dagInfo['context']; - info = dagInfo['description']; - } catch (e) { - info = dagInfoStr; - } - } - - return { - appType: appType, - info: info - }; - } - }, - vertices: 'otherinfo.dagPlan.vertices', - edges: 'otherinfo.dagPlan.edges', - vertexGroups: 'otherinfo.dagPlan.vertexGroups', - - vertexIdToNameMap: { - custom: function(source) { - var nameToIdMap = Em.get(source, 'otherinfo.vertexNameIdMapping') || {}; - var idToNameMap = {}; - $.each(nameToIdMap, function(vertexName, vertexId) { - idToNameMap[vertexId] = vertexName; - }); - return idToNameMap; - } - }, -}; - -App.DagSerializer = App.TimelineSerializer.extend({ - normalize: function(type, hash, prop) { - return Em.JsonMapper.map(hash, timelineJsonToDagMap); - }, -}); - -var timelineJsonToTaskAttemptMap = { - id: 'entity', - startTime: 'otherinfo.startTime', - endTime: 'otherinfo.endTime', - status: 'otherinfo.status', - diagnostics: 'otherinfo.diagnostics', - counterGroups: 'otherinfo.counters.counterGroups', - - progress: { - custom: function(source) { - return Em.get(source, 'otherinfo.status') == 'SUCCEEDED' ? 1 : null; - } - }, - - inProgressLog: 'otherinfo.inProgressLogsURL', - completedLog: 'otherinfo.completedLogsURL', - - taskID: 'primaryfilters.TEZ_TASK_ID.0', - vertexID: 'primaryfilters.TEZ_VERTEX_ID.0', - dagID: 'primaryfilters.TEZ_DAG_ID.0', - containerId: 'otherinfo.containerId', - nodeId: 'otherinfo.nodeId', - diagnostics: 'otherinfo.diagnostics' -}; - -App.DagTaskAttemptSerializer = -App.VertexTaskAttemptSerializer = -App.TaskTaskAttemptSerializer = -App.TaskAttemptSerializer = App.TimelineSerializer.extend({ - normalize: function(type, hash, prop) { - return Em.JsonMapper.map(hash, timelineJsonToTaskAttemptMap); - }, -}); - -var timelineJsonToTaskMap = { - id: 'entity', - dagID: 'primaryfilters.TEZ_DAG_ID.0', - startTime: 'otherinfo.startTime', - vertexID: 'primaryfilters.TEZ_VERTEX_ID.0', - endTime: 'otherinfo.endTime', - status: 'otherinfo.status', - progress: { - custom: function(source) { - return Em.get(source, 'otherinfo.status') == 'SUCCEEDED' ? 1 : null; - } - }, - numFailedTaskAttempts: 'otherinfo.numFailedTaskAttempts', - diagnostics: 'otherinfo.diagnostics', - counterGroups: 'otherinfo.counters.counterGroups', - successfulAttemptId: 'otherinfo.successfulAttemptId', - attempts: 'relatedentities.TEZ_TASK_ATTEMPT_ID', - numAttempts: 'relatedentities.TEZ_TASK_ATTEMPT_ID.length' -}; - -App.DagTaskSerializer = -App.VertexTaskSerializer = -App.TaskSerializer = App.TimelineSerializer.extend({ - normalize: function(type, hash, prop) { - return Em.JsonMapper.map(hash, timelineJsonToTaskMap); - }, -}); - -var timelineJsonToVertexMap = { - id: 'entity', - name: 'otherinfo.vertexName', - dagID: 'primaryfilters.TEZ_DAG_ID.0', - processorClassName: 'processorClassName', - counterGroups: 'otherinfo.counters.counterGroups', - inputs: 'inputs', - outputs: 'outputs', - - startTime: 'otherinfo.startTime', - endTime: 'otherinfo.endTime', - - progress: { - custom: function(source) { - return Em.get(source, 'otherinfo.status') == 'SUCCEEDED' ? 1 : null; - } - }, - runningTasks: { - custom: function(source) { - return Em.get(source, 'otherinfo.status') == 'SUCCEEDED' ? 0 : null; - } - }, - pendingTasks: { - custom: function(source) { - return Em.get(source, 'otherinfo.status') == 'SUCCEEDED' ? 0 : null; - } - }, - - status: 'otherinfo.status', - hasFailedTaskAttempts: { - custom: function(source) { - // if no other info is available we say no failed tasks attempts. - // since otherinfo is populated only at the end. - var numFailedAttempts = Em.get(source, 'otherinfo.numFailedTaskAttempts'); - return !!numFailedAttempts && numFailedAttempts > 0; - } - }, - diagnostics: 'otherinfo.diagnostics', - - failedTaskAttempts: 'otherinfo.numFailedTaskAttempts', - killedTaskAttempts: 'otherinfo.numKilledTaskAttempts', - - failedTasks: 'otherinfo.numFailedTasks', - sucessfulTasks: 'otherinfo.numSucceededTasks', - numTasks: 'otherinfo.numTasks', - killedTasks: 'otherinfo.numKilledTasks', - - firstTaskStartTime: 'otherinfo.stats.firstTaskStartTime', - lastTaskFinishTime: 'otherinfo.stats.lastTaskFinishTime', - - firstTasksToStart: 'otherinfo.stats.firstTasksToStart', - lastTasksToFinish: 'otherinfo.stats.lastTasksToFinish', - - minTaskDuration: 'otherinfo.stats.minTaskDuration', - maxTaskDuration: 'otherinfo.stats.maxTaskDuration', - avgTaskDuration: 'otherinfo.stats.avgTaskDuration', - - shortestDurationTasks: 'otherinfo.stats.shortestDurationTasks', - longestDurationTasks: 'otherinfo.stats.longestDurationTasks' -}; - -App.VertexSerializer = App.TimelineSerializer.extend({ - _normalizeSingleVertexPayload: function(vertex) { - processorClassName = Ember.get(vertex, 'otherinfo.processorClassName') || "", - inputs = [], - inputIds = [], - outputs = [], - outputIds = []; - - vertex.processorClassName = processorClassName.substr(processorClassName.lastIndexOf('.') + 1); - - if(vertex.inputs) { - vertex.inputs.forEach(function (input, index) { - input.entity = vertex.entity + '-input' + index; - inputIds.push(input.entity); - inputs.push(input); - }); - vertex.inputs = inputIds; - } - - if(vertex.outputs) { - vertex.outputs.forEach(function (output, index) { - output.entity = vertex.entity + '-output' + index; - outputIds.push(output.entity); - outputs.push(output); - }); - vertex.outputs = outputIds; - } - - return { - vertex: vertex, - inputs: inputs, - outputs: outputs - }; - }, - - normalizePayload: function(rawPayload, property) { - var pluralizedPoperty, - normalizedPayload, - n; - - property = property || 'vertex', - pluralizedPoperty = property.pluralize();; - if (!!rawPayload[pluralizedPoperty]) { - normalizedPayload = { - inputs: [], - outputs: [], - }; - normalizedPayload[pluralizedPoperty] = []; - - rawPayload[pluralizedPoperty].forEach(function(vertex){ - n = this._normalizeSingleVertexPayload(vertex); - normalizedPayload[pluralizedPoperty].push(n.vertex); - [].push.apply(normalizedPayload.inputs, n.inputs); - [].push.apply(normalizedPayload.outputs, n.outputs); - }, this); - - // delete so that we dont hang on to the json data. - delete rawPayload[pluralizedPoperty]; - - return normalizedPayload; - } else { - n = this._normalizeSingleVertexPayload(rawPayload[property]); - normalizedPayload = { - inputs : n.inputs, - outputs: n.outputs - }; - normalizedPayload[property] = n.vertex; - - return normalizedPayload; - } - }, - - normalize: function(type, hash, prop) { - return Em.JsonMapper.map(hash, timelineJsonToVertexMap); - }, -}); - -App.DagVertexSerializer = App.VertexSerializer.extend({ - normalizePayload: function (rawPayload) { - return this._super(rawPayload, 'dagVertex'); - } -}); - -App.InputSerializer = App.TimelineSerializer.extend({ - _map: { - id: 'entity', - inputName: 'name', - inputClass: 'class', - inputInitializer: 'initializer', - configs: 'configs' - }, - _normalizeData: function(data) { - var userPayload = JSON.parse(data.userPayloadAsText || null), - store = this.get('store'), - configs, - configKey, - configIndex = 0, - id; - - data.configs = []; - - if(userPayload) { - configs = userPayload.config || userPayload.dist; - for(configKey in configs) { - id = data.entity + configIndex++; - data.configs.push(id); - store.push('KVDatum', { - id: id, - key: configKey, - value: configs[configKey] - }); - } - } - - return data; - }, - normalize: function(type, hash, prop) { - return Em.JsonMapper.map(this._normalizeData(hash), this._map); - } -}); - -App.OutputSerializer = App.TimelineSerializer.extend({ - _map: { - id: 'entity', - outputName: 'name', - outputClass: 'class', - configs: 'configs' - }, - _normalizeData: function(data) { - var userPayload = JSON.parse(data.userPayloadAsText || null), - store = this.get('store'), - configs, - configKey, - configIndex = 0, - id; - - data.configs = []; - - if(userPayload) { - configs = userPayload.config || userPayload.dist; - for(configKey in configs) { - id = data.entity + configIndex++; - data.configs.push(id); - store.push('KVDatum', { - id: id, - key: configKey, - value: configs[configKey] - }); - } - } - - return data; - }, - normalize: function(type, hash, prop) { - return Em.JsonMapper.map(this._normalizeData(hash), this._map); - } -}); - -var timelineJsonToAppDetailMap = { - id: 'appId', - attemptId: { - custom: function(source) { - // while an attempt is in progress the attempt id contains a '-' - return (Em.get(source, 'currentAppAttemptId') || '').replace('-',''); - } - }, - - name: 'name', - queue: 'queue', - user: 'user', - type: 'type', - - startedTime: 'startedTime', - elapsedTime: 'elapsedTime', - finishedTime: 'finishedTime', - submittedTime: 'submittedTime', - - status: 'appState', - - finalStatus: 'finalAppStatus', - diagnostics: 'otherinfo.diagnostics', -}; - -App.AppDetailSerializer = App.TimelineSerializer.extend({ - normalize: function(type, hash, prop) { - return Em.JsonMapper.map(hash, timelineJsonToAppDetailMap); - }, -}); - -var timelineJsonToTezAppMap = { - id: 'entity', - - appId: 'appId', - - entityType: 'entitytype', - - startedTime: 'startedTime', - domain: 'domain', - - user: 'primaryfilters.user.0', - - dags: 'relatedentities.TEZ_DAG_ID', - configs: 'configs', - - tezBuildTime: 'otherinfo.tezVersion.buildTime', - tezRevision: 'otherinfo.tezVersion.revision', - tezVersion: 'otherinfo.tezVersion.version' -}; - -App.TezAppSerializer = App.TimelineSerializer.extend({ - _normalizeSinglePayload: function(rawPayload){ - var configs = rawPayload.otherinfo.config, - appId = rawPayload.entity.substr(4), - kVData = [], - id; - - rawPayload.appId = appId; - rawPayload.configs = []; - - for(var key in configs) { - id = appId + key; - rawPayload.configs.push(id); - kVData.push({ - id: id, - key: key, - value: configs[key] - }); - } - - return { - tezApp: rawPayload, - kVData: kVData - }; - }, - normalizePayload: function(rawPayload) { - if (!!rawPayload.tezApps) { - var normalizedPayload = { - tezApps: [], - kVData: [] - }, - push = Array.prototype.push; - rawPayload.tezApps.forEach(function(app){ - var n = this._normalizeSinglePayload(app); - normalizedPayload.tezApps.push(n.tezApp); - push.apply(normalizedPayload.kVData,n.kVData); - }); - return normalizedPayload; - } - else { - return this._normalizeSinglePayload(rawPayload.tezApp) - } - }, - normalize: function(type, hash, prop) { - return Em.JsonMapper.map(hash, timelineJsonToTezAppMap); - }, -}); - -var timelineJsonToHiveQueryMap = { - id: 'entity', - query: 'otherinfo.QUERY' -}; - -App.HiveQuerySerializer = App.TimelineSerializer.extend({ - _normalizeSingleDagPayload: function(hiveQuery) { - return { - hiveQuery: hiveQuery - } - }, - - normalizePayload: function(rawPayload){ - // we handled only single hive - return this._normalizeSingleDagPayload(rawPayload.hiveQuery); - }, - - normalize: function(type, hash, prop) { - return Em.JsonMapper.map(hash, timelineJsonToHiveQueryMap); - } -}); - -App.VertexProgressSerializer = App.DagProgressSerializer = DS.RESTSerializer.extend({}); - -// v2 version of am web services -App.DagInfoSerializer = DS.RESTSerializer.extend({ - normalizePayload: function(rawPayload) { - return { - dagInfo : [rawPayload.dag] - } - } -}); - -App.VertexInfoSerializer = DS.RESTSerializer.extend({ - map: { - id: 'id', - progress: 'progress', - status: 'status', - numTasks: 'totalTasks', - runningTasks: 'runningTasks', - sucessfulTasks: 'succeededTasks', - failedTaskAttempts: 'failedTaskAttempts', - killedTaskAttempts: 'killedTaskAttempts', - counters: 'counters' - }, - normalizePayload: function(rawPayload) { - return { - vertexInfo : rawPayload.vertices - } - }, - normalize: function(type, hash, prop) { - return Em.JsonMapper.map(hash, this.get('map')); - } -}); - -App.TaskInfoSerializer = DS.RESTSerializer.extend({ - normalizePayload: function(rawPayload) { - return { - taskInfo : rawPayload.tasks - } - } -}); - -App.AttemptInfoSerializer = DS.RESTSerializer.extend({ - normalizePayload: function(rawPayload) { - return { - attemptInfo : rawPayload.attempts - } - } -}); - -App.ClusterAppSerializer = App.TimelineSerializer.extend({ - map: { - id: 'id', - status: 'state', - finalStatus: 'finalStatus', - - name: 'name', - queue: 'queue', - user: 'user', - type: 'type', - - startedTime: 'startedTime', - elapsedTime: 'elapsedTime', - finishedTime: 'finishedTime', - - progress: 'progress' - }, - - _normalizeSingleDagPayload: function(rawPayload) { - return { - clusterApp: rawPayload.clusterApp.app - } - }, - - normalizePayload: function(rawPayload){ - // we handled only single clusterApp - return this._normalizeSingleDagPayload(rawPayload); - }, - - normalize: function(type, hash, prop) { - return Em.JsonMapper.map(hash, this.get('map')); - } -}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/models/abstract_entity.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/models/abstract_entity.js b/tez-ui/src/main/webapp/app/scripts/models/abstract_entity.js deleted file mode 100644 index 251d680..0000000 --- a/tez-ui/src/main/webapp/app/scripts/models/abstract_entity.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * 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. - */ - -App.AbstractEntity = DS.Model.extend({ - // type of the entity. should be one of App.EntityType - entityType: DS.attr('string'), - timeStamp: null, - - didLoad: function () { - this.set('timeStamp', new Date()); - }, - - observeReloading: function () { - if(!this.get('isReloading')) { - this.didLoad(); - } - }.observes('isReloading') -}); - -App.EntityType = { - DAG: 'dag', - VERTEX: 'vertex', - TASK: 'task', - TASK_ATTEMPT: 'task_attempt', -}; http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/models/dag.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/models/dag.js b/tez-ui/src/main/webapp/app/scripts/models/dag.js deleted file mode 100644 index 7a7ee78..0000000 --- a/tez-ui/src/main/webapp/app/scripts/models/dag.js +++ /dev/null @@ -1,518 +0,0 @@ -/** - * 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. - */ - -App.Dag = App.AbstractEntity.extend({ - - idx: function() { - return App.Helpers.misc.getDagIndexFromDagId(this.get('id')); - }.property('id'), - - progress: DS.attr('number'), - - submittedTime: DS.attr('number'), - - // start time of the entity - startTime: DS.attr('number'), - - // end time of the entity - endTime: DS.attr('number'), - - duration: function () { - return App.Helpers.date.duration(this.get('startTime'), this.get('endTime')) - }.property('startTime', 'endTime'), - - // set type to DAG - entityType: App.EntityType.DAG, - - // Name of the dag. - name: DS.attr('string'), - - // user name who ran this dag. - user: DS.attr('string'), - - // application ID of this dag. - applicationId: function() { - return App.Helpers.misc.getAppIdFromDagId(this.get('id')); - }.property('id'), - - tezApp: DS.belongsTo('tezApp'), - appDetail: DS.attr('object'), - - progress: DS.attr('number'), - - // status - status: DS.attr('string'), - hasFailedTaskAttempts: DS.attr('boolean'), - hasFailedTasks: function() { - var f = this.get('numFailedTasks'); - return !!f && f > 0; - }.property('numFailedTasks'), - numFailedTasks: DS.attr('number'), - - // diagnostics info if any. - diagnostics: DS.attr('string'), - - // Dag plan related data - planName: DS.attr('string'), - planVersion: DS.attr('number'), - appContextInfo: DS.attr('object'), - vertices: DS.attr('array'), // Serialize when required - edges: DS.attr('array'), // Serialize when required - vertexGroups: DS.attr('array'), - vertexIdToNameMap: DS.attr('array'), - - counterGroups: DS.attr('array'), - amWebServiceVersion: DS.attr('string'), - containerLogs: DS.attr('array'), - - callerId: DS.attr('string') -}); - -App.CounterGroup = DS.Model.extend({ - name: DS.attr('string'), - - displayName: DS.attr('string'), - - counters: DS.hasMany('counter', { inverse: 'parent' }), - - parent: DS.belongsTo('abstractEntity', { polymorphic: true }) -}); - -App.Counter = DS.Model.extend({ - name: DS.attr('string'), - - displayName: DS.attr('string'), - - value: DS.attr('number'), - - parent: DS.belongsTo('counterGroup') -}); - -App.Edge = DS.Model.extend({ - - fromVertex: DS.belongsTo('vertex'), - - toVertex: DS.belongsTo('vertex'), - - /** - * Type of this edge connecting vertices. Should be one of constants defined - * in 'App.EdgeType'. - */ - edgeType: DS.attr('string'), - - dag: DS.belongsTo('dag') -}); - -App.Vertex = App.AbstractEntity.extend({ - name: DS.attr('string'), - vertexIdx: function() { - return this.get('id').split('_').splice(-1).pop(); - }.property('id'), - - dag: DS.belongsTo('dag'), - dagID: DS.attr('string'), - applicationId: function() { - return App.Helpers.misc.getAppIdFromVertexId(this.get('id')); - }.property('id'), - dagIdx: function() { - return this.get('dagID').split('_').splice(-1).pop(); - }.property('dagID'), - - tezApp: DS.belongsTo('tezApp'), - - /** - * State of this vertex. Should be one of constants defined in - * App.VertexState. - */ - status: DS.attr('string'), - hasFailedTaskAttempts: DS.attr('boolean'), - hasFailedTasks: function() { - var f = this.get('failedTasks'); - return !!f && f > 0; - }.property('failedTasks'), - - progress: DS.attr('number'), - - /** - * Vertex type has to be one of the types defined in 'App.VertexType' - * @return {string} - */ - type: DS.attr('string'), - - /** - * A vertex can have multiple incoming edges. - */ - incomingEdges: DS.hasMany('edge', {inverse: 'fromVertex' }), - - /** - * This vertex can have multiple outgoing edges. - */ - outgoingEdges: DS.hasMany('edge', {inverse: 'toVertex'}), - - startTime: DS.attr('number'), - - endTime: DS.attr('number'), - - firstTaskStartTime: DS.attr('number'), - - firstTasksToStart: DS.attr('string'), - - lastTaskFinishTime: DS.attr('number'), - - lastTasksToFinish: DS.attr('string'), - - minTaskDuration: DS.attr('number'), - - maxTaskDuration: DS.attr('number'), - - avgTaskDuration: DS.attr('number'), - - shortestDurationTasks: DS.attr('string'), - - longestDurationTasks: DS.attr('string'), - - processorClassName: DS.attr('string'), - - /** - * Provides the duration of this job. If the job has not started, duration - * will be given as 0. If the job has not ended, duration will be till now. - * - * @return {Number} Duration in milliseconds. - */ - duration: function () { - return App.Helpers.date.duration(this.get('firstTaskStartTime') || this.get('startTime'), this.get('endTime')) - }.property('startTime', 'firstTaskStartTime', 'endTime'), - - /** - * Each Tez vertex can perform arbitrary application specific computations - * inside. The application can provide a list of operations it has provided in - * this vertex. - * - * Array of strings. [{string}] - */ - operations: DS.attr('array'), - - /** - * Provides additional information about the 'operations' performed in this - * vertex. This is shown directly to the user. - */ - operationPlan: DS.attr('string'), - - /** - * Number of actual Map/Reduce tasks in this vertex - */ - numTasks: DS.attr('number'), - - name: DS.attr('string'), - - failedTasks: DS.attr('number'), - sucessfulTasks: DS.attr('number'), - runningTasks: DS.attr('number'), - pendingTasks: DS.attr('number'), - numTasks: DS.attr('number'), - killedTasks: DS.attr('number'), - - failedTaskAttempts: DS.attr('number'), - killedTaskAttempts: DS.attr('number'), - - diagnostics: DS.attr('string'), - - counterGroups: DS.attr('array'), - - tasksNumber: function () { - return this.getWithDefault('tasksCount', 0); - }.property('tasksCount'), - - /** - * Local filesystem usage metrics for this vertex - */ - fileReadBytes: DS.attr('number'), - - fileWriteBytes: DS.attr('number'), - - fileReadOps: DS.attr('number'), - - fileWriteOps: DS.attr('number'), - - /** - * Spilled records - */ - spilledRecords: DS.attr('number'), - - /** - * HDFS usage metrics for this vertex - */ - hdfsReadBytes: DS.attr('number'), - - hdfsWriteBytes: DS.attr('number'), - - hdfsReadOps: DS.attr('number'), - - hdfsWriteOps: DS.attr('number'), - - /** - * Record metrics for this vertex - */ - recordReadCount: DS.attr('number'), - - recordWriteCount: DS.attr('number'), - - inputs: DS.hasMany('input'), - outputs: DS.hasMany('output'), - - totalReadBytes: function () { - return this.get('fileReadBytes') + this.get('hdfsReadBytes'); - }.property('fileReadBytes', 'hdfsReadBytes'), - - totalWriteBytes: function () { - return this.get('fileWriteBytes') + this.get('hdfsWriteBytes'); - }.property('fileWriteBytes', 'hdfsWriteBytes'), - - totalReadBytesDisplay: function () { - return App.Helpers.number.bytesToSize(this.get('totalReadBytes')); - }.property('totalReadBytes'), - - totalWriteBytesDisplay: function () { - return App.Helpers.number.bytesToSize(this.get('totalWriteBytes')); - }.property('totalWriteBytes'), - - durationDisplay: function () { - return App.Helpers.date.timingFormat(this.get('duration'), true); - }.property('duration') -}); -App.DagVertex = App.Vertex.extend({}); - -App.Input = App.AbstractEntity.extend({ - entity: DS.attr('string'), - - inputName: DS.attr('string'), - inputClass: DS.attr('string'), - inputInitializer: DS.attr('string'), - - configs: DS.hasMany('kVData', { async: false }) -}); - -App.Output = App.AbstractEntity.extend({ - entity: DS.attr('string'), - - outputName: DS.attr('string'), - outputClass: DS.attr('string'), - - configs: DS.hasMany('kVData', { async: false }) -}); - -App.AppDetail = App.AbstractEntity.extend({ - attemptId: DS.attr('string'), - - user: DS.attr('string'), - name: DS.attr('string'), - queue: DS.attr('string'), - type: DS.attr('string'), - - status: DS.attr('string'), - finalStatus: DS.attr('string'), - progress: DS.attr('string'), - - startedTime: DS.attr('number'), - elapsedTime: DS.attr('number'), - finishedTime: DS.attr('number'), - submittedTime: DS.attr('number'), - - diagnostics: DS.attr('string'), -}); - -App.TezApp = App.AbstractEntity.extend({ - appId: DS.attr('string'), - entityType: DS.attr('string'), - domain: DS.attr('string'), - user: DS.attr('string'), - - startedTime: DS.attr('number'), - - appDetail: DS.attr('object'), - dags: DS.hasMany('dag', { async: true }), - - configs: DS.hasMany('kVData', { async: false }), - - tezBuildTime: DS.attr('string'), - tezRevision: DS.attr('string'), - tezVersion: DS.attr('string'), -}); - -App.ClusterApp = App.AbstractEntity.extend({ - status: DS.attr('string'), - finalStatus: DS.attr('string'), - - user: DS.attr('string'), - name: DS.attr('string'), - queue: DS.attr('string'), - type: DS.attr('string'), - - startedTime: DS.attr('number'), - elapsedTime: DS.attr('number'), - finishedTime: DS.attr('number'), - submittedTime: DS.attr('number'), - - progress: DS.attr('number'), - - isComplete: function () { - var status = this.get('status'); - return status == 'FINISHED' || status == 'FAILED' || status == 'KILLED'; - }.property('status') -}); - -App.Task = App.AbstractEntity.extend({ - status: DS.attr('string'), - - index: function () { - var id = this.get('id'), - idPrefix = 'task_%@_'.fmt(this.get('dagID').substr(4)); - return id.indexOf(idPrefix) == 0 ? id.substr(idPrefix.length) : id; - }.property('id'), - - dagID: DS.attr('string'), - - progress: DS.attr('number'), - - successfulAttemptId: DS.attr('string'), - - attempts: DS.attr('array'), - - vertex: DS.belongsTo('vertex'), - vertexID: DS.attr('string'), - - tezApp: DS.belongsTo('tezApp'), - - startTime: DS.attr('number'), - - endTime: DS.attr('number'), - - duration: function () { - return App.Helpers.date.duration(this.get('startTime'), this.get('endTime')) - }.property('startTime', 'endTime'), - - diagnostics: DS.attr('string'), - - numAttempts: DS.attr('number'), - - pivotAttempt: DS.belongsTo('taskAttempt'), - - counterGroups: DS.attr('array'), // Serialize when required - numFailedTaskAttempts: DS.attr('number'), - hasFailedTaskAttempts: function() { - var numAttempts = this.get('numFailedTaskAttempts') || 0; - return numAttempts > 1; - }.property('numFailedTaskAttempts') -}); -App.DagTask = App.Task.extend({}); -App.VertexTask = App.Task.extend({}); - -App.DagProgress = DS.Model.extend({ - progress: DS.attr('number'), - appId: DS.attr('string'), - dagIdx: DS.attr('number') -}); - -App.VertexProgress = DS.Model.extend({ - progress: DS.attr('number'), - appId: DS.attr('string'), - dagIdx: DS.attr('string') -}); - -App.DagInfo = DS.Model.extend({ - // we need appId and dagIdx as they are used for querying with AM - appId: function() { - return App.Helpers.misc.getAppIdFromDagId(this.get('id')); - }.property('id'), - dagIdx: function() { - return App.Helpers.misc.getDagIndexFromDagId(this.get('id')); - }.property('id'), - - progress: DS.attr('number'), - status: DS.attr('string'), - counters: DS.attr('object') -}); - -App.VertexInfo = DS.Model.extend({ - // we need appId and dagIdx as they are used for querying with AM - appId: function() { - return App.Helpers.misc.getAppIdFromDagId(this.get('id')); - }.property('id'), - dagIdx: function() { - return App.Helpers.misc.getDagIndexFromDagId(this.get('id')); - }.property('id'), - - progress: DS.attr('number'), - status: DS.attr('string'), - numTasks: DS.attr('number'), - runningTasks: DS.attr('number'), - sucessfulTasks: DS.attr('number'), - failedTaskAttempts: DS.attr('number'), - killedTaskAttempts: DS.attr('number'), - - pendingTasks: function() { - return this.get('numTasks') - this.get('runningTasks') - this.get('sucessfulTasks'); - }.property('numTasks', 'runningTasks', 'sucessfulTasks'), - - counters: DS.attr('object') -}); - -App.TaskInfo = DS.Model.extend({ - progress: DS.attr('number'), - status: DS.attr('string'), - counters: DS.attr('object') -}); - -App.AttemptInfo = DS.Model.extend({ - progress: DS.attr('number'), - status: DS.attr('string'), - counters: DS.attr('object') -}); - -App.KVDatum = DS.Model.extend({ - key: DS.attr('string'), - value: DS.attr('string'), -}); - -App.HiveQuery = DS.Model.extend({ - query: DS.attr('string') -}); - -App.VertexState = { - NEW: "NEW", - INITIALIZING: "INITIALIZING", - INITED: "INITED", - RUNNING: "RUNNING", - SUCCEEDED: "SUCCEEDED", - FAILED: "FAILED", - KILLED: "KILLED", - ERROR: "ERROR", - TERMINATING: "TERMINATING", - JOBFAILED: "JOB FAILED" -}; - -App.VertexType = { - MAP: 'MAP', - REDUCE: 'REDUCE', - UNION: 'UNION' -}; - -App.EdgeType = { - SCATTER_GATHER: "SCATTER_GATHER", - BROADCAST: "BROADCAST", - CONTAINS: "CONTAINS" -}; http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/models/task_attempt.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/models/task_attempt.js b/tez-ui/src/main/webapp/app/scripts/models/task_attempt.js deleted file mode 100644 index 888408d..0000000 --- a/tez-ui/src/main/webapp/app/scripts/models/task_attempt.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * 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. - */ - -App.TaskAttempt = App.AbstractEntity.extend({ - index: function () { - var id = this.get('id'), - idPrefix = 'attempt_%@_'.fmt(this.get('dagID').substr(4)); - return id.indexOf(idPrefix) == 0 ? id.substr(idPrefix.length) : id; - }.property('id'), - - progress: DS.attr('number'), - - // start time of the entity - startTime: DS.attr('number'), - - // end time of the entity - endTime: DS.attr('number'), - - duration: function () { - return App.Helpers.date.duration(this.get('startTime'), this.get('endTime')) - }.property('startTime', 'endTime'), - - entityType: App.EntityType.TASK_ATTEMPT, - - // container - containerId: DS.attr('string'), - nodeId: DS.attr('string'), - - // status of the task attempt - status: DS.attr('string'), - - task: DS.belongsTo('task'), - taskID: DS.attr('string'), - vertexID: DS.attr('string'), - dagID: DS.attr('string'), - - inProgressLog: DS.attr('string'), - completedLog: DS.attr('string'), - - diagnostics: DS.attr('string'), - - counterGroups: DS.attr('array'), -}); -App.DagTaskAttempt = App.TaskAttempt.extend({}); -App.VertexTaskAttempt = App.TaskAttempt.extend({}); -App.TaskTaskAttempt = App.TaskAttempt.extend({}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/router.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/router.js b/tez-ui/src/main/webapp/app/scripts/router.js deleted file mode 100644 index 2478eaf..0000000 --- a/tez-ui/src/main/webapp/app/scripts/router.js +++ /dev/null @@ -1,321 +0,0 @@ -/** - * 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. - */ - -App.Router.map(function() { - this.resource('dags', { path: '/' }); - this.resource('dag', { path: '/dag/:dag_id'}, function() { - this.route('vertices'); - this.route('view'); - this.route('tasks'); - this.route('taskAttempts'); - this.route('counters'); - this.route('swimlane'); - }); - - this.resource('tez-app', {path: '/tez-app/:app_id'}, function(){ - this.route('dags'); - this.route('configs'); - }); - - this.resource('vertex', {path: '/vertex/:vertex_id'}, function(){ - this.route('tasks'); - this.route('additionals'); - this.resource('input', {path: '/input/:input_id'}, function(){ - this.route('configs'); - }); - this.resource('output', {path: '/output/:input_id'}, function(){ - this.route('configs'); - }); - this.route('taskAttempts'); - this.route('counters'); - this.route('details'); - this.route('swimlane'); - }); - - this.resource('tasks', {path: '/tasks'}); - this.resource('task', {path: '/task/:task_id'}, function(){ - this.route('attempts'); - this.route('counters'); - }); - - this.resource('taskAttempt', {path: '/task_attempt/:task_attempt_id'}, function() { - this.route('counters'); - }); - - this.resource('error', {path: '/error'}); -}); - -/* --- Router helper functions --- */ - -function renderSwimlanes () { - this.render('common/swimlanes'); -} - -function renderConfigs() { - this.render('common/configs'); -} - -function renderTable() { - this.render('common/table'); -} - -/* - * Creates a setupController function - * @param format Unformatted title string. - * @param Optional, arguments as string can be tailed after format to specify the property path. - * i.e. 'Dag - %@ (%@)', 'name', 'id' would give 'Dag - dag_name (dag_id)' - * @return setupController function - */ -function setupControllerFactory(format) { - var fmtArgs = Array.prototype.slice.call(arguments, 1); - - return function (controller, model) { - var fmtValues, title; - - if(format) { - if(model && fmtArgs.length) { - fmtValues = fmtArgs.map(function (key) { - return model.get(key); - }), - title = format.fmt.apply(format, fmtValues); - } - else { - title = format; - } - - $(document).attr('title', title); - } - - this._super(controller, model); - if(controller.setup) { - controller.setup(); - } - - if(controller.loadData) { - controller.loadData(); - } - }; -} - -/* --- Base route class --- */ -App.BaseRoute = Em.Route.extend({ - setupController: setupControllerFactory(), - resetController: function() { - if(this.controller.reset) { - this.controller.reset(); - } - }, - actions: { - pollingEnabledChanged: function (enabled) { - if(this.get('controller.pollster')) { - this.set('controller.pollingEnabled', enabled); - } - return true; - } - } -}); - -App.ApplicationRoute = Em.Route.extend({ - actions: { - willTransition: function(transition) { - App.Helpers.ErrorBar.getInstance().hide(); - $(document).tooltip("close"); - }, - error: function(error, transition, originRoute) { - this.replaceWith('error'); - Em.Logger.error(error); - var defaultError = 'Error while loading %@.'.fmt(transition.targetName); - var err = App.Helpers.misc.formatError(error, defaultError); - var msg = 'error code: %@, message: %@'.fmt(err.errCode, err.msg); - App.Helpers.ErrorBar.getInstance().show(msg, error.details); - }, - } -}); -/* --- Dag related routes --- */ - -App.DagsRoute = App.BaseRoute.extend({ - queryParams: { - count: App.Helpers.misc.defaultQueryParamsConfig, - fromID: App.Helpers.misc.defaultQueryParamsConfig, - user: App.Helpers.misc.defaultQueryParamsConfig, - status: App.Helpers.misc.defaultQueryParamsConfig, - appid: App.Helpers.misc.defaultQueryParamsConfig, - dag_name: App.Helpers.misc.defaultQueryParamsConfig - }, - setupController: setupControllerFactory('All Dags'), -}); - -App.DagRoute = App.BaseRoute.extend({ - model: function(params) { - return this.store.find('dag', params.dag_id); - }, - afterModel: function(model) { - return this.controllerFor('dag').loadAdditional(model); - }, - setupController: setupControllerFactory('Dag: %@ (%@)', 'name', 'id'), -}); - -App.DagViewRoute = App.BaseRoute.extend({ - setupController: setupControllerFactory() -}); - -App.DagSwimlaneRoute = App.BaseRoute.extend({ - renderTemplate: renderSwimlanes, - model: function(params) { - var model = this.modelFor('dag'), - queryParams = {'primaryFilter': 'TEZ_DAG_ID:' + model.id}; - this.store.unloadAll('task_attempt'); - return this.store.findQuery('task_attempt', queryParams); - }, - setupController: setupControllerFactory() -}); - -/* --- Task related routes --- */ - -App.TaskRoute = App.BaseRoute.extend({ - model: function(params) { - return this.store.find('task', params.task_id); - }, - afterModel: function(model) { - return this.controllerFor('task').loadAdditional(model); - }, - setupController: setupControllerFactory('Task: %@', 'id') -}); - -App.TasksRoute = App.BaseRoute.extend({ - setupController: setupControllerFactory() -}); - -/* --- Vertex related routes --- */ - -App.VertexRoute = App.BaseRoute.extend({ - model: function(params) { - return this.store.find('vertex', params.vertex_id); - }, - afterModel: function(model) { - return this.controllerFor('vertex').loadAdditional(model); - }, - setupController: setupControllerFactory('Vertex: %@ (%@)', 'name', 'id') -}); - -App.VertexAdditionalsRoute = App.BaseRoute.extend({ - setupController: function(controller, model) { - this._super(controller, model); - controller.loadEntities(); - } -}); - -App.InputRoute = App.BaseRoute.extend({ - model: function (params) { - var model = this.modelFor('vertex'); - return model.get('inputs').findBy('id', params.input_id); - }, - setupController: setupControllerFactory() -}); - -App.OutputRoute = App.BaseRoute.extend({ - model: function (params) { - var model = this.modelFor('vertex'); - return model.get('outputs').findBy('id', params.input_id); - }, - setupController: setupControllerFactory() -}); - -App.VertexSwimlaneRoute = App.BaseRoute.extend({ - renderTemplate: renderSwimlanes, - model: function(params) { - var model = this.modelFor('vertex'), - queryParams = {'primaryFilter': 'TEZ_VERTEX_ID:' + model.id }; - this.store.unloadAll('task_attempt'); - return this.store.find('task_attempt', queryParams); - }, - setupController: setupControllerFactory() -}); - -/* --- Task Attempt related routes--- */ - -App.TaskAttemptRoute = App.BaseRoute.extend({ - model: function(params) { - return this.store.find('task_attempt', params.task_attempt_id); - }, - afterModel: function(model) { - return this.controllerFor('task_attempt').loadAdditional(model); - }, - setupController: setupControllerFactory('Task Attempt: %@', 'id') -}); - -App.TaskAttemptsRoute = App.BaseRoute.extend({ - renderTemplate: renderTable, - setupController: setupControllerFactory('Task Attempt: %@', 'id') -}); - -/* --- Tez-app related routes --- */ - -App.TezAppRoute = App.BaseRoute.extend({ - model: function(params) { - var store = this.store; - return store.find('tezApp', 'tez_' + params.app_id).then(function (tezApp){ - if(!tezApp.get('appId')) return tezApp; - return App.Helpers.misc.loadApp(store, tezApp.get('appId')).then(function (appDetails){ - tezApp.set('appDetail', appDetails); - return tezApp; - }).catch(function() { - return tezApp; - }); - }); - }, - setupController: setupControllerFactory('Application: %@', 'id') -}); - -App.TezAppIndexRoute = App.BaseRoute.extend({ - setupController: setupControllerFactory() -}); - -App.TezAppDagsRoute = App.BaseRoute.extend({ - renderTemplate: renderTable, - setupController: setupControllerFactory() -}); - -App.TezAppConfigsRoute = App.BaseRoute.extend({ - renderTemplate: renderConfigs -}); - -/* --- Shared routes --- */ -App.DagIndexRoute = App.BaseRoute.extend({ - setupController: setupControllerFactory() -}); - -App.DagTasksRoute = - App.DagVerticesRoute = - App.DagTaskAttemptsRoute = - App.VertexTasksRoute = - App.VertexTaskAttemptsRoute = - App.BaseRoute.extend({ - renderTemplate: renderTable, - setupController: setupControllerFactory() - }); - -App.DagCountersRoute = - App.VertexCountersRoute = - App.TaskCountersRoute = - App.TaskAttemptCountersRoute = - App.BaseRoute.extend({ - renderTemplate: function() { - this.render('common/counters'); - } - }); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/views/checkbox.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/views/checkbox.js b/tez-ui/src/main/webapp/app/scripts/views/checkbox.js deleted file mode 100644 index da2de14..0000000 --- a/tez-ui/src/main/webapp/app/scripts/views/checkbox.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * 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. - */ - -App.Checkbox = Em.Checkbox.extend({ - change: function() { - var value = this.get('checked'), - target = this.get('target') || this.get('context'); - - if(target) { - Em.run.later(target.send.bind(target, this.get('action'), value), 100); - } - return true; - } -}); http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/views/dag-view-view.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/views/dag-view-view.js b/tez-ui/src/main/webapp/app/scripts/views/dag-view-view.js deleted file mode 100644 index f660572..0000000 --- a/tez-ui/src/main/webapp/app/scripts/views/dag-view-view.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * 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. - */ - -App.DagViewView = Ember.View.extend({ - setHeight: function () { - var container = $('.dag-view-component-container'), - offset; - if(container) { - offset = container.offset(); - container.height( - Math.max( - // 50 pixel is left at the bottom - offset ? $(window).height() - offset.top - 50 : 0, - 450 // Minimum dag view component container height - ) - ); - } - }, - - didInsertElement: function() { - $(window).on('resize', this.setHeight); - this.setHeight(); - }, - - willDestroyElement: function () { - $(window).off('resize', this.setHeight); - } -}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tez/blob/13132ec7/tez-ui/src/main/webapp/app/scripts/views/dropdown.js ---------------------------------------------------------------------- diff --git a/tez-ui/src/main/webapp/app/scripts/views/dropdown.js b/tez-ui/src/main/webapp/app/scripts/views/dropdown.js deleted file mode 100644 index be97507..0000000 --- a/tez-ui/src/main/webapp/app/scripts/views/dropdown.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * 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. - */ - -App.Dropdown = Em.Select.extend({ - currentValue: null, - init: function () { - this._super(); - this.set('currentValue', this.get('value')); - }, - change: function() { - var value = this.get('value'), - target = this.get('target') || this.get('context'); - - if(target && value != this.get('currentValue')) { - Em.run.later(target.send.bind(target, this.get('action'), value), 100); - this.set('currentValue', value); - } - return true; - } -}); \ No newline at end of file
