Update: Additional UI Extension Hooks
This commit is contained in:
@@ -6,6 +6,8 @@ using System.Web.Mvc;
|
||||
using Disco.BI;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Web.Extensions;
|
||||
using Disco.Services.Plugins.Features.UIExtension;
|
||||
using Disco.Models.UI.Config.DeviceBatch;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
@@ -31,35 +33,50 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
m.DeviceCount = m.DeviceBatch.Devices.Count();
|
||||
m.DeviceDecommissionedCount = m.DeviceBatch.Devices.Count(d => d.DecommissionedDate.HasValue);
|
||||
|
||||
m.DeviceModels = dbContext.DeviceModels.ToSelectListItems();
|
||||
m.DeviceModels = dbContext.DeviceModels.ToList();
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDeviceBatchShowModel>(this.ControllerContext, m);
|
||||
|
||||
return View(MVC.Config.DeviceBatch.Views.Show, m);
|
||||
}
|
||||
else
|
||||
{
|
||||
return View(Models.DeviceBatch.IndexModel.Build(dbContext));
|
||||
var m = Models.DeviceBatch.IndexModel.Build(dbContext);
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDeviceBatchIndexModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ActionResult Create()
|
||||
{
|
||||
// Default Batch
|
||||
var m = BI.DeviceBI.BatchUtilities.DefaultNewDeviceBatch(dbContext);
|
||||
var m = new Models.DeviceBatch.CreateModel()
|
||||
{
|
||||
DeviceBatch = BI.DeviceBI.BatchUtilities.DefaultNewDeviceBatch(dbContext)
|
||||
};
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDeviceBatchCreateModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public virtual ActionResult Create(Disco.Models.Repository.DeviceBatch model)
|
||||
public virtual ActionResult Create(Models.DeviceBatch.CreateModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// Check for Existing
|
||||
var existing = dbContext.DeviceBatches.Where(m => m.Name == model.Name).FirstOrDefault();
|
||||
var existing = dbContext.DeviceBatches.Where(m => m.Name == model.DeviceBatch.Name).FirstOrDefault();
|
||||
if (existing == null)
|
||||
{
|
||||
dbContext.DeviceBatches.Add(model);
|
||||
dbContext.DeviceBatches.Add(model.DeviceBatch);
|
||||
dbContext.SaveChanges();
|
||||
return RedirectToAction(MVC.Config.DeviceBatch.Index(model.Id));
|
||||
return RedirectToAction(MVC.Config.DeviceBatch.Index(model.DeviceBatch.Id));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -67,11 +84,19 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDeviceBatchCreateModel>(this.ControllerContext, model);
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
public virtual ActionResult Timeline()
|
||||
{
|
||||
var m = new Models.DeviceBatch.TimelineModel();
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDeviceBatchTimelineModel>(this.ControllerContext, m);
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ using System.Web.Mvc;
|
||||
using Disco.Services.Plugins.Features.WarrantyProvider;
|
||||
using Disco.Services.Plugins;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Services.Plugins.Features.UIExtension;
|
||||
using Disco.Models.UI.Config.DeviceModel;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
@@ -21,7 +23,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
WarrantyProviders = Plugins.GetPluginFeatures(typeof(WarrantyProviderFeature))
|
||||
};
|
||||
|
||||
m.DeviceComponentsModel = new Models.DeviceModel.DeviceComponentsModel()
|
||||
m.DeviceComponentsModel = new Models.DeviceModel.ComponentsModel()
|
||||
{
|
||||
DeviceModelId = m.DeviceModel.Id,
|
||||
DeviceComponents = m.DeviceModel.DeviceComponents.ToList(),
|
||||
@@ -35,22 +37,33 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
//m.Devices = dbContext.Devices.Include("DeviceModel").Include("DeviceProfile").Include("AssignedUser")
|
||||
// .Where(d => d.DeviceModelId == m.DeviceModel.Id).ToList();
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDeviceModelShowModel>(this.ControllerContext, m);
|
||||
|
||||
return View(MVC.Config.DeviceModel.Views.Show, m);
|
||||
}
|
||||
else
|
||||
{
|
||||
return View(Models.DeviceModel.IndexModel.Build(dbContext));
|
||||
var m = Models.DeviceModel.IndexModel.Build(dbContext);
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDeviceModelIndexModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ActionResult GenericComponents()
|
||||
{
|
||||
var m = new Models.DeviceModel.DeviceComponentsModel()
|
||||
var m = new Models.DeviceModel.ComponentsModel()
|
||||
{
|
||||
DeviceComponents = dbContext.DeviceComponents.Include("JobSubTypes").Where(dc => !dc.DeviceModelId.HasValue).ToList(),
|
||||
JobSubTypes = dbContext.JobSubTypes.Where(jst => jst.JobTypeId == Disco.Models.Repository.JobType.JobTypeIds.HNWar).ToList()
|
||||
};
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDeviceModelComponentsModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ using Disco.BI;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Services.Plugins.Features.CertificateProvider;
|
||||
using Disco.Services.Plugins;
|
||||
using Disco.Services.Plugins.Features.UIExtension;
|
||||
using Disco.Models.UI.Config.DeviceProfile;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
@@ -45,33 +47,46 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
//m.OrganisationalUnit = m.DeviceProfile.OrganisationalUnit;
|
||||
//m.ComputerNameTemplate = m.DeviceProfile.ComputerNameTemplate;
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDeviceProfileShowModel>(this.ControllerContext, m);
|
||||
|
||||
return View(MVC.Config.DeviceProfile.Views.Show, m);
|
||||
}
|
||||
else
|
||||
{
|
||||
return View(Models.DeviceProfile.IndexModel.Build(dbContext));
|
||||
var m = Models.DeviceProfile.IndexModel.Build(dbContext);
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDeviceProfileIndexModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ActionResult Create()
|
||||
{
|
||||
return View();
|
||||
var m = new Models.DeviceProfile.CreateModel();
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDeviceProfileCreateModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public virtual ActionResult Create(Disco.Models.Repository.DeviceProfile model)
|
||||
public virtual ActionResult Create(Models.DeviceProfile.CreateModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// Check for Existing
|
||||
var existing = dbContext.DeviceProfiles.Where(m => m.Name == model.Name).FirstOrDefault();
|
||||
var existing = dbContext.DeviceProfiles.Where(m => m.Name == model.DeviceProfile.Name).FirstOrDefault();
|
||||
if (existing == null)
|
||||
{
|
||||
model.ProvisionADAccount = true;
|
||||
model.DeviceProfile.ProvisionADAccount = true;
|
||||
|
||||
dbContext.DeviceProfiles.Add(model);
|
||||
dbContext.DeviceProfiles.Add(model.DeviceProfile);
|
||||
dbContext.SaveChanges();
|
||||
return RedirectToAction(MVC.Config.DeviceProfile.Index(model.Id));
|
||||
return RedirectToAction(MVC.Config.DeviceProfile.Index(model.DeviceProfile.Id));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -79,6 +94,9 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDeviceProfileCreateModel>(this.ControllerContext, model);
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
@@ -93,6 +111,9 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
m.DeviceProfilesAndNone = m.DeviceProfiles.ToList();
|
||||
m.DeviceProfilesAndNone.Insert(0, new Disco.Models.Repository.DeviceProfile() { Id = 0, Name = "<No Default>" });
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDeviceProfileDefaultsModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.BI;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Services.Plugins.Features.UIExtension;
|
||||
using Disco.Models.UI.Config.DocumentTemplate;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
@@ -16,6 +18,10 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
if (string.IsNullOrEmpty(id))
|
||||
{
|
||||
var m = new Models.DocumentTemplate.IndexModel() { DocumentTemplates = dbContext.DocumentTemplates.ToList() };
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateIndexModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
else
|
||||
@@ -26,12 +32,21 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
};
|
||||
m.TemplateExpressions = m.DocumentTemplate.ExtractPdfExpressions(dbContext);
|
||||
m.UpdateModel(dbContext);
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateShowModel>(this.ControllerContext, m);
|
||||
|
||||
return View(MVC.Config.DocumentTemplate.Views.Show, m);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ActionResult ImportStatus()
|
||||
{
|
||||
var m = new Models.DocumentTemplate.ImportStatusModel();
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateImportStatusModel>(this.ControllerContext, m);
|
||||
|
||||
return View();
|
||||
}
|
||||
public virtual ActionResult UndetectedPages()
|
||||
@@ -41,6 +56,9 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
DocumentTemplates = dbContext.DocumentTemplates.ToList()
|
||||
};
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateUndetectedPagesModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
@@ -49,6 +67,9 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
var m = new Models.DocumentTemplate.CreateModel();
|
||||
m.UpdateModel(dbContext);
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateCreateModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
@@ -87,6 +108,10 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
ModelState.AddModelError("Name", "A Document Template with this Name already exists.");
|
||||
}
|
||||
}
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateCreateModel>(this.ControllerContext, model);
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
@@ -103,6 +128,9 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
ExtensionLibraries = BI.Expressions.Expression.ExtensionLibraryTypes()
|
||||
};
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateExpressionBrowserModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Disco.Models.UI.Config.Enrolment;
|
||||
using Disco.Services.Plugins.Features.UIExtension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
@@ -18,11 +20,19 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
MacSshUsername = dbContext.DiscoConfiguration.Bootstrapper.MacSshUsername
|
||||
};
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigEnrolmentIndexModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
public virtual ActionResult Status()
|
||||
{
|
||||
return View();
|
||||
var m = new Models.Enrolment.StatusModel();
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigEnrolmentStatusModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Disco.Services.Logging;
|
||||
using Disco.Services.Logging.Models;
|
||||
using Disco.Services.Plugins.Features.UIExtension;
|
||||
using Disco.Models.UI.Config.Logging;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
@@ -24,6 +26,9 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
m.LogModules.Add(logModule, logModule.EventTypes.Values.Where(et => et.UsePersist).ToList());
|
||||
}
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigLoggingIndexModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
@@ -36,7 +41,12 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
if (taskStatus == null)
|
||||
return RedirectToAction(MVC.Config.Logging.Index());
|
||||
|
||||
return View(new Models.Logging.TaskStatusModel() { SessionId = taskStatus.SessionId });
|
||||
var m = new Models.Logging.TaskStatusModel() { SessionId = taskStatus.SessionId };
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigLoggingTaskStatusModel>(this.ControllerContext, m);
|
||||
|
||||
return View(m);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Disco.Models.UI.Config.Organisation;
|
||||
using Disco.Services.Plugins.Features.UIExtension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
@@ -18,7 +20,10 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
viewModel.OrganisationName = dbContext.DiscoConfiguration.OrganisationName;
|
||||
viewModel.MultiSiteMode = dbContext.DiscoConfiguration.MultiSiteMode;
|
||||
viewModel.OrganisationAddresses = dbContext.DiscoConfiguration.OrganisationAddresses.Addresses;
|
||||
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigOrganisationIndexModel>(this.ControllerContext, viewModel);
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user