admin.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. App.MainAdminView = Em.View.extend({
  20. templateName: require('templates/main/admin'),
  21. selectedBinding: 'controller.category',
  22. categories: function() {
  23. var items = [];
  24. if(App.isAuthorized('CLUSTER.VIEW_STACK_DETAILS, CLUSTER.UPGRADE_DOWNGRADE_STACK') || (App.get('upgradeInProgress') || App.get('upgradeHolding'))) {
  25. items.push({
  26. name: 'stackAndUpgrade',
  27. url: 'stackAndUpgrade.index',
  28. label: Em.I18n.t('admin.stackUpgrade.title')
  29. });
  30. }
  31. if(App.isAuthorized('AMBARI.SET_SERVICE_USERS_GROUPS') || (App.get('upgradeInProgress') || App.get('upgradeHolding'))) {
  32. items.push({
  33. name: 'adminServiceAccounts',
  34. url: 'adminServiceAccounts',
  35. label: Em.I18n.t('common.serviceAccounts')
  36. });
  37. }
  38. if (!App.get('isHadoopWindowsStack') && App.isAuthorized('CLUSTER.TOGGLE_KERBEROS') || (App.get('upgradeInProgress') || App.get('upgradeHolding')) ) {
  39. items.push({
  40. name: 'kerberos',
  41. url: 'adminKerberos.index',
  42. label: Em.I18n.t('common.kerberos')
  43. });
  44. }
  45. if (App.isAuthorized('SERVICE.START_STOP, CLUSTER.MODIFY_CONFIGS') || (App.get('upgradeInProgress') || App.get('upgradeHolding'))) {
  46. if (App.supports.serviceAutoStart) {
  47. items.push({
  48. name: 'serviceAutoStart',
  49. url: 'adminServiceAutoStart',
  50. label: Em.I18n.t('admin.serviceAutoStart.title')
  51. });
  52. }
  53. }
  54. return items;
  55. }.property(''),
  56. NavItemView: Ember.View.extend({
  57. tagName: 'li',
  58. classNameBindings: 'isActive:active'.w(),
  59. isActive: Em.computed.equalProperties('item', 'parentView.selected')
  60. }),
  61. willDestroyElement: function () {
  62. //reset selected category in Admin sub-menu after leaving admin section
  63. this.set('controller.category', null);
  64. }
  65. });