@grafana/k6-test-builder 0.6.1-alpha.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -346,6 +346,7 @@ interface TestBuilderStandaloneProps {
346
346
  saving?: boolean;
347
347
  k6Test?: TestBuilderTest;
348
348
  hasCloudExecution?: boolean;
349
+ hasFractionalVUhResolution?: boolean;
349
350
  availableLoadZones?: LoadZoneDataItem[];
350
351
  DocsLinkComponent?: ElementType<DocsLinkProps>;
351
352
  onViewChange?: (view: string) => void;
@@ -359,7 +360,7 @@ interface TestBuilderStandaloneProps {
359
360
  openImportModal?: BaseBuilderContextValue['openImportModal'];
360
361
  startRecorder?: BaseBuilderContextValue['startRecorder'];
361
362
  }
362
- export function TestBuilder({ loading, saving, k6Test, hasCloudExecution, availableLoadZones, DocsLinkComponent, onViewChange, StagesVirtualizationComponent, ScriptEditorComponent, TestBuilderIconComponent, readonlyScriptScenarios, apmConfigs, hasCloudAPM, disableAPM, openImportModal, startRecorder, }: TestBuilderStandaloneProps): JSX.Element;
363
+ export function TestBuilder({ loading, saving, k6Test, hasCloudExecution, hasFractionalVUhResolution, availableLoadZones, DocsLinkComponent, onViewChange, StagesVirtualizationComponent, ScriptEditorComponent, TestBuilderIconComponent, readonlyScriptScenarios, apmConfigs, hasCloudAPM, disableAPM, openImportModal, startRecorder, }: TestBuilderStandaloneProps): JSX.Element;
363
364
  interface Label {
364
365
  name: string;
365
366
  value: string;
package/dist/index.js CHANGED
@@ -1099,6 +1099,7 @@ const $b0053bc75d27f892$var$defaultContext = {
1099
1099
  ],
1100
1100
  DocsLinkComponent: (0, $cd402c1b3ca4b836$export$e816d7af81d48a79),
1101
1101
  hasCloudExecution: false,
1102
+ hasFractionalVUhResolution: false,
1102
1103
  readonlyScriptScenarios: true,
1103
1104
  TestBuilderIconComponent: (0, $924f96bd0d5c630d$export$cc0ae9a5c96bcd6f),
1104
1105
  apmConfigs: [],
@@ -1632,6 +1633,9 @@ function $90b0cfd5919312e7$export$c38d1d963d26061e(state) {
1632
1633
  function $90b0cfd5919312e7$export$ae763f5129c1544a(state) {
1633
1634
  return state.ui.hasCloudExecution;
1634
1635
  }
1636
+ function $90b0cfd5919312e7$export$e6a428d399561b3f(state) {
1637
+ return state.ui.hasFractionalVUhResolution;
1638
+ }
1635
1639
  function $90b0cfd5919312e7$export$15d5f46743a7d01c(state) {
1636
1640
  return state.ui.availableLoadZones;
1637
1641
  }
@@ -1658,6 +1662,7 @@ const $5dd5dedd6ce134dc$export$d4c72bab9d6cc13a = {
1658
1662
  view: "scenarios/default",
1659
1663
  // 'default' doesn't mean anything special, it's instead of an id
1660
1664
  hasCloudExecution: false,
1665
+ hasFractionalVUhResolution: false,
1661
1666
  availableLoadZones: []
1662
1667
  };
1663
1668
 
@@ -1713,6 +1718,9 @@ const $4016baaeec60d4ee$export$83c693298dde2c4f = (0, $gkIgo$reduxjstoolkit.crea
1713
1718
  setHasCloudExecution (state, action) {
1714
1719
  state.hasCloudExecution = action.payload;
1715
1720
  },
1721
+ setHasFractionalVUhResolution (state, action) {
1722
+ state.hasFractionalVUhResolution = action.payload;
1723
+ },
1716
1724
  setAvailableLoadZones (state, action) {
1717
1725
  state.availableLoadZones = action.payload;
1718
1726
  },
@@ -1728,7 +1736,7 @@ const $4016baaeec60d4ee$export$95881ffef5b0c248 = $4016baaeec60d4ee$export$83c69
1728
1736
  const $4016baaeec60d4ee$export$e324594224ef24da = $4016baaeec60d4ee$export$83c693298dde2c4f.actions;
1729
1737
 
1730
1738
 
1731
- const { init: $eeeed770fbbe0766$export$2cd8252107eb640b , setAdvancedOptionsTab: $eeeed770fbbe0766$export$267d608097309f30 , setAvailableLoadZones: $eeeed770fbbe0766$export$9f9f33201c1586de , setHasCloudExecution: $eeeed770fbbe0766$export$f89a1b8f393b8bb6 , setIsLoading: $eeeed770fbbe0766$export$9eaa806651dd33f0 , setView: $eeeed770fbbe0766$export$78fa5045d0400717 , setIsSaving: $eeeed770fbbe0766$export$ad10cacbaf4608fe , setShowTestScript: $eeeed770fbbe0766$export$8fadc49d0b5909c , setUnsavedChanges: $eeeed770fbbe0766$export$278d42400282afa6 } = (0, $4016baaeec60d4ee$export$e324594224ef24da);
1739
+ const { init: $eeeed770fbbe0766$export$2cd8252107eb640b , setAdvancedOptionsTab: $eeeed770fbbe0766$export$267d608097309f30 , setAvailableLoadZones: $eeeed770fbbe0766$export$9f9f33201c1586de , setHasCloudExecution: $eeeed770fbbe0766$export$f89a1b8f393b8bb6 , setHasFractionalVUhResolution: $eeeed770fbbe0766$export$92220e1782a52292 , setIsLoading: $eeeed770fbbe0766$export$9eaa806651dd33f0 , setView: $eeeed770fbbe0766$export$78fa5045d0400717 , setIsSaving: $eeeed770fbbe0766$export$ad10cacbaf4608fe , setShowTestScript: $eeeed770fbbe0766$export$8fadc49d0b5909c , setUnsavedChanges: $eeeed770fbbe0766$export$278d42400282afa6 } = (0, $4016baaeec60d4ee$export$e324594224ef24da);
1732
1740
 
1733
1741
 
1734
1742
 
@@ -2230,6 +2238,13 @@ function $4bac6ee95b8c8b72$export$5a00511f040384d7(timeInSeconds = 0) {
2230
2238
  }
2231
2239
  return `${Math.round(totalSeconds / 60)}min`;
2232
2240
  }
2241
+ function $4bac6ee95b8c8b72$export$435f89f92ea3c766(hasFractionalVUhResolution, vus, duration) {
2242
+ if (hasFractionalVUhResolution) return Math.max(1.0, $4bac6ee95b8c8b72$var$roundup(vus * duration / 3600, 0.01));
2243
+ else return Math.max(1.0, vus * Math.ceil(duration / 3600.0));
2244
+ }
2245
+ function $4bac6ee95b8c8b72$var$roundup(value, fraction) {
2246
+ return Math.ceil(value / fraction) * fraction;
2247
+ }
2233
2248
 
2234
2249
 
2235
2250
  function $5b497aacff60262b$var$_defineProperty(obj, key, value) {
@@ -3165,6 +3180,11 @@ function $b714db607dbce577$export$ce740c17ce134c88(stages = []) {
3165
3180
  return Math.max(accumulator, Number(stage.target));
3166
3181
  }, 0);
3167
3182
  }
3183
+ function $b714db607dbce577$export$33cd2c632b520a28(stages = []) {
3184
+ return stages.reduce((accumulator, stage)=>{
3185
+ return Math.max(accumulator, $b714db607dbce577$export$35d89f711450937a(stage.duration));
3186
+ }, 0);
3187
+ }
3168
3188
  function $b714db607dbce577$export$35d89f711450937a(duration = "") {
3169
3189
  const regexp = new RegExp(/(\d+|\d+\.\d+)([hms])/gim);
3170
3190
  const matches = [
@@ -3204,6 +3224,7 @@ function $b714db607dbce577$export$9427da4570bcea21(target) {
3204
3224
 
3205
3225
 
3206
3226
 
3227
+
3207
3228
  const { selectAll: $c5bb589de61e43ba$var$selectAll , selectTotal: $c5bb589de61e43ba$var$selectTotal , selectById: $c5bb589de61e43ba$var$selectById , selectIds: $c5bb589de61e43ba$var$selectIds } = (0, $3d1078687a0e83cd$export$8317e238293a29c9).getSelectors((state)=>state.scenarios);
3208
3229
  function $c5bb589de61e43ba$export$3c3c871389323db3(state) {
3209
3230
  if (!state.scenarios) return [];
@@ -3501,6 +3522,41 @@ const $c5bb589de61e43ba$export$b7fc4be04e2b72c4 = (0, $gkIgo$reduxjstoolkit.crea
3501
3522
  }, 0);
3502
3523
  return exact ? max : `≥ ${max}`;
3503
3524
  });
3525
+ const $c5bb589de61e43ba$export$e6bea69880c59e62 = (0, $gkIgo$reduxjstoolkit.createSelector)($c5bb589de61e43ba$export$3c3c871389323db3, (0, $90b0cfd5919312e7$export$e6a428d399561b3f), (scenarios, hasFractionalVUhResolution)=>{
3526
+ let exact = true;
3527
+ const vuhs = scenarios.reduce((accumulator, { options: options })=>{
3528
+ let addition = 0;
3529
+ switch(options.executor){
3530
+ case (0, $d331dbc145b152de$export$98a460cbb8841ef).SharedIterations:
3531
+ addition = (0, $4bac6ee95b8c8b72$export$435f89f92ea3c766)(hasFractionalVUhResolution, options.vus || (0, $0b027691e54da67d$export$99cd8ce77b900de9).vus, (0, $b714db607dbce577$export$35d89f711450937a)(options.maxDuration));
3532
+ break;
3533
+ case (0, $d331dbc145b152de$export$98a460cbb8841ef).PerVUIterations:
3534
+ addition = (0, $4bac6ee95b8c8b72$export$435f89f92ea3c766)(hasFractionalVUhResolution, options.vus || (0, $0b027691e54da67d$export$a8001a7c13efb87e).vus, (0, $b714db607dbce577$export$35d89f711450937a)(options.maxDuration));
3535
+ break;
3536
+ case (0, $d331dbc145b152de$export$98a460cbb8841ef).ConstantVUs:
3537
+ addition = (0, $4bac6ee95b8c8b72$export$435f89f92ea3c766)(hasFractionalVUhResolution, options.vus || (0, $0b027691e54da67d$export$2c92437f53907be7).vus, (0, $b714db607dbce577$export$35d89f711450937a)(options.duration));
3538
+ break;
3539
+ case (0, $d331dbc145b152de$export$98a460cbb8841ef).RampingVUs:
3540
+ addition = (0, $4bac6ee95b8c8b72$export$435f89f92ea3c766)(hasFractionalVUhResolution, (0, $b714db607dbce577$export$ce740c17ce134c88)(options.stages), (0, $b714db607dbce577$export$33cd2c632b520a28)(options.stages));
3541
+ break;
3542
+ case (0, $d331dbc145b152de$export$98a460cbb8841ef).ConstantArrivalRate:
3543
+ case (0, $d331dbc145b152de$export$98a460cbb8841ef).RampingArrivalRate:
3544
+ {
3545
+ const defaults = options.executor === (0, $d331dbc145b152de$export$98a460cbb8841ef).ConstantArrivalRate ? (0, $0b027691e54da67d$export$7f7b8742f8fe13fc) : (0, $0b027691e54da67d$export$301f34b9bbf2e6c5);
3546
+ const vus = Math.max(options.preAllocatedVUs || defaults.preAllocatedVUs, options.maxVUs || defaults.maxVUs || 0);
3547
+ const duration = options.executor === (0, $d331dbc145b152de$export$98a460cbb8841ef).ConstantArrivalRate ? (0, $b714db607dbce577$export$35d89f711450937a)(options.duration) : (0, $b714db607dbce577$export$33cd2c632b520a28)(options.stages);
3548
+ addition = (0, $4bac6ee95b8c8b72$export$435f89f92ea3c766)(hasFractionalVUhResolution, vus, duration);
3549
+ if (!options.maxVUs && !defaults.maxVUs) exact = false;
3550
+ break;
3551
+ }
3552
+ default:
3553
+ (0, $1c4cc247633c6592$export$af88d00dbe7f521).error("getVUhs: Trying to get VUhs for unknown executor type (%s)", // @ts-ignore
3554
+ options.executor);
3555
+ }
3556
+ return accumulator + addition;
3557
+ }, 0);
3558
+ return exact ? vuhs : `≥ ${vuhs}`;
3559
+ });
3504
3560
  const $c5bb589de61e43ba$export$8b4afeb4d5ebc7f2 = (0, $gkIgo$reduxjstoolkit.createSelector)([
3505
3561
  $c5bb589de61e43ba$export$fc1e5a8eff15c4a5
3506
3562
  ], (scenario)=>{
@@ -5192,13 +5248,19 @@ function $cdee3562a1fa264f$export$9cc0a26cbe829bcb() {
5192
5248
  }
5193
5249
  function $cdee3562a1fa264f$export$e3a1a4f1e85dc208() {
5194
5250
  const dispatch = $cdee3562a1fa264f$export$371624ce4da5e319();
5195
- const { hasCloudExecution: hasCloudExecution = false , k6Test: k6Test , availableLoadZones: availableLoadZones = [] } = (0, $b0053bc75d27f892$export$8bcb3cb1ba0d67a7)();
5251
+ const { hasCloudExecution: hasCloudExecution = false , hasFractionalVUhResolution: hasFractionalVUhResolution = false , k6Test: k6Test , availableLoadZones: availableLoadZones = [] } = (0, $b0053bc75d27f892$export$8bcb3cb1ba0d67a7)();
5196
5252
  (0, $gkIgo$react.useEffect)(()=>{
5197
5253
  dispatch((0, $eeeed770fbbe0766$export$f89a1b8f393b8bb6)(Boolean(hasCloudExecution)));
5198
5254
  }, [
5199
5255
  dispatch,
5200
5256
  hasCloudExecution
5201
5257
  ]);
5258
+ (0, $gkIgo$react.useEffect)(()=>{
5259
+ dispatch((0, $eeeed770fbbe0766$export$92220e1782a52292)(Boolean(hasFractionalVUhResolution)));
5260
+ }, [
5261
+ dispatch,
5262
+ hasFractionalVUhResolution
5263
+ ]);
5202
5264
  (0, $gkIgo$react.useEffect)(()=>{
5203
5265
  const { loadZones: loadZones , config: config , thresholds: thresholds , scenarios: scenarios , name: name , id: id } = new (0, $27b7f69a914929cd$export$1576fc997deee1a4)(k6Test).toObject();
5204
5266
  dispatch((0, $7014956835638f99$export$a75bd9e6b09c915e)(loadZones));
@@ -8191,8 +8253,10 @@ const $4efcda42d6ce57af$export$9a75ed5a99cf0511 = (props)=>{
8191
8253
  ]);
8192
8254
  const disableStatistics = !statisticsOptions.length;
8193
8255
  const handleDelete = ()=>dispatch((0, $f51ad74c1a393c6c$export$b7e4565ed8378479)(index));
8256
+ const [valueError, setValueError] = (0, $gkIgo$react.useState)();
8194
8257
  const createOnChangeHandler = (key, onSuccess)=>{
8195
8258
  return ({ target: { value: value } })=>{
8259
+ if (key === "value" && typeof value === "string") validateThresholdValue(value);
8196
8260
  dispatch((0, $f51ad74c1a393c6c$export$7a98fbd10fd8a51f)(index, key, value));
8197
8261
  onSuccess && onSuccess(value);
8198
8262
  };
@@ -8202,6 +8266,11 @@ const $4efcda42d6ce57af$export$9a75ed5a99cf0511 = (props)=>{
8202
8266
  if ((0, $536aa1751e69cdba$export$2e33e3c2b2cbdd89)(value).find((s)=>s.value === statistic)) return;
8203
8267
  dispatch((0, $f51ad74c1a393c6c$export$7a98fbd10fd8a51f)(index, "statistic", ""));
8204
8268
  };
8269
+ const validateThresholdValue = (val)=>{
8270
+ if (!val) return;
8271
+ const regexpPositiveNumber = /^\d+(\.\d+)?$/;
8272
+ setValueError(regexpPositiveNumber.test(val) ? undefined : "enter a positive number");
8273
+ };
8205
8274
  (0, $gkIgo$react.useEffect)(()=>{
8206
8275
  // Set URL to default '' if the request with the selected URL has been deleted/modified
8207
8276
  if (url !== "" && url !== "all" && !requestsURLs.includes(url)) dispatch((0, $f51ad74c1a393c6c$export$7a98fbd10fd8a51f)(index, "url", ""));
@@ -8243,6 +8312,8 @@ const $4efcda42d6ce57af$export$9a75ed5a99cf0511 = (props)=>{
8243
8312
  value: value,
8244
8313
  placeholder: "Threshold value",
8245
8314
  onChange: createOnChangeHandler("value"),
8315
+ error: !!valueError,
8316
+ helperText: valueError,
8246
8317
  InputProps: {
8247
8318
  endAdornment: /*#__PURE__*/ (0, $gkIgo$reactjsxruntime.jsx)((0, $gkIgo$materialuicore.InputAdornment), {
8248
8319
  position: "end",
@@ -14475,7 +14546,7 @@ function $1ae39e1e435a2397$export$9bb8a8c9de09825e({ children: children }) {
14475
14546
 
14476
14547
 
14477
14548
 
14478
- function $00b916e228a936f5$export$f290710bbb710efa({ loading: loading , saving: saving , k6Test: k6Test , hasCloudExecution: hasCloudExecution , availableLoadZones: availableLoadZones = [
14549
+ function $00b916e228a936f5$export$f290710bbb710efa({ loading: loading , saving: saving , k6Test: k6Test , hasCloudExecution: hasCloudExecution , hasFractionalVUhResolution: hasFractionalVUhResolution , availableLoadZones: availableLoadZones = [
14479
14550
  {
14480
14551
  id: 1,
14481
14552
  country: "us",
@@ -14487,6 +14558,7 @@ function $00b916e228a936f5$export$f290710bbb710efa({ loading: loading , saving:
14487
14558
  const context = {
14488
14559
  k6Test: k6Test,
14489
14560
  hasCloudExecution: hasCloudExecution,
14561
+ hasFractionalVUhResolution: hasFractionalVUhResolution,
14490
14562
  availableLoadZones: availableLoadZones,
14491
14563
  DocsLinkComponent: DocsLinkComponent,
14492
14564
  onViewChange: onViewChange,
@@ -15247,6 +15319,22 @@ const $efeb6023758e4c8d$export$4202723ba73439f5 = /*#__PURE__*/ (0, $gkIgo$react
15247
15319
 
15248
15320
 
15249
15321
 
15322
+
15323
+
15324
+ const $723b70ee4d7f62e8$export$1ae172e61ce3735b = /*#__PURE__*/ (0, $gkIgo$react.forwardRef)(({ props: props }, ref)=>/*#__PURE__*/ (0, $gkIgo$reactjsxruntime.jsx)("svg", {
15325
+ ref: ref,
15326
+ xmlns: "http://www.w3.org/2000/svg",
15327
+ width: "1.1em",
15328
+ height: "1.2em",
15329
+ viewBox: "0 0 24 24",
15330
+ ...props,
15331
+ children: /*#__PURE__*/ (0, $gkIgo$reactjsxruntime.jsx)("path", {
15332
+ fill: "currentColor",
15333
+ d: "M8.46777,8.39453l-.00225.00183-.00214.00208ZM18.42188,8.208a1.237,1.237,0,0,0-.23-.17481.99959.99959,0,0,0-1.39941.41114,5.78155,5.78155,0,0,1-1.398,1.77734,8.6636,8.6636,0,0,0,.1333-1.50977,8.71407,8.71407,0,0,0-4.40039-7.582,1.00009,1.00009,0,0,0-1.49121.80567A7.017,7.017,0,0,1,7.165,6.87793l-.23047.1875a8.51269,8.51269,0,0,0-1.9873,1.8623A8.98348,8.98348,0,0,0,8.60254,22.83594.99942.99942,0,0,0,9.98,21.91016a1.04987,1.04987,0,0,0-.0498-.3125,6.977,6.977,0,0,1-.18995-2.58106,9.004,9.004,0,0,0,4.3125,4.0166.997.997,0,0,0,.71534.03809A8.99474,8.99474,0,0,0,18.42188,8.208ZM14.51709,21.03906a6.964,6.964,0,0,1-3.57666-4.40234,8.90781,8.90781,0,0,1-.17969-.96387,1.00025,1.00025,0,0,0-.79931-.84473A.982.982,0,0,0,9.77,14.80957a.99955.99955,0,0,0-.8667.501,8.9586,8.9586,0,0,0-1.20557,4.71777,6.98547,6.98547,0,0,1-1.17529-9.86816,6.55463,6.55463,0,0,1,1.562-1.458.74507.74507,0,0,0,.07422-.05469s.29669-.24548.30683-.2511a8.96766,8.96766,0,0,0,2.89874-4.63269,6.73625,6.73625,0,0,1,1.38623,8.08789,1.00024,1.00024,0,0,0,1.18359,1.418,7.85568,7.85568,0,0,0,3.86231-2.6875,7.00072,7.00072,0,0,1-3.2793,10.457Z"
15334
+ })
15335
+ }));
15336
+
15337
+
15250
15338
  const $02d0d7ea86297262$var$Group = /*#__PURE__*/ (0, ($parcel$interopDefault($gkIgo$styledcomponents))).div.withConfig({
15251
15339
  displayName: "TestMetaInformation__Group",
15252
15340
  componentId: "sc-1iuml17-0"
@@ -15265,6 +15353,7 @@ const $02d0d7ea86297262$var$Container = /*#__PURE__*/ (0, ($parcel$interopDefaul
15265
15353
  const $02d0d7ea86297262$export$93f0f0dfc0a5be37 = ({ className: className })=>{
15266
15354
  const totalTime = (0, $cdee3562a1fa264f$export$9b8881d67105457d)((0, $c5bb589de61e43ba$export$e73da3986effb0a3));
15267
15355
  const maxVUs = (0, $cdee3562a1fa264f$export$9b8881d67105457d)((0, $c5bb589de61e43ba$export$b7fc4be04e2b72c4));
15356
+ const vuhs = (0, $cdee3562a1fa264f$export$9b8881d67105457d)((0, $c5bb589de61e43ba$export$e6bea69880c59e62));
15268
15357
  const usedLoadZones = (0, $cdee3562a1fa264f$export$9b8881d67105457d)((0, $cd701400f17d4ede$export$62a321f0b5eed932));
15269
15358
  const availableLoadZones = (0, $cdee3562a1fa264f$export$9b8881d67105457d)((0, $90b0cfd5919312e7$export$15d5f46743a7d01c));
15270
15359
  const loadZones = (0, $gkIgo$react.useMemo)(()=>{
@@ -15312,6 +15401,15 @@ const $02d0d7ea86297262$export$93f0f0dfc0a5be37 = ({ className: className })=>{
15312
15401
  children: /*#__PURE__*/ (0, $gkIgo$reactjsxruntime.jsxs)($02d0d7ea86297262$var$Container, {
15313
15402
  className: className,
15314
15403
  children: [
15404
+ /*#__PURE__*/ (0, $gkIgo$reactjsxruntime.jsxs)($02d0d7ea86297262$var$Group, {
15405
+ children: [
15406
+ /*#__PURE__*/ (0, $gkIgo$reactjsxruntime.jsx)((0, $723b70ee4d7f62e8$export$1ae172e61ce3735b), {}),
15407
+ /*#__PURE__*/ (0, $gkIgo$reactjsxruntime.jsx)("span", {
15408
+ children: (0, $4bac6ee95b8c8b72$export$362b9e721fb12a1b)(vuhs)
15409
+ }),
15410
+ "\xa0VUh"
15411
+ ]
15412
+ }),
15315
15413
  /*#__PURE__*/ (0, $gkIgo$reactjsxruntime.jsxs)($02d0d7ea86297262$var$Group, {
15316
15414
  children: [
15317
15415
  /*#__PURE__*/ (0, $gkIgo$reactjsxruntime.jsx)((0, $efeb6023758e4c8d$export$4202723ba73439f5), {}),
package/dist/module.js CHANGED
@@ -1076,6 +1076,7 @@ const $4cf6d05a57acd1d1$var$defaultContext = {
1076
1076
  ],
1077
1077
  DocsLinkComponent: (0, $a2bbc3b49e805484$export$e816d7af81d48a79),
1078
1078
  hasCloudExecution: false,
1079
+ hasFractionalVUhResolution: false,
1079
1080
  readonlyScriptScenarios: true,
1080
1081
  TestBuilderIconComponent: (0, $a80b21e889559c22$export$cc0ae9a5c96bcd6f),
1081
1082
  apmConfigs: [],
@@ -1609,6 +1610,9 @@ function $8497e93aef02a037$export$c38d1d963d26061e(state) {
1609
1610
  function $8497e93aef02a037$export$ae763f5129c1544a(state) {
1610
1611
  return state.ui.hasCloudExecution;
1611
1612
  }
1613
+ function $8497e93aef02a037$export$e6a428d399561b3f(state) {
1614
+ return state.ui.hasFractionalVUhResolution;
1615
+ }
1612
1616
  function $8497e93aef02a037$export$15d5f46743a7d01c(state) {
1613
1617
  return state.ui.availableLoadZones;
1614
1618
  }
@@ -1635,6 +1639,7 @@ const $7ef4afb8c4d4abe0$export$d4c72bab9d6cc13a = {
1635
1639
  view: "scenarios/default",
1636
1640
  // 'default' doesn't mean anything special, it's instead of an id
1637
1641
  hasCloudExecution: false,
1642
+ hasFractionalVUhResolution: false,
1638
1643
  availableLoadZones: []
1639
1644
  };
1640
1645
 
@@ -1690,6 +1695,9 @@ const $7761e2aa524882e4$export$83c693298dde2c4f = (0, $b7VBt$createSlice)({
1690
1695
  setHasCloudExecution (state, action) {
1691
1696
  state.hasCloudExecution = action.payload;
1692
1697
  },
1698
+ setHasFractionalVUhResolution (state, action) {
1699
+ state.hasFractionalVUhResolution = action.payload;
1700
+ },
1693
1701
  setAvailableLoadZones (state, action) {
1694
1702
  state.availableLoadZones = action.payload;
1695
1703
  },
@@ -1705,7 +1713,7 @@ const $7761e2aa524882e4$export$95881ffef5b0c248 = $7761e2aa524882e4$export$83c69
1705
1713
  const $7761e2aa524882e4$export$e324594224ef24da = $7761e2aa524882e4$export$83c693298dde2c4f.actions;
1706
1714
 
1707
1715
 
1708
- const { init: $8592aa8dcb3902ac$export$2cd8252107eb640b , setAdvancedOptionsTab: $8592aa8dcb3902ac$export$267d608097309f30 , setAvailableLoadZones: $8592aa8dcb3902ac$export$9f9f33201c1586de , setHasCloudExecution: $8592aa8dcb3902ac$export$f89a1b8f393b8bb6 , setIsLoading: $8592aa8dcb3902ac$export$9eaa806651dd33f0 , setView: $8592aa8dcb3902ac$export$78fa5045d0400717 , setIsSaving: $8592aa8dcb3902ac$export$ad10cacbaf4608fe , setShowTestScript: $8592aa8dcb3902ac$export$8fadc49d0b5909c , setUnsavedChanges: $8592aa8dcb3902ac$export$278d42400282afa6 } = (0, $7761e2aa524882e4$export$e324594224ef24da);
1716
+ const { init: $8592aa8dcb3902ac$export$2cd8252107eb640b , setAdvancedOptionsTab: $8592aa8dcb3902ac$export$267d608097309f30 , setAvailableLoadZones: $8592aa8dcb3902ac$export$9f9f33201c1586de , setHasCloudExecution: $8592aa8dcb3902ac$export$f89a1b8f393b8bb6 , setHasFractionalVUhResolution: $8592aa8dcb3902ac$export$92220e1782a52292 , setIsLoading: $8592aa8dcb3902ac$export$9eaa806651dd33f0 , setView: $8592aa8dcb3902ac$export$78fa5045d0400717 , setIsSaving: $8592aa8dcb3902ac$export$ad10cacbaf4608fe , setShowTestScript: $8592aa8dcb3902ac$export$8fadc49d0b5909c , setUnsavedChanges: $8592aa8dcb3902ac$export$278d42400282afa6 } = (0, $7761e2aa524882e4$export$e324594224ef24da);
1709
1717
 
1710
1718
 
1711
1719
 
@@ -2207,6 +2215,13 @@ function $f54872b9dc7588c3$export$5a00511f040384d7(timeInSeconds = 0) {
2207
2215
  }
2208
2216
  return `${Math.round(totalSeconds / 60)}min`;
2209
2217
  }
2218
+ function $f54872b9dc7588c3$export$435f89f92ea3c766(hasFractionalVUhResolution, vus, duration) {
2219
+ if (hasFractionalVUhResolution) return Math.max(1.0, $f54872b9dc7588c3$var$roundup(vus * duration / 3600, 0.01));
2220
+ else return Math.max(1.0, vus * Math.ceil(duration / 3600.0));
2221
+ }
2222
+ function $f54872b9dc7588c3$var$roundup(value, fraction) {
2223
+ return Math.ceil(value / fraction) * fraction;
2224
+ }
2210
2225
 
2211
2226
 
2212
2227
  function $3c3ef340187867fd$var$_defineProperty(obj, key, value) {
@@ -3142,6 +3157,11 @@ function $211a5ec4efef370d$export$ce740c17ce134c88(stages = []) {
3142
3157
  return Math.max(accumulator, Number(stage.target));
3143
3158
  }, 0);
3144
3159
  }
3160
+ function $211a5ec4efef370d$export$33cd2c632b520a28(stages = []) {
3161
+ return stages.reduce((accumulator, stage)=>{
3162
+ return Math.max(accumulator, $211a5ec4efef370d$export$35d89f711450937a(stage.duration));
3163
+ }, 0);
3164
+ }
3145
3165
  function $211a5ec4efef370d$export$35d89f711450937a(duration = "") {
3146
3166
  const regexp = new RegExp(/(\d+|\d+\.\d+)([hms])/gim);
3147
3167
  const matches = [
@@ -3181,6 +3201,7 @@ function $211a5ec4efef370d$export$9427da4570bcea21(target) {
3181
3201
 
3182
3202
 
3183
3203
 
3204
+
3184
3205
  const { selectAll: $d7b1b7c6f96b1d0a$var$selectAll , selectTotal: $d7b1b7c6f96b1d0a$var$selectTotal , selectById: $d7b1b7c6f96b1d0a$var$selectById , selectIds: $d7b1b7c6f96b1d0a$var$selectIds } = (0, $41ac3dbeb5bfb5b0$export$8317e238293a29c9).getSelectors((state)=>state.scenarios);
3185
3206
  function $d7b1b7c6f96b1d0a$export$3c3c871389323db3(state) {
3186
3207
  if (!state.scenarios) return [];
@@ -3478,6 +3499,41 @@ const $d7b1b7c6f96b1d0a$export$b7fc4be04e2b72c4 = (0, $b7VBt$createSelector)($d7
3478
3499
  }, 0);
3479
3500
  return exact ? max : `≥ ${max}`;
3480
3501
  });
3502
+ const $d7b1b7c6f96b1d0a$export$e6bea69880c59e62 = (0, $b7VBt$createSelector)($d7b1b7c6f96b1d0a$export$3c3c871389323db3, (0, $8497e93aef02a037$export$e6a428d399561b3f), (scenarios, hasFractionalVUhResolution)=>{
3503
+ let exact = true;
3504
+ const vuhs = scenarios.reduce((accumulator, { options: options })=>{
3505
+ let addition = 0;
3506
+ switch(options.executor){
3507
+ case (0, $fb7850f041d915c8$export$98a460cbb8841ef).SharedIterations:
3508
+ addition = (0, $f54872b9dc7588c3$export$435f89f92ea3c766)(hasFractionalVUhResolution, options.vus || (0, $c7adc130bba31664$export$99cd8ce77b900de9).vus, (0, $211a5ec4efef370d$export$35d89f711450937a)(options.maxDuration));
3509
+ break;
3510
+ case (0, $fb7850f041d915c8$export$98a460cbb8841ef).PerVUIterations:
3511
+ addition = (0, $f54872b9dc7588c3$export$435f89f92ea3c766)(hasFractionalVUhResolution, options.vus || (0, $c7adc130bba31664$export$a8001a7c13efb87e).vus, (0, $211a5ec4efef370d$export$35d89f711450937a)(options.maxDuration));
3512
+ break;
3513
+ case (0, $fb7850f041d915c8$export$98a460cbb8841ef).ConstantVUs:
3514
+ addition = (0, $f54872b9dc7588c3$export$435f89f92ea3c766)(hasFractionalVUhResolution, options.vus || (0, $c7adc130bba31664$export$2c92437f53907be7).vus, (0, $211a5ec4efef370d$export$35d89f711450937a)(options.duration));
3515
+ break;
3516
+ case (0, $fb7850f041d915c8$export$98a460cbb8841ef).RampingVUs:
3517
+ addition = (0, $f54872b9dc7588c3$export$435f89f92ea3c766)(hasFractionalVUhResolution, (0, $211a5ec4efef370d$export$ce740c17ce134c88)(options.stages), (0, $211a5ec4efef370d$export$33cd2c632b520a28)(options.stages));
3518
+ break;
3519
+ case (0, $fb7850f041d915c8$export$98a460cbb8841ef).ConstantArrivalRate:
3520
+ case (0, $fb7850f041d915c8$export$98a460cbb8841ef).RampingArrivalRate:
3521
+ {
3522
+ const defaults = options.executor === (0, $fb7850f041d915c8$export$98a460cbb8841ef).ConstantArrivalRate ? (0, $c7adc130bba31664$export$7f7b8742f8fe13fc) : (0, $c7adc130bba31664$export$301f34b9bbf2e6c5);
3523
+ const vus = Math.max(options.preAllocatedVUs || defaults.preAllocatedVUs, options.maxVUs || defaults.maxVUs || 0);
3524
+ const duration = options.executor === (0, $fb7850f041d915c8$export$98a460cbb8841ef).ConstantArrivalRate ? (0, $211a5ec4efef370d$export$35d89f711450937a)(options.duration) : (0, $211a5ec4efef370d$export$33cd2c632b520a28)(options.stages);
3525
+ addition = (0, $f54872b9dc7588c3$export$435f89f92ea3c766)(hasFractionalVUhResolution, vus, duration);
3526
+ if (!options.maxVUs && !defaults.maxVUs) exact = false;
3527
+ break;
3528
+ }
3529
+ default:
3530
+ (0, $77857f570335d7ae$export$af88d00dbe7f521).error("getVUhs: Trying to get VUhs for unknown executor type (%s)", // @ts-ignore
3531
+ options.executor);
3532
+ }
3533
+ return accumulator + addition;
3534
+ }, 0);
3535
+ return exact ? vuhs : `≥ ${vuhs}`;
3536
+ });
3481
3537
  const $d7b1b7c6f96b1d0a$export$8b4afeb4d5ebc7f2 = (0, $b7VBt$createSelector)([
3482
3538
  $d7b1b7c6f96b1d0a$export$fc1e5a8eff15c4a5
3483
3539
  ], (scenario)=>{
@@ -5169,13 +5225,19 @@ function $f33bf9327a1ab3ee$export$9cc0a26cbe829bcb() {
5169
5225
  }
5170
5226
  function $f33bf9327a1ab3ee$export$e3a1a4f1e85dc208() {
5171
5227
  const dispatch = $f33bf9327a1ab3ee$export$371624ce4da5e319();
5172
- const { hasCloudExecution: hasCloudExecution = false , k6Test: k6Test , availableLoadZones: availableLoadZones = [] } = (0, $4cf6d05a57acd1d1$export$8bcb3cb1ba0d67a7)();
5228
+ const { hasCloudExecution: hasCloudExecution = false , hasFractionalVUhResolution: hasFractionalVUhResolution = false , k6Test: k6Test , availableLoadZones: availableLoadZones = [] } = (0, $4cf6d05a57acd1d1$export$8bcb3cb1ba0d67a7)();
5173
5229
  (0, $b7VBt$useEffect)(()=>{
5174
5230
  dispatch((0, $8592aa8dcb3902ac$export$f89a1b8f393b8bb6)(Boolean(hasCloudExecution)));
5175
5231
  }, [
5176
5232
  dispatch,
5177
5233
  hasCloudExecution
5178
5234
  ]);
5235
+ (0, $b7VBt$useEffect)(()=>{
5236
+ dispatch((0, $8592aa8dcb3902ac$export$92220e1782a52292)(Boolean(hasFractionalVUhResolution)));
5237
+ }, [
5238
+ dispatch,
5239
+ hasFractionalVUhResolution
5240
+ ]);
5179
5241
  (0, $b7VBt$useEffect)(()=>{
5180
5242
  const { loadZones: loadZones , config: config , thresholds: thresholds , scenarios: scenarios , name: name , id: id } = new (0, $ab0d82593c0c1516$export$1576fc997deee1a4)(k6Test).toObject();
5181
5243
  dispatch((0, $f4368230f633744e$export$a75bd9e6b09c915e)(loadZones));
@@ -8168,8 +8230,10 @@ const $d221d46810783302$export$9a75ed5a99cf0511 = (props)=>{
8168
8230
  ]);
8169
8231
  const disableStatistics = !statisticsOptions.length;
8170
8232
  const handleDelete = ()=>dispatch((0, $a6a312292842f1bc$export$b7e4565ed8378479)(index));
8233
+ const [valueError, setValueError] = (0, $b7VBt$useState)();
8171
8234
  const createOnChangeHandler = (key, onSuccess)=>{
8172
8235
  return ({ target: { value: value } })=>{
8236
+ if (key === "value" && typeof value === "string") validateThresholdValue(value);
8173
8237
  dispatch((0, $a6a312292842f1bc$export$7a98fbd10fd8a51f)(index, key, value));
8174
8238
  onSuccess && onSuccess(value);
8175
8239
  };
@@ -8179,6 +8243,11 @@ const $d221d46810783302$export$9a75ed5a99cf0511 = (props)=>{
8179
8243
  if ((0, $46f0f9c909db815a$export$2e33e3c2b2cbdd89)(value).find((s)=>s.value === statistic)) return;
8180
8244
  dispatch((0, $a6a312292842f1bc$export$7a98fbd10fd8a51f)(index, "statistic", ""));
8181
8245
  };
8246
+ const validateThresholdValue = (val)=>{
8247
+ if (!val) return;
8248
+ const regexpPositiveNumber = /^\d+(\.\d+)?$/;
8249
+ setValueError(regexpPositiveNumber.test(val) ? undefined : "enter a positive number");
8250
+ };
8182
8251
  (0, $b7VBt$useEffect)(()=>{
8183
8252
  // Set URL to default '' if the request with the selected URL has been deleted/modified
8184
8253
  if (url !== "" && url !== "all" && !requestsURLs.includes(url)) dispatch((0, $a6a312292842f1bc$export$7a98fbd10fd8a51f)(index, "url", ""));
@@ -8220,6 +8289,8 @@ const $d221d46810783302$export$9a75ed5a99cf0511 = (props)=>{
8220
8289
  value: value,
8221
8290
  placeholder: "Threshold value",
8222
8291
  onChange: createOnChangeHandler("value"),
8292
+ error: !!valueError,
8293
+ helperText: valueError,
8223
8294
  InputProps: {
8224
8295
  endAdornment: /*#__PURE__*/ (0, $b7VBt$jsx)((0, $b7VBt$InputAdornment), {
8225
8296
  position: "end",
@@ -14452,7 +14523,7 @@ function $59eb99f127c45ea7$export$9bb8a8c9de09825e({ children: children }) {
14452
14523
 
14453
14524
 
14454
14525
 
14455
- function $045b658c7184976c$export$f290710bbb710efa({ loading: loading , saving: saving , k6Test: k6Test , hasCloudExecution: hasCloudExecution , availableLoadZones: availableLoadZones = [
14526
+ function $045b658c7184976c$export$f290710bbb710efa({ loading: loading , saving: saving , k6Test: k6Test , hasCloudExecution: hasCloudExecution , hasFractionalVUhResolution: hasFractionalVUhResolution , availableLoadZones: availableLoadZones = [
14456
14527
  {
14457
14528
  id: 1,
14458
14529
  country: "us",
@@ -14464,6 +14535,7 @@ function $045b658c7184976c$export$f290710bbb710efa({ loading: loading , saving:
14464
14535
  const context = {
14465
14536
  k6Test: k6Test,
14466
14537
  hasCloudExecution: hasCloudExecution,
14538
+ hasFractionalVUhResolution: hasFractionalVUhResolution,
14467
14539
  availableLoadZones: availableLoadZones,
14468
14540
  DocsLinkComponent: DocsLinkComponent,
14469
14541
  onViewChange: onViewChange,
@@ -15224,6 +15296,22 @@ const $ff01a446e890cae0$export$4202723ba73439f5 = /*#__PURE__*/ (0, $b7VBt$forwa
15224
15296
 
15225
15297
 
15226
15298
 
15299
+
15300
+
15301
+ const $f90e6ac18264291c$export$1ae172e61ce3735b = /*#__PURE__*/ (0, $b7VBt$forwardRef)(({ props: props }, ref)=>/*#__PURE__*/ (0, $b7VBt$jsx)("svg", {
15302
+ ref: ref,
15303
+ xmlns: "http://www.w3.org/2000/svg",
15304
+ width: "1.1em",
15305
+ height: "1.2em",
15306
+ viewBox: "0 0 24 24",
15307
+ ...props,
15308
+ children: /*#__PURE__*/ (0, $b7VBt$jsx)("path", {
15309
+ fill: "currentColor",
15310
+ d: "M8.46777,8.39453l-.00225.00183-.00214.00208ZM18.42188,8.208a1.237,1.237,0,0,0-.23-.17481.99959.99959,0,0,0-1.39941.41114,5.78155,5.78155,0,0,1-1.398,1.77734,8.6636,8.6636,0,0,0,.1333-1.50977,8.71407,8.71407,0,0,0-4.40039-7.582,1.00009,1.00009,0,0,0-1.49121.80567A7.017,7.017,0,0,1,7.165,6.87793l-.23047.1875a8.51269,8.51269,0,0,0-1.9873,1.8623A8.98348,8.98348,0,0,0,8.60254,22.83594.99942.99942,0,0,0,9.98,21.91016a1.04987,1.04987,0,0,0-.0498-.3125,6.977,6.977,0,0,1-.18995-2.58106,9.004,9.004,0,0,0,4.3125,4.0166.997.997,0,0,0,.71534.03809A8.99474,8.99474,0,0,0,18.42188,8.208ZM14.51709,21.03906a6.964,6.964,0,0,1-3.57666-4.40234,8.90781,8.90781,0,0,1-.17969-.96387,1.00025,1.00025,0,0,0-.79931-.84473A.982.982,0,0,0,9.77,14.80957a.99955.99955,0,0,0-.8667.501,8.9586,8.9586,0,0,0-1.20557,4.71777,6.98547,6.98547,0,0,1-1.17529-9.86816,6.55463,6.55463,0,0,1,1.562-1.458.74507.74507,0,0,0,.07422-.05469s.29669-.24548.30683-.2511a8.96766,8.96766,0,0,0,2.89874-4.63269,6.73625,6.73625,0,0,1,1.38623,8.08789,1.00024,1.00024,0,0,0,1.18359,1.418,7.85568,7.85568,0,0,0,3.86231-2.6875,7.00072,7.00072,0,0,1-3.2793,10.457Z"
15311
+ })
15312
+ }));
15313
+
15314
+
15227
15315
  const $600e66eeb9e75faf$var$Group = /*#__PURE__*/ (0, $b7VBt$styledcomponents).div.withConfig({
15228
15316
  displayName: "TestMetaInformation__Group",
15229
15317
  componentId: "sc-1iuml17-0"
@@ -15242,6 +15330,7 @@ const $600e66eeb9e75faf$var$Container = /*#__PURE__*/ (0, $b7VBt$styledcomponent
15242
15330
  const $600e66eeb9e75faf$export$93f0f0dfc0a5be37 = ({ className: className })=>{
15243
15331
  const totalTime = (0, $f33bf9327a1ab3ee$export$9b8881d67105457d)((0, $d7b1b7c6f96b1d0a$export$e73da3986effb0a3));
15244
15332
  const maxVUs = (0, $f33bf9327a1ab3ee$export$9b8881d67105457d)((0, $d7b1b7c6f96b1d0a$export$b7fc4be04e2b72c4));
15333
+ const vuhs = (0, $f33bf9327a1ab3ee$export$9b8881d67105457d)((0, $d7b1b7c6f96b1d0a$export$e6bea69880c59e62));
15245
15334
  const usedLoadZones = (0, $f33bf9327a1ab3ee$export$9b8881d67105457d)((0, $27ada388e04e2c5d$export$62a321f0b5eed932));
15246
15335
  const availableLoadZones = (0, $f33bf9327a1ab3ee$export$9b8881d67105457d)((0, $8497e93aef02a037$export$15d5f46743a7d01c));
15247
15336
  const loadZones = (0, $b7VBt$useMemo)(()=>{
@@ -15289,6 +15378,15 @@ const $600e66eeb9e75faf$export$93f0f0dfc0a5be37 = ({ className: className })=>{
15289
15378
  children: /*#__PURE__*/ (0, $b7VBt$jsxs)($600e66eeb9e75faf$var$Container, {
15290
15379
  className: className,
15291
15380
  children: [
15381
+ /*#__PURE__*/ (0, $b7VBt$jsxs)($600e66eeb9e75faf$var$Group, {
15382
+ children: [
15383
+ /*#__PURE__*/ (0, $b7VBt$jsx)((0, $f90e6ac18264291c$export$1ae172e61ce3735b), {}),
15384
+ /*#__PURE__*/ (0, $b7VBt$jsx)("span", {
15385
+ children: (0, $f54872b9dc7588c3$export$362b9e721fb12a1b)(vuhs)
15386
+ }),
15387
+ "\xa0VUh"
15388
+ ]
15389
+ }),
15292
15390
  /*#__PURE__*/ (0, $b7VBt$jsxs)($600e66eeb9e75faf$var$Group, {
15293
15391
  children: [
15294
15392
  /*#__PURE__*/ (0, $b7VBt$jsx)((0, $ff01a446e890cae0$export$4202723ba73439f5), {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/k6-test-builder",
3
- "version": "0.6.1-alpha.1",
3
+ "version": "0.7.0",
4
4
  "license": "AGPL-3.0",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/module.js",