|
388 | 388 | } |
389 | 389 |
|
390 | 390 | Table.prototype.build = function (rows, meta, onBuildRow, info) { |
391 | | - // console.warn('Table.build', meta, classname) |
| 391 | + // console.warn('Table.build', JSON.parse(JSON.stringify(meta))) |
392 | 392 | var metaDefault = { |
393 | 393 | attribs: { |
394 | 394 | class: [ |
|
427 | 427 | var length; |
428 | 428 | var i2; |
429 | 429 | var length2; |
430 | | - var parsed; |
431 | 430 | var rowKeys = rows.__debug_key_order__ || Object.keys(rows); |
432 | 431 | var rowKey; |
433 | | - var key; |
434 | 432 | var row; |
435 | 433 | var rowInfo; |
436 | 434 | var $tbody = $table.find('> tbody'); |
|
459 | 457 | if (typeof rowKey === 'string' && rowKey.match(/^\d+$/) && Number.isSafeInteger(rowKey)) { |
460 | 458 | rowKey = parseInt(rowKey, 10); |
461 | 459 | } |
462 | | - parsed = this.dump.parseTag(this.dump.dump(rowKey, { |
463 | | - requestInfo: info, |
464 | | - })); |
465 | | - $tr = $$1('<tr></tr>', rowInfo.attribs || {}) |
466 | | - .append( |
467 | | - $$1('<th scope="row" class="t_key text-right"></th>') |
468 | | - .addClass(/^\d+$/.test(rowKey) ? 't_int' : parsed.attribs.class.join(' ')) |
469 | | - .html(parsed.innerhtml) |
470 | | - ); |
471 | | - |
472 | | - if (tableInfo.haveObjRow) { |
473 | | - $tr.append( |
474 | | - rowInfo.class |
475 | | - ? $$1(this.dump.markupIdentifier(rowInfo.class, 'classname', 'td')) |
476 | | - .attr('title', rowInfo.summary) |
477 | | - : '<td class="t_undefined"></td>' |
478 | | - ); |
479 | | - } |
480 | | - for (i2 = 0, length2 = tableInfo.columns.length; i2 < length2; i2++) { |
481 | | - key = tableInfo.columns[i2].key; |
482 | | - /* |
483 | | - parsed = this.dump.parseTag(this.dump.dump(row[key], true)) |
484 | | - parsed.attribs.class = parsed.attribs.class.join(' ') |
485 | | - $tr.append( |
486 | | - $('<td />').html(parsed.innerhtml).attr(parsed.attribs) |
487 | | - ) |
488 | | - */ |
489 | | - $tr.append(this.dump.dump(row[key], { |
490 | | - requestInfo: info, |
491 | | - tagName: 'td' |
492 | | - })); |
493 | | - } |
494 | 460 |
|
| 461 | + $tr = this.buildRow(row, rowInfo, rowKey, tableInfo); |
495 | 462 | for (i2 = 0, length2 = onBuildRow.length; i2 < length2; i2++) { |
496 | 463 | $tr = onBuildRow[i2]($tr, row, rowInfo, rowKey); |
497 | 464 | } |
498 | 465 | $tbody.append($tr); |
499 | 466 | } |
500 | 467 | }; |
501 | 468 |
|
| 469 | + Table.prototype.buildRow = function (row, rowInfo, rowKey, tableInfo) { |
| 470 | + var i; |
| 471 | + var length; |
| 472 | + var colInfo; |
| 473 | + var key; |
| 474 | + var parsed = this.dump.parseTag(this.dump.dump(rowKey, { |
| 475 | + requestInfo: rowInfo.requestInfo, |
| 476 | + })); |
| 477 | + var td; |
| 478 | + var $tr = $$1('<tr></tr>', rowInfo.attribs || {}) |
| 479 | + .append( |
| 480 | + $$1('<th scope="row" class="t_key text-right"></th>') |
| 481 | + .addClass(/^\d+$/.test(rowKey) ? 't_int' : parsed.attribs.class.join(' ')) |
| 482 | + .html(parsed.innerhtml) |
| 483 | + ); |
| 484 | + |
| 485 | + if (tableInfo.haveObjRow) { |
| 486 | + $tr.append( |
| 487 | + rowInfo.class |
| 488 | + ? $$1(this.dump.markupIdentifier(rowInfo.class, 'classname', 'td')) |
| 489 | + .attr('title', rowInfo.summary) |
| 490 | + : '<td class="t_undefined"></td>' |
| 491 | + ); |
| 492 | + } |
| 493 | + for (i = 0, length = tableInfo.columns.length; i < length; i++) { |
| 494 | + colInfo = tableInfo.columns[i]; |
| 495 | + key = colInfo.key; |
| 496 | + td = this.dump.dump(row[key], { |
| 497 | + attribs: colInfo.attribs || {}, |
| 498 | + requestInfo: rowInfo.requestInfo, |
| 499 | + tagName: 'td', |
| 500 | + }); |
| 501 | + if (row[key] === true && colInfo.trueAs !== null) { |
| 502 | + td = td.replace('>true<', '>' + colInfo.trueAs + '<'); |
| 503 | + } else if (row[key] === false && colInfo.falseAs !== null) { |
| 504 | + td = td.replace('>false<', '>' + colInfo.falseAs + '<'); |
| 505 | + } |
| 506 | + $tr.append(td); |
| 507 | + } |
| 508 | + return $tr |
| 509 | + }; |
| 510 | + |
502 | 511 | /* |
503 | 512 | Add totals (tfoot) |
504 | 513 | */ |
|
514 | 523 | colHasTotal = typeof info.total !== 'undefined'; |
515 | 524 | haveTotal = haveTotal || colHasTotal; |
516 | 525 | if (colHasTotal) { |
517 | | - info.total = parseFloat(info.total.toFixed(6), 10); |
518 | | - cells.push(this.dump.dump(info.total, { tagName: 'td' })); |
| 526 | + if (!isNaN(parseFloat(info.total)) && isFinite(info.total)) { |
| 527 | + // isNumeric |
| 528 | + info.total = parseFloat(info.total.toFixed(6), 10); |
| 529 | + } |
| 530 | + cells.push(this.dump.dump(info.total, { |
| 531 | + attribs: info.attribs, |
| 532 | + tagName: 'td', |
| 533 | + })); |
519 | 534 | continue |
520 | 535 | } |
521 | 536 | cells.push('<td></td>'); |
|
4372 | 4387 | var tagEntries; |
4373 | 4388 | for (tagName in abs.phpDoc) { |
4374 | 4389 | tagEntries = abs.phpDoc[tagName]; |
| 4390 | + if (tagName === 'package') { |
| 4391 | + tagEntries.tagName = tagName; |
| 4392 | + html += this.dumpTag(tagEntries); |
| 4393 | + continue |
| 4394 | + } |
4375 | 4395 | if (!Array.isArray(tagEntries)) { |
4376 | 4396 | continue |
4377 | 4397 | } |
|
4721 | 4741 | var strClassName = ''; |
4722 | 4742 | var dumpOpts = this.dumper.getDumpOpts(); |
4723 | 4743 | try { |
4724 | | - if (this.dumper.getRequestInfo().$container.data('meta') === undefined) { |
4725 | | - console.warn('meta is undefined!!!', { |
4726 | | - requestInfo: this.dumper.getRequestInfo(), |
4727 | | - data: this.dumper.getRequestInfo().$container.data(), |
4728 | | - }); |
4729 | | - } |
4730 | 4744 | abs.debugVersion = this.dumper.getRequestInfo().$container.data('meta').debugVersion; |
4731 | 4745 | if (typeof abs.cfgFlags === 'undefined') { |
4732 | 4746 | abs.cfgFlags = 0x1FFFFFF & ~this.BRIEF; |
|
5269 | 5283 | function tabValuesFinish (vals, abs, dumper) { |
5270 | 5284 | switch (abs.typeMore) { |
5271 | 5285 | case 'base64': |
5272 | | - // vals.labelDecoded = 'decoded' |
5273 | 5286 | vals.labelRaw = 'base64'; |
5274 | 5287 | if (abs.strlen) { |
5275 | 5288 | vals.valRaw += '<span class="maxlen">… ' + (abs.strlen - abs.value.length) + ' more bytes (not logged)</span>'; |
5276 | 5289 | } |
5277 | 5290 | break |
| 5291 | + case 'form': |
| 5292 | + vals.labelRaw = 'form'; |
| 5293 | + break |
5278 | 5294 | case 'json': |
5279 | | - // vals.labelDecoded = 'decoded' |
5280 | 5295 | vals.labelRaw = 'json'; |
5281 | 5296 | if (abs.prettified || abs.strlen) { |
5282 | 5297 | abs.typeMore = null; // unset typeMore to prevent loop |
|
5859 | 5874 | }; |
5860 | 5875 |
|
5861 | 5876 | DumpString.prototype.isEncoded = function (val) { |
5862 | | - return ['base64', 'json', 'serialized'].indexOf(val.typeMore) > -1 |
| 5877 | + return ['base64', 'form', 'json', 'serialized'].indexOf(val.typeMore) > -1 |
5863 | 5878 | }; |
5864 | 5879 |
|
5865 | 5880 | /** |
|
5954 | 5969 | type: null, |
5955 | 5970 | typeMore: null, |
5956 | 5971 | visualWhiteSpace: true |
5957 | | - }, opts || {}); |
| 5972 | + }, JSON.parse(JSON.stringify(opts || {}))); |
5958 | 5973 | var tagName; |
5959 | 5974 | var type; // = this.getType(val) |
5960 | 5975 | var method; // = 'dump' + type[0].ucfirst() |
|
5963 | 5978 | dumpOpts.type = type[0]; |
5964 | 5979 | dumpOpts.typeMore = type[1]; |
5965 | 5980 | } |
5966 | | - if (typeof dumpOpts.attribs.class === 'string') { |
| 5981 | + if (typeof dumpOpts.attribs.class === 'undefined') { |
| 5982 | + dumpOpts.attribs.class = []; |
| 5983 | + } else if (typeof dumpOpts.attribs.class === 'string') { |
5967 | 5984 | dumpOpts.attribs.class = [dumpOpts.attribs.class]; |
5968 | 5985 | } |
5969 | 5986 | dumpOptStack.push(dumpOpts); |
|
6481 | 6498 | $container.find('.card-header .fa-spinner').remove(); |
6482 | 6499 | $container.find('.debug > .fa-spinner').remove(); |
6483 | 6500 | if (responseCode && responseCode + '' !== '200') { |
6484 | | - $container.find('.card-title').append(' <span class="label label-default" title="Response Code">' + responseCode + '</span>'); |
| 6501 | + $container.find('.card-title .response-code').remove(); |
| 6502 | + $container.find('.card-title').append(' <span class="label label-default response-code" title="Response Code">' + responseCode + '</span>'); |
6485 | 6503 | if (responseCode.toString().match(/^5/)) { |
6486 | 6504 | $container.addClass('bg-danger'); |
6487 | 6505 | } |
|
6929 | 6947 | } |
6930 | 6948 |
|
6931 | 6949 | function markupFilePath(filePath, commonPrefix, docRoot) { |
6932 | | - var fileParts = parseFilePath(filePath, commonPrefix, docRoot); |
| 6950 | + var fileParts = parseFilePath(filePath || '', commonPrefix, docRoot); |
6933 | 6951 | return (fileParts.docRoot ? '<span class="file-docroot">DOCUMENT_ROOT</span>' : '') |
6934 | 6952 | + (fileParts.relPathCommon ? '<span class="file-basepath">' + dump.dump(fileParts.relPathCommon, {tagName:null}) + '</span>' : '') |
6935 | 6953 | + (fileParts.relPath ? '<span class="file-relpath">' + dump.dump(fileParts.relPath, {tagName:null}) + '</span>' : '') |
6936 | 6954 | + '<span class="file-basename">' + dump.dump(fileParts.baseName, {tagName:null}) + '</span>' |
6937 | 6955 | } |
6938 | 6956 |
|
6939 | 6957 | function parseFilePath (filePath, commonPrefix, docRoot) { |
6940 | | - var baseName = filePath.match(/[^\/]+$/)[0]; |
| 6958 | + var baseName = (filePath.match(/[^\/]+$/) || [''])[0]; |
6941 | 6959 | var containsDocRoot = filePath.indexOf(docRoot) === 0; |
6942 | 6960 | var basePath = ''; |
6943 | 6961 | var relPath = filePath.slice(0, 0 - baseName.length); |
|
0 commit comments