lycheedev 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/lycheedev.js +21 -6
- package/package.json +1 -1
- package/vendor/addon/Core/Bootstrap.lua +131 -131
- package/vendor/addon/Core/Clients/Mainline.lua +9 -9
- package/vendor/addon/Core/Clients/Mists.lua +9 -9
- package/vendor/addon/Core/Clients/Titan.lua +9 -9
- package/vendor/addon/Core/Compatibility.lua +43 -43
- package/vendor/addon/Core/Database.lua +859 -859
- package/vendor/addon/Core/Inspector.lua +647 -647
- package/vendor/addon/Core/Locale.lua +307 -307
- package/vendor/addon/Core/Locale_enUS.lua +318 -318
- package/vendor/addon/Core/Safety.lua +42 -42
- package/vendor/addon/Core/Serializer.lua +324 -324
- package/vendor/addon/Libs/AutomationQR.lua +1176 -1176
- package/vendor/addon/Lychee Dev_Mainline.toc +43 -43
- package/vendor/addon/Lychee Dev_Mists.toc +43 -43
- package/vendor/addon/Lychee Dev_Wrath.toc +43 -43
- package/vendor/addon/Modules/Automation/Controller.lua +757 -757
- package/vendor/addon/Modules/Automation/Report.lua +409 -409
- package/vendor/addon/Modules/Automation/auto/auto.lua +12 -12
- package/vendor/addon/Modules/Diagnostics.lua +238 -238
- package/vendor/addon/Modules/Events/Catalog.lua +184 -184
- package/vendor/addon/Modules/Events/CatalogData_Mainline.lua +1788 -1788
- package/vendor/addon/Modules/Events/CatalogData_Mists.lua +1489 -1489
- package/vendor/addon/Modules/Events/CatalogData_Titan.lua +1492 -1492
- package/vendor/addon/Modules/Events/Monitor.lua +181 -181
- package/vendor/addon/Modules/FunctionTrace.lua +85 -85
- package/vendor/addon/Modules/ObjectInspector.lua +329 -329
- package/vendor/addon/UI/AutomationOverlay.lua +183 -183
- package/vendor/addon/UI/Export.lua +140 -140
- package/vendor/addon/UI/Features.lua +890 -890
- package/vendor/addon/UI/MainWindow.lua +1145 -1145
- package/vendor/addon/UI/Pages/About.lua +223 -223
- package/vendor/addon/UI/Pages/Automation.lua +417 -417
- package/vendor/addon/UI/Pages/Diagnostics.lua +289 -289
- package/vendor/addon/UI/Pages/ExportRecords.lua +387 -387
- package/vendor/addon/UI/Pages/Object.lua +573 -573
- package/vendor/addon/UI/Pages/Trace.lua +165 -165
- package/vendor/skill/SKILL.md +94 -94
- package/vendor/skill/agents/openai.yaml +4 -4
- package/vendor/skill/references/automation.md +327 -327
- package/vendor/skill/references/runtime-investigations.md +97 -97
- package/vendor/skill/scripts/automation/__init__.py +1 -1
- package/vendor/skill/scripts/automation/registry.py +516 -516
- package/vendor/skill/scripts/automation/saved_variables.py +438 -438
- package/vendor/skill/scripts/automation/session.py +207 -207
- package/vendor/skill/scripts/automation/windows.py +573 -573
- package/vendor/skill/scripts/automation.py +865 -865
- package/vendor/skill/scripts/requirements.txt +13 -13
- package/vendor/skill/scripts/selftest_offline.py +981 -981
|
@@ -1,289 +1,289 @@
|
|
|
1
|
-
local ADDON_NAME, ns = ...
|
|
2
|
-
local L = ns.L
|
|
3
|
-
|
|
4
|
-
local ERROR_ROW_HEIGHT = 44
|
|
5
|
-
local ERROR_LIST_WIDTH = 430
|
|
6
|
-
local VISIBLE_ROWS = 16
|
|
7
|
-
|
|
8
|
-
local function SetReadOnlyText(panel, text, selectAll)
|
|
9
|
-
local editBox = panel.editBox
|
|
10
|
-
editBox.savedText, editBox.updatingText = text or "", true
|
|
11
|
-
editBox:SetText(text or "")
|
|
12
|
-
editBox.updatingText = nil
|
|
13
|
-
editBox:SetCursorPosition(0)
|
|
14
|
-
panel.scroll:SetVerticalScroll(0)
|
|
15
|
-
if selectAll then
|
|
16
|
-
editBox:SetFocus()
|
|
17
|
-
editBox:HighlightText()
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
local function CreateLineInput(parent, ui)
|
|
22
|
-
local panel = ui.CreatePanel(parent, ui.editorR, ui.editorG, ui.editorB, 1)
|
|
23
|
-
local editBox = CreateFrame("EditBox", nil, panel)
|
|
24
|
-
editBox:SetAutoFocus(false)
|
|
25
|
-
editBox:SetFontObject(ChatFontNormal)
|
|
26
|
-
editBox:SetTextColor(0.94, 0.95, 0.96)
|
|
27
|
-
editBox:SetTextInsets(9, 9, 0, 0)
|
|
28
|
-
editBox:SetPoint("TOPLEFT", 1, -1)
|
|
29
|
-
editBox:SetPoint("BOTTOMRIGHT", -1, 1)
|
|
30
|
-
editBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
|
|
31
|
-
editBox:SetScript("OnEditFocusGained", function() ui.SetBorderColor(panel, true, 0.75) end)
|
|
32
|
-
editBox:SetScript("OnEditFocusLost", function() ui.SetBorderColor(panel, false) end)
|
|
33
|
-
panel.editBox = editBox
|
|
34
|
-
return panel
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
function ns.CreateDiagnosticsPage(parent, ui)
|
|
38
|
-
local page = CreateFrame("Frame", nil, parent)
|
|
39
|
-
page:SetAllPoints(parent)
|
|
40
|
-
|
|
41
|
-
local refreshButton = ui.CreateButton(page, 92, L.REFRESH, false)
|
|
42
|
-
refreshButton:SetPoint("TOPRIGHT", -14, -84)
|
|
43
|
-
local clearButton = ui.CreateButton(page, 178, L.CLEAR_ERRORS, false)
|
|
44
|
-
clearButton:SetPoint("RIGHT", refreshButton, "LEFT", -8, 0)
|
|
45
|
-
|
|
46
|
-
local status = page:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
47
|
-
status:SetPoint("TOPLEFT", 17, -94)
|
|
48
|
-
status:SetPoint("RIGHT", clearButton, "LEFT", -10, 0)
|
|
49
|
-
status:SetJustifyH("LEFT")
|
|
50
|
-
local function SetStatus(text, errorState)
|
|
51
|
-
local r = errorState and ui.accentR or 0.55
|
|
52
|
-
local g = errorState and ui.accentG or 0.60
|
|
53
|
-
local b = errorState and ui.accentB or 0.65
|
|
54
|
-
status:SetText(text or "")
|
|
55
|
-
status:SetTextColor(r, g, b, 0.92)
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
local errorsView = CreateFrame("Frame", nil, page)
|
|
59
|
-
errorsView:SetPoint("TOPLEFT", 0, -126)
|
|
60
|
-
errorsView:SetPoint("BOTTOMRIGHT")
|
|
61
|
-
|
|
62
|
-
local currentScope = ui.CreateButton(errorsView, 104, L.CURRENT_SESSION, "selected")
|
|
63
|
-
currentScope:SetPoint("TOPLEFT", 14, 0)
|
|
64
|
-
local allScope = ui.CreateButton(errorsView, 104, L.ALL_SESSIONS, false)
|
|
65
|
-
allScope:SetPoint("LEFT", currentScope, "RIGHT", 8, 0)
|
|
66
|
-
local searchPanel = CreateLineInput(errorsView, ui)
|
|
67
|
-
searchPanel:SetPoint("TOPLEFT", allScope, "TOPRIGHT", 14, 0)
|
|
68
|
-
searchPanel:SetWidth(260)
|
|
69
|
-
searchPanel:SetHeight(28)
|
|
70
|
-
local searchButton = ui.CreateButton(errorsView, 76, L.SEARCH, false)
|
|
71
|
-
searchButton:SetPoint("LEFT", searchPanel, "RIGHT", 8, 0)
|
|
72
|
-
local selectReport = ui.CreateButton(errorsView, 110, L.SELECT_REPORT, false)
|
|
73
|
-
selectReport:SetPoint("TOPRIGHT", -14, 0)
|
|
74
|
-
local exportReport = ui.CreateButton(errorsView, 92, L.SAVE_TO_DISK, false)
|
|
75
|
-
exportReport:SetPoint("RIGHT", selectReport, "LEFT", -8, 0)
|
|
76
|
-
page.currentScope = currentScope
|
|
77
|
-
page.allScope = allScope
|
|
78
|
-
page.refreshButton = refreshButton
|
|
79
|
-
page.clearButton = clearButton
|
|
80
|
-
page.selectReport = selectReport
|
|
81
|
-
page.exportReport = exportReport
|
|
82
|
-
|
|
83
|
-
local listLabel = ui.CreateSectionLabel(errorsView, L.ERROR_LIST)
|
|
84
|
-
listLabel:SetPoint("TOPLEFT", 17, -48)
|
|
85
|
-
local reportLabel = ui.CreateSectionLabel(errorsView, L.AGENT_REPORT)
|
|
86
|
-
reportLabel:SetPoint("TOPLEFT", ERROR_LIST_WIDTH + 29, -48)
|
|
87
|
-
|
|
88
|
-
local listPanel = ui.CreatePanel(errorsView, ui.editorR, ui.editorG, ui.editorB, 0.78)
|
|
89
|
-
listPanel:SetPoint("TOPLEFT", 14, -68)
|
|
90
|
-
listPanel:SetPoint("BOTTOMLEFT", 14, 54)
|
|
91
|
-
listPanel:SetWidth(ERROR_LIST_WIDTH)
|
|
92
|
-
local errorScroll = ui.CreateScrollArea(listPanel, 8, 8, 7, 8)
|
|
93
|
-
local errorContent = CreateFrame("Frame", nil, errorScroll)
|
|
94
|
-
errorContent:SetWidth(ERROR_LIST_WIDTH - 26)
|
|
95
|
-
errorContent:SetHeight(1)
|
|
96
|
-
errorScroll:SetScrollChild(errorContent)
|
|
97
|
-
local errorEmpty = listPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
98
|
-
errorEmpty:SetPoint("TOP", 0, -24)
|
|
99
|
-
errorEmpty:SetText(L.NO_ERRORS)
|
|
100
|
-
errorEmpty:SetTextColor(1, 1, 1, 0.32)
|
|
101
|
-
|
|
102
|
-
local reportPanel = ui.CreateTextArea(errorsView, true)
|
|
103
|
-
reportPanel:SetPoint("TOPLEFT", ERROR_LIST_WIDTH + 26, -68)
|
|
104
|
-
reportPanel:SetPoint("BOTTOMRIGHT", -14, 54)
|
|
105
|
-
reportPanel.editBox:SetWidth(ui.windowWidth - ERROR_LIST_WIDTH - 78)
|
|
106
|
-
reportPanel.editBox:SetScript("OnMouseUp", function(self)
|
|
107
|
-
self:SetFocus()
|
|
108
|
-
end)
|
|
109
|
-
SetReadOnlyText(reportPanel, L.SELECT_ERROR_DETAIL)
|
|
110
|
-
|
|
111
|
-
local errors = {}
|
|
112
|
-
local selectedError
|
|
113
|
-
local errorRows = {}
|
|
114
|
-
local scope = "current"
|
|
115
|
-
local confirmClear = false
|
|
116
|
-
local callbackOwner = {}
|
|
117
|
-
local callbackRegistered = false
|
|
118
|
-
local refreshQueued = false
|
|
119
|
-
|
|
120
|
-
local function ApplyErrorRowStyle(row)
|
|
121
|
-
local selected = row.errorEntry == selectedError
|
|
122
|
-
ui.SetListRowState(row, selected, row.isHovered)
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
local function CreateErrorRow(index)
|
|
126
|
-
local row = ui.CreateListRow(errorContent, ERROR_ROW_HEIGHT)
|
|
127
|
-
row:SetWidth(ERROR_LIST_WIDTH - 26)
|
|
128
|
-
local message = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
129
|
-
message:SetPoint("TOPLEFT", 9, -6)
|
|
130
|
-
message:SetPoint("TOPRIGHT", -54, -6)
|
|
131
|
-
message:SetJustifyH("LEFT")
|
|
132
|
-
message:SetWordWrap(false)
|
|
133
|
-
row.message = message
|
|
134
|
-
local count = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
135
|
-
count:SetPoint("TOPRIGHT", -9, -6)
|
|
136
|
-
count:SetTextColor(1, 1, 1, 0.42)
|
|
137
|
-
row.count = count
|
|
138
|
-
local metadata = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
139
|
-
metadata:SetPoint("BOTTOMLEFT", 9, 5)
|
|
140
|
-
metadata:SetPoint("BOTTOMRIGHT", -9, 5)
|
|
141
|
-
metadata:SetJustifyH("LEFT")
|
|
142
|
-
metadata:SetWordWrap(false)
|
|
143
|
-
metadata:SetTextColor(1, 1, 1, 0.34)
|
|
144
|
-
row.metadata = metadata
|
|
145
|
-
row:SetScript("OnEnter", function(self)
|
|
146
|
-
self.isHovered = true
|
|
147
|
-
ApplyErrorRowStyle(self)
|
|
148
|
-
end)
|
|
149
|
-
row:SetScript("OnLeave", function(self)
|
|
150
|
-
self.isHovered = nil
|
|
151
|
-
ApplyErrorRowStyle(self)
|
|
152
|
-
end)
|
|
153
|
-
row:SetScript("OnClick", function(self)
|
|
154
|
-
selectedError = self.errorEntry
|
|
155
|
-
SetReadOnlyText(reportPanel, ns.Diagnostics.FormatAgentReport(selectedError))
|
|
156
|
-
page:RefreshErrors()
|
|
157
|
-
end)
|
|
158
|
-
errorRows[index] = row
|
|
159
|
-
return row
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
function page:RefreshErrors()
|
|
163
|
-
for index = 1, #errorRows do errorRows[index]:Hide() end
|
|
164
|
-
local offset = errorScroll:GetVerticalScroll()
|
|
165
|
-
if issecretvalue and issecretvalue(offset) then offset = 0 end
|
|
166
|
-
local first = math.floor((offset or 0) / ERROR_ROW_HEIGHT) + 1
|
|
167
|
-
local last = math.min(#errors, first + VISIBLE_ROWS - 1)
|
|
168
|
-
local pool = 0
|
|
169
|
-
for itemIndex = first, last do
|
|
170
|
-
pool = pool + 1
|
|
171
|
-
local entry = errors[itemIndex]
|
|
172
|
-
local row = errorRows[pool] or CreateErrorRow(pool)
|
|
173
|
-
row.errorEntry = entry
|
|
174
|
-
row:ClearAllPoints()
|
|
175
|
-
row:SetPoint("TOPLEFT", 0, -((itemIndex - 1) * ERROR_ROW_HEIGHT))
|
|
176
|
-
row.message:SetText((tostring(entry.message or "")):match("([^\r\n]+)") or L.UNKNOWN_ERROR)
|
|
177
|
-
row.count:SetText("x" .. (tonumber(entry.counter) or 1))
|
|
178
|
-
row.metadata:SetText(string.format(L.ERROR_ROW_META,
|
|
179
|
-
tonumber(entry.session) or -1,
|
|
180
|
-
tonumber(entry.time) and date("%m-%d %H:%M:%S", entry.time) or L.UNKNOWN_TIME))
|
|
181
|
-
ApplyErrorRowStyle(row)
|
|
182
|
-
row:Show()
|
|
183
|
-
end
|
|
184
|
-
errorContent:SetHeight(math.max(1, #errors * ERROR_ROW_HEIGHT))
|
|
185
|
-
errorScroll:UpdateScrollChildRect()
|
|
186
|
-
errorEmpty:SetShown(#errors == 0)
|
|
187
|
-
ui.SetButtonEnabled(clearButton, #errors > 0)
|
|
188
|
-
ui.SetButtonEnabled(selectReport, selectedError ~= nil)
|
|
189
|
-
ui.SetButtonEnabled(exportReport, #errors > 0)
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
local function RefreshErrorsFromSource()
|
|
193
|
-
confirmClear = false
|
|
194
|
-
ui.SetButtonText(clearButton, L.CLEAR_ERRORS)
|
|
195
|
-
ui.SetButtonVariant(clearButton, "secondary")
|
|
196
|
-
local succeeded, snapshot, errorMessage = ns.Diagnostics.GetErrors(scope, searchPanel.editBox:GetText())
|
|
197
|
-
if not succeeded then
|
|
198
|
-
SetStatus(errorMessage, true)
|
|
199
|
-
return
|
|
200
|
-
end
|
|
201
|
-
errors = snapshot.errors
|
|
202
|
-
selectedError = nil
|
|
203
|
-
SetReadOnlyText(reportPanel, L.SELECT_ERROR_DETAIL)
|
|
204
|
-
SetStatus(string.format(scope == "current" and L.CURRENT_ERRORS_STATUS or L.ALL_ERRORS_STATUS, #errors), false)
|
|
205
|
-
page:RefreshErrors()
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
local function SetScope(newScope)
|
|
209
|
-
scope = newScope
|
|
210
|
-
ui.SetButtonVariant(currentScope, scope == "current" and "selected" or "secondary")
|
|
211
|
-
ui.SetButtonVariant(allScope, scope == "all" and "selected" or "secondary")
|
|
212
|
-
RefreshErrorsFromSource()
|
|
213
|
-
end
|
|
214
|
-
|
|
215
|
-
local function QueueErrorRefresh()
|
|
216
|
-
if refreshQueued then return end
|
|
217
|
-
refreshQueued = true
|
|
218
|
-
C_Timer.After(0, function()
|
|
219
|
-
refreshQueued = false
|
|
220
|
-
if page:IsShown() then
|
|
221
|
-
RefreshErrorsFromSource()
|
|
222
|
-
end
|
|
223
|
-
end)
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
local function RegisterErrorCallback()
|
|
227
|
-
if callbackRegistered or not EventRegistry then return end
|
|
228
|
-
EventRegistry:RegisterCallback("BugGrabber.BugGrabbed", QueueErrorRefresh, callbackOwner)
|
|
229
|
-
callbackRegistered = true
|
|
230
|
-
end
|
|
231
|
-
|
|
232
|
-
local function UnregisterErrorCallback()
|
|
233
|
-
if not callbackRegistered or not EventRegistry then return end
|
|
234
|
-
EventRegistry:UnregisterCallback("BugGrabber.BugGrabbed", callbackOwner)
|
|
235
|
-
callbackRegistered = false
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
errorScroll.onVerticalScrollChanged = function() page:RefreshErrors() end
|
|
239
|
-
currentScope:SetScript("OnClick", function() SetScope("current") end)
|
|
240
|
-
allScope:SetScript("OnClick", function() SetScope("all") end)
|
|
241
|
-
searchButton:SetScript("OnClick", RefreshErrorsFromSource)
|
|
242
|
-
searchPanel.editBox:SetScript("OnEnterPressed", RefreshErrorsFromSource)
|
|
243
|
-
selectReport:SetScript("OnClick", function()
|
|
244
|
-
if selectedError then
|
|
245
|
-
SetReadOnlyText(reportPanel, ns.Diagnostics.FormatAgentReport(selectedError))
|
|
246
|
-
reportPanel:SelectAll()
|
|
247
|
-
else
|
|
248
|
-
SetStatus(L.SELECT_ERROR_FIRST, true)
|
|
249
|
-
end
|
|
250
|
-
end)
|
|
251
|
-
exportReport:SetScript("OnClick", function()
|
|
252
|
-
if #errors > 0 then
|
|
253
|
-
ui.ExportText("error_log", L.ERROR_LIST, function()
|
|
254
|
-
return ns.SerializeForExport(errors)
|
|
255
|
-
end, { scope = scope, query = searchPanel.editBox:GetText(), recordCount = #errors })
|
|
256
|
-
else
|
|
257
|
-
SetStatus(L.NO_ERRORS, true)
|
|
258
|
-
end
|
|
259
|
-
end)
|
|
260
|
-
refreshButton:SetScript("OnClick", RefreshErrorsFromSource)
|
|
261
|
-
clearButton:SetScript("OnClick", function()
|
|
262
|
-
if not confirmClear then
|
|
263
|
-
confirmClear = true
|
|
264
|
-
ui.SetButtonText(clearButton, L.CONFIRM_CLEAR_ERRORS)
|
|
265
|
-
ui.SetButtonVariant(clearButton, "danger")
|
|
266
|
-
SetStatus(L.CONFIRM_CLEAR_ERRORS, true)
|
|
267
|
-
return
|
|
268
|
-
end
|
|
269
|
-
local succeeded, message = ns.Diagnostics.ResetErrors()
|
|
270
|
-
SetStatus(message, not succeeded)
|
|
271
|
-
if succeeded then RefreshErrorsFromSource() end
|
|
272
|
-
end)
|
|
273
|
-
|
|
274
|
-
page:SetScript("OnShow", RegisterErrorCallback)
|
|
275
|
-
page:SetScript("OnHide", UnregisterErrorCallback)
|
|
276
|
-
|
|
277
|
-
function page:Activate()
|
|
278
|
-
RefreshErrorsFromSource()
|
|
279
|
-
end
|
|
280
|
-
function page:Stop()
|
|
281
|
-
UnregisterErrorCallback()
|
|
282
|
-
end
|
|
283
|
-
|
|
284
|
-
ui.SetButtonEnabled(clearButton, false)
|
|
285
|
-
ui.SetButtonEnabled(selectReport, false)
|
|
286
|
-
ui.SetButtonEnabled(exportReport, false)
|
|
287
|
-
SetStatus(L.READY, false)
|
|
288
|
-
return page
|
|
289
|
-
end
|
|
1
|
+
local ADDON_NAME, ns = ...
|
|
2
|
+
local L = ns.L
|
|
3
|
+
|
|
4
|
+
local ERROR_ROW_HEIGHT = 44
|
|
5
|
+
local ERROR_LIST_WIDTH = 430
|
|
6
|
+
local VISIBLE_ROWS = 16
|
|
7
|
+
|
|
8
|
+
local function SetReadOnlyText(panel, text, selectAll)
|
|
9
|
+
local editBox = panel.editBox
|
|
10
|
+
editBox.savedText, editBox.updatingText = text or "", true
|
|
11
|
+
editBox:SetText(text or "")
|
|
12
|
+
editBox.updatingText = nil
|
|
13
|
+
editBox:SetCursorPosition(0)
|
|
14
|
+
panel.scroll:SetVerticalScroll(0)
|
|
15
|
+
if selectAll then
|
|
16
|
+
editBox:SetFocus()
|
|
17
|
+
editBox:HighlightText()
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
local function CreateLineInput(parent, ui)
|
|
22
|
+
local panel = ui.CreatePanel(parent, ui.editorR, ui.editorG, ui.editorB, 1)
|
|
23
|
+
local editBox = CreateFrame("EditBox", nil, panel)
|
|
24
|
+
editBox:SetAutoFocus(false)
|
|
25
|
+
editBox:SetFontObject(ChatFontNormal)
|
|
26
|
+
editBox:SetTextColor(0.94, 0.95, 0.96)
|
|
27
|
+
editBox:SetTextInsets(9, 9, 0, 0)
|
|
28
|
+
editBox:SetPoint("TOPLEFT", 1, -1)
|
|
29
|
+
editBox:SetPoint("BOTTOMRIGHT", -1, 1)
|
|
30
|
+
editBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
|
|
31
|
+
editBox:SetScript("OnEditFocusGained", function() ui.SetBorderColor(panel, true, 0.75) end)
|
|
32
|
+
editBox:SetScript("OnEditFocusLost", function() ui.SetBorderColor(panel, false) end)
|
|
33
|
+
panel.editBox = editBox
|
|
34
|
+
return panel
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
function ns.CreateDiagnosticsPage(parent, ui)
|
|
38
|
+
local page = CreateFrame("Frame", nil, parent)
|
|
39
|
+
page:SetAllPoints(parent)
|
|
40
|
+
|
|
41
|
+
local refreshButton = ui.CreateButton(page, 92, L.REFRESH, false)
|
|
42
|
+
refreshButton:SetPoint("TOPRIGHT", -14, -84)
|
|
43
|
+
local clearButton = ui.CreateButton(page, 178, L.CLEAR_ERRORS, false)
|
|
44
|
+
clearButton:SetPoint("RIGHT", refreshButton, "LEFT", -8, 0)
|
|
45
|
+
|
|
46
|
+
local status = page:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
47
|
+
status:SetPoint("TOPLEFT", 17, -94)
|
|
48
|
+
status:SetPoint("RIGHT", clearButton, "LEFT", -10, 0)
|
|
49
|
+
status:SetJustifyH("LEFT")
|
|
50
|
+
local function SetStatus(text, errorState)
|
|
51
|
+
local r = errorState and ui.accentR or 0.55
|
|
52
|
+
local g = errorState and ui.accentG or 0.60
|
|
53
|
+
local b = errorState and ui.accentB or 0.65
|
|
54
|
+
status:SetText(text or "")
|
|
55
|
+
status:SetTextColor(r, g, b, 0.92)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
local errorsView = CreateFrame("Frame", nil, page)
|
|
59
|
+
errorsView:SetPoint("TOPLEFT", 0, -126)
|
|
60
|
+
errorsView:SetPoint("BOTTOMRIGHT")
|
|
61
|
+
|
|
62
|
+
local currentScope = ui.CreateButton(errorsView, 104, L.CURRENT_SESSION, "selected")
|
|
63
|
+
currentScope:SetPoint("TOPLEFT", 14, 0)
|
|
64
|
+
local allScope = ui.CreateButton(errorsView, 104, L.ALL_SESSIONS, false)
|
|
65
|
+
allScope:SetPoint("LEFT", currentScope, "RIGHT", 8, 0)
|
|
66
|
+
local searchPanel = CreateLineInput(errorsView, ui)
|
|
67
|
+
searchPanel:SetPoint("TOPLEFT", allScope, "TOPRIGHT", 14, 0)
|
|
68
|
+
searchPanel:SetWidth(260)
|
|
69
|
+
searchPanel:SetHeight(28)
|
|
70
|
+
local searchButton = ui.CreateButton(errorsView, 76, L.SEARCH, false)
|
|
71
|
+
searchButton:SetPoint("LEFT", searchPanel, "RIGHT", 8, 0)
|
|
72
|
+
local selectReport = ui.CreateButton(errorsView, 110, L.SELECT_REPORT, false)
|
|
73
|
+
selectReport:SetPoint("TOPRIGHT", -14, 0)
|
|
74
|
+
local exportReport = ui.CreateButton(errorsView, 92, L.SAVE_TO_DISK, false)
|
|
75
|
+
exportReport:SetPoint("RIGHT", selectReport, "LEFT", -8, 0)
|
|
76
|
+
page.currentScope = currentScope
|
|
77
|
+
page.allScope = allScope
|
|
78
|
+
page.refreshButton = refreshButton
|
|
79
|
+
page.clearButton = clearButton
|
|
80
|
+
page.selectReport = selectReport
|
|
81
|
+
page.exportReport = exportReport
|
|
82
|
+
|
|
83
|
+
local listLabel = ui.CreateSectionLabel(errorsView, L.ERROR_LIST)
|
|
84
|
+
listLabel:SetPoint("TOPLEFT", 17, -48)
|
|
85
|
+
local reportLabel = ui.CreateSectionLabel(errorsView, L.AGENT_REPORT)
|
|
86
|
+
reportLabel:SetPoint("TOPLEFT", ERROR_LIST_WIDTH + 29, -48)
|
|
87
|
+
|
|
88
|
+
local listPanel = ui.CreatePanel(errorsView, ui.editorR, ui.editorG, ui.editorB, 0.78)
|
|
89
|
+
listPanel:SetPoint("TOPLEFT", 14, -68)
|
|
90
|
+
listPanel:SetPoint("BOTTOMLEFT", 14, 54)
|
|
91
|
+
listPanel:SetWidth(ERROR_LIST_WIDTH)
|
|
92
|
+
local errorScroll = ui.CreateScrollArea(listPanel, 8, 8, 7, 8)
|
|
93
|
+
local errorContent = CreateFrame("Frame", nil, errorScroll)
|
|
94
|
+
errorContent:SetWidth(ERROR_LIST_WIDTH - 26)
|
|
95
|
+
errorContent:SetHeight(1)
|
|
96
|
+
errorScroll:SetScrollChild(errorContent)
|
|
97
|
+
local errorEmpty = listPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
98
|
+
errorEmpty:SetPoint("TOP", 0, -24)
|
|
99
|
+
errorEmpty:SetText(L.NO_ERRORS)
|
|
100
|
+
errorEmpty:SetTextColor(1, 1, 1, 0.32)
|
|
101
|
+
|
|
102
|
+
local reportPanel = ui.CreateTextArea(errorsView, true)
|
|
103
|
+
reportPanel:SetPoint("TOPLEFT", ERROR_LIST_WIDTH + 26, -68)
|
|
104
|
+
reportPanel:SetPoint("BOTTOMRIGHT", -14, 54)
|
|
105
|
+
reportPanel.editBox:SetWidth(ui.windowWidth - ERROR_LIST_WIDTH - 78)
|
|
106
|
+
reportPanel.editBox:SetScript("OnMouseUp", function(self)
|
|
107
|
+
self:SetFocus()
|
|
108
|
+
end)
|
|
109
|
+
SetReadOnlyText(reportPanel, L.SELECT_ERROR_DETAIL)
|
|
110
|
+
|
|
111
|
+
local errors = {}
|
|
112
|
+
local selectedError
|
|
113
|
+
local errorRows = {}
|
|
114
|
+
local scope = "current"
|
|
115
|
+
local confirmClear = false
|
|
116
|
+
local callbackOwner = {}
|
|
117
|
+
local callbackRegistered = false
|
|
118
|
+
local refreshQueued = false
|
|
119
|
+
|
|
120
|
+
local function ApplyErrorRowStyle(row)
|
|
121
|
+
local selected = row.errorEntry == selectedError
|
|
122
|
+
ui.SetListRowState(row, selected, row.isHovered)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
local function CreateErrorRow(index)
|
|
126
|
+
local row = ui.CreateListRow(errorContent, ERROR_ROW_HEIGHT)
|
|
127
|
+
row:SetWidth(ERROR_LIST_WIDTH - 26)
|
|
128
|
+
local message = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
129
|
+
message:SetPoint("TOPLEFT", 9, -6)
|
|
130
|
+
message:SetPoint("TOPRIGHT", -54, -6)
|
|
131
|
+
message:SetJustifyH("LEFT")
|
|
132
|
+
message:SetWordWrap(false)
|
|
133
|
+
row.message = message
|
|
134
|
+
local count = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
135
|
+
count:SetPoint("TOPRIGHT", -9, -6)
|
|
136
|
+
count:SetTextColor(1, 1, 1, 0.42)
|
|
137
|
+
row.count = count
|
|
138
|
+
local metadata = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
139
|
+
metadata:SetPoint("BOTTOMLEFT", 9, 5)
|
|
140
|
+
metadata:SetPoint("BOTTOMRIGHT", -9, 5)
|
|
141
|
+
metadata:SetJustifyH("LEFT")
|
|
142
|
+
metadata:SetWordWrap(false)
|
|
143
|
+
metadata:SetTextColor(1, 1, 1, 0.34)
|
|
144
|
+
row.metadata = metadata
|
|
145
|
+
row:SetScript("OnEnter", function(self)
|
|
146
|
+
self.isHovered = true
|
|
147
|
+
ApplyErrorRowStyle(self)
|
|
148
|
+
end)
|
|
149
|
+
row:SetScript("OnLeave", function(self)
|
|
150
|
+
self.isHovered = nil
|
|
151
|
+
ApplyErrorRowStyle(self)
|
|
152
|
+
end)
|
|
153
|
+
row:SetScript("OnClick", function(self)
|
|
154
|
+
selectedError = self.errorEntry
|
|
155
|
+
SetReadOnlyText(reportPanel, ns.Diagnostics.FormatAgentReport(selectedError))
|
|
156
|
+
page:RefreshErrors()
|
|
157
|
+
end)
|
|
158
|
+
errorRows[index] = row
|
|
159
|
+
return row
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
function page:RefreshErrors()
|
|
163
|
+
for index = 1, #errorRows do errorRows[index]:Hide() end
|
|
164
|
+
local offset = errorScroll:GetVerticalScroll()
|
|
165
|
+
if issecretvalue and issecretvalue(offset) then offset = 0 end
|
|
166
|
+
local first = math.floor((offset or 0) / ERROR_ROW_HEIGHT) + 1
|
|
167
|
+
local last = math.min(#errors, first + VISIBLE_ROWS - 1)
|
|
168
|
+
local pool = 0
|
|
169
|
+
for itemIndex = first, last do
|
|
170
|
+
pool = pool + 1
|
|
171
|
+
local entry = errors[itemIndex]
|
|
172
|
+
local row = errorRows[pool] or CreateErrorRow(pool)
|
|
173
|
+
row.errorEntry = entry
|
|
174
|
+
row:ClearAllPoints()
|
|
175
|
+
row:SetPoint("TOPLEFT", 0, -((itemIndex - 1) * ERROR_ROW_HEIGHT))
|
|
176
|
+
row.message:SetText((tostring(entry.message or "")):match("([^\r\n]+)") or L.UNKNOWN_ERROR)
|
|
177
|
+
row.count:SetText("x" .. (tonumber(entry.counter) or 1))
|
|
178
|
+
row.metadata:SetText(string.format(L.ERROR_ROW_META,
|
|
179
|
+
tonumber(entry.session) or -1,
|
|
180
|
+
tonumber(entry.time) and date("%m-%d %H:%M:%S", entry.time) or L.UNKNOWN_TIME))
|
|
181
|
+
ApplyErrorRowStyle(row)
|
|
182
|
+
row:Show()
|
|
183
|
+
end
|
|
184
|
+
errorContent:SetHeight(math.max(1, #errors * ERROR_ROW_HEIGHT))
|
|
185
|
+
errorScroll:UpdateScrollChildRect()
|
|
186
|
+
errorEmpty:SetShown(#errors == 0)
|
|
187
|
+
ui.SetButtonEnabled(clearButton, #errors > 0)
|
|
188
|
+
ui.SetButtonEnabled(selectReport, selectedError ~= nil)
|
|
189
|
+
ui.SetButtonEnabled(exportReport, #errors > 0)
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
local function RefreshErrorsFromSource()
|
|
193
|
+
confirmClear = false
|
|
194
|
+
ui.SetButtonText(clearButton, L.CLEAR_ERRORS)
|
|
195
|
+
ui.SetButtonVariant(clearButton, "secondary")
|
|
196
|
+
local succeeded, snapshot, errorMessage = ns.Diagnostics.GetErrors(scope, searchPanel.editBox:GetText())
|
|
197
|
+
if not succeeded then
|
|
198
|
+
SetStatus(errorMessage, true)
|
|
199
|
+
return
|
|
200
|
+
end
|
|
201
|
+
errors = snapshot.errors
|
|
202
|
+
selectedError = nil
|
|
203
|
+
SetReadOnlyText(reportPanel, L.SELECT_ERROR_DETAIL)
|
|
204
|
+
SetStatus(string.format(scope == "current" and L.CURRENT_ERRORS_STATUS or L.ALL_ERRORS_STATUS, #errors), false)
|
|
205
|
+
page:RefreshErrors()
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
local function SetScope(newScope)
|
|
209
|
+
scope = newScope
|
|
210
|
+
ui.SetButtonVariant(currentScope, scope == "current" and "selected" or "secondary")
|
|
211
|
+
ui.SetButtonVariant(allScope, scope == "all" and "selected" or "secondary")
|
|
212
|
+
RefreshErrorsFromSource()
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
local function QueueErrorRefresh()
|
|
216
|
+
if refreshQueued then return end
|
|
217
|
+
refreshQueued = true
|
|
218
|
+
C_Timer.After(0, function()
|
|
219
|
+
refreshQueued = false
|
|
220
|
+
if page:IsShown() then
|
|
221
|
+
RefreshErrorsFromSource()
|
|
222
|
+
end
|
|
223
|
+
end)
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
local function RegisterErrorCallback()
|
|
227
|
+
if callbackRegistered or not EventRegistry then return end
|
|
228
|
+
EventRegistry:RegisterCallback("BugGrabber.BugGrabbed", QueueErrorRefresh, callbackOwner)
|
|
229
|
+
callbackRegistered = true
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
local function UnregisterErrorCallback()
|
|
233
|
+
if not callbackRegistered or not EventRegistry then return end
|
|
234
|
+
EventRegistry:UnregisterCallback("BugGrabber.BugGrabbed", callbackOwner)
|
|
235
|
+
callbackRegistered = false
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
errorScroll.onVerticalScrollChanged = function() page:RefreshErrors() end
|
|
239
|
+
currentScope:SetScript("OnClick", function() SetScope("current") end)
|
|
240
|
+
allScope:SetScript("OnClick", function() SetScope("all") end)
|
|
241
|
+
searchButton:SetScript("OnClick", RefreshErrorsFromSource)
|
|
242
|
+
searchPanel.editBox:SetScript("OnEnterPressed", RefreshErrorsFromSource)
|
|
243
|
+
selectReport:SetScript("OnClick", function()
|
|
244
|
+
if selectedError then
|
|
245
|
+
SetReadOnlyText(reportPanel, ns.Diagnostics.FormatAgentReport(selectedError))
|
|
246
|
+
reportPanel:SelectAll()
|
|
247
|
+
else
|
|
248
|
+
SetStatus(L.SELECT_ERROR_FIRST, true)
|
|
249
|
+
end
|
|
250
|
+
end)
|
|
251
|
+
exportReport:SetScript("OnClick", function()
|
|
252
|
+
if #errors > 0 then
|
|
253
|
+
ui.ExportText("error_log", L.ERROR_LIST, function()
|
|
254
|
+
return ns.SerializeForExport(errors)
|
|
255
|
+
end, { scope = scope, query = searchPanel.editBox:GetText(), recordCount = #errors })
|
|
256
|
+
else
|
|
257
|
+
SetStatus(L.NO_ERRORS, true)
|
|
258
|
+
end
|
|
259
|
+
end)
|
|
260
|
+
refreshButton:SetScript("OnClick", RefreshErrorsFromSource)
|
|
261
|
+
clearButton:SetScript("OnClick", function()
|
|
262
|
+
if not confirmClear then
|
|
263
|
+
confirmClear = true
|
|
264
|
+
ui.SetButtonText(clearButton, L.CONFIRM_CLEAR_ERRORS)
|
|
265
|
+
ui.SetButtonVariant(clearButton, "danger")
|
|
266
|
+
SetStatus(L.CONFIRM_CLEAR_ERRORS, true)
|
|
267
|
+
return
|
|
268
|
+
end
|
|
269
|
+
local succeeded, message = ns.Diagnostics.ResetErrors()
|
|
270
|
+
SetStatus(message, not succeeded)
|
|
271
|
+
if succeeded then RefreshErrorsFromSource() end
|
|
272
|
+
end)
|
|
273
|
+
|
|
274
|
+
page:SetScript("OnShow", RegisterErrorCallback)
|
|
275
|
+
page:SetScript("OnHide", UnregisterErrorCallback)
|
|
276
|
+
|
|
277
|
+
function page:Activate()
|
|
278
|
+
RefreshErrorsFromSource()
|
|
279
|
+
end
|
|
280
|
+
function page:Stop()
|
|
281
|
+
UnregisterErrorCallback()
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
ui.SetButtonEnabled(clearButton, false)
|
|
285
|
+
ui.SetButtonEnabled(selectReport, false)
|
|
286
|
+
ui.SetButtonEnabled(exportReport, false)
|
|
287
|
+
SetStatus(L.READY, false)
|
|
288
|
+
return page
|
|
289
|
+
end
|