Class: AtomicAdmin::Schema::ApplicationInstanceGeneralSettingsSchema

Inherits:
ApplicationInstanceSchema show all
Defined in:
lib/atomic_admin/schema/application_instance_general_settings_schema.rb

Instance Attribute Summary

Attributes inherited from ApplicationInstanceSchema

#application_instance

Instance Method Summary collapse

Methods inherited from ApplicationInstanceSchema

#initialize

Constructor Details

This class inherits a constructor from AtomicAdmin::Schema::ApplicationInstanceSchema

Instance Method Details

#schemaObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/atomic_admin/schema/application_instance_general_settings_schema.rb', line 4

def schema
  sites = Site.all

  {
    type: "object",
    properties: {
      nickname: {
        type: "string",
        minLength: 1,
      },
      primary_contact: {
        type: ["string", "null"],
      },
      created_at: {
        type: "string",
        format: "date-time",
      },
      lti_key: {
        type: "string",
      },
      lti_secret: {
        type: "string",
      },
      #  The available sites is based on the sites that have been created
      #  so this would require it to be dynamically generated on the fly
      site_id: {
        type: "number",
        oneOf: sites.map do |site|
          {
            title: site.url,
            const: site.id
          }
        end
      },
      domain: {
        type: "string",
      },
      canvas_token: {
        type: ["string", "null"],
      },
      rollbar_enabled: {
        type: "boolean",
      },
      use_scoped_developer_key: {
        type: "boolean",
      },
    },
    required: ["nickname"],
  }
end

#uischemaObject



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/atomic_admin/schema/application_instance_general_settings_schema.rb', line 55

def uischema
  token_preview = @application_instance.canvas_token_preview() || "Not set"
  {
    type: "HorizontalLayout",
    elements: [
      {
        type: "Group",
        label: "General Settings",
        elements: [
          {
            type: "VerticalLayout",
            elements: [
              {
                type: "Control",
                scope: "#/properties/nickname",
              },
              {
                type: "Control",
                scope: "#/properties/primary_contact",
              },
              {
                type: "Control",
                scope: "#/properties/created_at",
                label: "Date Created",
                options: {
                  format: "date",
                  props: {
                    isReadOnly: true,
                    size: "small",
                  },
                },
              },
              {
                type: "Control",
                scope: "#/properties/site_id",
                label: "LMS URL",
                options: {
                  props: {
                    menuSize: "auto",
                  }
                }
              },
              {
                type: "Control",
                scope: "#/properties/domain",
                label: "LTI Tool Domain",
              },
              {
                type: "Control",
                scope: "#/properties/canvas_token",
                label: "Canvas Token",
                options: {
                  props: {
                    message: "Current Canvas Token: #{token_preview}",
                  },
                },
              },
              {
                type: "Control",
                scope: "#/properties/rollbar_enabled",
                label: "Enable Rollbar",
              },
              {
                type: "Control",
                scope: "#/properties/use_scoped_developer_key",
                label: "Use Scoped Developer Key",
              },
            ],
          },
        ],
      },
      {
        type: "Group",
        label: "LTI Key and Secret",
        elements: [
          {
            type: "VerticalLayout",
            elements: [
              {
                type: "Control",
                scope: "#/properties/lti_key",
                label: "LTI Key",
                options: {
                  props: {
                    isReadOnly: true,
                  },
                },
              },
              {
                type: "Control",
                scope: "#/properties/lti_secret",
                label: "LTI Secret",
              },
            ],
          },
        ],
      },
    ],
  }
end