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:
@@ -18,8 +18,8 @@ ecmascript@0.16.2 # Enable ECMAScript2015+ syntax in app code
|
||||
typescript@4.5.4 # Enable TypeScript syntax in .ts and .tsx modules
|
||||
shell-server@0.5.0 # Server-side component of the `meteor shell` command
|
||||
|
||||
aldeed:collection2 # Attaches a schema to a collection
|
||||
aldeed:schema-index # Allows the schema to specify fields to be indexed
|
||||
#aldeed:collection2 # Attaches a schema to a collection
|
||||
#aldeed:schema-index # Allows the schema to specify fields to be indexed
|
||||
|
||||
svelte:compiler
|
||||
#static-html@1.3.2
|
||||
|
||||
@@ -5,11 +5,6 @@ accounts-password@2.3.1
|
||||
accounts-ui@1.4.2
|
||||
accounts-ui-unstyled@1.7.0
|
||||
alanning:roles@3.4.0
|
||||
aldeed:collection2@2.10.0
|
||||
aldeed:collection2-core@1.2.0
|
||||
aldeed:schema-deny@1.1.0
|
||||
aldeed:schema-index@1.1.1
|
||||
aldeed:simple-schema@1.5.4
|
||||
allow-deny@1.1.1
|
||||
autoupdate@1.8.0
|
||||
babel-compiler@7.9.0
|
||||
@@ -52,7 +47,6 @@ launch-screen@1.3.0
|
||||
less@4.0.0
|
||||
localstorage@1.2.0
|
||||
logging@1.3.1
|
||||
mdg:validation-error@0.2.0
|
||||
meteor@1.10.0
|
||||
meteor-base@1.5.1
|
||||
meteortesting:browser-tests@1.3.5
|
||||
@@ -78,7 +72,6 @@ oauth2@1.3.1
|
||||
observe-sequence@1.0.20
|
||||
ordered-dict@1.1.0
|
||||
promise@0.12.0
|
||||
raix:eventemitter@0.1.3
|
||||
random@1.2.0
|
||||
rate-limit@1.0.9
|
||||
rdb:svelte-meteor-data@1.0.0
|
||||
|
||||
@@ -2,7 +2,7 @@ import {Mongo} from "meteor/mongo";
|
||||
import {Meteor} from "meteor/meteor";
|
||||
import { check } from 'meteor/check';
|
||||
import { Roles } from 'meteor/alanning:roles';
|
||||
import SimpleSchema from "simpl-schema";
|
||||
//import SimpleSchema from "simpl-schema";
|
||||
import {AssetTypes} from "./asset-types";
|
||||
|
||||
export const AssetAssignments = new Mongo.Collection('assetAssignments');
|
||||
|
||||
@@ -2,7 +2,7 @@ import {Mongo} from "meteor/mongo";
|
||||
import {Meteor} from "meteor/meteor";
|
||||
import { check } from 'meteor/check';
|
||||
import { Roles } from 'meteor/alanning:roles';
|
||||
import SimpleSchema from "simpl-schema";
|
||||
//import SimpleSchema from "simpl-schema";
|
||||
|
||||
//
|
||||
// An asset type is a specific type of equipment. Example: Lenovo 100e Chromebook.
|
||||
|
||||
@@ -2,7 +2,7 @@ import {Mongo} from "meteor/mongo";
|
||||
import {Meteor} from "meteor/meteor";
|
||||
import { check } from 'meteor/check';
|
||||
import { Roles } from 'meteor/alanning:roles';
|
||||
import SimpleSchema from "simpl-schema";
|
||||
//import SimpleSchema from "simpl-schema";
|
||||
import {AssetTypes} from "./asset-types";
|
||||
|
||||
export const Assets = new Mongo.Collection('assets');
|
||||
|
||||
@@ -52,10 +52,15 @@ if (Meteor.isServer) {
|
||||
$regex: params.email,
|
||||
$options: "i"
|
||||
} : params.email;
|
||||
else if (params.date) { //Assume that date is a number. Finds all Chromebook Data with the last check in time greater than or equal to the given date.
|
||||
query.endTime = {'$gte': params.date}
|
||||
}
|
||||
|
||||
// console.log("Collecting Chromebook Data: ");
|
||||
// console.log(query);
|
||||
let result = Meteor.Records.find(query).fetch();
|
||||
console.log("Collecting Chromebook Data: ");
|
||||
console.log(query);
|
||||
|
||||
//Sort by the last time the record was updated from most to least recent.
|
||||
let result = Meteor.Records.find(query, {sort: {endTime: -1}}).fetch();
|
||||
// console.log("Found: ");
|
||||
// console.log(result);
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
16
imports/ui/DateInput.svelte
Normal file
16
imports/ui/DateInput.svelte
Normal file
@@ -0,0 +1,16 @@
|
||||
<script>
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
export let format = 'YYYY-MM-DD'
|
||||
export let date = new Date()
|
||||
|
||||
let internal
|
||||
|
||||
const input = (x) => (internal = dayjs(x).format(format))
|
||||
const output = (x) => (date = dayjs(x, format).toDate())
|
||||
|
||||
$: input(date)
|
||||
$: output(internal)
|
||||
</script>
|
||||
|
||||
<input type="date" bind:value={internal} />
|
||||
727
package-lock.json
generated
727
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -14,12 +14,12 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.16.7",
|
||||
"connect-route": "^0.1.5",
|
||||
"dayjs": "^1.11.3",
|
||||
"html5-qrcode": "^2.2.0",
|
||||
"jquery": "^3.6.0",
|
||||
"meteor-node-stubs": "^1.0.0",
|
||||
"moment": "^2.29.2",
|
||||
"mongodb": "^4.4.1",
|
||||
"simpl-schema": "^1.12.2",
|
||||
"svelte": "^3.46.4",
|
||||
"svelte-material-ui": "^6.0.0-beta.16",
|
||||
"tinro": "^0.6.12",
|
||||
|
||||
32
server/CheckEnvironment.js
Normal file
32
server/CheckEnvironment.js
Normal file
@@ -0,0 +1,32 @@
|
||||
if(!process.env.MONGO_URL) {
|
||||
console.log("Must provide the MONGO_URL environment variable point to the district central's main database. Should be of the format: `mongodb://localhost:27017/DatabaseName` or `mongodb://user_name:password@host.domain.com,host2.domain.com,host3.domain.com/DatabaseName?replicaSet=set_name`.")
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if(!process.env.MONGO_URL2) {
|
||||
console.log("Must provide the MONGO_URL2 environment variable pointing to the chromebook data collection dataset. Should be of the format: `mongodb://localhost:27017/DatabaseName` or `mongodb://user_name:password@host.domain.com,host2.domain.com,host3.domain.com/DatabaseName?replicaSet=set_name`.")
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
try {
|
||||
let settings = Assets.getText('settings.json');
|
||||
}
|
||||
catch(e) {
|
||||
console.log("Must have a /private/settings.json file with the following format:");
|
||||
console.log(`
|
||||
{
|
||||
"google": {
|
||||
"clientId": "xxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
|
||||
"secret": "xxxxxxxxxxxxxxxxxxx",
|
||||
"loginStyle": "redirect",
|
||||
"scope": [
|
||||
"email",
|
||||
"https://www.googleapis.com/auth/plus.login",
|
||||
"https://www.googleapis.com/auth/contacts.readonly"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
`);
|
||||
process.exit(0);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
import './CheckEnvironment.js';
|
||||
import './DataCollection.js';
|
||||
import '../imports/api/';
|
||||
import './google-oauth.js';
|
||||
|
||||
Reference in New Issue
Block a user