app-table-columns.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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 row.get('formattedStartTime');
  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. getCellContent: function(row) {
  101. return row.get('formattedFinishedTime');
  102. }
  103. }, {
  104. id: 'priority',
  105. headerTitle: 'Priority',
  106. contentPath: 'priority',
  107. }, {
  108. id: 'cluster',
  109. headerTitle: '%Cluster',
  110. contentPath: 'clusterUsagePercentage',
  111. observePath: true
  112. });
  113. return ColumnDef.make(colums);
  114. }.property(),
  115. serviceColumns: function() {
  116. var colums = [];
  117. colums.push({
  118. id: 'appName',
  119. headerTitle: 'Service Name',
  120. contentPath: 'appName',
  121. minWidth: "200px",
  122. facetType: null,
  123. cellComponentName: 'em-table-linked-cell',
  124. getCellContent: function(row) {
  125. return {
  126. displayText: row.get('appName'),
  127. href: `#/yarn-app/${row.id}/components?service=${row.get('appName')}`
  128. };
  129. }
  130. }, {
  131. id: 'appId',
  132. headerTitle: 'Application ID',
  133. contentPath: 'id',
  134. facetType: null,
  135. cellComponentName: 'em-table-tooltip-text',
  136. minWidth: "250px"
  137. }, {
  138. id: 'state',
  139. headerTitle: 'State',
  140. contentPath: 'state',
  141. cellComponentName: 'em-table-simple-status-cell',
  142. minWidth: "50px"
  143. }, {
  144. id: 'cluster',
  145. headerTitle: '%Cluster',
  146. contentPath: 'clusterUsagePercentage',
  147. facetType: null,
  148. observePath: true
  149. }, {
  150. id: 'elTime',
  151. headerTitle: 'Elapsed Time',
  152. contentPath: 'elapsedTime',
  153. facetType: null,
  154. cellDefinition: {
  155. type: "duration"
  156. },
  157. minWidth: "200px"
  158. }, {
  159. id: 'appUsr',
  160. headerTitle: 'User',
  161. contentPath: 'user',
  162. facetType: null,
  163. minWidth: "50px"
  164. }, {
  165. id: 'queue',
  166. headerTitle: 'Queue',
  167. contentPath: 'queue',
  168. cellComponentName: 'em-table-tooltip-text',
  169. }, {
  170. id: 'stTime',
  171. headerTitle: 'Started Time',
  172. contentPath: 'startTime',
  173. facetType: null,
  174. getCellContent: function(row) {
  175. return row.get('formattedStartTime');
  176. }
  177. }, {
  178. id: 'finishTime',
  179. headerTitle: 'Finished Time',
  180. contentPath: 'validatedFinishedTs',
  181. facetType: null,
  182. observePath: true,
  183. getCellContent: function(row) {
  184. return row.get('formattedFinishedTime');
  185. }
  186. });
  187. return ColumnDef.make(colums);
  188. }.property(),
  189. });