app/views/miq_ae_tools/_import_export.html.haml
%iframe.import-hidden-iframe{:name => "upload_target", :style => "display: none;"}
= render :partial => "layouts/flash_msg"
.import-flash-message
.alert
%span.icon-placeholder
%span.pficon
%span.pficon
%strong.message
.import-or-export
%h3
= _('Import Datastore classes (*.zip)')
= form_tag({:action => "upload_import_file"},
:target => "upload_target",
:multipart => true,
:method => :post) do
.form-horizontal
.form-group
.col-md-4
= render :partial => "shared/file_chooser", :locals => {:object_name => "upload", :method => "file"}
.col-md-6
= submit_tag(_("Upload"), :id => "upload-datastore-import", :class => "upload btn btn-default", :disabled => true)
%hr
%h3
= _('Import Datastore via git')
= form_tag({:action => "retrieve_git_datastore"},
:target => "upload_target",
:method => :post,
:id => "retrieve-git-datastore-form") do
.form-horizontal
.form-group
%label.col-sm-2.control-label
= _('Git URL:')
.col-md-8
= text_field_tag(:git_url, nil, :size => 128)
.form-group
%label.col-sm-2.control-label
= _('Username (optional):')
.col-md-8
= text_field_tag(:git_username, nil)
.form-group
%label.col-sm-2.control-label
= _('Password (optional):')
.col-md-8
= password_field_tag(:git_password, nil)
.form-group
%label.col-md-2.control-label
= _("Verify Peer Certificate")
.col-md-8
= check_box_tag(:git_verify_ssl, true, true)
.form-group
.col-sm-2
.col-md-8
= submit_tag(_("Submit"),
:id => "git-url-import",
:class => "git-retrieve-datastore btn btn-default",
:disabled => !git_import_button_enabled?)
= git_import_submit_help
%hr
%h3
= _('Export')
= form_tag({:action => "export_datastore"},
:method => :get) do
%button.btn.btn-default{:type => :submit, :title => _("Export all classes and instances")}
%i.pficon.pficon-export
= _('Export all classes and instances to a file')
%hr
%h3
= (t = _("Reset all components in the following domains: %{domains}") % {:domains => MiqAeDatastore.default_domain_names.join(', ')})
= link_to({:action => 'reset_datastore'},
"data-miq_sparkle_on" => true,
:confirm => _("All Datastore customizations will be lost. Are you sure you want to reset all classes and instances to default?"),
:remote => true,
:class => 'btn btn-default',
"data-method" => :post,
:title => t) do
%i.pficon.pficon-refresh
.git-import-data{:style => "display: none;"}
%h3
= _('Choose the branch or tag you would like to import')
%form#git-branch-tag-form
= hidden_field_tag(:git_repo_id, '', :class => "hidden-git-repo-id")
.form-horizontal
.form-group
%label.col-md-2.control-label
= _('Branch/Tag')
.col-md-8
= select_tag("branch_or_tag",
options_for_select(["Branch", "Tag"]),
:class => "git-branch-or-tag-select selectpicker")
.form-group.git-branch-group
%label.col-md-2.control-label
= _('Branches')
.col-md-8
%select.selectpicker.git-branches
.form-group.git-tag-group{:style => "display: none;"}
%label.col-md-2.control-label
= _('Tags')
.col-md-8
%select.selectpicker.git-tags
.form-group
.col-md-2
%input{:type => "hidden", :class => "git-branch-or-tag", :name => "git_branch_or_tag"}
.col-md-8
= button_tag(_("Submit"), :class => "git-import-submit btn btn-primary")
= button_tag(_("Cancel"), :class => "git-import-cancel btn btn-default")
.import-data{:style => "display: none;"}
%form#import-form
%h3
= _('Import Datastore classes')
.form-horizontal
.form-group
%label.col-md-2.control-label
= _('Select existing domain to import into:')
.col-md-8
= select_tag("selected_domain_to_import_to",
options_for_select(@importable_domain_options),
:class => "existing-domains selectpicker")
.form-group
%label.col-md-2.control-label
= _('Select domain you wish to import from:')
.col-md-8
%select.selectpicker.importing-domains{:name => "selected_domain_to_import_from"}
.form-group
%label.col-md-2.control-label
= _('Select namespaces you wish to import:')
.col-md-8
%input#toggle-all{:type => "checkbox"}
%label{:for => "toggle-all"}= _('Toggle All/None')
.domain-tree{:name => "selected_namespaces[]"}
%table{:width => "100%"}
%tr
%td{:align => "right"}
= hidden_field_tag(:import_file_upload_id, '', :class => "hidden-import-file-upload-id")
= button_tag(_("Commit"), :class => "import-commit btn btn-primary")
= button_tag(_("Back"), :class => "import-back btn btn-default")
:javascript
$(function() {
miqInitSelectPicker();
$("#upload_file").on("change", function() {
ImportSetup.setUpUploadImportButton('#upload-datastore-import')
});
$('#upload-datastore-import').on("click", function() {
miqSparkleOn();
});
ImportSetup.listenForPostMessages(Automate.getAndRenderAutomateJson);
ImportSetup.listenForGitPostMessages();
Automate.setUpAutomateImportClickHandlers();
});