1
0

app-table-columns.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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 TableDef from 'em-table/utils/table-definition';
  21. import Converter from 'yarn-ui/utils/converter';
  22. export default Ember.Controller.extend({
  23. tableDefinition: TableDef.create({
  24. sortColumnId: 'stTime',
  25. sortOrder: 'desc'
  26. }),
  27. columns: function() {
  28. var colums = [];
  29. colums.push({
  30. id: 'appId',
  31. headerTitle: 'Application ID',
  32. contentPath: 'id',
  33. cellComponentName: 'em-table-linked-cell',
  34. minWidth: "280px",
  35. facetType: null,
  36. getCellContent: function(row) {
  37. return {
  38. displayText: row.id,
  39. href: `#/yarn-app/${row.id}/attempts`
  40. };
  41. }
  42. }, {
  43. id: 'appType',
  44. headerTitle: 'Application Type',
  45. contentPath: 'applicationType',
  46. facetType: null,
  47. }, {
  48. id: 'appName',
  49. headerTitle: 'Application Name',
  50. cellComponentName: 'em-table-tooltip-text',
  51. contentPath: 'appName',
  52. facetType: null,
  53. }, {
  54. id: 'appUsr',
  55. headerTitle: 'User',
  56. contentPath: 'user',
  57. minWidth: "50px"
  58. }, {
  59. id: 'state',
  60. headerTitle: 'State',
  61. contentPath: 'state',
  62. cellComponentName: 'em-table-simple-status-cell',
  63. minWidth: "50px"
  64. }, {
  65. id: 'queue',
  66. headerTitle: 'Queue',
  67. cellComponentName: 'em-table-tooltip-text',
  68. contentPath: 'queue',
  69. }, {
  70. id: 'progress',
  71. headerTitle: 'Progress',
  72. contentPath: 'progress',
  73. cellComponentName: 'em-table-progress-cell',
  74. facetType: null,
  75. cellDefinition: {
  76. valueMax: 100
  77. }
  78. }, {
  79. id: 'stTime',
  80. headerTitle: 'Start Time',
  81. contentPath: 'startTime',
  82. facetType: null,
  83. getCellContent: function(row) {
  84. return Converter.timeStampToDate(row.get('startTime'));
  85. }
  86. }, {
  87. id: 'elTime',
  88. headerTitle: 'Elapsed Time',
  89. contentPath: 'elapsedTime',
  90. facetType: null,
  91. cellDefinition: {
  92. type: "duration"
  93. }
  94. }, {
  95. id: 'finishTime',
  96. headerTitle: 'Finished Time',
  97. contentPath: 'validatedFinishedTs',
  98. facetType: null,
  99. observePath: true
  100. }, {
  101. id: 'priority',
  102. headerTitle: 'Priority',
  103. contentPath: 'priority',
  104. }, {
  105. id: 'cluster',
  106. headerTitle: '%Cluster',
  107. contentPath: 'clusterUsagePercentage',
  108. observePath: true
  109. });
  110. return ColumnDef.make(colums);
  111. }.property(),
  112. serviceColumns: function() {
  113. var colums = [];
  114. colums.push({
  115. id: 'appName',
  116. headerTitle: 'Service Name',
  117. contentPath: 'appName',
  118. minWidth: "200px",
  119. facetType: null,
  120. cellComponentName: 'em-table-linked-cell',
  121. getCellContent: function(row) {
  122. return {
  123. displayText: row.get('appName'),
  124. href: `#/yarn-app/${row.id}/components?service=${row.get('appName')}`
  125. };
  126. }
  127. }, {
  128. id: 'appId',
  129. headerTitle: 'Application ID',
  130. contentPath: 'id',
  131. facetType: null,
  132. cellComponentName: 'em-table-tooltip-text',
  133. minWidth: "250px"
  134. }, {
  135. id: 'state',
  136. headerTitle: 'State',
  137. contentPath: 'state',
  138. cellComponentName: 'em-table-simple-status-cell',
  139. minWidth: "50px"
  140. }, {
  141. id: 'cluster',
  142. headerTitle: '%Cluster',
  143. contentPath: 'clusterUsagePercentage',
  144. facetType: null,
  145. observePath: true
  146. }, {
  147. id: 'elTime',
  148. headerTitle: 'Elapsed Time',
  149. contentPath: 'elapsedTime',
  150. facetType: null,
  151. cellDefinition: {
  152. type: "duration"
  153. },
  154. minWidth: "200px"
  155. }, {
  156. id: 'appUsr',
  157. headerTitle: 'User',
  158. contentPath: 'user',
  159. facetType: null,
  160. minWidth: "50px"
  161. }, {
  162. id: 'queue',
  163. headerTitle: 'Queue',
  164. contentPath: 'queue',
  165. cellComponentName: 'em-table-tooltip-text',
  166. }, {
  167. id: 'stTime',
  168. headerTitle: 'Started Time',
  169. contentPath: 'startTime',
  170. facetType: null,
  171. getCellContent: function(row) {
  172. return Converter.timeStampToDate(row.get('startTime'));
  173. }
  174. }, {
  175. id: 'finishTime',
  176. headerTitle: 'Finished Time',
  177. contentPath: 'validatedFinishedTs',
  178. facetType: null,
  179. observePath: true
  180. });
  181. return ColumnDef.make(colums);
  182. }.property(),
  183. });