throw "string" -> throw new Error("string"
This commit is contained in:
@@ -108,7 +108,9 @@ export default {
|
||||
//Get the AyaNova stock REQUIRED role rights for that object
|
||||
let objectRoleRights = this.ROLE_RIGHTS[typeName];
|
||||
if (!objectRoleRights) {
|
||||
throw `authorizationroles::getRights type ${oType} not found in roles collection`;
|
||||
throw new Error(
|
||||
`authorizationroles::getRights type ${oType} not found in roles collection`
|
||||
);
|
||||
}
|
||||
|
||||
//get the logged in user's role
|
||||
|
||||
@@ -5,9 +5,9 @@ export default {
|
||||
enumKey = enumKey.toLowerCase();
|
||||
if (enumKey != "authorizationroles") {
|
||||
if (window.$gz.store.state.enums[enumKey] == undefined) {
|
||||
throw "ERROR enums::get -> enumKey " +
|
||||
enumKey +
|
||||
" is missing from store";
|
||||
throw new Error(
|
||||
"ERROR enums::get -> enumKey " + enumKey + " is missing from store"
|
||||
);
|
||||
}
|
||||
return window.$gz.store.state.enums[enumKey][enumValue];
|
||||
} else {
|
||||
@@ -34,9 +34,11 @@ export default {
|
||||
enumKey = enumKey.toLowerCase();
|
||||
let e = window.$gz.store.state.enums[enumKey];
|
||||
if (!e) {
|
||||
throw "ERROR enums::getSelectionList -> enumKey " +
|
||||
enumKey +
|
||||
" is missing from store";
|
||||
throw new Error(
|
||||
"ERROR enums::getSelectionList -> enumKey " +
|
||||
enumKey +
|
||||
" is missing from store"
|
||||
);
|
||||
}
|
||||
let ret = [];
|
||||
//turn it into an array suitable for selection lists
|
||||
@@ -85,7 +87,7 @@ export default {
|
||||
let res = await window.$gz.api.get("enum-list/list/" + enumKey);
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
throw res;
|
||||
throw new Error(res);
|
||||
}
|
||||
return res.data;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,9 @@ function dealWithError(msg, vm) {
|
||||
if (vm.$ay.dev) {
|
||||
//make sure formState.appError is defined on data
|
||||
if (!window.$gz._.has(vm, "formState.appError")) {
|
||||
throw "DEV ERROR errorHandler::dealWithError -> formState.appError seems to be missing from form's vue data object";
|
||||
throw new Error(
|
||||
"DEV ERROR errorHandler::dealWithError -> formState.appError seems to be missing from form's vue data object"
|
||||
);
|
||||
}
|
||||
}
|
||||
vm.formState.appError = msg;
|
||||
|
||||
@@ -22,7 +22,7 @@ export default {
|
||||
//fetch and populate the store
|
||||
let res = await window.$gz.api.get("form-custom/" + formKey);
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
}
|
||||
window.$gz.store.commit("setFormCustomTemplateItem", {
|
||||
formKey: formKey,
|
||||
@@ -40,16 +40,20 @@ export default {
|
||||
},
|
||||
getFieldTemplateValue(formKey, fieldKey) {
|
||||
if (fieldKey === undefined) {
|
||||
throw "ERROR form-custom-template::getFieldTemplateValue -> fieldKey not specified for template for form [" +
|
||||
formKey +
|
||||
"]";
|
||||
throw new Error(
|
||||
"ERROR form-custom-template::getFieldTemplateValue -> fieldKey not specified for template for form [" +
|
||||
formKey +
|
||||
"]"
|
||||
);
|
||||
}
|
||||
|
||||
let template = window.$gz.store.state.formCustomTemplate[formKey];
|
||||
if (template === undefined) {
|
||||
throw "ERROR form-custom-template::getFieldTemplateValue -> Store is missing form template for [" +
|
||||
formKey +
|
||||
"]";
|
||||
throw new Error(
|
||||
"ERROR form-custom-template::getFieldTemplateValue -> Store is missing form template for [" +
|
||||
formKey +
|
||||
"]"
|
||||
);
|
||||
}
|
||||
|
||||
//_https://lodash.com/docs#find
|
||||
@@ -62,9 +66,11 @@ export default {
|
||||
let tok =
|
||||
window.$gz.store.state.formCustomTemplate[formKey + "_concurrencyToken"];
|
||||
if (tok === undefined) {
|
||||
throw "ERROR form-custom-template::getTemplateConcurrencyToken -> Store is missing concurrency token for [" +
|
||||
formKey +
|
||||
"]";
|
||||
throw new Error(
|
||||
"ERROR form-custom-template::getTemplateConcurrencyToken -> Store is missing concurrency token for [" +
|
||||
formKey +
|
||||
"]"
|
||||
);
|
||||
}
|
||||
|
||||
return tok;
|
||||
|
||||
@@ -57,7 +57,7 @@ function handleError(action, error, route) {
|
||||
);
|
||||
router.push(window.$gz.store.state.homePage);
|
||||
|
||||
throw "[ErrorUserNotAuthorized]";
|
||||
throw new Error("[ErrorUserNotAuthorized]");
|
||||
}
|
||||
|
||||
//Handle 401 not authenticated
|
||||
@@ -73,7 +73,7 @@ function handleError(action, error, route) {
|
||||
|
||||
router.push("/login");
|
||||
|
||||
throw "[ErrorUserNotAuthenticated]";
|
||||
throw new Error("[ErrorUserNotAuthenticated]");
|
||||
}
|
||||
|
||||
//is it a network error?
|
||||
@@ -98,7 +98,7 @@ function handleError(action, error, route) {
|
||||
window.$gz.eventBus.$emit("notify-error", msg);
|
||||
//note: using translation key in square brackets
|
||||
|
||||
throw msg;
|
||||
throw new Error(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,7 +500,7 @@ export default {
|
||||
handleError("UPSERT", error, route);
|
||||
} else {
|
||||
//specifically this is for the login page
|
||||
throw error;
|
||||
throw new Error(error);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -663,11 +663,13 @@ export default {
|
||||
|
||||
let res = await window.$gz.api.upsert("report/render", reportDataOptions);
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
} else {
|
||||
let reportUrl = window.$gz.api.reportDownloadUrl(res.data);
|
||||
if (window.open(reportUrl, "Report") == null) {
|
||||
throw "Problem displaying report in new window. Browser must allow pop-ups to view reports; check your browser setting";
|
||||
throw new Error(
|
||||
"Problem displaying report in new window. Browser must allow pop-ups to view reports; check your browser setting"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,24 +508,32 @@ export default {
|
||||
if (vm.$ay.dev) {
|
||||
//make sure formState.serverErrors is defined on data
|
||||
if (!window.$gz._.has(vm, "formState.serverError")) {
|
||||
throw "DEV ERROR gzform::formState.serverErrors -> formState.serverError seems to be missing from form's vue data object";
|
||||
throw new Error(
|
||||
"DEV ERROR gzform::formState.serverErrors -> formState.serverError seems to be missing from form's vue data object"
|
||||
);
|
||||
}
|
||||
|
||||
//make sure formState.appError is defined on data
|
||||
if (!window.$gz._.has(vm, "formState.appError")) {
|
||||
throw "DEV ERROR gzform::formState.serverErrors -> formState.appError seems to be missing from form's vue data object";
|
||||
throw new Error(
|
||||
"DEV ERROR gzform::formState.serverErrors -> formState.appError seems to be missing from form's vue data object"
|
||||
);
|
||||
}
|
||||
|
||||
//make sure formState.errorBoxMessage is defined on data
|
||||
if (!window.$gz._.has(vm, "formState.errorBoxMessage")) {
|
||||
throw "DEV ERROR gzform::formState.serverErrors -> formState.errorBoxMessage seems to be missing from form's vue data object";
|
||||
throw new Error(
|
||||
"DEV ERROR gzform::formState.serverErrors -> formState.errorBoxMessage seems to be missing from form's vue data object"
|
||||
);
|
||||
}
|
||||
|
||||
//ensure the error returned is in an expected format to catch coding errors at the server end
|
||||
if (!window.$gz._.isEmpty(vm.formState.serverError)) {
|
||||
//Make sure there is an error code if there is an error collection
|
||||
if (!vm.formState.serverError.code) {
|
||||
throw "DEV ERROR gzform::formState.serverErrors -> server returned error without code";
|
||||
throw new Error(
|
||||
"DEV ERROR gzform::formState.serverErrors -> server returned error without code"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -802,7 +810,9 @@ export default {
|
||||
setFormSettings(formKey, formSettings) {
|
||||
if (window.$gz.dev) {
|
||||
if (!formSettings.saved && !formSettings.temp) {
|
||||
throw "gzform:setFormSettings - saved AND temp keys are both missing from form data!";
|
||||
throw new Error(
|
||||
"gzform:setFormSettings - saved AND temp keys are both missing from form data!"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -841,7 +841,7 @@ async function getUserOptions() {
|
||||
"logItem",
|
||||
"Initialize::() fetch useroptions -> error" + error
|
||||
);
|
||||
throw error;
|
||||
throw new Error(error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -851,7 +851,7 @@ async function getUserOptions() {
|
||||
export default function initialize() {
|
||||
return new Promise(async function(resolve, reject) {
|
||||
if (!window.$gz.store.state.authenticated) {
|
||||
throw "initialize: Error, called but user not authenticated!";
|
||||
throw new Error("initialize: Error, called but user not authenticated!");
|
||||
}
|
||||
try {
|
||||
await window.$gz.translation.cacheTranslations(
|
||||
|
||||
@@ -21,7 +21,7 @@ export default {
|
||||
if (keepChecking && window.$gz.store.state.authenticated) {
|
||||
status = await window.$gz.api.get("notify/new-count");
|
||||
if (status.error) {
|
||||
throw status.error;
|
||||
throw new Error(status.error);
|
||||
} else {
|
||||
window.$gz.store.commit("setNewNotificationCount", status.data);
|
||||
//success so go to default in case it was changed by an error
|
||||
|
||||
@@ -32,13 +32,13 @@ export default {
|
||||
);
|
||||
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
}
|
||||
if (res.data) {
|
||||
tid.inside = res.data;
|
||||
}
|
||||
} catch (e) {
|
||||
throw e;
|
||||
throw new Error(e);
|
||||
}
|
||||
})();
|
||||
}
|
||||
@@ -69,14 +69,14 @@ export default {
|
||||
let res = await window.$gz.api.get("attachment/parent/" + tid.id);
|
||||
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
}
|
||||
if (res.data.id && res.data.id != 0) {
|
||||
this.handleOpenObjectClick(vm, res.data);
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
throw e;
|
||||
throw new Error(e);
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -115,7 +115,7 @@ export default {
|
||||
);
|
||||
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
}
|
||||
if (res && res.data) {
|
||||
vm.$router.push({
|
||||
@@ -125,7 +125,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
throw e;
|
||||
throw new Error(e);
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
@@ -13,7 +13,9 @@ export default {
|
||||
//
|
||||
tokenToDates: function(token) {
|
||||
if (token == null || token.length == 0) {
|
||||
throw "relative-date-filter-calculator: date token is null or empty";
|
||||
throw new Error(
|
||||
"relative-date-filter-calculator: date token is null or empty"
|
||||
);
|
||||
}
|
||||
|
||||
//return object contains the two dates that encompass the time period
|
||||
@@ -601,9 +603,11 @@ export default {
|
||||
break;
|
||||
|
||||
default:
|
||||
throw "realtive-date-time-filter-calculater: Date token [" +
|
||||
token +
|
||||
"] was not recognized";
|
||||
throw new Error(
|
||||
"realtive-date-time-filter-calculater: Date token [" +
|
||||
token +
|
||||
"] was not recognized"
|
||||
);
|
||||
//--------------------------
|
||||
}
|
||||
|
||||
@@ -1001,9 +1005,7 @@ export default {
|
||||
// BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
|
||||
// break;
|
||||
|
||||
// default:
|
||||
// throw new System.ArgumentOutOfRangeException("TOKEN", sOperator, "DataListSqlFilterCriteriaBuilder invalid filter TOKEN type [" + sValue + "] IN DATE_TIME");
|
||||
|
||||
//
|
||||
// //-----
|
||||
// }
|
||||
|
||||
|
||||
@@ -478,14 +478,18 @@ export default {
|
||||
//check pre-requisites exist just in case
|
||||
if (this.$ay.dev) {
|
||||
if (!window.$gz._) {
|
||||
throw "custom-fields-control: $gz._ (lodash) is required and missing";
|
||||
throw new Error(
|
||||
"custom-fields-control: $gz._ (lodash) is required and missing"
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.$ay.dev) {
|
||||
if (!this.formKey) {
|
||||
throw "custom-fields-control: formKey property is required and missing";
|
||||
throw new Error(
|
||||
"custom-fields-control: formKey property is required and missing"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ export default {
|
||||
//call api route
|
||||
let jobId = await window.$gz.api.upsert(url, body);
|
||||
if (jobId.error) {
|
||||
throw jobId.error;
|
||||
throw new Error(jobId.error);
|
||||
}
|
||||
jobId = jobId.jobId; //it's in a sub key
|
||||
//indicate loading by setting on button
|
||||
@@ -113,11 +113,11 @@ export default {
|
||||
`job-operations/status/${jobId}`
|
||||
);
|
||||
if (jobStatus.error) {
|
||||
throw jobStatus.error;
|
||||
throw new Error(jobStatus.error);
|
||||
}
|
||||
jobStatus = jobStatus.data;
|
||||
if (jobStatus == 4 || jobStatus == 0) {
|
||||
throw "Seeding job failed";
|
||||
throw new Error("Seeding job failed");
|
||||
}
|
||||
if (jobStatus == 3) {
|
||||
vm.jobActive = false;
|
||||
|
||||
@@ -593,7 +593,6 @@ export default {
|
||||
});
|
||||
|
||||
if (res.error) {
|
||||
// throw res.error;
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
|
||||
@@ -273,7 +273,7 @@ export default {
|
||||
vm.fetching = false;
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
throw res;
|
||||
throw new Error(res);
|
||||
}
|
||||
vm.searchResults = res.data;
|
||||
window.$gz.form.addNoSelectionItem(vm.searchResults);
|
||||
|
||||
@@ -89,7 +89,7 @@ export default {
|
||||
|
||||
let reportDataOptions = vm.reportDataOptions;
|
||||
if (!reportDataOptions) {
|
||||
throw "Missing report data unable to render report";
|
||||
throw new Error("Missing report data unable to render report");
|
||||
}
|
||||
reportDataOptions.ReportId = reportId;
|
||||
//Meta data from client for use by report script
|
||||
@@ -97,11 +97,13 @@ export default {
|
||||
let url = "report/render";
|
||||
let res = await window.$gz.api.upsert(url, reportDataOptions);
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
} else {
|
||||
let reportUrl = window.$gz.api.reportDownloadUrl(res.data);
|
||||
if (window.open(reportUrl, "Report") == null) {
|
||||
throw "Problem displaying report in new window. Browser must allow pop-ups to view reports; check your browser setting";
|
||||
throw new Error(
|
||||
"Problem displaying report in new window. Browser must allow pop-ups to view reports; check your browser setting"
|
||||
);
|
||||
}
|
||||
}
|
||||
this.isVisible = false;
|
||||
@@ -110,10 +112,12 @@ export default {
|
||||
async open(reportDataOptions) {
|
||||
let vm = this;
|
||||
if (reportDataOptions == null) {
|
||||
throw "report-selector:Open missing reportDataOptions";
|
||||
throw new Error("report-selector:Open missing reportDataOptions");
|
||||
}
|
||||
if (reportDataOptions.ObjectType == null) {
|
||||
throw "report-selector:Open - ObjectType is missing or empty";
|
||||
throw new Error(
|
||||
"report-selector:Open - ObjectType is missing or empty"
|
||||
);
|
||||
}
|
||||
|
||||
this.reportDataOptions = reportDataOptions;
|
||||
@@ -122,7 +126,7 @@ export default {
|
||||
`report/list/${reportDataOptions.ObjectType}`
|
||||
);
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
} else {
|
||||
this.reportList = res.data;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ export default {
|
||||
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
throw res;
|
||||
throw new Error(res);
|
||||
}
|
||||
//adding this to the property will automatically have it cached by the autocomplete component
|
||||
//as cache-items has been set so this just needs to be set here once and all is well in future
|
||||
|
||||
@@ -799,7 +799,7 @@ export default {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw editType + " NOT IMPLEMENTED";
|
||||
throw new Error(`wiki-control: ${editType} NOT IMPLEMENTED`);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ export default {
|
||||
//call seed route
|
||||
let jobId = await window.$gz.api.upsert("attachment/maintenance");
|
||||
if (jobId.error) {
|
||||
throw jobId.error;
|
||||
throw new Error(jobId.error);
|
||||
}
|
||||
jobId = jobId.jobId; //it's in a sub key
|
||||
vm.jobActive = true;
|
||||
@@ -229,11 +229,11 @@ export default {
|
||||
`job-operations/status/${jobId}`
|
||||
);
|
||||
if (jobStatus.error) {
|
||||
throw jobStatus.error;
|
||||
throw new Error(jobStatus.error);
|
||||
}
|
||||
jobStatus = jobStatus.data;
|
||||
if (jobStatus == 4 || jobStatus == 0) {
|
||||
throw "Seeding job failed";
|
||||
throw new Error("Seeding job failed");
|
||||
}
|
||||
if (jobStatus == 3) {
|
||||
vm.jobActive = false;
|
||||
|
||||
@@ -388,11 +388,11 @@ export default {
|
||||
//send request
|
||||
r = await window.$gz.api.upsert("license/trialRequest", vm.request);
|
||||
if (r.error) {
|
||||
throw r;
|
||||
throw new Error(r);
|
||||
}
|
||||
//a string is returned and will start with E1 if it's an error
|
||||
if (r.startsWith("E1")) {
|
||||
throw r;
|
||||
throw new Error(r);
|
||||
}
|
||||
|
||||
if (r == "ok") {
|
||||
@@ -414,7 +414,7 @@ export default {
|
||||
//It might have been just installed by the server on it's own so check if we are not working with the most current license
|
||||
let currentServerLicenseInfo = await window.$gz.api.get("license");
|
||||
if (currentServerLicenseInfo.error) {
|
||||
throw currentServerLicenseInfo.error;
|
||||
throw new Error(currentServerLicenseInfo.error);
|
||||
}
|
||||
currentServerLicenseInfo = currentServerLicenseInfo.data.license;
|
||||
|
||||
@@ -433,11 +433,11 @@ export default {
|
||||
let r = await window.$gz.api.upsert("license");
|
||||
//r should just be a string response unless there is an error in which case it's an object
|
||||
if (r.error) {
|
||||
throw r;
|
||||
throw new Error(r);
|
||||
}
|
||||
|
||||
if (r.startsWith("E1")) {
|
||||
throw r;
|
||||
throw new Error(r);
|
||||
}
|
||||
//If here, there is no technical error
|
||||
//key might not exist or be not found but no error so r contains the deets
|
||||
@@ -589,14 +589,14 @@ async function initForm(vm) {
|
||||
let res = await window.$gz.api.get("license");
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
throw res;
|
||||
throw new Error(res);
|
||||
}
|
||||
vm.currentLicenseInfo = res.data.license;
|
||||
|
||||
res = await window.$gz.api.get("license/database-empty");
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
throw res;
|
||||
throw new Error(res);
|
||||
}
|
||||
vm.dbIsEmpty = res.data;
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ export default {
|
||||
vm.formState.loading = true;
|
||||
|
||||
if (!recordId) {
|
||||
throw FORM_KEY + "::getDataFromApi -> Missing recordID!";
|
||||
throw new Error(FORM_KEY + "::getDataFromApi -> Missing recordID!");
|
||||
}
|
||||
let url = API_BASE_URL + recordId;
|
||||
try {
|
||||
|
||||
@@ -411,7 +411,7 @@ export default {
|
||||
vm.formState.loading = true;
|
||||
|
||||
if (!recordId) {
|
||||
throw FORM_KEY + "::getDataFromApi -> Missing recordID!";
|
||||
throw new Error(FORM_KEY + "::getDataFromApi -> Missing recordID!");
|
||||
}
|
||||
let url = API_BASE_URL + recordId;
|
||||
try {
|
||||
|
||||
@@ -299,7 +299,7 @@ async function getServerInfo(vm) {
|
||||
let res = await window.$gz.api.get("server-info");
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
throw res;
|
||||
throw new Error(res);
|
||||
} else {
|
||||
vm.serverInfo = res.data;
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ async function initDataObject(vm) {
|
||||
let url = "form-field-definition/" + vm.$route.params.formCustomTemplateKey;
|
||||
let res = await window.$gz.api.get(url);
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
}
|
||||
//set vm.obj to the combined synthesized snapshot array of template and availble fields for working data for this form
|
||||
// - {key, ltdisplay, hideable, custom, required, hide, type}
|
||||
|
||||
@@ -1191,7 +1191,7 @@ async function populateFieldDefinitions(vm) {
|
||||
"data-list/listfields?DataListKey=" + vm.dataListKey
|
||||
);
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
} else {
|
||||
vm.fieldDefinitions = res.data;
|
||||
}
|
||||
@@ -1224,7 +1224,9 @@ async function setEffectiveListView(vm) {
|
||||
*/
|
||||
|
||||
if (vm.listViewId == null) {
|
||||
throw "ay-data-list::setEffectiveListView - listViewId is not set";
|
||||
throw new Error(
|
||||
"ay-data-list::setEffectiveListView - listViewId is not set"
|
||||
);
|
||||
}
|
||||
|
||||
let formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
||||
@@ -1245,7 +1247,7 @@ async function setEffectiveListView(vm) {
|
||||
);
|
||||
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
} else {
|
||||
vm.effectiveListView = JSON.parse(res.data);
|
||||
vm.obj.name = vm.$ay.t("FilterUnsaved");
|
||||
@@ -1254,7 +1256,7 @@ async function setEffectiveListView(vm) {
|
||||
//listview has an id value
|
||||
let res = await window.$gz.api.get("data-list-view/" + vm.listViewId);
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
} else {
|
||||
vm.effectiveListView = JSON.parse(res.data.listView);
|
||||
vm.obj.public = res.data.public;
|
||||
@@ -1269,10 +1271,14 @@ async function setEffectiveListView(vm) {
|
||||
//
|
||||
function initDataObject(vm) {
|
||||
if (vm.effectiveListView == null) {
|
||||
throw "ay-data-list::initDataObject - effectiveListView is not set";
|
||||
throw new Error(
|
||||
"ay-data-list::initDataObject - effectiveListView is not set"
|
||||
);
|
||||
}
|
||||
if (vm.fieldDefinitions == null) {
|
||||
throw "ay-data-list::initDataObject - fieldDefinitions are not set";
|
||||
throw new Error(
|
||||
"ay-data-list::initDataObject - fieldDefinitions are not set"
|
||||
);
|
||||
}
|
||||
|
||||
let ret = [];
|
||||
@@ -1360,7 +1366,9 @@ function initDataObject(vm) {
|
||||
|
||||
if (window.$gz.dev) {
|
||||
if (vm.obj.editView.length != vm.fieldDefinitions.length) {
|
||||
throw "ay-data-list-view::initDataObject - working array length not equal to total field definition length";
|
||||
throw new Error(
|
||||
"ay-data-list-view::initDataObject - working array length not equal to total field definition length"
|
||||
);
|
||||
}
|
||||
}
|
||||
return Promise.resolve();
|
||||
@@ -1438,7 +1446,9 @@ function getDisplayForFilter(
|
||||
//Nothing more to do if there isn't both a value AND an operator at this point
|
||||
if (filterOperator == null || filterValue == null) {
|
||||
if (window.$gz.dev) {
|
||||
throw "ay-data-list-view::getDisplayForFilter Value filter missing one ore more of Operator, Value";
|
||||
throw new Error(
|
||||
"ay-data-list-view::getDisplayForFilter Value filter missing one ore more of Operator, Value"
|
||||
);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ export default {
|
||||
let res = await window.$gz.api.get("license/database-empty");
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
throw res;
|
||||
throw new Error(res);
|
||||
}
|
||||
if (res.data != true) {
|
||||
let dialogResult = await window.$gz.dialog.confirmGeneric(
|
||||
@@ -235,7 +235,7 @@ export default {
|
||||
`trial/seed/${vm.obj.seedLevel}/${vm.obj.timeZoneOffset}`
|
||||
);
|
||||
if (jobId.error) {
|
||||
throw jobId.error;
|
||||
throw new Error(jobId.error);
|
||||
}
|
||||
jobId = jobId.jobId; //it's in a sub key
|
||||
//indicate loading by setting on button
|
||||
@@ -262,11 +262,11 @@ export default {
|
||||
`job-operations/status/${jobId}`
|
||||
);
|
||||
if (jobStatus.error) {
|
||||
throw jobStatus.error;
|
||||
throw new Error(jobStatus.error);
|
||||
}
|
||||
jobStatus = jobStatus.data;
|
||||
if (jobStatus == 4 || jobStatus == 0) {
|
||||
throw "Seeding job failed";
|
||||
throw new Error("Seeding job failed");
|
||||
}
|
||||
if (jobStatus == 3) {
|
||||
vm.seedingJobActive = false;
|
||||
|
||||
@@ -139,11 +139,6 @@ export default {
|
||||
vm.formState.readOnly = !vm.rights.change;
|
||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
|
||||
//route params MUST have source data
|
||||
// if (!vm.$route.params.reportDataOptions) {
|
||||
// throw "ay-report-edit::created - missing reportDataOptions route parameter";
|
||||
// }
|
||||
|
||||
//id 0 means create a new record don't load one
|
||||
if (vm.$route.params.recordid != 0) {
|
||||
//is there already an obj from a prior operation?
|
||||
@@ -504,7 +499,7 @@ Handlebars.registerHelper('loud', function (aString) {
|
||||
loading: true
|
||||
});
|
||||
if (!recordId) {
|
||||
throw FORM_KEY + "::getDataFromApi -> Missing recordID!";
|
||||
throw new Error(FORM_KEY + "::getDataFromApi -> Missing recordID!");
|
||||
}
|
||||
let url = "report/" + recordId;
|
||||
try {
|
||||
@@ -702,7 +697,9 @@ Handlebars.registerHelper('loud', function (aString) {
|
||||
*/
|
||||
let reportDataOptions = vm.$route.params.reportDataOptions;
|
||||
if (!reportDataOptions) {
|
||||
throw "Missing report data: to view report must come here from an object edit form or list so data can be provided for viewing the report";
|
||||
throw new Error(
|
||||
"Missing report data: to view report must come here from an object edit form or list so data can be provided for viewing the report"
|
||||
);
|
||||
}
|
||||
reportDataOptions.ReportId = vm.obj.id;
|
||||
|
||||
@@ -936,17 +933,18 @@ async function fetchReportData(vm) {
|
||||
if (!reportDataOptions) {
|
||||
vm.reportData = null;
|
||||
return;
|
||||
// throw "ay-report-edit:fetchReportData - route parameter reportDataOptions is missing or empty, unable to init report designer";
|
||||
}
|
||||
if (reportDataOptions.ObjectType == null) {
|
||||
throw "ay-report-edit:fetchReportData - route parameter ObjectType is missing or empty, unable to init report designer";
|
||||
throw new Error(
|
||||
"ay-report-edit:fetchReportData - route parameter ObjectType is missing or empty, unable to init report designer"
|
||||
);
|
||||
}
|
||||
vm.obj.objectType = reportDataOptions.ObjectType;
|
||||
|
||||
let res = await window.$gz.api.upsert("report/data", reportDataOptions);
|
||||
//We never expect there to be no data here
|
||||
if (!res.hasOwnProperty("data")) {
|
||||
throw res;
|
||||
throw new Error(res);
|
||||
} else {
|
||||
vm.reportData = res.data;
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ export default {
|
||||
vm.formState.loading = true;
|
||||
|
||||
if (!recordId) {
|
||||
throw FORM_KEY + "::getDataFromApi -> Missing recordID!";
|
||||
throw new Error(FORM_KEY + "::getDataFromApi -> Missing recordID!");
|
||||
}
|
||||
let url = API_BASE_URL + recordId;
|
||||
try {
|
||||
|
||||
@@ -212,7 +212,7 @@ export default {
|
||||
//this is to ensure that when a user is viewing the latest notifications they don't see the NEW count still in the bell icon in menu since they are viewing them live
|
||||
let status = await window.$gz.api.get("notify/new-count");
|
||||
if (status.error) {
|
||||
throw status.error;
|
||||
throw new Error(status.error);
|
||||
}
|
||||
window.$gz.store.commit("setNewNotificationCount", status.data);
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ export default {
|
||||
vm.formState.loading = true;
|
||||
|
||||
if (!recordId) {
|
||||
throw FORM_KEY + "::getDataFromApi -> Missing recordID!";
|
||||
throw new Error(FORM_KEY + "::getDataFromApi -> Missing recordID!");
|
||||
}
|
||||
let url = API_BASE_URL + recordId;
|
||||
try {
|
||||
|
||||
@@ -310,7 +310,7 @@ export default {
|
||||
|
||||
if (res.error) {
|
||||
//don't expect this to ever get called but just in case
|
||||
throw res.error;
|
||||
throw new Error(res.error);
|
||||
}
|
||||
await processLogin(res.data, loggedInWithKnownPassword);
|
||||
|
||||
|
||||
@@ -423,7 +423,7 @@ export default {
|
||||
loading: true
|
||||
});
|
||||
if (!recordId) {
|
||||
throw FORM_KEY + "::getDataFromApi -> Missing recordID!";
|
||||
throw new Error(FORM_KEY + "::getDataFromApi -> Missing recordID!");
|
||||
}
|
||||
let url = API_BASE_URL + recordId;
|
||||
try {
|
||||
@@ -611,61 +611,64 @@ async function clickHandler(menuItem) {
|
||||
return;
|
||||
}
|
||||
let m = window.$gz.menu.parseMenuItem(menuItem);
|
||||
if (m.owner == FORM_KEY && !m.disabled) {
|
||||
switch (m.key) {
|
||||
case "save":
|
||||
m.vm.submit();
|
||||
break;
|
||||
case "delete":
|
||||
m.vm.remove();
|
||||
break;
|
||||
case "new":
|
||||
m.vm.$router.push({
|
||||
name: "widget-edit",
|
||||
params: { recordid: 0, new: true }
|
||||
});
|
||||
break;
|
||||
case "duplicate":
|
||||
m.vm.duplicate();
|
||||
break;
|
||||
case "report":
|
||||
// throw "blah blah blah";
|
||||
// throw Error("test exception");
|
||||
if (m.id != null) {
|
||||
//last report selected is in m.id
|
||||
try {
|
||||
if (m.owner == FORM_KEY && !m.disabled) {
|
||||
switch (m.key) {
|
||||
case "save":
|
||||
m.vm.submit();
|
||||
break;
|
||||
case "delete":
|
||||
m.vm.remove();
|
||||
break;
|
||||
case "new":
|
||||
m.vm.$router.push({
|
||||
name: "ay-report",
|
||||
params: { recordid: m.id, ayatype: window.$gz.type.Widget }
|
||||
name: "widget-edit",
|
||||
params: { recordid: 0, new: true }
|
||||
});
|
||||
} else {
|
||||
//general report selector chosen
|
||||
break;
|
||||
case "duplicate":
|
||||
m.vm.duplicate();
|
||||
break;
|
||||
case "report":
|
||||
if (m.id != null) {
|
||||
//last report selected is in m.id
|
||||
m.vm.$router.push({
|
||||
name: "ay-report",
|
||||
params: { recordid: m.id, ayatype: window.$gz.type.Widget }
|
||||
});
|
||||
} else {
|
||||
//general report selector chosen
|
||||
|
||||
let res = await m.vm.$refs.reportSelector.open({
|
||||
ObjectType: window.$gz.type.Widget,
|
||||
selectedRowIds: [m.vm.obj.id]
|
||||
});
|
||||
let res = await m.vm.$refs.reportSelector.open({
|
||||
ObjectType: window.$gz.type.Widget,
|
||||
selectedRowIds: [m.vm.obj.id]
|
||||
});
|
||||
|
||||
//if null for no selection
|
||||
//just bail out
|
||||
if (res == null) {
|
||||
return;
|
||||
//if null for no selection
|
||||
//just bail out
|
||||
if (res == null) {
|
||||
return;
|
||||
}
|
||||
//persist last report selected
|
||||
window.$gz.form.setLastReport(FORM_KEY, res);
|
||||
|
||||
//Now open the report viewer...
|
||||
m.vm.$router.push({
|
||||
name: "ay-report",
|
||||
params: { recordid: res.id, ayatype: window.$gz.type.Widget }
|
||||
});
|
||||
}
|
||||
//persist last report selected
|
||||
window.$gz.form.setLastReport(FORM_KEY, res);
|
||||
|
||||
//Now open the report viewer...
|
||||
m.vm.$router.push({
|
||||
name: "ay-report",
|
||||
params: { recordid: res.id, ayatype: window.$gz.type.Widget }
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
window.$gz.eventBus.$emit(
|
||||
"notify-warning",
|
||||
FORM_KEY + "::context click: [" + m.key + "]"
|
||||
);
|
||||
break;
|
||||
default:
|
||||
window.$gz.eventBus.$emit(
|
||||
"notify-warning",
|
||||
FORM_KEY + "::context click: [" + m.key + "]"
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (ex) {
|
||||
console.log("Widget menu handler error handler");
|
||||
window.$gz.errorHandler.handleFormError(ex, m.vm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user