fetch speed up implemented fully

This commit is contained in:
2021-10-05 19:21:46 +00:00
parent cb17995a9f
commit c3d3cb3388
3 changed files with 47 additions and 101 deletions

View File

@@ -15,14 +15,23 @@
SVC-SCHEDULE OUTSTANDING ITEMS
loaded schedule is slow to display, see if any speedups available
check the fetch events and put in some traces to calculate when and where
Port fetch events changes to personal schedule
Filter and sort issues:
Not in settings? Separate filter icon at top mimic data table UI?
Saved filters with order and names so users can quickly flip between groups of users?
Consider how to add filter by tag for users to schedule so can quickly select by tag(s)
sort order?? Not sure how to handle this one as filter and ad-hoc sort are at odds
View schedule by user so can click through user to schedule for *that* user alone, (brings up home-schedule maybe or I guess a copy would be easiest)
this will solve issue when people say "Why can't I view month but for one user instead?"
probably easiest from both the User edit form for admin and from the svc-schedule form (maybe a link on their names at top?? Opens same view currently selected but for that *one* user)
tech selection setting control ?
vertical in table in settings
show all techs in table with prior selections in order at the top and non selected at the end in alpha order
each row has up down control and checkbox to show so "Name|^|v|show"
During settings form, fetchEvents should be disabled until after save as changing DOW is triggering fetch which can be slow in a loaded sched
need tech selection setting control
vertical in table in settings
show all techs in table with prior selections in order at the top and non selected at the end in alpha order
each row has up down control and checkbox to show so "Name|^|v|show"
Remove day view options and replace by category view I think, but keep code and see how it goes may be switch back in again if demanded or makes sense
instead of new translation key, just use the day name but use it with the category view
@@ -33,9 +42,6 @@
schedule settings keyed by form re-use
3698 - hide unassigned tech slot (or case 3697 above would take care of that too)
View schedule by user so can click through user to schedule for *that* user alone, (brings up home-schedule maybe or I guess a copy would be easiest)
this will solve issue when people say "Why can't I view month but for one user instead?"
probably easiest from both the User edit form for admin and from the svc-schedule form (maybe a link on their names at top?? Opens same view currently selected but for that *one* user)
3766 - view schedule filtered by customer so can see at a glance all past and future for a single customer (more data table filter similarity)

View File

@@ -838,19 +838,36 @@ export default {
this.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(this);
} else {
this.events = res.data.map(x => {
return {
...x,
start: window.$gz.locale.utcDateToScheduleCompatibleFormatLocalized(
x.start,
this.timeZoneName
),
end: window.$gz.locale.utcDateToScheduleCompatibleFormatLocalized(
x.end,
this.timeZoneName
)
};
});
this.events.splice(0);
const timeZoneName = this.timeZoneName;
let i = res.data.length;
while (i--) {
const x = res.data[i];
this.events.push({
start: new Date(
new Date(x.start)
.toLocaleString("sv-SE", {
timeZone: timeZoneName
})
.replace(" ", "T")
).getTime(),
end: new Date(
new Date(x.end)
.toLocaleString("sv-SE", {
timeZone: timeZoneName
})
.replace(" ", "T")
).getTime(),
timed: true,
name: x.name,
color: x.color,
textColor: x.textColor,
type: x.type,
id: x.id,
editable: x.editable,
userId: x.userId
});
}
}
} catch (error) {
window.$gz.errorHandler.handleFormError(error, this);

View File

@@ -836,7 +836,7 @@ export default {
this.timeZoneName
),
wisuColorSource: this.formUserOptions.wisuColorSource,
wisu: this.formUserOptions.wisu, //workorder item scheduled user records
wisu: this.formUserOptions.wisu,
reviews: this.formUserOptions.reviews,
reminders: this.formUserOptions.reminders,
users: this.formUserOptions.users
@@ -846,25 +846,8 @@ export default {
this.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(this);
} else {
const vm = this;
/*
return new Date(
new Date(value) //convert to locale timezone and output in the closest thing to iso-8601 format
.toLocaleString("sv-SE", {
timeZone: timeZoneName
})
.replace(" ", "T") //Safari can't parse the date from here because sv-SE puts a space between date and time and Safari will only parse if it has a T between
).getTime();
*/
//=============================================
//HOT LOOP
//=============================================
console.time("process");
// const t = [];
this.events.splice(0);
const timeZoneName = this.timeZoneName;
let i = res.data.length;
while (i--) {
const x = res.data[i];
@@ -891,69 +874,9 @@ export default {
id: x.id,
editable: x.editable,
userId: x.userId,
category: vm.availableUsers.find(a => a.id == x.userId).name
category: this.availableUsers.find(a => a.id == x.userId).name
});
}
//this.events = t;
// this.events = res.data.map(x => {
// return {
// ...x,
// start: window.$gz.locale.utcDateToScheduleCompatibleFormatLocalized(
// x.start,
// this.timeZoneName
// ),
// end: window.$gz.locale.utcDateToScheduleCompatibleFormatLocalized(
// x.end,
// this.timeZoneName
// ),
// category: vm.availableUsers.find(a => a.id == x.userId).name
// };
// });
// t;
//====================================================
console.timeEnd("process");
//console.log(`processed ${this.events.length} items`);
/*
sept baseline
process: 4632ms - timer ended svc-schedule.vue:882
process: 19ms - timer ended svc-schedule.vue:882
process: 4467ms - timer ended
none under 4 seconds
{
"0": {
"start": "2021-09-02T00:00:00Z",
"end": "2021-09-02T04:00:00Z",
"timed": true,
"name": "3 Windler - Gerhold",
"color": "#FCF1C2",
"textColor": "black",
"type": 41,
"id": 41,
"editable": false,
"userId": 41
}
}
this.events = res.data.map(x => {
return {
...x,
start: window.$gz.locale.utcDateToScheduleCompatibleFormatLocalized(
x.start,
this.timeZoneName
),
end: window.$gz.locale.utcDateToScheduleCompatibleFormatLocalized(
x.end,
this.timeZoneName
),
category: vm.availableUsers.find(a => a.id == x.userId).name
};
});
*/
}
} catch (error) {
window.$gz.errorHandler.handleFormError(error, this);