From c7625816086feace8262509d53151f8add51ba73 Mon Sep 17 00:00:00 2001 From: "DESKTOP-C9V2M01\\Zeeri" Date: Tue, 12 Jul 2022 11:26:36 -0700 Subject: [PATCH] Added a data entry page with initial content. --- .meteor/packages | 4 +- imports/api/assets.js | 25 ++-- imports/ui/Admin.svelte | 2 +- imports/ui/Assets.svelte | 168 +++-------------------- imports/ui/Assets/AssetDataEntry.svelte | 172 ++++++++++++++++++++++++ imports/ui/Assets/AssetList.svelte | 165 +++++++++++++++++++++++ package-lock.json | 41 +++--- package.json | 6 +- tsconfig.json | 40 ++++++ 9 files changed, 440 insertions(+), 183 deletions(-) create mode 100644 imports/ui/Assets/AssetDataEntry.svelte create mode 100644 imports/ui/Assets/AssetList.svelte create mode 100644 tsconfig.json diff --git a/.meteor/packages b/.meteor/packages index e1570ef..ce73cee 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -21,7 +21,6 @@ shell-server@0.5.0 # Server-side component of the `meteor shell` comm #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 rdb:svelte-meteor-data accounts-ui@1.4.2 @@ -32,7 +31,8 @@ accounts-google@1.4.0 service-configuration@1.3.0 google-config-ui@1.0.3 # Adds the UI for logging in via Google alanning:roles # Adds roles to the user -#zodern:melte #babrahams:constellation # Alternative to MeteorToys - Has problems because it requires jquery 1.11.11 and everything else wants 2.x or 3.x msavin:mongol # Free version of MeteorToys - Provides access to the client side MongoDB for debugging. (Ctrl-M to activate :: https://atmospherejs.com/msavin/mongol) +#zodern:melte # Alternative to meteor-svelte (https://github.com/meteor-svelte/meteor-svelte). Was more actively developed. +svelte:compiler # Switching back to this because of TS errors. diff --git a/imports/api/assets.js b/imports/api/assets.js index 3e9785f..8a57ed2 100644 --- a/imports/api/assets.js +++ b/imports/api/assets.js @@ -51,32 +51,37 @@ Meteor.methods({ check(assetTypeId, String); check(assetId, String); check(serial, String); + + // Convert the asset ID's to uppercase for storage to make searching easier. + assetId = assetId.toUpperCase(); if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { let assetType = AssetTypes.findOne({assetTypeId}); - if(assetType.hasSerial && serial || !assetType.hasSerial && !serial) { - if(serial) { - Assets.insert({assetTypeId, assetId, serial}); - } - else { - Assets.insert({assetTypeId, assetId}); - } + if(serial) { + Assets.insert({assetTypeId, assetId, serial}); } else { - //Should never get here due to client side validation. - console.log("Error: Must provide a serial for asset types marked as having one, and may not provide one for asset types not marked as having one.") + Assets.insert({assetTypeId, assetId}); } } }, 'assets.update'(_id, assetId, serial) { - //TODO: + check(_id, String); + check(assetId, String); + if(serial) check(serial, String); + + if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { + //TODO: Need to first verify there are no checked out assets to the staff member. + Assets.update({_id}, {$set: {assetId, serial}}); + } }, 'assets.remove'(_id) { check(_id, String); if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) { //TODO: Need to first verify there are no checked out assets to the staff member. + Assets.remove({_id}); } }, }); diff --git a/imports/ui/Admin.svelte b/imports/ui/Admin.svelte index 006c322..14d774c 100644 --- a/imports/ui/Admin.svelte +++ b/imports/ui/Admin.svelte @@ -237,7 +237,7 @@

Sites

- + {#if dirtySite}
diff --git a/imports/ui/Assets.svelte b/imports/ui/Assets.svelte index 0a644dd..4a7d4c2 100644 --- a/imports/ui/Assets.svelte +++ b/imports/ui/Assets.svelte @@ -1,164 +1,26 @@
-
-

Asset Types

-
- {#each $assetTypes as type} -
{selectAssetType(type)}}> -
{type.name}
-
{type.description}
-
- {/each} -
-
- -
-

Assets

- - {#if dirtyAsset} -
- -
- - Provide a unique asset ID string. - -
-
- - Provide a unique serial string for the asset. - -
- - - -
- {/if} -
-
+ + + + + + {#if activeTab && activeTab.id === 'list'} + + {:else if activeTab && activeTab.id === 'entry'} + + {/if}
\ No newline at end of file diff --git a/imports/ui/Assets/AssetDataEntry.svelte b/imports/ui/Assets/AssetDataEntry.svelte new file mode 100644 index 0000000..8a88ff0 --- /dev/null +++ b/imports/ui/Assets/AssetDataEntry.svelte @@ -0,0 +1,172 @@ + + +
+ + Asset Types + + + {#each $assetTypes as type} + (assetTypeDialogSelectedValue = type)} selected={assetTypeDialogSelectedValue === type}> + + {type.name} + {type.description} + + + {/each} + + + + + + + + +
+
+

Asset Types

+ + + {#each selectedAssetTypes as type} + (selectedAssetType = type)} selected={selectedAssetType === type}> + {type.name} + + {/each} + + +
+
+
+ + +
+
+ + +
+
+
+ +
+ + \ No newline at end of file diff --git a/imports/ui/Assets/AssetList.svelte b/imports/ui/Assets/AssetList.svelte new file mode 100644 index 0000000..b876bd7 --- /dev/null +++ b/imports/ui/Assets/AssetList.svelte @@ -0,0 +1,165 @@ + + +
+
+

Assets

+ + {#if dirtyAsset} +
+
+ +
+
+ + +
+
+ + +
+ +
+ + +
+
+ {/if} +
+
+
+ + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 56d665e..2d14298 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1370,7 +1370,7 @@ "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "dev": true }, "chokidar": { @@ -1420,7 +1420,7 @@ "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, "color-string": { "version": "1.9.1", @@ -1443,7 +1443,7 @@ "connect-route": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/connect-route/-/connect-route-0.1.5.tgz", - "integrity": "sha512-6OZGYeoKS7zzhCAGP+Du7WYjP4geK3ii0sZlS+Oqx+ANFPcS5t/jDJr9BuhgN9qPz1ld8iahiPxNrgJyHeZ3cw==" + "integrity": "sha1-48IYMZ0uiKiprgsOD+Cacpw5dEo=" }, "dayjs": { "version": "1.11.3", @@ -1535,7 +1535,7 @@ "get-func-name": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, "glob-parent": { @@ -2493,19 +2493,19 @@ "tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", "dev": true }, "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", "dev": true }, "whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", "dev": true, "requires": { "tr46": "~0.0.3", @@ -2586,7 +2586,7 @@ "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, "rollup-plugin-css-only": { @@ -2631,7 +2631,7 @@ "simple-swizzle": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", - "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", + "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", "requires": { "is-arrayish": "^0.3.1" } @@ -2670,7 +2670,7 @@ "sparse-bitfield": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", - "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", + "integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=", "optional": true, "requires": { "memory-pager": "^1.0.2" @@ -2679,7 +2679,7 @@ "stack-trace": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", - "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==" + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" }, "string-width": { "version": "4.2.3", @@ -2710,9 +2710,9 @@ } }, "svelte": { - "version": "3.48.0", - "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.48.0.tgz", - "integrity": "sha512-fN2YRm/bGumvjUpu6yI3BpvZnpIm9I6A7HR4oUNYd7ggYyIwSA/BX7DJ+UXXffLp6XNcUijyLvttbPVCYa/3xQ==" + "version": "3.49.0", + "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.49.0.tgz", + "integrity": "sha512-+lmjic1pApJWDfPCpUUTc1m8azDqYCG1JN9YEngrx/hUyIcFJo6VZhj0A1Ai0wqoHcEIuQy+e9tk+4uDgdtsFA==" }, "svelte-material-ui": { "version": "6.0.0-beta.16", @@ -2814,6 +2814,17 @@ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, + "typescript": { + "version": "4.7.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", + "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "dev": true + }, + "umbrellajs": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/umbrellajs/-/umbrellajs-3.3.1.tgz", + "integrity": "sha512-3Y4LVTFZWyXdSc7jSiJQziZJ77R2I9YwO5kaKZeHlXfH3clzG0TsHNMQrKNJqKDlWkORN8QEvqrVOKhjVUN6IQ==" + }, "underscore": { "version": "1.13.4", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.4.tgz", @@ -2822,7 +2833,7 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "webidl-conversions": { "version": "7.0.0", diff --git a/package.json b/package.json index 4738a95..2a88a34 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "svelte": "^3.46.4", "svelte-material-ui": "^6.0.0-beta.16", "tinro": "^0.6.12", + "umbrellajs": "^3.3.1", "underscore": "^1.13.2", "winston": "^3.7.2", "winston-daily-rotate-file": "^4.6.1", @@ -47,7 +48,7 @@ "svelte", "html" ], - "hydratable": true, + "hydratable": false, "css": true }, "devDependencies": { @@ -56,6 +57,7 @@ "@smui/textfield": "^6.0.0-beta.16", "chai": "^4.2.0", "rollup-plugin-css-only": "^3.1.0", - "smui-theme": "^6.0.0-beta.16" + "smui-theme": "^6.0.0-beta.16", + "typescript": "^4.7.4" } } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..c406978 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,40 @@ +{ + "compilerOptions": { + /* Basic Options */ + "target": "es2018", + "module": "esNext", + "lib": ["esnext", "dom"], + "allowJs": true, + "checkJs": false, + "jsx": "preserve", + "incremental": true, + "noEmit": true, + + /* Strict Type-Checking Options */ + "strict": true, + "noImplicitAny": true, + "strictNullChecks": true, + + /* Additional Checks */ + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": false, + "noFallthroughCasesInSwitch": false, + + /* Module Resolution Options */ + "baseUrl": ".", + "paths": { + /* Support absolute /imports/* with a leading '/' */ + "/*": ["*"] + }, + "moduleResolution": "node", + "resolveJsonModule": true, + "types": ["node", "mocha"], + "esModuleInterop": true, + "preserveSymlinks": true + }, + "exclude": [ + "./.meteor/**", + "./packages/**" + ] +}