Update: Quick Log & Queue Support

This commit is contained in:
Gary Sharp committed 2014-02-18 17:26:03 +11:00
1 parent 0db43d9200
commit 6ac87633ac
7 files changed
+50 -40

No files matched your search

+4 -1
View File
@@ -10,7 +10,7 @@ namespace Disco.BI.JobBI
{ {
public static class Utilities public static class Utilities
{ {
public static Job Create(DiscoDataContext Database, Device device, User user, JobType type, List<JobSubType> subTypes, User initialTech) public static Job Create(DiscoDataContext Database, Device device, User user, JobType type, List<JobSubType> subTypes, User initialTech, bool addAutoQueues = true)
{ {
Job j = new Job() Job j = new Job()
{ {
@@ -41,6 +41,8 @@ namespace Disco.BI.JobBI
Database.Jobs.Add(j); Database.Jobs.Add(j);
// Job Queues // Job Queues
if (addAutoQueues)
{
var queues = from st in subTypes var queues = from st in subTypes
from jq in st.JobQueues from jq in st.JobQueues
group st by jq into g group st by jq into g
@@ -67,6 +69,7 @@ namespace Disco.BI.JobBI
Database.JobQueueJobs.Add(jqj); Database.JobQueueJobs.Add(jqj);
} }
}
switch (type.Id) switch (type.Id)
{ {
+3
View File
@@ -724,6 +724,9 @@
#createJob_Container #createJob_SubTypes li.highlight i { #createJob_Container #createJob_SubTypes li.highlight i {
display: inline-block; display: inline-block;
} }
#createJob_Container #createJob_SubTypes.isQuickLog li i {
display: none;
}
#createJob_Container #createJob_CommentsContainer #Comments { #createJob_Container #createJob_CommentsContainer #Comments {
width: 100%; width: 100%;
min-width: 500px; min-width: 500px;
+4
View File
@@ -756,6 +756,10 @@
} }
} }
#createJob_SubTypes.isQuickLog li i {
display: none;
}
#createJob_CommentsContainer { #createJob_CommentsContainer {
#Comments { #Comments {
+1 -1
View File
@@ -1 +1 @@
.tableData{border:solid 1px #f4f4f4;border-collapse:collapse}.tableData>tbody>tr>td{border:solid 1px #f4f4f4;background-color:#fff}.tableData>tbody>tr:nth-child(odd)>td{background-color:#fcfcfc}.tableData>thead>tr>th,.tableData>tbody>tr>th{background-color:#f4f4f4;border:solid 1px #f4f4f4}.tableData>tbody>tr:hover>td{background-color:#fefefe}.tableData>tbody>tr:hover:nth-child(odd)>td{background-color:#fafafa}.tableData>tfoot>tr>th,.tableData>tfoot>tr>td{background-color:#f4f4f4}.tableDataDark{border:solid 1px #d8d8d8;border-collapse:collapse}.tableDataDark td{border:solid 1px #d8d8d8;background-color:#fff}.tableDataDark th{background-color:#eee;border:solid 1px #d8d8d8}.tableDataContainer{background-color:#fff}.tableDataVertical{border:solid 1px #f4f4f4;border-collapse:collapse}.tableDataVertical>tbody>tr:nth-child(odd){background-color:#f4f4f4;margin:0;padding:0}.tableDataVertical>tbody>tr>th.name{width:170px;text-align:right}.tableDataVertical table.sub>tbody>tr:not(:first-child)>th,.tableDataVertical table.sub>tbody>tr:not(:first-child)>td{border-top:1px dashed #aaa}.tableDataVertical table.sub>tbody>tr>th{font-weight:normal;text-align:right}.tableDataVertical table.sub>tbody>tr>th.name{text-align:right}.icon16{display:inline-block;height:16px;width:16px;margin-left:2px;cursor:pointer}.subtleUntilHover{-moz-opacity:.3;opacity:.3}.subtleUntilHover:hover{-moz-opacity:1;opacity:1}#layout_PageHeading #Job_Show_Status{margin-left:20px;display:inline-block;height:50px;font-family:"Segoe UI",Arial,Verdana,Tahoma,sans-serif;font-weight:lighter;font-stretch:condensed;font-size:.7em;text-transform:uppercase}#layout_PageHeading #Job_Show_Status span.icon{margin-right:6px}#layout_PageHeading #Job_Show_QueueStatus{display:inline-block;float:right;height:50px;font-size:.6em}#Job_List{padding-top:20px}#Job_List>.jobTable>h3{margin:30px 0 50px 20px!important}#Job_Show #Job_Show_Subjects{table-layout:fixed}#Job_Show #Job_Show_Subjects>tbody>tr>td{padding-top:0;height:100%}#Job_Show #Job_Show_Subjects>tbody>tr>td>div{position:relative}#Job_Show #Job_Show_Subjects>tbody>tr>td>div div.status{margin-top:2px;padding-top:2px;border-top:1px dashed #ddd}#Job_Show #Job_Show_Subjects>tbody>tr>td>div input.discreet{margin-left:-2px}#Job_Show #Job_Show_Subjects>tbody>tr>td:not(:last-child){border-right:1px dashed #aaa}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_Type>table{table-layout:fixed}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_SubTypes_1,#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_SubTypes_2{padding-left:16px;font-weight:bold}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_SubTypes_Update{margin-left:16px;font-size:.9em}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_SubTypes_Update_Dialog{display:none}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_Dates{padding-bottom:6px}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_Dates table{table-layout:fixed}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_Dates table>tbody>tr>td{vertical-align:middle}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_Dates table>tbody>tr>td:first-child{font-weight:bold;width:60px}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_GenerateDocument_Container{padding-top:4px}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_GenerateDocument_Container #Job_Show_GenerateDocument{padding:0}#Job_Show #Job_Show_Subjects #Job_Show_Device>div{padding-left:102px;min-height:100px}#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Model_Image{position:absolute;left:0;top:0;height:96px;width:96px}#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Details{float:left}#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Details_HWar,#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Details_HNWar{float:right;border-left:1px dashed #ddd;padding-left:4px;margin-right:2px}#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Details_HWar_Details_Button,#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Details_HNWar_Details_Button{font-size:.9em}#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_DeviceHeld table{table-layout:fixed}#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_DeviceHeld table>tbody>tr>td:first-child{width:62px}#Job_Show #Job_Show_Subjects #Job_Show_Subjects_Actions>td{padding-top:4px}#Job_Show #Job_Show_Subjects #Job_Show_Subjects_Actions #Job_Show_Device_Actions{padding-left:111px}#jobDetailTabs{margin-top:10px;border-radius:0;background-image:none;background-color:#fff;border:none;padding:0}#jobDetailTabs #jobDetailTabItems{border-radius:0;border-top:1px solid #ddd;border-right:1px solid #ddd;border-left:1px solid #ddd;border-bottom:none;padding:2px 0 0 4px;background-image:none;background-color:#eee;display:table}#jobDetailTabs #jobDetailTabItems>li{top:0;border-radius:0;margin:0 5px 0 0;padding:0;line-height:normal;margin-right:4px}#jobDetailTabs #jobDetailTaLine truncated .tableData{border:solid 1px #f4f4f4;border-collapse:collapse}.tableData>tbody>tr>td{border:solid 1px #f4f4f4;background-color:#fff}.tableData>tbody>tr:nth-child(odd)>td{background-color:#fcfcfc}.tableData>thead>tr>th,.tableData>tbody>tr>th{background-color:#f4f4f4;border:solid 1px #f4f4f4}.tableData>tbody>tr:hover>td{background-color:#fefefe}.tableData>tbody>tr:hover:nth-child(odd)>td{background-color:#fafafa}.tableData>tfoot>tr>th,.tableData>tfoot>tr>td{background-color:#f4f4f4}.tableDataDark{border:solid 1px #d8d8d8;border-collapse:collapse}.tableDataDark td{border:solid 1px #d8d8d8;background-color:#fff}.tableDataDark th{background-color:#eee;border:solid 1px #d8d8d8}.tableDataContainer{background-color:#fff}.tableDataVertical{border:solid 1px #f4f4f4;border-collapse:collapse}.tableDataVertical>tbody>tr:nth-child(odd){background-color:#f4f4f4;margin:0;padding:0}.tableDataVertical>tbody>tr>th.name{width:170px;text-align:right}.tableDataVertical table.sub>tbody>tr:not(:first-child)>th,.tableDataVertical table.sub>tbody>tr:not(:first-child)>td{border-top:1px dashed #aaa}.tableDataVertical table.sub>tbody>tr>th{font-weight:normal;text-align:right}.tableDataVertical table.sub>tbody>tr>th.name{text-align:right}.icon16{display:inline-block;height:16px;width:16px;margin-left:2px;cursor:pointer}.subtleUntilHover{-moz-opacity:.3;opacity:.3}.subtleUntilHover:hover{-moz-opacity:1;opacity:1}#layout_PageHeading #Job_Show_Status{margin-left:20px;display:inline-block;height:50px;font-family:"Segoe UI",Arial,Verdana,Tahoma,sans-serif;font-weight:lighter;font-stretch:condensed;font-size:.7em;text-transform:uppercase}#layout_PageHeading #Job_Show_Status span.icon{margin-right:6px}#layout_PageHeading #Job_Show_QueueStatus{display:inline-block;float:right;height:50px;font-size:.6em}#Job_List{padding-top:20px}#Job_List>.jobTable>h3{margin:30px 0 50px 20px!important}#Job_Show #Job_Show_Subjects{table-layout:fixed}#Job_Show #Job_Show_Subjects>tbody>tr>td{padding-top:0;height:100%}#Job_Show #Job_Show_Subjects>tbody>tr>td>div{position:relative}#Job_Show #Job_Show_Subjects>tbody>tr>td>div div.status{margin-top:2px;padding-top:2px;border-top:1px dashed #ddd}#Job_Show #Job_Show_Subjects>tbody>tr>td>div input.discreet{margin-left:-2px}#Job_Show #Job_Show_Subjects>tbody>tr>td:not(:last-child){border-right:1px dashed #aaa}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_Type>table{table-layout:fixed}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_SubTypes_1,#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_SubTypes_2{padding-left:16px;font-weight:bold}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_SubTypes_Update{margin-left:16px;font-size:.9em}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_SubTypes_Update_Dialog{display:none}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_Dates{padding-bottom:6px}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_Dates table{table-layout:fixed}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_Dates table>tbody>tr>td{vertical-align:middle}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_Job_Dates table>tbody>tr>td:first-child{font-weight:bold;width:60px}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_GenerateDocument_Container{padding-top:4px}#Job_Show #Job_Show_Subjects #Job_Show_Job #Job_Show_GenerateDocument_Container #Job_Show_GenerateDocument{padding:0}#Job_Show #Job_Show_Subjects #Job_Show_Device>div{padding-left:102px;min-height:100px}#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Model_Image{position:absolute;left:0;top:0;height:96px;width:96px}#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Details{float:left}#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Details_HWar,#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Details_HNWar{float:right;border-left:1px dashed #ddd;padding-left:4px;margin-right:2px}#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Details_HWar_Details_Button,#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Details_HNWar_Details_Button{font-size:.9em}#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_DeviceHeld table{table-layout:fixed}#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_DeviceHeld table>tbody>tr>td:first-child{width:62px}#Job_Show #Job_Show_Subjects #Job_Show_Subjects_Actions>td{padding-top:4px}#Job_Show #Job_Show_Subjects #Job_Show_Subjects_Actions #Job_Show_Device_Actions{padding-left:111px}#jobDetailTabs{margin-top:10px;border-radius:0;background-image:none;background-color:#fff;border:none;padding:0}#jobDetailTabs #jobDetailTabItems{border-radius:0;border-top:1px solid #ddd;border-right:1px solid #ddd;border-left:1px solid #ddd;border-bottom:none;padding:2px 0 0 4px;background-image:none;background-color:#eee;display:table}#jobDetailTabs #jobDetailTabItems>li{top:0;border-radius:0;margin:0 5px 0 0;padding:0;line-height:normal;margin-right:4px}#jobDetailTabs #jobDetailTaLine truncated
+7 -1
View File
@@ -396,7 +396,13 @@ namespace Disco.Web.Controllers
{ {
// Create New Job // Create New Job
var currentUser = Database.Users.Find(UserService.CurrentUserId); var currentUser = Database.Users.Find(UserService.CurrentUserId);
var j = BI.JobBI.Utilities.Create(Database, m.Device, m.User, m.GetJobType, m.GetJobSubTypes, currentUser);
// Try QuickLog?
bool addAutoQueues = !(Authorization.Has(Claims.Job.Actions.Close)
&& m.QuickLog.HasValue && m.QuickLog.Value
&& m.QuickLogTaskTimeMinutes.HasValue && m.QuickLogTaskTimeMinutes.Value > 0);
var j = BI.JobBI.Utilities.Create(Database, m.Device, m.User, m.GetJobType, m.GetJobSubTypes, currentUser, addAutoQueues);
if (m.DeviceHeld.Value) if (m.DeviceHeld.Value)
{ {
+2 -5
View File
@@ -258,7 +258,6 @@
$deviceHeld.change(validateQuickLog); $deviceHeld.change(validateQuickLog);
$jobTypes.change(validateQuickLog); $jobTypes.change(validateQuickLog);
$('#createJob_SubTypes').on('change', 'input', validateQuickLog);
validateQuickLog(); validateQuickLog();
function validateQuickLog() { function validateQuickLog() {
@@ -275,11 +274,7 @@
case 'SImg': case 'SImg':
case 'SOS': case 'SOS':
case 'UMgmt': case 'UMgmt':
// If Job-Queues are configured for a Sub-Type, don't allow quick-log.
if ($('#createJob_SubType_' + $jobTypes.filter(':checked').val()).find('input:checked').closest('li').has('i.queue').length == 0)
quickLogAllowed = true; quickLogAllowed = true;
else
quickLogAllowed = false;
break; break;
default: default:
quickLogAllowed = false; quickLogAllowed = false;
@@ -301,8 +296,10 @@
$quickLog.change(function () { $quickLog.change(function () {
if ($(this).is(':checked')) { if ($(this).is(':checked')) {
$quickLogTaskTimeContainer.slideDown(); $quickLogTaskTimeContainer.slideDown();
$('#createJob_SubTypes').addClass('isQuickLog');
} else { } else {
$quickLogTaskTimeContainer.slideUp(); $quickLogTaskTimeContainer.slideUp();
$('#createJob_SubTypes').removeClass('isQuickLog');
} }
}); });
+29 -32
View File
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.34003 // Runtime Version:4.0.30319.34011
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@@ -701,43 +701,40 @@ WriteLiteral("\r\n //#region QuickLog\r\n var $quickLog =
"teJob_TaskTimeOtherMinutes\');\r\n var $quickLogTaskTimeValidationMessag" + "teJob_TaskTimeOtherMinutes\');\r\n var $quickLogTaskTimeValidationMessag" +
"e = $quickLogTaskTimeContainer.find(\'[data-valmsg-for=\"QuickLogTaskTimeMinutes\"]" + "e = $quickLogTaskTimeContainer.find(\'[data-valmsg-for=\"QuickLogTaskTimeMinutes\"]" +
"\');\r\n\r\n $deviceHeld.change(validateQuickLog);\r\n $jobTypes." + "\');\r\n\r\n $deviceHeld.change(validateQuickLog);\r\n $jobTypes." +
"change(validateQuickLog);\r\n $(\'#createJob_SubTypes\').on(\'change\', \'in" + "change(validateQuickLog);\r\n validateQuickLog();\r\n\r\n functi" +
"put\', validateQuickLog);\r\n validateQuickLog();\r\n\r\n functio" + "on validateQuickLog() {\r\n var quickLogAllowed = false;\r\n\r\n " +
"n validateQuickLog() {\r\n var quickLogAllowed = false;\r\n\r\n " + " if ($deviceHeld.val() === \'True\') {\r\n quickLogAllowe" +
" if ($deviceHeld.val() === \'True\') {\r\n quickLogAllowed" + "d = false;\r\n } else {\r\n // Allow Quick-Log onl" +
" = false;\r\n } else {\r\n // Allow Quick-Log only" + "y for certain Job Types\r\n var selectedType = $jobTypes.filter" +
" for certain Job Types\r\n var selectedType = $jobTypes.filter(" + "(\':checked\').val();\r\n switch (selectedType) {\r\n " +
"\':checked\').val();\r\n switch (selectedType) {\r\n " +
" case \'HMisc\':\r\n case \'SApp\':\r\n " + " case \'HMisc\':\r\n case \'SApp\':\r\n " +
" case \'SImg\':\r\n case \'SOS\':\r\n " + " case \'SImg\':\r\n case \'SOS\':\r\n " +
" case \'UMgmt\':\r\n // If Job-Queues are configured for " + " case \'UMgmt\':\r\n quickLogAllowed = true;\r\n " +
"a Sub-Type, don\'t allow quick-log.\r\n if ($(\'#createJo" + " break;\r\n default:\r\n " +
"b_SubType_\' + $jobTypes.filter(\':checked\').val()).find(\'input:checked\').closest(" + " quickLogAllowed = false;\r\n break;\r\n " +
"\'li\').has(\'i.queue\').length == 0)\r\n quickLogAllow" + " }\r\n }\r\n\r\n if (quickLogAllowed) {\r\n " +
"ed = true;\r\n else\r\n qu" + " $quickLogContainer.slideDown();\r\n } else {\r\n " +
"ickLogAllowed = false;\r\n break;\r\n " + " if (init)\r\n $quickLogContainer.hide();\r\n " +
" default:\r\n quickLogAllowed = false;\r\n " + " else\r\n $quickLogContainer.slideUp();\r\n " +
" break;\r\n }\r\n }\r\n\r\n " + " $quickLog.prop(\'checked\', false).change();\r\n }\r\n" +
" if (quickLogAllowed) {\r\n $quickLogContainer.slideDown();\r" + " }\r\n\r\n $quickLog.change(function () {\r\n if " +
"\n } else {\r\n if (init)\r\n " + "($(this).is(\':checked\')) {\r\n $quickLogTaskTimeContainer.slide" +
" $quickLogContainer.hide();\r\n else\r\n " + "Down();\r\n $(\'#createJob_SubTypes\').addClass(\'isQuickLog\');\r\n " +
"$quickLogContainer.slideUp();\r\n $quickLog.prop(\'checked\', fal" + " } else {\r\n $quickLogTaskTimeContainer.slideUp(" +
"se).change();\r\n }\r\n }\r\n\r\n $quickLog.change(" + ");\r\n $(\'#createJob_SubTypes\').removeClass(\'isQuickLog\');\r\n " +
"function () {\r\n if ($(this).is(\':checked\')) {\r\n " + " }\r\n });\r\n\r\n $quickLogTaskTimes.change(functio" +
" $quickLogTaskTimeContainer.slideDown();\r\n } else {\r\n " + "n () {\r\n if ($quickLogTaskTimes.filter(\':checked\').val() === \"\") " +
" $quickLogTaskTimeContainer.slideUp();\r\n }\r\n }" + "{\r\n $(\'#createJob_TaskTimeOtherMinutesContainer\').show();\r\n " +
");\r\n\r\n $quickLogTaskTimes.change(function () {\r\n if ($" + " $quickLogTaskTimeOtherMinutes.attr(\'disabled\', null).focus().s" +
"quickLogTaskTimes.filter(\':checked\').val() === \"\") {\r\n $(\'#cr" + "elect();\r\n } else {\r\n $(\'#createJob_TaskTimeOt" +
"eateJob_TaskTimeOtherMinutesContainer\').show();\r\n $quickLogTa" + "herMinutesContainer\').hide();\r\n $quickLogTaskTimeOtherMinutes" +
"skTimeOtherMinutes.attr(\'disabled\', null).focus().select();\r\n } e" + ".attr(\'disabled\', \'disabled\');\r\n }\r\n });\r\n " +
"lse {\r\n $(\'#createJob_TaskTimeOtherMinutesContainer\').hide();" + "//#endregion\r\n ");
"\r\n $quickLogTaskTimeOtherMinutes.attr(\'disabled\', \'disabled\')" +
";\r\n }\r\n });\r\n //#endregion\r\n ");
WriteLiteral("\r\n"); WriteLiteral("\r\n");
#line 320 "..\..\Views\Job\Create.cshtml" #line 317 "..\..\Views\Job\Create.cshtml"
} }