From b92685977f5afd82ab10593bd95bbce631590a02 Mon Sep 17 00:00:00 2001 From: Ahmed Kamal Date: Tue, 25 Aug 2015 01:48:36 +0300 Subject: [PATCH 1/2] Add a flash message partial to DW plugin --- app/views/layouts/wizard.html.slim | 2 +- app/views/shared/_dw_flash_messages.html.slim | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 app/views/shared/_dw_flash_messages.html.slim diff --git a/app/views/layouts/wizard.html.slim b/app/views/layouts/wizard.html.slim index f1370c8..d803e0b 100644 --- a/app/views/layouts/wizard.html.slim +++ b/app/views/layouts/wizard.html.slim @@ -40,7 +40,7 @@ html[dir="#{@locale_direction}" lang="#{I18n.locale}" xml:lang="#{I18n.locale}"] = render 'layouts/header' #content - = render 'shared/flash_messages' + = render 'shared/dw_flash_messages' #app.inner .row.text-center .col-md-12 diff --git a/app/views/shared/_dw_flash_messages.html.slim b/app/views/shared/_dw_flash_messages.html.slim new file mode 100644 index 0000000..4390e98 --- /dev/null +++ b/app/views/shared/_dw_flash_messages.html.slim @@ -0,0 +1,6 @@ +#errors + - flash.each do |name, msg| + - name = "danger" if name == "error" + div[class=" alert alert-#{name}"] + strong + =sanitize(msg) \ No newline at end of file From 70a3cde0f470b99a398e94a27789e8b8f7eb78b9 Mon Sep 17 00:00:00 2001 From: Ahmed Kamal Date: Tue, 25 Aug 2015 01:51:07 +0300 Subject: [PATCH 2/2] Show warning message after choosing LVM partition --- app/controllers/disk_wizard_controller.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/controllers/disk_wizard_controller.rb b/app/controllers/disk_wizard_controller.rb index 5e174b9..d907b2c 100644 --- a/app/controllers/disk_wizard_controller.rb +++ b/app/controllers/disk_wizard_controller.rb @@ -10,6 +10,8 @@ class DiskWizardController < ApplicationController DELETE_OPTION = '2' CREATE_OPTION = '3' + LVM_FSTYPE = "LVM2_member" + # @return [Device Array] : Return array of Device objects, which are mounted(permanent or temporary) in the HDA. # Render the first step of the Disk-Wizard(DW) def select_device @@ -58,6 +60,11 @@ def manage_disk if partition.match(/^\/dev/).blank? device = Device.find_with_unallocated(user_selections['disk']) @selected_partiton = (device.partitions.select{|part| part.identifier == user_selections['path'] }).first + else + @selected_partiton = Device.find partition + end + if @selected_partiton.fstype.eql?(LVM_FSTYPE) + flash[:error] = %Q[We do not recommend LVM partitions at Amahi and here is why.] end end