TEZ-3022. Tez UI 2: Add serializer & adapter for timeline server (sree)
Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/e2fbcc4c Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/e2fbcc4c Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/e2fbcc4c Branch: refs/heads/TEZ-2980 Commit: e2fbcc4c24baf043a43b71bce9037da12dff534d Parents: a0dd70c Author: Sreenath Somarajapuram <s...@apache.org> Authored: Tue Jan 5 00:07:05 2016 +0530 Committer: Sreenath Somarajapuram <s...@apache.org> Committed: Thu Feb 25 03:31:59 2016 +0530 ---------------------------------------------------------------------- TEZ-2980-CHANGES.txt | 1 + .../src/main/webapp/app/adapters/timeline.js | 23 +++++++++++ tez-ui2/src/main/webapp/app/routes/abstract.js | 1 + .../src/main/webapp/app/serializers/timeline.js | 25 ++++++++++++ .../src/main/webapp/config/default-app-conf.js | 12 ++++++ .../webapp/tests/unit/adapters/timeline-test.js | 31 +++++++++++++++ .../tests/unit/serializers/timeline-test.js | 40 ++++++++++++++++++++ 7 files changed, 133 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/e2fbcc4c/TEZ-2980-CHANGES.txt ---------------------------------------------------------------------- diff --git a/TEZ-2980-CHANGES.txt b/TEZ-2980-CHANGES.txt index 0eb31bf..c8f9d0f 100644 --- a/TEZ-2980-CHANGES.txt +++ b/TEZ-2980-CHANGES.txt @@ -9,3 +9,4 @@ ALL CHANGES: TEZ-2985. Tez UI 2: Create loader and entity classes TEZ-3021. Tez UI 2: Add env service & initializer TEZ-3023. Tez UI 2: Abstract adapter and route + TEZ-3022. Tez UI 2: Add serializer & adapter for timeline server http://git-wip-us.apache.org/repos/asf/tez/blob/e2fbcc4c/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 new file mode 100644 index 0000000..aba7e1e --- /dev/null +++ b/tez-ui2/src/main/webapp/app/adapters/timeline.js @@ -0,0 +1,23 @@ +/** + * 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 AbstractAdapter from './abstract'; + +export default AbstractAdapter.extend({ + serverName: "timeline", +}); http://git-wip-us.apache.org/repos/asf/tez/blob/e2fbcc4c/tez-ui2/src/main/webapp/app/routes/abstract.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/routes/abstract.js b/tez-ui2/src/main/webapp/app/routes/abstract.js index d0f3c3d..3191762 100644 --- a/tez-ui2/src/main/webapp/app/routes/abstract.js +++ b/tez-ui2/src/main/webapp/app/routes/abstract.js @@ -80,6 +80,7 @@ export default Ember.Route.extend({ setValue: function (value) { this.set('loadedValue', value); this.set('isLoading', false); + return value; }, _setControllerModel: Ember.observer("_controller", "loadedValue", function () { http://git-wip-us.apache.org/repos/asf/tez/blob/e2fbcc4c/tez-ui2/src/main/webapp/app/serializers/timeline.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/app/serializers/timeline.js b/tez-ui2/src/main/webapp/app/serializers/timeline.js new file mode 100644 index 0000000..8963dc2 --- /dev/null +++ b/tez-ui2/src/main/webapp/app/serializers/timeline.js @@ -0,0 +1,25 @@ +/** + * 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 LoaderSerializer from './loader'; + +export default LoaderSerializer.extend({ + extractArrayPayload: function (payload) { + return payload.entities; + } +}); http://git-wip-us.apache.org/repos/asf/tez/blob/e2fbcc4c/tez-ui2/src/main/webapp/config/default-app-conf.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/config/default-app-conf.js b/tez-ui2/src/main/webapp/config/default-app-conf.js index c8f6dd9..51a2e81 100644 --- a/tez-ui2/src/main/webapp/config/default-app-conf.js +++ b/tez-ui2/src/main/webapp/config/default-app-conf.js @@ -35,4 +35,16 @@ module.exports = { // Tez App configurations cluster: 'cluster' }, }, + paths: { + timeline: { + dag: 'TEZ_DAG_ID', + vertex: 'TEZ_VERTEX_ID', + task: 'TEZ_TASK_ID', + taskAttempt: 'TEZ_TASK_ATTEMPT_ID', + + hiveQuery: 'HIVE_QUERY_ID', + + tezApp: 'TEZ_APPLICATION' + } + } }; http://git-wip-us.apache.org/repos/asf/tez/blob/e2fbcc4c/tez-ui2/src/main/webapp/tests/unit/adapters/timeline-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/adapters/timeline-test.js b/tez-ui2/src/main/webapp/tests/unit/adapters/timeline-test.js new file mode 100644 index 0000000..9b1a8de --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/adapters/timeline-test.js @@ -0,0 +1,31 @@ +/** + * 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 { moduleFor, test } from 'ember-qunit'; + +moduleFor('adapter:timeline', 'Unit | Adapter | timeline', { + // Specify the other units that are required for this test. + // needs: ['serializer:foo'] +}); + +test('Basic creation test', function(assert) { + let adapter = this.subject(); + + assert.ok(adapter); + assert.equal(adapter.serverName, "timeline"); +}); http://git-wip-us.apache.org/repos/asf/tez/blob/e2fbcc4c/tez-ui2/src/main/webapp/tests/unit/serializers/timeline-test.js ---------------------------------------------------------------------- diff --git a/tez-ui2/src/main/webapp/tests/unit/serializers/timeline-test.js b/tez-ui2/src/main/webapp/tests/unit/serializers/timeline-test.js new file mode 100644 index 0000000..53f0b06 --- /dev/null +++ b/tez-ui2/src/main/webapp/tests/unit/serializers/timeline-test.js @@ -0,0 +1,40 @@ +/** + * 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 { moduleFor, test } from 'ember-qunit'; + +moduleFor('serializer:timeline', 'Unit | Serializer | timeline', { + // Specify the other units that are required for this test. + // needs: ['serializer:timeline'] +}); + +test('Basic creation test', function(assert) { + let serializer = this.subject(); + + assert.ok(serializer); + assert.ok(serializer.extractArrayPayload); +}); + +test('extractArrayPayload test', function(assert) { + let serializer = this.subject(), + testPayload = { + entities: [] + }; + + assert.equal(serializer.extractArrayPayload(testPayload), testPayload.entities); +});