-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(history): enabled for logged in user
This change allows our logged in users to take advantage of the same page that our current logged out users use, except without the indexdb! We had to change the order in which a few things were loaded, as well, just so we could make sure the $owner global was set properly. We also changed types to better match what CP was providing us
- Loading branch information
1 parent
591d7f5
commit fef351e
Showing
9 changed files
with
287 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
(function(window) { | ||
window.filterHistory = filterHistory; | ||
|
||
function filterHistory() { | ||
const input = document.getElementById("filter"); | ||
const filter = input.value.toUpperCase(); | ||
const table = document.getElementById("historyBody"); | ||
const rows = table.getElementsByTagName("tr"); | ||
|
||
for (let i = 0; i < rows.length; i++) { | ||
const row = rows[i]; | ||
if (row) { | ||
txtValue = row.textContent || row.innerText; | ||
if (txtValue.toUpperCase().indexOf(filter) > -1) { | ||
row.style.display = ""; | ||
} else { | ||
row.style.display = "none"; | ||
} | ||
} | ||
} | ||
} | ||
|
||
}(window)); | ||
|
||
((window) => { | ||
if (document.readyState === 'loading') { | ||
document.addEventListener('DOMContentLoaded', () => { | ||
handleDaySelector(); | ||
}); | ||
} else { | ||
handleDaySelector(); | ||
} | ||
|
||
function handleDaySelector () { | ||
const daySelector = document.querySelector('select[name=days]') | ||
daySelector.addEventListener('change', (e) => { | ||
const days = e.target.value; | ||
const protocol = window.location.protocol; | ||
const hostname = window.location.hostname; | ||
const redirectUri = protocol + "//" + hostname + "/testlog/" + days + "/"; | ||
|
||
window.location = redirectUri; | ||
}) | ||
} | ||
})(window); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace WebPageTest; | ||
|
||
/** | ||
* A test history object, as tracked by CP | ||
*/ | ||
class TestRecord implements \JsonSerializable | ||
{ | ||
private int $id; | ||
private string $test_id; | ||
private string $url; | ||
private string $location; | ||
private string $label; | ||
private string $test_start_time; | ||
private string $user; | ||
private ?string $api_key; | ||
|
||
public function __construct(array $options = []) | ||
{ | ||
$this->id = $options['id']; | ||
$this->test_id = $options['testId']; | ||
$this->url = $options['url']; | ||
$this->location = $options['location']; | ||
$this->label = $options['label']; | ||
$this->test_start_time = $options['testStartTime']; | ||
$this->user = $options['user']; | ||
$this->api_key = $options['apiKey'] ?? null; | ||
} | ||
|
||
public function getId(): int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function getTestId(): string | ||
{ | ||
return $this->test_id; | ||
} | ||
|
||
public function getUrl(): string | ||
{ | ||
return $this->url; | ||
} | ||
|
||
public function getLocation(): string | ||
{ | ||
return $this->location; | ||
} | ||
|
||
public function getLabel(): string | ||
{ | ||
return $this->label; | ||
} | ||
|
||
public function getStartTime(): string | ||
{ | ||
return $this->test_start_time; | ||
} | ||
|
||
public function getUser(): string | ||
{ | ||
return $this->user; | ||
} | ||
|
||
public function getApiKey(): ?string | ||
{ | ||
return $this->api_key; | ||
} | ||
|
||
public function jsonSerialize(): array | ||
{ | ||
return [ | ||
'id' => $this->id, | ||
'testId' => $this->test_id, | ||
'url' => $this->url, | ||
'location' => $this->location, | ||
'label' => $this->label, | ||
'testStartTime' => $this->test_start_time, | ||
'user' => $this->user, | ||
'apiKey' => $this->api_key | ||
]; | ||
} | ||
} |
Oops, something went wrong.