1use crate::descriptor::{Action, Field, Form, Kind, TEXT, field};
4use crate::template::SOURCE;
5
6const ENABLED: Field = field(
7 "enabled",
8 "State",
9 Kind::Choice {
10 options: &[("true", "Enabled"), ("false", "Disabled")],
11 default: Some("true"),
12 },
13 false,
14);
15
16pub const SCRIPT_CREATE: Form = Form {
18 name: "script-create",
19 title: "Create script",
20 fields: &[
21 field("name", "Name", TEXT, false),
22 field("source", "Source", SOURCE, true),
23 ENABLED,
24 ],
25 action: Action::Mutation,
26};
27
28pub const SCRIPT_EDIT: Form = Form {
31 name: "script-edit",
32 title: "Edit script",
33 fields: &[
34 field("id", "Id", Kind::Hidden, true),
35 field("revision", "Revision", Kind::Hidden, true),
36 field("name", "Name", TEXT, false),
37 field("source", "Source", SOURCE, true),
38 ENABLED,
39 ],
40 action: Action::LoadMutation,
41};