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,417 +1,417 @@
|
|
|
1
|
-
local ADDON_NAME, ns = ...
|
|
2
|
-
local L = ns.L
|
|
3
|
-
|
|
4
|
-
local ROW_HEIGHT = 58
|
|
5
|
-
local LIST_WIDTH = 354
|
|
6
|
-
local REPORT_DISPLAY_BYTES = 48 * 1024
|
|
7
|
-
|
|
8
|
-
local STATUS_LABELS = {
|
|
9
|
-
running = "AUTO_STATUS_RUNNING",
|
|
10
|
-
finalizing = "AUTO_STATUS_FINALIZING",
|
|
11
|
-
succeeded = "AUTO_STATUS_SUCCEEDED",
|
|
12
|
-
failed = "AUTO_STATUS_FAILED",
|
|
13
|
-
cancelled = "AUTO_STATUS_CANCELLED",
|
|
14
|
-
interrupted = "AUTO_STATUS_INTERRUPTED",
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
local KIND_LABELS = {
|
|
18
|
-
lua = "AUTO_KIND_LUA",
|
|
19
|
-
bug_snapshot = "AUTO_KIND_BUG",
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
local function GetStatusKey(status)
|
|
23
|
-
return STATUS_LABELS[status] and L[STATUS_LABELS[status]] or tostring(status or L.UNKNOWN)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
local function GetKindLabel(kind)
|
|
27
|
-
local key = KIND_LABELS[kind]
|
|
28
|
-
return key and L[key] or L.EXPORT_KIND_UNKNOWN
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
local function FormatTime(timestamp)
|
|
32
|
-
timestamp = tonumber(timestamp) or 0
|
|
33
|
-
if timestamp <= 0 then
|
|
34
|
-
return L.UNKNOWN
|
|
35
|
-
end
|
|
36
|
-
return date("%Y-%m-%d %H:%M:%S", timestamp)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
local RESULT_STATE_LABELS = {
|
|
40
|
-
pending = "AUTO_PENDING_DISK",
|
|
41
|
-
flushed = "AUTO_LOADED_SAVED",
|
|
42
|
-
received = "AUTO_ACK_RECEIVED",
|
|
43
|
-
failed = "AUTO_ACK_FAILED",
|
|
44
|
-
expired = "AUTO_RESULT_EXPIRED",
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
-- The life cycle lives in one place (Core/Database.lua); the page only renders
|
|
48
|
-
-- it, so the notice, the list and the detail pane cannot disagree.
|
|
49
|
-
local function GetResultState(record)
|
|
50
|
-
local state = ns.AutomationResultState(record)
|
|
51
|
-
local key = RESULT_STATE_LABELS[state]
|
|
52
|
-
return key and L[key] or "-"
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
local function CreateField(parent, labelText, x, y, width)
|
|
56
|
-
local label = parent:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
57
|
-
label:SetPoint("TOPLEFT", x, y)
|
|
58
|
-
label:SetText(labelText)
|
|
59
|
-
label:SetTextColor(1, 1, 1, 0.34)
|
|
60
|
-
|
|
61
|
-
local value = parent:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
62
|
-
value:SetPoint("TOPLEFT", x, y - 20)
|
|
63
|
-
value:SetWidth(width)
|
|
64
|
-
value:SetJustifyH("LEFT")
|
|
65
|
-
value:SetWordWrap(false)
|
|
66
|
-
value:SetTextColor(0.91, 0.93, 0.95, 0.92)
|
|
67
|
-
return value
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
function ns.CreateAutomationPage(parent, ui)
|
|
71
|
-
local page = CreateFrame("Frame", nil, parent)
|
|
72
|
-
page:SetAllPoints(parent)
|
|
73
|
-
|
|
74
|
-
local selectedExecutionId
|
|
75
|
-
local rows = {}
|
|
76
|
-
local clearConfirmed = false
|
|
77
|
-
|
|
78
|
-
local heading = ui.CreateSectionLabel(page, L.TAB_AUTOMATION)
|
|
79
|
-
heading:SetPoint("TOPLEFT", 17, -84)
|
|
80
|
-
|
|
81
|
-
local countText = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
82
|
-
countText:SetPoint("LEFT", heading, "RIGHT", 12, 0)
|
|
83
|
-
countText:SetTextColor(1, 1, 1, 0.36)
|
|
84
|
-
|
|
85
|
-
local taskLabel = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
86
|
-
taskLabel:SetPoint("TOPRIGHT", -14, -84)
|
|
87
|
-
taskLabel:SetText(L.AUTO_FIELD_TASK)
|
|
88
|
-
taskLabel:SetTextColor(1, 1, 1, 0.34)
|
|
89
|
-
|
|
90
|
-
local taskPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 1)
|
|
91
|
-
taskPanel:SetPoint("TOPRIGHT", -14, -104)
|
|
92
|
-
taskPanel:SetWidth(220)
|
|
93
|
-
taskPanel:SetHeight(30)
|
|
94
|
-
|
|
95
|
-
local taskInput = CreateFrame("EditBox", nil, taskPanel)
|
|
96
|
-
taskInput:SetPoint("TOPLEFT", 10, -1)
|
|
97
|
-
taskInput:SetPoint("BOTTOMRIGHT", -10, 1)
|
|
98
|
-
taskInput:SetAutoFocus(false)
|
|
99
|
-
taskInput:SetFontObject(ChatFontNormal)
|
|
100
|
-
taskInput:SetTextColor(0.94, 0.95, 0.96)
|
|
101
|
-
taskInput:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
|
|
102
|
-
taskInput:SetScript("OnEnterPressed", function(self)
|
|
103
|
-
self:ClearFocus()
|
|
104
|
-
if ns.Automation then
|
|
105
|
-
ns.Automation.Run(self:GetText())
|
|
106
|
-
end
|
|
107
|
-
end)
|
|
108
|
-
|
|
109
|
-
local runButton = ui.CreateButton(page, 96, L.AUTO_RUN, true)
|
|
110
|
-
runButton:SetPoint("RIGHT", taskPanel, "LEFT", -8, 0)
|
|
111
|
-
runButton:SetScript("OnClick", function()
|
|
112
|
-
if ns.Automation then
|
|
113
|
-
ns.Automation.Run(taskInput:GetText())
|
|
114
|
-
end
|
|
115
|
-
end)
|
|
116
|
-
|
|
117
|
-
local cancelButton = ui.CreateButton(page, 110, L.AUTO_CANCEL, false)
|
|
118
|
-
cancelButton:SetPoint("RIGHT", runButton, "LEFT", -8, 0)
|
|
119
|
-
|
|
120
|
-
local showNoticeButton = ui.CreateButton(page, 128, L.AUTO_SHOW_NOTICE, false)
|
|
121
|
-
showNoticeButton:SetPoint("RIGHT", cancelButton, "LEFT", -8, 0)
|
|
122
|
-
|
|
123
|
-
local hideNoticeButton = ui.CreateButton(page, 118, L.AUTO_HIDE_NOTICE, false)
|
|
124
|
-
hideNoticeButton:SetPoint("RIGHT", showNoticeButton, "LEFT", -8, 0)
|
|
125
|
-
|
|
126
|
-
local clearButton = ui.CreateButton(page, 118, L.AUTO_CLEAR_HISTORY, false)
|
|
127
|
-
clearButton:SetPoint("RIGHT", hideNoticeButton, "LEFT", -8, 0)
|
|
128
|
-
|
|
129
|
-
local listPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.78)
|
|
130
|
-
listPanel:SetPoint("TOPLEFT", 14, -144)
|
|
131
|
-
listPanel:SetPoint("BOTTOMLEFT", 14, 54)
|
|
132
|
-
listPanel:SetWidth(LIST_WIDTH)
|
|
133
|
-
|
|
134
|
-
local listScroll = ui.CreateScrollArea(listPanel, 8, 8, 7, 8)
|
|
135
|
-
local listContent = CreateFrame("Frame", nil, listScroll)
|
|
136
|
-
listContent:SetWidth(LIST_WIDTH - 26)
|
|
137
|
-
listContent:SetHeight(1)
|
|
138
|
-
listScroll:SetScrollChild(listContent)
|
|
139
|
-
|
|
140
|
-
local emptyTitle = listPanel:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
|
141
|
-
emptyTitle:SetPoint("CENTER", listPanel, "CENTER", 0, 14)
|
|
142
|
-
emptyTitle:SetText(L.AUTO_NO_EXECUTIONS)
|
|
143
|
-
emptyTitle:SetTextColor(1, 1, 1, 0.58)
|
|
144
|
-
|
|
145
|
-
local detailPanel = CreateFrame("Frame", nil, page)
|
|
146
|
-
detailPanel:SetPoint("TOPLEFT", listPanel, "TOPRIGHT", 12, 0)
|
|
147
|
-
detailPanel:SetPoint("BOTTOMRIGHT", -14, 54)
|
|
148
|
-
|
|
149
|
-
local detailHeading = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
|
150
|
-
detailHeading:SetPoint("TOPLEFT", 4, -4)
|
|
151
|
-
detailHeading:SetText(L.AUTO_DETAIL)
|
|
152
|
-
|
|
153
|
-
local detailState = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
154
|
-
detailState:SetPoint("TOPRIGHT", -4, -4)
|
|
155
|
-
|
|
156
|
-
local taskValue = CreateField(detailPanel, L.AUTO_FIELD_TASK, 4, -48, 282)
|
|
157
|
-
local kindValue = CreateField(detailPanel, L.EXPORT_RECORD_KIND, 314, -48, 272)
|
|
158
|
-
local requestValue = CreateField(detailPanel, L.AUTO_FIELD_REQUEST, 4, -106, 282)
|
|
159
|
-
local statusValue = CreateField(detailPanel, L.AUTO_FIELD_STATUS, 314, -106, 272)
|
|
160
|
-
local startedValue = CreateField(detailPanel, L.AUTO_FIELD_STARTED, 4, -164, 282)
|
|
161
|
-
local finishedValue = CreateField(detailPanel, L.AUTO_FIELD_FINISHED, 314, -164, 272)
|
|
162
|
-
local revisionValue = CreateField(detailPanel, L.AUTO_FIELD_REVISION, 4, -222, 282)
|
|
163
|
-
local errorValue = CreateField(detailPanel, L.AUTO_FIELD_ERROR, 314, -222, 272)
|
|
164
|
-
|
|
165
|
-
local ticketLabel = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
166
|
-
ticketLabel:SetPoint("TOPLEFT", 4, -284)
|
|
167
|
-
ticketLabel:SetText(L.EXPORT_TICKET)
|
|
168
|
-
ticketLabel:SetTextColor(1, 1, 1, 0.34)
|
|
169
|
-
|
|
170
|
-
local ticketPanel = ui.CreatePanel(detailPanel, ui.editorR, ui.editorG, ui.editorB, 1)
|
|
171
|
-
ticketPanel:SetPoint("TOPLEFT", 4, -305)
|
|
172
|
-
ticketPanel:SetPoint("TOPRIGHT", -140, -305)
|
|
173
|
-
ticketPanel:SetHeight(36)
|
|
174
|
-
|
|
175
|
-
local ticketBox = CreateFrame("EditBox", nil, ticketPanel)
|
|
176
|
-
ticketBox:SetPoint("TOPLEFT", 10, -1)
|
|
177
|
-
ticketBox:SetPoint("BOTTOMRIGHT", -10, 1)
|
|
178
|
-
ticketBox:SetAutoFocus(false)
|
|
179
|
-
ticketBox:SetFontObject(ChatFontNormal)
|
|
180
|
-
ticketBox:SetTextColor(0.94, 0.95, 0.96)
|
|
181
|
-
ticketBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
|
|
182
|
-
|
|
183
|
-
local viewReportButton = ui.CreateButton(detailPanel, 118, L.AUTO_VIEW_REPORT, false)
|
|
184
|
-
viewReportButton:SetPoint("TOPRIGHT", -4, -305)
|
|
185
|
-
|
|
186
|
-
local reportArea = ui.CreateTextArea(detailPanel, true)
|
|
187
|
-
reportArea:SetPoint("TOPLEFT", 4, -352)
|
|
188
|
-
reportArea:SetPoint("BOTTOMRIGHT", -4, 4)
|
|
189
|
-
|
|
190
|
-
local function ApplyRowState(row)
|
|
191
|
-
local selected = row.executionId == selectedExecutionId
|
|
192
|
-
ui.SetListRowState(row, selected, row.hovered)
|
|
193
|
-
if selected then
|
|
194
|
-
row.title:SetTextColor(1, 1, 1, 0.96)
|
|
195
|
-
elseif row.hovered then
|
|
196
|
-
row.title:SetTextColor(1, 1, 1, 0.90)
|
|
197
|
-
else
|
|
198
|
-
row.title:SetTextColor(1, 1, 1, 0.76)
|
|
199
|
-
end
|
|
200
|
-
end
|
|
201
|
-
|
|
202
|
-
local function RefreshDetail()
|
|
203
|
-
local automation = ns.GetAutomationIndex()
|
|
204
|
-
local record = selectedExecutionId and automation
|
|
205
|
-
and automation.records[selectedExecutionId] or nil
|
|
206
|
-
local hasRecord = record ~= nil
|
|
207
|
-
local resultState = GetResultState(record)
|
|
208
|
-
local hasResult = hasRecord and record.ticket and ns.GetExport(record.ticket) ~= nil
|
|
209
|
-
|
|
210
|
-
detailHeading:SetText(hasRecord and record.taskId or L.AUTO_DETAIL)
|
|
211
|
-
detailState:SetText(hasRecord and resultState or "")
|
|
212
|
-
detailState:SetTextColor(1, 1, 1, 0.36)
|
|
213
|
-
taskValue:SetText(hasRecord and record.taskId or "")
|
|
214
|
-
kindValue:SetText(hasRecord and GetKindLabel(record.kind) or "")
|
|
215
|
-
requestValue:SetText(hasRecord and record.executionId or "")
|
|
216
|
-
statusValue:SetText(hasRecord and GetStatusKey(record.status) or "")
|
|
217
|
-
startedValue:SetText(hasRecord and FormatTime(record.startedAt) or "")
|
|
218
|
-
finishedValue:SetText(hasRecord and FormatTime(record.finishedAt) or "")
|
|
219
|
-
revisionValue:SetText(hasRecord and (record.revision or L.NOT_AVAILABLE) or "")
|
|
220
|
-
errorValue:SetText(hasRecord and (record.errorCode or L.NOT_AVAILABLE) or "")
|
|
221
|
-
|
|
222
|
-
ticketBox.savedText = hasResult and record.ticket or ""
|
|
223
|
-
ticketBox.updatingText = true
|
|
224
|
-
ticketBox:SetText(ticketBox.savedText)
|
|
225
|
-
ticketBox.updatingText = nil
|
|
226
|
-
ui.SetButtonEnabled(showNoticeButton, hasResult and not (ns.Automation and ns.Automation.IsBusy()))
|
|
227
|
-
ui.SetButtonEnabled(viewReportButton, hasResult)
|
|
228
|
-
|
|
229
|
-
if not hasResult then
|
|
230
|
-
ui.SetReadOnlyText(reportArea, "")
|
|
231
|
-
end
|
|
232
|
-
end
|
|
233
|
-
|
|
234
|
-
local function SelectRecord(executionId)
|
|
235
|
-
selectedExecutionId = executionId
|
|
236
|
-
for index = 1, #rows do
|
|
237
|
-
ApplyRowState(rows[index])
|
|
238
|
-
end
|
|
239
|
-
RefreshDetail()
|
|
240
|
-
end
|
|
241
|
-
|
|
242
|
-
local function AcquireRow(index)
|
|
243
|
-
local row = rows[index]
|
|
244
|
-
if row then
|
|
245
|
-
return row
|
|
246
|
-
end
|
|
247
|
-
|
|
248
|
-
row = ui.CreateListRow(listContent, ROW_HEIGHT)
|
|
249
|
-
row:SetPoint("TOPLEFT", 0, -(index - 1) * ROW_HEIGHT)
|
|
250
|
-
row:SetPoint("TOPRIGHT", 0, -(index - 1) * ROW_HEIGHT)
|
|
251
|
-
row:EnableMouseWheel(true)
|
|
252
|
-
|
|
253
|
-
local title = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
254
|
-
title:SetPoint("TOPLEFT", 12, -10)
|
|
255
|
-
title:SetPoint("TOPRIGHT", -100, -10)
|
|
256
|
-
title:SetJustifyH("LEFT")
|
|
257
|
-
title:SetWordWrap(false)
|
|
258
|
-
row.title = title
|
|
259
|
-
|
|
260
|
-
local status = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
261
|
-
status:SetPoint("TOPRIGHT", -10, -10)
|
|
262
|
-
status:SetJustifyH("RIGHT")
|
|
263
|
-
row.status = status
|
|
264
|
-
|
|
265
|
-
local meta = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
266
|
-
meta:SetPoint("BOTTOMLEFT", 12, 9)
|
|
267
|
-
meta:SetPoint("BOTTOMRIGHT", -10, 9)
|
|
268
|
-
meta:SetJustifyH("LEFT")
|
|
269
|
-
meta:SetWordWrap(false)
|
|
270
|
-
meta:SetTextColor(1, 1, 1, 0.34)
|
|
271
|
-
row.meta = meta
|
|
272
|
-
|
|
273
|
-
row:SetScript("OnEnter", function(self)
|
|
274
|
-
self.hovered = true
|
|
275
|
-
ApplyRowState(self)
|
|
276
|
-
end)
|
|
277
|
-
row:SetScript("OnLeave", function(self)
|
|
278
|
-
self.hovered = nil
|
|
279
|
-
ApplyRowState(self)
|
|
280
|
-
end)
|
|
281
|
-
row:SetScript("OnClick", function(self)
|
|
282
|
-
SelectRecord(self.executionId)
|
|
283
|
-
end)
|
|
284
|
-
row:SetScript("OnMouseWheel", listScroll.onMouseWheel)
|
|
285
|
-
rows[index] = row
|
|
286
|
-
return row
|
|
287
|
-
end
|
|
288
|
-
|
|
289
|
-
local function Refresh()
|
|
290
|
-
local automation = ns.GetAutomationIndex()
|
|
291
|
-
local order = automation and automation.order or {}
|
|
292
|
-
countText:SetText(string.format(L.AUTO_EXECUTION_COUNT, #order))
|
|
293
|
-
emptyTitle:SetShown(#order == 0)
|
|
294
|
-
ui.SetButtonEnabled(clearButton, #order > 0)
|
|
295
|
-
|
|
296
|
-
if clearConfirmed then
|
|
297
|
-
clearConfirmed = false
|
|
298
|
-
ui.SetButtonText(clearButton, L.AUTO_CLEAR_HISTORY)
|
|
299
|
-
ui.SetButtonVariant(clearButton, "secondary")
|
|
300
|
-
end
|
|
301
|
-
|
|
302
|
-
for index = 1, #order do
|
|
303
|
-
local record = automation.records[order[index]]
|
|
304
|
-
local row = AcquireRow(index)
|
|
305
|
-
row.executionId = order[index]
|
|
306
|
-
row.title:SetText(record.taskId)
|
|
307
|
-
local state = GetResultState(record)
|
|
308
|
-
row.status:SetText(GetStatusKey(record.status))
|
|
309
|
-
if record.status == "succeeded" then
|
|
310
|
-
row.status:SetTextColor(0.42, 0.76, 0.43, 0.92)
|
|
311
|
-
elseif record.status == "running" or record.status == "finalizing" then
|
|
312
|
-
row.status:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.92)
|
|
313
|
-
else
|
|
314
|
-
row.status:SetTextColor(1, 1, 1, 0.30)
|
|
315
|
-
end
|
|
316
|
-
row.meta:SetText(FormatTime(record.startedAt) .. " | " .. GetKindLabel(record.kind)
|
|
317
|
-
.. " | " .. state)
|
|
318
|
-
row:Show()
|
|
319
|
-
end
|
|
320
|
-
for index = #order + 1, #rows do
|
|
321
|
-
rows[index]:Hide()
|
|
322
|
-
end
|
|
323
|
-
|
|
324
|
-
listContent:SetHeight(math.max(1, #order * ROW_HEIGHT))
|
|
325
|
-
listScroll:UpdateScrollChildRect()
|
|
326
|
-
if selectedExecutionId and not (automation and automation.records[selectedExecutionId]) then
|
|
327
|
-
selectedExecutionId = nil
|
|
328
|
-
end
|
|
329
|
-
if not selectedExecutionId and order[1] then
|
|
330
|
-
selectedExecutionId = order[1]
|
|
331
|
-
end
|
|
332
|
-
for index = 1, #rows do
|
|
333
|
-
ApplyRowState(rows[index])
|
|
334
|
-
end
|
|
335
|
-
RefreshDetail()
|
|
336
|
-
end
|
|
337
|
-
|
|
338
|
-
ticketBox:SetScript("OnTextChanged", function(self)
|
|
339
|
-
if not self.updatingText and self:GetText() ~= self.savedText then
|
|
340
|
-
self.updatingText = true
|
|
341
|
-
self:SetText(self.savedText or "")
|
|
342
|
-
self.updatingText = nil
|
|
343
|
-
self:HighlightText()
|
|
344
|
-
end
|
|
345
|
-
end)
|
|
346
|
-
ticketBox:SetScript("OnMouseUp", function()
|
|
347
|
-
if ticketBox.savedText ~= "" then
|
|
348
|
-
ui.SelectAllText(ticketBox)
|
|
349
|
-
end
|
|
350
|
-
end)
|
|
351
|
-
|
|
352
|
-
cancelButton:SetScript("OnClick", function()
|
|
353
|
-
if selectedExecutionId then
|
|
354
|
-
local automation = ns.GetAutomationIndex()
|
|
355
|
-
local record = automation and automation.records[selectedExecutionId] or nil
|
|
356
|
-
if record and ns.Automation then
|
|
357
|
-
ns.Automation.Cancel(record.taskId)
|
|
358
|
-
end
|
|
359
|
-
end
|
|
360
|
-
end)
|
|
361
|
-
|
|
362
|
-
showNoticeButton:SetScript("OnClick", function()
|
|
363
|
-
if ns.Automation then
|
|
364
|
-
ns.Automation.Show(ticketBox.savedText or "")
|
|
365
|
-
end
|
|
366
|
-
end)
|
|
367
|
-
|
|
368
|
-
hideNoticeButton:SetScript("OnClick", function()
|
|
369
|
-
if ns.Automation then
|
|
370
|
-
ns.Automation.Stop()
|
|
371
|
-
end
|
|
372
|
-
end)
|
|
373
|
-
|
|
374
|
-
clearButton:SetScript("OnClick", function()
|
|
375
|
-
if not clearConfirmed then
|
|
376
|
-
clearConfirmed = true
|
|
377
|
-
ui.SetButtonText(clearButton, L.CONFIRM_CLEAR_CACHE)
|
|
378
|
-
ui.SetButtonVariant(clearButton, "danger")
|
|
379
|
-
return
|
|
380
|
-
end
|
|
381
|
-
ns.ClearAutomationHistory()
|
|
382
|
-
selectedExecutionId = nil
|
|
383
|
-
Refresh()
|
|
384
|
-
end)
|
|
385
|
-
|
|
386
|
-
viewReportButton:SetScript("OnClick", function()
|
|
387
|
-
local entry = ticketBox.savedText ~= "" and ns.GetExport(ticketBox.savedText) or nil
|
|
388
|
-
if not entry or not entry.payload then
|
|
389
|
-
return
|
|
390
|
-
end
|
|
391
|
-
local content = entry.payload.content or ""
|
|
392
|
-
if #content > REPORT_DISPLAY_BYTES then
|
|
393
|
-
ui.SetReadOnlyText(reportArea, content:sub(1, REPORT_DISPLAY_BYTES)
|
|
394
|
-
.. "\n... " .. string.format(L.AUTO_REPORT_DISPLAY_LIMIT, REPORT_DISPLAY_BYTES / 1024))
|
|
395
|
-
else
|
|
396
|
-
ui.SetReadOnlyText(reportArea, content)
|
|
397
|
-
end
|
|
398
|
-
end)
|
|
399
|
-
|
|
400
|
-
page.Refresh = Refresh
|
|
401
|
-
page.SelectRecord = SelectRecord
|
|
402
|
-
page.ticketBox = ticketBox
|
|
403
|
-
page.taskInput = taskInput
|
|
404
|
-
page.rows = rows
|
|
405
|
-
page.reportArea = reportArea
|
|
406
|
-
page.runButton = runButton
|
|
407
|
-
page.cancelButton = cancelButton
|
|
408
|
-
page.showNoticeButton = showNoticeButton
|
|
409
|
-
page.hideNoticeButton = hideNoticeButton
|
|
410
|
-
page.viewReportButton = viewReportButton
|
|
411
|
-
page.clearButton = clearButton
|
|
412
|
-
function page:Activate()
|
|
413
|
-
Refresh()
|
|
414
|
-
end
|
|
415
|
-
Refresh()
|
|
416
|
-
return page
|
|
417
|
-
end
|
|
1
|
+
local ADDON_NAME, ns = ...
|
|
2
|
+
local L = ns.L
|
|
3
|
+
|
|
4
|
+
local ROW_HEIGHT = 58
|
|
5
|
+
local LIST_WIDTH = 354
|
|
6
|
+
local REPORT_DISPLAY_BYTES = 48 * 1024
|
|
7
|
+
|
|
8
|
+
local STATUS_LABELS = {
|
|
9
|
+
running = "AUTO_STATUS_RUNNING",
|
|
10
|
+
finalizing = "AUTO_STATUS_FINALIZING",
|
|
11
|
+
succeeded = "AUTO_STATUS_SUCCEEDED",
|
|
12
|
+
failed = "AUTO_STATUS_FAILED",
|
|
13
|
+
cancelled = "AUTO_STATUS_CANCELLED",
|
|
14
|
+
interrupted = "AUTO_STATUS_INTERRUPTED",
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
local KIND_LABELS = {
|
|
18
|
+
lua = "AUTO_KIND_LUA",
|
|
19
|
+
bug_snapshot = "AUTO_KIND_BUG",
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
local function GetStatusKey(status)
|
|
23
|
+
return STATUS_LABELS[status] and L[STATUS_LABELS[status]] or tostring(status or L.UNKNOWN)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
local function GetKindLabel(kind)
|
|
27
|
+
local key = KIND_LABELS[kind]
|
|
28
|
+
return key and L[key] or L.EXPORT_KIND_UNKNOWN
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
local function FormatTime(timestamp)
|
|
32
|
+
timestamp = tonumber(timestamp) or 0
|
|
33
|
+
if timestamp <= 0 then
|
|
34
|
+
return L.UNKNOWN
|
|
35
|
+
end
|
|
36
|
+
return date("%Y-%m-%d %H:%M:%S", timestamp)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
local RESULT_STATE_LABELS = {
|
|
40
|
+
pending = "AUTO_PENDING_DISK",
|
|
41
|
+
flushed = "AUTO_LOADED_SAVED",
|
|
42
|
+
received = "AUTO_ACK_RECEIVED",
|
|
43
|
+
failed = "AUTO_ACK_FAILED",
|
|
44
|
+
expired = "AUTO_RESULT_EXPIRED",
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
-- The life cycle lives in one place (Core/Database.lua); the page only renders
|
|
48
|
+
-- it, so the notice, the list and the detail pane cannot disagree.
|
|
49
|
+
local function GetResultState(record)
|
|
50
|
+
local state = ns.AutomationResultState(record)
|
|
51
|
+
local key = RESULT_STATE_LABELS[state]
|
|
52
|
+
return key and L[key] or "-"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
local function CreateField(parent, labelText, x, y, width)
|
|
56
|
+
local label = parent:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
57
|
+
label:SetPoint("TOPLEFT", x, y)
|
|
58
|
+
label:SetText(labelText)
|
|
59
|
+
label:SetTextColor(1, 1, 1, 0.34)
|
|
60
|
+
|
|
61
|
+
local value = parent:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
62
|
+
value:SetPoint("TOPLEFT", x, y - 20)
|
|
63
|
+
value:SetWidth(width)
|
|
64
|
+
value:SetJustifyH("LEFT")
|
|
65
|
+
value:SetWordWrap(false)
|
|
66
|
+
value:SetTextColor(0.91, 0.93, 0.95, 0.92)
|
|
67
|
+
return value
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
function ns.CreateAutomationPage(parent, ui)
|
|
71
|
+
local page = CreateFrame("Frame", nil, parent)
|
|
72
|
+
page:SetAllPoints(parent)
|
|
73
|
+
|
|
74
|
+
local selectedExecutionId
|
|
75
|
+
local rows = {}
|
|
76
|
+
local clearConfirmed = false
|
|
77
|
+
|
|
78
|
+
local heading = ui.CreateSectionLabel(page, L.TAB_AUTOMATION)
|
|
79
|
+
heading:SetPoint("TOPLEFT", 17, -84)
|
|
80
|
+
|
|
81
|
+
local countText = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
82
|
+
countText:SetPoint("LEFT", heading, "RIGHT", 12, 0)
|
|
83
|
+
countText:SetTextColor(1, 1, 1, 0.36)
|
|
84
|
+
|
|
85
|
+
local taskLabel = page:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
86
|
+
taskLabel:SetPoint("TOPRIGHT", -14, -84)
|
|
87
|
+
taskLabel:SetText(L.AUTO_FIELD_TASK)
|
|
88
|
+
taskLabel:SetTextColor(1, 1, 1, 0.34)
|
|
89
|
+
|
|
90
|
+
local taskPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 1)
|
|
91
|
+
taskPanel:SetPoint("TOPRIGHT", -14, -104)
|
|
92
|
+
taskPanel:SetWidth(220)
|
|
93
|
+
taskPanel:SetHeight(30)
|
|
94
|
+
|
|
95
|
+
local taskInput = CreateFrame("EditBox", nil, taskPanel)
|
|
96
|
+
taskInput:SetPoint("TOPLEFT", 10, -1)
|
|
97
|
+
taskInput:SetPoint("BOTTOMRIGHT", -10, 1)
|
|
98
|
+
taskInput:SetAutoFocus(false)
|
|
99
|
+
taskInput:SetFontObject(ChatFontNormal)
|
|
100
|
+
taskInput:SetTextColor(0.94, 0.95, 0.96)
|
|
101
|
+
taskInput:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
|
|
102
|
+
taskInput:SetScript("OnEnterPressed", function(self)
|
|
103
|
+
self:ClearFocus()
|
|
104
|
+
if ns.Automation then
|
|
105
|
+
ns.Automation.Run(self:GetText())
|
|
106
|
+
end
|
|
107
|
+
end)
|
|
108
|
+
|
|
109
|
+
local runButton = ui.CreateButton(page, 96, L.AUTO_RUN, true)
|
|
110
|
+
runButton:SetPoint("RIGHT", taskPanel, "LEFT", -8, 0)
|
|
111
|
+
runButton:SetScript("OnClick", function()
|
|
112
|
+
if ns.Automation then
|
|
113
|
+
ns.Automation.Run(taskInput:GetText())
|
|
114
|
+
end
|
|
115
|
+
end)
|
|
116
|
+
|
|
117
|
+
local cancelButton = ui.CreateButton(page, 110, L.AUTO_CANCEL, false)
|
|
118
|
+
cancelButton:SetPoint("RIGHT", runButton, "LEFT", -8, 0)
|
|
119
|
+
|
|
120
|
+
local showNoticeButton = ui.CreateButton(page, 128, L.AUTO_SHOW_NOTICE, false)
|
|
121
|
+
showNoticeButton:SetPoint("RIGHT", cancelButton, "LEFT", -8, 0)
|
|
122
|
+
|
|
123
|
+
local hideNoticeButton = ui.CreateButton(page, 118, L.AUTO_HIDE_NOTICE, false)
|
|
124
|
+
hideNoticeButton:SetPoint("RIGHT", showNoticeButton, "LEFT", -8, 0)
|
|
125
|
+
|
|
126
|
+
local clearButton = ui.CreateButton(page, 118, L.AUTO_CLEAR_HISTORY, false)
|
|
127
|
+
clearButton:SetPoint("RIGHT", hideNoticeButton, "LEFT", -8, 0)
|
|
128
|
+
|
|
129
|
+
local listPanel = ui.CreatePanel(page, ui.editorR, ui.editorG, ui.editorB, 0.78)
|
|
130
|
+
listPanel:SetPoint("TOPLEFT", 14, -144)
|
|
131
|
+
listPanel:SetPoint("BOTTOMLEFT", 14, 54)
|
|
132
|
+
listPanel:SetWidth(LIST_WIDTH)
|
|
133
|
+
|
|
134
|
+
local listScroll = ui.CreateScrollArea(listPanel, 8, 8, 7, 8)
|
|
135
|
+
local listContent = CreateFrame("Frame", nil, listScroll)
|
|
136
|
+
listContent:SetWidth(LIST_WIDTH - 26)
|
|
137
|
+
listContent:SetHeight(1)
|
|
138
|
+
listScroll:SetScrollChild(listContent)
|
|
139
|
+
|
|
140
|
+
local emptyTitle = listPanel:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
|
141
|
+
emptyTitle:SetPoint("CENTER", listPanel, "CENTER", 0, 14)
|
|
142
|
+
emptyTitle:SetText(L.AUTO_NO_EXECUTIONS)
|
|
143
|
+
emptyTitle:SetTextColor(1, 1, 1, 0.58)
|
|
144
|
+
|
|
145
|
+
local detailPanel = CreateFrame("Frame", nil, page)
|
|
146
|
+
detailPanel:SetPoint("TOPLEFT", listPanel, "TOPRIGHT", 12, 0)
|
|
147
|
+
detailPanel:SetPoint("BOTTOMRIGHT", -14, 54)
|
|
148
|
+
|
|
149
|
+
local detailHeading = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
|
150
|
+
detailHeading:SetPoint("TOPLEFT", 4, -4)
|
|
151
|
+
detailHeading:SetText(L.AUTO_DETAIL)
|
|
152
|
+
|
|
153
|
+
local detailState = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
154
|
+
detailState:SetPoint("TOPRIGHT", -4, -4)
|
|
155
|
+
|
|
156
|
+
local taskValue = CreateField(detailPanel, L.AUTO_FIELD_TASK, 4, -48, 282)
|
|
157
|
+
local kindValue = CreateField(detailPanel, L.EXPORT_RECORD_KIND, 314, -48, 272)
|
|
158
|
+
local requestValue = CreateField(detailPanel, L.AUTO_FIELD_REQUEST, 4, -106, 282)
|
|
159
|
+
local statusValue = CreateField(detailPanel, L.AUTO_FIELD_STATUS, 314, -106, 272)
|
|
160
|
+
local startedValue = CreateField(detailPanel, L.AUTO_FIELD_STARTED, 4, -164, 282)
|
|
161
|
+
local finishedValue = CreateField(detailPanel, L.AUTO_FIELD_FINISHED, 314, -164, 272)
|
|
162
|
+
local revisionValue = CreateField(detailPanel, L.AUTO_FIELD_REVISION, 4, -222, 282)
|
|
163
|
+
local errorValue = CreateField(detailPanel, L.AUTO_FIELD_ERROR, 314, -222, 272)
|
|
164
|
+
|
|
165
|
+
local ticketLabel = detailPanel:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
166
|
+
ticketLabel:SetPoint("TOPLEFT", 4, -284)
|
|
167
|
+
ticketLabel:SetText(L.EXPORT_TICKET)
|
|
168
|
+
ticketLabel:SetTextColor(1, 1, 1, 0.34)
|
|
169
|
+
|
|
170
|
+
local ticketPanel = ui.CreatePanel(detailPanel, ui.editorR, ui.editorG, ui.editorB, 1)
|
|
171
|
+
ticketPanel:SetPoint("TOPLEFT", 4, -305)
|
|
172
|
+
ticketPanel:SetPoint("TOPRIGHT", -140, -305)
|
|
173
|
+
ticketPanel:SetHeight(36)
|
|
174
|
+
|
|
175
|
+
local ticketBox = CreateFrame("EditBox", nil, ticketPanel)
|
|
176
|
+
ticketBox:SetPoint("TOPLEFT", 10, -1)
|
|
177
|
+
ticketBox:SetPoint("BOTTOMRIGHT", -10, 1)
|
|
178
|
+
ticketBox:SetAutoFocus(false)
|
|
179
|
+
ticketBox:SetFontObject(ChatFontNormal)
|
|
180
|
+
ticketBox:SetTextColor(0.94, 0.95, 0.96)
|
|
181
|
+
ticketBox:SetScript("OnEscapePressed", function(self) self:ClearFocus() end)
|
|
182
|
+
|
|
183
|
+
local viewReportButton = ui.CreateButton(detailPanel, 118, L.AUTO_VIEW_REPORT, false)
|
|
184
|
+
viewReportButton:SetPoint("TOPRIGHT", -4, -305)
|
|
185
|
+
|
|
186
|
+
local reportArea = ui.CreateTextArea(detailPanel, true)
|
|
187
|
+
reportArea:SetPoint("TOPLEFT", 4, -352)
|
|
188
|
+
reportArea:SetPoint("BOTTOMRIGHT", -4, 4)
|
|
189
|
+
|
|
190
|
+
local function ApplyRowState(row)
|
|
191
|
+
local selected = row.executionId == selectedExecutionId
|
|
192
|
+
ui.SetListRowState(row, selected, row.hovered)
|
|
193
|
+
if selected then
|
|
194
|
+
row.title:SetTextColor(1, 1, 1, 0.96)
|
|
195
|
+
elseif row.hovered then
|
|
196
|
+
row.title:SetTextColor(1, 1, 1, 0.90)
|
|
197
|
+
else
|
|
198
|
+
row.title:SetTextColor(1, 1, 1, 0.76)
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
local function RefreshDetail()
|
|
203
|
+
local automation = ns.GetAutomationIndex()
|
|
204
|
+
local record = selectedExecutionId and automation
|
|
205
|
+
and automation.records[selectedExecutionId] or nil
|
|
206
|
+
local hasRecord = record ~= nil
|
|
207
|
+
local resultState = GetResultState(record)
|
|
208
|
+
local hasResult = hasRecord and record.ticket and ns.GetExport(record.ticket) ~= nil
|
|
209
|
+
|
|
210
|
+
detailHeading:SetText(hasRecord and record.taskId or L.AUTO_DETAIL)
|
|
211
|
+
detailState:SetText(hasRecord and resultState or "")
|
|
212
|
+
detailState:SetTextColor(1, 1, 1, 0.36)
|
|
213
|
+
taskValue:SetText(hasRecord and record.taskId or "")
|
|
214
|
+
kindValue:SetText(hasRecord and GetKindLabel(record.kind) or "")
|
|
215
|
+
requestValue:SetText(hasRecord and record.executionId or "")
|
|
216
|
+
statusValue:SetText(hasRecord and GetStatusKey(record.status) or "")
|
|
217
|
+
startedValue:SetText(hasRecord and FormatTime(record.startedAt) or "")
|
|
218
|
+
finishedValue:SetText(hasRecord and FormatTime(record.finishedAt) or "")
|
|
219
|
+
revisionValue:SetText(hasRecord and (record.revision or L.NOT_AVAILABLE) or "")
|
|
220
|
+
errorValue:SetText(hasRecord and (record.errorCode or L.NOT_AVAILABLE) or "")
|
|
221
|
+
|
|
222
|
+
ticketBox.savedText = hasResult and record.ticket or ""
|
|
223
|
+
ticketBox.updatingText = true
|
|
224
|
+
ticketBox:SetText(ticketBox.savedText)
|
|
225
|
+
ticketBox.updatingText = nil
|
|
226
|
+
ui.SetButtonEnabled(showNoticeButton, hasResult and not (ns.Automation and ns.Automation.IsBusy()))
|
|
227
|
+
ui.SetButtonEnabled(viewReportButton, hasResult)
|
|
228
|
+
|
|
229
|
+
if not hasResult then
|
|
230
|
+
ui.SetReadOnlyText(reportArea, "")
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
local function SelectRecord(executionId)
|
|
235
|
+
selectedExecutionId = executionId
|
|
236
|
+
for index = 1, #rows do
|
|
237
|
+
ApplyRowState(rows[index])
|
|
238
|
+
end
|
|
239
|
+
RefreshDetail()
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
local function AcquireRow(index)
|
|
243
|
+
local row = rows[index]
|
|
244
|
+
if row then
|
|
245
|
+
return row
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
row = ui.CreateListRow(listContent, ROW_HEIGHT)
|
|
249
|
+
row:SetPoint("TOPLEFT", 0, -(index - 1) * ROW_HEIGHT)
|
|
250
|
+
row:SetPoint("TOPRIGHT", 0, -(index - 1) * ROW_HEIGHT)
|
|
251
|
+
row:EnableMouseWheel(true)
|
|
252
|
+
|
|
253
|
+
local title = row:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
254
|
+
title:SetPoint("TOPLEFT", 12, -10)
|
|
255
|
+
title:SetPoint("TOPRIGHT", -100, -10)
|
|
256
|
+
title:SetJustifyH("LEFT")
|
|
257
|
+
title:SetWordWrap(false)
|
|
258
|
+
row.title = title
|
|
259
|
+
|
|
260
|
+
local status = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
261
|
+
status:SetPoint("TOPRIGHT", -10, -10)
|
|
262
|
+
status:SetJustifyH("RIGHT")
|
|
263
|
+
row.status = status
|
|
264
|
+
|
|
265
|
+
local meta = row:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
266
|
+
meta:SetPoint("BOTTOMLEFT", 12, 9)
|
|
267
|
+
meta:SetPoint("BOTTOMRIGHT", -10, 9)
|
|
268
|
+
meta:SetJustifyH("LEFT")
|
|
269
|
+
meta:SetWordWrap(false)
|
|
270
|
+
meta:SetTextColor(1, 1, 1, 0.34)
|
|
271
|
+
row.meta = meta
|
|
272
|
+
|
|
273
|
+
row:SetScript("OnEnter", function(self)
|
|
274
|
+
self.hovered = true
|
|
275
|
+
ApplyRowState(self)
|
|
276
|
+
end)
|
|
277
|
+
row:SetScript("OnLeave", function(self)
|
|
278
|
+
self.hovered = nil
|
|
279
|
+
ApplyRowState(self)
|
|
280
|
+
end)
|
|
281
|
+
row:SetScript("OnClick", function(self)
|
|
282
|
+
SelectRecord(self.executionId)
|
|
283
|
+
end)
|
|
284
|
+
row:SetScript("OnMouseWheel", listScroll.onMouseWheel)
|
|
285
|
+
rows[index] = row
|
|
286
|
+
return row
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
local function Refresh()
|
|
290
|
+
local automation = ns.GetAutomationIndex()
|
|
291
|
+
local order = automation and automation.order or {}
|
|
292
|
+
countText:SetText(string.format(L.AUTO_EXECUTION_COUNT, #order))
|
|
293
|
+
emptyTitle:SetShown(#order == 0)
|
|
294
|
+
ui.SetButtonEnabled(clearButton, #order > 0)
|
|
295
|
+
|
|
296
|
+
if clearConfirmed then
|
|
297
|
+
clearConfirmed = false
|
|
298
|
+
ui.SetButtonText(clearButton, L.AUTO_CLEAR_HISTORY)
|
|
299
|
+
ui.SetButtonVariant(clearButton, "secondary")
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
for index = 1, #order do
|
|
303
|
+
local record = automation.records[order[index]]
|
|
304
|
+
local row = AcquireRow(index)
|
|
305
|
+
row.executionId = order[index]
|
|
306
|
+
row.title:SetText(record.taskId)
|
|
307
|
+
local state = GetResultState(record)
|
|
308
|
+
row.status:SetText(GetStatusKey(record.status))
|
|
309
|
+
if record.status == "succeeded" then
|
|
310
|
+
row.status:SetTextColor(0.42, 0.76, 0.43, 0.92)
|
|
311
|
+
elseif record.status == "running" or record.status == "finalizing" then
|
|
312
|
+
row.status:SetTextColor(ui.accentR, ui.accentG, ui.accentB, 0.92)
|
|
313
|
+
else
|
|
314
|
+
row.status:SetTextColor(1, 1, 1, 0.30)
|
|
315
|
+
end
|
|
316
|
+
row.meta:SetText(FormatTime(record.startedAt) .. " | " .. GetKindLabel(record.kind)
|
|
317
|
+
.. " | " .. state)
|
|
318
|
+
row:Show()
|
|
319
|
+
end
|
|
320
|
+
for index = #order + 1, #rows do
|
|
321
|
+
rows[index]:Hide()
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
listContent:SetHeight(math.max(1, #order * ROW_HEIGHT))
|
|
325
|
+
listScroll:UpdateScrollChildRect()
|
|
326
|
+
if selectedExecutionId and not (automation and automation.records[selectedExecutionId]) then
|
|
327
|
+
selectedExecutionId = nil
|
|
328
|
+
end
|
|
329
|
+
if not selectedExecutionId and order[1] then
|
|
330
|
+
selectedExecutionId = order[1]
|
|
331
|
+
end
|
|
332
|
+
for index = 1, #rows do
|
|
333
|
+
ApplyRowState(rows[index])
|
|
334
|
+
end
|
|
335
|
+
RefreshDetail()
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
ticketBox:SetScript("OnTextChanged", function(self)
|
|
339
|
+
if not self.updatingText and self:GetText() ~= self.savedText then
|
|
340
|
+
self.updatingText = true
|
|
341
|
+
self:SetText(self.savedText or "")
|
|
342
|
+
self.updatingText = nil
|
|
343
|
+
self:HighlightText()
|
|
344
|
+
end
|
|
345
|
+
end)
|
|
346
|
+
ticketBox:SetScript("OnMouseUp", function()
|
|
347
|
+
if ticketBox.savedText ~= "" then
|
|
348
|
+
ui.SelectAllText(ticketBox)
|
|
349
|
+
end
|
|
350
|
+
end)
|
|
351
|
+
|
|
352
|
+
cancelButton:SetScript("OnClick", function()
|
|
353
|
+
if selectedExecutionId then
|
|
354
|
+
local automation = ns.GetAutomationIndex()
|
|
355
|
+
local record = automation and automation.records[selectedExecutionId] or nil
|
|
356
|
+
if record and ns.Automation then
|
|
357
|
+
ns.Automation.Cancel(record.taskId)
|
|
358
|
+
end
|
|
359
|
+
end
|
|
360
|
+
end)
|
|
361
|
+
|
|
362
|
+
showNoticeButton:SetScript("OnClick", function()
|
|
363
|
+
if ns.Automation then
|
|
364
|
+
ns.Automation.Show(ticketBox.savedText or "")
|
|
365
|
+
end
|
|
366
|
+
end)
|
|
367
|
+
|
|
368
|
+
hideNoticeButton:SetScript("OnClick", function()
|
|
369
|
+
if ns.Automation then
|
|
370
|
+
ns.Automation.Stop()
|
|
371
|
+
end
|
|
372
|
+
end)
|
|
373
|
+
|
|
374
|
+
clearButton:SetScript("OnClick", function()
|
|
375
|
+
if not clearConfirmed then
|
|
376
|
+
clearConfirmed = true
|
|
377
|
+
ui.SetButtonText(clearButton, L.CONFIRM_CLEAR_CACHE)
|
|
378
|
+
ui.SetButtonVariant(clearButton, "danger")
|
|
379
|
+
return
|
|
380
|
+
end
|
|
381
|
+
ns.ClearAutomationHistory()
|
|
382
|
+
selectedExecutionId = nil
|
|
383
|
+
Refresh()
|
|
384
|
+
end)
|
|
385
|
+
|
|
386
|
+
viewReportButton:SetScript("OnClick", function()
|
|
387
|
+
local entry = ticketBox.savedText ~= "" and ns.GetExport(ticketBox.savedText) or nil
|
|
388
|
+
if not entry or not entry.payload then
|
|
389
|
+
return
|
|
390
|
+
end
|
|
391
|
+
local content = entry.payload.content or ""
|
|
392
|
+
if #content > REPORT_DISPLAY_BYTES then
|
|
393
|
+
ui.SetReadOnlyText(reportArea, content:sub(1, REPORT_DISPLAY_BYTES)
|
|
394
|
+
.. "\n... " .. string.format(L.AUTO_REPORT_DISPLAY_LIMIT, REPORT_DISPLAY_BYTES / 1024))
|
|
395
|
+
else
|
|
396
|
+
ui.SetReadOnlyText(reportArea, content)
|
|
397
|
+
end
|
|
398
|
+
end)
|
|
399
|
+
|
|
400
|
+
page.Refresh = Refresh
|
|
401
|
+
page.SelectRecord = SelectRecord
|
|
402
|
+
page.ticketBox = ticketBox
|
|
403
|
+
page.taskInput = taskInput
|
|
404
|
+
page.rows = rows
|
|
405
|
+
page.reportArea = reportArea
|
|
406
|
+
page.runButton = runButton
|
|
407
|
+
page.cancelButton = cancelButton
|
|
408
|
+
page.showNoticeButton = showNoticeButton
|
|
409
|
+
page.hideNoticeButton = hideNoticeButton
|
|
410
|
+
page.viewReportButton = viewReportButton
|
|
411
|
+
page.clearButton = clearButton
|
|
412
|
+
function page:Activate()
|
|
413
|
+
Refresh()
|
|
414
|
+
end
|
|
415
|
+
Refresh()
|
|
416
|
+
return page
|
|
417
|
+
end
|