{% block extra_css %}
<link href="{% static 'qcg/selectize/selectize.bootstrap3.css' %}" rel="stylesheet">
- <link href="{% static 'qcg/datetimepicker/bootstrap-datetimepicker.min.css' %}" rel="stylesheet">
{% endblock %}
{% block extra_js %}
<script src="{% static 'qcg/selectize/selectize.min.js' %}"></script>
<script src="{% static 'qcg/formset/jquery.formset.js' %}"></script>
- <script src="{% static 'qcg/moment/moment.min.js' %}"></script>
- <script src="{% static 'qcg/moment/pl.js' %}"></script>
- <script src="{% static 'qcg/datetimepicker/bootstrap-datetimepicker.min.js' %}"></script>
+
+ {% include 'filex/source.js.html' %}
<script>
$(function() {
- $('#id_application, #id_host').selectize();
+ var gridftpButton = $('<button/>', {
+ 'type': 'button',
+ 'class': 'btn btn-default pull-right',
+ 'text': 'Wybierz',
+ 'data-toggle': 'modal',
+ 'data-target': '#gridftp'
+ });
+
+ function fullPath(path, file) {
+ var res = path + file.get('name');
+
+ if (file.isDir())
+ res += '/';
+
+ return res;
+ }
+
+ $('#id_master_file,#id_executable,#id_input,#id_preprocess_script,#id_postprocess_script').before(function() {
+ var target = this;
+ return gridftpButton.clone().click(function() {
+ $('#select-btn').off().click(function() {
+ var selected = filex.selectedFiles();
+
+ if (selected.length != 1 || !selected[0].isFile()) {
+ alert('Wybierz dokładnie jeden plik.');
+ return;
+ }
+
+ var file = fullPath(filex.host + filex.path.full() + '/', selected[0]);
+
+ target.selectize.clear();
+ target.selectize.addOption({value: file, text: file});
+ target.selectize.addItem(file);
+ target.selectize.refreshItems();
+
+ $('#gridftp').modal('hide');
+ filex.clearSelection();
+ });
+ });
+ }).wrap('<div style="margin-right: 80px"></div>');
+
+ $('#id_stage_in').before(function() {
+ var target = this;
+ return gridftpButton.clone().click(function() {
+ $('#select-btn').off().click(function() {
+ var path = filex.host + filex.path.full() + '/';
+
+ _.each(filex.selectedFiles(), function(item) {
+ var file = fullPath(path, item);
+ target.selectize.addOption({value: file, text: file});
+ target.selectize.addItem(file);
+ });
+ target.selectize.refreshItems();
+
+ $('#gridftp').modal('hide');
+ filex.clearSelection();
+ });
+ });
+ }).wrap('<div style="margin-right: 80px"></div>');
+
+ $('#id_application').selectize();
$('#id_arguments,#id_properties,#id_native').selectize({
plugins: ['remove_button'],
create: true,
}
}
});
- $('#id_modules').selectize({
+ $('#id_modules,#id_hosts,#id_master_file,#id_executable,#id_input,#id_stage_in,#id_preprocess_script,#id_postprocess_script').selectize({
plugins: ['remove_button']
});
deleteCssClass: 'delete-btn btn btn-xs btn-danger'
});
- $('#id_not_before,#id_not_after').datetimepicker({
- locale: 'pl',
- minDate: moment()
- });
-
$('input[name="notify_type"],input[name="watch_output_type"],input[name="preprocess_type"],input[name="postprocess_type"]').on('change', function () {
$(this).tab('show');
}).each(function() {
$('form .collapse').collapse('toggle');
$(this).find('span').text(this.text == "Pokaż zaawansowane" ? "Ukryj zaawansowane" : "Pokaż zaawansowane");
});
-
- $('#new-env').click(function(e) {
- e.preventDefault();
- $('#env-modal').modal('show');
- });
-
- $('#env-form').submit(function(e) {
- e.preventDefault();
- $('#env-modal').modal('hide');
-
- $('#id_environment')[0].selectize.createItem($('#id_env_name').val() + '=' + $('#id_env_value').val());
- });
});
</script>
{% endblock %}
{% block container %}
<h1 class="page-header">{% block title %}Zleć zadanie{% endblock %}</h1>
+ {% if errors %}
+ <div class="alert alert-danger">
+ <strong>Uwaga!</strong> Formularz zawiera błędy.
+ {{ form.non_field_errors }}
+ {{ env_formset.non_field_errors }}
+ </div>
+ {% endif %}
+
<form action="." method="post" class="form-horizontal">
{% csrf_token %}
<div class="tab-content">
<fieldset id="basic" class="tab-pane active" role="tabpanel">
{% bootstrap_field form.application layout="horizontal" %}
- <div class="row" style="margin-top: -15px; margin-bottom: 15px">
- <div class="col-sm-offset-3 col-md-offset-4 col-sm-9 col-md-6">
- {# TODO grid ftp #}
- <a id="add-main-file" href="#">wybierz plik główny »</a>
- </div>
- </div>
-
+ {% bootstrap_field form.master_file layout="horizontal" %}
{% bootstrap_field form.executable layout="horizontal" form_group_class="form-group collapse" %}
{% bootstrap_field form.script layout="horizontal" form_group_class="form-group collapse" %}
{% bootstrap_field form.arguments layout="horizontal" %}
{% bootstrap_field form.note layout="horizontal" %}
- {% bootstrap_field form.grant layout="horizontal" %}
+ {% bootstrap_field form.grant layout="horizontal" form_group_class="form-group collapse" %}
</fieldset>
<fieldset id="resources" class="tab-pane" role="tabpanel">
- {% bootstrap_field form.host layout="horizontal" %}
+ {% bootstrap_field form.hosts layout="horizontal" %}
{% bootstrap_field form.queue layout="horizontal" %}
{% bootstrap_field form.properties layout="horizontal" form_group_class="form-group collapse" %}
{% bootstrap_field form.modules layout="horizontal" form_group_class="form-group collapse" %}
{% bootstrap_field form.procs layout="horizontal" %}
{% bootstrap_field form.nodes layout="horizontal" form_group_class="form-group collapse" %}
- {% include 'qcg/time_range_field.html' with field_name='wall_time' field=form.wall_time %}
+ {% bootstrap_field form.wall_time layout="horizontal" form_group_class="form-group timerange" %}
{% bootstrap_field form.memory layout="horizontal" form_group_class="form-group collapse" %}
{% bootstrap_field form.memory_per_slot layout="horizontal" form_group_class="form-group collapse" %}
{% bootstrap_field form.reservation layout="horizontal" form_group_class="form-group collapse" %}
<fieldset id="files" class="tab-pane" role="tabpanel">
{% bootstrap_field form.input layout="horizontal" %}
{% bootstrap_field form.stage_in layout="horizontal" %}
- {% bootstrap_field form.stage_out layout="horizontal" form_group_class="form-group collapse" %}
+{# {% bootstrap_field form.stage_out layout="horizontal" form_group_class="form-group collapse" %}#}
</fieldset>
<fieldset id="environment" class="tab-pane" role="tabpanel">
<label class="btn btn-default">
<input type="radio" autocomplete="off" name="{{ option.name }}" value="{{ option.choice_value }}"
{% if option.is_checked %}checked{% endif %}
- data-target=".notify-type-{{ option.choice_value }}"> {{ option.choice_label }}
+ data-target=".notify-type-{{ forloop.counter0 }}"> {{ option.choice_label }}
</label>
{% endfor %}
</div>
<label class="btn btn-default">
<input type="radio" autocomplete="off" name="{{ option.name }}" value="{{ option.choice_value }}"
{% if option.is_checked %}checked{% endif %}
- data-target=".watch-output-type-{{ option.choice_value }}"> {{ option.choice_label }}
+ data-target=".watch-output-type-{{ forloop.counter0 }}"> {{ option.choice_label }}
</label>
{% endfor %}
</div>
<label class="btn btn-default">
<input type="radio" autocomplete="off" name="{{ option.name }}" value="{{ option.choice_value }}"
{% if option.is_checked %}checked{% endif %}
- data-target=".preprocess-type-{{ option.choice_value }}"> {{ option.choice_label }}
+ data-target=".preprocess-type-{{ forloop.counter0 }}"> {{ option.choice_label }}
</label>
{% endfor %}
</div>
<label class="btn btn-default">
<input type="radio" autocomplete="off" name="{{ option.name }}" value="{{ option.choice_value }}"
{% if option.is_checked %}checked{% endif %}
- data-target=".postprocess-type-{{ option.choice_value }}"> {{ option.choice_label }}
+ data-target=".postprocess-type-{{ forloop.counter0 }}"> {{ option.choice_label }}
</label>
{% endfor %}
</div>
</div>
</form>
+ <div id="gridftp" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modal-label" aria-hidden="true">
+ <div class="modal-dialog modal-lg">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
+ <h4 class="modal-title" id="modal-label">Wybierz plik</h4>
+ </div>
+ <div class="modal-body">
+ {% include 'filex/source.html' %}
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Anuluj</button>
+ <button id="select-btn" type="button" class="btn btn-primary">Wybierz</button>
+ </div>
+ </div>
+ </div>
+ </div>
+
{% endblock %}