Updating framework to meteor 3 and later

This commit is contained in:
Brian McGonagill 2025-06-21 07:28:59 -05:00
parent 717994508a
commit cca29bc591
58 changed files with 2332 additions and 1611 deletions

View file

@ -2,12 +2,13 @@
<h4>My Dashboard</h4>
<div class="row">
{{#if $eq currConfig.allowUpdates true}}
{{#if updatesExist}}
{{#if $eq updatesExist true}}
<div class="col s12">
<div class="card green darken-3" id="updateInfoCard">
<div class="card-content white-text">
<div class="card-title">Update Available</div>
<div class="row">
<ul class="collapsible green darken-3 white-text">
<li>
<div class="collapsible-header"><strong>Update Available</strong></div>
<div class="collapsible-body">
<div class="row">
{{#each updates}}
<div class="col s12">
<div class="row">
@ -33,8 +34,9 @@
<hr />
{{/each}}
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
{{/if}}
{{/if}}

View file

@ -7,6 +7,8 @@ import moment from 'moment';
import { TaskItems } from "../../imports/api/tasks";
import { UpdateInfo } from '../../imports/api/updateInfo.js';
import { SysConfig } from '../../imports/api/systemConfig.js';
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
import { M } from '../lib/assets/materialize.js';
Template.dashboard.onCreated(function() {
this.subscribe("userList");
@ -23,7 +25,10 @@ Template.dashboard.onCreated(function() {
});
Template.dashboard.onRendered(function() {
setTimeout(function() {
var elems = document.querySelectorAll('.collapsible');
var instances = M.Collapsible.init(elems, {});
}, 200);
});
Template.dashboard.helpers({
@ -61,18 +66,47 @@ Template.dashboard.helpers({
},
updates: function() {
let updateAvail = UpdateInfo.find({});
return updateAvail;
},
updatesExist: function() {
let updateExists = UpdateInfo.find({ viewed: false }).fetch();
if (updateExists.length > 0) {
return true;
} else {
return false;
try {
if (!updateAvail) {
console.log("No update info found.");
return false;
} else {
console.dir(updateAvail);
return updateAvail;
}
} catch(error) {
console.log(" ERROR trying to grab update info: " + error);
}
},
updatesExist: function() {
const ifUpdate = async() => {
let updateExists = await UpdateInfo.findOneAsync({ viewed: false });
if (!updateExists) {
console.log("Update doesn't exist as false.");
return false;
} else {
console.log("Update found with false.");
return true;
}
}
let updateAvail = ifUpdate();
return updateAvail;
},
currConfig: function() {
return SysConfig.findOne({});
const getSys = async() => {
let currSys = SysConfig.findOneAsync({});
try {
if (!currSys) {
// console.log("No System Config found.")
} else {
return currSys;
}
} catch(error) {
console.log(" ERROR trying to fetch current system config: " + error);
}
}
let currConf = getSys();
return currConf;
},
descriptionSinHTML: function() {
let desc = this.description;
@ -141,12 +175,19 @@ Template.dashboard.events({
'click .readLink' (event) {
let eventId = event.currentTarget.id;
Meteor.call('markUpdate.read', eventId, function(err, result) {
if (err) {
console.log(" ERROR marking update as 'read': " + err);
} else {
console.log("marked read successfully!");
const markUpdate = async() => {
let result = await Meteor.callAsync('markUpdate.read', eventId);
try {
if (!result) {
console.log(" Error marking this read.");
showSnackbar("Error Marking Read!", "red");
} else {
showSnackbar("Successfully Marked as Read.", "green");
}
} catch(error) {
console.log(" ERROR trying to mark this update as read: " + error);
}
});
}
markUpdate();
}
});