diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index 07028728..93559880 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -5,9 +5,9 @@
Name | +Status | +Name | Project | -Responsible | +Responsible | + <% unless buttons.nil? %> +Actions | + <% end %>Description |
---|---|---|---|---|---|---|---|
- <%= render 'vms/vm_status', vm: vm %>
+ <% vm.powered_on? %>
+ <%= vm.archived? ? 'archived' : vm.powered_on? ? 'online' : 'offline' %> + + |
+ <%= link_to vm.name, {controller: :vms, action: 'show', id: vm.name}, - method: :get, class: "btn btn-link" %> + method: :get, class: "btn btn-link" %> | <% if vm.project.nil? %> @@ -33,11 +41,12 @@ <% end %> <% end %> - - <% unless buttons.nil? %> - <%= render buttons.to_s, vm: vm %> - <% end %> | + <% unless buttons.nil? %> ++ <%= render buttons.to_s, vm: vm %> + | + <% end %><%= vm.config&.description %> | diff --git a/app/views/vms/_vm_confirmations.erb b/app/views/vms/_vm_confirmations.erb new file mode 100644 index 00000000..e69de29b diff --git a/app/views/vms/index.html.erb b/app/views/vms/index.html.erb index f2e6d14d..82d2fa6e 100644 --- a/app/views/vms/index.html.erb +++ b/app/views/vms/index.html.erb @@ -9,7 +9,7 @@ -<%= render 'section', {header: 'Active vms', id: 'active', vms: @vms, buttons: nil} %> -<%= render 'section', {header: 'To be archived vms', id: 'to_be_archived', vms: @pending_archivation_vms, buttons: 'archive_buttons'} %> -<%= render 'section', {header: 'To be revived vms', id: 'to_be_revived', vms: @pending_reviving_vms, buttons: 'to_revive_buttons'} %> -<%= render 'section', {header: 'Archived vms', id: 'archived', vms: @archived_vms, buttons: 'revive_buttons'} %> \ No newline at end of file +<%= render 'section', {header: 'Active VMs', id: 'active', vms: @vms, buttons: 'running_vm_buttons'} %> +<%= render 'section', {header: 'Archivable VMs', id: 'to_be_archived', vms: @pending_archivation_vms, buttons: 'archive_buttons'} %> +<%= render 'section', {header: 'Revivable VMs', id: 'to_be_revived', vms: @pending_reviving_vms, buttons: 'to_revive_buttons'} %> +<%= render 'section', {header: 'Archived VMs', id: 'archived', vms: @archived_vms, buttons: 'revive_buttons'} %> \ No newline at end of file diff --git a/spec/views/vms/index.html.erb_spec.rb b/spec/views/vms/index.html.erb_spec.rb index abc9c8df..c77f2db0 100644 --- a/spec/views/vms/index.html.erb_spec.rb +++ b/spec/views/vms/index.html.erb_spec.rb @@ -51,11 +51,11 @@ end it 'shows correct power on / off button' do - expect(rendered).to have_css('a.btn-manage.play') + expect(rendered).to have_css('a.fa-play') end it 'demands confirmation on shutdown' do - expect(rendered).to have_css('a.btn-manage[data-confirm="Are you sure?"]') + expect(rendered).to have_css 'a.btn-manage[data-confirm]' end context 'when vmwaretools are not installed' do @@ -65,16 +65,16 @@ it 'shows no power buttons' do rendered = render - expect(rendered).not_to have_css('a.btn-manage.play') - expect(rendered).not_to have_css('a.btn-manage.stop') + expect(rendered).not_to have_css('a.fa-play') + expect(rendered).not_to have_css('a.fa-stop') end end end context 'when the user is not a root user for the vms' do it 'does not show any manage buttons' do - expect(rendered).not_to have_css('a.btn-manage.play') - expect(rendered).not_to have_css('a.btn-manage.stop') + expect(rendered).not_to have_css('a.fa-play') + expect(rendered).not_to have_css('a.fa-stop') end end @@ -98,24 +98,18 @@ let(:current_user) { FactoryBot.create :admin } it 'shows correct power on / off button' do - expect(rendered).to have_css('a.btn-manage.play') + expect(rendered).to have_css('a.fa-play') end it 'demands confirmation on shutdown' do - expect(rendered).to have_css('a.btn-manage[data-confirm="Are you sure?"]') + expect(rendered).to have_css('a.btn-manage[data-confirm]') end - context 'when vmwaretools are not installed' do - before do - assign(:vms, mock_vms_without_tools) - render - end - - it 'shows no power buttons' do - rendered = render - expect(rendered).not_to have_css('a.btn-manage.play') - expect(rendered).not_to have_css('a.btn-manage.stop') - end + it 'shows no power buttons when vmwaretools are not installed' do + assign(:vms, mock_vms_without_tools) + rendered = render + expect(rendered).not_to have_css('a.fa-play') + expect(rendered).not_to have_css('a.fa-stop') end it 'links to new vm page' do