url duplication cleanup

deepsource-autofix-76c6eb20
Dan Gowans 2023-01-05 13:16:43 -05:00
parent c33e52102e
commit 3fd07bea6f
15 changed files with 46 additions and 75 deletions

View File

@ -15,8 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
if (responseJSON.success) {
los.clearUnsavedChanges();
if (isCreate || refreshAfterSave) {
window.location.href =
los.urlPrefix + "/lots/" + responseJSON.lotId + "/edit?t=" + Date.now();
window.location.href = los.getLotURL(responseJSON.lotId, true, true);
}
else {
bulmaJS.alert({
@ -48,7 +47,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
}, (responseJSON) => {
if (responseJSON.success) {
cityssm.disableNavBlocker();
window.location.href = los.urlPrefix + "/lots/?t=" + Date.now();
window.location.href = los.getLotURL();
}
else {
bulmaJS.alert({

View File

@ -33,8 +33,7 @@ declare const bulmaJS: BulmaJS;
los.clearUnsavedChanges();
if (isCreate || refreshAfterSave) {
window.location.href =
los.urlPrefix + "/lots/" + responseJSON.lotId + "/edit?t=" + Date.now();
window.location.href = los.getLotURL(responseJSON.lotId, true, true);
} else {
bulmaJS.alert({
message: exports.aliases.lot + " Updated Successfully",
@ -74,7 +73,7 @@ declare const bulmaJS: BulmaJS;
(responseJSON: { success: boolean; errorMessage?: string }) => {
if (responseJSON.success) {
cityssm.disableNavBlocker();
window.location.href = los.urlPrefix + "/lots/?t=" + Date.now();
window.location.href = los.getLotURL();
} else {
bulmaJS.alert({
title: `Error Deleting ${los.escapedAliases.Lot}`,

View File

@ -18,16 +18,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
if (responseJSON.success) {
los.clearUnsavedChanges();
if (isCreate || refreshAfterSave) {
window.location.href =
los.urlPrefix +
"/lotOccupancies/" +
responseJSON.lotOccupancyId +
"/edit?t=" +
Date.now();
window.location.href = los.getLotOccupancyURL(responseJSON.lotOccupancyId, true, true);
}
else {
bulmaJS.alert({
message: exports.aliases.occupancy + " Updated Successfully",
message: `${los.escapedAliases.Occupancy} Updated Successfully`,
contextualColorName: "success"
});
}
@ -49,14 +44,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
cityssm.postJSON(los.urlPrefix + "/lotOccupancies/doCopyLotOccupancy", {
lotOccupancyId
}, (responseJSON) => {
var _a;
if (responseJSON.success) {
cityssm.disableNavBlocker();
window.location.href =
los.urlPrefix +
"/lotOccupancies/" +
((_a = responseJSON.lotOccupancyId) === null || _a === void 0 ? void 0 : _a.toString()) +
"/edit";
window.location.href = los.getLotOccupancyURL(responseJSON.lotOccupancyId, true);
}
else {
bulmaJS.alert({
@ -96,7 +86,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
}, (responseJSON) => {
if (responseJSON.success) {
cityssm.disableNavBlocker();
window.location.href = los.urlPrefix + "/lotOccupancies?t=" + Date.now();
window.location.href = los.getLotOccupancyURL();
}
else {
bulmaJS.alert({

View File

@ -18,16 +18,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
if (responseJSON.success) {
los.clearUnsavedChanges();
if (isCreate || refreshAfterSave) {
window.location.href =
los.urlPrefix +
"/lotOccupancies/" +
responseJSON.lotOccupancyId +
"/edit?t=" +
Date.now();
window.location.href = los.getLotOccupancyURL(responseJSON.lotOccupancyId, true, true);
}
else {
bulmaJS.alert({
message: exports.aliases.occupancy + " Updated Successfully",
message: `${los.escapedAliases.Occupancy} Updated Successfully`,
contextualColorName: "success"
});
}
@ -49,14 +44,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
cityssm.postJSON(los.urlPrefix + "/lotOccupancies/doCopyLotOccupancy", {
lotOccupancyId
}, (responseJSON) => {
var _a;
if (responseJSON.success) {
cityssm.disableNavBlocker();
window.location.href =
los.urlPrefix +
"/lotOccupancies/" +
((_a = responseJSON.lotOccupancyId) === null || _a === void 0 ? void 0 : _a.toString()) +
"/edit";
window.location.href = los.getLotOccupancyURL(responseJSON.lotOccupancyId, true);
}
else {
bulmaJS.alert({
@ -96,7 +86,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
}, (responseJSON) => {
if (responseJSON.success) {
cityssm.disableNavBlocker();
window.location.href = los.urlPrefix + "/lotOccupancies?t=" + Date.now();
window.location.href = los.getLotOccupancyURL();
}
else {
bulmaJS.alert({

View File

@ -36,15 +36,14 @@ declare const bulmaJS: BulmaJS;
los.clearUnsavedChanges();
if (isCreate || refreshAfterSave) {
window.location.href =
los.urlPrefix +
"/lotOccupancies/" +
responseJSON.lotOccupancyId +
"/edit?t=" +
Date.now();
window.location.href = los.getLotOccupancyURL(
responseJSON.lotOccupancyId,
true,
true
);
} else {
bulmaJS.alert({
message: exports.aliases.occupancy + " Updated Successfully",
message: `${los.escapedAliases.Occupancy} Updated Successfully`,
contextualColorName: "success"
});
}
@ -74,11 +73,7 @@ declare const bulmaJS: BulmaJS;
(responseJSON: { success: boolean; errorMessage?: string; lotOccupancyId?: number }) => {
if (responseJSON.success) {
cityssm.disableNavBlocker();
window.location.href =
los.urlPrefix +
"/lotOccupancies/" +
responseJSON.lotOccupancyId?.toString() +
"/edit";
window.location.href = los.getLotOccupancyURL(responseJSON.lotOccupancyId, true);
} else {
bulmaJS.alert({
title: "Error Copying Record",
@ -124,7 +119,7 @@ declare const bulmaJS: BulmaJS;
(responseJSON: { success: boolean; errorMessage?: string }) => {
if (responseJSON.success) {
cityssm.disableNavBlocker();
window.location.href = los.urlPrefix + "/lotOccupancies?t=" + Date.now();
window.location.href = los.getLotOccupancyURL();
} else {
bulmaJS.alert({
title: "Error Deleting Record",

View File

@ -357,21 +357,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
return (urlPrefix +
"/" +
recordTypePlural +
"/" +
recordId +
(edit ? "/edit" : "") +
(recordId ? "/" + recordId : "") +
(recordId && edit ? "/edit" : "") +
(time ? "/?t=" + Date.now() : ""));
}
function getMapURL(mapId, edit = false, time = false) {
function getMapURL(mapId = "", edit = false, time = false) {
return getRecordURL("maps", mapId, edit, time);
}
function getLotURL(lotId, edit = false, time = false) {
function getLotURL(lotId = "", edit = false, time = false) {
return getRecordURL("lots", lotId, edit, time);
}
function getLotOccupancyURL(lotOccupancyId, edit = false, time = false) {
function getLotOccupancyURL(lotOccupancyId = "", edit = false, time = false) {
return getRecordURL("lotOccupancies", lotOccupancyId, edit, time);
}
function getWorkOrderURL(workOrderId, edit = false, time = false) {
function getWorkOrderURL(workOrderId = "", edit = false, time = false) {
return getRecordURL("workOrders", workOrderId, edit, time);
}
/*

View File

@ -448,26 +448,25 @@ declare const bulmaJS: BulmaJS;
urlPrefix +
"/" +
recordTypePlural +
"/" +
recordId +
(edit ? "/edit" : "") +
(recordId ? "/" + recordId : "") +
(recordId && edit ? "/edit" : "") +
(time ? "/?t=" + Date.now() : "")
);
}
function getMapURL(mapId: number | string, edit = false, time = false) {
function getMapURL(mapId: number | string = "", edit = false, time = false) {
return getRecordURL("maps", mapId, edit, time);
}
function getLotURL(lotId: number | string, edit = false, time = false) {
function getLotURL(lotId: number | string = "", edit = false, time = false) {
return getRecordURL("lots", lotId, edit, time);
}
function getLotOccupancyURL(lotOccupancyId: number | string, edit = false, time = false) {
function getLotOccupancyURL(lotOccupancyId: number | string = "", edit = false, time = false) {
return getRecordURL("lotOccupancies", lotOccupancyId, edit, time);
}
function getWorkOrderURL(workOrderId: number | string, edit = false, time = false) {
function getWorkOrderURL(workOrderId: number | string = "", edit = false, time = false) {
return getRecordURL("workOrders", workOrderId, edit, time);
}

View File

@ -43,7 +43,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
mapId
}, (responseJSON) => {
if (responseJSON.success) {
window.location.href = los.urlPrefix + "/maps?t=" + Date.now();
window.location.href = los.getMapURL();
}
else {
bulmaJS.alert({

View File

@ -66,7 +66,7 @@ declare const bulmaJS: BulmaJS;
},
(responseJSON: { success: boolean; errorMessage?: string }) => {
if (responseJSON.success) {
window.location.href = los.urlPrefix + "/maps?t=" + Date.now();
window.location.href = los.getMapURL();
} else {
bulmaJS.alert({
title: "Error Deleting " + exports.aliases.map,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e;const t=exports.los,a=document.querySelector("#map--mapId").value,s=""===a,o=document.querySelector("#form--map");o.addEventListener("submit",function(e){e.preventDefault(),cityssm.postJSON(t.urlPrefix+"/maps/"+(s?"doCreateMap":"doUpdateMap"),o,e=>{e.success?(cityssm.disableNavBlocker(),s?window.location.href=t.urlPrefix+"/maps/"+e.mapId+"/edit":bulmaJS.alert({message:exports.aliases.map+" Updated Successfully",contextualColorName:"success"})):bulmaJS.alert({title:"Error Updating "+exports.aliases.map,message:e.errorMessage||"",contextualColorName:"danger"})})});const r=o.querySelectorAll("input, select");for(const e of r)e.addEventListener("change",cityssm.enableNavBlocker);null===(e=document.querySelector("#button--deleteMap"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:"Delete "+exports.aliases.map,message:`Are you sure you want to delete this ${exports.aliases.map.toLowerCase()} and all related ${exports.aliases.lots.toLowerCase()}?`,contextualColorName:"warning",okButton:{text:`Yes, Delete ${exports.aliases.map}`,callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/maps/doDeleteMap",{mapId:a},e=>{e.success?window.location.href=t.urlPrefix+"/maps?t="+Date.now():bulmaJS.alert({title:"Error Deleting "+exports.aliases.map,message:e.errorMessage||"",contextualColorName:"danger"})})}}})})})();
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{var e;const t=exports.los,a=document.querySelector("#map--mapId").value,s=""===a,o=document.querySelector("#form--map");o.addEventListener("submit",function(e){e.preventDefault(),cityssm.postJSON(t.urlPrefix+"/maps/"+(s?"doCreateMap":"doUpdateMap"),o,e=>{e.success?(cityssm.disableNavBlocker(),s?window.location.href=t.urlPrefix+"/maps/"+e.mapId+"/edit":bulmaJS.alert({message:exports.aliases.map+" Updated Successfully",contextualColorName:"success"})):bulmaJS.alert({title:"Error Updating "+exports.aliases.map,message:e.errorMessage||"",contextualColorName:"danger"})})});const r=o.querySelectorAll("input, select");for(const e of r)e.addEventListener("change",cityssm.enableNavBlocker);null===(e=document.querySelector("#button--deleteMap"))||void 0===e||e.addEventListener("click",e=>{e.preventDefault(),bulmaJS.confirm({title:"Delete "+exports.aliases.map,message:`Are you sure you want to delete this ${exports.aliases.map.toLowerCase()} and all related ${exports.aliases.lots.toLowerCase()}?`,contextualColorName:"warning",okButton:{text:`Yes, Delete ${exports.aliases.map}`,callbackFunction:function(){cityssm.postJSON(t.urlPrefix+"/maps/doDeleteMap",{mapId:a},e=>{e.success?window.location.href=t.getMapURL():bulmaJS.alert({title:"Error Deleting "+exports.aliases.map,message:e.errorMessage||"",contextualColorName:"danger"})})}}})})})();

View File

@ -38,8 +38,8 @@ export interface LOS {
getMoveUpDownButtonFieldHTML: (upButtonClassNames: string, downButtonClassNames: string, isSmall?: boolean) => string;
getLoadingParagraphHTML: (captionText?: string) => string;
getSearchResultsPagerHTML: (limit: number, offset: number, count: number) => string;
getMapURL: (mapId: number | string, edit?: boolean, time?: boolean) => string;
getLotURL: (lotId: number | string, edit?: boolean, time?: boolean) => string;
getLotOccupancyURL: (lotOccupancyId: number | string, edit?: boolean, time?: boolean) => string;
getWorkOrderURL: (workOrderId: number | string, edit?: boolean, time?: boolean) => string;
getMapURL: (mapId?: number | string, edit?: boolean, time?: boolean) => string;
getLotURL: (lotId?: number | string, edit?: boolean, time?: boolean) => string;
getLotOccupancyURL: (lotOccupancyId?: number | string, edit?: boolean, time?: boolean) => string;
getWorkOrderURL: (workOrderId?: number | string, edit?: boolean, time?: boolean) => string;
}

View File

@ -56,8 +56,8 @@ export interface LOS {
getLoadingParagraphHTML: (captionText?: string) => string;
getSearchResultsPagerHTML: (limit: number, offset: number, count: number) => string;
getMapURL: (mapId: number | string, edit?: boolean, time?: boolean) => string;
getLotURL: (lotId: number | string, edit?: boolean, time?: boolean) => string;
getLotOccupancyURL: (lotOccupancyId: number | string, edit?: boolean, time?: boolean) => string;
getWorkOrderURL: (workOrderId: number | string, edit?: boolean, time?: boolean) => string;
getMapURL: (mapId?: number | string, edit?: boolean, time?: boolean) => string;
getLotURL: (lotId?: number | string, edit?: boolean, time?: boolean) => string;
getLotOccupancyURL: (lotOccupancyId?: number | string, edit?: boolean, time?: boolean) => string;
getWorkOrderURL: (workOrderId?: number | string, edit?: boolean, time?: boolean) => string;
}