Repository: ambari Updated Branches: refs/heads/trunk 99c3937c9 -> 3ec1f7815
AMBARI-5774. Create Ember models for Slider Apps classes. (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3ec1f781 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3ec1f781 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3ec1f781 Branch: refs/heads/trunk Commit: 3ec1f7815240422b28b0e491c21c85752dffb121 Parents: 99c3937 Author: Oleg Nechiporenko <[email protected]> Authored: Thu May 15 16:24:12 2014 +0300 Committer: Oleg Nechiporenko <[email protected]> Committed: Thu May 15 16:27:05 2014 +0300 ---------------------------------------------------------------------- .../src/main/resources/ui/app/models/host.js | 54 +++++++ .../main/resources/ui/app/models/slider_app.js | 158 +++++++++++++++++++ .../ui/app/models/slider_app_component.js | 70 ++++++++ .../resources/ui/app/models/slider_app_type.js | 94 +++++++++++ .../ui/app/models/slider_app_type_component.js | 99 ++++++++++++ .../ui/app/models/slider_quick_link.js | 59 +++++++ .../resources/ui/app/models/typed_property.js | 69 ++++++++ 7 files changed, 603 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/3ec1f781/contrib/views/slider/src/main/resources/ui/app/models/host.js ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/models/host.js b/contrib/views/slider/src/main/resources/ui/app/models/host.js new file mode 100644 index 0000000..4bc1d79 --- /dev/null +++ b/contrib/views/slider/src/main/resources/ui/app/models/host.js @@ -0,0 +1,54 @@ +/** + * 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.Host = DS.Model.extend({ + + /** + * @type {string} + */ + hostName: DS.attr('string'), + + /** + * @type {string} + */ + publicHostName: DS.attr('string') + +}); + +App.Host.FIXTURES = [ + { + id: 1, + hostName: 'host1', + publicHostName: 'Host 1' + }, + { + id: 2, + hostName: 'host2', + publicHostName: 'Host 2' + }, + { + id: 3, + hostName: 'host3', + publicHostName: 'Host 3' + }, + { + id: 4, + hostName: 'host 4', + publicHostName: 'Host 4' + } +]; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/3ec1f781/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js b/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js new file mode 100644 index 0000000..e514be6 --- /dev/null +++ b/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js @@ -0,0 +1,158 @@ +/** + * 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.SliderApp = DS.Model.extend({ + + /** + * @type {string} + */ + index: DS.attr('string'), + + /** + * @type {string} + */ + yarnId: DS.attr('string'), + + /** + * @type {string} + */ + name: DS.attr('string'), + + /** + * @type {status} + */ + status: DS.attr('string'), + + /** + * @type {string} + */ + user: DS.attr('string'), + + /** + * @type {number} + */ + started: DS.attr('number'), + + /** + * @type {number} + */ + ended: DS.attr('number'), + + /** + * @type {App.SliderAppType} + */ + appType: DS.belongsTo('App.SliderAppType'), + + /** + * @type {string} + */ + diagnostics: DS.attr('string'), + + /** + * @type {App.SliderAppComponent[]} + */ + components: DS.hasMany('App.SliderAppComponent'), + + /** + * @type {App.QuickLink[]} + */ + quickLinks: DS.hasMany('App.QuickLink'), + + /** + * @type {App.TypedProperty[]} + */ + runtimeProperties: DS.hasMany('App.TypedProperty') +}); + +App.SliderApp.FIXTURES = [ + { + id: 1, + index: 'indx1', + yarnId: 'y1', + name: 'name1', + status: 'good', + user: 'u1', + started: 1400132912, + ended: 1400152912, + appType: 1, + diagnostics: 'd1', + components: [3, 4, 5], + quickLinks: [1, 2], + runtimeProperties: [1, 2, 3] + }, + { + id: 2, + index: 'indx2', + yarnId: 'y2', + name: 'name2', + status: 'good', + user: 'u2', + started: 1400132912, + ended: 1400152912, + appType: 2, + diagnostics: 'd2', + components: [1, 3], + quickLinks: [4, 5], + runtimeProperties: [3, 4] + }, + { + id: 3, + index: 'indx3', + yarnId: 'y3', + name: 'name3', + status: 'good', + user: 'u3', + started: 1400132912, + ended: 1400152912, + appType: 3, + diagnostics: 'd3', + components: [1], + quickLinks: [1, 2, 4, 5], + runtimeProperties: [2, 3] + }, + { + id: 4, + index: 'indx4', + yarnId: 'y4', + name: 'name4', + status: 'good', + user: 'u4', + started: 1400132912, + ended: 1400152912, + appType: 4, + diagnostics: 'd4', + components: [1, 2, 3, 4, 5], + quickLinks: [4], + runtimeProperties: [1, 2, 3, 4, 5] + }, + { + id: 5, + index: 'indx5', + yarnId: 'y5', + name: 'name5', + status: 'good', + user: 'u5', + started: 1400132912, + ended: 1400152912, + appType: 5, + diagnostics: 'd5', + components: [2, 5], + quickLinks: [3, 4], + runtimeProperties: [1, 2, 3] + } +]; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/3ec1f781/contrib/views/slider/src/main/resources/ui/app/models/slider_app_component.js ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/models/slider_app_component.js b/contrib/views/slider/src/main/resources/ui/app/models/slider_app_component.js new file mode 100644 index 0000000..de115c4 --- /dev/null +++ b/contrib/views/slider/src/main/resources/ui/app/models/slider_app_component.js @@ -0,0 +1,70 @@ +/** + * 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.SliderAppComponent = DS.Model.extend({ + + /** + * @type {string} + */ + index: DS.attr('string'), // (appid+component_name+index) + + /** + * @type {string} + */ + status: DS.attr('string'), + + /** + * @type {App.Host} + */ + host: DS.belongsTo('App.Host') + +}); + + +App.SliderAppComponent.FIXTURES = [ + { + id: 1, + index: 'indx1', + status: 'st1', + host: 1 + }, + { + id: 2, + index: 'indx2', + status: 'st1', + host: 2 + }, + { + id: 3, + index: 'indx3', + status: 'st3', + host: 3 + }, + { + id: 4, + index: 'indx4', + status: 'st4', + host: 4 + }, + { + id: 5, + index: 'indx5', + status: 'st5', + host: 1 + } +]; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/3ec1f781/contrib/views/slider/src/main/resources/ui/app/models/slider_app_type.js ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/models/slider_app_type.js b/contrib/views/slider/src/main/resources/ui/app/models/slider_app_type.js new file mode 100644 index 0000000..0c1e81d --- /dev/null +++ b/contrib/views/slider/src/main/resources/ui/app/models/slider_app_type.js @@ -0,0 +1,94 @@ +/** + * 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.SliderAppType = DS.Model.extend({ + + /** + * @type {string} + */ + index: DS.attr('string'), + + /** + * @type {string} + */ + displayName: DS.attr('string'), + + /** + * @type {App.SliderAppTypeComponent[]} + */ + components: DS.hasMany('App.SliderAppTypeComponent'), + + /** + * @type {object} + */ + configs: {} + +}); + +App.SliderAppType.FIXTURES = [ + { + id: 1, + index: 'indx1', + disaplyName: 'Index 1', + components: [1, 2], + configs: { + c1: 'v1', + c2: 'b1' + } + }, + { + id: 2, + index: 'indx2', + disaplyName: 'Index 2', + components: [2, 4, 5], + configs: { + c1: 'v2', + c2: 'b2' + } + }, + { + id: 3, + index: 'indx3', + disaplyName: 'Index 3', + components: [1, 2, 4], + configs: { + c1: 'v3', + c2: 'b3' + } + }, + { + id: 4, + index: 'indx4', + disaplyName: 'Index 4', + components: [5], + configs: { + c1: 'v4', + c2: 'b4' + } + }, + { + id: 5, + index: 'indx5', + disaplyName: 'Index 5', + components: [1, 2, 3, 4, 5], + configs: { + c1: 'v5', + c2: 'b5' + } + } +]; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/3ec1f781/contrib/views/slider/src/main/resources/ui/app/models/slider_app_type_component.js ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/models/slider_app_type_component.js b/contrib/views/slider/src/main/resources/ui/app/models/slider_app_type_component.js new file mode 100644 index 0000000..162e80f --- /dev/null +++ b/contrib/views/slider/src/main/resources/ui/app/models/slider_app_type_component.js @@ -0,0 +1,99 @@ +/** + * 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.SliderAppTypeComponent = DS.Model.extend({ + + /** + * @type {string} + */ + index: DS.attr('string'), // (app-type + name) + + /** + * @type {string} + */ + name: DS.attr('string'), + + /** + * @type {string} + */ + displayName: DS.attr('string'), + + /** + * @type {number} + */ + defaultNumInstances: DS.attr('number'), + + /** + * @type {number} + */ + defaultYARNMemory: DS.attr('number'), + + /** + * @type {number} + */ + defaultYARNCPU: DS.attr('number') + +}); + +App.SliderAppTypeComponent.FIXTURES = [ + { + id: 1, + index: 'indx1', + name: 'name1', + displayName: 'Name 1', + defaultNumInstances: 10, + defaultYARNMemory: 1000, + defaultYARNCPU: 2 + }, + { + id: 2, + index: 'indx2', + name: 'name2', + displayName: 'Name 2', + defaultNumInstances: 10, + defaultYARNMemory: 1000, + defaultYARNCPU: 2 + }, + { + id: 3, + index: 'indx3', + name: 'name3', + displayName: 'Name 3', + defaultNumInstances: 10, + defaultYARNMemory: 1000, + defaultYARNCPU: 2 + }, + { + id: 4, + index: 'indx4', + name: 'name4', + displayName: 'Name 4', + defaultNumInstances: 10, + defaultYARNMemory: 1000, + defaultYARNCPU: 2 + }, + { + id: 5, + index: 'indx5', + name: 'name5', + displayName: 'Name 5', + defaultNumInstances: 10, + defaultYARNMemory: 1000, + defaultYARNCPU: 2 + } +]; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/3ec1f781/contrib/views/slider/src/main/resources/ui/app/models/slider_quick_link.js ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/models/slider_quick_link.js b/contrib/views/slider/src/main/resources/ui/app/models/slider_quick_link.js new file mode 100644 index 0000000..5b11f13 --- /dev/null +++ b/contrib/views/slider/src/main/resources/ui/app/models/slider_quick_link.js @@ -0,0 +1,59 @@ +/** + * 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.QuickLink = DS.Model.extend({ + + /** + * @type {string} + */ + label: DS.attr('string'), + + /** + * @type {string} + */ + url: DS.attr('string') + +}); + +App.QuickLink.FIXTURES = [ + { + id: 1, + label: 'link1', + url: 'url1' + }, + { + id: 2, + label: 'link2', + url: 'url2' + }, + { + id: 3, + label: 'link3', + url: 'url3' + }, + { + id: 4, + label: 'link4', + url: 'url4' + }, + { + id: 5, + label: 'link5', + url: 'url5' + } +]; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/3ec1f781/contrib/views/slider/src/main/resources/ui/app/models/typed_property.js ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/models/typed_property.js b/contrib/views/slider/src/main/resources/ui/app/models/typed_property.js new file mode 100644 index 0000000..86c611d --- /dev/null +++ b/contrib/views/slider/src/main/resources/ui/app/models/typed_property.js @@ -0,0 +1,69 @@ +/** + * 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.TypedProperty = DS.Model.extend({ + + /** + * @type {string} + */ + key: DS.attr('string'), + + /** + * @type {string} + */ + value: DS.attr('string'), + + /** + * @type {string} + */ + type: DS.attr('string') // (one of 'date', 'host') + +}); + +App.TypedProperty.FIXTURES = [ + { + id: 1, + key: 'k1', + value: 'v1', + type: 'host' + }, + { + id: 2, + key: 'k2', + value: 'v2', + type: 'host' + }, + { + id: 3, + key: 'k3', + value: 'v3', + type: 'date' + }, + { + id: 4, + key: 'k4', + value: 'v4', + type: 'date' + }, + { + id: 5, + key: 'k5', + value: 'v5', + type: 'host' + } +]; \ No newline at end of file
