mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-06-03 12:58:08 +02:00
Add files via upload
This commit is contained in:
@@ -6187,6 +6187,728 @@ header {
|
||||
background: rgba(0, 102, 255, 0.1);
|
||||
}
|
||||
|
||||
/* 任务管理页面样式 */
|
||||
.tasks-stats-bar {
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
padding: 16px 20px;
|
||||
background: linear-gradient(135deg, rgba(0, 102, 255, 0.05) 0%, rgba(0, 102, 255, 0.02) 100%);
|
||||
border: 1px solid rgba(0, 102, 255, 0.15);
|
||||
border-radius: 12px;
|
||||
box-shadow: var(--shadow-sm);
|
||||
margin-bottom: 24px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.tasks-controls {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.tasks-filters {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
align-items: flex-end;
|
||||
flex-wrap: wrap;
|
||||
padding: 16px;
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.tasks-filters label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-secondary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.tasks-filters select {
|
||||
padding: 8px 12px;
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 6px;
|
||||
font-size: 0.875rem;
|
||||
background: var(--bg-primary);
|
||||
color: var(--text-primary);
|
||||
min-width: 150px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.tasks-filters select:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent-color);
|
||||
box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
|
||||
}
|
||||
|
||||
.tasks-filters select:hover {
|
||||
border-color: var(--accent-color);
|
||||
}
|
||||
|
||||
.tasks-batch-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 12px 16px;
|
||||
background: rgba(0, 102, 255, 0.05);
|
||||
border: 1px solid rgba(0, 102, 255, 0.2);
|
||||
border-radius: 8px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.tasks-batch-actions span {
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-primary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.auto-refresh-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-primary);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.auto-refresh-toggle input[type="checkbox"] {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
cursor: pointer;
|
||||
accent-color: var(--accent-color);
|
||||
}
|
||||
|
||||
.page-header-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.show-history-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-primary);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.show-history-toggle input[type="checkbox"] {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
cursor: pointer;
|
||||
accent-color: var(--accent-color);
|
||||
}
|
||||
|
||||
.tasks-history-section {
|
||||
margin-top: 32px;
|
||||
padding-top: 24px;
|
||||
border-top: 2px solid var(--border-color);
|
||||
}
|
||||
|
||||
.tasks-history-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.tasks-history-title {
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.task-item-history {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.task-item-history:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.task-history-badge {
|
||||
font-size: 0.875rem;
|
||||
margin-left: 4px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.task-stat-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.task-stat-label {
|
||||
font-size: 0.8125rem;
|
||||
color: var(--text-secondary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.task-stat-value {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 600;
|
||||
color: var(--accent-color);
|
||||
}
|
||||
|
||||
.tasks-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.tasks-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 60px 20px;
|
||||
text-align: center;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.tasks-empty p {
|
||||
font-size: 1rem;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.task-item {
|
||||
background: var(--bg-primary);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
box-shadow: var(--shadow-sm);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.task-item:hover {
|
||||
box-shadow: var(--shadow-md);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.task-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.task-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
.task-checkbox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.task-checkbox input[type="checkbox"] {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
cursor: pointer;
|
||||
accent-color: var(--accent-color);
|
||||
}
|
||||
|
||||
.task-checkbox-placeholder {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.task-status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 4px 12px;
|
||||
border-radius: 12px;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.task-status-running {
|
||||
background: rgba(0, 123, 255, 0.1);
|
||||
color: var(--accent-color);
|
||||
border: 1px solid rgba(0, 123, 255, 0.3);
|
||||
}
|
||||
|
||||
.task-status-cancelling {
|
||||
background: rgba(255, 193, 7, 0.1);
|
||||
color: #b8860b;
|
||||
border: 1px solid rgba(255, 193, 7, 0.3);
|
||||
}
|
||||
|
||||
.task-status-completed {
|
||||
background: rgba(40, 167, 69, 0.1);
|
||||
color: var(--success-color);
|
||||
border: 1px solid rgba(40, 167, 69, 0.3);
|
||||
}
|
||||
|
||||
.task-status-failed,
|
||||
.task-status-timeout {
|
||||
background: rgba(220, 53, 69, 0.1);
|
||||
color: var(--error-color);
|
||||
border: 1px solid rgba(220, 53, 69, 0.3);
|
||||
}
|
||||
|
||||
.task-status-cancelled {
|
||||
background: rgba(108, 117, 125, 0.1);
|
||||
color: var(--text-secondary);
|
||||
border: 1px solid rgba(108, 117, 125, 0.3);
|
||||
}
|
||||
|
||||
.task-status-unknown {
|
||||
background: var(--bg-secondary);
|
||||
color: var(--text-secondary);
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.task-message {
|
||||
font-size: 0.9375rem;
|
||||
color: var(--text-primary);
|
||||
font-weight: 500;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.task-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.task-time {
|
||||
font-size: 0.8125rem;
|
||||
color: var(--text-secondary);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.task-duration {
|
||||
font-size: 0.8125rem;
|
||||
color: var(--accent-color);
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
padding: 4px 8px;
|
||||
background: rgba(0, 102, 255, 0.1);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.task-details {
|
||||
margin-top: 12px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid var(--border-color);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.task-id-label {
|
||||
color: var(--text-secondary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.task-id-value {
|
||||
color: var(--text-primary);
|
||||
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
||||
background: var(--bg-secondary);
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
word-break: break-all;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.task-id-value:hover {
|
||||
background: var(--bg-tertiary);
|
||||
color: var(--accent-color);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.tasks-stats-bar {
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.task-stat-item {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.tasks-filters {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.tasks-filters select {
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
.tasks-batch-actions {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.page-header-actions {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.task-header {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.task-actions {
|
||||
width: 100%;
|
||||
justify-content: flex-end;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.task-duration {
|
||||
font-size: 0.75rem;
|
||||
padding: 2px 6px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 批量任务相关样式 */
|
||||
.batch-queues-section {
|
||||
margin-top: 32px;
|
||||
padding-top: 24px;
|
||||
border-top: 2px solid var(--border-color);
|
||||
}
|
||||
|
||||
.batch-queues-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.batch-queues-header h3 {
|
||||
margin: 0;
|
||||
font-size: 1.125rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.batch-queues-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.batch-queue-item {
|
||||
background: var(--bg-primary);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
box-shadow: var(--shadow-sm);
|
||||
transition: all 0.2s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.batch-queue-item:hover {
|
||||
box-shadow: var(--shadow-md);
|
||||
transform: translateY(-2px);
|
||||
border-color: var(--accent-color);
|
||||
}
|
||||
|
||||
.batch-queue-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.batch-queue-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex: 1;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.batch-queue-status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 4px 12px;
|
||||
border-radius: 12px;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.batch-queue-status-pending {
|
||||
background: rgba(108, 117, 125, 0.1);
|
||||
color: var(--text-secondary);
|
||||
border: 1px solid rgba(108, 117, 125, 0.3);
|
||||
}
|
||||
|
||||
.batch-queue-status-running {
|
||||
background: rgba(0, 123, 255, 0.1);
|
||||
color: var(--accent-color);
|
||||
border: 1px solid rgba(0, 123, 255, 0.3);
|
||||
}
|
||||
|
||||
.batch-queue-status-completed {
|
||||
background: rgba(40, 167, 69, 0.1);
|
||||
color: var(--success-color);
|
||||
border: 1px solid rgba(40, 167, 69, 0.3);
|
||||
}
|
||||
|
||||
.batch-queue-status-cancelled {
|
||||
background: rgba(108, 117, 125, 0.1);
|
||||
color: var(--text-secondary);
|
||||
border: 1px solid rgba(108, 117, 125, 0.3);
|
||||
}
|
||||
|
||||
.batch-queue-id {
|
||||
font-size: 0.8125rem;
|
||||
color: var(--text-secondary);
|
||||
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
||||
}
|
||||
|
||||
.batch-queue-time {
|
||||
font-size: 0.8125rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.batch-queue-progress {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
.batch-queue-progress-bar {
|
||||
flex: 1;
|
||||
height: 8px;
|
||||
background: var(--bg-secondary);
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.batch-queue-progress-fill {
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, var(--accent-color) 0%, var(--accent-hover) 100%);
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
|
||||
.batch-queue-progress-text {
|
||||
font-size: 0.8125rem;
|
||||
color: var(--text-secondary);
|
||||
white-space: nowrap;
|
||||
min-width: 60px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.batch-queue-stats {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
flex-wrap: wrap;
|
||||
font-size: 0.8125rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.batch-queue-stats span {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.batch-queue-detail-info {
|
||||
margin-bottom: 24px;
|
||||
padding: 16px;
|
||||
background: var(--bg-secondary);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.batch-queue-detail-info .detail-item {
|
||||
margin-bottom: 8px;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.batch-queue-detail-info .detail-item strong {
|
||||
color: var(--text-primary);
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.batch-queue-tasks-list {
|
||||
max-height: 500px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.batch-queue-tasks-list h4 {
|
||||
margin: 0 0 16px 0;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.batch-task-item {
|
||||
background: var(--bg-primary);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
margin-bottom: 12px;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.batch-task-item:hover {
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
.batch-task-item-active {
|
||||
border-color: var(--accent-color);
|
||||
background: rgba(0, 102, 255, 0.02);
|
||||
}
|
||||
|
||||
.batch-task-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.batch-task-header .btn-small {
|
||||
margin-left: auto;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.batch-task-header .batch-task-edit-btn {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.batch-task-header .batch-task-delete-btn {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.batch-task-index {
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
min-width: 30px;
|
||||
}
|
||||
|
||||
.batch-task-status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 8px;
|
||||
border-radius: 8px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.batch-task-status-pending {
|
||||
background: rgba(108, 117, 125, 0.1);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.batch-task-status-running {
|
||||
background: rgba(0, 123, 255, 0.1);
|
||||
color: var(--accent-color);
|
||||
}
|
||||
|
||||
.batch-task-status-completed {
|
||||
background: rgba(40, 167, 69, 0.1);
|
||||
color: var(--success-color);
|
||||
}
|
||||
|
||||
.batch-task-status-failed {
|
||||
background: rgba(220, 53, 69, 0.1);
|
||||
color: var(--error-color);
|
||||
}
|
||||
|
||||
.batch-task-status-cancelled {
|
||||
background: rgba(108, 117, 125, 0.1);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.batch-task-message {
|
||||
flex: 1;
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-primary);
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.batch-task-time {
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-secondary);
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.batch-task-error {
|
||||
font-size: 0.8125rem;
|
||||
color: var(--error-color);
|
||||
margin-top: 8px;
|
||||
padding: 8px;
|
||||
background: rgba(220, 53, 69, 0.05);
|
||||
border-radius: 4px;
|
||||
border-left: 3px solid var(--error-color);
|
||||
}
|
||||
|
||||
.batch-task-result {
|
||||
font-size: 0.8125rem;
|
||||
color: var(--text-primary);
|
||||
margin-top: 8px;
|
||||
padding: 8px;
|
||||
background: var(--bg-secondary);
|
||||
border-radius: 4px;
|
||||
max-height: 150px;
|
||||
overflow-y: auto;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.batch-import-stats {
|
||||
display: none;
|
||||
padding: 8px 12px;
|
||||
background: rgba(0, 102, 255, 0.05);
|
||||
border: 1px solid rgba(0, 102, 255, 0.2);
|
||||
border-radius: 6px;
|
||||
font-size: 0.875rem;
|
||||
color: var(--accent-color);
|
||||
}
|
||||
|
||||
.batch-import-stat {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.batch-queue-header {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.batch-queue-progress {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.batch-queue-stats {
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.batch-task-header {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
/* 漏洞管理页面样式 */
|
||||
.vulnerability-dashboard {
|
||||
margin-bottom: 24px;
|
||||
|
||||
+26
-8
@@ -3778,7 +3778,18 @@ let pendingGroupMappings = {}; // 待保留的分组映射(用于处理后端A
|
||||
async function loadGroups() {
|
||||
try {
|
||||
const response = await apiFetch('/api/groups');
|
||||
groupsCache = await response.json();
|
||||
if (!response.ok) {
|
||||
groupsCache = [];
|
||||
return;
|
||||
}
|
||||
const data = await response.json();
|
||||
// 确保groupsCache是有效数组
|
||||
if (Array.isArray(data)) {
|
||||
groupsCache = data;
|
||||
} else {
|
||||
// 如果返回的不是数组,使用空数组(不打印警告,因为可能后端返回了错误格式但我们要优雅处理)
|
||||
groupsCache = [];
|
||||
}
|
||||
|
||||
const groupsList = document.getElementById('conversation-groups-list');
|
||||
if (!groupsList) return;
|
||||
@@ -4723,13 +4734,20 @@ async function loadConversationGroupMapping() {
|
||||
groups = groupsCache;
|
||||
} else {
|
||||
const response = await apiFetch('/api/groups');
|
||||
groups = await response.json();
|
||||
}
|
||||
|
||||
// 确保groups是有效数组
|
||||
if (!Array.isArray(groups)) {
|
||||
console.warn('loadConversationGroupMapping: groups不是有效数组,使用空数组');
|
||||
groups = [];
|
||||
if (!response.ok) {
|
||||
// 如果API请求失败,使用空数组,不打印警告(这是正常错误处理)
|
||||
groups = [];
|
||||
} else {
|
||||
groups = await response.json();
|
||||
// 确保groups是有效数组,只在真正异常时才打印警告
|
||||
if (!Array.isArray(groups)) {
|
||||
// 只在返回的不是数组且不是null/undefined时才打印警告(可能是后端返回了错误格式)
|
||||
if (groups !== null && groups !== undefined) {
|
||||
console.warn('loadConversationGroupMapping: groups不是有效数组,使用空数组', groups);
|
||||
}
|
||||
groups = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 保存待保留的映射
|
||||
|
||||
+79
-7
@@ -3,14 +3,37 @@ let currentPage = 'chat';
|
||||
|
||||
// 初始化路由
|
||||
function initRouter() {
|
||||
// 默认显示对话页面
|
||||
switchPage('chat');
|
||||
|
||||
// 从URL hash读取页面(如果有)
|
||||
const hash = window.location.hash.slice(1);
|
||||
if (hash && ['chat', 'vulnerabilities', 'mcp-monitor', 'mcp-management', 'knowledge-management', 'knowledge-retrieval-logs', 'settings'].includes(hash)) {
|
||||
switchPage(hash);
|
||||
if (hash) {
|
||||
const hashParts = hash.split('?');
|
||||
const pageId = hashParts[0];
|
||||
if (pageId && ['chat', 'vulnerabilities', 'mcp-monitor', 'mcp-management', 'knowledge-management', 'knowledge-retrieval-logs', 'settings', 'tasks'].includes(pageId)) {
|
||||
switchPage(pageId);
|
||||
|
||||
// 如果是chat页面且带有conversation参数,加载对应对话
|
||||
if (pageId === 'chat' && hashParts.length > 1) {
|
||||
const params = new URLSearchParams(hashParts[1]);
|
||||
const conversationId = params.get('conversation');
|
||||
if (conversationId) {
|
||||
setTimeout(() => {
|
||||
// 尝试多种方式调用loadConversation
|
||||
if (typeof loadConversation === 'function') {
|
||||
loadConversation(conversationId);
|
||||
} else if (typeof window.loadConversation === 'function') {
|
||||
window.loadConversation(conversationId);
|
||||
} else {
|
||||
console.warn('loadConversation function not found');
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 默认显示对话页面
|
||||
switchPage('chat');
|
||||
}
|
||||
|
||||
// 切换页面
|
||||
@@ -178,6 +201,12 @@ function initPage(pageId) {
|
||||
case 'chat':
|
||||
// 对话页面已由chat.js初始化
|
||||
break;
|
||||
case 'tasks':
|
||||
// 初始化任务管理页面
|
||||
if (typeof initTasksPage === 'function') {
|
||||
initTasksPage();
|
||||
}
|
||||
break;
|
||||
case 'mcp-monitor':
|
||||
// 初始化监控面板
|
||||
if (typeof refreshMonitorPanel === 'function') {
|
||||
@@ -211,6 +240,11 @@ function initPage(pageId) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// 清理其他页面的定时器
|
||||
if (pageId !== 'tasks' && typeof cleanupTasksPage === 'function') {
|
||||
cleanupTasksPage();
|
||||
}
|
||||
}
|
||||
|
||||
// 页面加载完成后初始化路由
|
||||
@@ -221,10 +255,48 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
// 监听hash变化
|
||||
window.addEventListener('hashchange', function() {
|
||||
const hash = window.location.hash.slice(1);
|
||||
if (hash && ['chat', 'vulnerabilities', 'mcp-monitor', 'mcp-management', 'knowledge-management', 'knowledge-retrieval-logs', 'settings'].includes(hash)) {
|
||||
switchPage(hash);
|
||||
// 处理带参数的hash(如 chat?conversation=xxx)
|
||||
const hashParts = hash.split('?');
|
||||
const pageId = hashParts[0];
|
||||
|
||||
if (pageId && ['chat', 'tasks', 'vulnerabilities', 'mcp-monitor', 'mcp-management', 'knowledge-management', 'knowledge-retrieval-logs', 'settings'].includes(pageId)) {
|
||||
switchPage(pageId);
|
||||
|
||||
// 如果是chat页面且带有conversation参数,加载对应对话
|
||||
if (pageId === 'chat' && hashParts.length > 1) {
|
||||
const params = new URLSearchParams(hashParts[1]);
|
||||
const conversationId = params.get('conversation');
|
||||
if (conversationId) {
|
||||
setTimeout(() => {
|
||||
// 尝试多种方式调用loadConversation
|
||||
if (typeof loadConversation === 'function') {
|
||||
loadConversation(conversationId);
|
||||
} else if (typeof window.loadConversation === 'function') {
|
||||
window.loadConversation(conversationId);
|
||||
} else {
|
||||
console.warn('loadConversation function not found');
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 页面加载时也检查hash参数
|
||||
const hash = window.location.hash.slice(1);
|
||||
if (hash) {
|
||||
const hashParts = hash.split('?');
|
||||
const pageId = hashParts[0];
|
||||
if (pageId === 'chat' && hashParts.length > 1) {
|
||||
const params = new URLSearchParams(hashParts[1]);
|
||||
const conversationId = params.get('conversation');
|
||||
if (conversationId && typeof loadConversation === 'function') {
|
||||
setTimeout(() => {
|
||||
loadConversation(conversationId);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 切换侧边栏折叠/展开
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -76,6 +76,17 @@
|
||||
<span>对话</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nav-item" data-page="tasks">
|
||||
<div class="nav-item-content" data-title="任务管理" onclick="switchPage('tasks')">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<polyline points="13 2 13 9 20 9" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<line x1="9" y1="13" x2="15" y2="13" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
||||
<line x1="9" y1="17" x2="15" y2="17" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
||||
</svg>
|
||||
<span>任务管理</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="nav-item" data-page="vulnerabilities">
|
||||
<div class="nav-item-content" data-title="漏洞管理" onclick="switchPage('vulnerabilities')">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
@@ -541,6 +552,31 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 任务管理页面 -->
|
||||
<div id="page-tasks" class="page">
|
||||
<div class="page-header">
|
||||
<h2>任务管理</h2>
|
||||
<div class="page-header-actions">
|
||||
<button class="btn-primary" onclick="showBatchImportModal()">批量导入任务</button>
|
||||
<label class="auto-refresh-toggle">
|
||||
<input type="checkbox" id="tasks-auto-refresh" checked onchange="toggleTasksAutoRefresh(this.checked)">
|
||||
<span>自动刷新</span>
|
||||
</label>
|
||||
<button class="btn-secondary" onclick="refreshBatchQueues()">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page-content">
|
||||
<!-- 批量任务队列列表 -->
|
||||
<div class="batch-queues-section" id="batch-queues-section" style="display: none;">
|
||||
<div class="batch-queues-header">
|
||||
<h3>批量任务队列</h3>
|
||||
<button class="btn-secondary btn-small" onclick="refreshBatchQueues()">刷新</button>
|
||||
</div>
|
||||
<div id="batch-queues-list" class="batch-queues-list"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 系统设置页面 -->
|
||||
<div id="page-settings" class="page">
|
||||
<div class="page-header">
|
||||
@@ -1096,6 +1132,91 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 批量导入任务模态框 -->
|
||||
<div id="batch-import-modal" class="modal">
|
||||
<div class="modal-content" style="max-width: 800px;">
|
||||
<div class="modal-header">
|
||||
<h2>批量导入任务</h2>
|
||||
<span class="modal-close" onclick="closeBatchImportModal()">×</span>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="batch-tasks-input">任务列表(每行一个任务)<span style="color: red;">*</span></label>
|
||||
<textarea id="batch-tasks-input" rows="15" placeholder="请输入任务列表,每行一个任务,例如: 扫描 192.168.1.1 的开放端口 检查 https://example.com 是否存在SQL注入 枚举 example.com 的子域名" style="font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; font-size: 0.875rem; line-height: 1.5;"></textarea>
|
||||
<div class="form-hint" style="margin-top: 8px;">
|
||||
<strong>提示:</strong>每行输入一个任务指令,系统将依次执行这些任务。空行会被自动忽略。
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div id="batch-import-stats" class="batch-import-stats"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn-secondary" onclick="closeBatchImportModal()">取消</button>
|
||||
<button class="btn-primary" onclick="createBatchQueue()">创建队列</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 批量任务队列详情模态框 -->
|
||||
<div id="batch-queue-detail-modal" class="modal">
|
||||
<div class="modal-content" style="max-width: 900px;">
|
||||
<div class="modal-header">
|
||||
<h2 id="batch-queue-detail-title">批量任务队列详情</h2>
|
||||
<div class="modal-header-actions">
|
||||
<button class="btn-secondary" id="batch-queue-add-task-btn" onclick="showAddBatchTaskModal()" style="display: none;">添加任务</button>
|
||||
<button class="btn-secondary" id="batch-queue-start-btn" onclick="startBatchQueue()" style="display: none;">开始执行</button>
|
||||
<button class="btn-secondary btn-danger" id="batch-queue-cancel-btn" onclick="cancelBatchQueue()" style="display: none;">取消队列</button>
|
||||
<button class="btn-secondary btn-danger" id="batch-queue-delete-btn" onclick="deleteBatchQueue()" style="display: none;">删除队列</button>
|
||||
<span class="modal-close" onclick="closeBatchQueueDetailModal()">×</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="batch-queue-detail-content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 编辑批量任务模态框 -->
|
||||
<div id="edit-batch-task-modal" class="modal">
|
||||
<div class="modal-content" style="max-width: 600px;">
|
||||
<div class="modal-header">
|
||||
<h2>编辑任务</h2>
|
||||
<span class="modal-close" onclick="closeEditBatchTaskModal()">×</span>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="edit-task-message">任务消息</label>
|
||||
<textarea id="edit-task-message" class="form-control" rows="5" placeholder="请输入任务消息"></textarea>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button class="btn-primary" onclick="saveBatchTask()">保存</button>
|
||||
<button class="btn-secondary" onclick="closeEditBatchTaskModal()">取消</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 添加批量任务模态框 -->
|
||||
<div id="add-batch-task-modal" class="modal">
|
||||
<div class="modal-content" style="max-width: 600px;">
|
||||
<div class="modal-header">
|
||||
<h2>添加任务</h2>
|
||||
<span class="modal-close" onclick="closeAddBatchTaskModal()">×</span>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="add-task-message">任务消息</label>
|
||||
<textarea id="add-task-message" class="form-control" rows="5" placeholder="请输入任务消息"></textarea>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button class="btn-primary" onclick="saveAddBatchTask()">添加</button>
|
||||
<button class="btn-secondary" onclick="closeAddBatchTaskModal()">取消</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 漏洞编辑模态框 -->
|
||||
<div id="vulnerability-modal" class="modal">
|
||||
<div class="modal-content" style="max-width: 900px;">
|
||||
@@ -1171,6 +1292,7 @@
|
||||
<script src="/static/js/settings.js"></script>
|
||||
<script src="/static/js/knowledge.js"></script>
|
||||
<script src="/static/js/vulnerability.js?v=4"></script>
|
||||
<script src="/static/js/tasks.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user