Added a search for Chromebook usage after a specific date. Removed references to the schema code which was not working. Ran into a deployment issue that requires I manually run sudo npm run install from the bundle/programs/server folder after deploying.
This commit is contained in:
@@ -54,15 +54,30 @@
|
||||
import HelperText from '@smui/textfield/helper-text';
|
||||
import Icon from '@smui/textfield/icon';
|
||||
import { Icon as CommonIcon } from '@smui/common';
|
||||
import DateInput from "./DateInput.svelte";
|
||||
|
||||
let serialInput = null;
|
||||
let emailInput = null;
|
||||
let dateInput = null;
|
||||
|
||||
$: serialInput = null;
|
||||
$: emailInput = null;
|
||||
function serialSearch() {
|
||||
router.goto("/chromebooks?serial=" + encodeURIComponent(serialInput) + "®ex=true");
|
||||
}
|
||||
function emailSearch() {
|
||||
router.goto("/chromebooks?email=" + encodeURIComponent(emailInput) + "®ex=true");
|
||||
}
|
||||
function dateSearch() {
|
||||
console.log("Date Search")
|
||||
console.log(dateInput);
|
||||
|
||||
if(dateInput) {
|
||||
console.log(dateInput instanceof Date)
|
||||
//console.log(!isNaN(date.valueOf()));
|
||||
console.log(dateInput.getTime())
|
||||
}
|
||||
if(dateInput && dateInput instanceof Date)
|
||||
router.goto("/chromebooks?date=" + encodeURIComponent(dateInput.getTime()));
|
||||
}
|
||||
|
||||
// console.log("Loading Script");
|
||||
// //Attempt to listen for URL changes (query portion specifically).
|
||||
@@ -85,37 +100,44 @@
|
||||
// console.log("Params: ");
|
||||
// console.log(params);
|
||||
|
||||
$: deviceId = null;
|
||||
$: serial = null;
|
||||
$: email = null
|
||||
$: regex = false;
|
||||
let deviceId = null;
|
||||
let serial = null;
|
||||
let email = null;
|
||||
let date = null;
|
||||
let regex = false;
|
||||
$: router.subscribe(query => {
|
||||
deviceId = router.location.query.get("deviceId");
|
||||
serial = router.location.query.get("serial");
|
||||
email = router.location.query.get("email");
|
||||
regex = router.location.query.get("regex");
|
||||
date = router.location.query.get("date");
|
||||
|
||||
if(deviceId) deviceId = decodeURIComponent(deviceId);
|
||||
if(serial) serial = decodeURIComponent(serial);
|
||||
if(email) email = decodeURIComponent(email);
|
||||
if(date) date = decodeURIComponent(date);
|
||||
if(regex) regex = true;
|
||||
|
||||
// console.log("Query:");
|
||||
// console.log(deviceId);
|
||||
// console.log(serial);
|
||||
// console.log(email);
|
||||
// console.log(date);
|
||||
});
|
||||
$: chromebookData = null;
|
||||
let chromebookData = null;
|
||||
$: {
|
||||
if(deviceId || serial || email) {
|
||||
if(deviceId || serial || email || date) {
|
||||
let params = {};
|
||||
|
||||
if(deviceId) params.deviceId = deviceId;
|
||||
else if(serial) params.serial = serial;
|
||||
else if(email) params.email = email;
|
||||
else if(date) params.date = parseInt(date, 10);
|
||||
|
||||
if(regex) params.regex = true;
|
||||
if(!date && regex) params.regex = true;
|
||||
|
||||
console.log("Calling DataCollection.chromebookData")
|
||||
console.log(params);
|
||||
Meteor.call("DataCollection.chromebookData", params, (error, result) => {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
@@ -174,6 +196,11 @@
|
||||
<input type="text" bind:value="{emailInput}" placeholder="Email"/>@avpanthers.org<br/>
|
||||
<button type="button" role="button" on:click={emailSearch}>Search</button>
|
||||
</li>
|
||||
<li>
|
||||
All records since: <br/>
|
||||
<DateInput bind:date={dateInput}/>
|
||||
<button type="button" role="button" on:click={dateSearch}>Search</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user