Class: Yast::ALogClass

Inherits:
Module
  • Object
show all
Defined in:
../../src/modules/ALog.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) CommitPopup

Prompt the user for a message to describe the changes that she did using YaST, logs it using #Note



106
107
108
109
110
111
112
# File '../../src/modules/ALog.rb', line 106

def CommitPopup
  i = uiInput(_("Enter a log message that describes the changes you made."))
  msg = i == nil ? "*empty log message*" : i
  Note(msg)

  nil
end

- (Object) doLog(type, msg)



52
53
54
55
56
57
# File '../../src/modules/ALog.rb', line 52

def doLog(type, msg)
  # TODO make a separate log, this is just a prototype
  Builtins.y2internal("{%1} %2", type, msg)

  nil
end

- (Object) Item(msg)

Log a change to the system from the system point of view. msg should include the file being changed, and what changes are made (TODO: with all detail? or summary?) Example "/etc/ntp.conf: added 'server ntp.example.org'"

Parameters:

  • msg (String)

    message



64
65
66
67
68
# File '../../src/modules/ALog.rb', line 64

def Item(msg)
  doLog("item", msg)

  nil
end

- (Object) main



45
46
47
48
49
50
# File '../../src/modules/ALog.rb', line 45

def main
  Yast.import "UI"
  textdomain "base"

  Yast.import "Label"
end

- (Object) Note(msg)

Log a change to the system from the human point of view. (It will appear slightly differently in the log) Example "get proper time from the corporate time server as requested in ticket bofh#327"

Parameters:

  • msg (String)

    message



75
76
77
78
79
# File '../../src/modules/ALog.rb', line 75

def Note(msg)
  doLog("note", msg)

  nil
end

- (Object) uiInput(label)



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File '../../src/modules/ALog.rb', line 81

def uiInput(label)
  # TODO more lines?
  d = VBox(
    InputField(Id(:val), label, ""),
    ButtonBox(
      PushButton(
        Id(:ok),
        Opt(:default, :key_F10, :okButton),
        Label.OKButton
      )
    )
  )
  UI.OpenDialog(d)
  ui = nil
  begin
    ui = UI.UserInput
  end while ui != :ok || ui != :cancel

  val = nil
  val = Convert.to_string(UI.QueryWidget(Id(:val), :Value)) if ui == :ok
  val
end