15 rect.
id = ImGui::GetItemID();
16 rect.
min = ImGui::GetItemRectMin();
17 rect.
max = ImGui::GetItemRectMax();
22 const std::function<
void()>& callback,
27 if (ImGui::SmallButton(button_label)) {
28 if (rect !=
nullptr) {
34 if (rect !=
nullptr) {
37 ImGui::SetItemTooltip(
"%s", tooltip);
44 std::chrono::system_clock::time_point timestamp) {
45 const std::time_t raw = std::chrono::system_clock::to_time_t(timestamp);
48 localtime_s(&local_tm, &raw);
50 localtime_r(&raw, &local_tm);
53 std::strftime(buffer,
sizeof(buffer),
"%Y-%m-%d %H:%M:%S", &local_tm);
54 return std::string(buffer);
73 const char* fallback_icon) {
74 switch (status.
state) {
88 const std::string& output_log) {
89 if (!output_log.empty()) {
94 if (!status.
detail.empty()) {
95 if (!payload.empty()) {
98 payload.append(status.
detail);
101 if (!payload.empty()) {
102 payload.append(
"\n");
111 if (build_log.empty()) {
114 if (ImGui::SmallButton(
"Copy Current Log##workflow_copy_current_log")) {
115 rect = LastItemRect();
116 ImGui::SetClipboardText(build_log.c_str());
119 rect = LastItemRect();
128 bool drew_action =
false;
132 DrawWorkflowActionButton(
133 "Open Output##workflow_open_output",
134 "Open the Workflow Output panel", callbacks.
show_output,
143 DrawWorkflowActionButton(
144 "Rebuild##workflow_rebuild",
"Rebuild project",
151 DrawWorkflowActionButton(
152 "Run Again##workflow_run_again",
157 const std::string copy_payload =
163 if (ImGui::SmallButton(
"Copy Log##workflow_copy_log")) {
165 ImGui::SetClipboardText(copy_payload.c_str());
175 const std::vector<ProjectWorkflowHistoryEntry>& history,
176 size_t max_entries) {
177 if (max_entries == 0 || history.empty()) {
180 const size_t count = std::min(history.size(), max_entries);
181 return std::vector<ProjectWorkflowHistoryEntry>(history.begin(),
182 history.begin() + count);
const Theme & GetCurrentTheme() const
static ThemeManager & Get()
#define ICON_MD_CHECK_CIRCLE
WorkflowButtonRect DrawCopyCurrentLogButton(const std::string &build_log)
std::string FormatHistoryTime(std::chrono::system_clock::time_point timestamp)
const char * WorkflowIcon(const ProjectWorkflowStatus &status, const char *fallback_icon)
std::string BuildCopyPayload(const ProjectWorkflowStatus &status, const std::string &output_log)
WorkflowActionRowResult DrawHistoryActionRow(const ProjectWorkflowHistoryEntry &entry, const WorkflowActionCallbacks &callbacks, const WorkflowActionRowOptions &options)
std::vector< ProjectWorkflowHistoryEntry > SelectWorkflowPreviewEntries(const std::vector< ProjectWorkflowHistoryEntry > &history, size_t max_entries)
ImVec4 WorkflowColor(ProjectWorkflowState state)
ImVec4 ConvertColorToImVec4(const Color &color)
ImVec4 GetTextSecondaryVec4()
ProjectWorkflowStatus status
ProjectWorkflowState state
std::function< void()> run_project
std::function< void()> show_output
std::function< void()> start_build
WorkflowButtonRect copy_log
WorkflowButtonRect open_output
WorkflowButtonRect primary_action