ManageIQ/manageiq-ui-classic

View on GitHub
app/presenters/tree_node/miq_action.rb

Summary

Maintainability
A
0 mins
Test Coverage
B
80%
module TreeNode
  class MiqAction < Node
    set_attribute(:text, &:description)
    set_attribute(:icon) do
      if @tree.instance_of?(TreeBuilderAction)
        @object.decorate.fonticon
      else
        flag_of(@object) == :success ? "pficon pficon-ok" : "pficon pficon-error-circle-o"
      end
    end

    private

    def flag_of(object)
      object.instance_variable_get(:@flag)
    end
  end
end