Multiple updates and additions

- Added a permission to show or hide update version information on that dashboard as a card that will only show when new update info is available and not yet dismissed.
- Updated Lists so list items added will have their fist letter auto-capitalized
- Updated Lists so list items are searched against the products before being added to the list, so we have store info more commonly in lists
- Updated Products so new products will have their first letter capitalized automatically
- Updated the dashboard to show the Update Available card if this is enbaled in permissions.
    - The dashboard card only shows for System Admin roles.
    - The dashboard card is enabled by default
    - The dashboard card is pulled from the GitLab releases RSS feed.
    - The RSS Feed is only checked every 30 minutes using node-cron
- Updated System Configuration to have a toggle for the update available card
- Added a bell icon to the top and slide out navigation, shown when a new update is available, if update available is enabled in system configuration.
This commit is contained in:
Brian McGonagill 2024-08-21 07:01:36 -05:00
parent f02ea7d549
commit c70f9bd74e
14 changed files with 410 additions and 29 deletions

View file

@ -22,16 +22,19 @@ Meteor.methods({
throw new Meteor.Error('You are not allowed to add items. Make sure you are logged in with valid user credentials.');
}
let iname = itemName.charAt(0).toUpperCase() + itemName.slice(1);
// look up the item from the Products collection
let prodInfo = Products.findOne({ prodName: itemName });
if (typeof prodInfo == "undefined") {
Meteor.call("add.product", itemName, "", "", "", function(err, result) {
let prodInfo = Products.findOne({ prodName: iname });
if (!prodInfo) {
Meteor.call("add.product", itemName, [""], function(err, result) {
if (err) {
console.log(" ERROR adding item to products: " + err);
} else {
// console.log(" SUCCESS adding item to Products.");
return ListItems.insert({
itemName: itemName,
itemName: iname,
listId: listId,
prodId: result,
addedBy: this.userId,
@ -44,7 +47,7 @@ Meteor.methods({
});
} else {
return ListItems.insert({
itemName: itemName,
itemName: iname,
listId: listId,
prodId: prodInfo._id,
addedBy: this.userId,
@ -176,4 +179,4 @@ Meteor.methods({
return ListItems.remove({ _id: itemId });
}
});
});

View file

@ -22,11 +22,19 @@ Meteor.methods({
let pname = prodName.charAt(0).toUpperCase() + prodName.slice(1);
return Products.insert({
prodName: pname,
prodOwner: this.userId,
prodStore: prodStore,
});
// first does this product already exist?
let prodExists = Products.findOne({ prodName: pname });
if (!prodExists) {
return Products.insert({
prodName: pname,
prodOwner: this.userId,
prodStore: prodStore,
});
} else {
console.log(" ---- Product exsits in database already.");
}
},
'edit.product' (prodId, prodName, prodStore) {
check(prodId, String);

View file

@ -55,4 +55,21 @@ Meteor.methods({
}
});
},
});
'allow.updateInfo' (allowUpdate) {
check(allowUpdate, Boolean);
if (!this.userId) {
throw new Meteor.Error('Not able to change system update notification settings. Make sure you are logged in with valid system administrator credentials.');
}
let curr = SysConfig.findOne({});
let configId = curr._id;
return SysConfig.update({ _id: configId }, {
$set: {
allowUpdates: allowUpdate,
}
});
},
});