support for vendor notifications webhook

This commit is contained in:
2022-08-29 20:57:24 +00:00
parent 541cf1d2ae
commit 0d6425cf8b
11 changed files with 485 additions and 76 deletions

View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.EntityFrameworkCore;
using rockfishCore.Models;
using rockfishCore.Util;
using System.ComponentModel.DataAnnotations;
namespace rockfishCore.Controllers
{
//### OUR ROUTE CALLED FROM ROCKFISH CLIENT ####
[Produces("application/json")]
[Route("api/vendor-notifications")]
[Authorize]
public class VendorNotificationController : Controller
{
private readonly rockfishContext ct;
public VendorNotificationController(rockfishContext context)
{
ct = context;
}
// GET: api/vendor-notifications/5
[HttpGet("{id}")]
public async Task<IActionResult> GetRfCase([FromRoute] long id)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
var RfCase = await ct.VendorNotification.SingleOrDefaultAsync(m => m.Id == id);
if (RfCase == null)
{
return NotFound();
}
return Ok(RfCase);
}
[HttpGet("list")]
public async Task<IActionResult> GetList([FromRoute] long siteId)
{
return Ok(await ct.VendorNotification.AsNoTracking().OrderByDescending(z => z.Id).ToListAsync());
}
}//eoc
}//eons

View File

@@ -5,7 +5,7 @@
1) SET VERSION 1) SET VERSION
SET app.api RFVERSION property SET app.api RFVERSION property
RENAME ?rfv=6.20 parameter in default.htm to the new version so all files update on mobile RENAME ?rfv=6.21 parameter in default.htm to the new version so all files update on mobile
1.5) Run buildtemplates.bat if handlebars templates have changed at all 1.5) Run buildtemplates.bat if handlebars templates have changed at all

View File

@@ -2,7 +2,7 @@ namespace rockfishCore.Util
{ {
public static class RfVersion public static class RfVersion
{ {
public const string NumberOnly="6.20"; public const string NumberOnly="6.21";
public const string Full = "Rockfish server " + NumberOnly; public const string Full = "Rockfish server " + NumberOnly;
} }
} }

View File

@@ -11,73 +11,76 @@
<title>Rockfish loading....</title> <title>Rockfish loading....</title>
<!-- ICONS / MANIFEST --> <!-- ICONS / MANIFEST -->
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?rfv=6.20"> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?rfv=6.21">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png?rfv=6.20"> <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png?rfv=6.21">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png?rfv=6.20"> <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png?rfv=6.21">
<link rel="manifest" href="/manifest.json?rfv=6.20"> <link rel="manifest" href="/manifest.json?rfv=6.21">
<link rel="mask-icon" href="/safari-pinned-tab.svg?rfv=6.20" color="#5bbad5"> <link rel="mask-icon" href="/safari-pinned-tab.svg?rfv=6.21" color="#5bbad5">
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
<!-- 3rd party components fonts and icons --> <!-- 3rd party components fonts and icons -->
<link href="css/materialdesignicons.min.css?rfv=6.20" media="all" rel="stylesheet" type="text/css" /> <link href="css/materialdesignicons.min.css?rfv=6.21" media="all" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/bootstrap.min.css?rfv=6.20" type="text/css" /> <link rel="stylesheet" href="css/bootstrap.min.css?rfv=6.21" type="text/css" />
<link rel="stylesheet" href="css/app.css?rfv=6.20" type="text/css" /> <link rel="stylesheet" href="css/app.css?rfv=6.21" type="text/css" />
<link rel="stylesheet" href="css/mdi-bs4-compat.css?rfv=6.20" type="text/css" /> <link rel="stylesheet" href="css/mdi-bs4-compat.css?rfv=6.21" type="text/css" />
<!-- third-party javascript --> <!-- third-party javascript -->
<script src="js/lib/jquery-3.3.1.min.js?rfv=6.20"></script> <script src="js/lib/jquery-3.3.1.min.js?rfv=6.21"></script>
<script src="js/lib/page.js?rfv=6.20"></script> <script src="js/lib/page.js?rfv=6.21"></script>
<script src="js/lib/jquery.event.gevent.js?rfv=6.20"></script> <script src="js/lib/jquery.event.gevent.js?rfv=6.21"></script>
<script src="js/lib/jquery.gzserialize.js?rfv=6.20"></script> <script src="js/lib/jquery.gzserialize.js?rfv=6.21"></script>
<script src="js/lib/handlebars.runtime.min-v4.7.6.js?rfv=6.20"></script> <script src="js/lib/handlebars.runtime.min-v4.7.6.js?rfv=6.21"></script>
<script src="js/lib/store.min.js?rfv=6.20"></script> <script src="js/lib/store.min.js?rfv=6.21"></script>
<script src="js/lib/jquery.autocomplete.min.js?rfv=6.20"></script> <script src="js/lib/jquery.autocomplete.min.js?rfv=6.21"></script>
<script src="js/lib/moment.min.js?rfv=6.20"></script> <script src="js/lib/moment.min.js?rfv=6.21"></script>
<!-- our javascript --> <!-- our javascript -->
<script src="js/index.js?rfv=6.20"></script> <script src="js/index.js?rfv=6.21"></script>
<script src="js/app.util.js?rfv=6.20"></script> <script src="js/app.util.js?rfv=6.21"></script>
<script src="js/app.api.js?rfv=6.20"></script> <script src="js/app.api.js?rfv=6.21"></script>
<script src="js/app.utilB.js?rfv=6.20"></script> <script src="js/app.utilB.js?rfv=6.21"></script>
<script src="js/app.nav.js?rfv=6.20"></script> <script src="js/app.nav.js?rfv=6.21"></script>
<script src="js/app.shell.js?rfv=6.20"></script> <script src="js/app.shell.js?rfv=6.21"></script>
<script src="js/app.fourohfour.js?rfv=6.20"></script> <script src="js/app.fourohfour.js?rfv=6.21"></script>
<script src="js/app.authenticate.js?rfv=6.20"></script> <script src="js/app.authenticate.js?rfv=6.21"></script>
<script src="js/app.customers.js?rfv=6.20"></script> <script src="js/app.customers.js?rfv=6.21"></script>
<script src="js/app.customerEdit.js?rfv=6.20"></script> <script src="js/app.customerEdit.js?rfv=6.21"></script>
<script src="js/app.customerSites.js?rfv=6.20"></script> <script src="js/app.customerSites.js?rfv=6.21"></script>
<script src="js/app.customerSiteEdit.js?rfv=6.20"></script> <script src="js/app.customerSiteEdit.js?rfv=6.21"></script>
<script src="js/app.purchases.js?rfv=6.20"></script> <script src="js/app.purchases.js?rfv=6.21"></script>
<script src="js/app.purchaseEdit.js?rfv=6.20"></script> <script src="js/app.purchaseEdit.js?rfv=6.21"></script>
<script src="js/app.license.js?rfv=6.20"></script> <script src="js/app.license.js?rfv=6.21"></script>
<script src="js/app.licenseTemplates.js?rfv=6.20"></script> <script src="js/app.licenseTemplates.js?rfv=6.21"></script>
<script src="js/app.licenseRequestEdit.js?rfv=6.20"></script> <script src="js/app.licenseRequestEdit.js?rfv=6.21"></script>
<script src="js/app.licenses.js?rfv=6.20"></script> <script src="js/app.licenses.js?rfv=6.21"></script>
<script src="js/app.licenseView.js?rfv=6.20"></script> <script src="js/app.licenseView.js?rfv=6.21"></script>
<script src="js/app.reportData.js?rfv=6.20"></script> <script src="js/app.reportData.js?rfv=6.21"></script>
<script src="js/app.reportDataProdEmail.js?rfv=6.20"></script> <script src="js/app.reportDataProdEmail.js?rfv=6.21"></script>
<script src="js/app.reportDataExpires.js?rfv=6.20"></script> <script src="js/app.reportDataExpires.js?rfv=6.21"></script>
<script src="js/app.search.js?rfv=6.20"></script> <script src="js/app.search.js?rfv=6.21"></script>
<script src="js/app.subscription.js?rfv=6.20"></script> <script src="js/app.subscription.js?rfv=6.21"></script>
<script src="js/app.subnotify.js?rfv=6.20"></script> <script src="js/app.subnotify.js?rfv=6.21"></script>
<script src="js/app.templates.js?rfv=6.20"></script> <script src="js/app.templates.js?rfv=6.21"></script>
<script src="js/app.templateEdit.js?rfv=6.20"></script> <script src="js/app.templateEdit.js?rfv=6.21"></script>
<script src="js/app.inbox.js?rfv=6.20"></script> <script src="js/app.inbox.js?rfv=6.21"></script>
<script src="js/app.mailEdit.js?rfv=6.20"></script> <script src="js/app.mailEdit.js?rfv=6.21"></script>
<script src="js/app.rfcaseEdit.js?rfv=6.20"></script> <script src="js/app.rfcaseEdit.js?rfv=6.21"></script>
<script src="js/app.rfcases.js?rfv=6.20"></script> <script src="js/app.rfcases.js?rfv=6.21"></script>
<script src="js/app.rfsettings.js?rfv=6.20"></script> <script src="js/app.rfsettings.js?rfv=6.21"></script>
<script src="js/app.ops.js?rfv=6.20"></script> <script src="js/app.ops.js?rfv=6.21"></script>
<script src="js/app.trials.js?rfv=6.20"></script> <script src="js/app.trials.js?rfv=6.21"></script>
<script src="js/app.trialEdit.js?rfv=6.20"></script> <script src="js/app.trialEdit.js?rfv=6.21"></script>
<script src="js/app.ravLicenses.js?rfv=6.20"></script> <script src="js/app.ravLicenses.js?rfv=6.21"></script>
<script src="js/app.ravLicense.js?rfv=6.20"></script> <script src="js/app.ravLicense.js?rfv=6.21"></script>
<script src="js/app.vendorNotifications.js?rfv=6.21"></script>
<script src="js/app.vendorNotification.js?rfv=6.21"></script>
<!-- handlebars templates --> <!-- handlebars templates -->
<script src="js/templates/templates.js?rfv=6.20"></script> <script src="js/templates/templates.js?rfv=6.21"></script>
<script> <script>
@@ -107,7 +110,7 @@ window.onerror = function ( error ) {
<body class="rf-body"> <body class="rf-body">
<div id="app" class="container"></div> <div id="app" class="container"></div>
<script src="js/lib/bootstrap.min.js?rfv=6.20"></script> <script src="js/lib/bootstrap.min.js?rfv=6.21"></script>
</body> </body>
</html> </html>

View File

@@ -30,7 +30,7 @@ app.api = (function () {
licenseEmailResponse, licenseEmailResponse,
test; test;
RockFishVersion = "6.20"; RockFishVersion = "6.21";
////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////
// NOT AUTHORIZED ERROR HANDLER // NOT AUTHORIZED ERROR HANDLER

View File

@@ -230,6 +230,11 @@ app.shell = (function () {
page("/trialEdit/:id", trialEdit); page("/trialEdit/:id", trialEdit);
page("/ravLicenses/:id/:cust_id", ravLicenses); page("/ravLicenses/:id/:cust_id", ravLicenses);
page("/ravLicense/:id/:cust_id", ravLicense); page("/ravLicense/:id/:cust_id", ravLicense);
page("/vendorNotifications", vendorNotifications);
page("/vendorNotifications/:id", vendorNotification);
page("*", notFound); page("*", notFound);
page({ page({
hashbang: true hashbang: true
@@ -556,6 +561,23 @@ app.shell = (function () {
app.ravLicenses.initModule(); app.ravLicenses.initModule();
}; };
var vendorNotification = function (ctx) {
app.nav.setSelectedMenuItem("vendornotifications");
app.vendorNotification.configModule({
context: ctx
});
app.vendorNotification.initModule();
};
var vendorNotifications = function (ctx) {
app.nav.setSelectedMenuItem("vendornotifications");
app.vendorNotifications.configModule({
context: ctx
});
app.vendorNotifications.initModule();
};
var notFound = function (ctx) { var notFound = function (ctx) {
app.fourohfour.configModule({ app.fourohfour.configModule({
context: ctx context: ctx

View File

@@ -0,0 +1,148 @@
/*jslint browser : true, continue : true,
devel : true, indent : 2, maxerr : 50,
newcap : true, nomen : true, plusplus : true,
regexp : true, sloppy : true, vars : false,
white : true
*/
/*global $, app */
app.vendorNotification = (function () {
"use strict";
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
var stateMap = {},
onSave,
onDelete,
configModule,
initModule;
//----------------- END MODULE SCOPE VARIABLES ---------------
//------------------- BEGIN EVENT HANDLERS -------------------
//ONSAVE
//
onSave = function (event) {
event.preventDefault();
$.gevent.publish("app-clear-error");
alert("STUB: ONSAVE");
// //get form data
// var formData = $("form").serializeArray({
// checkboxesAsBools: true
// });
// var submitData = app.utilB.objectifyFormDataArray(formData);
// //is this a new record?
// if (stateMap.id != "new") {
// //put id into the form data
// submitData.id = stateMap.id;
// app.api.update("vendor-notifications", submitData, function (res) {
// if (res.error) {
// $.gevent.publish("app-show-error", res.msg);
// }
// });
// }
return false; //prevent default?
};
//ONDELETE
//
onDelete = function (event) {
event.preventDefault();
$.gevent.publish("app-clear-error");
alert("STUB: onDelete");
// var r = confirm("Are you sure you want to delete this record?");
// if (r == true) {
// //Delete
// app.api.remove("vendor-notifications/" + stateMap.id, function (res) {
// if (res.error) {
// $.gevent.publish("app-show-error", res.msg);
// } else {
// //deleted, return to list
// page("#!/vendorNotifications");
// return false;
// }
// });
// } else {
// return false;
// }
return false; //prevent default?
};
//-------------------- END EVENT HANDLERS --------------------
//------------------- BEGIN PUBLIC METHODS -------------------
//CONFIGMODULE
//
configModule = function (context) {
stateMap.context = context.context;
if (stateMap.context.params.id) {
stateMap.id = stateMap.context.params.id;
}
};
//INITMODULE
//
initModule = function ($container) {
if (typeof $container === "undefined") {
$container = $("#app-shell-main-content");
}
$container.html(Handlebars.templates["app.vendorNotification"]({}));
////app.nav.setContextTitle("Case");
//Context menu
app.nav.contextClear();
app.nav.contextAddLink(
"vendor-notifications/",
"Notifications",
"bell"
);
//case 3513 (ironically I can't see it yet)
document.title = "Vendor notification " + stateMap.id;
//fetch existing record
app.api.get("vendor-notifications/" + stateMap.id, function (res) {
if (res.error) {
$.gevent.publish("app-show-error", res.msg);
} else {
//set the caseid header //<span class="badge badge-secondary">New</span>
$("#notificationid").html(stateMap.id);
$("#dtcreated").html(
"created " +
app.utilB.epochToLocalShortDateTime(res.dtCreated)
);
if (res.processed) {
$("#processed").html("Processed");
$("#dtprocessed").html(
"processed " +
app.utilB.epochToLocalShortDateTime(res.dtProcessed)
);
} else {
$("#processed").html("NOT PROCESSED");
}
$("#vendor").html(res.vendor);
$("#data").html(res.data);
//fill out form
app.utilB.formData(res);
//================
}
});
};
// RETURN PUBLIC METHODS
//
return {
configModule: configModule,
initModule: initModule
};
//------------------- END PUBLIC METHODS ---------------------
})();

View File

@@ -0,0 +1,92 @@
/*jslint browser : true, continue : true,
devel : true, indent : 2, maxerr : 50,
newcap : true, nomen : true, plusplus : true,
regexp : true, sloppy : true, vars : false,
white : true
*/
/*global $, app */
app.vendorNotifications = (function () {
"use strict";
//---------------- BEGIN MODULE SCOPE VARIABLES --------------
var stateMap = {},
configModule,
initModule;
//----------------- END MODULE SCOPE VARIABLES ---------------
//------------------- BEGIN UTILITY METHODS ------------------
//-------------------- END UTILITY METHODS -------------------
//------------------- BEGIN EVENT HANDLERS -------------------
//-------------------- END EVENT HANDLERS --------------------
//------------------- BEGIN PUBLIC METHODS -------------------
//CONFIGMODULE
//
configModule = function (context) {
stateMap.context = context.context;
if (stateMap.context.params.id) {
stateMap.id = stateMap.context.params.id; //siteid
}
};
//INITMODULE
//
initModule = function ($container) {
if (typeof $container === "undefined") {
$container = $("#app-shell-main-content");
}
$container.html(Handlebars.templates["app.vendorNotifications"]({}));
//case 3513
document.title = "Vendor notifications";
//===================
//Get notifications
app.api.get("vendor-notifications/list/", function (res) {
if (res.error) {
$.gevent.publish("app-show-error", res.msg);
} else {
var $appList = $("#rf-list");
$appList.append("<ul >");
$.each(res, function (i, obj) {
var idColumn =
'<span class="rf-larger"><strong>' +
obj.id +
"</strong></span>";
$appList.append(
"<li class='mdc-list-item'><a href=\"#!/vendorNotifcation/" +
obj.id +
'">' +
app.utilB.genListColumn(idColumn) +
"&nbsp;" +
app.utilB.genListColumn(
app.utilB.epochToLocalShortDateTime(
obj.dtCreated
)
) +
"</a></li>"
);
});
$appList.append("</ul>");
}
});
//=========/licenses==============
app.nav.contextClear(); ///ravLicense/122
};
//PUBLIC METHODS
//
return {
configModule: configModule,
initModule: initModule
};
//------------------- END PUBLIC METHODS ---------------------
})();

View File

@@ -1,7 +1,18 @@
<nav id="rf-nav" class="navbar fixed-top navbar-expand-lg navbar-dark" style="background-color: #00205B;"> <nav
{{!-- navbar-dark bg-success --}} id="rf-nav"
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" class="navbar fixed-top navbar-expand-lg navbar-dark"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> style="background-color: #00205B;"
>
{{! navbar-dark bg-success }}
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
@@ -9,40 +20,64 @@
<ul class="navbar-nav mr-auto"> <ul class="navbar-nav mr-auto">
<li id="inbox" class="nav-item"> <li id="inbox" class="nav-item">
<a class="rfac nav-link mdi mdi-inbox" href="#!/inbox">Inbox </a> <a class="rfac nav-link mdi mdi-inbox" href="#!/inbox">Inbox
</a>
</li> </li>
<li id="customers" class="nav-item"> <li id="customers" class="nav-item">
<a class="rfac nav-link mdi mdi-contacts" href="#!/customers">Customers </a> <a
class="rfac nav-link mdi mdi-contacts"
href="#!/customers"
>Customers </a>
</li> </li>
<li id="trials" class="nav-item"> <li id="trials" class="nav-item">
<a class="rfac nav-link mdi mdi-voice" href="#!/trials">Trial requests </a> <a class="rfac nav-link mdi mdi-voice" href="#!/trials">Trial
requests
</a>
</li>
<li id="vendornotifications" class="nav-item">
<a class="rfac nav-link mdi mdi-voice" href="#!/vendorNotifications">Trial
Vendor notifications
</a>
</li> </li>
<li id="subscriptions" class="nav-item"> <li id="subscriptions" class="nav-item">
<a class="rfac nav-link mdi mdi-basket" href="#!/subscription">Subscriptions </a> <a
class="rfac nav-link mdi mdi-basket"
href="#!/subscription"
>Subscriptions </a>
</li> </li>
<li id="license" class="nav-item"> <li id="license" class="nav-item">
<a class="rfac nav-link mdi mdi-key" href="#!/license">v7 License </a> <a class="rfac nav-link mdi mdi-key" href="#!/license">v7
License
</a>
</li> </li>
<li id="rfcases" class="nav-item"> <li id="rfcases" class="nav-item">
<a class="rfac nav-link mdi mdi-bug" href="#!/rfcases">Cases </a> <a class="rfac nav-link mdi mdi-bug" href="#!/rfcases">Cases
</a>
</li> </li>
<li id="rfops" class="nav-item"> <li id="rfops" class="nav-item">
<a class="rfac nav-link mdi mdi-server-network" href="#!/ops">Server Ops </a> <a
class="rfac nav-link mdi mdi-server-network"
href="#!/ops"
>Server Ops </a>
</li> </li>
<li id="rfsettings" class="nav-item"> <li id="rfsettings" class="nav-item">
<a class="rfac nav-link mdi mdi-settings" href="#!/rfsettings">Settings </a> <a
class="rfac nav-link mdi mdi-settings"
href="#!/rfsettings"
>Settings </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="rfac nav-link mdi mdi-logout" href="#!/logout">Log off </a> <a class="rfac nav-link mdi mdi-logout" href="#!/logout">Log off
</a>
</li> </li>
</ul> </ul>
@@ -50,9 +85,7 @@
</div> </div>
</nav> </nav>
<div class="rf-content mx-2">
<div class="rf-content mx-2 ">
<div id="app-error-div" class="alert alert-danger d-none" role="alert"> <div id="app-error-div" class="alert alert-danger d-none" role="alert">
<p id="app-error-message"></p> <p id="app-error-message"></p>
</div> </div>

View File

@@ -0,0 +1,49 @@
<div>
<form id="frm" method="post" action="index.html">
<div class="mb-4">
<span class="display-4" id="notificationid"></span>
<span class="text-muted align-top" id="dtcreated"></span>
</div>
<div class="mb-4">
<span class="display-4" id="processed"></span>
<span class="text-muted align-top" id="dtprocessed"></span>
</div>
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label for="vendor">Vendor</label>
<input
class="form-control"
type="text"
id="vendor"
name="vendor"
value=""
/>
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<label for="data">Data</label>
<textarea
class="form-control"
id="data"
name="data"
rows="15"
></textarea>
</div>
</div>
</div>
{{! <div class="app-frm-buttons mt-5">
<button id="btn-save" class="btn btn-success">Save</button>
<button id="btn-delete" class="btn btn-outline-dark">Delete</button>
</div> }}
</form>
</div>

View File

@@ -0,0 +1,3 @@
<div>
<div id="rf-list" class="rf-list"/>
</div>