refactoring

deepsource-autofix-76c6eb20
Dan Gowans 2022-12-30 16:09:47 -05:00
parent 062c210674
commit 055768c626
6 changed files with 19 additions and 24 deletions

View File

@ -369,7 +369,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
} }
document.querySelector("#button--addLotType").addEventListener("click", () => { document.querySelector("#button--addLotType").addEventListener("click", () => {
let addCloseModalFunction; let addCloseModalFunction;
const doAdd = (submitEvent) => { function doAdd(submitEvent) {
submitEvent.preventDefault(); submitEvent.preventDefault();
cityssm.postJSON(los.urlPrefix + "/admin/doAddLotType", submitEvent.currentTarget, (responseJSON) => { cityssm.postJSON(los.urlPrefix + "/admin/doAddLotType", submitEvent.currentTarget, (responseJSON) => {
if (responseJSON.success) { if (responseJSON.success) {
@ -385,7 +385,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
}); });
} }
}); });
}; }
cityssm.openHtmlModal("adminLotTypes-addLotType", { cityssm.openHtmlModal("adminLotTypes-addLotType", {
onshow(modalElement) { onshow(modalElement) {
los.populateAliases(modalElement); los.populateAliases(modalElement);

View File

@ -632,12 +632,12 @@ declare const bulmaJS: BulmaJS;
} }
} }
(document.querySelector("#button--addLotType") as HTMLButtonElement).addEventListener( document.querySelector("#button--addLotType")!.addEventListener(
"click", "click",
() => { () => {
let addCloseModalFunction: () => void; let addCloseModalFunction: () => void;
const doAdd = (submitEvent: SubmitEvent) => { function doAdd(submitEvent: SubmitEvent): void {
submitEvent.preventDefault(); submitEvent.preventDefault();
cityssm.postJSON( cityssm.postJSON(
@ -661,7 +661,7 @@ declare const bulmaJS: BulmaJS;
} }
} }
); );
}; }
cityssm.openHtmlModal("adminLotTypes-addLotType", { cityssm.openHtmlModal("adminLotTypes-addLotType", {
onshow(modalElement) { onshow(modalElement) {

View File

@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const workOrderTypeIdsElement = document.querySelector("#icsFilters--workOrderTypeIds"); const workOrderTypeIdsElement = document.querySelector("#icsFilters--workOrderTypeIds");
const workOrderMilestoneTypeIdsElement = document.querySelector("#icsFilters--workOrderMilestoneTypeIds"); const workOrderMilestoneTypeIdsElement = document.querySelector("#icsFilters--workOrderMilestoneTypeIds");
const calendarLinkElement = document.querySelector("#icsFilters--calendarURL"); const calendarLinkElement = document.querySelector("#icsFilters--calendarURL");
const updateCalendarURL = () => { function updateCalendarURL() {
let url = window.location.href.slice(0, Math.max(0, window.location.href.indexOf(window.location.pathname) + 1)) + let url = window.location.href.slice(0, Math.max(0, window.location.href.indexOf(window.location.pathname) + 1)) +
los.urlPrefix + los.urlPrefix +
"api/" + "api/" +
@ -31,7 +31,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
url = url.slice(0, -1) + "&"; url = url.slice(0, -1) + "&";
} }
calendarLinkElement.value = url.slice(0, -1); calendarLinkElement.value = url.slice(0, -1);
}; }
document.querySelector("#icsFilters--workOrderTypeIds-all").addEventListener("change", (changeEvent) => { document.querySelector("#icsFilters--workOrderTypeIds-all").addEventListener("change", (changeEvent) => {
workOrderTypeIdsElement.disabled = changeEvent.currentTarget.checked; workOrderTypeIdsElement.disabled = changeEvent.currentTarget.checked;
}); });

View File

@ -17,9 +17,8 @@ import type * as globalTypes from "../types/globalTypes";
"#icsFilters--calendarURL" "#icsFilters--calendarURL"
) as HTMLTextAreaElement; ) as HTMLTextAreaElement;
const updateCalendarURL = () => { function updateCalendarURL() {
let url = let url = window.location.href.slice(
window.location.href.slice(
0, 0,
Math.max(0, window.location.href.indexOf(window.location.pathname) + 1) Math.max(0, window.location.href.indexOf(window.location.pathname) + 1)
) + ) +
@ -30,10 +29,8 @@ import type * as globalTypes from "../types/globalTypes";
"milestoneICS/" + "milestoneICS/" +
"?"; "?";
if ( if (!workOrderTypeIdsElement.disabled &&
!workOrderTypeIdsElement.disabled && workOrderTypeIdsElement.selectedOptions.length > 0) {
workOrderTypeIdsElement.selectedOptions.length > 0
) {
url += "workOrderTypeIds="; url += "workOrderTypeIds=";
for (const optionElement of workOrderTypeIdsElement.selectedOptions) { for (const optionElement of workOrderTypeIdsElement.selectedOptions) {
@ -43,10 +40,8 @@ import type * as globalTypes from "../types/globalTypes";
url = url.slice(0, -1) + "&"; url = url.slice(0, -1) + "&";
} }
if ( if (!workOrderMilestoneTypeIdsElement.disabled &&
!workOrderMilestoneTypeIdsElement.disabled && workOrderMilestoneTypeIdsElement.selectedOptions.length > 0) {
workOrderMilestoneTypeIdsElement.selectedOptions.length > 0
) {
url += "workOrderMilestoneTypeIds="; url += "workOrderMilestoneTypeIds=";
for (const optionElement of workOrderMilestoneTypeIdsElement.selectedOptions) { for (const optionElement of workOrderMilestoneTypeIdsElement.selectedOptions) {
@ -57,7 +52,7 @@ import type * as globalTypes from "../types/globalTypes";
} }
calendarLinkElement.value = url.slice(0, -1); calendarLinkElement.value = url.slice(0, -1);
}; }
( (
document.querySelector("#icsFilters--workOrderTypeIds-all") as HTMLInputElement document.querySelector("#icsFilters--workOrderTypeIds-all") as HTMLInputElement

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,t=document.querySelector("#icsFilters--workOrderTypeIds"),r=document.querySelector("#icsFilters--workOrderMilestoneTypeIds"),s=document.querySelector("#icsFilters--calendarURL"),l=()=>{let l=window.location.href.slice(0,Math.max(0,window.location.href.indexOf(window.location.pathname)+1))+e.urlPrefix+"api/"+e.apiKey+"/milestoneICS/?";if(!t.disabled&&t.selectedOptions.length>0){l+="workOrderTypeIds=";for(const e of t.selectedOptions)l+=e.value+",";l=l.slice(0,-1)+"&"}if(!r.disabled&&r.selectedOptions.length>0){l+="workOrderMilestoneTypeIds=";for(const e of r.selectedOptions)l+=e.value+",";l=l.slice(0,-1)+"&"}s.value=l.slice(0,-1)};document.querySelector("#icsFilters--workOrderTypeIds-all").addEventListener("change",e=>{t.disabled=e.currentTarget.checked}),document.querySelector("#icsFilters--workOrderMilestoneTypeIds-all").addEventListener("change",e=>{r.disabled=e.currentTarget.checked});const o=document.querySelector("#panel--icsFilters").querySelectorAll("input, select");for(const e of o)e.addEventListener("change",l);l(),s.addEventListener("click",()=>{s.focus(),s.select()})})(); "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=exports.los,t=document.querySelector("#icsFilters--workOrderTypeIds"),r=document.querySelector("#icsFilters--workOrderMilestoneTypeIds"),s=document.querySelector("#icsFilters--calendarURL");function o(){let o=window.location.href.slice(0,Math.max(0,window.location.href.indexOf(window.location.pathname)+1))+e.urlPrefix+"api/"+e.apiKey+"/milestoneICS/?";if(!t.disabled&&t.selectedOptions.length>0){o+="workOrderTypeIds=";for(const e of t.selectedOptions)o+=e.value+",";o=o.slice(0,-1)+"&"}if(!r.disabled&&r.selectedOptions.length>0){o+="workOrderMilestoneTypeIds=";for(const e of r.selectedOptions)o+=e.value+",";o=o.slice(0,-1)+"&"}s.value=o.slice(0,-1)}document.querySelector("#icsFilters--workOrderTypeIds-all").addEventListener("change",e=>{t.disabled=e.currentTarget.checked}),document.querySelector("#icsFilters--workOrderMilestoneTypeIds-all").addEventListener("change",e=>{r.disabled=e.currentTarget.checked});const c=document.querySelector("#panel--icsFilters").querySelectorAll("input, select");for(const e of c)e.addEventListener("change",o);o(),s.addEventListener("click",()=>{s.focus(),s.select()})})();