Mailinglist Archive: yast-devel (46 mails)

< Previous Next >
Re: [yast-devel] [PATCH 1/3] Change Apparmor settings to use UI
On 06/08/2017 09:33 AM, Josef Reidinger wrote:
On Wed, 7 Jun 2017 15:38:45 -0500
Goldwyn Rodrigues <rgoldwyn@xxxxxxx> wrote:

From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>

This is a precursor to use aa-status json profile view.

Please note, "Configure" option is left hanging which will be filled
in the next patch.

Well, to be honest I found discussion in pull request easier to orientate and
also for discussion, but lets comment it here.

Definitely. What's the advantage of a mailing list in comparison with
Github?


[...]

+ @service_enabled = Yast::UI.QueryWidget(:aaState, :Value)
+ change_state
end
+ end

+ def change_state
+ status = Yast::Service.Enabled("apparmor")
+ # If the service is the same state as our status, return
+ if status == @service_enabled
+ return
+ end

+ # Change the state to what we have
+ if @service_enabled
+ Yast::Service.start("apparmor")
+ Yast::Service.enable("apparmor")
+ else
+ Yast::Service.stop("apparmor")
+ Yast::Service.disable("apparmor")
+ end

- button
+ # Check if the change of service state worked
+ status = Yast::Service.Enabled("apparmor")


Just note. It is quite uncommon in yast to react immediatelly in YaST UI.
Especially consider that user click on "Enable" checkbox and then press
cancel.
This should be done only after click on next, where he confirm that he really
want
to do actions.

Moreover, for starting/stopping and enabling/disabling services we
already have a common widget (with wording and behavior blessed by the
UX team) used in both yast-dhcp-server and yast-dns-server.

Here is the (quite extensively documented) class:
https://github.com/yast/yast-yast2/blob/master/library/general/src/lib/ui/service_status.rb

And here is the unit test, that should be useful as example (in addition
to the already mentioned modules already using it):
https://github.com/yast/yast-yast2/blob/master/library/general/test/service_status_test.rb

Cheers.
--
Ancor González Sosa
YaST Team at SUSE Linux GmbH
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >