diff --git a/inc/Core/Admin/Pages/Pipelines/PipelinesFilters.php b/inc/Core/Admin/Pages/Pipelines/PipelinesFilters.php index d625acee6..865b1bfb0 100644 --- a/inc/Core/Admin/Pages/Pipelines/PipelinesFilters.php +++ b/inc/Core/Admin/Pages/Pipelines/PipelinesFilters.php @@ -91,82 +91,5 @@ function ( $pages ) { ); } -/** - * Get AI providers formatted for React - * - * @return array AI providers with models - */ -function datamachine_get_ai_providers_for_react() { - try { - // Use AI HTTP Client library's filters directly - $library_providers = apply_filters( 'chubes_ai_providers', array() ); - - $providers = array(); - foreach ( $library_providers as $key => $provider_info ) { - // Get models for this provider via filter - $models = apply_filters( 'chubes_ai_models', $key ); - - $providers[ $key ] = array( - 'label' => $provider_info['name'] ?? ucfirst( $key ), - 'models' => $models, - ); - } - - return $providers; - } catch ( \Exception $e ) { - do_action( - 'datamachine_log', - 'error', - 'Failed to get AI providers for React', - array( - 'error' => $e->getMessage(), - 'exception' => $e, - ) - ); - return array(); - } -} - -/** - * Get AI tools formatted for React. - * - * Returns only global (non-handler) tools from the unified `datamachine_tools` - * registry. Handler tools are excluded because their definitions are shaped - * by runtime handler config and are only meaningful inside a pipeline - * execution context. - * - * @return array AI tools with configuration status - */ -function datamachine_get_ai_tools_for_react() { - $tool_manager = new \DataMachine\Engine\AI\Tools\ToolManager(); - $all_tools = $tool_manager->get_all_tools(); - - // Filter to only global tools — exclude both per-handler tools (carry - // a 'handler' link) and handler tool registry wrappers. - $global_tools = array_filter( - $all_tools, - function ( $tool_def ) { - if ( ! is_array( $tool_def ) ) { - return false; - } - if ( isset( $tool_def['_handler_callable'] ) ) { - return false; - } - return ! isset( $tool_def['handler'] ); - } - ); - - $tools = array(); - foreach ( $global_tools as $tool_id => $tool_def ) { - $tools[ $tool_id ] = array( - 'label' => $tool_def['label'] ?? ucfirst( str_replace( '_', ' ', $tool_id ) ), - 'description' => $tool_def['description'] ?? '', - 'configured' => apply_filters( 'datamachine_tool_configured', false, $tool_id ), - ); - } - - return $tools; -} - // Auto-register when file loads - achieving complete self-containment add_action( 'init', __NAMESPACE__ . '\\datamachine_register_pipelines_admin_page_filters' ); diff --git a/inc/Core/Admin/Pages/Pipelines/assets/css/chat-input.css b/inc/Core/Admin/Pages/Pipelines/assets/css/chat-input.css index 1130cddf9..70260b446 100644 --- a/inc/Core/Admin/Pages/Pipelines/assets/css/chat-input.css +++ b/inc/Core/Admin/Pages/Pipelines/assets/css/chat-input.css @@ -1,7 +1,8 @@ /** * Chat Input Styles * - * Input area, textarea, and send button. + * Input container only. Textarea and send button are handled by the + * @extrachill/chat library components. */ /* ===== INPUT CONTAINER ===== */ @@ -14,38 +15,3 @@ align-items: flex-end; flex-shrink: 0; } - -/* ===== TEXTAREA ===== */ - -.datamachine-chat-input__textarea { - flex: 1; - padding: 8px 12px; - border: 1px solid #ddd; - border-radius: 8px; - font-family: inherit; - font-size: 13px; - line-height: 1.4; - resize: none; - min-height: 36px; - max-height: 120px; -} - -.datamachine-chat-input__textarea:focus { - outline: none; - border-color: #007cba; - box-shadow: 0 0 0 1px #007cba; -} - -.datamachine-chat-input__textarea:disabled { - background: #f9f9f9; - color: #757575; -} - -/* ===== SEND BUTTON ===== */ - -.datamachine-chat-input__send { - flex-shrink: 0; - min-width: 36px; - height: 36px; - padding: 0; -} diff --git a/inc/Core/Admin/Pages/Pipelines/assets/css/chat-messages.css b/inc/Core/Admin/Pages/Pipelines/assets/css/chat-messages.css index 0b962e059..e11e86301 100644 --- a/inc/Core/Admin/Pages/Pipelines/assets/css/chat-messages.css +++ b/inc/Core/Admin/Pages/Pipelines/assets/css/chat-messages.css @@ -1,11 +1,12 @@ /** * Chat Messages Styles * - * Message list, individual messages, markdown rendering, code blocks, - * typing indicator, and timestamps. + * Message list container only. Individual messages, markdown rendering, + * code blocks, typing indicator, and timestamps are handled by the + * @extrachill/chat library components. */ -/* ===== MESSAGE LIST ===== */ +/* ===== MESSAGE LIST CONTAINER ===== */ .datamachine-chat-messages { flex: 1; @@ -15,160 +16,3 @@ flex-direction: column; gap: 12px; } - -.datamachine-chat-messages__empty { - color: #757575; - font-size: 13px; - text-align: center; - padding: 20px; - line-height: 1.5; -} - -/* ===== INDIVIDUAL MESSAGE ===== */ - -.datamachine-chat-message { - max-width: 90%; - padding: 10px 14px; - border-radius: 12px; - font-size: 13px; - line-height: 1.5; - word-wrap: break-word; -} - -.datamachine-chat-message--user { - background: #007cba; - color: #fff; - margin-left: auto; - border-bottom-right-radius: 4px; -} - -.datamachine-chat-message--assistant { - background: #f0f0f0; - color: #1e1e1e; - margin-right: auto; - border-bottom-left-radius: 4px; -} - -/* ===== MESSAGE CONTENT & MARKDOWN ===== */ - -.datamachine-chat-message__content { - word-break: break-word; - overflow-wrap: anywhere; -} - -.datamachine-chat-message__content p:first-child { - margin-top: 0; -} - -.datamachine-chat-message__content p:last-child { - margin-bottom: 0; -} - -.datamachine-chat-message__content h1, -.datamachine-chat-message__content h2, -.datamachine-chat-message__content h3, -.datamachine-chat-message__content h4 { - margin: 12px 0 8px; - font-size: 1.1em; - line-height: 1.3; -} - -.datamachine-chat-message__content ul, -.datamachine-chat-message__content ol { - margin: 8px 0; - padding-left: 20px; -} - -.datamachine-chat-message__content li { - margin-bottom: 4px; -} - -/* ===== CODE BLOCKS ===== */ - -.datamachine-chat-message__content code { - background: rgba(0, 0, 0, 0.05); - padding: 2px 4px; - border-radius: 4px; - font-size: 0.9em; - font-family: Menlo, Monaco, Consolas, "Courier New", monospace; - overflow-wrap: anywhere; -} - -.datamachine-chat-message--user .datamachine-chat-message__content code { - background: rgba(255, 255, 255, 0.2); - color: #fff; -} - -/* ===== TOOL SUMMARY (inline) ===== */ - -.datamachine-chat-message__tools { - margin-top: 8px; - font-size: 11px; - color: #757575; - font-style: italic; -} - -.datamachine-chat-message--user .datamachine-chat-message__tools { - color: rgba(255, 255, 255, 0.7); -} - -/* ===== TIMESTAMP ===== */ - -.datamachine-chat-message__timestamp { - display: none; - font-size: 10px; - color: #999; - margin-top: 4px; -} - -.datamachine-chat-message:hover .datamachine-chat-message__timestamp { - display: block; -} - -.datamachine-chat-message--user .datamachine-chat-message__timestamp { - color: rgba(255, 255, 255, 0.6); -} - -/* ===== TYPING INDICATOR ===== */ - -.datamachine-chat-messages__typing { - display: flex; - align-items: center; - gap: 4px; - padding: 10px 14px; - background: #f0f0f0; - border-radius: 12px; - border-bottom-left-radius: 4px; - width: fit-content; -} - -.datamachine-typing-dot { - width: 8px; - height: 8px; - background: #757575; - border-radius: 50%; - animation: datamachine-typing-bounce 1.4s infinite ease-in-out both; -} - -.datamachine-typing-dot:nth-child(1) { - animation-delay: -0.32s; -} - -.datamachine-typing-dot:nth-child(2) { - animation-delay: -0.16s; -} - -.datamachine-typing-dot:nth-child(3) { - animation-delay: 0s; -} - -@keyframes datamachine-typing-bounce { - 0%, 80%, 100% { - transform: scale(0.6); - opacity: 0.5; - } - 40% { - transform: scale(1); - opacity: 1; - } -} diff --git a/inc/Core/Admin/Pages/Pipelines/assets/css/chat-sidebar.css b/inc/Core/Admin/Pages/Pipelines/assets/css/chat-sidebar.css index a793638a6..610422ea7 100644 --- a/inc/Core/Admin/Pages/Pipelines/assets/css/chat-sidebar.css +++ b/inc/Core/Admin/Pages/Pipelines/assets/css/chat-sidebar.css @@ -8,7 +8,6 @@ @import url("chat-messages.css"); @import url("chat-input.css"); @import url("chat-sessions.css"); -@import url("chat-tools.css"); /* ===== LAYOUT ===== */ @@ -81,33 +80,10 @@ position: relative; } -.datamachine-chat-sidebar__new, .datamachine-chat-sidebar__copy { font-size: 12px; } -/* ===== PROCESSING INDICATOR ===== */ - -.datamachine-chat-sidebar__processing { - padding: 8px 16px; - background: #f9f9f9; - border-top: 1px solid #eee; - font-size: 12px; - color: #757575; - text-align: center; - flex-shrink: 0; - animation: datamachine-processing-pulse 1.5s ease-in-out infinite; -} - -@keyframes datamachine-processing-pulse { - 0%, 100% { - opacity: 0.7; - } - 50% { - opacity: 1; - } -} - /* ===== RESPONSIVE ===== */ @media (max-width: 960px) { diff --git a/inc/Core/Admin/Pages/Pipelines/assets/css/chat-tools.css b/inc/Core/Admin/Pages/Pipelines/assets/css/chat-tools.css deleted file mode 100644 index 804336c07..000000000 --- a/inc/Core/Admin/Pages/Pipelines/assets/css/chat-tools.css +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Chat Tools Styles - * - * Tool call/result display — collapsible tool messages. - */ - -/* ===== TOOL MESSAGE (Collapsible) ===== */ - -.datamachine-tool-message { - margin: 4px 0; -} - -.datamachine-tool-message__toggle { - display: flex; - align-items: center; - gap: 6px; - width: 100%; - padding: 6px 10px; - background: transparent; - border: 1px dashed #ddd; - border-radius: 6px; - font-size: 12px; - color: #757575; - cursor: pointer; - text-align: left; -} - -.datamachine-tool-message__toggle:hover { - background: #f9f9f9; - border-color: #ccc; -} - -.datamachine-tool-message__indicator { - display: flex; - align-items: center; - justify-content: center; - width: 16px; - height: 16px; - border-radius: 50%; - flex-shrink: 0; -} - -.datamachine-tool-message__indicator--success { - background: #00a32a; - color: #fff; -} - -.datamachine-tool-message__indicator--error { - background: #d63638; - color: #fff; -} - -.datamachine-tool-message__name { - font-weight: 500; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.datamachine-tool-message__timestamp { - display: none; - font-size: 10px; - color: #999; - margin-left: auto; - flex-shrink: 0; -} - -.datamachine-tool-message__toggle:hover .datamachine-tool-message__timestamp { - display: block; -} - -.datamachine-tool-message__details { - margin-top: 8px; - padding: 10px; - background: #f9f9f9; - border: 1px solid #eee; - border-radius: 6px; - font-size: 11px; -} - -.datamachine-tool-message__tool { - margin-bottom: 12px; -} - -.datamachine-tool-message__tool:last-child { - margin-bottom: 0; -} - -.datamachine-tool-message__tool-header { - font-weight: 600; - color: #1e1e1e; - margin-bottom: 8px; - padding-bottom: 4px; - border-bottom: 1px solid #ddd; -} - -.datamachine-tool-message__section { - margin-bottom: 8px; -} - -.datamachine-tool-message__section:last-child { - margin-bottom: 0; -} - -.datamachine-tool-message__label { - font-weight: 600; - color: #1e1e1e; - margin-bottom: 4px; - font-size: 10px; - text-transform: uppercase; - letter-spacing: 0.5px; -} - -.datamachine-tool-message__text { - color: #555; - margin-bottom: 4px; -} - -.datamachine-tool-message__details pre { - margin: 0; - padding: 8px; - background: #fff; - border: 1px solid #eee; - border-radius: 4px; - white-space: pre-wrap; - word-break: break-word; - color: #555; - font-size: 10px; - max-height: 200px; - overflow-y: auto; -} - -.datamachine-tool-message__pending { - color: #757575; - font-style: italic; -} diff --git a/inc/Core/Admin/Pages/Pipelines/assets/css/pipelines-modal.css b/inc/Core/Admin/Pages/Pipelines/assets/css/pipelines-modal.css index 378cb2e6b..26c2b0159 100644 --- a/inc/Core/Admin/Pages/Pipelines/assets/css/pipelines-modal.css +++ b/inc/Core/Admin/Pages/Pipelines/assets/css/pipelines-modal.css @@ -43,10 +43,6 @@ } /* Modal body - main content area */ -.datamachine-modal-body { - /* Main content area with consistent spacing */ -} - /* Modal error display */ .datamachine-modal-error { margin-bottom: 16px; @@ -60,14 +56,6 @@ border-bottom: 1px solid var(--datamachine-border-1); } -.datamachine-modal-section--spaced { - margin-bottom: 24px; -} - -.datamachine-modal-section--no-border { - border-bottom: none; -} - /* ===== MODAL UTILITIES ===== */ /* Modal empty states */ @@ -84,12 +72,6 @@ } /* Modal descriptions */ -.datamachine-modal-description { - margin-bottom: 16px; - color: #757575; - font-size: 14px; -} - /* Modal info boxes */ .datamachine-modal-info-box { margin-top: 16px; @@ -207,11 +189,6 @@ font-weight: 500; } -.datamachine-modal-badge--info { - background: #0073aa; - color: #fff; -} - /* Handler display in modal sections */ .datamachine-modal-handler-display { margin-top: 12px; @@ -248,28 +225,12 @@ } /* Modal text variants */ -.datamachine-modal-text--note { - margin: 0; - font-size: 12px; - color: #757575; -} - .datamachine-modal-text--info { margin: 0; font-size: 12px; color: #757575; } -.datamachine-modal-text--highlight { - margin: 0; - font-size: 12px; - color: #0073aa; -} - -.datamachine-modal-text--strong { - font-weight: 600; -} - /* Modal loading/empty states */ .datamachine-modal-loading-state { padding: 40px; @@ -306,10 +267,6 @@ gap: 12px; } -.datamachine-warning-icon-container { - flex-shrink: 0; -} - .datamachine-warning-content { flex: 1; } @@ -336,12 +293,6 @@ } /* Tool selector layouts */ -.datamachine-tools-grid { - display: grid; - grid-template-columns: repeat(2, 1fr); - gap: 12px; -} - .datamachine-tool-checkbox-simple { padding: 12px; border: 1px solid var(--datamachine-border-1); @@ -379,23 +330,11 @@ } /* Form field wrapper for modal components */ -.datamachine-form-field-wrapper { - position: relative; - z-index: 1; -} - /* Tool spacing */ .datamachine-tools-spacing--mt-16 { margin-top: 16px; } -.datamachine-tools-header { - margin-bottom: 12px; - padding: 10px; - background: #f9f9f9; - border-radius: var(--datamachine-border-radius); -} - /* ============================================================================ PHASE 6: Handler Settings Sub-Components ========================================================================= */ @@ -645,10 +584,6 @@ } /* Step Cards */ -.datamachine-step-card-section { - margin-bottom: 12px; -} - .datamachine-step-card-header { display: flex; align-items: center; @@ -663,16 +598,6 @@ } /* AI Config Display */ -.datamachine-ai-config-section { - margin-top: 12px; -} - -.datamachine-ai-config-meta { - font-size: 12px; - color: #757575; - margin-bottom: 8px; -} - /* Empty Cards - moved to pipelines-page.css for proper architectural separation */ /* Flow Handler Components */ @@ -688,12 +613,6 @@ margin-top: 12px; } -.datamachine-handler-empty-text { - margin: 0 0 8px 0; - font-size: 12px; - color: #856404; -} - .datamachine-handler-tag { display: inline-block; padding: 4px 12px; @@ -723,58 +642,13 @@ margin-bottom: 16px; } -.datamachine-section-title { - margin: 0 0 8px 0; - font-size: 16px; - font-weight: 600; -} - -.datamachine-section-description { - margin: 0; - color: #757575; - font-size: 12px; -} - -.datamachine-section-content { - margin-bottom: 24px; -} - -.datamachine-section-loading { - text-align: center; - padding: 20px; - color: #757575; -} - /* Pipeline Steps Layout */ -.datamachine-pipeline-steps-wrapper { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 20px; - padding: 20px 0; -} - .datamachine-pipeline-steps-empty { padding: 20px; text-align: center; } -.datamachine-pipeline-steps-empty-text { - color: #757575; - margin-bottom: 16px; -} - -.datamachine-step-item { - flex: 0 0 auto; - min-width: 300px; - max-width: 300px; -} - /* Modal Empty States */ -.datamachine-modal-empty-state-text { - margin: 0; -} - /* Responsive adjustments for modal utilities */ @media (max-width: 768px) { .datamachine-modal-grid-2col { @@ -793,21 +667,7 @@ /* ===== FILES HANDLER MODAL STYLES ===== */ - /* File status section */ -.datamachine-uploaded-files-section { - margin-top: 20px; - border-top: 1px solid var(--datamachine-border-2); - padding-top: 20px; -} - -.datamachine-files-section-header { - display: flex; - justify-content: space-between; - align-items: center; - margin-bottom: 15px; -} - .datamachine-files-section-header h5 { margin: 0; color: #1d2327; @@ -820,12 +680,6 @@ } /* File states */ -.datamachine-files-state { - padding: 20px; - text-align: center; - color: #646970; -} - .datamachine-loading-files .dashicons { animation: spin 1s linear infinite; } @@ -835,59 +689,11 @@ 100% { transform: rotate(360deg); } } -.datamachine-empty-files { - background: #f9f9f9; - border-radius: var(--datamachine-border-radius); -} - -.datamachine-empty-icon { - font-size: 48px; - color: #c3c4c7; - margin-bottom: 10px; -} - -.datamachine-empty-message { - margin: 0 0 8px 0; - color: #50575e; - font-weight: 500; -} - -.datamachine-empty-hint { - margin: 0; - font-size: 12px; - color: #8c8f94; -} - - -.datamachine-file-row.datamachine-file-status-processed { - background: #f8fff8; -} - -.datamachine-file-row.datamachine-file-status-pending { - background: #fffef7; -} - -.datamachine-file-name { - font-weight: 500; -} - -.datamachine-file-actions-col { - width: 60px; - text-align: center; -} - -.datamachine-delete-file { - padding: 4px 6px; - min-height: unset; - line-height: 1; -} - -.datamachine-delete-file .dashicons { +.datamachine-file-row.datamachine-file-row.datamachine-delete-file .dashicons { font-size: 14px; line-height: 1; } - /* Tab content (used by ImportExportModal) */ .datamachine-tab-content { padding: 0; @@ -898,12 +704,6 @@ } /* Form field styling (used by Jobs modals) */ -.datamachine-form-field { - display: flex; - flex-direction: column; - gap: 5px; -} - .datamachine-form-field label { font-weight: 600; color: #333; diff --git a/inc/Core/Admin/Pages/Pipelines/assets/css/pipelines-page.css b/inc/Core/Admin/Pages/Pipelines/assets/css/pipelines-page.css index 501673805..242091bfe 100644 --- a/inc/Core/Admin/Pages/Pipelines/assets/css/pipelines-page.css +++ b/inc/Core/Admin/Pages/Pipelines/assets/css/pipelines-page.css @@ -38,72 +38,17 @@ } /* Spacing utilities */ -.datamachine-spacing--margin-bottom-16 { - margin-bottom: 16px; -} .datamachine-spacing--margin-bottom-20 { margin-bottom: 20px; } -.datamachine-spacing--margin-bottom-24 { - margin-bottom: 24px; -} - -.datamachine-spacing--margin-top-12 { - margin-top: 12px; -} - -.datamachine-spacing--margin-top-16 { - margin-top: 16px; -} - -.datamachine-spacing--margin-top-24 { - margin-top: 24px; -} - /* Color utilities */ .datamachine-color--text-muted { color: #757575; } -.datamachine-color--text-secondary { - color: #646970; -} - -.datamachine-color--text-error { - color: #dc3232; -} - /* Typography utilities */ -.datamachine-text--h4 { - margin: 0 0 8px 0; - font-size: 14px; - font-weight: 600; -} - -.datamachine-text--description { - margin: 0 0 12px 0; - font-size: 12px; - color: #757575; -} - -.datamachine-text--note { - margin: 0; - font-size: 12px; - color: #0073aa; -} - -/* Layout utilities */ -.datamachine-layout--flex-center { - display: flex; - align-items: center; -} - -.datamachine-layout--flex-column { - display: flex; - flex-direction: column; -} /* Empty state styling */ .datamachine-empty-state { @@ -122,17 +67,6 @@ } /* Table styling */ -.datamachine-table { - width: 100%; - border-collapse: collapse; -} - -.datamachine-table--bordered { - border: 1px solid var(--datamachine-border-1); - border-radius: var(--datamachine-border-radius); - max-height: 300px; - overflow-y: auto; -} /* Status badges - base moved to root.css */ @@ -145,7 +79,6 @@ box-shadow: 0 2px 4px rgba(0,0,0,0.1); } - /* ===== COMPONENT: PIPELINE HEADER ===== */ .datamachine-pipeline-header { @@ -176,12 +109,7 @@ outline: none; } - /* Pipeline sections */ -.datamachine-pipeline-steps-section, -.datamachine-pipeline-flows { - padding: 20px; -} /* Pipeline steps - horizontal scrolling flex layout */ .datamachine-pipeline-steps { @@ -215,7 +143,6 @@ box-shadow: 0 1px 3px rgba(0,0,0,0.1); } - /* ===== COMPONENT: FLOW HEADER ===== */ .datamachine-flow-header { @@ -428,21 +355,6 @@ } /* Status badge variants - base moved to root.css */ -.datamachine-status-badge--processed { - background: rgba(70, 180, 80, 0.13); - color: #46b450; -} - -.datamachine-status-badge--pending { - background: rgba(240, 184, 73, 0.13); - color: #f0b849; -} - -.datamachine-flow-steps__list { - display: flex; - flex-wrap: wrap; - align-items: center; -} /* Individual step containers within flow steps */ .datamachine-flow-step-container { @@ -494,13 +406,9 @@ word-break: break-all; max-width: 100%; box-sizing: border-box; -} - -.datamachine-handler-settings-display div { background: #f0f0f0; } - /* Responsive design */ @media (max-width: 768px) { .datamachine-pipelines-page { @@ -566,56 +474,6 @@ } /* Empty step content styling - uses same card structure as populated steps */ -.datamachine-step-empty-content { - display: flex; - align-items: center; - justify-content: center; - height: 100%; -} - -/* Delete button styling - WordPress standard */ -.button-link-delete { - color: #d63638; - border: none; - background: transparent; - box-shadow: none; - text-decoration: none; -} - -.button-link-delete:hover { - color: #d63638; - background: transparent; - text-decoration: underline; -} - -/* Red delete button styling - secondary style with red border and text */ -.button-delete { - background: #fff; - border-color: #d63638; - color: #d63638; -} - -.button-delete:hover, -.button-delete:focus { - background: #f8f9fa; - border-color: #b32d2e; - color: #b32d2e; -} - -/* Configure button styling - WordPress admin blue */ -.button-link-configure { - color: #0073aa; - border: none; - background: transparent; - box-shadow: none; - text-decoration: none; -} - -.button-link-configure:hover { - color: #0073aa; - background: transparent; - text-decoration: underline; -} /* Universal data flow arrows - inline flex items */ .datamachine-data-flow-arrow { @@ -668,43 +526,6 @@ /* Hidden element utility now in root.css */ -/* Admin notice dismissible features - extends root.css base */ -.datamachine-admin-notice--dismissible { - padding-right: 38px; - position: relative; -} - -.datamachine-admin-notice .notice-dismiss { - background: none; - border: none; - border-radius: 0; - color: #787c82; - cursor: pointer; - float: right; - font-size: 12px; - height: 38px; - margin: 0; - overflow: hidden; - padding: 9px; - position: absolute; - right: 1px; - text-align: center; - text-decoration: none; - top: 0; - width: 38px; - z-index: 1; -} - -.datamachine-admin-notice .notice-dismiss:hover, -.datamachine-admin-notice .notice-dismiss:active { - color: #d63638; -} - -.datamachine-admin-notice .notice-dismiss:focus { - box-shadow: 0 0 0 1px #72aee6, 0 0 2px 1px rgba(54, 144, 192, 0.8); - outline: 2px solid transparent; -} - /* ===== PIPELINE STEP CARD ===== */ /** * WordPress Components Overrides @@ -724,13 +545,6 @@ margin-top: 12px; } -.datamachine-step-card-ai-label, -.datamachine-step-card-tools-label { - font-size: 12px; - color: #757575; - margin-bottom: 8px; -} - .datamachine-step-card-actions { display: flex; gap: 8px; diff --git a/inc/Core/Admin/Pages/Pipelines/assets/react/components/shared/LoadingSpinner.jsx b/inc/Core/Admin/Pages/Pipelines/assets/react/components/shared/LoadingSpinner.jsx deleted file mode 100644 index b8c256e66..000000000 --- a/inc/Core/Admin/Pages/Pipelines/assets/react/components/shared/LoadingSpinner.jsx +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Loading Spinner Component - * - * Reusable loading indicator with optional message. - */ - -/** - * WordPress dependencies - */ -import { Spinner } from '@wordpress/components'; -import { __ } from '@wordpress/i18n'; - -/** - * Loading Spinner Component - * - * @param {Object} props - Component props - * @param {string} props.message - Optional loading message - * @return {React.ReactElement} Loading spinner - */ -export default function LoadingSpinner( { message } ) { - return ( -
- - { message && ( -

- { message } -

- ) } -
- ); -} diff --git a/inc/Core/Admin/Pages/Pipelines/assets/react/hooks/useHandlersAPI.js b/inc/Core/Admin/Pages/Pipelines/assets/react/hooks/useHandlersAPI.js deleted file mode 100644 index 05c3f2583..000000000 --- a/inc/Core/Admin/Pages/Pipelines/assets/react/hooks/useHandlersAPI.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Handlers API Hook - * - * Fetch handlers from REST API with optional step type filtering. - * Provides loading and error states for components. - */ - -/** - * WordPress dependencies - */ -import { useState, useEffect } from '@wordpress/element'; -/** - * Internal dependencies - */ -import { getHandlers } from '../utils/api'; - -/** - * Fetch handlers from REST API - * - * @param {string|null} stepType - Optional step type filter (fetch, publish, upsert) - * @return {Object} Handlers data with loading and error states - */ -export const useHandlersAPI = ( stepType = null ) => { - const [ handlers, setHandlers ] = useState( {} ); - const [ loading, setLoading ] = useState( true ); - const [ error, setError ] = useState( null ); - - useEffect( () => { - const fetchHandlers = async () => { - setLoading( true ); - setError( null ); - - try { - const response = await getHandlers( stepType ); - - if ( response.success ) { - // API returns handlers array directly in response.data - setHandlers( response.data || {} ); - } else { - throw new Error( - response.message || 'Failed to fetch handlers' - ); - } - } catch ( err ) { - console.error( 'Handlers fetch error:', err ); - setError( - err.message || 'An error occurred while fetching handlers' - ); - } finally { - setLoading( false ); - } - }; - - fetchHandlers(); - }, [ stepType ] ); - - return { handlers, loading, error }; -}; diff --git a/inc/Core/Admin/Pages/Pipelines/assets/react/queries/flows.js b/inc/Core/Admin/Pages/Pipelines/assets/react/queries/flows.js index 098a7ef55..0ffe329f4 100644 --- a/inc/Core/Admin/Pages/Pipelines/assets/react/queries/flows.js +++ b/inc/Core/Admin/Pages/Pipelines/assets/react/queries/flows.js @@ -332,69 +332,6 @@ export const useUpdateFlowHandler = () => { } ); }; -export const useUpdateUserMessage = () => { - const queryClient = useQueryClient(); - return useMutation( { - mutationFn: ( { flowStepId, message } ) => - updateUserMessage( flowStepId, message ), - onMutate: async ( { pipelineId, flowId, flowStepId, message } ) => { - const patches = { - pipelineId, - flowId, - flowStepId, - patchStep: ( step ) => ( { - ...step, - user_message: message, - } ), - }; - - const cachedFlowId = normalizeId( flowId ); - const cachedPipelineId = normalizeId( pipelineId ); - - const previousSingle = cachedFlowId - ? queryClient.getQueryData( [ - 'flows', - 'single', - cachedFlowId, - ] ) - : undefined; - - const previousPaginatedQueries = cachedPipelineId - ? queryClient.getQueriesData( { - queryKey: [ 'flows', cachedPipelineId ], - exact: false, - } ) - : []; - - patchFlowStepInCache( queryClient, patches ); - - return { previousSingle, previousPaginatedQueries }; - }, - onError: ( _, { pipelineId, flowId }, context ) => { - const cachedFlowId = normalizeId( flowId ); - const cachedPipelineId = normalizeId( pipelineId ); - - if ( cachedFlowId && context?.previousSingle ) { - queryClient.setQueryData( - [ 'flows', 'single', cachedFlowId ], - context.previousSingle - ); - } - - if ( - cachedPipelineId && - context?.previousPaginatedQueries?.length - ) { - context.previousPaginatedQueries.forEach( - ( [ queryKey, data ] ) => { - queryClient.setQueryData( queryKey, data ); - } - ); - } - }, - } ); -}; - export const useAddFlowHandler = () => { const queryClient = useQueryClient(); return useMutation( { diff --git a/inc/Core/Admin/Pages/Pipelines/assets/react/queries/handlers.js b/inc/Core/Admin/Pages/Pipelines/assets/react/queries/handlers.js index c33533060..0ea3ae2d1 100644 --- a/inc/Core/Admin/Pages/Pipelines/assets/react/queries/handlers.js +++ b/inc/Core/Admin/Pages/Pipelines/assets/react/queries/handlers.js @@ -23,12 +23,6 @@ export const useHandlers = () => staleTime: 30 * 60 * 1000, // 30 minutes - handlers don't change often } ); -export const useHandlerModels = () => { - // Deprecated: Return mapping slug -> model via HandlerFactory - const { data: handlers = {} } = useHandlers(); - return handlers; -}; - export const useHandlerDetails = ( handlerSlug ) => useQuery( { queryKey: [ 'handlers', handlerSlug ], diff --git a/inc/Core/Admin/Pages/Pipelines/assets/react/queries/pipelines.js b/inc/Core/Admin/Pages/Pipelines/assets/react/queries/pipelines.js index be17a3738..b7d17c08b 100644 --- a/inc/Core/Admin/Pages/Pipelines/assets/react/queries/pipelines.js +++ b/inc/Core/Admin/Pages/Pipelines/assets/react/queries/pipelines.js @@ -201,17 +201,6 @@ export const useCreatePipeline = ( options = {} ) => { } ); }; -export const useUpdatePipelineTitle = () => { - const queryClient = useQueryClient(); - return useMutation( { - mutationFn: ( { pipelineId, name } ) => - updatePipelineTitle( pipelineId, name ), - onSuccess: () => { - queryClient.invalidateQueries( { queryKey: [ 'pipelines' ] } ); - }, - } ); -}; - export const useDeletePipeline = () => { const queryClient = useQueryClient(); return useMutation( { @@ -296,33 +285,7 @@ export const useDeletePipelineStep = () => { } ); }; -export const useReorderPipelineSteps = () => { - const queryClient = useQueryClient(); - return useMutation( { - mutationFn: ( { pipelineId, steps } ) => - reorderPipelineSteps( pipelineId, steps ), - onSuccess: ( _, { pipelineId } ) => { - queryClient.invalidateQueries( { queryKey: [ 'pipelines' ] } ); - queryClient.invalidateQueries( { - queryKey: [ 'flows', pipelineId ], - } ); - }, - } ); -}; -export const useUpdateSystemPrompt = () => { - const queryClient = useQueryClient(); - return useMutation( { - mutationFn: ( { stepId, prompt, stepType, pipelineId } ) => - updateSystemPrompt( stepId, prompt, stepType, pipelineId ), - onSuccess: ( _, { pipelineId } ) => { - queryClient.invalidateQueries( { queryKey: [ 'pipelines' ] } ); - queryClient.invalidateQueries( { - queryKey: [ 'flows', pipelineId ], - } ); - }, - } ); -}; export const useUploadContextFile = () => { const queryClient = useQueryClient(); diff --git a/inc/Core/Admin/Pages/Pipelines/assets/react/services/handlerService.js b/inc/Core/Admin/Pages/Pipelines/assets/react/services/handlerService.js deleted file mode 100644 index 543aaee3e..000000000 --- a/inc/Core/Admin/Pages/Pipelines/assets/react/services/handlerService.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * External dependencies - */ -import { queryClient } from '@shared/lib/queryClient'; -/** - * Internal dependencies - */ -import { updateFlowHandler } from '../utils/api'; -import createModel from '../models/HandlerFactory'; - -export const sanitizeAndUpdateFlowHandler = async ( { - flowStepId, - handlerSlug, - settings, - pipelineId, - stepType, - flowConfig = {}, - pipelineStepConfig = {}, -} ) => { - const qc = queryClient; // wrapper for import consistency - - // Find handler details in cache if available - const handlerDetails = qc.getQueryData( [ 'handlers', handlerSlug ] ) || {}; - - const model = createModel( - handlerSlug, - qc.getQueryData( [ 'handlers' ] )?.[ handlerSlug ] || {}, - handlerDetails - ); - const sanitizedSettings = model - ? model.sanitizeForAPI( settings, handlerDetails?.settings || {} ) - : settings; - - const response = await updateFlowHandler( - flowStepId, - handlerSlug, - sanitizedSettings, - pipelineId, - stepType, - flowConfig, - pipelineStepConfig - ); - return response; -}; - -export default sanitizeAndUpdateFlowHandler; diff --git a/inc/Core/Admin/Pages/Pipelines/assets/react/utils/api.js b/inc/Core/Admin/Pages/Pipelines/assets/react/utils/api.js index ae410d853..6b91f271b 100644 --- a/inc/Core/Admin/Pages/Pipelines/assets/react/utils/api.js +++ b/inc/Core/Admin/Pages/Pipelines/assets/react/utils/api.js @@ -357,19 +357,6 @@ export const removeFlowHandler = async ( flowStepId, handlerSlug ) => { } ); }; -/** - * Update user message for AI step in flow - * - * @param {string} flowStepId - Flow step ID - * @param {string} message - User message content - * @return {Promise} Updated flow step data - */ -export const updateUserMessage = async ( flowStepId, message ) => { - return await client.patch( `/flows/steps/${ flowStepId }/user-message`, { - user_message: message, - } ); -}; - /** * Get available scheduling intervals * @@ -537,15 +524,6 @@ export const getStepTypes = async () => { return await client.get( '/step-types' ); }; -/** - * Get available providers - * - * @return {Promise} Providers configuration - */ -export const getProviders = async () => { - return await client.get( '/providers' ); -}; - /** * Get available tools * diff --git a/inc/Core/Admin/Pages/Pipelines/assets/react/utils/constants.js b/inc/Core/Admin/Pages/Pipelines/assets/react/utils/constants.js index 493ffa589..4641896ef 100644 --- a/inc/Core/Admin/Pages/Pipelines/assets/react/utils/constants.js +++ b/inc/Core/Admin/Pages/Pipelines/assets/react/utils/constants.js @@ -16,21 +16,11 @@ export const MODAL_TYPES = { FLOW_QUEUE: 'flow-queue', IMPORT_EXPORT: 'import-export', OAUTH: 'oauth', - CONFIRM_DELETE: 'confirm-delete', CONTEXT_FILES: 'context-files', MEMORY_FILES: 'memory-files', FLOW_MEMORY_FILES: 'flow-memory-files', }; -/** - * Handler Types (matches step types) - */ -export const HANDLER_TYPES = { - FETCH: 'fetch', - PUBLISH: 'publish', - UPDATE: 'update', -}; - /** * Auto-save Debounce Delay (milliseconds) */ @@ -41,12 +31,6 @@ export const AUTO_SAVE_DELAY = 500; */ export const API_TIMEOUT = 30000; -/** - * Default Pipeline/Flow Names - */ -export const DEFAULT_PIPELINE_NAME = 'New Pipeline'; -export const DEFAULT_FLOW_NAME = 'New Flow'; - /** * Validation Constants */ @@ -58,18 +42,3 @@ export const VALIDATION = { MAX_PROMPT_LENGTH: 10000, MAX_USER_MESSAGE_LENGTH: 5000, }; - -/** - * CSS Class Prefixes - */ -export const CLASS_PREFIX = 'datamachine-pipelines'; - -/** - * Status Colors - */ -export const STATUS_COLORS = { - SUCCESS: '#46b450', - ERROR: '#dc3232', - WARNING: '#f0b849', - INFO: '#0073aa', -}; diff --git a/inc/Core/Admin/Pages/Pipelines/assets/react/utils/formatters.js b/inc/Core/Admin/Pages/Pipelines/assets/react/utils/formatters.js index 802840ab8..cabd20ca5 100644 --- a/inc/Core/Admin/Pages/Pipelines/assets/react/utils/formatters.js +++ b/inc/Core/Admin/Pages/Pipelines/assets/react/utils/formatters.js @@ -9,19 +9,6 @@ */ import { __ } from '@wordpress/i18n'; -/** - * Format timestamp for display - * - * Backend handles ALL date formatting via DateFormatter class. - * This function simply passes through the pre-formatted display value. - * - * @param {string|null} displayValue - Pre-formatted display string from backend - * @return {string} Display string or "Never" - */ -export const formatDateTime = ( displayValue ) => { - return displayValue || __( 'Never', 'data-machine' ); -}; - /** * Parse a datetime string as UTC. * @@ -31,7 +18,7 @@ export const formatDateTime = ( displayValue ) => { * @param {string|null} dateString - Datetime string from API * @return {Date|null} Date object or null if invalid */ -export const parseUtcDateTime = ( dateString ) => { +const parseUtcDateTime = ( dateString ) => { if ( ! dateString ) { return null; } diff --git a/inc/Core/Admin/Pages/Pipelines/assets/react/utils/handlerSettings.js b/inc/Core/Admin/Pages/Pipelines/assets/react/utils/handlerSettings.js index 056e2268c..5d55065a6 100644 --- a/inc/Core/Admin/Pages/Pipelines/assets/react/utils/handlerSettings.js +++ b/inc/Core/Admin/Pages/Pipelines/assets/react/utils/handlerSettings.js @@ -28,10 +28,6 @@ export const resolveFieldValue = ( ); }; -export const getFieldHelpText = ( fieldConfig = {} ) => { - return fieldConfig.description || ''; -}; - /** * Sanitize handler settings payload with proper type coercion. * @@ -42,4 +38,4 @@ export const getFieldHelpText = ( fieldConfig = {} ) => { * @param {Object} settingsFields Field schema definitions * @return {Object} Sanitized settings with proper types */ -export default { resolveFieldValue, getFieldHelpText }; +export default { resolveFieldValue };