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
155
156
157
158
159
160
161
|
# File 'app/models/panda_pal/organization_concerns/task_scheduling.rb', line 118
def self.build_settings_entry(desc)
k = desc[:key]
kl = ' ' * (k.to_s.length - 4)
default_schedule = '<Computed>'
default_schedule = desc[:schedule] if desc[:schedule].is_a?(String)
default_schedule = '<Disabled>' unless desc[:schedule].present?
{
required: false,
description: " Override schedule for '\#{k.to_s}' task.\n\n **Default**: \#{default_schedule}\n\n Set to `false` to disable or supply a Cron string:\n ```yaml\n \#{k.to_s}: 0 0 0 * * * America/Denver\n #\#{kl} \u2502 \u2502 \u2502 \u2502 \u2502 \u2502 \u2514\u2500\u2500 Timezone (Optional)\n #\#{kl} \u2502 \u2502 \u2502 \u2502 \u2502 \u2514\u2500\u2500 Day of Week\n #\#{kl} \u2502 \u2502 \u2502 \u2502 \u2514\u2500\u2500 Month\n #\#{kl} \u2502 \u2502 \u2502 \u2514\u2500\u2500 Day of Month\n #\#{kl} \u2502 \u2502 \u2514\u2500\u2500 Hour\n #\#{kl} \u2502 \u2514\u2500\u2500 Minute\n #\#{kl} \u2514\u2500\u2500 Second (Optional)\n ````\n MARKDOWN\n json_schema: {\n oneOf: [\n { type: 'string', pattern: '^((((\\d+,)+\\d+|(\\d+(\\/|-)\\d+)|\\d+|\\*) ?){5,6})(\\w+\\/\\w+)?$' },\n { enum: [false] },\n ],\n default: desc[:schedule].is_a?(String) ? desc[:schedule] : '0 0 3 * * * America/Denver',\n },\n validate: ->(value, *args, errors:, **kwargs) {\n begin\n Rufus::Scheduler.parse(value) if value\n nil\n rescue ArgumentError\n errors << \"<path> must be false or a Crontab string\"\n end\n }\n }\nend\n",
|