Class: Yast::ALogClass

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

Instance Method Summary collapse

Instance Method Details

#CommitPopupObject

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



104
105
106
107
108
109
110
# File 'library/log/src/modules/ALog.rb', line 104

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

#doLog(type, msg) ⇒ Object



52
53
54
55
56
57
# File 'library/log/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

#Item(msg) ⇒ Object

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:



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

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

  nil
end

#mainObject



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

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

  Yast.import "Label"
end

#Note(msg) ⇒ Object

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:



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

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

  nil
end

#uiInput(label) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'library/log/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
  ui = UI.UserInput while ui != :ok || ui != :cancel

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