HUGE REFACTOR / CLEANUP

if there is a issue it's probably something in here that was changed
This commit is contained in:
2021-09-28 20:19:44 +00:00
parent 51eddfede9
commit d0afdd9855
238 changed files with 3127 additions and 8614 deletions

View File

@@ -62,7 +62,6 @@
</v-row>
</div>
</template>
<script>
const FORM_KEY = "adm-attachments";
export default {
@@ -132,14 +131,12 @@ export default {
);
}
},
async moveSelected(aType, ayId) {
let vm = this;
async moveSelected() {
const vm = this;
try {
//called from move dialog, already selected
vm.moveDialog = false;
window.$gz.form.deleteAllErrorBoxErrors(vm);
let res = await window.$gz.api.upsert("attachment/batch-move", {
const res = await window.$gz.api.upsert("attachment/batch-move", {
idList: this.selectedItems,
toType: this.moveType,
toId: this.moveId
@@ -154,15 +151,14 @@ export default {
}
},
async deleteSelected() {
let vm = this;
const vm = this;
try {
let dialogResult = await window.$gz.dialog.confirmDelete();
const dialogResult = await window.$gz.dialog.confirmDelete();
if (dialogResult != true) {
return;
}
window.$gz.form.deleteAllErrorBoxErrors(vm);
let res = await window.$gz.api.upsert(
const res = await window.$gz.api.upsert(
"attachment/batch-delete",
this.selectedItems
);
@@ -176,11 +172,10 @@ export default {
}
},
async startMaintenanceJob() {
let vm = this;
const vm = this;
try {
//warning about job exclusivity
let dialogResult = await window.$gz.dialog.confirmGeneric(
const dialogResult = await window.$gz.dialog.confirmGeneric(
"JobExclusiveWarning",
"warning"
);
@@ -188,29 +183,13 @@ export default {
return;
}
//call seed route
let jobId = await window.$gz.api.upsert("attachment/maintenance");
if (jobId.error) {
//throw new Error(jobId.error);
throw new Error(window.$gz.errorHandler.errorToString(jobId, vm));
}
jobId = jobId.jobId; //it's in a sub key
jobId = jobId.jobId;
vm.jobActive = true;
/* /// <summary>
/// Job status for opsjobs
/// </summary>
public enum JobStatus : int
{
Absent=0,
Sleeping = 1,
Running = 2,
Completed = 3,
Failed = 4
} */
let jobStatus = 1;
//get status
while (vm.jobActive == true) {
await window.$gz.util.sleepAsync(1000);
//check if done
@@ -218,7 +197,6 @@ export default {
`job-operations/status/${jobId}`
);
if (jobStatus.error) {
// throw new Error(jobStatus.error);
throw new Error(
window.$gz.errorHandler.errorToString(jobStatus, vm)
);
@@ -231,8 +209,6 @@ export default {
vm.jobActive = false;
}
}
//Here if it's completed successfully
window.$gz.eventBus.$emit("notify-success", vm.$ay.t("JobCompleted"));
this.reload = !this.reload;
} catch (error) {
@@ -251,7 +227,7 @@ function clickHandler(menuItem) {
if (!menuItem) {
return;
}
let m = window.$gz.menu.parseMenuItem(menuItem);
const m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) {
case "START_MAINTENANCE_JOB":
@@ -277,16 +253,13 @@ function clickHandler(menuItem) {
//
//
function generateMenu(vm) {
let menuOptions = {
const menuOptions = {
isMain: true,
icon: "$ayiFolder",
title: "Attachments",
helpUrl: "adm-attachments",
menuItems: []
};
//STUB REPORTS
//Report not Print, print is a further option
menuOptions.menuItems.push({
title: "Report",
icon: "$ayiFileAlt",
@@ -294,8 +267,7 @@ function generateMenu(vm) {
vm: vm
});
//get last report selected
let lastReport = window.$gz.form.getLastReport(FORM_KEY);
const lastReport = window.$gz.form.getLastReport(FORM_KEY);
if (lastReport != null) {
menuOptions.menuItems.push({
title: lastReport.name,
@@ -352,11 +324,10 @@ async function fetchTranslatedText(vm) {
//
//
async function populateSelectionLists(vm) {
let res = await window.$gz.api.get("enum-list/list/coreall");
const res = await window.$gz.api.get("enum-list/list/coreall");
if (res.error) {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
// window.$gz.errorHandler.handleFormError(res.error, vm);
} else {
vm.selectLists.objectTypes = res.data;
window.$gz.form.addNoSelectionItem(vm.selectLists.objectTypes);