A few fixes to make the App Catalog plugin work.

This fixes passing params to stack and image creation form dialogs.
It also fixes a bug with nested dialogs.

Partial-Bug: 1481518
Change-Id: Ie6965ad7c8a738f8b88927077884bba621f2eb6b
This commit is contained in:
Kevin Fox 2015-08-24 15:02:54 -07:00
parent ef1d49e086
commit c454e72bcf
4 changed files with 38 additions and 4 deletions

View File

@ -42,8 +42,11 @@ horizon.modals.create = function (title, body, confirm, cancel) {
horizon.modals.success = function (data) {
var modal;
$('#modal_wrapper').append(data);
modal = $('.modal:last');
var modal_wrapper = $('#modal_wrapper');
// Moves the modal_wrapper to the bottom. This shows it over other dialogs.
modal_wrapper.parent().append(modal_wrapper);
modal_wrapper.append(data);
modal = $('#modal_wrapper > .modal:last');
modal.modal();
$(modal).trigger("new_modal", modal);
return modal;

View File

@ -49,6 +49,23 @@ class CreateView(forms.ModalFormView):
success_url = reverse_lazy("horizon:project:images:index")
page_title = _("Create An Image")
def get_initial(self):
initial = {}
for name in [
'name',
'description',
'image_url',
'source_type',
'architecture',
'disk_format',
'minimum_disk',
'minimum_ram'
]:
tmp = self.request.GET.get(name)
if tmp:
initial[name] = tmp
return initial
class UpdateView(forms.ModalFormView):
form_class = project_forms.UpdateImageForm

View File

@ -95,6 +95,17 @@ class SelectTemplateView(forms.ModalFormView):
success_url = reverse_lazy('horizon:project:stacks:launch')
page_title = _("Select Template")
def get_initial(self):
initial = {}
for name in [
'template_url',
'template_source'
]:
tmp = self.request.GET.get(name)
if tmp:
initial[name] = tmp
return initial
def get_form_kwargs(self):
kwargs = super(SelectTemplateView, self).get_form_kwargs()
kwargs['next_view'] = CreateStackView

View File

@ -18,9 +18,12 @@
.module('horizon.app.tech-debt')
.controller('ImageFormController', ImageFormController);
function ImageFormController() {
var ctrl = this;
ImageFormController.$inject = ['$element'];
function ImageFormController($element) {
var ctrl = this;
ctrl.copyFrom = $element('.image_url').val();
ctrl.diskFormat = $element('.disk_format').val();
ctrl.selectImageFormat = function (path) {
if (!path) { return; }
var format = path.substr(path.lastIndexOf(".") + 1)