components.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. import Ember from 'ember';
  19. import ColumnDef from 'em-table/utils/column-definition';
  20. import TableDefinition from 'em-table/utils/table-definition';
  21. export default Ember.Controller.extend({
  22. queryParams: ["service"],
  23. service: undefined,
  24. tableDefinition: TableDefinition.create({
  25. searchType: 'manual',
  26. }),
  27. tableColumns: Ember.computed('model.appId', 'model.serviceName', function() {
  28. var cols = [];
  29. var service = this.get('model.serviceName');
  30. var appId = this.get('model.appId');
  31. cols.push({
  32. id: 'name',
  33. headerTitle: 'Component',
  34. contentPath: 'name',
  35. cellComponentName: 'em-table-linked-cell',
  36. getCellContent: function(row) {
  37. return {
  38. displayText: row.get('name'),
  39. href: `#/yarn-component-instances/${row.get('name')}/info?service=${service}&&appid=${appId}`
  40. };
  41. }
  42. }, {
  43. id: 'vcores',
  44. headerTitle: 'VCores',
  45. contentPath: 'vcores'
  46. }, {
  47. id: 'memory',
  48. headerTitle: 'Memory (MB)',
  49. contentPath: 'memory'
  50. }, {
  51. id: 'instances',
  52. headerTitle: 'Number of Instances',
  53. contentPath: 'instances',
  54. observePath: true
  55. });
  56. return ColumnDef.make(cols);
  57. })
  58. });