lycheedev 1.0.0
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 +257 -0
- package/package.json +42 -0
- package/src/addon.js +87 -0
- package/src/config.js +64 -0
- package/src/doctor.js +100 -0
- package/src/install.js +131 -0
- package/src/paths.js +93 -0
- package/src/python.js +107 -0
- package/src/skill.js +48 -0
- package/src/wow.js +110 -0
- package/vendor/addon/Core/Bootstrap.lua +131 -0
- package/vendor/addon/Core/Clients/Mainline.lua +9 -0
- package/vendor/addon/Core/Clients/Mists.lua +9 -0
- package/vendor/addon/Core/Clients/Titan.lua +9 -0
- package/vendor/addon/Core/Compatibility.lua +43 -0
- package/vendor/addon/Core/Database.lua +859 -0
- package/vendor/addon/Core/Inspector.lua +647 -0
- package/vendor/addon/Core/Locale.lua +307 -0
- package/vendor/addon/Core/Locale_enUS.lua +318 -0
- package/vendor/addon/Core/Safety.lua +42 -0
- package/vendor/addon/Core/Serializer.lua +324 -0
- package/vendor/addon/Libs/AutomationQR.lua +1176 -0
- package/vendor/addon/Lychee Dev_Mainline.toc +43 -0
- package/vendor/addon/Lychee Dev_Mists.toc +43 -0
- package/vendor/addon/Lychee Dev_Wrath.toc +43 -0
- package/vendor/addon/Media/GitHub.png +0 -0
- package/vendor/addon/Media/Logo.png +0 -0
- package/vendor/addon/Modules/Automation/Controller.lua +757 -0
- package/vendor/addon/Modules/Automation/Report.lua +409 -0
- package/vendor/addon/Modules/Automation/auto/auto.lua +12 -0
- package/vendor/addon/Modules/Diagnostics.lua +238 -0
- package/vendor/addon/Modules/Events/Catalog.lua +184 -0
- package/vendor/addon/Modules/Events/CatalogData_Mainline.lua +1788 -0
- package/vendor/addon/Modules/Events/CatalogData_Mists.lua +1489 -0
- package/vendor/addon/Modules/Events/CatalogData_Titan.lua +1492 -0
- package/vendor/addon/Modules/Events/Monitor.lua +181 -0
- package/vendor/addon/Modules/FunctionTrace.lua +85 -0
- package/vendor/addon/Modules/ObjectInspector.lua +329 -0
- package/vendor/addon/UI/AutomationOverlay.lua +183 -0
- package/vendor/addon/UI/Export.lua +140 -0
- package/vendor/addon/UI/Features.lua +890 -0
- package/vendor/addon/UI/MainWindow.lua +1145 -0
- package/vendor/addon/UI/Pages/About.lua +223 -0
- package/vendor/addon/UI/Pages/Automation.lua +417 -0
- package/vendor/addon/UI/Pages/Diagnostics.lua +289 -0
- package/vendor/addon/UI/Pages/ExportRecords.lua +387 -0
- package/vendor/addon/UI/Pages/Object.lua +573 -0
- package/vendor/addon/UI/Pages/Trace.lua +165 -0
- package/vendor/skill/SKILL.md +94 -0
- package/vendor/skill/agents/openai.yaml +4 -0
- package/vendor/skill/references/automation.md +327 -0
- package/vendor/skill/references/runtime-investigations.md +97 -0
- package/vendor/skill/scripts/automation/__init__.py +1 -0
- package/vendor/skill/scripts/automation/registry.py +516 -0
- package/vendor/skill/scripts/automation/saved_variables.py +438 -0
- package/vendor/skill/scripts/automation/session.py +207 -0
- package/vendor/skill/scripts/automation/windows.py +573 -0
- package/vendor/skill/scripts/automation.py +865 -0
- package/vendor/skill/scripts/requirements.txt +13 -0
- package/vendor/skill/scripts/selftest_offline.py +981 -0
|
@@ -0,0 +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
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
local ADDON_NAME, ns = ...
|
|
2
|
+
local L = ns.L
|
|
3
|
+
|
|
4
|
+
local ROW_HEIGHT = 58
|
|
5
|
+
local LIST_WIDTH = 354
|
|
6
|
+
|
|
7
|
+
local KIND_LABELS = {
|
|
8
|
+
run_result = L.EXPORT_KIND_RUN_RESULT,
|
|
9
|
+
object_snapshot = L.EXPORT_KIND_OBJECT_SNAPSHOT,
|
|
10
|
+
object_node = L.EXPORT_KIND_OBJECT_NODE,
|
|
11
|
+
event_log = L.EXPORT_KIND_EVENT_LOG,
|
|
12
|
+
function_trace = L.EXPORT_KIND_FUNCTION_TRACE,
|
|
13
|
+
error_log = L.EXPORT_KIND_ERROR_LOG,
|
|
14
|
+
-- Historical evidence remains readable after removal of the performance tools.
|
|
15
|
+
performance_snapshot = L.EXPORT_KIND_PERFORMANCE,
|
|
16
|
+
performance_health = L.EXPORT_KIND_PERFORMANCE,
|
|
17
|
+
performance_capture = L.EXPORT_KIND_PERFORMANCE,
|
|
18
|
+
performance_benchmark = L.EXPORT_KIND_PERFORMANCE,
|
|
19
|
+
performance_storage = L.EXPORT_KIND_PERFORMANCE,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
local function FormatBytes(bytes)
|
|
23
|
+
bytes = math.max(0, tonumber(bytes) or 0)
|
|
24
|
+
if bytes >= 1024 * 1024 then
|
|
25
|
+
return string.format("%.2f MB", bytes / 1024 / 1024)
|
|
26
|
+
elseif bytes >= 1024 then
|
|
27
|
+
return string.format("%.1f KB", bytes / 1024)
|
|
28
|
+
end
|
|
29
|
+
return string.format("%d B", bytes)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
local function FormatTime(timestamp)
|
|
33
|
+
timestamp = tonumber(timestamp) or 0
|
|
34
|
+
if timestamp <= 0 then
|
|
35
|
+
return L.UNKNOWN
|
|
36
|
+
end
|
|
37
|
+
return date("%Y-%m-%d %H:%M:%S", timestamp)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
local function GetKindLabel(kind)
|
|
41
|
+
return KIND_LABELS[kind] or L.EXPORT_KIND_UNKNOWN
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
local function CreateField(parent, labelText, x, y, width)
|
|
45
|
+
local label = parent:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
46
|
+
label:SetPoint("TOPLEFT", x, y)
|
|
47
|
+
label:SetText(labelText)
|
|
48
|
+
label:SetTextColor(1, 1, 1, 0.34)
|
|
49
|
+
|
|
50
|
+
local value = parent:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
51
|
+
value:SetPoint("TOPLEFT", x, y - 20)
|
|
52
|
+
value:SetWidth(width)
|
|
53
|
+
value:SetJustifyH("LEFT")
|
|
54
|
+
value:SetWordWrap(false)
|
|
55
|
+
value:SetTextColor(0.91, 0.93, 0.95, 0.92)
|
|
56
|
+
return value
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
function ns.CreateExportRecordsPage(parent, ui)
|
|
60
|
+
local page = CreateFrame("Frame", nil, parent)
|
|
61
|
+
page:SetAllPoints(parent)
|
|
62
|
+
|
|
63
|
+
local selectedTicket
|
|
64
|
+
local rows = {}
|
|
65
|
+
local deleteConfirmed = false
|
|
66
|
+
local clearConfirmed = false
|
|
67
|
+
|
|
68
|
+
local heading = ui.CreateSectionLabel(page, L.EXPORT_RECORDS)
|
|
69
|
+
heading:SetPoint("TOPLEFT", 17, -84)
|
|
70
|
+
|
|
71
|
+
local countText = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
72
|
+
countText:SetPoint("LEFT", heading, "RIGHT", 12, 0)
|
|
73
|
+
countText:SetTextColor(1, 1, 1, 0.36)
|
|
74
|
+
|
|
75
|
+
local pendingText = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
76
|
+
pendingText:SetPoint("LEFT", countText, "RIGHT", 12, 0)
|
|
77
|
+
pendingText:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.92)
|
|
78
|
+
|
|
79
|
+
local clearButton = ui.CreateButton(page, 120, L.CLEAR_EXPORT_CACHE, false)
|
|
80
|
+
clearButton:SetPoint("TOPRIGHT", -14, -77)
|
|
81
|
+
|
|
82
|
+
local usageText = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
83
|
+
usageText:SetPoint("RIGHT", clearButton, "LEFT", -12, 0)
|
|
84
|
+
usageText:SetTextColor(1, 1, 1, 0.34)
|
|
85
|
+
|
|
86
|
+
local listPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.78)
|
|
87
|
+
listPanel:SetPoint("TOPLEFT", 14, -108)
|
|
88
|
+
listPanel:SetPoint("BOTTOMLEFT", 14, 54)
|
|
89
|
+
listPanel:SetWidth(LIST_WIDTH)
|
|
90
|
+
|
|
91
|
+
local listScroll = ui.CreateScrollArea(listPanel, 8, 8, 7, 8)
|
|
92
|
+
local listContent = CreateFrame("Frame", nil, listScroll)
|
|
93
|
+
listContent:SetWidth(LIST_WIDTH - 26)
|
|
94
|
+
listContent:SetHeight(1)
|
|
95
|
+
listScroll:SetScrollChild(listContent)
|
|
96
|
+
|
|
97
|
+
local emptyTitle = listPanel:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
|
98
|
+
emptyTitle:SetPoint("CENTER", listPanel, "CENTER", 0, 14)
|
|
99
|
+
emptyTitle:SetText(L.EXPORT_RECORDS_EMPTY)
|
|
100
|
+
emptyTitle:SetTextColor(1, 1, 1, 0.58)
|
|
101
|
+
|
|
102
|
+
local emptyHelp = listPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
103
|
+
emptyHelp:SetPoint("TOP", emptyTitle, "BOTTOM", 0, -9)
|
|
104
|
+
emptyHelp:SetWidth(270)
|
|
105
|
+
emptyHelp:SetJustifyH("CENTER")
|
|
106
|
+
emptyHelp:SetText(L.EXPORT_RECORDS_EMPTY_HELP)
|
|
107
|
+
emptyHelp:SetTextColor(1, 1, 1, 0.32)
|
|
108
|
+
|
|
109
|
+
local detailPanel = CreateFrame("Frame", nil, page)
|
|
110
|
+
detailPanel:SetPoint("TOPLEFT", listPanel, "TOPRIGHT", 12, 0)
|
|
111
|
+
detailPanel:SetPoint("BOTTOMRIGHT", -14, 54)
|
|
112
|
+
|
|
113
|
+
local detailHeading = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
|
114
|
+
detailHeading:SetPoint("TOPLEFT", 4, -4)
|
|
115
|
+
detailHeading:SetText(L.EXPORT_RECORD_DETAIL)
|
|
116
|
+
|
|
117
|
+
local detailStatus = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
118
|
+
detailStatus:SetPoint("TOPRIGHT", -4, -4)
|
|
119
|
+
|
|
120
|
+
local nameValue = CreateField(detailPanel, L.EXPORT_RECORD_NAME, 4, -48, 282)
|
|
121
|
+
local kindValue = CreateField(detailPanel, L.EXPORT_RECORD_KIND, 314, -48, 272)
|
|
122
|
+
local timeValue = CreateField(detailPanel, L.EXPORT_RECORD_TIME, 4, -106, 282)
|
|
123
|
+
local sizeValue = CreateField(detailPanel, L.EXPORT_RECORD_SIZE, 314, -106, 272)
|
|
124
|
+
local clientValue = CreateField(detailPanel, L.EXPORT_RECORD_CLIENT, 4, -164, 282)
|
|
125
|
+
local pathValue = CreateField(detailPanel, L.EXPORT_RECORD_PATH, 314, -164, 272)
|
|
126
|
+
|
|
127
|
+
local ticketLabel = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
128
|
+
ticketLabel:SetPoint("TOPLEFT", 4, -226)
|
|
129
|
+
ticketLabel:SetText(L.EXPORT_TICKET)
|
|
130
|
+
ticketLabel:SetTextColor(1, 1, 1, 0.34)
|
|
131
|
+
|
|
132
|
+
local ticketPanel = ui.CreatePanel(detailPanel, ui.editorR, ui.editorG, ui.editorB, 1)
|
|
133
|
+
ticketPanel:SetPoint("TOPLEFT", 4, -247)
|
|
134
|
+
ticketPanel:SetPoint("TOPRIGHT", -4, -247)
|
|
135
|
+
ticketPanel:SetHeight(40)
|
|
136
|
+
|
|
137
|
+
local ticketBox = CreateFrame("EditBox", nil, ticketPanel)
|
|
138
|
+
ticketBox:SetPoint("TOPLEFT", 10, -1)
|
|
139
|
+
ticketBox:SetPoint("BOTTOMRIGHT", -10, 1)
|
|
140
|
+
ticketBox:SetAutoFocus(false)
|
|
141
|
+
ticketBox:SetFontObject(ChatFontNormal)
|
|
142
|
+
ticketBox:SetTextColor(0.94, 0.95, 0.96)
|
|
143
|
+
ticketBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
|
|
144
|
+
|
|
145
|
+
local ticketHint = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
146
|
+
ticketHint:SetPoint("TOPLEFT", ticketPanel, "BOTTOMLEFT", 1, -10)
|
|
147
|
+
ticketHint:SetPoint("RIGHT", -4, 0)
|
|
148
|
+
ticketHint:SetJustifyH("LEFT")
|
|
149
|
+
ticketHint:SetText(L.EXPORT_TICKET_HELP)
|
|
150
|
+
ticketHint:SetTextColor(1, 1, 1, 0.36)
|
|
151
|
+
|
|
152
|
+
local deleteButton = ui.CreateButton(detailPanel, 128, L.EXPORT_RECORD_DELETE, false)
|
|
153
|
+
deleteButton:SetPoint("BOTTOMLEFT", 4, 4)
|
|
154
|
+
|
|
155
|
+
local reloadButton = ui.CreateButton(detailPanel, 110, L.RELOAD_NOW, true)
|
|
156
|
+
reloadButton:SetPoint("BOTTOMRIGHT", -4, 4)
|
|
157
|
+
|
|
158
|
+
local function ApplyRowState(row)
|
|
159
|
+
local selected = row.ticket == selectedTicket
|
|
160
|
+
ui.SetListRowState(row, selected, row.hovered)
|
|
161
|
+
if selected then
|
|
162
|
+
row.title:SetTextColor(1, 1, 1, 0.96)
|
|
163
|
+
elseif row.hovered then
|
|
164
|
+
row.title:SetTextColor(1, 1, 1, 0.90)
|
|
165
|
+
else
|
|
166
|
+
row.title:SetTextColor(1, 1, 1, 0.76)
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
local function RefreshDetail()
|
|
171
|
+
local entry = selectedTicket and ns.GetExport(selectedTicket) or nil
|
|
172
|
+
local hasEntry = entry ~= nil
|
|
173
|
+
local source = hasEntry and entry.source or nil
|
|
174
|
+
local payload = hasEntry and entry.payload or nil
|
|
175
|
+
local environment = hasEntry and entry.environment or nil
|
|
176
|
+
local title = source and source.title or ""
|
|
177
|
+
local kind = source and source.kind or "unknown"
|
|
178
|
+
detailHeading:SetText(hasEntry and (title ~= "" and title or L.EXPORT_RECORD_DETAIL)
|
|
179
|
+
or L.EXPORT_RECORD_DETAIL)
|
|
180
|
+
local pending = hasEntry and ns.IsExportPending(selectedTicket)
|
|
181
|
+
detailStatus:SetText(hasEntry and (pending and L.EXPORT_STATUS_PENDING or L.EXPORT_STATUS_SAVED) or "")
|
|
182
|
+
if pending then
|
|
183
|
+
detailStatus:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.94)
|
|
184
|
+
else
|
|
185
|
+
detailStatus:SetTextColor(1, 1, 1, 0.36)
|
|
186
|
+
end
|
|
187
|
+
nameValue:SetText(hasEntry and (title ~= "" and title or L.UNKNOWN) or "")
|
|
188
|
+
kindValue:SetText(hasEntry and GetKindLabel(kind) or "")
|
|
189
|
+
timeValue:SetText(hasEntry and FormatTime(entry.createdAt) or "")
|
|
190
|
+
sizeValue:SetText(hasEntry and FormatBytes(payload and payload.byteCount) or "")
|
|
191
|
+
if hasEntry and environment then
|
|
192
|
+
local version = environment.version or L.UNKNOWN
|
|
193
|
+
local build = environment.build and (" (" .. tostring(environment.build) .. ")") or ""
|
|
194
|
+
clientValue:SetText(version .. build)
|
|
195
|
+
else
|
|
196
|
+
clientValue:SetText("")
|
|
197
|
+
end
|
|
198
|
+
local path = hasEntry and source and source.path
|
|
199
|
+
pathValue:SetText(path and tostring(path) or L.NOT_AVAILABLE)
|
|
200
|
+
ticketBox.savedText = hasEntry and selectedTicket or ""
|
|
201
|
+
ticketBox.updatingText = true
|
|
202
|
+
ticketBox:SetText(ticketBox.savedText)
|
|
203
|
+
ticketBox.updatingText = nil
|
|
204
|
+
ticketHint:SetText(L.EXPORT_TICKET_HELP)
|
|
205
|
+
if hasEntry then
|
|
206
|
+
ui.SelectAllText(ticketBox)
|
|
207
|
+
else
|
|
208
|
+
ticketBox:ClearFocus()
|
|
209
|
+
end
|
|
210
|
+
ui.SetButtonEnabled(deleteButton, hasEntry)
|
|
211
|
+
deleteConfirmed = false
|
|
212
|
+
ui.SetButtonText(deleteButton, L.EXPORT_RECORD_DELETE)
|
|
213
|
+
ui.SetButtonVariant(deleteButton, "secondary")
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
local function SelectRecord(ticket)
|
|
217
|
+
selectedTicket = ns.GetExport(ticket) and ticket or nil
|
|
218
|
+
for index = 1, #rows do
|
|
219
|
+
ApplyRowState(rows[index])
|
|
220
|
+
end
|
|
221
|
+
RefreshDetail()
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
local function AcquireRow(index)
|
|
225
|
+
local row = rows[index]
|
|
226
|
+
if row then
|
|
227
|
+
return row
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
row = ui.CreateListRow(listContent, ROW_HEIGHT)
|
|
231
|
+
row:SetPoint("TOPLEFT", 0, -(index - 1) * ROW_HEIGHT)
|
|
232
|
+
row:SetPoint("TOPRIGHT", 0, -(index - 1) * ROW_HEIGHT)
|
|
233
|
+
row:EnableMouseWheel(true)
|
|
234
|
+
|
|
235
|
+
local title = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
236
|
+
title:SetPoint("TOPLEFT", 12, -10)
|
|
237
|
+
title:SetPoint("TOPRIGHT", -76, -10)
|
|
238
|
+
title:SetJustifyH("LEFT")
|
|
239
|
+
title:SetWordWrap(false)
|
|
240
|
+
row.title = title
|
|
241
|
+
|
|
242
|
+
local status = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
243
|
+
status:SetPoint("TOPRIGHT", -10, -10)
|
|
244
|
+
status:SetJustifyH("RIGHT")
|
|
245
|
+
row.status = status
|
|
246
|
+
|
|
247
|
+
local meta = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
248
|
+
meta:SetPoint("BOTTOMLEFT", 12, 9)
|
|
249
|
+
meta:SetPoint("BOTTOMRIGHT", -10, 9)
|
|
250
|
+
meta:SetJustifyH("LEFT")
|
|
251
|
+
meta:SetWordWrap(false)
|
|
252
|
+
meta:SetTextColor(1, 1, 1, 0.34)
|
|
253
|
+
row.meta = meta
|
|
254
|
+
|
|
255
|
+
row:SetScript("OnEnter", function(self)
|
|
256
|
+
self.hovered = true
|
|
257
|
+
ApplyRowState(self)
|
|
258
|
+
end)
|
|
259
|
+
row:SetScript("OnLeave", function(self)
|
|
260
|
+
self.hovered = nil
|
|
261
|
+
ApplyRowState(self)
|
|
262
|
+
end)
|
|
263
|
+
row:SetScript("OnClick", function(self)
|
|
264
|
+
SelectRecord(self.ticket)
|
|
265
|
+
end)
|
|
266
|
+
row:SetScript("OnMouseWheel", listScroll.onMouseWheel)
|
|
267
|
+
rows[index] = row
|
|
268
|
+
return row
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
local function Refresh()
|
|
272
|
+
local exports = ns.GetExports()
|
|
273
|
+
local order = exports and exports.order or {}
|
|
274
|
+
local count, bytes, maximum = ns.GetExportStats()
|
|
275
|
+
local pendingCount = ns.GetPendingExportCount()
|
|
276
|
+
countText:SetText(string.format(L.EXPORT_RECORD_COUNT, count))
|
|
277
|
+
pendingText:SetText(pendingCount > 0 and string.format(L.EXPORT_PENDING_COUNT, pendingCount) or "")
|
|
278
|
+
usageText:SetText(string.format(L.EXPORT_STORAGE_USAGE,
|
|
279
|
+
bytes / 1024, maximum / 1024 / 1024))
|
|
280
|
+
emptyTitle:SetShown(count == 0)
|
|
281
|
+
emptyHelp:SetShown(count == 0)
|
|
282
|
+
ui.SetButtonEnabled(clearButton, count > 0)
|
|
283
|
+
|
|
284
|
+
if clearConfirmed then
|
|
285
|
+
clearConfirmed = false
|
|
286
|
+
ui.SetButtonText(clearButton, L.CLEAR_EXPORT_CACHE)
|
|
287
|
+
ui.SetButtonVariant(clearButton, "secondary")
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
for index = 1, #order do
|
|
291
|
+
local ticket = order[index]
|
|
292
|
+
local entry = ns.GetExport(ticket)
|
|
293
|
+
local source = entry.source
|
|
294
|
+
local payload = entry.payload
|
|
295
|
+
local row = AcquireRow(index)
|
|
296
|
+
row.ticket = ticket
|
|
297
|
+
row.title:SetText(source.title ~= "" and source.title or ticket)
|
|
298
|
+
local pending = ns.IsExportPending(ticket)
|
|
299
|
+
row.status:SetText(pending and L.EXPORT_STATUS_PENDING or L.EXPORT_STATUS_SAVED)
|
|
300
|
+
if pending then
|
|
301
|
+
row.status:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.92)
|
|
302
|
+
else
|
|
303
|
+
row.status:SetTextColor(1, 1, 1, 0.30)
|
|
304
|
+
end
|
|
305
|
+
row.meta:SetText(FormatTime(entry.createdAt) .. " | " .. GetKindLabel(source.kind)
|
|
306
|
+
.. " | " .. FormatBytes(payload.byteCount))
|
|
307
|
+
row:Show()
|
|
308
|
+
end
|
|
309
|
+
for index = #order + 1, #rows do
|
|
310
|
+
rows[index]:Hide()
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
listContent:SetHeight(math.max(1, #order * ROW_HEIGHT))
|
|
314
|
+
listScroll:UpdateScrollChildRect()
|
|
315
|
+
ui.SetButtonEnabled(reloadButton, pendingCount > 0)
|
|
316
|
+
if not selectedTicket or not ns.GetExport(selectedTicket) then
|
|
317
|
+
selectedTicket = order[1]
|
|
318
|
+
end
|
|
319
|
+
for index = 1, #rows do
|
|
320
|
+
ApplyRowState(rows[index])
|
|
321
|
+
end
|
|
322
|
+
RefreshDetail()
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
ticketBox:SetScript("OnTextChanged", function(self)
|
|
326
|
+
if not self.updatingText and self:GetText() ~= self.savedText then
|
|
327
|
+
self.updatingText = true
|
|
328
|
+
self:SetText(self.savedText or "")
|
|
329
|
+
self.updatingText = nil
|
|
330
|
+
self:HighlightText()
|
|
331
|
+
end
|
|
332
|
+
end)
|
|
333
|
+
ticketBox:SetScript("OnMouseUp", function()
|
|
334
|
+
if selectedTicket then
|
|
335
|
+
ui.SelectAllText(ticketBox)
|
|
336
|
+
end
|
|
337
|
+
end)
|
|
338
|
+
reloadButton:SetScript("OnClick", function()
|
|
339
|
+
if ns.IsCombatBlocked() then
|
|
340
|
+
ns.PrintCombatBlocked()
|
|
341
|
+
return
|
|
342
|
+
end
|
|
343
|
+
ReloadUI()
|
|
344
|
+
end)
|
|
345
|
+
deleteButton:SetScript("OnClick", function()
|
|
346
|
+
if not selectedTicket then
|
|
347
|
+
return
|
|
348
|
+
end
|
|
349
|
+
if not deleteConfirmed then
|
|
350
|
+
deleteConfirmed = true
|
|
351
|
+
ui.SetButtonText(deleteButton, L.EXPORT_RECORD_DELETE_CONFIRM)
|
|
352
|
+
ui.SetButtonVariant(deleteButton, "danger")
|
|
353
|
+
return
|
|
354
|
+
end
|
|
355
|
+
ns.DeleteExport(selectedTicket)
|
|
356
|
+
selectedTicket = nil
|
|
357
|
+
Refresh()
|
|
358
|
+
end)
|
|
359
|
+
clearButton:SetScript("OnClick", function()
|
|
360
|
+
if not clearConfirmed then
|
|
361
|
+
clearConfirmed = true
|
|
362
|
+
ui.SetButtonText(clearButton, L.CONFIRM_CLEAR_CACHE)
|
|
363
|
+
ui.SetButtonVariant(clearButton, "danger")
|
|
364
|
+
return
|
|
365
|
+
end
|
|
366
|
+
ns.ClearExports()
|
|
367
|
+
selectedTicket = nil
|
|
368
|
+
Refresh()
|
|
369
|
+
end)
|
|
370
|
+
|
|
371
|
+
page.listScroll = listScroll
|
|
372
|
+
page.rows = rows
|
|
373
|
+
page.ticketBox = ticketBox
|
|
374
|
+
page.ticketHint = ticketHint
|
|
375
|
+
page.pendingText = pendingText
|
|
376
|
+
page.detailStatus = detailStatus
|
|
377
|
+
page.deleteButton = deleteButton
|
|
378
|
+
page.clearButton = clearButton
|
|
379
|
+
page.reloadButton = reloadButton
|
|
380
|
+
page.Refresh = Refresh
|
|
381
|
+
page.SelectRecord = SelectRecord
|
|
382
|
+
function page:Activate()
|
|
383
|
+
Refresh()
|
|
384
|
+
end
|
|
385
|
+
Refresh()
|
|
386
|
+
return page
|
|
387
|
+
end
|