[f79788]: / Allura / allura / templates / site_admin_task_new.html  Maximize  Restore  History

Download this file

133 lines (124 with data), 3.6 kB

  1
  2
  3
  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
 54
 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
{#-
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-#}
{% set page="task_manager" %}
{% set sidebar_rel = '../' %}
{% extends 'allura:templates/site_admin.html' %}
{% block extra_css %}
<style>
#content_base form {
margin: 1em;
}
#content_base form > div {
margin-bottom: 1em;
}
#content_base form > div > *{
display: inline-block;
vertical-align: top;
}
#content_base form > div input,
#content_base form > div textarea,
#content_base form > .input {
display: block;
width: 300px;
}
#content_base form > div label {
width: 100px;
}
#content_base .error {
width: 300px;
background: none;
border: none;
color: #f00;
margin: 0;
padding: 0 0 0 .8em;
}
#content_base pre.doc {
clear: left;
}
#content_base .note {
font-size: small;
font-style: italic;
}
</style>
{% endblock %}
{% macro error(field) %}
{% if form_errors.get(field) %}
<span class="error">{{form_errors.get(field)}}</span>
{% endif %}
{% endmacro %}
{% block content %}
<h2>New Task</h2>
<form method="POST" action="create" id="newtask">
<div>
<label>Task Name *</label>
<div class="input">
<input name="task" value="{{form_values.get('task', '')}}"/>
<span class="note">Dotted python path to task callable
<br>e.g. allura.tasks.admin_tasks.install_app or allura.scripts.disable_users.DisableUsers</span>
</div>
{{error('task')}}
</div>
<div>
<label>c.user</label>
<div class="input">
<input name="user" value="{{form_values.get('user', '')}}" />
<span class="note">Username</span>
</div>
{{error('user')}}
</div>
<div>
<label>c.project/c.app</label>
<div class="input">
<input name="path" value="{{form_values.get('path', '')}}" />
<span class="note">e.g. /p/allura or /p/allura/git</span>
</div>
{{error('path')}}
</div>
<div>
<label>Task args/kwargs</label>
<div class="input">
<textarea name="task_args" rows="4">{{form_values.get('task_args', '{\n "args": [],\n "kwargs": {}\n}')}}</textarea>
</div>
{{error('task_args')}}
</div>
<input type="submit" value="Run Task"/><br/>
<pre class="doc"></pre>
{{lib.csrf_token()}}
</form>
{% endblock %}
{% block extra_js %}
<script>
$(function() {
var $task = $('input[name=task]');
$task.blur(function() {
$.get("task_doc", {task_name: $task.val()}, function(data) {
$task.parent().siblings('.error').remove();
$('pre.doc').empty();
if (data.error) {
$task.parent().after('<span class="error">' + data.error + '</span>');
}
if (data.doc) {
$('pre.doc').html(data.doc);
}
});
});
if ($task.val().trim() !== '') {
$task.blur();
}
});
</script>
{% endblock %}