Mailinglist Archive: yast-devel (126 mails)

< Previous Next >
[yast-devel] Webyast: Improvements after first release (discussion)
  • From: Josef Reidinger <jreidinger@xxxxxxx>
  • Date: Fri, 6 Nov 2009 10:13:12 +0100
  • Message-id: <200911061013.12831.jreidinger@xxxxxxx>
Hi,
I would like to summarize and also start discussion what should be improved
after first webyast release. Because I think that things which affects
infrastructure should be done before changes in plugin to benefit from
improvements and also if we collect useful things which should framework
provide, then it is easier to implement it together and cooperate between
features. I separate issues to simple and more complex.

Simple:

- all webclient plugins should have testsuite (related to improvement
activeResource usage on webclient as now it is quite hard to create good tests
)

- all rest service should have REST documentation

- all rest service should properly report invalid values ( related to
validations in ActiveModel ). Properly report is to use InvalidValue exception
which reports 422 and xml description which ActiveResource understand ( done
automatic in InvalidValue exception)

- remove static rest_authentificate file and use gem, because current solution
require that we also port all security changes in rest_authentificate manually

Complex:

- Rest-service framework should provide Basic model and two Basic controller
for REST. model should contain helper for permission check for read and write
permission, validations, automatic loading and storing xml. Controllers should
provide basic REST operation for single resource and multiple resource REST
service provides xml and json api. After some research the best look to
backport ActiveModel from rails 3.0 and add own specific yast extensions. I
can maintain it as gem.

Example plugin after this improvement:

controller:
LanguageController < SingleRESTController
end

model:
Language < YaSTModel
#permissions checks
read_permission yapi("language.read")
write_permission yapi("language.write")

#validations, generally known from ActiveResource and ActiveRecord +
own
specific if it is needed for DBUS
validates_inclusion_of :language, :in => @known_languages
#etc...

def find (...) #Active model parameters
create( yastdbuscall (language.read,params...)) #create uses
automatic new a
load
end

def save
yastdbuscall (language.read,params...) #maybe some checks etc.
end

end

Thats what should simple plugin which is backended by DBus contain, Other non-
problem related things should be handled in framework (if you must copy and
paste code, then something is wrong, when you write plugin you should add only
specific things related to that plugin).

- Change permissions and resource call in frontend. It is huge wasting of
sourced and one of problems that leads to slow webyast. My solution is to ask
webservice for all resources and all permission for logged user after login
and then use this values stored in webclient. This helps avoid calling three
rest resources instead of one ( you can see example in network, where is 4
rest calls which lead to 12!!! rest service call just to provide information
about network). Related also to next note.

- Simplify ActiveResource handling in webclient. Current generated way is
uncommon and each person, which want create own plugin fight with it. Solution
used in network, which provide some basic class is for me just half solution.
What should be done is class which act like common ActiveResource which is
well known rails source. My suggestion is to join with previous task and
provide extension of ActiveResource which takes site from a storage (known
after login), path on site from a storage (known after login if we do previous
note) and credentials (same as now or improved). This is what ActiveResource
need to improve. So after this change our code should look like common
ActiveResource code and not as some strange code which looks like it doesn't
use rails.


Welcome any opinions, suggestion and ideas what should be also improved
Josef
--
Josef Reidinger
YaST team
maintainer of perl-Bootloader, YaST2-Repair, webyast
(language,time,basesystem,ntp)
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages