@looker/run-it 0.9.52 → 0.9.53

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/lib/RunIt.js.map +1 -1
  3. package/lib/RunItProvider.js.map +1 -1
  4. package/lib/components/Collapser/CollapserCard.js.map +1 -1
  5. package/lib/components/ConfigForm/ConfigForm.js.map +1 -1
  6. package/lib/components/ConfigForm/utils.js.map +1 -1
  7. package/lib/components/CopyLinkWrapper/CopyLinkWrapper.js.map +1 -1
  8. package/lib/components/DataGrid/DataGrid.js.map +1 -1
  9. package/lib/components/DataGrid/gridUtils.js.map +1 -1
  10. package/lib/components/DocSdkCalls/DocMultiCall.js.map +1 -1
  11. package/lib/components/DocSdkCalls/DocSdkCalls.js.map +1 -1
  12. package/lib/components/Loading/Loading.js.map +1 -1
  13. package/lib/components/LoginForm/LoginForm.js.map +1 -1
  14. package/lib/components/MethodBadge/MethodBadge.js.map +1 -1
  15. package/lib/components/PerfTracker/PerfChart.js.map +1 -1
  16. package/lib/components/PerfTracker/PerfTable.js.map +1 -1
  17. package/lib/components/PerfTracker/PerfTracker.js.map +1 -1
  18. package/lib/components/PerfTracker/perfTableUtils.js.map +1 -1
  19. package/lib/components/PerfTracker/perfUtils.js.map +1 -1
  20. package/lib/components/RequestForm/FormItem.js.map +1 -1
  21. package/lib/components/RequestForm/RequestForm.js.map +1 -1
  22. package/lib/components/RequestForm/formUtils.js.map +1 -1
  23. package/lib/components/ResponseExplorer/ResponseExplorer.js.map +1 -1
  24. package/lib/components/ShowResponse/ShowResponse.js.map +1 -1
  25. package/lib/components/ShowResponse/responseUtils.js.map +1 -1
  26. package/lib/components/common/common.js.map +1 -1
  27. package/lib/esm/RunIt.js +48 -57
  28. package/lib/esm/RunIt.js.map +1 -1
  29. package/lib/esm/RunItProvider.js +4 -14
  30. package/lib/esm/RunItProvider.js.map +1 -1
  31. package/lib/esm/components/Collapser/CollapserCard.js +14 -22
  32. package/lib/esm/components/Collapser/CollapserCard.js.map +1 -1
  33. package/lib/esm/components/Collapser/index.js +1 -12
  34. package/lib/esm/components/Collapser/index.js.map +1 -1
  35. package/lib/esm/components/ConfigForm/ConfigForm.js +49 -58
  36. package/lib/esm/components/ConfigForm/ConfigForm.js.map +1 -1
  37. package/lib/esm/components/ConfigForm/index.js +2 -27
  38. package/lib/esm/components/ConfigForm/index.js.map +1 -1
  39. package/lib/esm/components/ConfigForm/utils.js +9 -21
  40. package/lib/esm/components/ConfigForm/utils.js.map +1 -1
  41. package/lib/esm/components/CopyLinkWrapper/CopyLinkWrapper.js +13 -22
  42. package/lib/esm/components/CopyLinkWrapper/CopyLinkWrapper.js.map +1 -1
  43. package/lib/esm/components/CopyLinkWrapper/index.js +1 -12
  44. package/lib/esm/components/CopyLinkWrapper/index.js.map +1 -1
  45. package/lib/esm/components/DataGrid/DataGrid.js +16 -25
  46. package/lib/esm/components/DataGrid/DataGrid.js.map +1 -1
  47. package/lib/esm/components/DataGrid/gridUtils.js +13 -26
  48. package/lib/esm/components/DataGrid/gridUtils.js.map +1 -1
  49. package/lib/esm/components/DataGrid/index.js +2 -25
  50. package/lib/esm/components/DataGrid/index.js.map +1 -1
  51. package/lib/esm/components/DocSdkCalls/DocMultiCall.js +7 -15
  52. package/lib/esm/components/DocSdkCalls/DocMultiCall.js.map +1 -1
  53. package/lib/esm/components/DocSdkCalls/DocSdkCalls.js +17 -26
  54. package/lib/esm/components/DocSdkCalls/DocSdkCalls.js.map +1 -1
  55. package/lib/esm/components/DocSdkCalls/callUtils.js +3 -10
  56. package/lib/esm/components/DocSdkCalls/callUtils.js.map +1 -1
  57. package/lib/esm/components/DocSdkCalls/index.js +2 -19
  58. package/lib/esm/components/DocSdkCalls/index.js.map +1 -1
  59. package/lib/esm/components/Loading/Loading.js +6 -14
  60. package/lib/esm/components/Loading/Loading.js.map +1 -1
  61. package/lib/esm/components/Loading/index.js +1 -12
  62. package/lib/esm/components/Loading/index.js.map +1 -1
  63. package/lib/esm/components/LoginForm/LoginForm.js +11 -21
  64. package/lib/esm/components/LoginForm/LoginForm.js.map +1 -1
  65. package/lib/esm/components/LoginForm/index.js +1 -18
  66. package/lib/esm/components/LoginForm/index.js.map +1 -1
  67. package/lib/esm/components/MethodBadge/MethodBadge.js +8 -19
  68. package/lib/esm/components/MethodBadge/MethodBadge.js.map +1 -1
  69. package/lib/esm/components/MethodBadge/index.js +1 -12
  70. package/lib/esm/components/MethodBadge/index.js.map +1 -1
  71. package/lib/esm/components/PerfTracker/PerfChart.js +11 -19
  72. package/lib/esm/components/PerfTracker/PerfChart.js.map +1 -1
  73. package/lib/esm/components/PerfTracker/PerfTable.js +13 -22
  74. package/lib/esm/components/PerfTracker/PerfTable.js.map +1 -1
  75. package/lib/esm/components/PerfTracker/PerfTracker.js +25 -34
  76. package/lib/esm/components/PerfTracker/PerfTracker.js.map +1 -1
  77. package/lib/esm/components/PerfTracker/index.js +2 -19
  78. package/lib/esm/components/PerfTracker/index.js.map +1 -1
  79. package/lib/esm/components/PerfTracker/perfTableUtils.js +17 -27
  80. package/lib/esm/components/PerfTracker/perfTableUtils.js.map +1 -1
  81. package/lib/esm/components/PerfTracker/perfUtils.js +3 -12
  82. package/lib/esm/components/PerfTracker/perfUtils.js.map +1 -1
  83. package/lib/esm/components/RequestForm/FormItem.js +6 -14
  84. package/lib/esm/components/RequestForm/FormItem.js.map +1 -1
  85. package/lib/esm/components/RequestForm/RequestForm.js +24 -32
  86. package/lib/esm/components/RequestForm/RequestForm.js.map +1 -1
  87. package/lib/esm/components/RequestForm/formUtils.js +26 -41
  88. package/lib/esm/components/RequestForm/formUtils.js.map +1 -1
  89. package/lib/esm/components/RequestForm/index.js +2 -19
  90. package/lib/esm/components/RequestForm/index.js.map +1 -1
  91. package/lib/esm/components/ResponseExplorer/ResponseExplorer.js +30 -41
  92. package/lib/esm/components/ResponseExplorer/ResponseExplorer.js.map +1 -1
  93. package/lib/esm/components/ResponseExplorer/index.js +1 -16
  94. package/lib/esm/components/ResponseExplorer/index.js.map +1 -1
  95. package/lib/esm/components/ShowResponse/ShowResponse.js +6 -14
  96. package/lib/esm/components/ShowResponse/ShowResponse.js.map +1 -1
  97. package/lib/esm/components/ShowResponse/index.js +1 -12
  98. package/lib/esm/components/ShowResponse/index.js.map +1 -1
  99. package/lib/esm/components/ShowResponse/responseUtils.js +28 -41
  100. package/lib/esm/components/ShowResponse/responseUtils.js.map +1 -1
  101. package/lib/esm/components/common/common.js +4 -13
  102. package/lib/esm/components/common/common.js.map +1 -1
  103. package/lib/esm/components/common/index.js +1 -18
  104. package/lib/esm/components/common/index.js.map +1 -1
  105. package/lib/esm/components/index.js +13 -148
  106. package/lib/esm/components/index.js.map +1 -1
  107. package/lib/esm/index.js +4 -49
  108. package/lib/esm/index.js.map +1 -1
  109. package/lib/esm/test-data/index.js +2 -67
  110. package/lib/esm/test-data/index.js.map +1 -1
  111. package/lib/esm/test-data/responses.js +9 -24
  112. package/lib/esm/test-data/responses.js.map +1 -1
  113. package/lib/esm/test-data/specs.js +3 -10
  114. package/lib/esm/test-data/specs.js.map +1 -1
  115. package/lib/esm/utils/RunItSDK.js +12 -20
  116. package/lib/esm/utils/RunItSDK.js.map +1 -1
  117. package/lib/esm/utils/index.js +2 -27
  118. package/lib/esm/utils/index.js.map +1 -1
  119. package/lib/esm/utils/requestUtils.js +26 -41
  120. package/lib/esm/utils/requestUtils.js.map +1 -1
  121. package/lib/test-data/responses.js.map +1 -1
  122. package/lib/test-data/specs.js +1 -1
  123. package/lib/test-data/specs.js.map +1 -1
  124. package/lib/utils/RunItSDK.js.map +1 -1
  125. package/lib/utils/requestUtils.js.map +1 -1
  126. package/package.json +4 -4
@@ -1,38 +1,30 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.PerfTracker = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _components = require("@looker/components");
9
- var _Delete = require("@styled-icons/material/Delete");
10
- var _ConfigForm = require("../ConfigForm");
11
- var _Loading = require("../Loading");
12
- var _perfUtils = require("./perfUtils");
13
- var _PerfChart = require("./PerfChart");
14
- var _PerfTable = require("./PerfTable");
15
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
1
+ import React, { useEffect, useState } from 'react';
2
+ import { Heading, FlexItem, IconButton, SpaceVertical, FieldToggleSwitch, Flex } from '@looker/components';
3
+ import { Delete } from '@styled-icons/material/Delete';
4
+ import { RunItConfigKey } from '../ConfigForm';
5
+ import { Loading } from '../Loading';
6
+ import { PerfTimings } from './perfUtils';
7
+ import { PerfChart } from './PerfChart';
8
+ import { PerfTable } from './PerfTable';
17
9
  var perfFilter = function perfFilter() {
18
10
  var all = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
19
11
  if (all) return '.*';
20
- var value = localStorage.getItem(_ConfigForm.RunItConfigKey);
12
+ var value = localStorage.getItem(RunItConfigKey);
21
13
  if (!value) return '.*';
22
14
  var config = JSON.parse(value);
23
15
  var url = new URL(config.base_url);
24
16
  return "".concat(url.protocol, "//").concat(url.hostname, ".*");
25
17
  };
26
- var PerfTracker = _ref => {
18
+ export var PerfTracker = _ref => {
27
19
  var {
28
- perf = new _perfUtils.PerfTimings(),
20
+ perf = new PerfTimings(),
29
21
  showAllColumns = false
30
22
  } = _ref;
31
- var [loading, setLoading] = (0, _react.useState)(false);
32
- var [showAll, setShowAll] = (0, _react.useState)(false);
33
- var [filter, setFilter] = (0, _react.useState)(perfFilter());
34
- var [data, setData] = (0, _react.useState)(perf.entries(filter));
35
- var [timings, setTimings] = (0, _react.useState)(data.length > 0 ? data[0] : undefined);
23
+ var [loading, setLoading] = useState(false);
24
+ var [showAll, setShowAll] = useState(false);
25
+ var [filter, setFilter] = useState(perfFilter());
26
+ var [data, setData] = useState(perf.entries(filter));
27
+ var [timings, setTimings] = useState(data.length > 0 ? data[0] : undefined);
36
28
  var handleClear = _ => {
37
29
  setLoading(true);
38
30
  perf.clear();
@@ -47,30 +39,29 @@ var PerfTracker = _ref => {
47
39
  setFilter(pf);
48
40
  setData(perf.entries(pf));
49
41
  };
50
- (0, _react.useEffect)(() => {
42
+ useEffect(() => {
51
43
  setLoading(false);
52
44
  }, [data]);
53
45
  var handleSelect = item => setTimings(item);
54
- return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_components.Heading, null, "Load Times for ", filter), _react.default.createElement(_components.Flex, null, _react.default.createElement(_components.FlexItem, null, _react.default.createElement(_components.IconButton, {
55
- icon: _react.default.createElement(_Delete.Delete, null),
46
+ return React.createElement(React.Fragment, null, React.createElement(Heading, null, "Load Times for ", filter), React.createElement(Flex, null, React.createElement(FlexItem, null, React.createElement(IconButton, {
47
+ icon: React.createElement(Delete, null),
56
48
  onClick: handleClear,
57
49
  label: "Clear the performance queue"
58
- })), _react.default.createElement(_components.FlexItem, null, _react.default.createElement(_components.FieldToggleSwitch, {
50
+ })), React.createElement(FlexItem, null, React.createElement(FieldToggleSwitch, {
59
51
  name: "filtering",
60
52
  label: "Show All",
61
53
  onChange: handleFilterChange,
62
54
  on: showAll
63
- })), _react.default.createElement(_components.FlexItem, null, _react.default.createElement(_Loading.Loading, {
55
+ })), React.createElement(FlexItem, null, React.createElement(Loading, {
64
56
  loading: loading
65
- }))), _react.default.createElement(_react.default.Fragment, null, !_perfUtils.PerfTimings.supported && 'Performance timing is not supported in this browser', _perfUtils.PerfTimings.supported && !!timings && _react.default.createElement(_components.SpaceVertical, {
57
+ }))), React.createElement(React.Fragment, null, !PerfTimings.supported && 'Performance timing is not supported in this browser', PerfTimings.supported && !!timings && React.createElement(SpaceVertical, {
66
58
  gap: "small"
67
- }, _react.default.createElement(_PerfChart.PerfChart, {
59
+ }, React.createElement(PerfChart, {
68
60
  loadTimes: timings
69
- }), _react.default.createElement(_PerfTable.PerfTable, {
61
+ }), React.createElement(PerfTable, {
70
62
  data: data,
71
63
  onSelect: handleSelect,
72
64
  showAllColumns: showAllColumns
73
- })), _perfUtils.PerfTimings.supported && data.length < 1 && 'No performance data is loaded'));
65
+ })), PerfTimings.supported && data.length < 1 && 'No performance data is loaded'));
74
66
  };
75
- exports.PerfTracker = PerfTracker;
76
67
  //# sourceMappingURL=PerfTracker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PerfTracker.js","names":["_react","_interopRequireWildcard","require","_components","_Delete","_ConfigForm","_Loading","_perfUtils","_PerfChart","_PerfTable","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","perfFilter","all","arguments","length","undefined","value","localStorage","getItem","RunItConfigKey","config","JSON","parse","url","URL","base_url","concat","protocol","hostname","PerfTracker","_ref","perf","PerfTimings","showAllColumns","loading","setLoading","useState","showAll","setShowAll","filter","setFilter","data","setData","entries","timings","setTimings","handleClear","_","clear","handleFilterChange","e","target","checked","pf","useEffect","handleSelect","item","createElement","Fragment","Heading","Flex","FlexItem","IconButton","icon","Delete","onClick","label","FieldToggleSwitch","name","onChange","on","Loading","supported","SpaceVertical","gap","PerfChart","loadTimes","PerfTable","onSelect","exports"],"sources":["../../../../src/components/PerfTracker/PerfTracker.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { BaseSyntheticEvent, FC } from 'react'\nimport React, { useEffect, useState } from 'react'\nimport {\n Heading,\n FlexItem,\n IconButton,\n SpaceVertical,\n FieldToggleSwitch,\n Flex,\n} from '@looker/components'\nimport { Delete } from '@styled-icons/material/Delete'\n\nimport { RunItConfigKey } from '../ConfigForm'\nimport { Loading } from '../Loading'\nimport type { LoadTimes } from './perfUtils'\nimport { PerfTimings } from './perfUtils'\nimport { PerfChart } from './PerfChart'\nimport { PerfTable } from './PerfTable'\n\ninterface PerfTrackerProps {\n perf?: PerfTimings\n showAllColumns?: boolean\n}\n\nconst perfFilter = (all = false) => {\n if (all) return '.*'\n // TODO: temporary solution until redux is introduced in RunIt. Using the env\n // adaptor makes the below async, which in turn makes it hard to use this to\n // set the initial state. PerfTracker is only used in the standalone version\n // so this achieves parity.\n const value = localStorage.getItem(RunItConfigKey)\n if (!value) return '.*'\n const config = JSON.parse(value)\n const url = new URL(config.base_url)\n return `${url.protocol}//${url.hostname}.*`\n}\n\nexport const PerfTracker: FC<PerfTrackerProps> = ({\n perf = new PerfTimings(),\n showAllColumns = false,\n}) => {\n // TODO UI option to filter by url pattern\n const [loading, setLoading] = useState(false)\n const [showAll, setShowAll] = useState(false)\n const [filter, setFilter] = useState(perfFilter())\n const [data, setData] = useState<LoadTimes[]>(perf.entries(filter))\n const [timings, setTimings] = useState(data.length > 0 ? data[0] : undefined)\n\n const handleClear = (_: BaseSyntheticEvent) => {\n setLoading(true)\n perf.clear()\n setData([])\n setTimings(undefined)\n }\n\n const handleFilterChange = (e: BaseSyntheticEvent) => {\n setLoading(true)\n const all = e.target.checked\n setShowAll(all)\n const pf = perfFilter(all)\n setFilter(pf)\n setData(perf.entries(pf))\n }\n\n useEffect(() => {\n setLoading(false)\n }, [data])\n\n const handleSelect = (item: LoadTimes) => setTimings(item)\n\n return (\n <>\n <Heading>Load Times for {filter}</Heading>\n <Flex>\n <FlexItem>\n <IconButton\n icon={<Delete />}\n onClick={handleClear}\n label=\"Clear the performance queue\"\n />\n </FlexItem>\n <FlexItem>\n <FieldToggleSwitch\n name=\"filtering\"\n label=\"Show All\"\n onChange={handleFilterChange}\n on={showAll}\n />\n </FlexItem>\n <FlexItem>\n <Loading loading={loading} />\n </FlexItem>\n </Flex>\n <>\n {!PerfTimings.supported &&\n 'Performance timing is not supported in this browser'}\n {PerfTimings.supported && !!timings && (\n <SpaceVertical gap=\"small\">\n <PerfChart loadTimes={timings} />\n <PerfTable\n data={data}\n onSelect={handleSelect}\n showAllColumns={showAllColumns}\n />\n </SpaceVertical>\n )}\n {PerfTimings.supported &&\n data.length < 1 &&\n 'No performance data is loaded'}\n </>\n </>\n )\n}\n"],"mappings":";;;;;;AA2BA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC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}
1
+ {"version":3,"file":"PerfTracker.js","names":["React","useEffect","useState","Heading","FlexItem","IconButton","SpaceVertical","FieldToggleSwitch","Flex","Delete","RunItConfigKey","Loading","PerfTimings","PerfChart","PerfTable","perfFilter","all","arguments","length","undefined","value","localStorage","getItem","config","JSON","parse","url","URL","base_url","concat","protocol","hostname","PerfTracker","_ref","perf","showAllColumns","loading","setLoading","showAll","setShowAll","filter","setFilter","data","setData","entries","timings","setTimings","handleClear","_","clear","handleFilterChange","e","target","checked","pf","handleSelect","item","createElement","Fragment","icon","onClick","label","name","onChange","on","supported","gap","loadTimes","onSelect"],"sources":["../../../../src/components/PerfTracker/PerfTracker.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { BaseSyntheticEvent, FC } from 'react'\nimport React, { useEffect, useState } from 'react'\nimport {\n Heading,\n FlexItem,\n IconButton,\n SpaceVertical,\n FieldToggleSwitch,\n Flex,\n} from '@looker/components'\nimport { Delete } from '@styled-icons/material/Delete'\n\nimport { RunItConfigKey } from '../ConfigForm'\nimport { Loading } from '../Loading'\nimport type { LoadTimes } from './perfUtils'\nimport { PerfTimings } from './perfUtils'\nimport { PerfChart } from './PerfChart'\nimport { PerfTable } from './PerfTable'\n\ninterface PerfTrackerProps {\n perf?: PerfTimings\n showAllColumns?: boolean\n}\n\nconst perfFilter = (all = false) => {\n if (all) return '.*'\n // TODO: temporary solution until redux is introduced in RunIt. Using the env\n // adaptor makes the below async, which in turn makes it hard to use this to\n // set the initial state. PerfTracker is only used in the standalone version\n // so this achieves parity.\n const value = localStorage.getItem(RunItConfigKey)\n if (!value) return '.*'\n const config = JSON.parse(value)\n const url = new URL(config.base_url)\n return `${url.protocol}//${url.hostname}.*`\n}\n\nexport const PerfTracker: FC<PerfTrackerProps> = ({\n perf = new PerfTimings(),\n showAllColumns = false,\n}) => {\n // TODO UI option to filter by url pattern\n const [loading, setLoading] = useState(false)\n const [showAll, setShowAll] = useState(false)\n const [filter, setFilter] = useState(perfFilter())\n const [data, setData] = useState<LoadTimes[]>(perf.entries(filter))\n const [timings, setTimings] = useState(data.length > 0 ? data[0] : undefined)\n\n const handleClear = (_: BaseSyntheticEvent) => {\n setLoading(true)\n perf.clear()\n setData([])\n setTimings(undefined)\n }\n\n const handleFilterChange = (e: BaseSyntheticEvent) => {\n setLoading(true)\n const all = e.target.checked\n setShowAll(all)\n const pf = perfFilter(all)\n setFilter(pf)\n setData(perf.entries(pf))\n }\n\n useEffect(() => {\n setLoading(false)\n }, [data])\n\n const handleSelect = (item: LoadTimes) => setTimings(item)\n\n return (\n <>\n <Heading>Load Times for {filter}</Heading>\n <Flex>\n <FlexItem>\n <IconButton\n icon={<Delete />}\n onClick={handleClear}\n label=\"Clear the performance queue\"\n />\n </FlexItem>\n <FlexItem>\n <FieldToggleSwitch\n name=\"filtering\"\n label=\"Show All\"\n onChange={handleFilterChange}\n on={showAll}\n />\n </FlexItem>\n <FlexItem>\n <Loading loading={loading} />\n </FlexItem>\n </Flex>\n <>\n {!PerfTimings.supported &&\n 'Performance timing is not supported in this browser'}\n {PerfTimings.supported && !!timings && (\n <SpaceVertical gap=\"small\">\n <PerfChart loadTimes={timings} />\n <PerfTable\n data={data}\n onSelect={handleSelect}\n showAllColumns={showAllColumns}\n />\n </SpaceVertical>\n )}\n {PerfTimings.supported &&\n data.length < 1 &&\n 'No performance data is loaded'}\n </>\n </>\n )\n}\n"],"mappings":"AA2BA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SACEC,OAAO,EACPC,QAAQ,EACRC,UAAU,EACVC,aAAa,EACbC,iBAAiB,EACjBC,IAAI,QACC,oBAAoB;AAC3B,SAASC,MAAM,QAAQ,+BAA+B;AAEtD,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,OAAO,QAAQ,YAAY;AAEpC,SAASC,WAAW,QAAQ,aAAa;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,SAAS,QAAQ,aAAa;AAOvC,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAA,EAAoB;EAAA,IAAhBC,GAAG,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAC7B,IAAID,GAAG,EAAE,OAAO,IAAI;EAKpB,IAAMI,KAAK,GAAGC,YAAY,CAACC,OAAO,CAACZ,cAAc,CAAC;EAClD,IAAI,CAACU,KAAK,EAAE,OAAO,IAAI;EACvB,IAAMG,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACL,KAAK,CAAC;EAChC,IAAMM,GAAG,GAAG,IAAIC,GAAG,CAACJ,MAAM,CAACK,QAAQ,CAAC;EACpC,UAAAC,MAAA,CAAUH,GAAG,CAACI,QAAQ,QAAAD,MAAA,CAAKH,GAAG,CAACK,QAAQ;AACzC,CAAC;AAED,OAAO,IAAMC,WAAiC,GAAGC,IAAA,IAG3C;EAAA,IAH4C;IAChDC,IA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AChB,EACAvB,WAAW,CAACqD,SAAS,IACpBvB,IAAI,CAACxB,MAAM,GAAG,CAAC,IACf,+BACF,CACF,CAAC;AAEP,CAAC"}
@@ -1,20 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "PerfTimings", {
7
- enumerable: true,
8
- get: function get() {
9
- return _perfUtils.PerfTimings;
10
- }
11
- });
12
- Object.defineProperty(exports, "PerfTracker", {
13
- enumerable: true,
14
- get: function get() {
15
- return _PerfTracker.PerfTracker;
16
- }
17
- });
18
- var _PerfTracker = require("./PerfTracker");
19
- var _perfUtils = require("./perfUtils");
1
+ export { PerfTracker } from './PerfTracker';
2
+ export { PerfTimings } from './perfUtils';
20
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_PerfTracker","require","_perfUtils"],"sources":["../../../../src/components/PerfTracker/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport { PerfTracker } from './PerfTracker'\nexport { PerfTimings } from './perfUtils'\n"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA"}
1
+ {"version":3,"file":"index.js","names":["PerfTracker","PerfTimings"],"sources":["../../../../src/components/PerfTracker/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport { PerfTracker } from './PerfTracker'\nexport { PerfTimings } from './perfUtils'\n"],"mappings":"AAyBA,SAASA,WAAW,QAAQ,eAAe;AAC3C,SAASC,WAAW,QAAQ,aAAa"}
@@ -1,15 +1,8 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.perfTableColumns = exports.createTableRows = exports.UrlText = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _components = require("@looker/components");
9
- var _styledComponents = _interopRequireDefault(require("styled-components"));
10
- var _perfUtils = require("./perfUtils");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- var perfTableColumns = function perfTableColumns() {
1
+ import React from 'react';
2
+ import { DataTableItem, Tooltip, Text, DataTableCell } from '@looker/components';
3
+ import styled from 'styled-components';
4
+ import { perfRound } from './perfUtils';
5
+ export var perfTableColumns = function perfTableColumns() {
13
6
  var all = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
14
7
  var numericColumns = all ? 9 : 6;
15
8
  var urlWidth = all ? 13 : 20;
@@ -91,33 +84,31 @@ var perfTableColumns = function perfTableColumns() {
91
84
  });
92
85
  return result;
93
86
  };
94
- exports.perfTableColumns = perfTableColumns;
95
87
  var Metric = _ref => {
96
88
  var {
97
89
  value,
98
90
  description
99
91
  } = _ref;
100
- return _react.default.createElement(_components.Tooltip, {
92
+ return React.createElement(Tooltip, {
101
93
  placement: "right",
102
94
  textAlign: "left",
103
- content: _react.default.createElement(_react.default.Fragment, null, description)
104
- }, _react.default.createElement("span", null, value));
95
+ content: React.createElement(React.Fragment, null, description)
96
+ }, React.createElement("span", null, value));
105
97
  };
106
- var metric = (value, description) => _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(Metric, {
98
+ var metric = (value, description) => React.createElement(React.Fragment, null, React.createElement(Metric, {
107
99
  value: value,
108
100
  description: "".concat(description, " (").concat(value, " ms)")
109
101
  }));
110
- var UrlText = (0, _styledComponents.default)(_components.Text).withConfig({
102
+ export var UrlText = styled(Text).withConfig({
111
103
  displayName: "perfTableUtils__UrlText",
112
104
  componentId: "sc-eq1lm0-0"
113
105
  })(["display:inline-block;direction:rtl;width:78px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;"]);
114
- exports.UrlText = UrlText;
115
106
  var urlColumn = value => {
116
107
  var url = new URL(value);
117
108
  var path = "".concat(url.pathname).concat(url.search);
118
- return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_components.Tooltip, {
109
+ return React.createElement(React.Fragment, null, React.createElement(Tooltip, {
119
110
  content: value
120
- }, _react.default.createElement(UrlText, {
111
+ }, React.createElement(UrlText, {
121
112
  mb: "0",
122
113
  pt: "0",
123
114
  fontSize: "xsmall"
@@ -125,19 +116,18 @@ var urlColumn = value => {
125
116
  };
126
117
  var extraPerfColumns = function extraPerfColumns(item) {
127
118
  var showAllColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
128
- if (!showAllColumns) return _react.default.createElement(_react.default.Fragment, null);
129
- return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_components.DataTableCell, null, metric(item.connect, 'Immediately before the browser starts to establish the connection to the server to retrieve the resource until the connection is established.')), _react.default.createElement(_components.DataTableCell, null, metric(item.secureConnection, 'Immediately before the browser starts the handshake process to secure the current connection until the connection ends. 0 if not a secure connection.')), _react.default.createElement(_components.DataTableCell, null, metric(item.responseTime, 'Immediately after the browser receives the first byte of the response from the server until the response ends.')));
119
+ if (!showAllColumns) return React.createElement(React.Fragment, null);
120
+ return React.createElement(React.Fragment, null, React.createElement(DataTableCell, null, metric(item.connect, 'Immediately before the browser starts to establish the connection to the server to retrieve the resource until the connection is established.')), React.createElement(DataTableCell, null, metric(item.secureConnection, 'Immediately before the browser starts the handshake process to secure the current connection until the connection ends. 0 if not a secure connection.')), React.createElement(DataTableCell, null, metric(item.responseTime, 'Immediately after the browser receives the first byte of the response from the server until the response ends.')));
130
121
  };
131
- var createTableRows = function createTableRows(data, onSelect) {
122
+ export var createTableRows = function createTableRows(data, onSelect) {
132
123
  var showAllColumns = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
133
124
  return data.map((item, index) => {
134
125
  var id = "".concat(item.name, ".").concat(index);
135
- return _react.default.createElement(_components.DataTableItem, {
126
+ return React.createElement(DataTableItem, {
136
127
  id: id,
137
128
  key: id,
138
129
  onClick: onSelect.bind(null, item)
139
- }, _react.default.createElement(_components.DataTableCell, null, urlColumn(item.name)), _react.default.createElement(_components.DataTableCell, null, metric(item.domainLookup, 'Immediately before the browser starts the domain name lookup until it ends')), extraPerfColumns(item, showAllColumns), _react.default.createElement(_components.DataTableCell, null, metric(item.fetchUntilResponseEnd, 'Immediately before the browser starts to fetch the resource until the response ends')), _react.default.createElement(_components.DataTableCell, null, metric(item.requestUntilResponseEnd, 'Immediately after the browser receives the first byte of the response from the server until the response ends')), _react.default.createElement(_components.DataTableCell, null, metric(item.startUntilResponseEnd, 'Immediately before the browser starts requesting the resource from the server')), _react.default.createElement(_components.DataTableCell, null, metric((0, _perfUtils.perfRound)(item.processDuration), 'Total time to process the payload')), _react.default.createElement(_components.DataTableCell, null, metric((0, _perfUtils.perfRound)(item.duration), 'Total time of the request and response')));
130
+ }, React.createElement(DataTableCell, null, urlColumn(item.name)), React.createElement(DataTableCell, null, metric(item.domainLookup, 'Immediately before the browser starts the domain name lookup until it ends')), extraPerfColumns(item, showAllColumns), React.createElement(DataTableCell, null, metric(item.fetchUntilResponseEnd, 'Immediately before the browser starts to fetch the resource until the response ends')), React.createElement(DataTableCell, null, metric(item.requestUntilResponseEnd, 'Immediately after the browser receives the first byte of the response from the server until the response ends')), React.createElement(DataTableCell, null, metric(item.startUntilResponseEnd, 'Immediately before the browser starts requesting the resource from the server')), React.createElement(DataTableCell, null, metric(perfRound(item.processDuration), 'Total time to process the payload')), React.createElement(DataTableCell, null, metric(perfRound(item.duration), 'Total time of the request and response')));
140
131
  });
141
132
  };
142
- exports.createTableRows = createTableRows;
143
133
  //# sourceMappingURL=perfTableUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"perfTableUtils.js","names":["_react","_interopRequireDefault","require","_components","_styledComponents","_perfUtils","obj","__esModule","default","perfTableColumns","all","arguments","length","undefined","numericColumns","urlWidth","numWidth","result","canSort","id","primaryKey","title","type","widthPercent","push","exports","Metric","_ref","value","description","createElement","Tooltip","placement","textAlign","content","Fragment","metric","concat","UrlText","styled","Text","withConfig","displayName","componentId","urlColumn","url","URL","path","pathname","search","mb","pt","fontSize","extraPerfColumns","item","showAllColumns","DataTableCell","connect","secureConnection","responseTime","createTableRows","data","onSelect","map","index","name","DataTableItem","key","onClick","bind","domainLookup","fetchUntilResponseEnd","requestUntilResponseEnd","startUntilResponseEnd","perfRound","processDuration","duration"],"sources":["../../../../src/components/PerfTracker/perfTableUtils.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport type { FC } from 'react'\nimport React from 'react'\nimport type { DataTableColumns } from '@looker/components'\nimport { DataTableItem, Tooltip, Text, DataTableCell } from '@looker/components'\nimport styled from 'styled-components'\nimport type { LoadTimes } from './perfUtils'\nimport { perfRound } from './perfUtils'\n\n/**\n * An array of columns defining the PerfTable\n * @param all true to include all columns\n */\nexport const perfTableColumns = (all = false) => {\n const numericColumns = all ? 9 : 6\n const urlWidth = all ? 13 : 20\n const numWidth = (100 - urlWidth) / numericColumns + 1\n const result = [\n {\n canSort: true,\n id: 'id',\n primaryKey: true,\n title: 'URL',\n type: 'string',\n widthPercent: urlWidth,\n },\n ]\n if (all) {\n result.push(\n {\n canSort: true,\n id: 'domainLookup',\n primaryKey: false,\n title: 'Domain',\n type: 'number',\n widthPercent: numWidth,\n },\n {\n canSort: true,\n id: 'connect',\n primaryKey: false,\n title: 'Connect',\n type: 'number',\n widthPercent: numWidth,\n },\n {\n canSort: true,\n id: 'secureConnection',\n primaryKey: false,\n title: 'Secure',\n type: 'number',\n widthPercent: numWidth,\n }\n )\n }\n result.push(\n {\n canSort: true,\n id: 'responseTime',\n primaryKey: false,\n title: 'Response',\n type: 'number',\n widthPercent: numWidth,\n },\n {\n canSort: true,\n id: 'fetchUntilResponseEnd',\n primaryKey: false,\n title: 'Fetch',\n type: 'number',\n widthPercent: numWidth,\n },\n {\n canSort: true,\n id: 'requestUntilResponseEnd',\n primaryKey: false,\n title: 'Request',\n type: 'number',\n widthPercent: numWidth,\n },\n {\n canSort: true,\n id: 'startUntilResponseEnd',\n primaryKey: false,\n title: 'Start',\n type: 'number',\n widthPercent: numWidth,\n },\n {\n canSort: true,\n id: 'processDuration',\n primaryKey: false,\n title: 'Processing',\n type: 'number',\n widthPercent: numWidth,\n },\n {\n canSort: true,\n id: 'duration',\n primaryKey: false,\n title: 'Duration',\n type: 'number',\n widthPercent: numWidth,\n }\n )\n return result as DataTableColumns\n}\n\ninterface MetricProps {\n value: number\n description: string\n}\n\n/**\n * Renders a metric with its description in a tooltip\n */\nconst Metric: FC<MetricProps> = ({ value, description }) => (\n <Tooltip placement=\"right\" textAlign=\"left\" content={<>{description}</>}>\n <span>{value}</span>\n </Tooltip>\n)\n\n/**\n * Helper function to create a metric data cell\n * @param value milliseconds of performance metric\n * @param description to explain the metric, with ms value appended\n */\nconst metric = (value: number, description: string) => (\n <>\n <Metric value={value} description={`${description} (${value} ms)`} />\n </>\n)\n\n/**\n * Styling override to align url paths to the right and truncate to the left\n */\nexport const UrlText = styled(Text)`\n display: inline-block;\n direction: rtl;\n width: 78px;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n`\n\n/**\n * Special url value display handling\n * @param value is the url to massage\n */\nconst urlColumn = (value: string) => {\n const url = new URL(value)\n const path = `${url.pathname}${url.search}`\n return (\n <>\n <Tooltip content={value}>\n <UrlText mb=\"0\" pt=\"0\" fontSize=\"xsmall\">\n {path}\n </UrlText>\n </Tooltip>\n </>\n )\n}\n\n/**\n * Creates the extra performance columns if showAllColumns is true\n * @param item to put into row data\n * @param showAllColumns toggle for showing or skipping these performance columns\n */\nconst extraPerfColumns = (item: LoadTimes, showAllColumns = false) => {\n if (!showAllColumns) return <></>\n return (\n <>\n <DataTableCell>\n {metric(\n item.connect,\n 'Immediately before the browser starts to establish the connection to the server to retrieve the resource until the connection is established.'\n )}\n </DataTableCell>\n <DataTableCell>\n {metric(\n item.secureConnection,\n 'Immediately before the browser starts the handshake process to secure the current connection until the connection ends. 0 if not a secure connection.'\n )}\n </DataTableCell>\n <DataTableCell>\n {metric(\n item.responseTime,\n 'Immediately after the browser receives the first byte of the response from the server until the response ends.'\n )}\n </DataTableCell>\n </>\n )\n}\n\n/**\n * Generates PerfTable rows from an array of resource load times\n * @param data A array of resource load times\n * @param onSelect A handler for performing an action when a row is clicked\n * @param showAllColumns should be true to show all columns\n */\nexport const createTableRows = (\n data: LoadTimes[],\n onSelect: (item: LoadTimes) => void,\n showAllColumns = false\n) =>\n data.map((item, index) => {\n const id = `${item.name}.${index}`\n return (\n <DataTableItem id={id} key={id} onClick={onSelect.bind(null, item)}>\n <DataTableCell>{urlColumn(item.name)}</DataTableCell>\n <DataTableCell>\n {metric(\n item.domainLookup,\n 'Immediately before the browser starts the domain name lookup until it ends'\n )}\n </DataTableCell>\n {extraPerfColumns(item, showAllColumns)}\n <DataTableCell>\n {metric(\n item.fetchUntilResponseEnd,\n 'Immediately before the browser starts to fetch the resource until the response ends'\n )}\n </DataTableCell>\n <DataTableCell>\n {metric(\n item.requestUntilResponseEnd,\n 'Immediately after the browser receives the first byte of the response from the server until the response ends'\n )}\n </DataTableCell>\n <DataTableCell>\n {metric(\n item.startUntilResponseEnd,\n 'Immediately before the browser starts requesting the resource from the server'\n )}\n </DataTableCell>\n <DataTableCell>\n {metric(\n perfRound(item.processDuration),\n 'Total time to process the payload'\n )}\n </DataTableCell>\n <DataTableCell>\n {metric(\n perfRound(item.duration),\n 'Total time of the request and response'\n )}\n </DataTableCell>\n </DataTableItem>\n )\n })\n"],"mappings":";;;;;;AA0BA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AAAuC,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAMhC,IAAMG,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAA,EAAoB;EAAA,IAAhBC,GAAG,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAC1C,IAAMG,cAAc,GAAGJ,GAAG,GAAG,CAAC,GAAG,CAAC;EAClC,IAAMK,QAAQ,GAAGL,GAAG,GAAG,EAAE,GAAG,EAAE;EAC9B,IAAMM,QAAQ,GAAG,CAAC,GAAG,GAAGD,QAAQ,IAAID,cAAc,GAAG,CAAC;EACtD,IAAMG,MAAM,GAAG,CACb;IACEC,OAAO,EAAE,IAAI;IACbC,EAAE,EAAE,IAAI;IACRC,UAAU,EAAE,IAAI;IAChBC,KAAK,EAAE,KAAK;IACZC,IAAI,EAAE,QAAQ;IACdC,YAAY,EAAER;EAChB,CAAC,CACF;EACD,IAAIL,GAAG,EAAE;IACPO,MAAM,CAACO,IAAI,CACT;MACEN,OAAO,EAAE,IAAI;MACbC,EAAE,EAAE,cAAc;MAClBC,UAAU,EAAE,KAAK;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AAC3B,WAAA,CAAAqD,aAAa,QACXpB,MAAM,CACLkB,IAAI,CAACmB,qBAAqB,EAC1B,+EAA+E,CAChF,CACa,EAChBzE,MAAA,CAAAQ,OAAA,CAAAsB,aAAA,CAAC3B,WAAA,CAAAqD,aAAa,QACXpB,MAAM,CACL,IAAAsC,oBAAS,EAACpB,IAAI,CAACqB,eAAe,CAAC,EAC/B,mCAAmC,CACpC,CACa,EAChB3E,MAAA,CAAAQ,OAAA,CAAAsB,aAAA,CAAC3B,WAAA,CAAAqD,aAAa,QACXpB,MAAM,CACL,IAAAsC,oBAAS,EAACpB,IAAI,CAACsB,QAAQ,CAAC,EACxB,wCAAwC,CACzC,CACa,CACF;EAEpB,CAAC,CAAC;AAAA;AAAAnD,OAAA,CAAAmC,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"file":"perfTableUtils.js","names":["React","DataTableItem","Tooltip","Text","DataTableCell","styled","perfRound","perfTableColumns","all","arguments","length","undefined","numericColumns","urlWidth","numWidth","result","canSort","id","primaryKey","title","type","widthPercent","push","Metric","_ref","value","description","createElement","placement","textAlign","content","Fragment","metric","concat","UrlText","withConfig","displayName","componentId","urlColumn","url","URL","path","pathname","search","mb","pt","fontSize","extraPerfColumns","item","showAllColumns","connect","secureConnection","responseTime","createTableRows","data","onSelect","map","index","name","key","onClick","bind","domainLookup","fetchUntilResponseEnd","requestUntilResponseEnd","startUntilResponseEnd","processDuration","duration"],"sources":["../../../../src/components/PerfTracker/perfTableUtils.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport type { FC } from 'react'\nimport React from 'react'\nimport type { DataTableColumns } from '@looker/components'\nimport { DataTableItem, Tooltip, Text, DataTableCell } from '@looker/components'\nimport styled from 'styled-components'\nimport type { LoadTimes } from './perfUtils'\nimport { perfRound } from './perfUtils'\n\n/**\n * An array of columns defining the PerfTable\n * @param all true to include all columns\n */\nexport const perfTableColumns = (all = false) => {\n const numericColumns = all ? 9 : 6\n const urlWidth = all ? 13 : 20\n const numWidth = (100 - urlWidth) / numericColumns + 1\n const result = [\n {\n canSort: true,\n id: 'id',\n primaryKey: true,\n title: 'URL',\n type: 'string',\n widthPercent: urlWidth,\n },\n ]\n if (all) {\n result.push(\n {\n canSort: true,\n id: 'domainLookup',\n primaryKey: false,\n title: 'Domain',\n type: 'number',\n widthPercent: numWidth,\n },\n {\n canSort: true,\n id: 'connect',\n primaryKey: false,\n title: 'Connect',\n type: 'number',\n widthPercent: numWidth,\n },\n {\n canSort: true,\n id: 'secureConnection',\n primaryKey: false,\n title: 'Secure',\n type: 'number',\n widthPercent: numWidth,\n }\n )\n }\n result.push(\n {\n canSort: true,\n id: 'responseTime',\n primaryKey: false,\n title: 'Response',\n type: 'number',\n widthPercent: numWidth,\n },\n {\n canSort: true,\n id: 'fetchUntilResponseEnd',\n primaryKey: false,\n title: 'Fetch',\n type: 'number',\n widthPercent: numWidth,\n },\n {\n canSort: true,\n id: 'requestUntilResponseEnd',\n primaryKey: false,\n title: 'Request',\n type: 'number',\n widthPercent: numWidth,\n },\n {\n canSort: true,\n id: 'startUntilResponseEnd',\n primaryKey: false,\n title: 'Start',\n type: 'number',\n widthPercent: numWidth,\n },\n {\n canSort: true,\n id: 'processDuration',\n primaryKey: false,\n title: 'Processing',\n type: 'number',\n widthPercent: numWidth,\n },\n {\n canSort: true,\n id: 'duration',\n primaryKey: false,\n title: 'Duration',\n type: 'number',\n widthPercent: numWidth,\n }\n )\n return result as DataTableColumns\n}\n\ninterface MetricProps {\n value: number\n description: string\n}\n\n/**\n * Renders a metric with its description in a tooltip\n */\nconst Metric: FC<MetricProps> = ({ value, description }) => (\n <Tooltip placement=\"right\" textAlign=\"left\" content={<>{description}</>}>\n <span>{value}</span>\n </Tooltip>\n)\n\n/**\n * Helper function to create a metric data cell\n * @param value milliseconds of performance metric\n * @param description to explain the metric, with ms value appended\n */\nconst metric = (value: number, description: string) => (\n <>\n <Metric value={value} description={`${description} (${value} ms)`} />\n </>\n)\n\n/**\n * Styling override to align url paths to the right and truncate to the left\n */\nexport const UrlText = styled(Text)`\n display: inline-block;\n direction: rtl;\n width: 78px;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n`\n\n/**\n * Special url value display handling\n * @param value is the url to massage\n */\nconst urlColumn = (value: string) => {\n const url = new URL(value)\n const path = `${url.pathname}${url.search}`\n return (\n <>\n <Tooltip content={value}>\n <UrlText mb=\"0\" pt=\"0\" fontSize=\"xsmall\">\n {path}\n </UrlText>\n </Tooltip>\n </>\n )\n}\n\n/**\n * Creates the extra performance columns if showAllColumns is true\n * @param item to put into row data\n * @param showAllColumns toggle for showing or skipping these performance columns\n */\nconst extraPerfColumns = (item: LoadTimes, showAllColumns = false) => {\n if (!showAllColumns) return <></>\n return (\n <>\n <DataTableCell>\n {metric(\n item.connect,\n 'Immediately before the browser starts to establish the connection to the server to retrieve the resource until the connection is established.'\n )}\n </DataTableCell>\n <DataTableCell>\n {metric(\n item.secureConnection,\n 'Immediately before the browser starts the handshake process to secure the current connection until the connection ends. 0 if not a secure connection.'\n )}\n </DataTableCell>\n <DataTableCell>\n {metric(\n item.responseTime,\n 'Immediately after the browser receives the first byte of the response from the server until the response ends.'\n )}\n </DataTableCell>\n </>\n )\n}\n\n/**\n * Generates PerfTable rows from an array of resource load times\n * @param data A array of resource load times\n * @param onSelect A handler for performing an action when a row is clicked\n * @param showAllColumns should be true to show all columns\n */\nexport const createTableRows = (\n data: LoadTimes[],\n onSelect: (item: LoadTimes) => void,\n showAllColumns = false\n) =>\n data.map((item, index) => {\n const id = `${item.name}.${index}`\n return (\n <DataTableItem id={id} key={id} onClick={onSelect.bind(null, item)}>\n <DataTableCell>{urlColumn(item.name)}</DataTableCell>\n <DataTableCell>\n {metric(\n item.domainLookup,\n 'Immediately before the browser starts the domain name lookup until it ends'\n )}\n </DataTableCell>\n {extraPerfColumns(item, showAllColumns)}\n <DataTableCell>\n {metric(\n item.fetchUntilResponseEnd,\n 'Immediately before the browser starts to fetch the resource until the response ends'\n )}\n </DataTableCell>\n <DataTableCell>\n {metric(\n item.requestUntilResponseEnd,\n 'Immediately after the browser receives the first byte of the response from the server until the response ends'\n )}\n </DataTableCell>\n <DataTableCell>\n {metric(\n item.startUntilResponseEnd,\n 'Immediately before the browser starts requesting the resource from the server'\n )}\n </DataTableCell>\n <DataTableCell>\n {metric(\n perfRound(item.processDuration),\n 'Total time to process the payload'\n )}\n </DataTableCell>\n <DataTableCell>\n {metric(\n perfRound(item.duration),\n 'Total time of the request and response'\n )}\n </DataTableCell>\n </DataTableItem>\n )\n })\n"],"mappings":"AA0BA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,aAAa,EAAEC,OAAO,EAAEC,IAAI,EAAEC,aAAa,QAAQ,oBAAoB;AAChF,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,SAASC,SAAS,QAAQ,aAAa;AAMvC,OAAO,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAA,EAA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,aAAA,CAACvB,aAAa,QACX4B,MAAM,CACLgB,IAAI,CAACiB,qBAAqB,EAC1B,+EACF,CACa,CAAC,EAChBjE,KAAA,CAAA2B,aAAA,CAACvB,aAAa,QACX4B,MAAM,CACL1B,SAAS,CAAC0C,IAAI,CAACkB,eAAe,CAAC,EAC/B,mCACF,CACa,CAAC,EAChBlE,KAAA,CAAA2B,aAAA,CAACvB,aAAa,QACX4B,MAAM,CACL1B,SAAS,CAAC0C,IAAI,CAACmB,QAAQ,CAAC,EACxB,wCACF,CACa,CACF,CAAC;EAEpB,CAAC,CAAC;AAAA"}
@@ -1,16 +1,9 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.perfRound = exports.PerfTimings = exports.LoadTimes = void 0;
7
1
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
2
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
9
3
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
- var perfRound = num => Math.round((num + Number.EPSILON) * 10000) / 10000;
11
- exports.perfRound = perfRound;
4
+ export var perfRound = num => Math.round((num + Number.EPSILON) * 10000) / 10000;
12
5
  var diff = (end, start) => perfRound(end - start);
13
- class LoadTimes {
6
+ export class LoadTimes {
14
7
  constructor(entry) {
15
8
  this.entry = entry;
16
9
  _defineProperty(this, "duration", 0);
@@ -56,8 +49,7 @@ class LoadTimes {
56
49
  return this.entry.name;
57
50
  }
58
51
  }
59
- exports.LoadTimes = LoadTimes;
60
- class PerfTimings {
52
+ export class PerfTimings {
61
53
  static get supported() {
62
54
  if (PerfTimings._supported === undefined) {
63
55
  try {
@@ -108,6 +100,5 @@ class PerfTimings {
108
100
  return this._full;
109
101
  }
110
102
  }
111
- exports.PerfTimings = PerfTimings;
112
103
  _defineProperty(PerfTimings, "_supported", undefined);
113
104
  //# sourceMappingURL=perfUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"perfUtils.js","names":["perfRound","num","Math","round","Number","EPSILON","exports","diff","end","start","LoadTimes","constructor","entry","_defineProperty","resource","redirect","redirectEnd","redirectStart","domainLookup","domainLookupEnd","domainLookupStart","connect","connectEnd","connectStart","secureConnectionStart","secureConnection","responseTime","responseEnd","responseStart","fetchStart","fetchUntilResponseEnd","requestStart","requestUntilResponseEnd","startTime","startUntilResponseEnd","calcProcessTime","duration","performance","getEntriesByName","undefined","entries","concat","name","length","measure","processStart","processEnd","processDuration","PerfTimings","supported","_supported","_unused","value","onresourcetimingbufferfull","_ev","_full","clear","clearResourceTimings","clearMarks","clearMeasures","pattern","arguments","type","ex","RegExp","getEntriesByType","filter","p","test","map","bufferSize","_bufferSize","setResourceTimingBufferSize","isFull"],"sources":["../../../../src/components/PerfTracker/perfUtils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\n/**\n * Calculation of Load times for a resource performance entry\n */\nexport interface IResourceLoadTimes {\n entry: PerformanceEntry\n name: string\n duration: number\n redirect: number\n domainLookup: number\n connect: number\n secureConnection: number\n responseTime: number\n fetchUntilResponseEnd: number\n requestUntilResponseEnd: number\n startUntilResponseEnd: number\n processStart: number\n processEnd: number\n processDuration: number\n}\n\n/**\n * Rounds a number to 3 decimal places\n */\nexport const perfRound = (num: number) =>\n Math.round((num + Number.EPSILON) * 10000) / 10000\n\n/**\n * Round and scale (if needed) the difference in performance metrics\n * @param end of high precision timer metric\n * @param start of high precision timer metric\n * @returns rounded difference of end - start\n */\nconst diff = (end: number, start: number) => perfRound(end - start)\n\nexport class LoadTimes implements IResourceLoadTimes {\n duration = 0\n redirect = 0\n domainLookup = 0\n connect = 0\n secureConnection = 0\n responseTime = 0\n fetchUntilResponseEnd = 0\n requestUntilResponseEnd = 0\n startUntilResponseEnd = 0\n processStart = 0\n processEnd = 0\n processDuration = 0\n\n constructor(public entry: PerformanceEntry) {\n if ('redirectStart' in entry) {\n // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming\n // Either a `PerformanceResourceTiming` or `PerformanceTiming` instance\n const resource = entry as PerformanceResourceTiming\n this.redirect = diff(resource.redirectEnd, resource.redirectStart)\n this.domainLookup = diff(\n resource.domainLookupEnd,\n resource.domainLookupStart\n )\n this.connect = diff(resource.connectEnd, resource.connectStart)\n if (resource.secureConnectionStart > 0)\n this.secureConnection = diff(\n resource.connectEnd,\n resource.secureConnectionStart\n )\n this.responseTime = diff(resource.responseEnd, resource.responseStart)\n if (resource.fetchStart > 0)\n this.fetchUntilResponseEnd = diff(\n resource.responseEnd,\n resource.fetchStart\n )\n if (resource.requestStart > 0)\n this.requestUntilResponseEnd = diff(\n resource.responseEnd,\n resource.requestStart\n )\n if (resource.startTime > 0)\n this.startUntilResponseEnd = diff(\n resource.responseEnd,\n resource.startTime\n )\n this.calcProcessTime()\n }\n }\n\n private calcProcessTime() {\n this.duration = this.entry.duration\n if (performance.getEntriesByName !== undefined) {\n const entries = performance.getEntriesByName(\n `${this.name}-${this.entry.startTime}`,\n 'measure'\n )\n if (entries.length > 0) {\n const measure = entries[entries.length - 1] as PerformanceMeasure\n const resource = this.entry as PerformanceResourceTiming\n this.processStart = resource.responseEnd\n this.processEnd = resource.responseEnd + measure.duration\n this.processDuration = measure.duration\n this.duration += measure.duration\n }\n }\n }\n\n get name() {\n return this.entry.name\n }\n}\n\n/**\n * Performance API utility class\n *\n * Defaults to \"resource\" types\n * */\nexport class PerfTimings {\n private _full = false\n private _bufferSize = 0\n private static _supported: boolean | undefined = undefined\n\n /** Are performance timings supported in this runtime? */\n public static get supported() {\n if (PerfTimings._supported === undefined) {\n // This gyration is necessary to avoid IDEA-based exceptions about performance being undefined,\n // which it may be, but this now throws up in IDEA\n try {\n PerfTimings._supported = performance !== undefined\n } catch {\n PerfTimings._supported = false\n }\n }\n return PerfTimings._supported\n }\n\n public static set supported(value: boolean) {\n PerfTimings._supported = value\n }\n\n constructor() {\n if (PerfTimings.supported) {\n performance.onresourcetimingbufferfull = (_ev) => (this._full = true)\n // https://developer.mozilla.org/en-US/docs/Web/API/Performance/setResourceTimingBufferSize\n // says the buffer size should be at least 150, but I don't know if we need to set it\n // this.bufferSize = 50 // TODO what's the default bufferSize? Does it vary by browser?\n }\n }\n\n clear() {\n if (!PerfTimings.supported) return false\n if (performance.clearResourceTimings !== undefined)\n performance.clearResourceTimings()\n if (performance.clearMarks !== undefined) performance.clearMarks()\n if (performance.clearMeasures !== undefined) performance.clearMeasures()\n this._full = this.entries().length === 0\n return this._full\n }\n\n entries(pattern = '.*', type = 'resource') {\n // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry\n if (PerfTimings.supported) {\n const ex = new RegExp(pattern, 'i')\n return performance\n .getEntriesByType(type)\n .filter((p) => ex.test(p.name))\n .map((p) => new LoadTimes(p))\n }\n return []\n }\n\n get bufferSize() {\n return this._bufferSize\n }\n\n set bufferSize(value) {\n if (\n PerfTimings.supported &&\n typeof performance.setResourceTimingBufferSize !== undefined\n ) {\n this._bufferSize = value\n performance.setResourceTimingBufferSize(value)\n }\n }\n\n get isFull() {\n return this._full\n }\n}\n"],"mappings":";;;;;;;;;AAiDO,IAAMA,SAAS,GAAIC,GAAW,IACnCC,IAAI,CAACC,KAAK,CAAC,CAACF,GAAG,GAAGG,MAAM,CAACC,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK;AAAAC,OAAA,CAAAN,SAAA,GAAAA,SAAA;AAQpD,IAAMO,IAAI,GAAGA,CAACC,GAAW,EAAEC,KAAa,KAAKT,SAAS,CAACQ,GAAG,GAAGC,KAAK,CAAC;AAE5D,MAAMC,SAAS,CAA+B;EAcnDC,WAAWA,CAAQC,KAAuB,EAAE;IAAA,KAAzBA,KAAuB,GAAvBA,KAAuB;IAAAC,eAAA,mBAb/B,CAAC;IAAAA,eAAA,mBACD,CAAC;IAAAA,eAAA,uBACG,CAAC;IAAAA,eAAA,kBACN,CAAC;IAAAA,eAAA,2BACQ,CAAC;IAAAA,eAAA,uBACL,CAAC;IAAAA,eAAA,gCACQ,CAAC;IAAAA,eAAA,kCACC,CAAC;IAAAA,eAAA,gCACH,CAAC;IAAAA,eAAA,uBACV,CAAC;IAAAA,eAAA,qBACH,CAAC;IAAAA,eAAA,0BACI,CAAC;IAGjB,IAAI,eAAe,IAAID,KAAK,EAAE;MAG5B,IAAME,QAAQ,GAAGF,KAAkC;MACnD,IAAI,CAACG,QAAQ,GAAGR,IAAI,CAACO,QAAQ,CAACE,WAAW,EAAEF,QAAQ,CAACG,aAAa,CAAC;MAClE,IAAI,CAACC,YAAY,GAAGX,IAAI,CACtBO,QAAQ,CAACK,eAAe,EACxBL,QAAQ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,OAAA,CAAA0C,WAAA,GAAAA,WAAA;AAAAnC,eAAA,CAvEYmC,WAAW,gBAG2BT,SAAS"}
1
+ {"version":3,"file":"perfUtils.js","names":["perfRound","num","Math","round","Number","EPSILON","diff","end","start","LoadTimes","constructor","entry","_defineProperty","resource","redirect","redirectEnd","redirectStart","domainLookup","domainLookupEnd","domainLookupStart","connect","connectEnd","connectStart","secureConnectionStart","secureConnection","responseTime","responseEnd","responseStart","fetchStart","fetchUntilResponseEnd","requestStart","requestUntilResponseEnd","startTime","startUntilResponseEnd","calcProcessTime","duration","performance","getEntriesByName","undefined","entries","concat","name","length","measure","processStart","processEnd","processDuration","PerfTimings","supported","_supported","_unused","value","onresourcetimingbufferfull","_ev","_full","clear","clearResourceTimings","clearMarks","clearMeasures","pattern","arguments","type","ex","RegExp","getEntriesByType","filter","p","test","map","bufferSize","_bufferSize","setResourceTimingBufferSize","isFull"],"sources":["../../../../src/components/PerfTracker/perfUtils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\n/**\n * Calculation of Load times for a resource performance entry\n */\nexport interface IResourceLoadTimes {\n entry: PerformanceEntry\n name: string\n duration: number\n redirect: number\n domainLookup: number\n connect: number\n secureConnection: number\n responseTime: number\n fetchUntilResponseEnd: number\n requestUntilResponseEnd: number\n startUntilResponseEnd: number\n processStart: number\n processEnd: number\n processDuration: number\n}\n\n/**\n * Rounds a number to 3 decimal places\n */\nexport const perfRound = (num: number) =>\n Math.round((num + Number.EPSILON) * 10000) / 10000\n\n/**\n * Round and scale (if needed) the difference in performance metrics\n * @param end of high precision timer metric\n * @param start of high precision timer metric\n * @returns rounded difference of end - start\n */\nconst diff = (end: number, start: number) => perfRound(end - start)\n\nexport class LoadTimes implements IResourceLoadTimes {\n duration = 0\n redirect = 0\n domainLookup = 0\n connect = 0\n secureConnection = 0\n responseTime = 0\n fetchUntilResponseEnd = 0\n requestUntilResponseEnd = 0\n startUntilResponseEnd = 0\n processStart = 0\n processEnd = 0\n processDuration = 0\n\n constructor(public entry: PerformanceEntry) {\n if ('redirectStart' in entry) {\n // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming\n // Either a `PerformanceResourceTiming` or `PerformanceTiming` instance\n const resource = entry as PerformanceResourceTiming\n this.redirect = diff(resource.redirectEnd, resource.redirectStart)\n this.domainLookup = diff(\n resource.domainLookupEnd,\n resource.domainLookupStart\n )\n this.connect = diff(resource.connectEnd, resource.connectStart)\n if (resource.secureConnectionStart > 0)\n this.secureConnection = diff(\n resource.connectEnd,\n resource.secureConnectionStart\n )\n this.responseTime = diff(resource.responseEnd, resource.responseStart)\n if (resource.fetchStart > 0)\n this.fetchUntilResponseEnd = diff(\n resource.responseEnd,\n resource.fetchStart\n )\n if (resource.requestStart > 0)\n this.requestUntilResponseEnd = diff(\n resource.responseEnd,\n resource.requestStart\n )\n if (resource.startTime > 0)\n this.startUntilResponseEnd = diff(\n resource.responseEnd,\n resource.startTime\n )\n this.calcProcessTime()\n }\n }\n\n private calcProcessTime() {\n this.duration = this.entry.duration\n if (performance.getEntriesByName !== undefined) {\n const entries = performance.getEntriesByName(\n `${this.name}-${this.entry.startTime}`,\n 'measure'\n )\n if (entries.length > 0) {\n const measure = entries[entries.length - 1] as PerformanceMeasure\n const resource = this.entry as PerformanceResourceTiming\n this.processStart = resource.responseEnd\n this.processEnd = resource.responseEnd + measure.duration\n this.processDuration = measure.duration\n this.duration += measure.duration\n }\n }\n }\n\n get name() {\n return this.entry.name\n }\n}\n\n/**\n * Performance API utility class\n *\n * Defaults to \"resource\" types\n * */\nexport class PerfTimings {\n private _full = false\n private _bufferSize = 0\n private static _supported: boolean | undefined = undefined\n\n /** Are performance timings supported in this runtime? */\n public static get supported() {\n if (PerfTimings._supported === undefined) {\n // This gyration is necessary to avoid IDEA-based exceptions about performance being undefined,\n // which it may be, but this now throws up in IDEA\n try {\n PerfTimings._supported = performance !== undefined\n } catch {\n PerfTimings._supported = false\n }\n }\n return PerfTimings._supported\n }\n\n public static set supported(value: boolean) {\n PerfTimings._supported = value\n }\n\n constructor() {\n if (PerfTimings.supported) {\n performance.onresourcetimingbufferfull = (_ev) => (this._full = true)\n // https://developer.mozilla.org/en-US/docs/Web/API/Performance/setResourceTimingBufferSize\n // says the buffer size should be at least 150, but I don't know if we need to set it\n // this.bufferSize = 50 // TODO what's the default bufferSize? Does it vary by browser?\n }\n }\n\n clear() {\n if (!PerfTimings.supported) return false\n if (performance.clearResourceTimings !== undefined)\n performance.clearResourceTimings()\n if (performance.clearMarks !== undefined) performance.clearMarks()\n if (performance.clearMeasures !== undefined) performance.clearMeasures()\n this._full = this.entries().length === 0\n return this._full\n }\n\n entries(pattern = '.*', type = 'resource') {\n // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry\n if (PerfTimings.supported) {\n const ex = new RegExp(pattern, 'i')\n return performance\n .getEntriesByType(type)\n .filter((p) => ex.test(p.name))\n .map((p) => new LoadTimes(p))\n }\n return []\n }\n\n get bufferSize() {\n return this._bufferSize\n }\n\n set bufferSize(value) {\n if (\n PerfTimings.supported &&\n typeof performance.setResourceTimingBufferSize !== undefined\n ) {\n this._bufferSize = value\n performance.setResourceTimingBufferSize(value)\n }\n }\n\n get isFull() {\n return this._full\n }\n}\n"],"mappings":";;;AAiDA,OAAO,IAAMA,SAAS,GAAIC,GAAW,IACnCC,IAAI,CAACC,KAAK,CAAC,CAACF,GAAG,GAAGG,MAAM,CAACC,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK;AAQpD,IAAMC,IAAI,GAAGA,CAACC,GAAW,EAAEC,KAAa,KAAKR,SAAS,CAACO,GAAG,GAAGC,KAAK,CAAC;AAEnE,OAAO,MAAMC,SAAS,CAA+B;EAcnDC,WAAWA,CAAQC,KAAuB,EAAE;IAAA,KAAzBA,KAAuB,GAAvBA,KAAuB;IAAAC,eAAA,mBAb/B,CAAC;IAAAA,eAAA,mBACD,CAAC;IAAAA,eAAA,uBACG,CAAC;IAAAA,eAAA,kBACN,CAAC;IAAAA,eAAA,2BACQ,CAAC;IAAAA,eAAA,uBACL,CAAC;IAAAA,eAAA,gCACQ,CAAC;IAAAA,eAAA,kCACC,CAAC;IAAAA,eAAA,gCACH,CAAC;IAAAA,eAAA,uBACV,CAAC;IAAAA,eAAA,qBACH,CAAC;IAAAA,eAAA,0BACI,CAAC;IAGjB,IAAI,eAAe,IAAID,KAAK,EAAE;MAG5B,IAAME,QAAQ,GAAGF,KAAkC;MACnD,IAAI,CAACG,QAAQ,GAAGR,IAAI,CAACO,QAAQ,CAACE,WAAW,EAAEF,QAAQ,CAACG,aAAa,CAAC;MAClE,IAAI,CAACC,YAAY,GAAGX,IAAI,CACtBO,QAAQ,CAACK,eAAe,EACxBL,QAAQ,CAACM,iBACX,CAAC;MACD,IAAI,CAACC,OAAO,GAAGd,IAAI,CAACO,QAAQ,CAACQ,UAAU,EAAER,QAAQ,CAACS,YAAY,CAAC;MAC/D,IAAIT,QAAQ,CAACU,qBAAqB,GA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AAK,GAAG,IAAI,CAACf,OAAO,CAAC,CAAC,CAACG,MAAM,KAAK,CAAC;IACxC,OAAO,IAAI,CAACY,KAAK;EACnB;EAEAf,OAAOA,CAAA,EAAoC;IAAA,IAAnCoB,OAAO,GAAAC,SAAA,CAAAlB,MAAA,QAAAkB,SAAA,QAAAtB,SAAA,GAAAsB,SAAA,MAAG,IAAI;IAAA,IAAEC,IAAI,GAAAD,SAAA,CAAAlB,MAAA,QAAAkB,SAAA,QAAAtB,SAAA,GAAAsB,SAAA,MAAG,UAAU;IAEvC,IAAIb,WAAW,CAACC,SAAS,EAAE;MACzB,IAAMc,EAAE,GAAG,IAAIC,MAAM,CAACJ,OAAO,EAAE,GAAG,CAAC;MACnC,OAAOvB,WAAW,CACf4B,gBAAgB,CAACH,IAAI,CAAC,CACtBI,MAAM,CAAEC,CAAC,IAAKJ,EAAE,CAACK,IAAI,CAACD,CAAC,CAACzB,IAAI,CAAC,CAAC,CAC9B2B,GAAG,CAAEF,CAAC,IAAK,IAAIzD,SAAS,CAACyD,CAAC,CAAC,CAAC;IACjC;IACA,OAAO,EAAE;EACX;EAEA,IAAIG,UAAUA,CAAA,EAAG;IACf,OAAO,IAAI,CAACC,WAAW;EACzB;EAEA,IAAID,UAAUA,CAAClB,KAAK,EAAE;IACpB,IACEJ,WAAW,CAACC,SAAS,IACrB,OAAOZ,WAAW,CAACmC,2BAA2B,KAAKjC,SAAS,EAC5D;MACA,IAAI,CAACgC,WAAW,GAAGnB,KAAK;MACxBf,WAAW,CAACmC,2BAA2B,CAACpB,KAAK,CAAC;IAChD;EACF;EAEA,IAAIqB,MAAMA,CAAA,EAAG;IACX,OAAO,IAAI,CAAClB,KAAK;EACnB;AACF;AAAC1C,eAAA,CAvEYmC,WAAW,gBAG2BT,SAAS"}
@@ -1,30 +1,22 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.FormItem = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _components = require("@looker/components");
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- var FormItem = _ref => {
1
+ import React from 'react';
2
+ import { Space, Box, Label } from '@looker/components';
3
+ export var FormItem = _ref => {
11
4
  var {
12
5
  id,
13
6
  children,
14
7
  label = ' '
15
8
  } = _ref;
16
9
  var key = "space_".concat(id);
17
- return _react.default.createElement(_components.Space, {
10
+ return React.createElement(Space, {
18
11
  id: key,
19
12
  key: key
20
- }, _react.default.createElement(_components.Box, {
13
+ }, React.createElement(Box, {
21
14
  key: "".concat(key, "_box"),
22
15
  width: "120px",
23
16
  flexShrink: 0
24
- }, _react.default.createElement(_components.Label, {
17
+ }, React.createElement(Label, {
25
18
  key: "".concat(key, "_label_for"),
26
19
  htmlFor: id
27
20
  }, label)), children);
28
21
  };
29
- exports.FormItem = FormItem;
30
22
  //# sourceMappingURL=FormItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormItem.js","names":["_react","_interopRequireDefault","require","_components","obj","__esModule","default","FormItem","_ref","id","children","label","key","concat","createElement","Space","Box","width","flexShrink","Label","htmlFor","exports"],"sources":["../../../../src/components/RequestForm/FormItem.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport type { FC, ReactElement } from 'react'\nimport React from 'react'\nimport { Space, Box, Label } from '@looker/components'\n\ninterface FormItemProps {\n /** ID of input item for label */\n id: string\n /** Optional label. Defaults to an empty string so spacing is preserved */\n label?: string | ReactElement\n /** Nested react elements */\n children: ReactElement\n}\n\n/**\n * basic input form layout component\n * @param id of input item\n * @param children embedded react elements\n * @param label optional label\n */\nexport const FormItem: FC<FormItemProps> = ({ id, children, label = ' ' }) => {\n const key = `space_${id}`\n return (\n <Space id={key} key={key}>\n <Box key={`${key}_box`} width=\"120px\" flexShrink={0}>\n <Label key={`${key}_label_for`} htmlFor={id}>\n {label}\n </Label>\n </Box>\n {children}\n </Space>\n )\n}\n"],"mappings":";;;;;;AA0BA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAAsD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAiB/C,IAAMG,QAA2B,GAAGC,IAAA,IAAmC;EAAA,IAAlC;IAAEC,EAAE;IAAEC,QAAQ;IAAEC,KAAK,GAAG;EAAI,CAAC,GAAAH,IAAA;EACvE,IAAMI,GAAG,YAAAC,MAAA,CAAYJ,EAAE,CAAE;EACzB,OACET,MAAA,CAAAM,OAAA,CAAAQ,aAAA,CAACX,WAAA,CAAAY,KAAK;IAACN,EAAE,EAAEG,GAAI;IAACA,GAAG,EAAEA;EAAI,GACvBZ,MAAA,CAAAM,OAAA,CAAAQ,aAAA,CAACX,WAAA,CAAAa,GAAG;IAACJ,GAAG,KAAAC,MAAA,CAAKD,GAAG,SAAO;IAACK,KAAK,EAAC,OAAO;IAACC,UAAU,EAAE;EAAE,GAClDlB,MAAA,CAAAM,OAAA,CAAAQ,aAAA,CAACX,WAAA,CAAAgB,KAAK;IAACP,GAAG,KAAAC,MAAA,CAAKD,GAAG,eAAa;IAACQ,OAAO,EAAEX;EAAG,GACzCE,KAAK,CACA,CACJ,EACLD,QAAQ,CACH;AAEZ,CAAC;AAAAW,OAAA,CAAAd,QAAA,GAAAA,QAAA"}
1
+ {"version":3,"file":"FormItem.js","names":["React","Space","Box","Label","FormItem","_ref","id","children","label","key","concat","createElement","width","flexShrink","htmlFor"],"sources":["../../../../src/components/RequestForm/FormItem.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport type { FC, ReactElement } from 'react'\nimport React from 'react'\nimport { Space, Box, Label } from '@looker/components'\n\ninterface FormItemProps {\n /** ID of input item for label */\n id: string\n /** Optional label. Defaults to an empty string so spacing is preserved */\n label?: string | ReactElement\n /** Nested react elements */\n children: ReactElement\n}\n\n/**\n * basic input form layout component\n * @param id of input item\n * @param children embedded react elements\n * @param label optional label\n */\nexport const FormItem: FC<FormItemProps> = ({ id, children, label = ' ' }) => {\n const key = `space_${id}`\n return (\n <Space id={key} key={key}>\n <Box key={`${key}_box`} width=\"120px\" flexShrink={0}>\n <Label key={`${key}_label_for`} htmlFor={id}>\n {label}\n </Label>\n </Box>\n {children}\n </Space>\n )\n}\n"],"mappings":"AA0BA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,EAAEC,GAAG,EAAEC,KAAK,QAAQ,oBAAoB;AAiBtD,OAAO,IAAMC,QAA2B,GAAGC,IAAA,IAAmC;EAAA,IAAlC;IAAEC,EAAE;IAAEC,QAAQ;IAAEC,KAAK,GAAG;EAAI,CAAC,GAAAH,IAAA;EACvE,IAAMI,GAAG,YAAAC,MAAA,CAAYJ,EAAE,CAAE;EACzB,OACEN,KAAA,CAAAW,aAAA,CAACV,KAAK;IAACK,EAAE,EAAEG,GAAI;IAACA,GAAG,EAAEA;EAAI,GACvBT,KAAA,CAAAW,aAAA,CAACT,GAAG;IAACO,GAAG,KAAAC,MAAA,CAAKD,GAAG,SAAO;IAACG,KAAK,EAAC,OAAO;IAACC,UAAU,EAAE;EAAE,GAClDb,KAAA,CAAAW,aAAA,CAACR,KAAK;IAACM,GAAG,KAAAC,MAAA,CAAKD,GAAG,eAAa;IAACK,OAAO,EAAER;EAAG,GACzCE,KACI,CACJ,CAAC,EACLD,QACI,CAAC;AAEZ,CAAC"}