@looker/run-it 0.9.43-alpha.1650 → 0.9.43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/lib/RunIt.js +12 -28
  3. package/lib/RunIt.js.map +1 -1
  4. package/lib/RunItProvider.js +0 -6
  5. package/lib/RunItProvider.js.map +1 -1
  6. package/lib/components/Collapser/CollapserCard.js +0 -8
  7. package/lib/components/Collapser/CollapserCard.js.map +1 -1
  8. package/lib/components/Collapser/index.js +0 -1
  9. package/lib/components/Collapser/index.js.map +1 -1
  10. package/lib/components/ConfigForm/ConfigForm.js +5 -52
  11. package/lib/components/ConfigForm/ConfigForm.js.map +1 -1
  12. package/lib/components/ConfigForm/index.js +0 -4
  13. package/lib/components/ConfigForm/index.js.map +1 -1
  14. package/lib/components/ConfigForm/utils.js +5 -21
  15. package/lib/components/ConfigForm/utils.js.map +1 -1
  16. package/lib/components/CopyLinkWrapper/CopyLinkWrapper.js +0 -16
  17. package/lib/components/CopyLinkWrapper/CopyLinkWrapper.js.map +1 -1
  18. package/lib/components/CopyLinkWrapper/index.js +0 -1
  19. package/lib/components/CopyLinkWrapper/index.js.map +1 -1
  20. package/lib/components/DataGrid/DataGrid.d.ts +2 -2
  21. package/lib/components/DataGrid/DataGrid.js +1 -9
  22. package/lib/components/DataGrid/DataGrid.js.map +1 -1
  23. package/lib/components/DataGrid/gridUtils.js +1 -22
  24. package/lib/components/DataGrid/gridUtils.js.map +1 -1
  25. package/lib/components/DataGrid/index.js +4 -6
  26. package/lib/components/DataGrid/index.js.map +1 -1
  27. package/lib/components/DocSdkCalls/DocMultiCall.js +0 -6
  28. package/lib/components/DocSdkCalls/DocMultiCall.js.map +1 -1
  29. package/lib/components/DocSdkCalls/DocSdkCalls.d.ts +1 -0
  30. package/lib/components/DocSdkCalls/DocSdkCalls.js +5 -17
  31. package/lib/components/DocSdkCalls/DocSdkCalls.js.map +1 -1
  32. package/lib/components/DocSdkCalls/callUtils.js +0 -5
  33. package/lib/components/DocSdkCalls/callUtils.js.map +1 -1
  34. package/lib/components/DocSdkCalls/index.js +4 -6
  35. package/lib/components/DocSdkCalls/index.js.map +1 -1
  36. package/lib/components/Loading/Loading.js +0 -5
  37. package/lib/components/Loading/Loading.js.map +1 -1
  38. package/lib/components/Loading/index.js +0 -1
  39. package/lib/components/Loading/index.js.map +1 -1
  40. package/lib/components/LoginForm/LoginForm.js +1 -16
  41. package/lib/components/LoginForm/LoginForm.js.map +1 -1
  42. package/lib/components/LoginForm/index.js +0 -1
  43. package/lib/components/LoginForm/index.js.map +1 -1
  44. package/lib/components/MethodBadge/MethodBadge.js +1 -16
  45. package/lib/components/MethodBadge/MethodBadge.js.map +1 -1
  46. package/lib/components/MethodBadge/index.js +0 -1
  47. package/lib/components/MethodBadge/index.js.map +1 -1
  48. package/lib/components/PerfTracker/PerfChart.js +0 -12
  49. package/lib/components/PerfTracker/PerfChart.js.map +1 -1
  50. package/lib/components/PerfTracker/PerfTable.js +0 -9
  51. package/lib/components/PerfTracker/PerfTable.js.map +1 -1
  52. package/lib/components/PerfTracker/PerfTracker.js +0 -18
  53. package/lib/components/PerfTracker/PerfTracker.js.map +1 -1
  54. package/lib/components/PerfTracker/index.js +4 -6
  55. package/lib/components/PerfTracker/index.js.map +1 -1
  56. package/lib/components/PerfTracker/perfTableUtils.d.ts +1 -1
  57. package/lib/components/PerfTracker/perfTableUtils.js +2 -18
  58. package/lib/components/PerfTracker/perfTableUtils.js.map +1 -1
  59. package/lib/components/PerfTracker/perfUtils.js +4 -42
  60. package/lib/components/PerfTracker/perfUtils.js.map +1 -1
  61. package/lib/components/RequestForm/FormItem.js +0 -5
  62. package/lib/components/RequestForm/FormItem.js.map +1 -1
  63. package/lib/components/RequestForm/RequestForm.d.ts +3 -1
  64. package/lib/components/RequestForm/RequestForm.js +25 -23
  65. package/lib/components/RequestForm/RequestForm.js.map +1 -1
  66. package/lib/components/RequestForm/formUtils.d.ts +1 -0
  67. package/lib/components/RequestForm/formUtils.js +9 -47
  68. package/lib/components/RequestForm/formUtils.js.map +1 -1
  69. package/lib/components/RequestForm/index.js +0 -2
  70. package/lib/components/RequestForm/index.js.map +1 -1
  71. package/lib/components/ResponseExplorer/ResponseExplorer.js +2 -22
  72. package/lib/components/ResponseExplorer/ResponseExplorer.js.map +1 -1
  73. package/lib/components/ResponseExplorer/index.js +0 -2
  74. package/lib/components/ResponseExplorer/index.js.map +1 -1
  75. package/lib/components/ShowResponse/ShowResponse.js +0 -7
  76. package/lib/components/ShowResponse/ShowResponse.js.map +1 -1
  77. package/lib/components/ShowResponse/index.js +0 -1
  78. package/lib/components/ShowResponse/index.js.map +1 -1
  79. package/lib/components/ShowResponse/responseUtils.js +4 -49
  80. package/lib/components/ShowResponse/responseUtils.js.map +1 -1
  81. package/lib/components/common/common.d.ts +2 -2
  82. package/lib/components/common/common.js +1 -5
  83. package/lib/components/common/common.js.map +1 -1
  84. package/lib/components/common/index.js +0 -1
  85. package/lib/components/common/index.js.map +1 -1
  86. package/lib/components/index.js +0 -26
  87. package/lib/components/index.js.map +1 -1
  88. package/lib/esm/RunIt.js +65 -62
  89. package/lib/esm/RunIt.js.map +1 -1
  90. package/lib/esm/RunItProvider.js +14 -4
  91. package/lib/esm/RunItProvider.js.map +1 -1
  92. package/lib/esm/components/Collapser/CollapserCard.js +22 -14
  93. package/lib/esm/components/Collapser/CollapserCard.js.map +1 -1
  94. package/lib/esm/components/Collapser/index.js +12 -1
  95. package/lib/esm/components/Collapser/index.js.map +1 -1
  96. package/lib/esm/components/ConfigForm/ConfigForm.js +63 -89
  97. package/lib/esm/components/ConfigForm/ConfigForm.js.map +1 -1
  98. package/lib/esm/components/ConfigForm/index.js +27 -2
  99. package/lib/esm/components/ConfigForm/index.js.map +1 -1
  100. package/lib/esm/components/ConfigForm/utils.js +25 -21
  101. package/lib/esm/components/ConfigForm/utils.js.map +1 -1
  102. package/lib/esm/components/CopyLinkWrapper/CopyLinkWrapper.js +22 -19
  103. package/lib/esm/components/CopyLinkWrapper/CopyLinkWrapper.js.map +1 -1
  104. package/lib/esm/components/CopyLinkWrapper/index.js +12 -1
  105. package/lib/esm/components/CopyLinkWrapper/index.js.map +1 -1
  106. package/lib/esm/components/DataGrid/DataGrid.js +25 -17
  107. package/lib/esm/components/DataGrid/DataGrid.js.map +1 -1
  108. package/lib/esm/components/DataGrid/gridUtils.js +26 -15
  109. package/lib/esm/components/DataGrid/gridUtils.js.map +1 -1
  110. package/lib/esm/components/DataGrid/index.js +25 -2
  111. package/lib/esm/components/DataGrid/index.js.map +1 -1
  112. package/lib/esm/components/DocSdkCalls/DocMultiCall.js +15 -7
  113. package/lib/esm/components/DocSdkCalls/DocMultiCall.js.map +1 -1
  114. package/lib/esm/components/DocSdkCalls/DocSdkCalls.js +30 -22
  115. package/lib/esm/components/DocSdkCalls/DocSdkCalls.js.map +1 -1
  116. package/lib/esm/components/DocSdkCalls/callUtils.js +10 -3
  117. package/lib/esm/components/DocSdkCalls/callUtils.js.map +1 -1
  118. package/lib/esm/components/DocSdkCalls/index.js +19 -2
  119. package/lib/esm/components/DocSdkCalls/index.js.map +1 -1
  120. package/lib/esm/components/Loading/Loading.js +14 -6
  121. package/lib/esm/components/Loading/Loading.js.map +1 -1
  122. package/lib/esm/components/Loading/index.js +12 -1
  123. package/lib/esm/components/Loading/index.js.map +1 -1
  124. package/lib/esm/components/LoginForm/LoginForm.js +21 -18
  125. package/lib/esm/components/LoginForm/LoginForm.js.map +1 -1
  126. package/lib/esm/components/LoginForm/index.js +18 -1
  127. package/lib/esm/components/LoginForm/index.js.map +1 -1
  128. package/lib/esm/components/MethodBadge/MethodBadge.js +19 -13
  129. package/lib/esm/components/MethodBadge/MethodBadge.js.map +1 -1
  130. package/lib/esm/components/MethodBadge/index.js +12 -1
  131. package/lib/esm/components/MethodBadge/index.js.map +1 -1
  132. package/lib/esm/components/PerfTracker/PerfChart.js +18 -16
  133. package/lib/esm/components/PerfTracker/PerfChart.js.map +1 -1
  134. package/lib/esm/components/PerfTracker/PerfTable.js +22 -15
  135. package/lib/esm/components/PerfTracker/PerfTable.js.map +1 -1
  136. package/lib/esm/components/PerfTracker/PerfTracker.js +33 -31
  137. package/lib/esm/components/PerfTracker/PerfTracker.js.map +1 -1
  138. package/lib/esm/components/PerfTracker/index.js +19 -2
  139. package/lib/esm/components/PerfTracker/index.js.map +1 -1
  140. package/lib/esm/components/PerfTracker/perfTableUtils.js +28 -26
  141. package/lib/esm/components/PerfTracker/perfTableUtils.js.map +1 -1
  142. package/lib/esm/components/PerfTracker/perfUtils.js +15 -39
  143. package/lib/esm/components/PerfTracker/perfUtils.js.map +1 -1
  144. package/lib/esm/components/RequestForm/FormItem.js +14 -6
  145. package/lib/esm/components/RequestForm/FormItem.js.map +1 -1
  146. package/lib/esm/components/RequestForm/RequestForm.js +50 -32
  147. package/lib/esm/components/RequestForm/RequestForm.js.map +1 -1
  148. package/lib/esm/components/RequestForm/formUtils.js +47 -53
  149. package/lib/esm/components/RequestForm/formUtils.js.map +1 -1
  150. package/lib/esm/components/RequestForm/index.js +19 -2
  151. package/lib/esm/components/RequestForm/index.js.map +1 -1
  152. package/lib/esm/components/ResponseExplorer/ResponseExplorer.js +41 -35
  153. package/lib/esm/components/ResponseExplorer/ResponseExplorer.js.map +1 -1
  154. package/lib/esm/components/ResponseExplorer/index.js +16 -1
  155. package/lib/esm/components/ResponseExplorer/index.js.map +1 -1
  156. package/lib/esm/components/ShowResponse/ShowResponse.js +14 -8
  157. package/lib/esm/components/ShowResponse/ShowResponse.js.map +1 -1
  158. package/lib/esm/components/ShowResponse/index.js +12 -1
  159. package/lib/esm/components/ShowResponse/index.js.map +1 -1
  160. package/lib/esm/components/ShowResponse/responseUtils.js +43 -61
  161. package/lib/esm/components/ShowResponse/responseUtils.js.map +1 -1
  162. package/lib/esm/components/common/common.js +13 -4
  163. package/lib/esm/components/common/common.js.map +1 -1
  164. package/lib/esm/components/common/index.js +18 -1
  165. package/lib/esm/components/common/index.js.map +1 -1
  166. package/lib/esm/components/index.js +148 -13
  167. package/lib/esm/components/index.js.map +1 -1
  168. package/lib/esm/index.js +49 -4
  169. package/lib/esm/index.js.map +1 -1
  170. package/lib/esm/test-data/index.js +68 -0
  171. package/lib/esm/test-data/index.js.map +1 -0
  172. package/lib/esm/test-data/responses.js +139 -0
  173. package/lib/esm/test-data/responses.js.map +1 -0
  174. package/lib/esm/test-data/specs.js +11 -0
  175. package/lib/esm/test-data/specs.js.map +1 -0
  176. package/lib/esm/utils/RunItSDK.js +25 -20
  177. package/lib/esm/utils/RunItSDK.js.map +1 -1
  178. package/lib/esm/utils/index.js +27 -2
  179. package/lib/esm/utils/index.js.map +1 -1
  180. package/lib/esm/utils/requestUtils.js +42 -64
  181. package/lib/esm/utils/requestUtils.js.map +1 -1
  182. package/lib/index.js +0 -8
  183. package/lib/index.js.map +1 -1
  184. package/lib/test-data/index.js +20 -22
  185. package/lib/test-data/index.js.map +1 -1
  186. package/lib/test-data/responses.js +1 -3
  187. package/lib/test-data/responses.js.map +1 -1
  188. package/lib/test-data/specs.js +0 -4
  189. package/lib/test-data/specs.js.map +1 -1
  190. package/lib/utils/RunItSDK.js +6 -15
  191. package/lib/utils/RunItSDK.js.map +1 -1
  192. package/lib/utils/index.js +0 -4
  193. package/lib/utils/index.js.map +1 -1
  194. package/lib/utils/requestUtils.d.ts +1 -1
  195. package/lib/utils/requestUtils.js +4 -61
  196. package/lib/utils/requestUtils.js.map +1 -1
  197. package/package.json +20 -19
@@ -1,40 +1,44 @@
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';
1
+ "use strict";
9
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; }
10
17
  var perfFilter = function perfFilter() {
11
18
  var all = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
12
19
  if (all) return '.*';
13
- var value = localStorage.getItem(RunItConfigKey);
20
+ var value = localStorage.getItem(_ConfigForm.RunItConfigKey);
14
21
  if (!value) return '.*';
15
22
  var config = JSON.parse(value);
16
23
  var url = new URL(config.base_url);
17
24
  return "".concat(url.protocol, "//").concat(url.hostname, ".*");
18
25
  };
19
-
20
- export var PerfTracker = _ref => {
26
+ var PerfTracker = _ref => {
21
27
  var {
22
- perf = new PerfTimings(),
28
+ perf = new _perfUtils.PerfTimings(),
23
29
  showAllColumns = false
24
30
  } = _ref;
25
- var [loading, setLoading] = useState(false);
26
- var [showAll, setShowAll] = useState(false);
27
- var [filter, setFilter] = useState(perfFilter());
28
- var [data, setData] = useState(perf.entries(filter));
29
- var [timings, setTimings] = useState(data.length > 0 ? data[0] : undefined);
30
-
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);
31
36
  var handleClear = _ => {
32
37
  setLoading(true);
33
38
  perf.clear();
34
39
  setData([]);
35
40
  setTimings(undefined);
36
41
  };
37
-
38
42
  var handleFilterChange = e => {
39
43
  setLoading(true);
40
44
  var all = e.target.checked;
@@ -43,32 +47,30 @@ export var PerfTracker = _ref => {
43
47
  setFilter(pf);
44
48
  setData(perf.entries(pf));
45
49
  };
46
-
47
- useEffect(() => {
50
+ (0, _react.useEffect)(() => {
48
51
  setLoading(false);
49
52
  }, [data]);
50
-
51
53
  var handleSelect = item => setTimings(item);
52
-
53
- 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, {
54
- icon: React.createElement(Delete, null),
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),
55
56
  onClick: handleClear,
56
57
  label: "Clear the performance queue"
57
- })), React.createElement(FlexItem, null, React.createElement(FieldToggleSwitch, {
58
+ })), _react.default.createElement(_components.FlexItem, null, _react.default.createElement(_components.FieldToggleSwitch, {
58
59
  name: "filtering",
59
60
  label: "Show All",
60
61
  onChange: handleFilterChange,
61
62
  on: showAll
62
- })), React.createElement(FlexItem, null, React.createElement(Loading, {
63
+ })), _react.default.createElement(_components.FlexItem, null, _react.default.createElement(_Loading.Loading, {
63
64
  loading: loading
64
- }))), React.createElement(React.Fragment, null, !PerfTimings.supported && 'Performance timing is not supported in this browser', PerfTimings.supported && !!timings && React.createElement(SpaceVertical, {
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, {
65
66
  gap: "small"
66
- }, React.createElement(PerfChart, {
67
+ }, _react.default.createElement(_PerfChart.PerfChart, {
67
68
  loadTimes: timings
68
- }), React.createElement(PerfTable, {
69
+ }), _react.default.createElement(_PerfTable.PerfTable, {
69
70
  data: data,
70
71
  onSelect: handleSelect,
71
72
  showAllColumns: showAllColumns
72
- })), PerfTimings.supported && data.length < 1 && 'No performance data is loaded'));
73
+ })), _perfUtils.PerfTimings.supported && data.length < 1 && 'No performance data is loaded'));
73
74
  };
75
+ exports.PerfTracker = PerfTracker;
74
76
  //# sourceMappingURL=PerfTracker.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/PerfTracker/PerfTracker.tsx"],"names":["React","useEffect","useState","Heading","FlexItem","IconButton","SpaceVertical","FieldToggleSwitch","Flex","Delete","RunItConfigKey","Loading","PerfTimings","PerfChart","PerfTable","perfFilter","all","value","localStorage","getItem","config","JSON","parse","url","URL","base_url","protocol","hostname","PerfTracker","perf","showAllColumns","loading","setLoading","showAll","setShowAll","filter","setFilter","data","setData","entries","timings","setTimings","length","undefined","handleClear","_","clear","handleFilterChange","e","target","checked","pf","handleSelect","item","supported"],"mappings":"AA2BA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SACEC,OADF,EAEEC,QAFF,EAGEC,UAHF,EAIEC,aAJF,EAKEC,iBALF,EAMEC,IANF,QAOO,oBAPP;AAQA,SAASC,MAAT,QAA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AW,CAAC0C,SAAb,IACC,qDAFJ,EAGG1C,WAAW,CAAC0C,SAAZ,IAAyB,CAAC,CAACd,OAA3B,IACC,oBAAC,aAAD;AAAe,IAAA,GAAG,EAAC;AAAnB,KACE,oBAAC,SAAD;AAAW,IAAA,SAAS,EAAEA;AAAtB,IADF,EAEE,oBAAC,SAAD;AACE,IAAA,IAAI,EAAEH,IADR;AAEE,IAAA,QAAQ,EAAEe,YAFZ;AAGE,IAAA,cAAc,EAAEtB;AAHlB,IAFF,CAJJ,EAaGlB,WAAW,CAAC0C,SAAZ,IACCjB,IAAI,CAACK,MAAL,GAAc,CADf,IAEC,+BAfJ,CAtBF,CADF;AA0CD,CA3EM","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"],"file":"PerfTracker.js"}
1
+ {"version":3,"file":"PerfTracker.js","names":["perfFilter","all","value","localStorage","getItem","RunItConfigKey","config","JSON","parse","url","URL","base_url","protocol","hostname","PerfTracker","perf","PerfTimings","showAllColumns","loading","setLoading","useState","showAll","setShowAll","filter","setFilter","data","setData","entries","timings","setTimings","length","undefined","handleClear","_","clear","handleFilterChange","e","target","checked","pf","useEffect","handleSelect","item","supported"],"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;AACA;AAQA;AAEA;AACA;AAEA;AACA;AACA;AAAuC;AAAA;AAOvC,IAAMA,UAAU,GAAG,SAAbA,UAAU,GAAoB;EAAA,IAAhBC,GAAG,uEAAG,KAAK;EAC7B,IAAIA,GAAG,EAAE,OAAO,IAAI;EAKpB,IAAMC,KAAK,GAAGC,YAAY,CAACC,OAAO,CAACC,0BAAc,CAAC;EAClD,IAAI,CAACH,KAAK,EAAE,OAAO,IAAI;EACvB,IAAMI,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACN,KAAK,CAAC;EAChC,IAAMO,GAAG,GAAG,IAAIC,GAAG,CAACJ,MAAM,CAACK,QAAQ,CAAC;EACpC,iBAAUF,GAAG,CAACG,QAAQ,eAAKH,GAAG,CAACI,QAAQ;AACzC,CAAC;AAEM,IAAMC,WAAiC,GAAG,QAG3C;EAAA,IAH4C;IAChDC,IAAI,GAAG,IAAIC,sBAAW,EAAE;IACxBC,cAAc,GAAG;EACnB,CAAC;EAEC,IAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAG,IAAAC,eAAQ,EAAC,KAAK,CAAC;EAC7C,IAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAG,IAAAF,eAAQ,EAAC,KAAK,CAAC;E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AAC;EAA6B,EACnC,CACO,EACX,6BAAC,oBAAQ,QACP,6BAAC,6BAAiB;IAChB,IAAI,EAAC,WAAW;IAChB,KAAK,EAAC,UAAU;IAChB,QAAQ,EAAEG,kBAAmB;IAC7B,EAAE,EAAEd;EAAQ,EACZ,CACO,EACX,6BAAC,oBAAQ,QACP,6BAAC,gBAAO;IAAC,OAAO,EAAEH;EAAQ,EAAG,CACpB,CACN,EACP,4DACG,CAACF,sBAAW,CAAC2B,SAAS,IACrB,qDAAqD,EACtD3B,sBAAW,CAAC2B,SAAS,IAAI,CAAC,CAACf,OAAO,IACjC,6BAAC,yBAAa;IAAC,GAAG,EAAC;EAAO,GACxB,6BAAC,oBAAS;IAAC,SAAS,EAAEA;EAAQ,EAAG,EACjC,6BAAC,oBAAS;IACR,IAAI,EAAEH,IAAK;IACX,QAAQ,EAAEgB,YAAa;IACvB,cAAc,EAAExB;EAAe,EAC/B,CAEL,EACAD,sBAAW,CAAC2B,SAAS,IACpBlB,IAAI,CAACK,MAAM,GAAG,CAAC,IACf,+BAA+B,CAChC,CACF;AAEP,CAAC;AAAA"}
@@ -1,3 +1,20 @@
1
- export { PerfTracker } from './PerfTracker';
2
- export { PerfTimings } from './perfUtils';
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");
3
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/PerfTracker/index.ts"],"names":["PerfTracker","PerfTimings"],"mappings":"AAyBA,SAASA,WAAT,QAA4B,eAA5B;AACA,SAASC,WAAT,QAA4B,aAA5B","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"],"file":"index.js"}
1
+ {"version":3,"file":"index.js","names":[],"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;AACA"}
@@ -1,8 +1,15 @@
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() {
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() {
6
13
  var all = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
7
14
  var numericColumns = all ? 9 : 6;
8
15
  var urlWidth = all ? 13 : 20;
@@ -15,7 +22,6 @@ export var perfTableColumns = function perfTableColumns() {
15
22
  type: 'string',
16
23
  widthPercent: urlWidth
17
24
  }];
18
-
19
25
  if (all) {
20
26
  result.push({
21
27
  canSort: true,
@@ -40,7 +46,6 @@ export var perfTableColumns = function perfTableColumns() {
40
46
  widthPercent: numWidth
41
47
  });
42
48
  }
43
-
44
49
  result.push({
45
50
  canSort: true,
46
51
  id: 'responseTime',
@@ -86,56 +91,53 @@ export var perfTableColumns = function perfTableColumns() {
86
91
  });
87
92
  return result;
88
93
  };
89
-
94
+ exports.perfTableColumns = perfTableColumns;
90
95
  var Metric = _ref => {
91
96
  var {
92
97
  value,
93
98
  description
94
99
  } = _ref;
95
- return React.createElement(Tooltip, {
100
+ return _react.default.createElement(_components.Tooltip, {
96
101
  placement: "right",
97
102
  textAlign: "left",
98
- content: React.createElement(React.Fragment, null, description)
99
- }, React.createElement("span", null, value));
103
+ content: _react.default.createElement(_react.default.Fragment, null, description)
104
+ }, _react.default.createElement("span", null, value));
100
105
  };
101
-
102
- var metric = (value, description) => React.createElement(React.Fragment, null, React.createElement(Metric, {
106
+ var metric = (value, description) => _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(Metric, {
103
107
  value: value,
104
108
  description: "".concat(description, " (").concat(value, " ms)")
105
109
  }));
106
-
107
- export var UrlText = styled(Text).withConfig({
110
+ var UrlText = (0, _styledComponents.default)(_components.Text).withConfig({
108
111
  displayName: "perfTableUtils__UrlText",
109
- componentId: "eq1lm0-0"
112
+ componentId: "sc-eq1lm0-0"
110
113
  })(["display:inline-block;direction:rtl;width:78px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;"]);
111
-
114
+ exports.UrlText = UrlText;
112
115
  var urlColumn = value => {
113
116
  var url = new URL(value);
114
117
  var path = "".concat(url.pathname).concat(url.search);
115
- return React.createElement(React.Fragment, null, React.createElement(Tooltip, {
118
+ return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_components.Tooltip, {
116
119
  content: value
117
- }, React.createElement(UrlText, {
120
+ }, _react.default.createElement(UrlText, {
118
121
  mb: "0",
119
122
  pt: "0",
120
123
  fontSize: "xsmall"
121
124
  }, path)));
122
125
  };
123
-
124
126
  var extraPerfColumns = function extraPerfColumns(item) {
125
127
  var showAllColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
126
- if (!showAllColumns) return React.createElement(React.Fragment, null);
127
- 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.')));
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.')));
128
130
  };
129
-
130
- export var createTableRows = function createTableRows(data, onSelect) {
131
+ var createTableRows = function createTableRows(data, onSelect) {
131
132
  var showAllColumns = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
132
133
  return data.map((item, index) => {
133
134
  var id = "".concat(item.name, ".").concat(index);
134
- return React.createElement(DataTableItem, {
135
+ return _react.default.createElement(_components.DataTableItem, {
135
136
  id: id,
136
137
  key: id,
137
138
  onClick: onSelect.bind(null, item)
138
- }, 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')));
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')));
139
140
  });
140
141
  };
142
+ exports.createTableRows = createTableRows;
141
143
  //# sourceMappingURL=perfTableUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/PerfTracker/perfTableUtils.tsx"],"names":["React","DataTableItem","Tooltip","Text","DataTableCell","styled","perfRound","perfTableColumns","all","numericColumns","urlWidth","numWidth","result","canSort","id","primaryKey","title","type","widthPercent","push","Metric","value","description","metric","UrlText","urlColumn","url","URL","path","pathname","search","extraPerfColumns","item","showAllColumns","connect","secureConnection","responseTime","createTableRows","data","onSelect","map","index","name","bind","domainLookup","fetchUntilResponseEnd","requestUntilResponseEnd","startUntilResponseEnd","processDuration","duration"],"mappings":"AA0BA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,aAAT,EAAwBC,OAAxB,EAAiCC,IAAjC,EAAuCC,aAAvC,QAA4D,oBAA5D;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AAEA,SAASC,SAAT,QAA0B,aAA1B;AAMA,OAAO,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB,GAAiB;AAAA,MAAhBC,GAAgB,uEAAV,KAAU;AAC/C,MAAMC,cAAc,GAAGD,GAAG,GAAG,CAAH,GA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AMC,eAAe,GAAG,SAAlBA,eAAkB,CAC7BC,IAD6B,EAE7BC,QAF6B;AAAA,MAG7BN,cAH6B,uEAGZ,KAHY;AAAA,SAK7BK,IAAI,CAACE,GAAL,CAAS,CAACR,IAAD,EAAOS,KAAP,KAAiB;AACxB,QAAM3B,EAAE,aAAMkB,IAAI,CAACU,IAAX,cAAmBD,KAAnB,CAAR;AACA,WACE,oBAAC,aAAD;AAAe,MAAA,EAAE,EAAE3B,EAAnB;AAAuB,MAAA,GAAG,EAAEA,EAA5B;AAAgC,MAAA,OAAO,EAAEyB,QAAQ,CAACI,IAAT,CAAc,IAAd,EAAoBX,IAApB;AAAzC,OACE,oBAAC,aAAD,QAAgBP,SAAS,CAACO,IAAI,CAACU,IAAN,CAAzB,CADF,EAEE,oBAAC,aAAD,QACGnB,MAAM,CACLS,IAAI,CAACY,YADA,EAEL,4EAFK,CADT,CAFF,EAQGb,gBAAgB,CAACC,IAAD,EAAOC,cAAP,CARnB,EASE,oBAAC,aAAD,QACGV,MAAM,CACLS,IAAI,CAACa,qBADA,EAEL,qFAFK,CADT,CATF,EAeE,oBAAC,aAAD,QACGtB,MAAM,CACLS,IAAI,CAACc,uBADA,EAEL,+GAFK,CADT,CAfF,EAqBE,oBAAC,aAAD,QACGvB,MAAM,CACLS,IAAI,CAACe,qBADA,EAEL,+EAFK,CADT,CArBF,EA2BE,oBAAC,aAAD,QACGxB,MAAM,CACLjB,SAAS,CAAC0B,IAAI,CAACgB,eAAN,CADJ,EAEL,mCAFK,CADT,CA3BF,EAiCE,oBAAC,aAAD,QACGzB,MAAM,CACLjB,SAAS,CAAC0B,IAAI,CAACiB,QAAN,CADJ,EAEL,wCAFK,CADT,CAjCF,CADF;AA0CD,GA5CD,CAL6B;AAAA,CAAxB","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"],"file":"perfTableUtils.js"}
1
+ {"version":3,"file":"perfTableUtils.js","names":["perfTableColumns","all","numericColumns","urlWidth","numWidth","result","canSort","id","primaryKey","title","type","widthPercent","push","Metric","value","description","metric","UrlText","styled","Text","urlColumn","url","URL","path","pathname","search","extraPerfColumns","item","showAllColumns","connect","secureConnection","responseTime","createTableRows","data","onSelect","map","index","name","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;AAEA;AACA;AAEA;AAAuC;AAMhC,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgB,GAAoB;EAAA,IAAhBC,GAAG,uEAAG,KAAK;EAC1C,IAAMC,cAAc,GAAGD,GAAG,GAAG,CAAC,GAAG,CAAC;EAClC,IAAME,QAAQ,GAAGF,GAAG,GAAG,EAAE,GAAG,EAAE;EAC9B,IAAMG,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,IAAIF,GAAG,EAAE;IACPI,MAAM,CAACO,IAAI,CACT;MACEN,OAAO,EAAE,IAAI;MACbC,EAAE,EAAE,cAAc;MAClBC,UAAU,EAAE,KAAK;MACjBC,KAAK,EAAE,QAAQ;MACfC,IAAI,EAAE,QAAQ;MACdC,YAAY,EAAEP;IAChB,CAAC,EACD;MACEE,OAAO,EAAE,IAAI;MACbC,EAAE,EAAE,SAAS;MACbC,UAAU,EAAE,KAAK;MACjBC,KAAK,EAAE,SAAS;MAChBC,IAAI,EAAE,QAAQ;MACdC,YAAY,EAAEP;IAChB,CAAC,EACD;MACEE,OAAO,EAAE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IAAMC,eAAe,GAAG,SAAlBA,eAAe,CAC1BC,IAAiB,EACjBC,QAAmC;EAAA,IACnCN,cAAc,uEAAG,KAAK;EAAA,OAEtBK,IAAI,CAACE,GAAG,CAAC,CAACR,IAAI,EAAES,KAAK,KAAK;IACxB,IAAM7B,EAAE,aAAMoB,IAAI,CAACU,IAAI,cAAID,KAAK,CAAE;IAClC,OACE,6BAAC,yBAAa;MAAC,EAAE,EAAE7B,EAAG;MAAC,GAAG,EAAEA,EAAG;MAAC,OAAO,EAAE2B,QAAQ,CAACI,IAAI,CAAC,IAAI,EAAEX,IAAI;IAAE,GACjE,6BAAC,yBAAa,QAAEP,SAAS,CAACO,IAAI,CAACU,IAAI,CAAC,CAAiB,EACrD,6BAAC,yBAAa,QACXrB,MAAM,CACLW,IAAI,CAACY,YAAY,EACjB,4EAA4E,CAC7E,CACa,EACfb,gBAAgB,CAACC,IAAI,EAAEC,cAAc,CAAC,EACvC,6BAAC,yBAAa,QACXZ,MAAM,CACLW,IAAI,CAACa,qBAAqB,EAC1B,qFAAqF,CACtF,CACa,EAChB,6BAAC,yBAAa,QACXxB,MAAM,CACLW,IAAI,CAACc,uBAAuB,EAC5B,+GAA+G,CAChH,CACa,EAChB,6BAAC,yBAAa,QACXzB,MAAM,CACLW,IAAI,CAACe,qBAAqB,EAC1B,+EAA+E,CAChF,CACa,EAChB,6BAAC,yBAAa,QACX1B,MAAM,CACL,IAAA2B,oBAAS,EAAChB,IAAI,CAACiB,eAAe,CAAC,EAC/B,mCAAmC,CACpC,CACa,EAChB,6BAAC,yBAAa,QACX5B,MAAM,CACL,IAAA2B,oBAAS,EAAChB,IAAI,CAACkB,QAAQ,CAAC,EACxB,wCAAwC,CACzC,CACa,CACF;EAEpB,CAAC,CAAC;AAAA;AAAA"}
@@ -1,37 +1,30 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
- export var perfRound = num => Math.round((num + Number.EPSILON) * 10000) / 10000;
4
-
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.perfRound = exports.PerfTimings = exports.LoadTimes = void 0;
7
+ 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
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
9
+ 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;
5
12
  var diff = (end, start) => perfRound(end - start);
6
-
7
- export class LoadTimes {
13
+ class LoadTimes {
8
14
  constructor(entry) {
9
15
  this.entry = entry;
10
-
11
16
  _defineProperty(this, "duration", 0);
12
-
13
17
  _defineProperty(this, "redirect", 0);
14
-
15
18
  _defineProperty(this, "domainLookup", 0);
16
-
17
19
  _defineProperty(this, "connect", 0);
18
-
19
20
  _defineProperty(this, "secureConnection", 0);
20
-
21
21
  _defineProperty(this, "responseTime", 0);
22
-
23
22
  _defineProperty(this, "fetchUntilResponseEnd", 0);
24
-
25
23
  _defineProperty(this, "requestUntilResponseEnd", 0);
26
-
27
24
  _defineProperty(this, "startUntilResponseEnd", 0);
28
-
29
25
  _defineProperty(this, "processStart", 0);
30
-
31
26
  _defineProperty(this, "processEnd", 0);
32
-
33
27
  _defineProperty(this, "processDuration", 0);
34
-
35
28
  if ('redirectStart' in entry) {
36
29
  var resource = entry;
37
30
  this.redirect = diff(resource.redirectEnd, resource.redirectStart);
@@ -45,13 +38,10 @@ export class LoadTimes {
45
38
  this.calcProcessTime();
46
39
  }
47
40
  }
48
-
49
41
  calcProcessTime() {
50
42
  this.duration = this.entry.duration;
51
-
52
43
  if (performance.getEntriesByName !== undefined) {
53
44
  var entries = performance.getEntriesByName("".concat(this.name, "-").concat(this.entry.startTime), 'measure');
54
-
55
45
  if (entries.length > 0) {
56
46
  var measure = entries[entries.length - 1];
57
47
  var resource = this.entry;
@@ -62,13 +52,12 @@ export class LoadTimes {
62
52
  }
63
53
  }
64
54
  }
65
-
66
55
  get name() {
67
56
  return this.entry.name;
68
57
  }
69
-
70
58
  }
71
- export class PerfTimings {
59
+ exports.LoadTimes = LoadTimes;
60
+ class PerfTimings {
72
61
  static get supported() {
73
62
  if (PerfTimings._supported === undefined) {
74
63
  try {
@@ -77,24 +66,18 @@ export class PerfTimings {
77
66
  PerfTimings._supported = false;
78
67
  }
79
68
  }
80
-
81
69
  return PerfTimings._supported;
82
70
  }
83
-
84
71
  static set supported(value) {
85
72
  PerfTimings._supported = value;
86
73
  }
87
-
88
74
  constructor() {
89
75
  _defineProperty(this, "_full", false);
90
-
91
76
  _defineProperty(this, "_bufferSize", 0);
92
-
93
77
  if (PerfTimings.supported) {
94
78
  performance.onresourcetimingbufferfull = _ev => this._full = true;
95
79
  }
96
80
  }
97
-
98
81
  clear() {
99
82
  if (!PerfTimings.supported) return false;
100
83
  if (performance.clearResourceTimings !== undefined) performance.clearResourceTimings();
@@ -103,35 +86,28 @@ export class PerfTimings {
103
86
  this._full = this.entries().length === 0;
104
87
  return this._full;
105
88
  }
106
-
107
89
  entries() {
108
90
  var pattern = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.*';
109
91
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'resource';
110
-
111
92
  if (PerfTimings.supported) {
112
93
  var ex = new RegExp(pattern, 'i');
113
94
  return performance.getEntriesByType(type).filter(p => ex.test(p.name)).map(p => new LoadTimes(p));
114
95
  }
115
-
116
96
  return [];
117
97
  }
118
-
119
98
  get bufferSize() {
120
99
  return this._bufferSize;
121
100
  }
122
-
123
101
  set bufferSize(value) {
124
102
  if (PerfTimings.supported && typeof performance.setResourceTimingBufferSize !== undefined) {
125
103
  this._bufferSize = value;
126
104
  performance.setResourceTimingBufferSize(value);
127
105
  }
128
106
  }
129
-
130
107
  get isFull() {
131
108
  return this._full;
132
109
  }
133
-
134
110
  }
135
-
111
+ exports.PerfTimings = PerfTimings;
136
112
  _defineProperty(PerfTimings, "_supported", undefined);
137
113
  //# sourceMappingURL=perfUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/PerfTracker/perfUtils.ts"],"names":["perfRound","num","Math","round","Number","EPSILON","diff","end","start","LoadTimes","constructor","entry","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","name","length","measure","processStart","processEnd","processDuration","PerfTimings","supported","_supported","value","onresourcetimingbufferfull","_ev","_full","clear","clearResourceTimings","clearMarks","clearMeasures","pattern","type","ex","RegExp","getEntriesByType","filter","p","test","map","bufferSize","_bufferSize","setResourceTimingBufferSize","isFull"],"mappings":";;AAiDA,OAAO,IAAMA,SAAS,GAAIC,GAAD,IACvBC,IAAI,CAACC,KAAL,CAAW,CAACF,GAAG,GAAGG,MAAM,CAACC,OAAd,IAAyB,KAApC,IAA6C,KADxC;;AASP,IAAMC,IAAI,GAAG,CAACC,GAAD,EAAcC,KAAd,KAAgCR,SAAS,CAACO,GAAG,GAAGC,KAAP,CAAtD;;AAEA,OAAO,MAAMC,SAAN,CAA8C;AAcnDC,EAAAA,WAAW,CAAQC,KAAR,EAAiC;AAAA,SAAzBA,KAAyB,GAAzBA,KAAyB;;AAAA,sCAbjC,CAaiC;;AAAA,sCAZjC,CAYiC;;AAAA,0CAX7B,CAW6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6B,WAAL,GAAmBlB,KAAnB;AACAb,MAAAA,WAAW,CAACgC,2BAAZ,CAAwCnB,KAAxC;AACD;AACF;;AAES,MAANoB,MAAM,GAAG;AACX,WAAO,KAAKjB,KAAZ;AACD;;AAtEsB;;gBAAZN,W,gBAGsCR,S","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"],"file":"perfUtils.js"}
1
+ {"version":3,"file":"perfUtils.js","names":["perfRound","num","Math","round","Number","EPSILON","diff","end","start","LoadTimes","constructor","entry","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","name","length","measure","processStart","processEnd","processDuration","PerfTimings","supported","_supported","value","onresourcetimingbufferfull","_ev","_full","clear","clearResourceTimings","clearMarks","clearMeasures","pattern","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;AAAA;AAQ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AO,EAAE;EACX;EAEA,IAAIG,UAAU,GAAG;IACf,OAAO,IAAI,CAACC,WAAW;EACzB;EAEA,IAAID,UAAU,CAACjB,KAAK,EAAE;IACpB,IACEH,WAAW,CAACC,SAAS,IACrB,OAAOX,WAAW,CAACgC,2BAA2B,KAAK9B,SAAS,EAC5D;MACA,IAAI,CAAC6B,WAAW,GAAGlB,KAAK;MACxBb,WAAW,CAACgC,2BAA2B,CAACnB,KAAK,CAAC;IAChD;EACF;EAEA,IAAIoB,MAAM,GAAG;IACX,OAAO,IAAI,CAACjB,KAAK;EACnB;AACF;AAAC;AAAA,gBAvEYN,WAAW,gBAG2BR,SAAS"}
@@ -1,22 +1,30 @@
1
- import React from 'react';
2
- import { Space, Box, Label } from '@looker/components';
3
- export var FormItem = _ref => {
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 => {
4
11
  var {
5
12
  id,
6
13
  children,
7
14
  label = ' '
8
15
  } = _ref;
9
16
  var key = "space_".concat(id);
10
- return React.createElement(Space, {
17
+ return _react.default.createElement(_components.Space, {
11
18
  id: key,
12
19
  key: key
13
- }, React.createElement(Box, {
20
+ }, _react.default.createElement(_components.Box, {
14
21
  key: "".concat(key, "_box"),
15
22
  width: "120px",
16
23
  flexShrink: 0
17
- }, React.createElement(Label, {
24
+ }, _react.default.createElement(_components.Label, {
18
25
  key: "".concat(key, "_label_for"),
19
26
  htmlFor: id
20
27
  }, label)), children);
21
28
  };
29
+ exports.FormItem = FormItem;
22
30
  //# sourceMappingURL=FormItem.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/RequestForm/FormItem.tsx"],"names":["React","Space","Box","Label","FormItem","id","children","label","key"],"mappings":"AA0BA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,KAAT,EAAgBC,GAAhB,EAAqBC,KAArB,QAAkC,oBAAlC;AAiBA,OAAO,IAAMC,QAA2B,GAAG,QAAmC;AAAA,MAAlC;AAAEC,IAAAA,EAAF;AAAMC,IAAAA,QAAN;AAAgBC,IAAAA,KAAK,GAAG;AAAxB,GAAkC;AAC5E,MAAMC,GAAG,mBAAYH,EAAZ,CAAT;AACA,SACE,oBAAC,KAAD;AAAO,IAAA,EAAE,EAAEG,GAAX;AAAgB,IAAA,GAAG,EAAEA;AAArB,KACE,oBAAC,GAAD;AAAK,IAAA,GAAG,YAAKA,GAAL,SAAR;AAAwB,IAAA,KAAK,EAAC,OAA9B;AAAsC,IAAA,UAAU,EAAE;AAAlD,KACE,oBAAC,KAAD;AAAO,IAAA,GAAG,YAAKA,GAAL,eAAV;AAAgC,IAAA,OAAO,EAAEH;AAAzC,KACGE,KADH,CADF,CADF,EAMGD,QANH,CADF;AAUD,CAZM","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"],"file":"FormItem.js"}
1
+ {"version":3,"file":"FormItem.js","names":["FormItem","id","children","label","key"],"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;AACA;AAAsD;AAiB/C,IAAMA,QAA2B,GAAG,QAAmC;EAAA,IAAlC;IAAEC,EAAE;IAAEC,QAAQ;IAAEC,KAAK,GAAG;EAAI,CAAC;EACvE,IAAMC,GAAG,mBAAYH,EAAE,CAAE;EACzB,OACE,6BAAC,iBAAK;IAAC,EAAE,EAAEG,GAAI;IAAC,GAAG,EAAEA;EAAI,GACvB,6BAAC,eAAG;IAAC,GAAG,YAAKA,GAAG,SAAO;IAAC,KAAK,EAAC,OAAO;IAAC,UAAU,EAAE;EAAE,GAClD,6BAAC,iBAAK;IAAC,GAAG,YAAKA,GAAG,eAAa;IAAC,OAAO,EAAEH;EAAG,GACzCE,KAAK,CACA,CACJ,EACLD,QAAQ,CACH;AAEZ,CAAC;AAAA"}