(response, elId, parentId, type)
| 380 | |
| 381 | // Build a table of per-worker resources and components (when permitted) |
| 382 | var makeWorkerStatsTable = function (response, elId, parentId, type) { |
| 383 | var showCpu = response.schedulerDisplayResource; |
| 384 | |
| 385 | var columns = [ |
| 386 | { |
| 387 | data: 'host', |
| 388 | render: function (data, type, row){ |
| 389 | return type === 'display' ? |
| 390 | ('<a href="/supervisor.html?host=' + data + '">' + data + '</a>') : |
| 391 | data; |
| 392 | } |
| 393 | }, |
| 394 | { |
| 395 | data: 'port', |
| 396 | render: function (data, type, row) { |
| 397 | var logLink = row.workerLogLink; |
| 398 | return type === 'display' ? |
| 399 | ('<a href="' + logLink + '">' + data + '</a>'): |
| 400 | data; |
| 401 | } |
| 402 | }, |
| 403 | { |
| 404 | data: function (row, type){ |
| 405 | // if we are showing or filtering, using the formatted |
| 406 | // uptime, else use the seconds (for sorting) |
| 407 | return (type === 'display' || type === 'filter') ? |
| 408 | row.uptime : |
| 409 | row.uptimeSeconds; |
| 410 | } |
| 411 | }, |
| 412 | { data: 'executorsTotal' }, |
| 413 | { |
| 414 | data: function (row){ |
| 415 | return row.assignedMemOnHeap + row.assignedMemOffHeap; |
| 416 | } |
| 417 | }, |
| 418 | ]; |
| 419 | |
| 420 | if (showCpu) { |
| 421 | columns.push ({ data: 'assignedCpu' }); |
| 422 | } |
| 423 | |
| 424 | columns.push ({ |
| 425 | data: function (row, type, obj, dt) { |
| 426 | var components = Object.keys(row.componentNumTasks || {}); |
| 427 | if (components.length === 0){ |
| 428 | // if no components returned, it means the worker |
| 429 | // topology isn't one the user is authorized to see |
| 430 | return "N/A"; |
| 431 | } |
| 432 | |
| 433 | if (type == 'filter') { |
| 434 | return components; |
| 435 | } |
| 436 | |
| 437 | if (type == 'display') { |
| 438 | // show a button to toggle the component row |
| 439 | return '<button class="btn btn-sm btn-info details-control" type="button">' + |
no test coverage detected