You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by is...@apache.org on 2018/02/20 20:27:33 UTC
[ambari] branch branch-feature-AMBARI-14714-ui updated:
[AMBARI-22925] mpack admin (#343)
This is an automated email from the ASF dual-hosted git repository.
ishanbha pushed a commit to branch branch-feature-AMBARI-14714-ui
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714-ui by this push:
new d4f42be [AMBARI-22925] mpack admin (#343)
d4f42be is described below
commit d4f42be94a5d1240cb52e842911fd07a74be83f3
Author: Jason Golieb <j...@golieb.net>
AuthorDate: Tue Feb 20 15:27:31 2018 -0500
[AMBARI-22925] mpack admin (#343)
* Bug fixes
* Implementation of Service Groups (mpacks) admin screen without any back end. Includes DashRow and Timeline controls.
* Fixed sql script.
* Added all admin permissions to dev server simulated admin.
---
.../main/resources/Ambari-DDL-Postgres-CREATE.sql | 2 +-
.../app/assets/data/users/privileges_admin.json | 58 +++++-
ambari-web/app/assets/test/tests.js | 3 +
ambari-web/app/controllers.js | 1 +
.../main/admin/serviceGroups_controller.js | 185 +++++++++++++++++
ambari-web/app/messages.js | 16 +-
ambari-web/app/routes/main.js | 21 ++
ambari-web/app/styles/application.less | 130 +++++++++++-
ambari-web/app/styles/dashrow.less | 98 +++++++++
ambari-web/app/templates/common/dashrow.hbs | 61 ++++++
ambari-web/app/templates/common/timeline.hbs | 34 ++++
.../app/templates/main/admin/serviceGroups.hbs | 79 ++++++++
.../templates/main/admin/serviceGroups/body.hbs | 39 ++++
.../templates/main/admin/serviceGroups/header.hbs | 19 ++
.../templates/main/admin/serviceGroups/menu.hbs | 24 +++
.../main/admin/serviceGroups/serviceGroup.hbs | 19 ++
ambari-web/app/utils/date/date.js | 25 ++-
ambari-web/app/utils/handlebars_helpers.js | 13 +-
ambari-web/app/views.js | 6 +
ambari-web/app/views/common/dashrow_view.js | 69 +++++++
.../app/views/common/helpers/format_date_view.js | 28 +++
ambari-web/app/views/common/timeline_view.js | 63 ++++++
.../main/admin/serviceGroups/serviceGroup_view.js | 44 +++++
.../app/views/main/admin/serviceGroups_view.js | 23 +++
ambari-web/app/views/main/menu.js | 10 +-
ambari-web/test/utils/date/date_test.js | 25 +++
ambari-web/test/views/common/dashrow_view_test.js | 33 ++++
.../views/common/helpers/format_date_view_test.js | 44 +++++
ambari-web/test/views/common/timeline_view_test.js | 220 +++++++++++++++++++++
29 files changed, 1374 insertions(+), 18 deletions(-)
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index 20b777d..bbd0239 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -1287,7 +1287,7 @@ INSERT INTO ambari_sequences (sequence_name, sequence_value) VALUES
('servicecomponent_version_id_seq', 0),
('blueprint_service_id_seq', 0),
('blueprint_mpack_instance_id_seq', 0),
- ('hostgroup_component_id_seq', 0);
+ ('hostgroup_component_id_seq', 0),
('repo_os_id_seq', 0),
('repo_definition_id_seq', 0),
('hostcomponentdesiredstate_id_seq', 0);
diff --git a/ambari-web/app/assets/data/users/privileges_admin.json b/ambari-web/app/assets/data/users/privileges_admin.json
index 3c60252..d849d0b 100644
--- a/ambari-web/app/assets/data/users/privileges_admin.json
+++ b/ambari-web/app/assets/data/users/privileges_admin.json
@@ -3,11 +3,65 @@
"items" : [
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/privileges/1",
- "PrivilegeInfo" : {
+ "AuthorizationInfo" : {
"permission_name" : "AMBARI.ADMINISTRATOR",
"principal_name" : "admin",
"principal_type" : "USER",
- "privilege_id" : 1
+ "authorization_id" : "AMBARI.ADMINISTRATOR"
+ }
+ },
+ {
+ "href" : "http://c6401.ambari.apache.org:8080/api/v1/privileges/2",
+ "AuthorizationInfo" : {
+ "permission_name" : "CLUSTER.TOGGLE_KERBEROS",
+ "principal_name" : "admin",
+ "principal_type" : "USER",
+ "authorization_id" : "CLUSTER.TOGGLE_KERBEROS"
+ }
+ },
+ {
+ "href" : "http://c6401.ambari.apache.org:8080/api/v1/privileges/3",
+ "AuthorizationInfo" : {
+ "permission_name" : "CLUSTER.MODIFY_CONFIGS",
+ "principal_name" : "admin",
+ "principal_type" : "USER",
+ "authorization_id" : "CLUSTER.MODIFY_CONFIGS"
+ }
+ },
+ {
+ "href" : "http://c6401.ambari.apache.org:8080/api/v1/privileges/4",
+ "AuthorizationInfo" : {
+ "permission_name" : "SERVICE.START_STOP",
+ "principal_name" : "admin",
+ "principal_type" : "USER",
+ "authorization_id" : "SERVICE.START_STOP"
+ }
+ },
+ {
+ "href" : "http://c6401.ambari.apache.org:8080/api/v1/privileges/5",
+ "AuthorizationInfo" : {
+ "permission_name" : "SERVICE.SET_SERVICE_USERS_GROUPS",
+ "principal_name" : "admin",
+ "principal_type" : "USER",
+ "authorization_id" : "SERVICE.SET_SERVICE_USERS_GROUPS"
+ }
+ },
+ {
+ "href" : "http://c6401.ambari.apache.org:8080/api/v1/privileges/6",
+ "AuthorizationInfo" : {
+ "permission_name" : "CLUSTER.UPGRADE_DOWNGRADE_STACK",
+ "principal_name" : "admin",
+ "principal_type" : "USER",
+ "authorization_id" : "CLUSTER.UPGRADE_DOWNGRADE_STACK"
+ }
+ },
+ {
+ "href" : "http://c6401.ambari.apache.org:8080/api/v1/privileges/7",
+ "AuthorizationInfo" : {
+ "permission_name" : "CLUSTER.VIEW_STACK_DETAILS",
+ "principal_name" : "admin",
+ "principal_type" : "USER",
+ "authorization_id" : "CLUSTER.VIEW_STACK_DETAILS"
}
}
]
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 1d1db3e..def9cf2 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -252,6 +252,7 @@ var files = [
'test/views/common/configs/widgets/list_config_widget_view_test',
'test/views/common/configs/widgets/slider_config_widget_view_test',
'test/views/common/configs/widgets/toggle_config_widget_view_test',
+ 'test/views/common/helpers/format_date_view_test',
'test/views/common/helpers/format_word_break_view_test',
'test/views/common/ajax_default_error_popup_body_test',
'test/views/common/filter_combo_cleanable_test',
@@ -263,6 +264,8 @@ var files = [
'test/views/common/modal_popup_test',
'test/views/common/sort_view_test',
'test/views/common/progress_bar_view_test',
+ 'test/views/common/dashrow_view_test',
+ 'test/views/common/timeline_view_test',
'test/views/common/select_custom_date_view_test',
'test/views/common/widget/graph_widget_view_test',
'test/views/common/widget/number_widget_view_test',
diff --git a/ambari-web/app/controllers.js b/ambari-web/app/controllers.js
index 74f06c0..cbe39ad 100644
--- a/ambari-web/app/controllers.js
+++ b/ambari-web/app/controllers.js
@@ -86,6 +86,7 @@ require('controllers/main/admin/highAvailability/journalNode/step7_controller');
require('controllers/main/admin/highAvailability/journalNode/step8_controller');
require('controllers/main/admin/stack_and_upgrade_controller');
require('controllers/main/admin/stack_upgrade_history_controller');
+require('controllers/main/admin/serviceGroups_controller');
require('controllers/main/admin/serviceAccounts_controller');
require('utils/polling');
require('controllers/main/admin/kerberos');
diff --git a/ambari-web/app/controllers/main/admin/serviceGroups_controller.js b/ambari-web/app/controllers/main/admin/serviceGroups_controller.js
new file mode 100644
index 0000000..431b2c4
--- /dev/null
+++ b/ambari-web/app/controllers/main/admin/serviceGroups_controller.js
@@ -0,0 +1,185 @@
+/**
+ * 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 App = require('app');
+
+const VersionType = {
+ HOTFIX: 'hotfix',
+ PATCH: 'patch',
+ RELEASE: 'release'
+}
+
+App.MainAdminServiceGroupsController = Em.Controller.extend(App.LocalStorage, {
+ name: 'mainAdminServiceGroupsController',
+
+ /**
+ * Dummy data that will be removed when we have an API to query.
+ */
+ serviceGroups: [
+ {
+ id: "HDPCore-300",
+ name: "HDP Core",
+ version: "3.0.0",
+ installedServices: [
+ {
+ name: "HDFS",
+ version: "x.x"
+ },
+ {
+ name: "Zookeeper",
+ version: "x.x"
+ }
+ ],
+ otherServices: [
+ {
+ name: "Blarg",
+ version: "x.x"
+ },
+ {
+ name: "Snarf",
+ version: "x.x"
+ }
+ ],
+ history: [
+ {
+ date: new Date(2017, 0, 14),
+ version: '2.7',
+ versionType: 'release'
+ },
+ {
+ date: new Date(2017, 12, 16),
+ version: '3.0',
+ versionType: 'release'
+ },
+ {
+ date: new Date(2017, 9, 17),
+ version: '3.1',
+ versionType: 'release'
+ },
+ {
+ date: new Date(2017, 0, 11),
+ version: '2.7',
+ versionType: 'release'
+ },
+ {
+ date: new Date(2017, 12, 12),
+ version: '3.0',
+ versionType: 'release'
+ },
+ {
+ date: new Date(2017, 9, 13),
+ version: '3.1',
+ versionType: 'release'
+ },
+ {
+ date: new Date(2017, 6, 15),
+ version: '2.6.1.1',
+ versionType: 'hotfix'
+ },
+ {
+ date: new Date(2017, 3, 15),
+ version: '2.6.2',
+ versionType: 'patch'
+ },
+ {
+ date: new Date(2017, 0, 15),
+ version: '2.7',
+ versionType: 'release'
+ },
+ {
+ date: new Date(2017, 12, 15),
+ version: '3.0',
+ versionType: 'release'
+ },
+ {
+ date: new Date(2017, 9, 15),
+ version: '3.1',
+ versionType: 'release'
+ }
+ ]
+ },
+ {
+ id: "ODS-300",
+ name: "ODS",
+ version: "3.0.0",
+ installedServices: [
+ {
+ name: "HDFS",
+ version: "x.x"
+ },
+ {
+ name: "Zookeeper",
+ version: "x.x"
+ }
+ ],
+ otherServices: [
+ {
+ name: "Blarg",
+ version: "x.x"
+ },
+ {
+ name: "Snarf",
+ version: "x.x"
+ }
+ ],
+ history: [
+ {
+ date: new Date(2017, 6, 15),
+ version: '2.6.1.1',
+ versionType: 'hotfix'
+ },
+ {
+ date: new Date(2017, 3, 15),
+ version: '2.6.2',
+ versionType: 'patch'
+ },
+ {
+ date: new Date(2017, 0, 15),
+ version: '2.7',
+ versionType: 'release'
+ },
+ {
+ date: new Date(2017, 9, 15),
+ version: '3.0',
+ versionType: 'release'
+ }
+ ]
+ }
+ ],
+
+ // /**
+ // * data to load from local storage
+ // */
+ // dbPropsToLoad: [ ],
+
+ // init: function () {
+ // this.initDBProperties();
+ // },
+
+ // /**
+ // * restore data from localStorage
+ // */
+ // initDBProperties: function () {
+ // var props = this.getDBProperties(this.get('dbPropsToLoad'));
+ // Em.keys(props).forEach(function (k) {
+ // if (!Em.isNone(props[k])) {
+ // this.set(k, props[k]);
+ // }
+ // }, this);
+ // },
+});
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 62a7e60..6ec70b2 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -144,6 +144,7 @@ Em.I18n.translations = {
'common.disk':'Disk',
'common.diskUsage':'Disk Usage',
'common.dismiss': "Dismiss",
+ 'common.documentation': "Documentation",
'common.done':'Done',
'common.downgrade':'Downgrade',
'common.download': 'Download',
@@ -182,7 +183,8 @@ Em.I18n.translations = {
'common.group':'Group',
'common.groups':'Groups',
'common.hbase':'HBase',
- 'common.hide':'Hide',
+ 'common.hide': 'Hide',
+ 'common.history': 'History',
'common.host':'Host',
'common.hostLog.popup.errorLog.value': 'errors-{0}.txt',
'common.hostLog.popup.logDir.path':'/var/lib/ambari-agent/data/', // TODO, this hardcoded path needs to be removed.
@@ -246,7 +248,8 @@ Em.I18n.translations = {
'common.optional': 'Optional',
'common.options': 'Options',
'common.os': 'OS',
- 'common.oss':'OSs',
+ 'common.oss': 'OSs',
+ 'common.others': 'Others',
'common.override':'Override',
'common.overrides': 'Overrides',
'common.package': 'Package',
@@ -305,7 +308,8 @@ Em.I18n.translations = {
'common.servers':'Servers',
'common.service': 'Service',
'common.serviceAccounts': 'Service Accounts',
- 'common.services':'Services',
+ 'common.serviceGroups': 'Service Groups',
+ 'common.services': 'Services',
'common.severity': "Severity",
'common.show':'Show',
'common.showDetails':'Show Details',
@@ -1966,6 +1970,12 @@ Em.I18n.translations = {
"<li>DO NOT enable / disable HA</li>" +
"<li>DO NOT make any drastic changes to service configurations</li></ul>" +
"You <strong>MUST</strong> continue the {0} and finalize <strong>BEFORE</strong> performing <strong>ANY</strong> significant changes to the cluster.",
+
+ 'admin.serviceGroups.title': "Management Packs",
+ 'admin.serviceGroups.createUpgradePlan': "Create Upgrade Plan",
+ 'admin.serviceGroups.addServiceGroup': "Add Management Pack",
+ 'admin.serviceGroups.removeOldVersions': "Remove Old Versions",
+
'admin.stackUpgrade.downgrade.proceed': "Proceed with Downgrade",
'admin.stackUpgrade.downgrade.body': "Are you sure you wish to abort the upgrade process and downgrade to <b>{0}</b>?",
'admin.stackUpgrade.downgrade.retry.body': "Are you sure you wish to retry downgrade to <b>{0}</b>?",
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 194fb14..c0a4e19 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -562,6 +562,26 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
})
}),
+ serviceGroups: Em.Route.extend({
+ breadcrumbs: {
+ label: Em.I18n.t('admin.serviceGroups.title')
+ },
+
+ route: '/serviceGroups',
+
+ enter: function (router, transition) {
+ if (router.get('loggedIn') && !App.isAuthorized('CLUSTER.VIEW_STACK_DETAILS')) {
+ router.transitionTo('main.dashboard.index');
+ }
+ },
+
+ connectOutlets: function (router) {
+ router.set('mainAdminController.category', "adminServiceGroups");
+ router.set('mainAdminController.categoryLabel', Em.I18n.t('common.serviceGroups'));
+ router.get('mainAdminController').connectOutlet('mainAdminServiceGroups');
+ }
+ }),
+
stackAndUpgrade: Em.Route.extend({
route: '/stack',
breadcrumbs: null,
@@ -617,6 +637,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
router.transitionTo(event.context);
}
}),
+
stackUpgrade: require('routes/stack_upgrade_routes'),
adminAdvanced: Em.Route.extend({
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 5c69e2a..83d515e 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -2565,13 +2565,19 @@ a.abort-icon:hover {
.capsule {
height: 22px;
width: auto;
- border-radius: 12px;
- background: #eee;
- font-size: 10px;
- align-items: center;
- border: none;
padding-left: 10px;
padding-right: 10px;
+ margin-bottom: 5px;
+ background-color: #ddd;
+ font-size: 10px;
+ border-radius: 12px;
+ border: none;
+ outline: none;
+
+ &:hover {
+ background-color: #ccc;
+ }
+
.icon {
color: #999;
font-style: normal;
@@ -2732,6 +2738,120 @@ td .no-data {
background-color: @diff-background-equal;
}
+#admin-service-groups {
+ div.timeline {
+ height: 190px;
+ width: 100%;
+ overflow: auto;
+
+ ol {
+ display: flex;
+ height: 170px;
+
+ li.timeline-event {
+ list-style: none;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: space-evenly;
+ position: relative;
+ flex-shrink: 0;
+ width: 120px;
+ height: 60px;
+ padding: 5px;
+ color: #999;
+ background-color: #eee;
+ border-radius: 4px;
+
+ &:not(:last-of-type):before {
+ height: 2px;
+ width: 100%;
+ position: absolute;
+ left: 50%;
+ content: " ";
+ background-color: #ccc;
+ }
+
+ &:nth-of-type(odd):before {
+ bottom: ~"calc(-50% + 4px)";
+ }
+
+ &:nth-of-type(even):before {
+ top: ~"calc(-50% + 4px)";
+ }
+
+ &:after {
+ height: 14px;
+ width: 14px;
+ border-radius: 50%;
+ content: " ";
+ position: absolute;
+ background-color: #666;
+ left: 50%;
+ transform: translateX(-50%);
+ border: white 1px solid;
+ }
+
+ &:nth-of-type(odd) {
+ align-self: flex-start;
+
+ &:after {
+ bottom: ~"calc(-50% - 2px)";
+ }
+ }
+
+ &:nth-of-type(even) {
+ align-self: flex-end;
+
+ &:after {
+ top: ~"calc(-50% - 2px)";
+ }
+ }
+
+ &:last-of-type {
+ color: #ccc;
+ background-color: #1eb475;
+
+ .event-heading {
+ color: #fafafa;
+ }
+
+ &:after {
+ width: 13px;
+ height: 13px;
+ background-color: inherit;
+ border: none;
+ box-shadow: 0 0 0 8px #1eb47599;
+ }
+ }
+
+ .event-heading {
+ color: #666;
+ font-size: 16px;
+
+ .icon {
+ font-family: 'FontAwesome';
+
+ &.release {
+ display: none;
+ }
+
+ &.patch:before {
+ color: #e98a40;
+ content: '\f0fa';
+ }
+
+ &.hotfix:before {
+ color: #ef6162;
+ content: '\f188';
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
.bulk-host-display {
margin-bottom: 10px;
pre {
diff --git a/ambari-web/app/styles/dashrow.less b/ambari-web/app/styles/dashrow.less
new file mode 100644
index 0000000..4d7c064
--- /dev/null
+++ b/ambari-web/app/styles/dashrow.less
@@ -0,0 +1,98 @@
+/**
+ * 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 'common.less';
+
+.dashrow {
+ margin-bottom: 20px;
+ border-radius: 4px;
+ box-shadow: 0 0 10px 2px rgba(0,0,0,0.1);
+
+ .panel {
+ border-radius: inherit;
+
+ .panel-heading {
+ height: 90px;
+ margin: 0;
+ padding: 15px 30px;
+ border-radius: inherit;
+ display: flex;
+ align-items: center;
+ font-size: 20px;
+
+ .panel-title {
+ color: #333;
+ margin-right: 15px;
+ font-size: inherit;
+ }
+
+ .dropdown {
+ margin-left: auto;
+ margin-right: 15px;
+
+ .menu-button {
+ border: none;
+ outline: none;
+
+ &:after {
+ content: '\e235';
+ font-family: 'Glyphicons Halflings';
+ vertical-align: text-bottom;
+ font-size: inherit;
+ }
+ }
+
+ & ~ .collapse-button {
+ margin-left: initial;
+ }
+ }
+
+ .collapse-button {
+ width: 20px;
+ padding: 0;
+ border: none;
+ outline: none;
+ margin-left: auto;
+
+ &:after {
+ content: '\f078';
+ font-family: 'FontAwesome';
+ vertical-align: text-bottom;
+ font-size: inherit;
+ }
+
+ &.collapsed:after {
+ content: '\f054';
+ }
+ }
+ }
+
+ .panel-collapse {
+ border-bottom-left-radius: inherit;
+ border-bottom-right-radius: inherit;
+ background: #fafafa;
+
+ .panel-body {
+ padding: 15px 30px;
+ }
+ }
+ }
+}
+
+.open .dropdown-menu {
+ display: block;
+}
\ No newline at end of file
diff --git a/ambari-web/app/templates/common/dashrow.hbs b/ambari-web/app/templates/common/dashrow.hbs
new file mode 100644
index 0000000..822a7c7
--- /dev/null
+++ b/ambari-web/app/templates/common/dashrow.hbs
@@ -0,0 +1,61 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+<div class="dashrow">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ {{#if view.headerClass}}
+ {{view view.headerClass}}
+ {{else}}
+ {{#if view.encodeHeader}}
+ {{view.header}}
+ {{else}}
+ {{{view.header}}}
+ {{/if}}
+ {{/if}}
+ {{#if view.hasMenu}}
+ <div class="dropdown">
+ <button class="dropdown-toggle icon-button menu-button" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
+ {{#if view.menuClass}}
+ {{view view.menuClass}}
+ {{else}}
+ {{#if view.encodeMenu}}
+ {{view.menu}}
+ {{else}}
+ {{{view.menu}}}
+ {{/if}}
+ {{/if}}
+ </div>
+ {{/if}}
+ <button class="collapse-button" type="button" data-toggle="collapse" {{bindAttr data-target="view.collapseTarget" aria-controls="view.collapseId"}} aria-expanded="false"></button>
+ </div>
+ <div {{bindAttr id="view.collapseId"}} class="panel-collapse collapse">
+ <div class="panel-body">
+ {{#if view.bodyClass}}
+ {{view view.bodyClass}}
+ {{else}}
+ {{#if view.encodeBody}}
+ {{view.body}}
+ {{else}}
+ {{{view.body}}}
+ {{/if}}
+ {{/if}}
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/ambari-web/app/templates/common/timeline.hbs b/ambari-web/app/templates/common/timeline.hbs
new file mode 100644
index 0000000..685752d
--- /dev/null
+++ b/ambari-web/app/templates/common/timeline.hbs
@@ -0,0 +1,34 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+<div class="timeline">
+ <ol>
+ {{#each event in view.sortedEvents}}
+ <li class="timeline-event">
+ {{#if view.eventClass}}
+ {{view view.eventClass eventBinding="event"}}
+ {{else}}
+ <div class="event-heading">
+ <span {{bindAttr class=":icon event.versionType"}}> </span>{{event.version}}
+ </div>
+ <div>{{formatDate event.date format="D MMM YYYY"}}</div>
+ {{/if}}
+ </li>
+ {{/each}}
+ </ol>
+</div>
\ No newline at end of file
diff --git a/ambari-web/app/templates/main/admin/serviceGroups.hbs b/ambari-web/app/templates/main/admin/serviceGroups.hbs
new file mode 100644
index 0000000..81f27b7
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/serviceGroups.hbs
@@ -0,0 +1,79 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+<div id="admin-service-groups">
+ <div class="row">
+ <!-- Nav tabs -->
+ <div class="col-xs-12">
+ <ul class="nav nav-tabs pull-left" role="tablist">
+ <li role="presentation" class="active">
+ <a href="#mpacks" aria-controls="mpacks" role="tab" data-toggle="tab">Management Packs</a>
+ </li>
+ <li role="presentation">
+ <a href="#history" aria-controls="history" role="tab" data-toggle="tab">Upgrade History</a>
+ </li>
+ </ul>
+ <!-- Actions Menu -->
+ <div class="dropdown pull-right">
+ <button class="btn btn-primary dropdown-toggle" type="button" id="actions-menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">Actions <span class="caret"></span></button>
+ <ul class="dropdown-menu" aria-labelledby="actions-menu">
+ <li><a href="#"><i class="icon-arrow-up"></i> {{t admin.serviceGroups.createUpgradePlan}}</a></li>
+ <li><a href="#"><i class="icon-plus"></i> {{t admin.serviceGroups.addServiceGroup}}</a></li>
+ <li><a href="#"><i class="icon-trash"></i> {{t admin.serviceGroups.removeOldVersions}}</a></li>
+ <li><a href="#"><i class="icon-book"></i> {{t common.documentation}}</a></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <!-- Tab panes -->
+ <div class="col-xs-12">
+ <div class="tab-content">
+ <div role="tabpanel" class="tab-pane active" id="mpacks">
+ {{#each serviceGroup in controller.serviceGroups}}
+ {{view App.ServiceGroupView serviceGroupBinding="serviceGroup"}}
+ {{/each}}
+ </div>
+ <div role="tabpanel" class="tab-pane" id="history">
+ <div class="panel panel-default">
+ <div class="panel-body">
+ <table class="table table-hover">
+ <thead>
+ <tr>
+ <th>Management Pack</th>
+ <th>Status</th>
+ <th>Date Added</th>
+ <th>Actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/ambari-web/app/templates/main/admin/serviceGroups/body.hbs b/ambari-web/app/templates/main/admin/serviceGroups/body.hbs
new file mode 100644
index 0000000..ddb6c5c
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/serviceGroups/body.hbs
@@ -0,0 +1,39 @@
+{{!
+* 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.
+}}
+
+<h4>{{t common.services}}</h4>
+<div>
+ <p>{{t common.installed}}:
+ {{#each service in view.installedServices}}
+ <button class="capsule capsule-selected">
+ {{service.name}} {{service.version}} <i class="icon icon-ok"></i>
+ </button>
+ {{/each}}
+ </p>
+ <p>{{t common.others}}:
+ {{#each service in view.otherServices}}
+ <button class="capsule">
+ {{service.name}} {{service.version}} <i class="icon icon-plus"></i>
+ </button>
+ {{/each}}
+ </p>
+</div>
+<div>
+ <h4>{{t common.version}} {{t common.history}}</h4>
+ {{view App.Timeline eventsBinding="view.history"}}
+</div>
\ No newline at end of file
diff --git a/ambari-web/app/templates/main/admin/serviceGroups/header.hbs b/ambari-web/app/templates/main/admin/serviceGroups/header.hbs
new file mode 100644
index 0000000..a748278
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/serviceGroups/header.hbs
@@ -0,0 +1,19 @@
+{{!
+* 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.
+}}
+
+<h4 class="panel-title">{{view.name}} {{view.version}}</h4>
\ No newline at end of file
diff --git a/ambari-web/app/templates/main/admin/serviceGroups/menu.hbs b/ambari-web/app/templates/main/admin/serviceGroups/menu.hbs
new file mode 100644
index 0000000..faa041d
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/serviceGroups/menu.hbs
@@ -0,0 +1,24 @@
+{{!
+* 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.
+}}
+
+<ul class="dropdown-menu dropdown-menu-right">
+ <li><a href="#"><i class="icon-arrow-up"></i> {{t admin.serviceGroups.createUpgradePlan}}</a></li>
+ <li><a href="#"><i class="icon-plus"></i> {{t admin.serviceGroups.addServiceGroup}}</a></li>
+ <li><a href="#"><i class="icon-trash"></i> {{t admin.serviceGroups.removeOldVersions}}</a></li>
+ <li><a href="#"><i class="icon-book"></i> {{t common.documentation}}</a></li>
+</ul>
\ No newline at end of file
diff --git a/ambari-web/app/templates/main/admin/serviceGroups/serviceGroup.hbs b/ambari-web/app/templates/main/admin/serviceGroups/serviceGroup.hbs
new file mode 100644
index 0000000..66dcf6a
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/serviceGroups/serviceGroup.hbs
@@ -0,0 +1,19 @@
+{{!
+* 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.
+}}
+
+{{view App.DashRow}}
\ No newline at end of file
diff --git a/ambari-web/app/utils/date/date.js b/ambari-web/app/utils/date/date.js
index f3cb205..26abd75 100644
--- a/ambari-web/app/utils/date/date.js
+++ b/ambari-web/app/utils/date/date.js
@@ -48,18 +48,33 @@ module.exports = {
* Convert timestamp to date-string
* default format - 'DAY_OF_THE_WEEK, MONTH DAY, YEAR HOURS:MINUTES'
*
- * @param {number} timestamp
- * @param {bool} format
+ * @param {number or object} timestamp
+ * @param {string} format
* @return {*} date
* @method dateFormat
*/
dateFormat: function (timestamp, format) {
- if (!validator.isValidInt(timestamp)) {
- return timestamp;
+ let dateToFormat;
+
+ if (typeof timestamp === "number") {
+ //integer timestamp provided
+ if (validator.isValidInt(timestamp)) {
+ dateToFormat = new Date(timestamp);
+ } else {
+ return timestamp;
+ }
+ } else {
+ //Date object provided
+ if (typeof timestamp === "object" && timestamp instanceof Date) {
+ dateToFormat = timestamp;
+ } else {
+ return timestamp;
+ }
}
+
format = format || 'ddd, MMM DD, YYYY HH:mm';
- return moment((new Date(timestamp))).format(format);
+ return moment((dateToFormat)).format(format);
},
/**
diff --git a/ambari-web/app/utils/handlebars_helpers.js b/ambari-web/app/utils/handlebars_helpers.js
index 68e2283..48230c8 100644
--- a/ambari-web/app/utils/handlebars_helpers.js
+++ b/ambari-web/app/utils/handlebars_helpers.js
@@ -100,4 +100,15 @@ App.registerBoundHelper('statusIcon', App.StatusIconView);
* Return `span` with formatted service name
* @param {string} content - serviceName
*/
-App.registerBoundHelper('formatRole', App.FormatRoleView);
\ No newline at end of file
+App.registerBoundHelper('formatRole', App.FormatRoleView);
+
+/**
+ * Return formatted date string. Optionally pass a format pattern to control the output.
+ * Uses Moment.js; for supported format patterns, see https://momentjs.com/docs/#/displaying/format/
+ *
+ * Example:
+ * {{formatDate myDate format="dddd, MMMM Do YYYY, h:mm:ss a"}}
+ * Output:
+ * Sunday, February 14th 2010, 3:25:50 pm
+ */
+App.registerBoundHelper('formatDate', App.FormatDateView);
\ No newline at end of file
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index dfbc9c0..f89133b 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -20,6 +20,8 @@
// load all views here
require('views/application');
+require('views/common/dashrow_view');
+require('views/common/timeline_view');
require('views/common/breadcrumbs_view');
require('views/common/clock_view');
require('views/common/checkbox_view');
@@ -98,6 +100,7 @@ require('views/common/configs/widgets/label_config_widget_view');
require('views/common/configs/widgets/test_db_connection_widget_view');
require('views/common/configs/widgets/overrides/config_widget_override_view');
require('views/common/configs/service_config_layout_tab_view');
+require('views/common/dashrow_view');
require('views/common/configs/service_config_layout_tab_compare_view');
require('views/common/filter_combobox');
require('views/common/filter_combo_cleanable');
@@ -112,6 +115,7 @@ require('views/common/widget/gauge_widget_view');
require('views/common/widget/number_widget_view');
require('views/common/widget/heatmap_widget_view');
require('views/common/assign_master_components_view');
+require('views/common/helpers/format_date_view');
require('views/common/helpers/format_word_break_view');
require('views/common/helpers/format_null_view');
require('views/common/helpers/format_role_view');
@@ -221,6 +225,8 @@ require('views/main/admin/highAvailability/rangerAdmin/step2_view');
require('views/main/admin/highAvailability/rangerAdmin/step3_view');
require('views/main/admin/highAvailability/rangerAdmin/step4_view');
require('views/main/admin/serviceAccounts_view');
+require('views/main/admin/serviceGroups_view');
+require('views/main/admin/serviceGroups/serviceGroup_view');
require('views/main/admin/stack_upgrade/upgrade_wizard_view');
require('views/main/admin/stack_upgrade/upgrade_version_box_view');
require('views/main/admin/stack_upgrade/upgrade_version_column_view');
diff --git a/ambari-web/app/views/common/dashrow_view.js b/ambari-web/app/views/common/dashrow_view.js
new file mode 100644
index 0000000..1fb602d
--- /dev/null
+++ b/ambari-web/app/views/common/dashrow_view.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.
+ */
+
+var App = require('app');
+
+App.DashRow = Ember.View.extend({
+
+ templateName: require('templates/common/dashrow'),
+
+ hasMenu: Em.computed.or('menu', 'menuClass'),
+
+ encodeMenu: false,
+
+ menu: null,
+
+ //Define a property named menuClass which extends Ember.View to use an arbitrary Handlebars template as the menu.
+ //The template should contain a structure compatible with Bootstrap dropdowns, such as:
+ // <ul class="dropdown-menu dropdown-menu-right">
+ // <li><a href="#">...</a></li>
+ // <li><a href="#">...</a></li>
+ // <li><a href="#">...</a></li>
+ // </ul>
+
+ encodeHeader: false,
+
+ header: ' ',
+
+ //Define a property named headerClass which extends Ember.View to use an arbitrary Handlebars template as the header.
+
+ //set this to provide an id for the collapsible part
+ //so it can be targeted by the Bootstrap collapse plugin
+ collapseId: null,
+
+ collapseTarget: function () {
+ const collapseId = this.get('collapseId');
+
+ if (collapseId) {
+ return "#" + collapseId;
+ }
+
+ return collapseId;
+ }.property('collapseId'),
+
+ encodeBody: false,
+
+ body: ' ',
+
+ //Define a property named bodyClass which extends Ember.View to use an arbitrary Handlebars template as the body.
+
+ didInsertElement: function () {
+ this.$().find('.dropdown-toggle').dropdown();
+ this.$().find('.collapse').collapse({ toggle: false });
+ }
+});
diff --git a/ambari-web/app/views/common/helpers/format_date_view.js b/ambari-web/app/views/common/helpers/format_date_view.js
new file mode 100644
index 0000000..0eed168
--- /dev/null
+++ b/ambari-web/app/views/common/helpers/format_date_view.js
@@ -0,0 +1,28 @@
+/**
+ * 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 App = require('app');
+var dateUtils = require('utils/date/date');
+
+App.FormatDateView = Em.View.extend({
+ template: Em.Handlebars.compile('{{view.result}}'),
+ format: null,
+ result: function() {
+ return dateUtils.dateFormat(this.get('content'), this.get('format'));
+ }.property('content')
+});
\ No newline at end of file
diff --git a/ambari-web/app/views/common/timeline_view.js b/ambari-web/app/views/common/timeline_view.js
new file mode 100644
index 0000000..5e37778
--- /dev/null
+++ b/ambari-web/app/views/common/timeline_view.js
@@ -0,0 +1,63 @@
+/**
+ * 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 App = require('app');
+
+App.Timeline = Em.View.extend({
+ templateName: require('templates/common/timeline'),
+
+ //bound from template
+ events: [],
+
+ //custom sort function
+ sort: null,
+
+ //path to property to sort by
+ datePath: null,
+
+ //default sort function
+ byDate: function (datePath) {
+ //use datePath to find dates to compare if provided as a string
+ if (datePath && typeof datePath === "string") {
+ return (a, b) => {
+ let valueA = a, valueB = b;
+ const path = datePath.split(".");
+
+ for (let x = 0, length = path.length, prop = path[x]; x < length; x++, prop = path[x]) {
+ valueA = valueA[prop];
+ valueB = valueB[prop];
+ }
+
+ return valueA - valueB;
+ }
+ }
+
+ //otherwise, assume a first level property named "date"
+ return (a, b) => a.date - b.date;
+ },
+
+ sortFunction: function () {
+ return this.get('sort') || this.byDate(this.get('datePath'))
+ }.observes('sort', 'datePath'),
+
+ sortedEvents: function () {
+ const sortFunction = this.sortFunction();
+ const events = this.get('events');
+ return events.sort(sortFunction);
+ }.property('events')
+});
\ No newline at end of file
diff --git a/ambari-web/app/views/main/admin/serviceGroups/serviceGroup_view.js b/ambari-web/app/views/main/admin/serviceGroups/serviceGroup_view.js
new file mode 100644
index 0000000..5940392
--- /dev/null
+++ b/ambari-web/app/views/main/admin/serviceGroups/serviceGroup_view.js
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.ServiceGroupView = App.DashRow.extend({
+ //bound from template
+ serviceGroup: null,
+
+ collapseId: Em.computed.alias('serviceGroup.id'),
+
+ // menuClass: Em.View.extend({
+ // templateName: require('templates/main/admin/serviceGroups/menu')
+ // }),
+
+ headerClass: Em.View.extend({
+ templateName: require('templates/main/admin/serviceGroups/header'),
+ name: Em.computed.alias('parentView.serviceGroup.name'),
+ version: Em.computed.alias('parentView.serviceGroup.version'),
+ }),
+
+ bodyClass: Em.View.extend({
+ templateName: require('templates/main/admin/serviceGroups/body'),
+ installedServices: Em.computed.alias('parentView.serviceGroup.installedServices'),
+ otherServices: Em.computed.alias('parentView.serviceGroup.otherServices'),
+ history: Em.computed.alias('parentView.serviceGroup.history')
+ })
+});
+
diff --git a/ambari-web/app/views/main/admin/serviceGroups_view.js b/ambari-web/app/views/main/admin/serviceGroups_view.js
new file mode 100644
index 0000000..89ff8e6
--- /dev/null
+++ b/ambari-web/app/views/main/admin/serviceGroups_view.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.
+ */
+
+var App = require('app');
+
+App.MainAdminServiceGroupsView = App.DashRow.extend({
+ templateName: require('templates/main/admin/serviceGroups')
+});
\ No newline at end of file
diff --git a/ambari-web/app/views/main/menu.js b/ambari-web/app/views/main/menu.js
index 7efc543..c3ef62e 100644
--- a/ambari-web/app/views/main/menu.js
+++ b/ambari-web/app/views/main/menu.js
@@ -100,7 +100,15 @@ App.MainSideMenuView = Em.CollectionView.extend({
// create dropdown categories for each menu item
let {router} = App;
if (itemName === 'admin') {
- if(App.isAuthorized('CLUSTER.VIEW_STACK_DETAILS, CLUSTER.UPGRADE_DOWNGRADE_STACK') || upg) {
+ if (App.isAuthorized('CLUSTER.VIEW_STACK_DETAILS') || upg) {
+ categories.push({
+ name: 'adminServiceGroups',
+ url: 'serviceGroups',
+ label: Em.I18n.t('admin.serviceGroups.title'),
+ href: router.urlFor('main.admin.serviceGroups')
+ });
+ }
+ if (App.isAuthorized('CLUSTER.VIEW_STACK_DETAILS, CLUSTER.UPGRADE_DOWNGRADE_STACK') || upg) {
categories.push({
name: 'stackAndUpgrade',
url: 'stack',
diff --git a/ambari-web/test/utils/date/date_test.js b/ambari-web/test/utils/date/date_test.js
index 1168f3b..5613eaf 100644
--- a/ambari-web/test/utils/date/date_test.js
+++ b/ambari-web/test/utils/date/date_test.js
@@ -31,6 +31,31 @@ describe('date', function () {
{m: 'empty function', t: function(){}}
]);
+ describe('#dateFormat', function () {
+ it('Should format dates passed as timestamp integers', function () {
+ var input = 0;//.toUTCString();
+ var expected = "Wed, Dec 31, 1969 19:00";
+ var actual = date.dateFormat(input);
+
+ expect(actual).to.equal(expected);
+ });
+
+ it('Should format dates passed as Date objects', function () {
+ var input = new Date(1970, 0, 1);
+ var expected = "Thu, Jan 01, 1970 00:00";
+ var actual = date.dateFormat(input);
+
+ expect(actual).to.equal(expected);
+ });
+
+ it('Should pass through any other type of data', function () {
+ var expected = "Hello World";
+ var actual = date.dateFormat(expected);
+
+ expect(actual).to.equal(expected);
+ });
+ }),
+
describe('#dateFormatZeroFirst()', function() {
var tests = [
{
diff --git a/ambari-web/test/views/common/dashrow_view_test.js b/ambari-web/test/views/common/dashrow_view_test.js
new file mode 100644
index 0000000..6efaab3
--- /dev/null
+++ b/ambari-web/test/views/common/dashrow_view_test.js
@@ -0,0 +1,33 @@
+/**
+ * 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 App = require('app');
+require('views/common/dashrow_view');
+
+describe('App.DashRow', function() {
+ describe('#collapseTarget', function () {
+ it('Returns the expected collapseTarget', function () {
+ var view = App.DashRow.create();
+ var id = 'alpha';
+ expect(view.get('collapseTarget')).to.be.null;
+
+ view.set('collapseId', id);
+ expect(view.get('collapseTarget')).to.equal('#' + id);
+ });
+ });
+});
\ No newline at end of file
diff --git a/ambari-web/test/views/common/helpers/format_date_view_test.js b/ambari-web/test/views/common/helpers/format_date_view_test.js
new file mode 100644
index 0000000..8a15cc0
--- /dev/null
+++ b/ambari-web/test/views/common/helpers/format_date_view_test.js
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+var view;
+
+describe('App.FormatDateView', function () {
+
+ beforeEach(function () {
+ view = App.FormatDateView.create();
+ });
+
+ describe('#result', function () {
+ Em.A([
+ {content: new Date(2018, 1, 13), expected: "Tue, Feb 13, 2018 00:00"},
+ {content: new Date(2018, 1, 13), format: "D MMM YYYY", expected: "13 Feb 2018"}
+ ]).forEach(function (test) {
+ var message = 'content: {0}, format: {1}, expected: {2}'.format(JSON.stringify(test.content), JSON.stringify(test.format), JSON.stringify(test.expected));
+ it(message, function () {
+ view.set('content', test.content);
+ view.set('format', test.format);
+ expect(view.get('result')).to.be.equal(test.expected);
+ });
+ });
+
+ });
+
+});
\ No newline at end of file
diff --git a/ambari-web/test/views/common/timeline_view_test.js b/ambari-web/test/views/common/timeline_view_test.js
new file mode 100644
index 0000000..0f99acb
--- /dev/null
+++ b/ambari-web/test/views/common/timeline_view_test.js
@@ -0,0 +1,220 @@
+/**
+ * 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 App = require('app');
+require('views/common/timeline_view');
+
+describe('App.Timeline', function() {
+ describe('#sortedEvents', function () {
+ it('Sorts events by date', function () {
+ var view = App.Timeline.create();
+ view.set('events', [
+ {
+ date: new Date(2017, 4, 1)
+ },
+ {
+ date: new Date(2017, 1, 1)
+ },
+ {
+ date: new Date(2017, 5, 1)
+ },
+ {
+ date: new Date(2017, 3, 1)
+ },
+ {
+ date: new Date(2017, 2, 1)
+ }
+ ]);
+
+ var expected = [
+ {
+ date: new Date(2017, 1, 1)
+ },
+ {
+ date: new Date(2017, 2, 1)
+ },
+ {
+ date: new Date(2017, 3, 1)
+ },
+ {
+ date: new Date(2017, 4, 1)
+ },
+ {
+ date: new Date(2017, 5, 1)
+ }
+ ];
+
+ var sortedEvents = view.get('sortedEvents');
+ var actual = [
+ sortedEvents.objectAt(0),
+ sortedEvents.objectAt(1),
+ sortedEvents.objectAt(2),
+ sortedEvents.objectAt(3),
+ sortedEvents.objectAt(4),
+ ];
+
+ expect(actual).to.deep.equal(expected);
+ });
+
+ it('Sorts events using the provided datePath', function () {
+ var view = App.Timeline.create();
+ view.set('datePath', 'path.to.date');
+ view.set('events', [
+ {
+ path: {
+ to: {
+ date: new Date(2017, 4, 1)
+ }
+ }
+ },
+ {
+ path: {
+ to: {
+ date: new Date(2017, 1, 1)
+ }
+ }
+ },
+ {
+ path: {
+ to: {
+ date: new Date(2017, 5, 1)
+ }
+ }
+ },
+ {
+ path: {
+ to: {
+ date: new Date(2017, 3, 1)
+ }
+ }
+ },
+ {
+ path: {
+ to: {
+ date: new Date(2017, 2, 1)
+ }
+ }
+ }
+ ]);
+
+ var expected = [
+ {
+ path: {
+ to: {
+ date: new Date(2017, 1, 1)
+ }
+ }
+ },
+ {
+ path: {
+ to: {
+ date: new Date(2017, 2, 1)
+ }
+ }
+ },
+ {
+ path: {
+ to: {
+ date: new Date(2017, 3, 1)
+ }
+ }
+ },
+ {
+ path: {
+ to: {
+ date: new Date(2017, 4, 1)
+ }
+ }
+ },
+ {
+ path: {
+ to: {
+ date: new Date(2017, 5, 1)
+ }
+ }
+ }
+ ];
+
+ var sortedEvents = view.get('sortedEvents');
+ var actual = [
+ sortedEvents.objectAt(0),
+ sortedEvents.objectAt(1),
+ sortedEvents.objectAt(2),
+ sortedEvents.objectAt(3),
+ sortedEvents.objectAt(4),
+ ];
+
+ expect(actual).to.deep.equal(expected);
+ });
+
+ it('Sorts events using the provided function', function () {
+ var view = App.Timeline.create();
+ var sort = function (a, b) {
+ return a.id - b.id;
+ };
+
+ view.set('sort', sort);
+ view.set('events', [
+ {
+ id: 3
+ },
+ {
+ id: 2
+ },
+ {
+ id: 5
+ },
+ {
+ id: 1
+ },
+ {
+ id: 4
+ }
+ ]);
+
+ var expected = [
+ {
+ id: 1
+ },
+ {
+ id: 2
+ },
+ {
+ id: 3
+ },
+ {
+ id: 4
+ },
+ {
+ id: 5
+ }
+ ];
+
+ var sortedEvents = view.get('sortedEvents');
+ var actual = [
+ sortedEvents.objectAt(0),
+ sortedEvents.objectAt(1),
+ sortedEvents.objectAt(2),
+ sortedEvents.objectAt(3),
+ sortedEvents.objectAt(4),
+ ];
+
+ expect(actual).to.deep.equal(expected);
+ });
+ });
+});
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
ishanbha@apache.org.