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.
Files changed (60) hide show
  1. package/bin/lycheedev.js +257 -0
  2. package/package.json +42 -0
  3. package/src/addon.js +87 -0
  4. package/src/config.js +64 -0
  5. package/src/doctor.js +100 -0
  6. package/src/install.js +131 -0
  7. package/src/paths.js +93 -0
  8. package/src/python.js +107 -0
  9. package/src/skill.js +48 -0
  10. package/src/wow.js +110 -0
  11. package/vendor/addon/Core/Bootstrap.lua +131 -0
  12. package/vendor/addon/Core/Clients/Mainline.lua +9 -0
  13. package/vendor/addon/Core/Clients/Mists.lua +9 -0
  14. package/vendor/addon/Core/Clients/Titan.lua +9 -0
  15. package/vendor/addon/Core/Compatibility.lua +43 -0
  16. package/vendor/addon/Core/Database.lua +859 -0
  17. package/vendor/addon/Core/Inspector.lua +647 -0
  18. package/vendor/addon/Core/Locale.lua +307 -0
  19. package/vendor/addon/Core/Locale_enUS.lua +318 -0
  20. package/vendor/addon/Core/Safety.lua +42 -0
  21. package/vendor/addon/Core/Serializer.lua +324 -0
  22. package/vendor/addon/Libs/AutomationQR.lua +1176 -0
  23. package/vendor/addon/Lychee Dev_Mainline.toc +43 -0
  24. package/vendor/addon/Lychee Dev_Mists.toc +43 -0
  25. package/vendor/addon/Lychee Dev_Wrath.toc +43 -0
  26. package/vendor/addon/Media/GitHub.png +0 -0
  27. package/vendor/addon/Media/Logo.png +0 -0
  28. package/vendor/addon/Modules/Automation/Controller.lua +757 -0
  29. package/vendor/addon/Modules/Automation/Report.lua +409 -0
  30. package/vendor/addon/Modules/Automation/auto/auto.lua +12 -0
  31. package/vendor/addon/Modules/Diagnostics.lua +238 -0
  32. package/vendor/addon/Modules/Events/Catalog.lua +184 -0
  33. package/vendor/addon/Modules/Events/CatalogData_Mainline.lua +1788 -0
  34. package/vendor/addon/Modules/Events/CatalogData_Mists.lua +1489 -0
  35. package/vendor/addon/Modules/Events/CatalogData_Titan.lua +1492 -0
  36. package/vendor/addon/Modules/Events/Monitor.lua +181 -0
  37. package/vendor/addon/Modules/FunctionTrace.lua +85 -0
  38. package/vendor/addon/Modules/ObjectInspector.lua +329 -0
  39. package/vendor/addon/UI/AutomationOverlay.lua +183 -0
  40. package/vendor/addon/UI/Export.lua +140 -0
  41. package/vendor/addon/UI/Features.lua +890 -0
  42. package/vendor/addon/UI/MainWindow.lua +1145 -0
  43. package/vendor/addon/UI/Pages/About.lua +223 -0
  44. package/vendor/addon/UI/Pages/Automation.lua +417 -0
  45. package/vendor/addon/UI/Pages/Diagnostics.lua +289 -0
  46. package/vendor/addon/UI/Pages/ExportRecords.lua +387 -0
  47. package/vendor/addon/UI/Pages/Object.lua +573 -0
  48. package/vendor/addon/UI/Pages/Trace.lua +165 -0
  49. package/vendor/skill/SKILL.md +94 -0
  50. package/vendor/skill/agents/openai.yaml +4 -0
  51. package/vendor/skill/references/automation.md +327 -0
  52. package/vendor/skill/references/runtime-investigations.md +97 -0
  53. package/vendor/skill/scripts/automation/__init__.py +1 -0
  54. package/vendor/skill/scripts/automation/registry.py +516 -0
  55. package/vendor/skill/scripts/automation/saved_variables.py +438 -0
  56. package/vendor/skill/scripts/automation/session.py +207 -0
  57. package/vendor/skill/scripts/automation/windows.py +573 -0
  58. package/vendor/skill/scripts/automation.py +865 -0
  59. package/vendor/skill/scripts/requirements.txt +13 -0
  60. package/vendor/skill/scripts/selftest_offline.py +981 -0
@@ -0,0 +1,223 @@
1
+ local ADDON_NAME, ns = ...
2
+ local L = ns.L
3
+
4
+ local REPOSITORY_URL = "https://github.com/Follen/Lychee-Dev"
5
+
6
+ local function CreateMetaItem(parent, labelText, valueText, x, y, width)
7
+ local label = parent:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
8
+ label:SetPoint("TOPLEFT", x, y)
9
+ label:SetWidth(width)
10
+ label:SetJustifyH("LEFT")
11
+ label:SetWordWrap(false)
12
+ label:SetText(labelText)
13
+ label:SetTextColor(1, 1, 1, 0.34)
14
+
15
+ local value = parent:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
16
+ value:SetPoint("TOPLEFT", x, y - 22)
17
+ value:SetWidth(width)
18
+ value:SetJustifyH("LEFT")
19
+ value:SetWordWrap(false)
20
+ value:SetText(valueText)
21
+ value:SetTextColor(0.94, 0.95, 0.96, 0.94)
22
+ return { label = label, value = value }
23
+ end
24
+
25
+ local function CreateEnvironmentRow(parent, labelText, valueText, detailText, y, accent)
26
+ local label = parent:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
27
+ label:SetPoint("TOPLEFT", 17, y)
28
+ label:SetWidth(160)
29
+ label:SetJustifyH("LEFT")
30
+ label:SetText(labelText)
31
+ label:SetTextColor(1, 1, 1, 0.36)
32
+
33
+ local value = parent:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
34
+ value:SetPoint("TOPLEFT", 190, y + 1)
35
+ value:SetPoint("RIGHT", -18, 0)
36
+ value:SetJustifyH("LEFT")
37
+ value:SetText(valueText)
38
+ value:SetTextColor(accent and 0.42 or 0.86, accent and 0.76 or 0.89, accent and 0.43 or 0.92, 0.94)
39
+
40
+ local detail = parent:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
41
+ detail:SetPoint("TOPLEFT", value, "BOTTOMLEFT", 0, -7)
42
+ detail:SetPoint("RIGHT", -18, 0)
43
+ detail:SetJustifyH("LEFT")
44
+ detail:SetText(detailText)
45
+ detail:SetTextColor(1, 1, 1, 0.34)
46
+ end
47
+
48
+ function ns.CreateAboutPage(parent, ui)
49
+ local page = CreateFrame("Frame", nil, parent)
50
+ page:SetAllPoints(parent)
51
+
52
+ local description = page:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
53
+ description:SetPoint("TOPLEFT", 17, -101)
54
+ description:SetWidth(930)
55
+ description:SetJustifyH("LEFT")
56
+ description:SetText(L.ABOUT_DESCRIPTION)
57
+ description:SetTextColor(0.92, 0.94, 0.96, 0.92)
58
+
59
+ local version = "0.7.2"
60
+ version = ns.Client.GetAddOnMetadata(ADDON_NAME, "Version") or version
61
+
62
+ local accent = page:CreateTexture(nil, "ARTWORK")
63
+ accent:SetColorTexture(ui.accentR, ui.accentG, ui.accentB, 0.92)
64
+ accent:SetPoint("TOPLEFT", 17, -137)
65
+ accent:SetSize(32, 2)
66
+
67
+ local projectLabel = ui.CreateSectionLabel(page, L.ABOUT_PROJECT)
68
+ projectLabel:SetPoint("TOPLEFT", 17, -166)
69
+
70
+ local metadata = CreateFrame("Frame", nil, page)
71
+ metadata:SetPoint("TOPLEFT", 14, -188)
72
+ metadata:SetPoint("TOPRIGHT", -14, -188)
73
+ metadata:SetHeight(112)
74
+ local metadataBackground = metadata:CreateTexture(nil, "BACKGROUND")
75
+ metadataBackground:SetAllPoints()
76
+ metadataBackground:SetColorTexture(ui.surfaceR, ui.surfaceG, ui.surfaceB, 0.24)
77
+
78
+ local metaItems = {
79
+ version = CreateMetaItem(metadata, L.ABOUT_VERSION, version, 18, -12, 250),
80
+ author = CreateMetaItem(metadata, L.ABOUT_AUTHOR, "Follen", 330, -12, 250),
81
+ command = CreateMetaItem(metadata, L.ABOUT_COMMAND, "/dev", 642, -12, 250),
82
+ clients = CreateMetaItem(metadata, L.ABOUT_CLIENT, L.ABOUT_CLIENT_VALUE, 18, -64, 920),
83
+ }
84
+
85
+ for _, x in ipairs({ 312, 624 }) do
86
+ local separator = metadata:CreateTexture(nil, "ARTWORK")
87
+ separator:SetColorTexture(1, 1, 1, 0.06)
88
+ separator:SetPoint("TOPLEFT", x, -10)
89
+ separator:SetPoint("BOTTOMLEFT", x, 58)
90
+ separator:SetWidth(1)
91
+ end
92
+
93
+ local metadataDivider = metadata:CreateTexture(nil, "ARTWORK")
94
+ metadataDivider:SetColorTexture(1, 1, 1, 0.06)
95
+ metadataDivider:SetPoint("TOPLEFT", 18, -55)
96
+ metadataDivider:SetPoint("TOPRIGHT", -18, -55)
97
+ metadataDivider:SetHeight(1)
98
+
99
+ local environmentLabel = ui.CreateSectionLabel(page, L.ABOUT_ENVIRONMENT)
100
+ environmentLabel:SetPoint("TOPLEFT", 17, -329)
101
+
102
+ CreateEnvironmentRow(page, L.ABOUT_DEPENDENCY, L.ABOUT_DEPENDENCY_STATUS,
103
+ L.ABOUT_DEPENDENCY_DETAIL, -358, true)
104
+
105
+ local rowDivider = page:CreateTexture(nil, "ARTWORK")
106
+ rowDivider:SetColorTexture(1, 1, 1, 0.06)
107
+ rowDivider:SetPoint("TOPLEFT", 190, -403)
108
+ rowDivider:SetPoint("TOPRIGHT", -18, -403)
109
+ rowDivider:SetHeight(1)
110
+
111
+ CreateEnvironmentRow(page, L.ABOUT_SAFETY, L.ABOUT_SAFETY_STATUS,
112
+ L.ABOUT_SAFETY_TEXT, -423, false)
113
+
114
+ local githubButton = CreateFrame("Button", nil, page)
115
+ githubButton:SetSize(38, 38)
116
+ githubButton:SetPoint("BOTTOMLEFT", 17, 17)
117
+
118
+ local githubIcon = githubButton:CreateTexture(nil, "ARTWORK")
119
+ githubIcon:SetAllPoints()
120
+ githubIcon:SetTexture("Interface\\AddOns\\" .. ADDON_NAME .. "\\Media\\GitHub.png")
121
+ githubIcon:SetAlpha(0.38)
122
+
123
+ githubButton:SetScript("OnEnter", function()
124
+ githubIcon:SetAlpha(0.72)
125
+ end)
126
+ githubButton:SetScript("OnLeave", function()
127
+ githubIcon:SetAlpha(0.38)
128
+ end)
129
+
130
+ local linkPopup
131
+ local linkBackdrop
132
+
133
+ local function HideLinkPopup()
134
+ if linkPopup then
135
+ linkPopup:Hide()
136
+ end
137
+ if linkBackdrop then
138
+ linkBackdrop:Hide()
139
+ end
140
+ end
141
+
142
+ local function EnsureLinkPopup()
143
+ if linkPopup then
144
+ return linkPopup
145
+ end
146
+
147
+ linkBackdrop = CreateFrame("Button", nil, UIParent)
148
+ linkBackdrop:SetAllPoints(UIParent)
149
+ linkBackdrop:SetFrameStrata("DIALOG")
150
+ linkBackdrop:SetFrameLevel(499)
151
+ linkBackdrop:RegisterForClicks("AnyUp")
152
+ linkBackdrop:SetScript("OnClick", HideLinkPopup)
153
+ local shade = linkBackdrop:CreateTexture(nil, "BACKGROUND")
154
+ shade:SetAllPoints()
155
+ shade:SetColorTexture(0, 0, 0, 0.24)
156
+
157
+ linkPopup = ui.CreatePanel(UIParent, ui.surfaceR, ui.surfaceG, ui.surfaceB, 0.98)
158
+ linkPopup:SetSize(420, 54)
159
+ linkPopup:SetFrameStrata("DIALOG")
160
+ linkPopup:SetFrameLevel(500)
161
+ linkPopup:EnableMouse(true)
162
+
163
+ local urlPanel = ui.CreatePanel(linkPopup, ui.editorR, ui.editorG, ui.editorB, 1)
164
+ urlPanel:SetPoint("TOPLEFT", 12, -10)
165
+ urlPanel:SetPoint("BOTTOMRIGHT", -12, 10)
166
+
167
+ local urlBox = CreateFrame("EditBox", nil, urlPanel)
168
+ urlBox:SetPoint("TOPLEFT", 10, -1)
169
+ urlBox:SetPoint("BOTTOMRIGHT", -10, 1)
170
+ urlBox:SetAutoFocus(false)
171
+ urlBox:SetFontObject(ChatFontNormal)
172
+ urlBox:SetJustifyH("CENTER")
173
+ urlBox:SetTextColor(0.94, 0.95, 0.96)
174
+ urlBox.savedText = REPOSITORY_URL
175
+ urlBox:SetText(REPOSITORY_URL)
176
+ urlBox:SetScript("OnEscapePressed", function(self)
177
+ self:ClearFocus()
178
+ HideLinkPopup()
179
+ end)
180
+ urlBox:SetScript("OnMouseUp", function(self)
181
+ self:SetFocus()
182
+ self:HighlightText()
183
+ end)
184
+ urlBox:SetScript("OnTextChanged", function(self)
185
+ if not self.updatingText and self:GetText() ~= self.savedText then
186
+ self.updatingText = true
187
+ self:SetText(self.savedText)
188
+ self.updatingText = nil
189
+ self:HighlightText()
190
+ end
191
+ end)
192
+
193
+ linkPopup:SetScript("OnMouseDown", function()
194
+ urlBox:SetFocus()
195
+ urlBox:HighlightText()
196
+ end)
197
+ linkPopup:Hide()
198
+ linkBackdrop:Hide()
199
+
200
+ linkPopup.urlBox = urlBox
201
+ linkPopup.backdrop = linkBackdrop
202
+ page.linkPopup = linkPopup
203
+ page.linkBackdrop = linkBackdrop
204
+ page.urlBox = urlBox
205
+ return linkPopup
206
+ end
207
+
208
+ githubButton:SetScript("OnClick", function()
209
+ local popup = EnsureLinkPopup()
210
+ popup:ClearAllPoints()
211
+ popup:SetPoint("BOTTOMLEFT", githubButton, "TOPLEFT", 0, 10)
212
+ linkBackdrop:Show()
213
+ popup:Show()
214
+ popup.urlBox:SetFocus()
215
+ popup.urlBox:HighlightText()
216
+ end)
217
+ page:SetScript("OnHide", HideLinkPopup)
218
+
219
+ page.githubButton = githubButton
220
+ page.githubIcon = githubIcon
221
+ page.metaItems = metaItems
222
+ return page
223
+ end
@@ -0,0 +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