@ynput/ayon-addon-planner 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +105 -0
- package/README.md +134 -2
- package/components.d.ts +9 -0
- package/components.js +14 -0
- package/examples/BookingEventFormHeaderItem.js +17 -0
- package/examples/TimelineEventBadge.js +23 -0
- package/examples/TimelineEventEndItem.js +22 -0
- package/examples/shared.js +14 -0
- package/index.d.ts +273 -0
- package/index.js +74 -0
- package/package.json +79 -4
- package/previews.d.ts +65 -0
- package/previews.js +11688 -0
- package/slots.d.ts +4 -0
- package/slots.js +78 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-ALv2
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2025 Ynput s.r.o.
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,135 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ynput/ayon-addon-planner
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
What an AYON addon needs to contribute to the planner's slots: the slots' types, their declarations as
|
|
4
|
+
data, one helper per slot, and the planner's header button for the booking form's header items.
|
|
5
|
+
Apart from that button and the dev shell's previews (below) it holds no planner code.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { defineAddon } from "@ynput/ayon-addon/manifest";
|
|
9
|
+
import { plannerBookingEventMenuItem, plannerTaskEventMenuItem } from "@ynput/ayon-addon-planner";
|
|
10
|
+
|
|
11
|
+
export default defineAddon({
|
|
12
|
+
contributes: [
|
|
13
|
+
plannerTaskEventMenuItem({
|
|
14
|
+
id: "start_timer",
|
|
15
|
+
label: "Start timer",
|
|
16
|
+
icon: "play_arrow",
|
|
17
|
+
run: () => import("./menu/startTimer"),
|
|
18
|
+
}),
|
|
19
|
+
plannerBookingEventMenuItem({
|
|
20
|
+
id: "start_timer",
|
|
21
|
+
label: "Start timer",
|
|
22
|
+
icon: "play_arrow",
|
|
23
|
+
eventTypes: ["allocation"], // all event types when not set
|
|
24
|
+
run: () => import("./menu/startTimerOnBooking"),
|
|
25
|
+
}),
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
| Slot | Where | Context |
|
|
31
|
+
| --- | --- | --- |
|
|
32
|
+
| `planner.taskEventMenuItem` | the right-click menu of a task event on the Schedule page | `projectName`; `entities`: the selected events' tasks, the right-clicked event's first; `events`: the selected task events (`TaskEventRef`), the right-clicked one first |
|
|
33
|
+
| `planner.bookingEventMenuItem` | the right-click menu of a booking event on the Plan page. `eventTypes` narrows it to `capacity`, `allocation`, `absence` or `milestone`: it shows when every selected event is one of them | `events`: the selected booking events (`BookingEventRef`), the right-clicked one first |
|
|
34
|
+
| `planner.bookingEventFormHeaderItem` | the header of the booking event form on the Plan page (popover and docked), left of its own buttons. `component` draws a small control | `events`: the events the form edits (`BookingEventRef`) |
|
|
35
|
+
| `planner.timelineEventBadge` | before the title of every event bar on the Plan (booking events) and Schedule (task events) timelines. `component` draws a small badge; keep it light and return null for most events | `event`: a `BookingEventRef` on the Plan page, a `TaskEventRef` (`eventType: "task"`) on the Schedule page; `task`: the task of a task event |
|
|
36
|
+
| `planner.timelineEventEndItem` | at the end of every event bar on the Plan and Schedule timelines, after its people. `component` draws a small item (an icon or a dot); keep it light and return null for most events | the same as `planner.timelineEventBadge` |
|
|
37
|
+
|
|
38
|
+
A `planner.bookingEventFormHeaderItem` component draws its button with
|
|
39
|
+
`BookingEventFormHeaderButton` from `@ynput/ayon-addon-planner/components`, the button the planner
|
|
40
|
+
draws its own header buttons with (AYON's `Button` and its props, without a background until hovered
|
|
41
|
+
or pressed), so it looks and behaves like them:
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import type { SlotProps } from "@ynput/ayon-addon";
|
|
45
|
+
import { BookingEventFormHeaderButton } from "@ynput/ayon-addon-planner/components";
|
|
46
|
+
|
|
47
|
+
const TimerButton = ({ events }: SlotProps<"planner.bookingEventFormHeaderItem">) => (
|
|
48
|
+
<BookingEventFormHeaderButton icon="play_circle" data-tooltip="Start timer" onClick={() => {}} />
|
|
49
|
+
);
|
|
50
|
+
export default TimerButton;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Import `/components` only from a contribution's components, never from the manifest: it needs
|
|
54
|
+
React, styled-components and `@ynput/ayon-react-components` (all shared by AYON), where `index.js`
|
|
55
|
+
and `slots.js` have no dependencies.
|
|
56
|
+
|
|
57
|
+
A `BookingEventRef` has `id`, `eventType`, `label`, `projectName` (`null` for a studio-level
|
|
58
|
+
event), `startTime` and `endTime` (ISO 8601), `netDuration` (seconds, when not the whole span),
|
|
59
|
+
`status` (a booking status name), `attrib` (the booking attributes the user may see) and
|
|
60
|
+
`resources`: what it books, each with `id`, `label`, `resourceType` (`person` for a person),
|
|
61
|
+
`isPool`, `unitCount` and, for a person, the AYON `userName`.
|
|
62
|
+
|
|
63
|
+
A `TaskEventRef` has `id` (the event's, not the task's), `eventType: "task"`, `label` (as the bar
|
|
64
|
+
shows it), `projectName`, `taskId`, `startTime`, `endTime`, `people` (AYON user names) and `tags`.
|
|
65
|
+
|
|
66
|
+
Fields after `projectName` are left out when the event has no value for them, so check before
|
|
67
|
+
using one. `toBookingEventRef`, `toTaskEventRef` and `toTaskRef` build these refs the way the
|
|
68
|
+
planner does, for tests.
|
|
69
|
+
|
|
70
|
+
Without the planner in the bundle, or with a planner older than the slot, AYON skips the contribution
|
|
71
|
+
with a console warning and the rest of your addon works. How addons declare and contribute to slots:
|
|
72
|
+
"Slots of other addons" in `@ynput/ayon-addon/AGENTS.md`.
|
|
73
|
+
|
|
74
|
+
Additive context fields are a minor release of this package. A breaking change is a new slot version: contributions built for the old one are skipped until they update to this package's new helper.
|
|
75
|
+
|
|
76
|
+
## Examples
|
|
77
|
+
|
|
78
|
+
Each slot in `slots.js` has an `example`: what AYON's developer mode shows in it with **Show slots**
|
|
79
|
+
on, after the real contributions and owned by the planner (in Highlight contributions' colours and
|
|
80
|
+
legend too). The menu items' examples are an entry with a label and an icon; the form header item's
|
|
81
|
+
is an icon button like the form's own, the badge's a small icon and the end item's a dot, drawn by
|
|
82
|
+
`examples/` and loaded only when shown. Using one changes nothing: it only says "Example
|
|
83
|
+
contribution to `<slot>`". `ayon-addon slots` prints them as manifest entries.
|
|
84
|
+
|
|
85
|
+
## Previews
|
|
86
|
+
|
|
87
|
+
`@ynput/ayon-addon-planner/previews` (`ayonAddon.previews` in `package.json`) lets the AYON dev shell
|
|
88
|
+
show your contributions without the planner. It has two scenes, drawn by the planner's own
|
|
89
|
+
components, that render its slots through the planner's own code, with a context you edit in the
|
|
90
|
+
shell's form:
|
|
91
|
+
|
|
92
|
+
- **Booking event (Plan)** (`bookingEvent`): a booking event bar on the Plan timeline, with the
|
|
93
|
+
`planner.timelineEventBadge` contributions before its title and the
|
|
94
|
+
`planner.timelineEventEndItem` contributions at its end. Right-click opens the planner's menu
|
|
95
|
+
with the `planner.bookingEventMenuItem` contributions. Double-click, or "Open form", opens the
|
|
96
|
+
booking form with the `planner.bookingEventFormHeaderItem` contributions in its header. Fields:
|
|
97
|
+
event type, title, project (or none, for a studio-level event), resources and attributes (JSON),
|
|
98
|
+
start, end, net hours, status (the planner's default booking statuses, or none), the event id,
|
|
99
|
+
and a number of events for a selection (copies with their own ids).
|
|
100
|
+
- **Task event (Schedule)** (`taskEvent`): a task event bar on the Schedule timeline with its badge
|
|
101
|
+
and end item contributions, and the planner's right-click menu with the
|
|
102
|
+
`planner.taskEventMenuItem` contributions. Fields: project, task (a real task from the server),
|
|
103
|
+
title, start, end, people, tags, colour and the event id.
|
|
104
|
+
|
|
105
|
+
An action on an event usually needs it to exist on the server (the time tracker checks the booking
|
|
106
|
+
event before starting a timer on it). Pick **Real booking event** to load one of the planner's
|
|
107
|
+
booking events from two weeks around today (`POST /api/addons/planner/<version>/booking/events/find`,
|
|
108
|
+
with its resources' names, types and users from `booking/resources/find`): it fills in the other
|
|
109
|
+
fields. The task field lists the project's real tasks. The planner menu items that need the
|
|
110
|
+
planner's data (paste, move, delete) do nothing in the scenes, and saving the form only updates the
|
|
111
|
+
scene's fields.
|
|
112
|
+
|
|
113
|
+
`previews.js` ships the planner's compiled UI components: the same code every AYON server with the
|
|
114
|
+
planner serves to browsers, without its server or business logic. Its data hooks are stand-ins
|
|
115
|
+
that return the scene's context and the planner's default settings. It is built from
|
|
116
|
+
`frontend/src/contractPreviews` by `yarn build:contract` (`vite.contract.config.ts`), with its CSS
|
|
117
|
+
inlined in styled-components and scoped to the scene. React, react-dom, styled-components,
|
|
118
|
+
`@ynput/ayon-react-components`, `@ynput/ayon-frontend-shared` and `@ynput/ayon-addon` stay external:
|
|
119
|
+
optional peer dependencies the dev shell provides. Only the dev shell loads it, never your addon's
|
|
120
|
+
bundle.
|
|
121
|
+
|
|
122
|
+
## Releasing
|
|
123
|
+
|
|
124
|
+
The package lives in the planner's repo and is published by hand:
|
|
125
|
+
|
|
126
|
+
1. Bump `version` in `frontend/contract/package.json`: a minor release for new slots or context fields,
|
|
127
|
+
a patch release for fixes to types, docs or previews.
|
|
128
|
+
2. Run `yarn build:contract` in `frontend` and commit `contract/previews.js` (`npm pack` and
|
|
129
|
+
`npm publish` also rebuild it, in `prepack`).
|
|
130
|
+
3. Check the contents with `npm pack --dry-run` in `frontend/contract`.
|
|
131
|
+
4. Run `npm publish` in `frontend/contract`. It needs an npm account with publish rights on the
|
|
132
|
+
`@ynput` scope.
|
|
133
|
+
|
|
134
|
+
The planner's own frontend uses this folder directly (`link:./contract`). Contributing addons pin the
|
|
135
|
+
published version, so publish before releasing an addon that relies on a new slot.
|
package/components.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Button } from "@ynput/ayon-react-components";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A button in the header of the booking event form, as the planner draws its own (Dock / Popover,
|
|
5
|
+
* Close): `@ynput/ayon-react-components`' `Button` with its props, with no background until hovered
|
|
6
|
+
* or pressed. Use it in a `planner.bookingEventFormHeaderItem` component, usually icon only:
|
|
7
|
+
* `<BookingEventFormHeaderButton icon="play_circle" data-tooltip="Start timer" onClick={start} />`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const BookingEventFormHeaderButton: typeof Button;
|
package/components.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// The planner's own UI pieces that contributions use to look like the planner. Unlike index.js this
|
|
2
|
+
// module imports React packages, so import it from a contribution's components, never from the
|
|
3
|
+
// manifest. The planner draws its own buttons with these, so a contribution looks the same.
|
|
4
|
+
import { Button } from "@ynput/ayon-react-components";
|
|
5
|
+
import styled from "styled-components";
|
|
6
|
+
|
|
7
|
+
// The icon buttons in the header of the booking event form (Dock / Popover, Close): AYON's
|
|
8
|
+
// Button with no background until hovered or pressed.
|
|
9
|
+
export const BookingEventFormHeaderButton = styled(Button)`
|
|
10
|
+
&,
|
|
11
|
+
&:disabled {
|
|
12
|
+
background-color: transparent;
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// The example of planner.bookingEventFormHeaderItem: an icon button drawn with the form's own header
|
|
2
|
+
// button (Dock, Close). A click only says what it is.
|
|
3
|
+
import { createElement } from "react";
|
|
4
|
+
import { BookingEventFormHeaderButton } from "../components.js";
|
|
5
|
+
import { announce } from "./shared.js";
|
|
6
|
+
|
|
7
|
+
const SLOT = "planner.bookingEventFormHeaderItem";
|
|
8
|
+
|
|
9
|
+
const BookingEventFormHeaderItem = ({ events }) =>
|
|
10
|
+
createElement(BookingEventFormHeaderButton, {
|
|
11
|
+
icon: "extension",
|
|
12
|
+
"data-tooltip": `Example contribution to ${SLOT}\nevents: ${events.length}`,
|
|
13
|
+
"aria-label": `Example contribution to ${SLOT}`,
|
|
14
|
+
onClick: () => announce(SLOT),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export default BookingEventFormHeaderItem;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// The example of planner.timelineEventBadge: a small rounded square before the event's title, as a
|
|
2
|
+
// badge is.
|
|
3
|
+
import { createElement } from "react";
|
|
4
|
+
import { describe } from "./shared.js";
|
|
5
|
+
|
|
6
|
+
const SLOT = "planner.timelineEventBadge";
|
|
7
|
+
|
|
8
|
+
const TimelineEventBadge = ({ event }) =>
|
|
9
|
+
createElement("span", {
|
|
10
|
+
role: "img",
|
|
11
|
+
"data-tooltip": describe(SLOT, event),
|
|
12
|
+
"aria-label": `Example contribution to ${SLOT}`,
|
|
13
|
+
style: {
|
|
14
|
+
flexShrink: 0,
|
|
15
|
+
alignSelf: "center",
|
|
16
|
+
width: 10,
|
|
17
|
+
height: 10,
|
|
18
|
+
borderRadius: 3,
|
|
19
|
+
backgroundColor: "var(--md-sys-color-tertiary)",
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export default TimelineEventBadge;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// The example of planner.timelineEventEndItem: a small dot at the end of the event bar.
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { describe } from "./shared.js";
|
|
4
|
+
|
|
5
|
+
const SLOT = "planner.timelineEventEndItem";
|
|
6
|
+
|
|
7
|
+
const TimelineEventEndItem = ({ event }) =>
|
|
8
|
+
createElement("span", {
|
|
9
|
+
role: "img",
|
|
10
|
+
"data-tooltip": describe(SLOT, event),
|
|
11
|
+
"aria-label": `Example contribution to ${SLOT}`,
|
|
12
|
+
style: {
|
|
13
|
+
flexShrink: 0,
|
|
14
|
+
alignSelf: "center",
|
|
15
|
+
width: 8,
|
|
16
|
+
height: 8,
|
|
17
|
+
borderRadius: "50%",
|
|
18
|
+
backgroundColor: "var(--md-sys-color-tertiary)",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export default TimelineEventEndItem;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// What the planner's example contributions share: they are what AYON's developer mode shows in the
|
|
2
|
+
// planner's slots with Show slots on (`example` in slots.js), drawn in each slot's real shape.
|
|
3
|
+
// Plain JS without JSX: the contract package has no build step for them.
|
|
4
|
+
import { toast } from "@ynput/ayon-addon";
|
|
5
|
+
|
|
6
|
+
/** Using an example changes nothing: it only says what it is, as AYON's own examples do. */
|
|
7
|
+
export const announce = (slot) =>
|
|
8
|
+
toast.info(`Example contribution to ${slot}`, { toastId: `ayon-example:${slot}` });
|
|
9
|
+
|
|
10
|
+
/** The tooltip of a small example: the slot and the event it was drawn for. */
|
|
11
|
+
export const describe = (slot, event) =>
|
|
12
|
+
[`Example contribution to ${slot}`, event?.label && `event: ${event.label}`, event?.eventType && `type: ${event.eventType}`]
|
|
13
|
+
.filter(Boolean)
|
|
14
|
+
.join("\n");
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import type {
|
|
3
|
+
ContributionFields,
|
|
4
|
+
ContributionInput,
|
|
5
|
+
EntityRef,
|
|
6
|
+
Loader,
|
|
7
|
+
MenuItemMeta,
|
|
8
|
+
RunPiece,
|
|
9
|
+
SlotProps,
|
|
10
|
+
} from "@ynput/ayon-addon";
|
|
11
|
+
|
|
12
|
+
export { slots } from "./slots.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A task event on the Schedule page: a span of time planned for a task, not the task itself (that
|
|
16
|
+
* is the `EntityRef` next to it). The fields after `projectName` are left out when the event has
|
|
17
|
+
* no value for them, and by a planner older than these fields.
|
|
18
|
+
*/
|
|
19
|
+
export interface TaskEventRef {
|
|
20
|
+
/** the task event's id (a uuid), not the task's */
|
|
21
|
+
id: string;
|
|
22
|
+
eventType: "task";
|
|
23
|
+
/** what the bar shows: the folder and the task, e.g. "sh010 - Compositing" */
|
|
24
|
+
label?: string;
|
|
25
|
+
projectName: string;
|
|
26
|
+
/** the id of the event's task */
|
|
27
|
+
taskId?: string;
|
|
28
|
+
/** when the event starts, ISO 8601 */
|
|
29
|
+
startTime?: string;
|
|
30
|
+
/** when the event ends, ISO 8601 */
|
|
31
|
+
endTime?: string;
|
|
32
|
+
/** the AYON users (user names) the event is planned for, as the bar shows them */
|
|
33
|
+
people?: string[];
|
|
34
|
+
/** the event's tag names, from the project's anatomy */
|
|
35
|
+
tags?: string[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** What a `planner.taskEventMenuItem` contribution's `run` gets, besides `slot` and `user`. */
|
|
39
|
+
export interface PlannerTaskEventMenuItemContext {
|
|
40
|
+
projectName: string;
|
|
41
|
+
/** the tasks of the selected events, the right-clicked event's first */
|
|
42
|
+
entities: EntityRef[];
|
|
43
|
+
/**
|
|
44
|
+
* the selected events, the right-clicked one first. One per event, so a task with several
|
|
45
|
+
* selected events is here more than once (and once in `entities`)
|
|
46
|
+
*/
|
|
47
|
+
events?: TaskEventRef[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type BookingEventType = "capacity" | "allocation" | "absence" | "milestone";
|
|
51
|
+
|
|
52
|
+
/** A resource a booking event books: a person, or anything else the studio plans (a seat, a room). */
|
|
53
|
+
export interface BookingEventResource {
|
|
54
|
+
/** the planner resource's id */
|
|
55
|
+
id: string;
|
|
56
|
+
/** its name in the planner */
|
|
57
|
+
label: string;
|
|
58
|
+
/** its resource type, one the studio configures in the planner: `person` for a person */
|
|
59
|
+
resourceType?: string;
|
|
60
|
+
/** a pool: several interchangeable units (e.g. five render licences) */
|
|
61
|
+
isPool?: boolean;
|
|
62
|
+
/** how many units the event books, 1 when not set */
|
|
63
|
+
unitCount?: number;
|
|
64
|
+
/** the AYON user a person resource stands for */
|
|
65
|
+
userName?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* A booking event: not an entity, and at studio level, so it may have no project. The fields after
|
|
70
|
+
* `projectName` are left out when the event has no value for them, and by a planner older than
|
|
71
|
+
* these fields.
|
|
72
|
+
*/
|
|
73
|
+
export interface BookingEventRef {
|
|
74
|
+
id: string;
|
|
75
|
+
eventType: BookingEventType;
|
|
76
|
+
label?: string;
|
|
77
|
+
projectName: string | null;
|
|
78
|
+
/** when the event starts, ISO 8601 */
|
|
79
|
+
startTime?: string;
|
|
80
|
+
/** when the event ends, ISO 8601 */
|
|
81
|
+
endTime?: string;
|
|
82
|
+
/** the hours it books, in seconds, when not the whole span (e.g. 8h a day over a week) */
|
|
83
|
+
netDuration?: number;
|
|
84
|
+
/** the name of its booking status, one the studio configures in the planner */
|
|
85
|
+
status?: string;
|
|
86
|
+
/** its booking attributes (those the studio configures in the planner) that the user may see */
|
|
87
|
+
attrib?: Record<string, unknown>;
|
|
88
|
+
/** what it books: people and other resources */
|
|
89
|
+
resources?: BookingEventResource[];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** What a `planner.bookingEventMenuItem` contribution's `run` gets, besides `slot` and `user`. */
|
|
93
|
+
export interface PlannerBookingEventMenuItemContext {
|
|
94
|
+
/** the selected events, the right-clicked one first */
|
|
95
|
+
events: BookingEventRef[];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** What a `planner.bookingEventFormHeaderItem` contribution's `component` gets, besides `slot` and `user`. */
|
|
99
|
+
export interface PlannerBookingEventFormHeaderItemContext {
|
|
100
|
+
/** the events the form edits: one, or several when a selection is edited together */
|
|
101
|
+
events: BookingEventRef[];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** What a `planner.timelineEventBadge` contribution's `component` gets, besides `slot` and `user`. */
|
|
105
|
+
export interface PlannerTimelineEventBadgeContext {
|
|
106
|
+
/**
|
|
107
|
+
* The event the bar shows: a booking event on the Plan page (its `eventType`), a task event on
|
|
108
|
+
* the Schedule page (`eventType: "task"`, always in a project).
|
|
109
|
+
*/
|
|
110
|
+
event: BookingEventRef | TaskEventRef;
|
|
111
|
+
/** the task of a task event; not set for booking events */
|
|
112
|
+
task?: EntityRef;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* What a `planner.timelineEventEndItem` contribution's `component` gets, besides `slot` and `user`:
|
|
117
|
+
* the same as a badge's.
|
|
118
|
+
*/
|
|
119
|
+
export type PlannerTimelineEventEndItemContext = PlannerTimelineEventBadgeContext;
|
|
120
|
+
|
|
121
|
+
declare module "@ynput/ayon-addon" {
|
|
122
|
+
interface SlotMap {
|
|
123
|
+
/**
|
|
124
|
+
* An item in the right-click menu of a task event on the Schedule page. It shows from the
|
|
125
|
+
* description; `run` loads when the menu opens and is called on click.
|
|
126
|
+
*/
|
|
127
|
+
"planner.taskEventMenuItem": {
|
|
128
|
+
version: 1;
|
|
129
|
+
meta: MenuItemMeta;
|
|
130
|
+
context: PlannerTaskEventMenuItemContext;
|
|
131
|
+
pieces: { run: Loader<RunPiece<"planner.taskEventMenuItem">> };
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* An item in the right-click menu of a booking event on the Plan page. It shows from the
|
|
135
|
+
* description; `run` loads when the menu opens and is called on click.
|
|
136
|
+
*/
|
|
137
|
+
"planner.bookingEventMenuItem": {
|
|
138
|
+
version: 1;
|
|
139
|
+
meta: MenuItemMeta & {
|
|
140
|
+
/** event types it acts on: shown only when every selected event is one of them. All when not set */
|
|
141
|
+
eventTypes?: BookingEventType[];
|
|
142
|
+
};
|
|
143
|
+
context: PlannerBookingEventMenuItemContext;
|
|
144
|
+
pieces: { run: Loader<RunPiece<"planner.bookingEventMenuItem">> };
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* A small control (an icon button) in the header of the booking event form on the Plan page,
|
|
148
|
+
* left of the form's own buttons. `component` loads when the form opens and draws it; return
|
|
149
|
+
* null for events it has nothing for. Draw the button with `BookingEventFormHeaderButton`
|
|
150
|
+
* from `@ynput/ayon-addon-planner/components` to look like the form's own buttons.
|
|
151
|
+
*/
|
|
152
|
+
"planner.bookingEventFormHeaderItem": {
|
|
153
|
+
version: 1;
|
|
154
|
+
meta: {
|
|
155
|
+
/** unique among this addon's contributions to this slot */
|
|
156
|
+
id: string;
|
|
157
|
+
/** what it is, for the slot listings */
|
|
158
|
+
label: string;
|
|
159
|
+
};
|
|
160
|
+
context: PlannerBookingEventFormHeaderItemContext;
|
|
161
|
+
pieces: { component: Loader<ComponentType<SlotProps<"planner.bookingEventFormHeaderItem">>> };
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* A small badge (an icon or a dot) before the title of an event bar on the Plan (booking
|
|
165
|
+
* events) and Schedule (task events) timelines. `component` renders for every visible bar:
|
|
166
|
+
* keep it light, and return null for the events it has nothing for.
|
|
167
|
+
*/
|
|
168
|
+
"planner.timelineEventBadge": {
|
|
169
|
+
version: 1;
|
|
170
|
+
meta: {
|
|
171
|
+
/** unique among this addon's contributions to this slot */
|
|
172
|
+
id: string;
|
|
173
|
+
/** what it is, for the slot listings */
|
|
174
|
+
label: string;
|
|
175
|
+
};
|
|
176
|
+
context: PlannerTimelineEventBadgeContext;
|
|
177
|
+
pieces: { component: Loader<ComponentType<SlotProps<"planner.timelineEventBadge">>> };
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* A small item (an icon or a dot) at the end of an event bar on the Plan (booking events) and
|
|
181
|
+
* Schedule (task events) timelines, after its people. `component` renders for every visible
|
|
182
|
+
* bar: keep it light, and return null for the events it has nothing for.
|
|
183
|
+
*/
|
|
184
|
+
"planner.timelineEventEndItem": {
|
|
185
|
+
version: 1;
|
|
186
|
+
meta: {
|
|
187
|
+
/** unique among this addon's contributions to this slot */
|
|
188
|
+
id: string;
|
|
189
|
+
/** what it is, for the slot listings */
|
|
190
|
+
label: string;
|
|
191
|
+
};
|
|
192
|
+
context: PlannerTimelineEventEndItemContext;
|
|
193
|
+
pieces: { component: Loader<ComponentType<SlotProps<"planner.timelineEventEndItem">>> };
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** A contribution to `planner.taskEventMenuItem`, for an addon's manifest. Stamps the slot version. */
|
|
199
|
+
export declare const plannerTaskEventMenuItem: (
|
|
200
|
+
item: ContributionFields<"planner.taskEventMenuItem">,
|
|
201
|
+
) => ContributionInput<"planner.taskEventMenuItem">;
|
|
202
|
+
|
|
203
|
+
/** A contribution to `planner.bookingEventMenuItem`, for an addon's manifest. Stamps the slot version. */
|
|
204
|
+
export declare const plannerBookingEventMenuItem: (
|
|
205
|
+
item: ContributionFields<"planner.bookingEventMenuItem">,
|
|
206
|
+
) => ContributionInput<"planner.bookingEventMenuItem">;
|
|
207
|
+
|
|
208
|
+
/** A contribution to `planner.bookingEventFormHeaderItem`, for an addon's manifest. Stamps the slot version. */
|
|
209
|
+
export declare const plannerBookingEventFormHeaderItem: (
|
|
210
|
+
item: ContributionFields<"planner.bookingEventFormHeaderItem">,
|
|
211
|
+
) => ContributionInput<"planner.bookingEventFormHeaderItem">;
|
|
212
|
+
|
|
213
|
+
/** A contribution to `planner.timelineEventBadge`, for an addon's manifest. Stamps the slot version. */
|
|
214
|
+
export declare const plannerTimelineEventBadge: (
|
|
215
|
+
item: ContributionFields<"planner.timelineEventBadge">,
|
|
216
|
+
) => ContributionInput<"planner.timelineEventBadge">;
|
|
217
|
+
|
|
218
|
+
/** A contribution to `planner.timelineEventEndItem`, for an addon's manifest. Stamps the slot version. */
|
|
219
|
+
export declare const plannerTimelineEventEndItem: (
|
|
220
|
+
item: ContributionFields<"planner.timelineEventEndItem">,
|
|
221
|
+
) => ContributionInput<"planner.timelineEventEndItem">;
|
|
222
|
+
|
|
223
|
+
/** What the planner builds a booking event's ref from: its own event, or a stand-in of one. */
|
|
224
|
+
export interface BookingEventInput {
|
|
225
|
+
id: string;
|
|
226
|
+
eventType: BookingEventType;
|
|
227
|
+
label?: string;
|
|
228
|
+
projectName?: string | null;
|
|
229
|
+
startTime?: string;
|
|
230
|
+
endTime?: string;
|
|
231
|
+
netDuration?: number | null;
|
|
232
|
+
status?: string;
|
|
233
|
+
attrib?: Record<string, unknown>;
|
|
234
|
+
resources?: {
|
|
235
|
+
id: string;
|
|
236
|
+
label?: string;
|
|
237
|
+
resourceType?: string;
|
|
238
|
+
isPool?: boolean;
|
|
239
|
+
unitCount?: number;
|
|
240
|
+
userName?: string;
|
|
241
|
+
}[];
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** What the planner builds a task event's ref from. */
|
|
245
|
+
export interface TaskEventInput {
|
|
246
|
+
id: string;
|
|
247
|
+
label?: string;
|
|
248
|
+
startTime?: string;
|
|
249
|
+
endTime?: string;
|
|
250
|
+
people?: string[];
|
|
251
|
+
tags?: string[];
|
|
252
|
+
task?: { id: string } | null;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* A booking event as the planner's slots pass it: only the fields of `BookingEventRef`, the unset
|
|
257
|
+
* ones left out. The planner builds its contexts with it; use it for test contexts.
|
|
258
|
+
*/
|
|
259
|
+
export declare const toBookingEventRef: (event: BookingEventInput) => BookingEventRef;
|
|
260
|
+
|
|
261
|
+
/** A resource as `BookingEventRef.resources` has it. */
|
|
262
|
+
export declare const toBookingEventResource: (
|
|
263
|
+
resource: NonNullable<BookingEventInput["resources"]>[number],
|
|
264
|
+
) => BookingEventResource;
|
|
265
|
+
|
|
266
|
+
/** A task event as the planner's slots pass it, in its project. */
|
|
267
|
+
export declare const toTaskEventRef: (event: TaskEventInput, projectName: string) => TaskEventRef;
|
|
268
|
+
|
|
269
|
+
/** A task as the planner's slots pass it (`entities`, `task`), in its project. */
|
|
270
|
+
export declare const toTaskRef: (
|
|
271
|
+
task: { id: string; name?: string; label?: string | null },
|
|
272
|
+
projectName: string,
|
|
273
|
+
) => EntityRef;
|