Manager: add optional description to job types

This description will be shown as a tooltip in the job submission UI.
This commit is contained in:
Taylor Wiebe 2024-04-04 11:10:22 +02:00 committed by Sybren A. Stüvel
parent 2bbb7b48d2
commit a0cb8735c9
4 changed files with 30 additions and 1 deletions

@ -116,7 +116,8 @@ def _store_available_job_types(available_job_types: _AvailableJobTypes) -> None:
else:
# Convert from API response type to list suitable for an EnumProperty.
_job_type_enum_items = [
(job_type.name, job_type.label, "") for job_type in job_types
(job_type.name, job_type.label, getattr(job_type, "description", ""))
for job_type in job_types
]
_job_type_enum_items.insert(0, _JOB_TYPE_NOT_SELECTED_ENUM_ITEM)

@ -442,6 +442,32 @@ func TestGetJobTypeHappy(t *testing.T) {
assertResponseJSON(t, echoCtx, http.StatusOK, jt)
}
func TestGetJobTypeWithDescriptionHappy(t *testing.T) {
mockCtrl := gomock.NewController(t)
defer mockCtrl.Finish()
mf := newMockedFlamenco(mockCtrl)
// Get an existing job type with a description.
description := "This is a test job type"
jt := api.AvailableJobType{
Description: &description,
Etag: "some etag",
Name: "test-job-type",
Label: "Test Job Type",
Settings: []api.AvailableJobSetting{
{Key: "setting", Type: api.AvailableJobSettingTypeString},
},
}
mf.jobCompiler.EXPECT().GetJobType("test-job-type").
Return(jt, nil)
echoCtx := mf.prepareMockedRequest(nil)
err := mf.flamenco.GetJobType(echoCtx, "test-job-type")
require.NoError(t, err)
assertResponseJSON(t, echoCtx, http.StatusOK, jt)
}
func TestGetJobTypeUnknown(t *testing.T) {
mockCtrl := gomock.NewController(t)
defer mockCtrl.Finish()

@ -2,6 +2,7 @@
const JOB_TYPE = {
label: "Simple Blender Render",
description: "Render a sequence of frames, and create a preview video file",
settings: [
// Settings for artists to determine:
{ key: "frames", type: "string", required: true, eval: "f'{C.scene.frame_start}-{C.scene.frame_end}'",

@ -2,6 +2,7 @@
const JOB_TYPE = {
label: "Simple Blender Render",
description: "Render a sequence of frames, and create a preview video file",
settings: [
// Settings for artists to determine:
{ key: "frames", type: "string", required: true,