Our pure JavaScript Scheduler component


Post by peaguilar »

If there are issues on scheduler it doesn't fail gracefully. It pops up this modal, and makes the user pick from the options. Is there a way to disable this so it never shows up?

Screen Shot 2023-01-31 at 9.23.08 AM.png
Screen Shot 2023-01-31 at 9.23.08 AM.png (255.17 KiB) Viewed 221 times

Post by peaguilar »

If I click the use 24 hours calendar with non-working sat and sun it shows the calendar the way that I need it. Can I default it to that option so that we never see this modal in production?


Post by marcio »

Hey peaguilar,

That error happens when you have a misconfiguration in the scheduler data, and that's a friendly way of fixing it.

That said, you can listen to this event https://bryntum.com/products/schedulerpro/docs/api/SchedulerPro/model/ProjectModel#event-emptyCalendar

And then do something like this to work as you suggested

project.on('emptyCalendar', ({ schedulingIssue, continueWithResolutionResult }) => {
    // apply the first resolution and continue
    schedulingIssue.getResolutions()[0].resolve();
    continueWithResolutionResult(EffectResolutionResult.Resume);
})

Best regards,
Márcio


Post by peaguilar »

Thank you for the response. Where does the EffectResolution come from? It doesnt show in the solution?


Post by marcio »

It's an enum from our TS typing, we'll update the docs, but you can use it the strings Cancel or Resume

export enum EffectResolutionResult {
    /**
     * A chosen resolution is "do nothing" so changes should be cancelled.
     */
    Cancel      = 'Cancel',
    /**
     * A resolution is applied and current transaction should be continued.
     */
    Resume      = 'Resume'
}

Best regards,
Márcio


Post by peaguilar »

if I try with this the listener fires, but it doesn't disable the modal

   scheduler.current?.instance.project.on(
        'emptyCalendar',
        ({ schedulingIssue, continueWithResolutionResult }: any) => {
          // apply the first resolution and continue
          schedulingIssue.getResolutions()[0].resolve();
          continueWithResolutionResult('Resume');
        }
      );

Post by marcio »

Are you able to share the data sample that you're using that is generating this error? To check what's not correct in the data.

Best regards,
Márcio


Post by peaguilar »

[
    {
        "id": "e6217bf3-aae9-49e5-90ba",
        "name": "Resource Calendare6217bf3-aae9-49e5-90ba",
        "unspecifiedTimeIsWorking": false,
        "intervals": [
            {
                "startDate": "2023-01-29T08:00:07-05:00",
                "endDate": "2023-01-29T18:00:07-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-30T08:00:07-05:00",
                "endDate": "2023-01-30T18:00:07-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-24T08:00:07-05:00",
                "endDate": "2023-01-24T18:00:07-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-31T08:00:07-05:00",
                "endDate": "2023-01-31T18:00:07-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-25T08:00:07-05:00",
                "endDate": "2023-01-25T18:00:07-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-01T08:00:07-05:00",
                "endDate": "2023-02-01T18:00:07-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-26T08:00:07-05:00",
                "endDate": "2023-01-26T18:00:07-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-02T08:00:07-05:00",
                "endDate": "2023-02-02T18:00:07-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-27T08:00:07-05:00",
                "endDate": "2023-01-27T18:00:07-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-03T08:00:07-05:00",
                "endDate": "2023-02-03T18:00:07-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-28T08:00:07-05:00",
                "endDate": "2023-01-28T18:00:07-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-31T09:02:02-05:00",
                "endDate": "2023-01-31T10:02:02-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-01T09:02:25-05:00",
                "endDate": "2023-02-01T10:02:25-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-01T08:02:02-05:00",
                "endDate": "2023-02-01T09:02:02-05:00",
                "isWorking": true
            }
        ]
    },
    {
        "id": "0ce84fef-515b-479e",
        "name": "Resource Calendar0ce84fef-515b-479e-a5a0",
        "unspecifiedTimeIsWorking": false,
        "intervals": [
            {
                "startDate": "2023-01-25T09:27:21-05:00",
                "endDate": "2023-01-25T17:27:21-05:00",
                "isWorking": true
            }
        ]
    },
    {
        "id": "4e0af623-43bc-471c-b1e4",
        "name": "Resource Calendar4e0af623-43bc-471c",
        "unspecifiedTimeIsWorking": false,
        "intervals": [
            {
                "startDate": "2023-01-30T09:00:13-05:00",
                "endDate": "2023-01-30T18:30:13-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-06T09:00:13-05:00",
                "endDate": "2023-02-06T18:30:13-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-13T09:00:13-05:00",
                "endDate": "2023-02-13T18:30:13-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-31T09:00:13-05:00",
                "endDate": "2023-01-31T18:30:13-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-07T09:00:13-05:00",
                "endDate": "2023-02-07T18:30:13-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-01T09:00:13-05:00",
                "endDate": "2023-02-01T18:30:13-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-08T09:00:13-05:00",
                "endDate": "2023-02-08T18:30:13-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-26T09:00:13-05:00",
                "endDate": "2023-01-26T18:30:13-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-02T09:00:13-05:00",
                "endDate": "2023-02-02T18:30:13-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-09T09:00:13-05:00",
                "endDate": "2023-02-09T18:30:13-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-27T09:00:13-05:00",
                "endDate": "2023-01-27T18:30:13-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-03T09:00:13-05:00",
                "endDate": "2023-02-03T18:30:13-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-10T09:00:13-05:00",
                "endDate": "2023-02-10T18:30:13-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-29T09:00:00-05:00",
                "endDate": "2023-01-29T10:00:00-05:00",
                "isWorking": true
            }
        ]
    },
    {
        "id": "2c585701-0b17-4d4d-8efc",
        "name": "Resource Calendar2c585701-0b17-4d4d-8efc",
        "unspecifiedTimeIsWorking": false,
        "intervals": [
            {
                "startDate": "2023-01-31T08:00:05-05:00",
                "endDate": "2023-01-31T12:00:05-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-01T08:00:42-05:00",
                "endDate": "2023-02-01T12:00:42-05:00",
                "isWorking": true
            }
        ]
    },
    {
        "id": "3ae4f874-3a1e-48c6-9915",
        "name": "Resource Calendar3ae4f874-3a1e-48c6-9915",
        "unspecifiedTimeIsWorking": false,
        "intervals": [
            {
                "startDate": "2023-01-29T09:00:31-05:00",
                "endDate": "2023-01-29T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-05T09:00:31-05:00",
                "endDate": "2023-02-05T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-30T09:00:31-05:00",
                "endDate": "2023-01-30T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-06T09:00:31-05:00",
                "endDate": "2023-02-06T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-24T09:00:31-05:00",
                "endDate": "2023-01-24T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-31T09:00:31-05:00",
                "endDate": "2023-01-31T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-07T09:00:31-05:00",
                "endDate": "2023-02-07T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-25T09:00:31-05:00",
                "endDate": "2023-01-25T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-01T09:00:31-05:00",
                "endDate": "2023-02-01T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-08T09:00:31-05:00",
                "endDate": "2023-02-08T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-26T09:00:31-05:00",
                "endDate": "2023-01-26T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-02T09:00:31-05:00",
                "endDate": "2023-02-02T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-09T09:00:31-05:00",
                "endDate": "2023-02-09T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-27T09:00:31-05:00",
                "endDate": "2023-01-27T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-03T09:00:31-05:00",
                "endDate": "2023-02-03T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-10T09:00:31-05:00",
                "endDate": "2023-02-10T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-01-28T09:00:31-05:00",
                "endDate": "2023-01-28T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-04T09:00:31-05:00",
                "endDate": "2023-02-04T20:00:31-05:00",
                "isWorking": true
            },
            {
                "startDate": "2023-02-11T09:00:31-05:00",
                "endDate": "2023-02-11T20:00:31-05:00",
                "isWorking": true
            }
        ]
    },
    {
        "id": "e2a65a4f-31ac-4b5a-9cfc",
        "name": "Off Calendar",
        "unspecifiedTimeIsWorking": false,
        "intervals": [
            {
                "recurrentStartDate": "at 00:00",
                "recurrentEndDate": "at 23:59",
                "isWorking": false,
                "name": "Non working time"
            }
        ]
    },
    {
        "id": "80e7d596-5521-4ee7-a2dd",
        "name": "Off Calendar",
        "unspecifiedTimeIsWorking": false,
        "intervals": [
            {
                "recurrentStartDate": "at 00:00",
                "recurrentEndDate": "at 23:59",
                "isWorking": false,
                "name": "Non working time"
            }
        ]
    },
    {
        "id": "f06e8922-9506-4d7d-b292",
        "name": "Off Calendar",
        "unspecifiedTimeIsWorking": false,
        "intervals": [
            {
                "recurrentStartDate": "at 00:00",
                "recurrentEndDate": "at 23:59",
                "isWorking": false,
                "name": "Non working time"
            }
        ]
    },
    {
        "id": "beef267c-f31e-4f6c-910f",
        "name": "Off Calendar",
        "unspecifiedTimeIsWorking": false,
        "intervals": [
            {
                "recurrentStartDate": "at 00:00",
                "recurrentEndDate": "at 23:59",
                "isWorking": false,
                "name": "Non working time"
            }
        ]
    },
    {
        "id": "f3f7a6f5-9b9a-4fec-aba2",
        "name": "Off Calendar",
        "unspecifiedTimeIsWorking": false,
        "intervals": [
            {
                "recurrentStartDate": "at 00:00",
                "recurrentEndDate": "at 23:59",
                "isWorking": false,
                "name": "Non working time"
            }
        ]
    },
    {
        "id": "3f6a64dd-9b0d-4133-843b",
        "name": "Off Calendar",
        "unspecifiedTimeIsWorking": false,
        "intervals": [
            {
                "recurrentStartDate": "at 00:00",
                "recurrentEndDate": "at 23:59",
                "isWorking": false,
                "name": "Non working time"
            }
        ]
    },
    {
        "id": "51fbf8ee-fb4a-41c5-85d8",
        "name": "Off Calendar",
        "unspecifiedTimeIsWorking": false,
        "intervals": [
            {
                "recurrentStartDate": "at 00:00",
                "recurrentEndDate": "at 23:59",
                "isWorking": false,
                "name": "Non working time"
            }
        ]
    }
]

Post by peaguilar »

This is the data set for calendars we are creating the calendars when there are schedules available. If there are no schedules we create a calendar for the resource that defaults to a recurring schedule that will show no working time.


Post by marcio »

I see, I added your calendars data in our demo here https://bryntum.com/products/schedulerpro/examples/non-working-time/ and didn't have any issues (check the screenshot).

Which version are you using? Are you able to share a sample project with your configuration for us to check what is causing that popup to display?

Attachments
Screenshot 2023-01-31 at 14.55.07.png
Screenshot 2023-01-31 at 14.55.07.png (402.03 KiB) Viewed 155 times

Best regards,
Márcio


Post Reply