Publishing Actions
Publishing actions encompasses all TaskBar action that interact with server-side APIs, they are synchronous and block the user interface until completion.
The are specified in an array, and each publishing action has the following elements:
- IconURL is the URL of the Icon of the action, it can be an SVG or a 64x64 (or larger) image.
- Caption is the textual caption for the action.
- Hint is an optional textual hint for the publishing action.
- PublishURL is the endpoint be invoked by the action.
- PublishData specifies the data to send for the POST, accepted options are "selection" and "model" (see below)
- Action indicates how the publishing action is handled
The API should return a JSON with the action to be undertaken by the scheduler (see below).
A publishing "action" with no icon and no caption can be used to introduce a splitter in the TaskBar.
Valid action types are:
- post (default) will POST the PublishData to the PublishURL
- window will open the PublishURL in a new Window, and passes the PublishData in the query string (the model option is not supported)
PublishData = selection
This sends the current selection, as the selected Resource ID (null if none selected) and an array of selected Task IDs (empty if none selected):
"Resource": "R1-1",
"Tasks": ["OF1-T1", "OF3-T4"]
}
or ?Resource=R1-1&Tasks=OF1-T1,OF3-T4.
PublishData = model
This sends a JSON object with two field:
- Selection contains the current selection (same as PublishData = selection)
- Model contains the whole schedule model in the standard Data Format
API Action Result
The JSON object returned by the API should have an Action field, and the following actions are supported:
- notify will display a notification message specified in a Message textual string
"Action": "notify",
"Message": "Schedule successfully published!"
}
- refresh asks for the schedule data to be reloaded from the Model field, while attempting to preserve current interactive aspects when possible (zoom, scrolls and selection)
"Action": "refresh",
"Model": ...new scheduler model data...
}
Example
{
"IconURL": "/icons/myicon.png",
"Caption": "My Action",
"PublishURL": "//api.server.com/MyAPI/Action/DoIt",
"PublishData": "selection"
},{
"IconURL": "/icons/othericon.png",
"Caption": "Other Action",
"PublishURL": "//api.server.com/MyOtherAPI/OtherAction",
"PublishData": "data"
},{
"IconURL": "/icons/open.png",
"Caption": "NewTab",
"PublishURL": "http://snr-dev/WebProcess.citdev/PLANNING.Display/newtab",
"PublishData": "selection",
"Action": "window"
}
]