Skip to content

Commit 74ab9f6

Browse files
authored
Merge pull request #3154 from catchpoint/master
promote to prod
2 parents be00d63 + 5aea7de commit 74ab9f6

File tree

8 files changed

+69
-74
lines changed

8 files changed

+69
-74
lines changed

www/assets/js/country-list/country-list.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
((window) => {
44
class CountrySelector {
5-
constructor(selector, subdivisionSelector, isoCompliantJsonBlob) {
5+
constructor(selector, subdivisionSelector, isoCompliantJsonBlob, initialCountry, initialState) {
66
this.countryList = isoCompliantJsonBlob;
77
this.countries = Object.keys(this.countryList).map((code) => {
88
return {
@@ -22,9 +22,12 @@
2222

2323
this.countrySelector = selector;
2424
this.subdivisionSelector = subdivisionSelector;
25+
this.countrySelector.value = initialCountry;
2526

2627
// Fill in subdivisions
27-
this.fillSubdivision(this.countries[0].code);
28+
this.fillSubdivision(initialCountry ?? this.countries[0].code);
29+
30+
this.subdivisionSelector.value = initialState;
2831

2932
// Attach listener
3033
this.countrySelector.addEventListener("change", (e) => {
@@ -47,6 +50,7 @@
4750
}
4851

4952
fillSubdivision(countryCode) {
53+
this.subdivisionSelector.value = undefined;
5054
const divisions = this.getSubdivisions(countryCode);
5155
const opts = Object.keys(divisions).map((key) => {
5256
return new Option(divisions[key], key);
@@ -60,4 +64,4 @@
6064
}
6165

6266
window.CountrySelector = CountrySelector;
63-
})(window);
67+
})(window);

www/constants.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ define('SETTINGS_PATH', realpath(WWW_PATH . '/settings/'));
1313
define('TEMP_DIR', realpath(WWW_PATH . '/tmp/'));
1414
define('OE_PATH', realpath(WWW_PATH . '/experiments/'));
1515

16-
define('WPT_SALT', '2502'); // used to force assets hash
16+
define('WPT_SALT', '2503'); // used to force assets hash
1717
define('VER_WEBPAGETEST', '21.07'); // webpagetest version
1818
define('VER_TYPOGRAPHY_CSS', @md5_file(ASSETS_PATH . '/css/typography.css') . WPT_SALT); // version of the typography css file
1919
define('VER_LAYOUT_CSS', @md5_file(ASSETS_PATH . '/css/layout.css') . WPT_SALT); // version of the layout css file

www/jsonResult.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
6262

6363
if ($ret['statusCode'] == 200) {
6464
$protocol = getUrlProtocol();
65-
$host = $_SERVER['HTTP_HOST'];
66-
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
65+
$host = $_SERVER['HTTP_HOST'];
66+
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
6767
$urlStart = "$protocol://$host$uri";
6868

6969
$testInfo = TestInfo::fromValues($id, $testPath, $test);
@@ -107,14 +107,14 @@
107107
function getRequestInfoFlags()
108108
{
109109
$getFlags = array(
110-
"average" => JsonResultGenerator::WITHOUT_AVERAGE,
111-
"standard" => JsonResultGenerator::WITHOUT_STDDEV,
112-
"median" => JsonResultGenerator::WITHOUT_MEDIAN,
113-
"runs" => JsonResultGenerator::WITHOUT_RUNS,
114-
"requests" => JsonResultGenerator::WITHOUT_REQUESTS,
115-
"console" => JsonResultGenerator::WITHOUT_CONSOLE,
116-
"lighthouse" => JsonResultGenerator::WITHOUT_LIGHTHOUSE,
117-
"rv" => JsonResultGenerator::WITHOUT_REPEAT_VIEW
110+
"average" => JsonResultGenerator::WITHOUT_AVERAGE,
111+
"standard" => JsonResultGenerator::WITHOUT_STDDEV,
112+
"median" => JsonResultGenerator::WITHOUT_MEDIAN,
113+
"runs" => JsonResultGenerator::WITHOUT_RUNS,
114+
"requests" => JsonResultGenerator::WITHOUT_REQUESTS,
115+
"console" => JsonResultGenerator::WITHOUT_CONSOLE,
116+
"lighthouse" => JsonResultGenerator::WITHOUT_LIGHTHOUSE,
117+
"rv" => JsonResultGenerator::WITHOUT_REPEAT_VIEW
118118
);
119119

120120
$infoFlags = array();
@@ -127,4 +127,4 @@ function getRequestInfoFlags()
127127
$infoFlags[] = JsonResultGenerator::BASIC_INFO_ONLY;
128128
}
129129
return $infoFlags;
130-
}
130+
}

www/templates/account/billing/update-payment-confirm-address.php

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@
3131
<label for="state">State</label>
3232
<div>
3333
<select autocomplete="off" name="state" data-country-selector="state-selector" required>
34-
35-
<?php foreach ($state_list as $state) : ?>
36-
<option value="<?= $state['code'] ?>" <?php if ($state['code'] == $state_code) {
37-
echo 'selected';
38-
} ?>>
34+
<?php foreach ($state_list as $state): ?>
35+
<option value="<?= $state['code'] ?>">
3936
<?= $state['name']; ?>
4037
</option>
4138
<?php endforeach; ?>
@@ -45,21 +42,8 @@
4542
<div class="info-container country">
4643
<label for="country">Country</label>
4744
<select autocomplete="off" name="country" data-country-selector="selector" required>
48-
<?php foreach ($country_list as $country) : ?>
49-
<?php
50-
$current_code = $country["code"];
51-
$selected_country = false;
52-
if (isset($country_code) && !is_null($country_code)) {
53-
if ($current_code == $country_code) {
54-
$selected_country = true;
55-
}
56-
} else {
57-
if ($current_code == 'US') {
58-
$selected_country = true;
59-
}
60-
}
61-
?>
62-
<option value="<?= $country["code"] ?>" <?= $selected_country ? 'selected' : '' ?>>
45+
<?php foreach ($country_list as $country): ?>
46+
<option value="<?= $country["code"] ?>">
6347
<?= $country["name"]; ?>
6448
</option>
6549
<?php endforeach; ?>
@@ -83,18 +67,19 @@
8367
<script>
8468
(() => {
8569
const countryList = <?= $country_list_json_blob ?>;
70+
const initialCountry = "<?= $country_code ?>";
71+
const initialState = "<?= $state_code ?>";
8672
if (document.readyState === "loading") {
8773
document.addEventListener("DOMContentLoaded", () => {
8874
const countrySelectorEl = document.querySelector("[data-country-selector=selector]");
8975
const divisionSelectorEl = document.querySelector("[data-country-selector=state-selector]");
9076

91-
new CountrySelector(countrySelectorEl, divisionSelectorEl, countryList);
77+
new CountrySelector(countrySelectorEl, divisionSelectorEl, countryList, initialCountry, initialState);
9278
});
9379
} else {
9480
const countrySelectorEl = document.querySelector("[data-country-selector=selector]");
9581
const divisionSelectorEl = document.querySelector("[data-country-selector=state-selector]");
96-
97-
new CountrySelector(countrySelectorEl, divisionSelectorEl, countryList);
82+
new CountrySelector(countrySelectorEl, divisionSelectorEl, countryList, initialCountry, initialState);
9883
}
9984
})();
10085
</script>

www/templates/account/includes/signup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<tr>
3232
<th scope="col">Locations</th>
3333
<td>30</td>
34-
<td>40 <sup><a href="#fn1" id="ref1">*</a></sup></td>
34+
<td>35+<sup><a href="#fn1" id="ref1">*</a></sup></td>
3535
</tr>
3636

3737
<tr>

www/templates/account/plans/upgrade-plan.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@
202202
<tr>
203203
<th scope="col">Locations</th>
204204
<td>30</td>
205-
<td>40<sup><a href="#fn1" id="ref2">*</a></sup></td>
206-
<td>40<sup><a href="#fn1" id="ref1">*</a></sup></td>
205+
<td>35+<sup><a href="#fn1" id="ref2">*</a></sup></td>
206+
<td>35+<sup><a href="#fn1" id="ref1">*</a></sup></td>
207207
</tr>
208208

209209
<tr>

www/templates/account/signup/step-1.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@
190190
<tr>
191191
<th scope="col">Locations</th>
192192
<td>30</td>
193-
<td>40<sup><a href="#fn1" id="ref2">*</a></sup></td>
194-
<td>40<sup><a href="#fn1" id="ref1">*</a></sup></td>
193+
<td>35+<sup><a href="#fn1" id="ref2">*</a></sup></td>
194+
<td>35+<sup><a href="#fn1" id="ref1">*</a></sup></td>
195195
</tr>
196196

197197
<tr>

www/testStatus.inc

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ $testQueue = array();
1010
$testInfoJson = null;
1111

1212
/**
13-
* Get the status of the given test ID (and return the info in an array)
14-
*
15-
*/
13+
* Get the status of the given test ID (and return the info in an array)
14+
*
15+
*/
1616
function GetTestStatus($id, $includePosition = true)
1717
{
1818
$testServer = GetServerForTest($id);
1919
if (isset($testServer)) {
20-
// Proxy the status through the server that actually owns the test
20+
// Proxy the status through the server that actually owns the test
2121
$pos = $includePosition ? '1' : '0';
2222
$status = json_decode(http_fetch("{$testServer}testStatus.php?test=$id&pos=$pos"), true);
2323
if (is_array($status) && isset($status['data'])) {
@@ -30,7 +30,7 @@ function GetTestStatus($id, $includePosition = true)
3030
}
3131
$testPath = './' . GetTestPath($id);
3232

33-
// Fast-path for pending tests when we don't need to know the queue position (avoid test and location locks)
33+
// Fast-path for pending tests when we don't need to know the queue position (avoid test and location locks)
3434
if (file_exists("$testPath/test.scheduled") && !file_exists("$testPath/.archived")) {
3535
$ret = array('statusCode' => 101, 'statusText' => 'Test pending', 'id' => $id);
3636
$status = GetSchedulerTestStatus($id);
@@ -47,10 +47,12 @@ function GetTestStatus($id, $includePosition = true)
4747
$ret['statusText'] = "Waiting at the front of the queue...";
4848
}
4949
} else {
50-
$ret = array('statusCode' => 100,
51-
'statusText' => 'Test just started',
52-
'startTime' => gmdate("m/d/y G:i:s"),
53-
'id' => $id);
50+
$ret = array(
51+
'statusCode' => 100,
52+
'statusText' => 'Test just started',
53+
'startTime' => gmdate("m/d/y G:i:s"),
54+
'id' => $id
55+
);
5456
}
5557
}
5658
return $ret;
@@ -71,10 +73,12 @@ function GetTestStatus($id, $includePosition = true)
7173
@unlink("$testPath/test.requeued");
7274
@unlink("$testPath/test.running");
7375
} else {
74-
$ret = array('statusCode' => 100,
75-
'statusText' => 'Test just started',
76-
'startTime' => gmdate("m/d/y G:i:s", filemtime("$testPath/test.running")),
77-
'id' => $id);
76+
$ret = array(
77+
'statusCode' => 100,
78+
'statusText' => 'Test just started',
79+
'startTime' => gmdate("m/d/y G:i:s", filemtime("$testPath/test.running")),
80+
'id' => $id
81+
);
7882
$testInfoJson = GetTestInfo($id);
7983
PopulateTestInfoJson($ret, $testInfoJson);
8084
if ($elapsed == 0) {
@@ -98,10 +102,12 @@ function GetTestStatus($id, $includePosition = true)
98102
return $ret;
99103
}
100104
} elseif (is_file("$testPath/test.complete") || file_exists("$testPath/.archived")) {
101-
$ret = array('statusCode' => 200,
102-
'statusText' => 'Test Complete',
103-
'id' => $id,
104-
'completeTime' => gmdate("m/d/y G:i:s", filemtime("$testPath/test.complete")));
105+
$ret = array(
106+
'statusCode' => 200,
107+
'statusText' => 'Test Complete',
108+
'id' => $id,
109+
'completeTime' => gmdate("m/d/y G:i:s", filemtime("$testPath/test.complete"))
110+
);
105111
$testInfoJson = GetTestInfo($id);
106112
PopulateTestInfoJson($ret, $testInfoJson);
107113
return $ret;
@@ -152,7 +158,7 @@ function GetTestStatus($id, $includePosition = true)
152158
}
153159
if (
154160
(array_key_exists('started', $testInfoJson) &&
155-
$testInfoJson['started']) ||
161+
$testInfoJson['started']) ||
156162
isset($test['test']['completeTime'])
157163
) {
158164
$ret['startTime'] = isset($test['test']['startTime']) ? $test['test']['startTime'] : $now;
@@ -174,9 +180,9 @@ function GetTestStatus($id, $includePosition = true)
174180
} else {
175181
$ret['statusCode'] = 100;
176182
if ($elapsed == 0) {
177-
$ret['statusText'] = "Test just started";
183+
$ret['statusText'] = "Test just started";
178184
} elseif ($elapsed == 1) {
179-
$ret['statusText'] = "Test Started $elapsed second ago";
185+
$ret['statusText'] = "Test Started $elapsed second ago";
180186
} elseif ($elapsed < 60) {
181187
$ret['statusText'] = "Test Started $elapsed seconds ago";
182188
} else {
@@ -241,7 +247,7 @@ function GetTestStatus($id, $includePosition = true)
241247
$rvRuns = 0;
242248
for ($run = 1; $run <= $runs; $run++) {
243249
if (gz_is_file("$testPath/{$run}_IEWPG.txt") || gz_is_file("$testPath/{$run}_devtools.json.txt")) {
244-
$fvRuns++;
250+
$fvRuns++;
245251
}
246252
if (gz_is_file("$testPath/{$run}_Cached_IEWPG.txt") || gz_is_file("$testPath/{$run}_Cached_devtools.json.txt")) {
247253
$rvRuns++;
@@ -261,14 +267,14 @@ function GetTestStatus($id, $includePosition = true)
261267
$ret['statusText'] = "Completed {$ret['testsCompleted']} of {$ret['testsExpected']} tests";
262268
}
263269

264-
// TODO: Add actual summary-result information
270+
// TODO: Add actual summary-result information
265271
}
266272
} else {
267273
if ($includePosition && array_key_exists('workdir', $testInfoJson)) {
268274
$count = FindJobPosition($testInfoJson['location'], $testInfoJson['workdir'], $id);
269275
if ($count >= 0) {
270-
$ret['statusCode'] = 101;
271-
$ret['behindCount'] = $count;
276+
$ret['statusCode'] = 101;
277+
$ret['behindCount'] = $count;
272278
if ($count > 1) {
273279
$ret['statusText'] = "Waiting behind $count other tests...";
274280
} elseif ($count == 1) {
@@ -286,7 +292,7 @@ function GetTestStatus($id, $includePosition = true)
286292
$ret['statusCode'] = 401;
287293
$ret['statusText'] = 'Test request not found';
288294

289-
// Force the test to end - something went Very Wrong (tm)
295+
// Force the test to end - something went Very Wrong (tm)
290296
$lock = LockTest($id);
291297
if ($lock) {
292298
$testInfoJson = GetTestInfo($id);
@@ -295,7 +301,7 @@ function GetTestStatus($id, $includePosition = true)
295301
$test = file_get_contents("$testPath/testinfo.ini");
296302
$date = gmdate("m/d/y G:i:s", $now);
297303

298-
// Update the completion time if it isn't already set
304+
// Update the completion time if it isn't already set
299305
if (!strpos($test, 'completeTime')) {
300306
$complete = "[test]\r\ncompleteTime=$date";
301307
$out = str_replace('[test]', $complete, $test);
@@ -334,10 +340,10 @@ function GetTestStatusText($id)
334340
}
335341

336342
/**
337-
* Check the status of a batch test
338-
*
339-
* @param mixed $status
340-
*/
343+
* Check the status of a batch test
344+
*
345+
* @param mixed $status
346+
*/
341347
function GetBatchStatus(&$status)
342348
{
343349
$dirty = false;
@@ -469,7 +475,7 @@ function array2xml($array, $xml = false)
469475

470476
foreach ($array as $key => $value) {
471477
if (is_array($value)) {
472-
//get children
478+
//get children
473479
array2xml($value, $xml->addChild($key));
474480
} else {
475481
$xml->addChild($key, $value);

0 commit comments

Comments
 (0)