Skip to content

Commit

Permalink
remove incident "priority" fields from the UI
Browse files Browse the repository at this point in the history
It turns out that almost no one ever uses the priority field,
so let's dump it.

#1574
  • Loading branch information
srabraham committed Feb 2, 2025
1 parent 8ba2524 commit 1c3cf54
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 76 deletions.
20 changes: 3 additions & 17 deletions src/ims/element/incident/incident_template/template.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
</div>
</div>

<!-- Incident number, state, priority -->
<!-- Incident number, state -->

<div class="row py-1">
<div class="col-sm-4 py-1">
<div class="col-sm-6 py-1">
<div class="input-group">
<label class="control-label input-group-text">IMS #</label>
<span id="incident_number" class="form-control form-control-static"/>
</div>
</div>
<div class="col-sm-4 py-1">
<div class="col-sm-6 py-1">
<div class="input-group">
<label for="incident_state" class="control-label input-group-text">State</label>
<select
Expand All @@ -46,20 +46,6 @@
</select>
</div>
</div>
<div class="col-sm-4 py-1">
<div class="input-group">
<label for="incident_priority" class="control-label input-group-text">Priority</label>
<select
id="incident_priority"
class="form-control form-select form-select-sm auto-width"
onchange="editPriority()"
>
<option value="1">High</option>
<option value="3">Normal</option>
<option value="5">Low</option>
</select>
</div>
</div>
</div>

<!-- Summary -->
Expand Down
2 changes: 0 additions & 2 deletions src/ims/element/incident/incidents_template/template.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@
<thead>
<tr>
<th>#</th>
<th><abbr title="Priority">Pri</abbr></th>
<th>Created</th>
<th>State</th>
<th>Rangers</th>
Expand All @@ -180,7 +179,6 @@
<tfoot>
<tr>
<th>#</th>
<th><abbr title="Priority">Pri</abbr></th>
<th>Created</th>
<th>State</th>
<th>Rangers</th>
Expand Down
42 changes: 0 additions & 42 deletions src/ims/element/static/ims.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,35 +386,6 @@ function selectOptionWithValue(select, value) {
// Incident data
//

// Look up the name of a priority given its number (1-5).
function priorityNameFromNumber(number) {
switch (number) {
case 1: return "High";
case 2: return "High";
case 3: return "Normal";
case 4: return "Low";
case 5: return "Low︎";
default:
console.warn("Unknown incident priority number: " + number);
return undefined;
}
}


// Look up the glyph for a priority given its number (1-5).
function priorityIconFromNumber(number) {
switch (number) {
case 1: return '↑';
case 2: return '↑';
case 3: return '';
case 4: return '↓';
case 5: return '↓';
default:
console.warn("Unknown incident priority number: " + number);
return undefined;
}
}


// Look up a state's name given its ID.
function stateNameFromID(stateID) {
Expand Down Expand Up @@ -654,19 +625,6 @@ function renderIncidentNumber(incidentNumber, type, incident) {
return undefined;
}

function renderPriority(priorityNumber, type, incident) {
switch (type) {
case "display":
return priorityIconFromNumber(priorityNumber);
case "filter":
return priorityNameFromNumber(priorityNumber);
case "type":
case "sort":
return priorityNumber;
}
return undefined;
}

// e.g. "Wed, 8/28"
const shortDate = new Intl.DateTimeFormat(undefined, {
weekday: "short",
Expand Down
21 changes: 6 additions & 15 deletions src/ims/element/static/incidents.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,51 +242,43 @@ function initDataTables() {
"cellType": "th",
},
{ // 1
"name": "incident_priority",
"className": "incident_priority text-center",
"data": "priority",
"defaultContent": null,
"searchable": false,
"render": renderPriority,
},
{ // 2
"name": "incident_created",
"className": "incident_created text-center",
"data": "created",
"defaultContent": null,
"render": renderDate,
},
{ // 3
{ // 2
"name": "incident_state",
"className": "incident_state text-center",
"data": "state",
"defaultContent": null,
"render": renderState,
},
{ // 4
{ // 3
"name": "incident_ranger_handles",
"className": "incident_ranger_handles",
"data": "ranger_handles",
"defaultContent": "",
"render": renderSafeSorted,
"width": "6em",
},
{ // 5
{ // 4
"name": "incident_location",
"className": "incident_location",
"data": "location",
"defaultContent": "",
"render": renderLocation,
},
{ // 6
{ // 5
"name": "incident_types",
"className": "incident_types",
"data": "incident_types",
"defaultContent": "",
"render": renderSafeSorted,
"width": "5em",
},
{ // 7
{ // 6
"name": "incident_summary",
"className": "incident_summary",
"data": "summary",
Expand All @@ -295,8 +287,7 @@ function initDataTables() {
},
],
"order": [
[1, "asc"],
[2, "dsc"],
[1, "dsc"],
],
"createdRow": function (row, incident, index) {
row.addEventListener("click", function (e) {
Expand Down

0 comments on commit 1c3cf54

Please sign in to comment.