From ca1996152be6327c0b85381b609a23c409b94ae2 Mon Sep 17 00:00:00 2001 From: Gerhard Jungwirth Date: Wed, 27 Apr 2016 11:07:07 +0200 Subject: [PATCH] MT#19439 non-destructive dashboard beautification Change-Id: I72a3e0cbeffd7cb36a9fd063fb6c2782ebef2f9c --- lib/NGCP/Panel/Controller/Dashboard.pm | 37 +++++--------------------- lib/NGCP/Panel/Widget.pm | 6 ++--- 2 files changed, 9 insertions(+), 34 deletions(-) diff --git a/lib/NGCP/Panel/Controller/Dashboard.pm b/lib/NGCP/Panel/Controller/Dashboard.pm index 4445e215b5..bc1911081c 100644 --- a/lib/NGCP/Panel/Controller/Dashboard.pm +++ b/lib/NGCP/Panel/Controller/Dashboard.pm @@ -1,28 +1,14 @@ package NGCP::Panel::Controller::Dashboard; -use NGCP::Panel::Utils::Generic qw(:all); -use Sipwise::Base; -use parent 'Catalyst::Controller'; -use NGCP::Panel::Widget; - -=head1 NAME - -NGCP::Panel::Controller::Dashboard - Catalyst Controller - -=head1 DESCRIPTION - -Catalyst Controller. - -=head1 METHODS - -=cut -=head2 index +use warnings; +use strict; -Dashboard index +use parent 'Catalyst::Controller'; -=cut +use NGCP::Panel::Utils::Generic qw(:all); +use NGCP::Panel::Widget; -sub index :Path :Args(0) { +sub dashb_index :Path :Args(0) { my ($self, $c) = @_; my $plugin_finder = NGCP::Panel::Widget->new; @@ -60,17 +46,6 @@ sub ajax :Path('ajax') :Args(1) { $c->detach( $c->view("JSON") ); } -=head1 AUTHOR - -Andreas Granig,,, - -=head1 LICENSE - -This library is free software. You can redistribute it and/or modify -it under the same terms as Perl itself. - -=cut - __PACKAGE__->meta->make_immutable; 1; diff --git a/lib/NGCP/Panel/Widget.pm b/lib/NGCP/Panel/Widget.pm index 2f4aa87585..038e2cb122 100644 --- a/lib/NGCP/Panel/Widget.pm +++ b/lib/NGCP/Panel/Widget.pm @@ -1,5 +1,4 @@ package NGCP::Panel::Widget; -use Sipwise::Base; use Moose; with 'MooseX::Object::Pluggable'; @@ -15,7 +14,7 @@ sub filter { sub instantiate_plugins { my ($self, $c, $type_filter) = @_; - my @plugins = map { s/^.*:://; $_; } $self->_plugin_locator->plugins; + my @plugins = map { s/^.*:://r; } $self->_plugin_locator->plugins; my @instances = (); foreach(@plugins) { @@ -25,7 +24,8 @@ sub instantiate_plugins { push @instances, { instance => $inst, name => $_ }; } } - return sort {$a->{instance}->priority <=> $b->{instance}->priority} @instances; + my @sorted_instances = sort {$a->{instance}->priority <=> $b->{instance}->priority} @instances; + return @sorted_instances; } no Moose;