2112 lines
111 KiB
HTML
2112 lines
111 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="fa" dir="rtl">
|
||
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>مدیریت محصولات</title>
|
||
<script src="https://d3js.org/d3.v7.min.js"></script>
|
||
<style>
|
||
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');
|
||
|
||
:root {
|
||
--primary: #1a365d;
|
||
--primary-light: #2c5282;
|
||
--primary-dark: #0f2341;
|
||
--accent: #c9a961;
|
||
--accent-dark: #a8893f;
|
||
--accent-light: #e0c789;
|
||
--bg: #f5f7fa;
|
||
--board-bg: #e2e8f0;
|
||
--card-bg: #ffffff;
|
||
--panel-bg: #ffffff;
|
||
--text: #1a202c;
|
||
--text-muted: #4a5568;
|
||
--text-light: #718096;
|
||
--border: #cbd5e0;
|
||
--border-light: #e2e8f0;
|
||
--success: #38a169;
|
||
--danger: #e53e3e;
|
||
--warning: #dd6b20;
|
||
--info: #3182ce;
|
||
--shadow: 0 4px 6px rgba(0, 0, 0, 0.08), 0 10px 20px rgba(26, 54, 93, 0.1);
|
||
--shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
|
||
--shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
|
||
--radius: 10px;
|
||
--radius-sm: 6px;
|
||
--sidebar-width: 280px;
|
||
--header-height: 64px;
|
||
--tabs-height: 48px;
|
||
--footer-height: 36px;
|
||
}
|
||
|
||
[data-theme="dark"] {
|
||
--primary: #2c5282;
|
||
--primary-light: #3b6fb5;
|
||
--primary-dark: #1a365d;
|
||
--accent: #e0c789;
|
||
--accent-dark: #c9a961;
|
||
--accent-light: #f0d9a0;
|
||
--bg: #1a202c;
|
||
--board-bg: #2d3748;
|
||
--card-bg: #2d3748;
|
||
--panel-bg: #1f2937;
|
||
--text: #e2e8f0;
|
||
--text-muted: #cbd5e0;
|
||
--text-light: #a0aec0;
|
||
--border: #4a5568;
|
||
--border-light: #374151;
|
||
--shadow: 0 4px 6px rgba(0, 0, 0, 0.3), 0 10px 20px rgba(0, 0, 0, 0.4);
|
||
--shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
|
||
--shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
|
||
}
|
||
|
||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||
|
||
body {
|
||
font-family: 'Vazirmatn', Tahoma, sans-serif;
|
||
background: var(--bg);
|
||
color: var(--text);
|
||
height: 100vh;
|
||
overflow: hidden;
|
||
font-size: 14px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
transition: background 0.3s, color 0.3s;
|
||
}
|
||
|
||
.app-header {
|
||
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
|
||
color: white;
|
||
padding: 0 20px;
|
||
height: var(--header-height);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
border-bottom: 3px solid var(--accent);
|
||
box-shadow: var(--shadow);
|
||
z-index: 100;
|
||
flex-shrink: 0;
|
||
position: relative;
|
||
overflow: hidden;
|
||
}
|
||
.app-header::before {
|
||
content: '';
|
||
position: absolute;
|
||
top: -50%;
|
||
left: -10%;
|
||
width: 300px;
|
||
height: 300px;
|
||
background: radial-gradient(circle, rgba(201, 169, 97, 0.15) 0%, transparent 70%);
|
||
border-radius: 50%;
|
||
pointer-events: none;
|
||
}
|
||
.app-brand { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
|
||
.app-logo {
|
||
width: 44px; height: 44px; background: var(--accent); border-radius: 10px;
|
||
display: flex; align-items: center; justify-content: center; font-size: 22px;
|
||
font-weight: 800; color: var(--primary-dark); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); flex-shrink: 0;
|
||
}
|
||
.app-brand-text { display: flex; flex-direction: column; gap: 2px; }
|
||
.app-title { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; color: white; }
|
||
.app-subtitle { font-size: 11px; opacity: 0.85; color: rgba(255, 255, 255, 0.9); }
|
||
|
||
.btn {
|
||
background: linear-gradient(135deg, var(--primary-light), var(--primary));
|
||
color: white; border: none; padding: 8px 14px; border-radius: var(--radius-sm);
|
||
cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600;
|
||
display: inline-flex; align-items: center; gap: 6px; transition: all 0.2s;
|
||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); white-space: nowrap;
|
||
}
|
||
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); filter: brightness(1.1); }
|
||
.btn:active { transform: translateY(0); }
|
||
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: var(--primary-dark); font-weight: 700; }
|
||
.btn-ghost { background: rgba(26, 54, 93, 0.08); border: 1px solid var(--border); color: var(--primary); font-weight: 600; }
|
||
.btn-ghost:hover { background: rgba(26, 54, 93, 0.15); border-color: var(--primary-light); }
|
||
[data-theme="dark"] .btn-ghost { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.25); color: white; }
|
||
[data-theme="dark"] .btn-ghost:hover { background: rgba(255, 255, 255, 0.2); }
|
||
.btn-danger { background: linear-gradient(135deg, var(--danger), #c53030); color: white; }
|
||
.btn-sm { padding: 4px 10px; font-size: 11px; }
|
||
.btn-xs { padding: 2px 6px; font-size: 10px; }
|
||
.btn-icon {
|
||
width: 32px; height: 32px; padding: 0;
|
||
display: inline-flex; align-items: center; justify-content: center;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.app-main { flex: 1; display: flex; overflow: hidden; position: relative; flex-direction: row; }
|
||
|
||
.sidebar {
|
||
order: -1; width: var(--sidebar-width); background: var(--panel-bg);
|
||
border-right: 1px solid var(--border); display: flex; flex-direction: column;
|
||
transition: width 0.3s ease; box-shadow: var(--shadow); overflow: hidden;
|
||
flex-shrink: 0; z-index: 50;
|
||
}
|
||
.sidebar.collapsed { width: 0; overflow: hidden; }
|
||
.sidebar-header {
|
||
background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white;
|
||
padding: 12px; display: flex; align-items: center; justify-content: space-between;
|
||
border-bottom: 2px solid var(--accent); min-height: 48px;
|
||
}
|
||
.sidebar-title { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; }
|
||
.sidebar.collapsed .sidebar-title { display: none; }
|
||
.sidebar-body { flex: 1; overflow-y: auto; padding: 8px; }
|
||
.sidebar.collapsed .sidebar-body { display: none; }
|
||
.sidebar-group { margin-bottom: 6px; border: 1px solid var(--border-light); border-radius: var(--radius-sm); overflow: hidden; background: var(--card-bg); }
|
||
.sidebar-group-header {
|
||
background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white;
|
||
padding: 10px 12px; cursor: pointer; display: flex; align-items: center;
|
||
justify-content: space-between; font-size: 13px; font-weight: 700;
|
||
user-select: none; transition: all 0.2s; position: relative;
|
||
}
|
||
.sidebar-group-header:hover { filter: brightness(1.1); }
|
||
.sidebar-group-header .group-icon { display: flex; align-items: center; gap: 8px; flex: 1; overflow: hidden; }
|
||
.sidebar-group-header .group-arrow { transition: transform 0.3s; font-size: 12px; flex-shrink: 0; }
|
||
.sidebar-group.collapsed .group-arrow { transform: rotate(90deg); }
|
||
.sidebar-group.collapsed .sidebar-group-body { display: none; }
|
||
.sidebar-group-body { padding: 6px; display: flex; flex-direction: column; gap: 4px; }
|
||
.sidebar-btn {
|
||
background: var(--card-bg); border: 1px solid var(--border-light); color: var(--text);
|
||
padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-family: inherit;
|
||
font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 8px;
|
||
transition: all 0.2s; text-align: right; width: 100%; position: relative;
|
||
}
|
||
.sidebar-btn:hover { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; border-color: var(--primary); transform: translateX(-2px); }
|
||
.sidebar-btn .btn-icon-emoji { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
|
||
.sidebar-btn .btn-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||
|
||
[data-tooltip] { position: relative; }
|
||
[data-tooltip]::after {
|
||
content: attr(data-tooltip); position: absolute; right: calc(100% + 10px); top: 50%;
|
||
transform: translateY(-50%); background: var(--primary-dark); color: white;
|
||
padding: 8px 12px; border-radius: 6px; font-size: 11px; font-weight: 500;
|
||
white-space: normal; opacity: 0; pointer-events: none; transition: opacity 0.2s;
|
||
z-index: 1000; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); max-width: 250px; line-height: 1.5;
|
||
}
|
||
[data-tooltip]::before {
|
||
content: ''; position: absolute; right: calc(100% + 5px); top: 50%;
|
||
transform: translateY(-50%); border: 5px solid transparent;
|
||
border-left-color: var(--primary-dark); opacity: 0; pointer-events: none;
|
||
transition: opacity 0.2s; z-index: 1000;
|
||
}
|
||
[data-tooltip]:hover::after, [data-tooltip]:hover::before { opacity: 1; }
|
||
[data-theme="dark"] [data-tooltip]::after { background: var(--accent-dark); color: var(--primary-dark); }
|
||
[data-theme="dark"] [data-tooltip]::before { border-left-color: var(--accent-dark); }
|
||
|
||
.tabs-bar {
|
||
background: linear-gradient(135deg, #0f1724 0%, #1a2a44 100%);
|
||
border-bottom: 2px solid var(--accent);
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 0 12px;
|
||
min-height: var(--tabs-height);
|
||
box-shadow: var(--shadow-sm);
|
||
flex-shrink: 0;
|
||
gap: 10px;
|
||
position: relative;
|
||
flex-wrap: wrap;
|
||
}
|
||
.toolbar-controls { display: flex; gap: 6px; margin-left: 8px; }
|
||
.toolbar-icon-btn {
|
||
background: rgba(255, 255, 255, 0.08);
|
||
border: 1px solid rgba(255, 255, 255, 0.15);
|
||
color: white;
|
||
width: 34px; height: 34px; border-radius: 6px; cursor: pointer;
|
||
font-size: 15px; display: flex; align-items: center; justify-content: center;
|
||
transition: all 0.2s; padding: 0;
|
||
}
|
||
.toolbar-icon-btn:hover:not(:disabled) { background: var(--accent); color: var(--primary-dark); border-color: var(--accent); transform: translateY(-1px); }
|
||
.toolbar-icon-btn svg { display: block; }
|
||
.toolbar-search { flex: 1; min-width: 180px; max-width: 320px; position: relative; display: flex; align-items: center; }
|
||
.search-icon { position: absolute; right: 10px; font-size: 13px; opacity: 0.7; pointer-events: none; }
|
||
.search-input {
|
||
width: 100%; padding: 7px 32px 7px 12px;
|
||
background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15);
|
||
border-radius: 6px; color: white; font-family: inherit; font-size: 13px; transition: all 0.2s;
|
||
}
|
||
.search-input::placeholder { color: rgba(255, 255, 255, 0.5); }
|
||
.search-input:focus { outline: none; background: rgba(255, 255, 255, 0.12); border-color: var(--accent); box-shadow: 0 0 0 2px rgba(201, 169, 97, 0.2); }
|
||
.toolbar-filters { display: flex; gap: 8px; }
|
||
.filter-dropdown {
|
||
position: relative; display: flex; align-items: center; gap: 6px;
|
||
background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15);
|
||
border-radius: 6px; padding: 0 10px; transition: all 0.2s;
|
||
}
|
||
.filter-dropdown:hover { border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.12); }
|
||
.filter-icon { font-size: 13px; opacity: 0.9; }
|
||
.filter-select {
|
||
background: transparent; border: none; color: white; font-family: inherit;
|
||
font-size: 12px; font-weight: 600; padding: 7px 4px; cursor: pointer; outline: none; min-width: 110px;
|
||
}
|
||
.filter-select option { background: var(--primary-dark); color: white; }
|
||
.toolbar-stats { display: flex; gap: 12px; margin-right: auto; padding-right: 8px; border-right: 1px solid rgba(255, 255, 255, 0.1); }
|
||
.stat-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: rgba(255, 255, 255, 0.85); white-space: nowrap; }
|
||
.stat-icon { font-size: 13px; }
|
||
.stat-label { font-weight: 500; }
|
||
.stat-value {
|
||
font-weight: 800; color: var(--accent); background: rgba(201, 169, 97, 0.15);
|
||
padding: 2px 7px; border-radius: 10px; font-size: 11px; min-width: 22px; text-align: center;
|
||
}
|
||
|
||
@media (max-width: 900px) {
|
||
.tabs-bar { flex-wrap: wrap; padding: 8px; gap: 8px; }
|
||
.toolbar-stats { order: 3; width: 100%; margin-right: 0; padding-right: 0; border-right: none; border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 8px; justify-content: center; }
|
||
.toolbar-search { order: 2; }
|
||
}
|
||
|
||
.board-area { flex: 1; overflow: auto; padding: 24px; background: var(--board-bg); transition: background 0.3s; }
|
||
.board-section { margin-bottom: 20px; }
|
||
.board-section:last-child { margin-bottom: 0; }
|
||
.board-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 2px solid var(--border); }
|
||
.board-header-title { font-size: 18px; font-weight: 800; color: var(--primary); display: flex; align-items: center; gap: 10px; }
|
||
[data-theme="dark"] .board-header-title { color: var(--accent); }
|
||
.board-header-actions { display: flex; gap: 8px; }
|
||
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
|
||
.project-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); transition: all 0.25s; display: flex; flex-direction: column; position: relative; }
|
||
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
|
||
.project-card-header { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: white; padding: 16px; position: relative; overflow: hidden; }
|
||
.project-card-header::before { content: ''; position: absolute; top: -30px; left: -30px; width: 100px; height: 100px; background: radial-gradient(circle, rgba(201, 169, 97, 0.2) 0%, transparent 70%); border-radius: 50%; }
|
||
.project-card-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; position: relative; z-index: 1; }
|
||
.project-card-icon { font-size: 22px; flex-shrink: 0; }
|
||
.project-card-title { font-size: 16px; font-weight: 700; flex: 1; }
|
||
.project-card-desc { font-size: 12px; opacity: 0.9; position: relative; z-index: 1; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
||
.project-card-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
|
||
.project-stat-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); }
|
||
.project-stat-value { font-weight: 700; color: var(--primary); }
|
||
[data-theme="dark"] .project-stat-value { color: var(--accent); }
|
||
.project-type-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
|
||
.type-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 4px; display: inline-block; }
|
||
.type-backend { background: #ebf4ff; color: #2b6cb0; }
|
||
.type-frontend { background: #f0fff4; color: #276749; }
|
||
.type-service { background: #fefcbf; color: #975a16; }
|
||
.type-database { background: #fed7e2; color: #97266d; }
|
||
.type-mobile { background: #e9d8fd; color: #553c9a; }
|
||
.type-infrastructure { background: #feebc8; color: #9c4221; }
|
||
[data-theme="dark"] .type-backend { background: rgba(66, 153, 225, 0.2); color: #90cdf4; }
|
||
[data-theme="dark"] .type-frontend { background: rgba(72, 187, 120, 0.2); color: #9ae6b4; }
|
||
[data-theme="dark"] .type-service { background: rgba(236, 201, 75, 0.2); color: #fefcbf; }
|
||
[data-theme="dark"] .type-database { background: rgba(237, 100, 166, 0.2); color: #fbb6ce; }
|
||
[data-theme="dark"] .type-mobile { background: rgba(159, 122, 234, 0.2); color: #d6bcfa; }
|
||
[data-theme="dark"] .type-infrastructure { background: rgba(237, 137, 54, 0.2); color: #fbd38d; }
|
||
.project-card-footer { padding: 12px 16px; background: var(--border-light); border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 6px; }
|
||
.card-actions { display: flex; gap: 6px; }
|
||
.board-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); text-align: center; }
|
||
.board-empty-icon { font-size: 80px; opacity: 0.3; margin-bottom: 20px; }
|
||
.board-empty h2 { font-size: 20px; color: var(--primary); margin-bottom: 10px; }
|
||
[data-theme="dark"] .board-empty h2 { color: var(--accent); }
|
||
.board-empty p { margin-bottom: 20px; }
|
||
.no-results { text-align: center; padding: 40px; color: var(--text-muted); background: var(--border-light); border-radius: var(--radius); margin: 20px 0; }
|
||
|
||
.modal-overlay { position: fixed; inset: 0; background: rgba(26, 54, 93, 0.6); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; animation: fadeIn 0.2s; }
|
||
.modal-overlay.active { display: flex; }
|
||
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
||
.modal { background: var(--panel-bg); color: var(--text); border-radius: 12px; width: 100%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slideUp 0.25s; }
|
||
.modal-lg { max-width: 800px; }
|
||
.modal-xl { max-width: 1000px; }
|
||
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
|
||
.modal-header { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 3px solid var(--accent); }
|
||
.modal-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
|
||
.modal-close { background: rgba(255, 255, 255, 0.15); border: none; color: white; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 16px; transition: all 0.2s; }
|
||
.modal-close:hover { background: var(--danger); }
|
||
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
|
||
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-start; gap: 8px; background: var(--border-light); }
|
||
|
||
.detail-section { margin-bottom: 20px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
|
||
.detail-section-header { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; padding: 12px 16px; font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
|
||
.detail-section-header-actions { display: flex; align-items: center; gap: 8px; }
|
||
.detail-section-body { padding: 16px; background: var(--card-bg); }
|
||
.detail-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
|
||
.detail-info-item { display: flex; flex-direction: column; gap: 4px; }
|
||
.detail-info-label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
|
||
.detail-info-value { font-size: 13px; font-weight: 600; color: var(--text); }
|
||
.subproject-list { display: flex; flex-direction: column; gap: 10px; }
|
||
.subproject-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--border-light); transition: all 0.2s; }
|
||
.subproject-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
|
||
.subproject-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 8px; }
|
||
.subproject-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
|
||
.subproject-actions { display: flex; gap: 4px; }
|
||
.subproject-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
|
||
.deployment-section { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
|
||
.deployment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
|
||
.deployment-header-title { font-size: 11px; font-weight: 600; color: var(--text-muted); }
|
||
.deployment-list { display: flex; flex-direction: column; gap: 6px; }
|
||
.deployment-item { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; background: var(--card-bg); border: 1px solid var(--border-light); border-radius: 6px; font-size: 11px; transition: all 0.2s; }
|
||
.deployment-item:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
|
||
.deployment-item-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
||
.deployment-env-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
|
||
.deployment-version { font-family: 'Vazirmatn', monospace; font-weight: 700; color: var(--primary); font-size: 11px; }
|
||
[data-theme="dark"] .deployment-version { color: var(--accent); }
|
||
.deployment-date { font-size: 10px; color: var(--text-muted); }
|
||
.deployment-actions { display: flex; gap: 4px; }
|
||
.empty-deployments { text-align: center; padding: 12px; color: var(--text-muted); background: var(--border-light); border-radius: 6px; }
|
||
.empty-subprojects { text-align: center; padding: 30px; color: var(--text-muted); background: var(--border-light); border-radius: var(--radius-sm); }
|
||
|
||
.form-group { margin-bottom: 16px; }
|
||
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--primary); margin-bottom: 6px; }
|
||
[data-theme="dark"] .form-label { color: var(--accent-light); }
|
||
.form-label .required { color: var(--danger); }
|
||
.form-input, .form-textarea, .form-select { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: inherit; font-size: 13px; background: var(--card-bg); color: var(--text); transition: all 0.2s; }
|
||
.form-input:focus, .form-textarea:focus, .form-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.15); }
|
||
.form-textarea { resize: vertical; min-height: 70px; line-height: 1.6; }
|
||
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
|
||
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
|
||
.form-row-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; align-items: end; }
|
||
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
|
||
.form-error { font-size: 11px; color: var(--danger); margin-top: 4px; display: none; }
|
||
.form-error.visible { display: block; }
|
||
|
||
.color-input-wrapper { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
|
||
.color-input-wrapper input[type="color"] { width: 32px; height: 32px; border: none; border-radius: 4px; cursor: pointer; padding: 0; }
|
||
.color-input-wrapper input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
|
||
.color-input-wrapper input[type="color"]::-webkit-color-swatch { border: 1px solid var(--border); border-radius: 4px; }
|
||
.color-preview-text { font-size: 11px; font-family: monospace; color: var(--text-muted); }
|
||
|
||
.webhook-section { background: var(--border-light); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-top: 12px; }
|
||
.webhook-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
|
||
.webhook-section-title { font-size: 13px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 6px; }
|
||
[data-theme="dark"] .webhook-section-title { color: var(--accent-light); }
|
||
.webhook-toggle { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }
|
||
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
|
||
.switch input { opacity: 0; width: 0; height: 0; }
|
||
.slider { position: absolute; cursor: pointer; inset: 0; background: var(--border); transition: 0.3s; border-radius: 20px; }
|
||
.slider::before { position: absolute; content: ""; height: 14px; width: 14px; right: 3px; bottom: 3px; background: white; transition: 0.3s; border-radius: 50%; }
|
||
input:checked + .slider { background: var(--success); }
|
||
input:checked + .slider::before { transform: translateX(-16px); }
|
||
.webhook-status { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 10px; background: var(--card-bg); border-radius: 4px; font-size: 11px; color: var(--text-muted); }
|
||
.webhook-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
|
||
.webhook-status-dot.success { background: var(--success); }
|
||
.webhook-status-dot.error { background: var(--danger); }
|
||
.webhook-status-dot.pending { background: var(--warning); animation: pulse 1.5s infinite; }
|
||
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
|
||
|
||
.toast-container { position: fixed; bottom: 20px; left: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
|
||
.toast { background: var(--primary); color: white; padding: 12px 18px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: 13px; display: flex; align-items: center; gap: 10px; animation: slideInLeft 0.3s; min-width: 250px; }
|
||
.toast.success { background: var(--success); }
|
||
.toast.error { background: var(--danger); }
|
||
.toast.warning { background: var(--warning); }
|
||
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: translateX(0); } }
|
||
|
||
.app-footer { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; padding: 8px 20px; font-size: 11px; display: flex; justify-content: space-between; align-items: center; border-top: 2px solid var(--accent); flex-shrink: 0; }
|
||
.footer-brand { color: var(--accent); font-weight: 700; }
|
||
|
||
.form-input[readonly], .form-textarea[readonly] { background: var(--border-light); color: var(--text-muted); cursor: not-allowed; opacity: 0.85; border-style: dashed; }
|
||
.readonly-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 600; color: var(--text-muted); background: var(--border-light); border: 1px solid var(--border); padding: 2px 8px; border-radius: 10px; margin-right: 6px; }
|
||
.readonly-badge::before { content: '🔒'; font-size: 10px; }
|
||
.readonly-info { background: linear-gradient(to left, #ebf8ff, #e6f6ff); border: 1px solid #90cdf4; border-right: 4px solid var(--info); padding: 10px 14px; border-radius: 6px; font-size: 11px; color: var(--text-muted); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
|
||
[data-theme="dark"] .readonly-info { background: rgba(49, 130, 206, 0.12); border-color: rgba(49, 130, 206, 0.3); border-right-color: var(--info); }
|
||
|
||
.env-card { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; transition: all 0.15s; }
|
||
.env-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-sm); }
|
||
|
||
/* Galaxy Graph Styles */
|
||
.galaxy-container {
|
||
width: 100%;
|
||
height: 600px;
|
||
background: radial-gradient(ellipse at center, #0a0e27 0%, #050817 100%);
|
||
border-radius: 8px;
|
||
overflow: hidden;
|
||
position: relative;
|
||
}
|
||
.galaxy-container svg {
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
.galaxy-node {
|
||
cursor: pointer;
|
||
transition: all 0.3s;
|
||
}
|
||
.galaxy-node:hover {
|
||
filter: brightness(1.3);
|
||
}
|
||
.galaxy-link {
|
||
stroke-opacity: 0.4;
|
||
transition: all 0.3s;
|
||
}
|
||
.galaxy-link:hover {
|
||
stroke-opacity: 0.8;
|
||
stroke-width: 2;
|
||
}
|
||
.galaxy-tooltip {
|
||
position: absolute;
|
||
background: rgba(10, 14, 39, 0.95);
|
||
color: #e0c789;
|
||
padding: 10px 14px;
|
||
border-radius: 6px;
|
||
font-size: 12px;
|
||
pointer-events: none;
|
||
opacity: 0;
|
||
transition: opacity 0.3s;
|
||
border: 1px solid #c9a961;
|
||
max-width: 250px;
|
||
z-index: 1000;
|
||
}
|
||
.galaxy-legend {
|
||
position: absolute;
|
||
top: 20px;
|
||
right: 20px;
|
||
background: rgba(10, 14, 39, 0.9);
|
||
padding: 12px 16px;
|
||
border-radius: 8px;
|
||
border: 1px solid #c9a961;
|
||
color: #e0c789;
|
||
font-size: 11px;
|
||
}
|
||
.galaxy-legend-title {
|
||
font-weight: 700;
|
||
margin-bottom: 8px;
|
||
font-size: 12px;
|
||
}
|
||
.galaxy-legend-item {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
margin-bottom: 4px;
|
||
}
|
||
.galaxy-legend-color {
|
||
width: 12px;
|
||
height: 12px;
|
||
border-radius: 50%;
|
||
}
|
||
.galaxy-controls {
|
||
position: absolute;
|
||
bottom: 20px;
|
||
right: 20px;
|
||
display: flex;
|
||
gap: 8px;
|
||
}
|
||
.galaxy-controls button {
|
||
background: rgba(10, 14, 39, 0.9);
|
||
color: #e0c789;
|
||
border: 1px solid #c9a961;
|
||
padding: 6px 12px;
|
||
border-radius: 6px;
|
||
cursor: pointer;
|
||
font-family: 'Vazirmatn', Tahoma, sans-serif;
|
||
font-size: 11px;
|
||
}
|
||
.galaxy-controls button:hover {
|
||
background: #c9a961;
|
||
color: #0a0e27;
|
||
}
|
||
|
||
::-webkit-scrollbar { width: 8px; height: 8px; }
|
||
::-webkit-scrollbar-track { background: transparent; }
|
||
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
|
||
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
|
||
</style>
|
||
</head>
|
||
|
||
<body>
|
||
<header class="app-header">
|
||
<div class="app-brand">
|
||
<div class="app-logo"></div>
|
||
<div class="app-brand-text">
|
||
<div class="app-title" id="headerTitle">مدیریت محصولات</div>
|
||
<div class="app-subtitle" id="headerSubtitle">مدیریت نسخهها و نیازمندیهای محصولات</div>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
|
||
<div class="tabs-bar" id="advancedToolbar">
|
||
<div class="toolbar-controls">
|
||
<button class="toolbar-icon-btn" id="sidebarToggle" title="باز/بسته کردن سایدبار">
|
||
<span id="sidebarIcon">✕</span>
|
||
</button>
|
||
<button class="toolbar-icon-btn" id="themeToggle" title="تغییر تم">
|
||
<span id="themeIcon">🌙</span>
|
||
</button>
|
||
<button class="toolbar-icon-btn" id="undoBtn" title="بازگشت (Ctrl+Z)" disabled>
|
||
<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d="M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>
|
||
</button>
|
||
<button class="toolbar-icon-btn" id="redoBtn" title="باز انجام (Ctrl+Y)" disabled>
|
||
<svg viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>
|
||
</button>
|
||
</div>
|
||
|
||
<div class="toolbar-search">
|
||
<span class="search-icon"></span>
|
||
<input type="text" class="search-input" id="toolbarSearch" placeholder="جستجو...">
|
||
</div>
|
||
|
||
<div class="toolbar-filters">
|
||
<div class="filter-dropdown">
|
||
<span class="filter-icon">🏷️</span>
|
||
<select class="filter-select" id="filterType">
|
||
<option value="">همه انواع</option>
|
||
<option value="backend">بکاند</option>
|
||
<option value="frontend">فرانتاند</option>
|
||
<option value="service">میکروسرویس</option>
|
||
<option value="database">پایگاه داده</option>
|
||
<option value="mobile">موبایل</option>
|
||
<option value="infrastructure">زیرساخت</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div class="filter-dropdown">
|
||
<span class="filter-icon">🌐</span>
|
||
<select class="filter-select" id="filterEnvironment">
|
||
<option value="">همه محیطها</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="toolbar-stats">
|
||
<div class="stat-item">
|
||
<span class="stat-icon">📋</span>
|
||
<span class="stat-label">کل:</span>
|
||
<span class="stat-value" id="statTotal">0</span>
|
||
</div>
|
||
<div class="stat-item">
|
||
<span class="stat-icon">📦</span>
|
||
<span class="stat-label">محصول:</span>
|
||
<span class="stat-value" id="statProjects">0</span>
|
||
</div>
|
||
<div class="stat-item">
|
||
<span class="stat-icon"></span>
|
||
<span class="stat-label">پروژه:</span>
|
||
<span class="stat-value" id="statSubProjects">0</span>
|
||
</div>
|
||
<div class="stat-item">
|
||
<span class="stat-icon">🔗</span>
|
||
<span class="stat-label">وابستگی:</span>
|
||
<span class="stat-value" id="statDependencies">0</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="app-main">
|
||
<aside class="sidebar" id="sidebar">
|
||
<div class="sidebar-header">
|
||
<div class="sidebar-title">🛠️ ابزارها</div>
|
||
</div>
|
||
<div class="sidebar-body" id="sidebarBody"></div>
|
||
</aside>
|
||
|
||
<main class="board-area" id="boardArea"></main>
|
||
</div>
|
||
|
||
<footer class="app-footer" id="appFooter">
|
||
<div>
|
||
<span class="footer-brand">طراح و توسعهدهنده:</span> هادی خزاعی اصل
|
||
<span style="margin: 0 10px;">|</span>
|
||
<span class="footer-brand">شرکت:</span> رایان پرداز کاوش
|
||
</div>
|
||
<div>
|
||
<span class="footer-brand">نسخه:</span> 1.4.20
|
||
</div>
|
||
</footer>
|
||
|
||
<!-- Settings Modal -->
|
||
<div class="modal-overlay" id="settingsModal">
|
||
<div class="modal modal-lg">
|
||
<div class="modal-header">
|
||
<div class="modal-title"><span>⚙️</span><span>تنظیمات محصول</span></div>
|
||
<button class="modal-close" data-close-modal></button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="readonly-info">
|
||
<span>ℹ️</span>
|
||
<span>اطلاعات پایه محصول فقط قابل مشاهده هستند و از طریق فایل پیکربندی قابل تغییر میباشند.</span>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group">
|
||
<label class="form-label">عنوان محصول <span class="readonly-badge">فقط خواندنی</span></label>
|
||
<input type="text" class="form-input" id="settingProjectTitle" readonly>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">نسخه <span class="readonly-badge">فقط خواندنی</span></label>
|
||
<input type="text" class="form-input" id="settingVersion" readonly>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">توضیحات <span class="readonly-badge">فقط خواندنی</span></label>
|
||
<textarea class="form-textarea" id="settingDescription" readonly></textarea>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group">
|
||
<label class="form-label">توسعهدهنده <span class="readonly-badge">فقط خواندنی</span></label>
|
||
<input type="text" class="form-input" id="settingDeveloper" readonly>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">شرکت <span class="readonly-badge">فقط خواندنی</span></label>
|
||
<input type="text" class="form-input" id="settingCompany" readonly>
|
||
</div>
|
||
</div>
|
||
<div class="webhook-section">
|
||
<div class="webhook-section-header">
|
||
<div class="webhook-section-title"><span></span><span>تنظیمات وبهوک</span></div>
|
||
<div class="webhook-toggle">
|
||
<span>فعالسازی</span>
|
||
<label class="switch">
|
||
<input type="checkbox" id="settingWebhookEnabled">
|
||
<span class="slider"></span>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">آدرس URL وبهوک <span class="required">*</span></label>
|
||
<input type="url" class="form-input" id="settingWebhookUrl" dir="ltr" placeholder="https://example.com/webhook">
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">شناسه کلاینت (Client ID) <span class="required">*</span></label>
|
||
<input type="text" class="form-input" id="settingWebhookClientId" dir="ltr" placeholder="client-xxxx-xxxx">
|
||
</div>
|
||
<div class="webhook-status">
|
||
<span class="webhook-status-dot" id="webhookStatusDot"></span>
|
||
<span id="webhookStatusText">وضعیت: غیرفعال</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-accent" id="saveSettingsBtn"> ذخیره</button>
|
||
<button class="btn btn-ghost" data-close-modal>بستن</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Environment Manager Modal -->
|
||
<div class="modal-overlay" id="envManagerModal">
|
||
<div class="modal modal-lg">
|
||
<div class="modal-header">
|
||
<div class="modal-title">
|
||
<span>🌍</span>
|
||
<span>افزودن محیط عملیاتی جدید</span>
|
||
</div>
|
||
<button class="modal-close" data-close-modal>✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="form-row">
|
||
<div class="form-group">
|
||
<label class="form-label">نام محیط <span class="required">*</span></label>
|
||
<input type="text" class="form-input" id="newEnvName" placeholder="مثلاً: QA">
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">توضیحات</label>
|
||
<input type="text" class="form-input" id="newEnvDesc" placeholder="توضیحات محیط">
|
||
</div>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group">
|
||
<label class="form-label">رنگ پسزمینه</label>
|
||
<div class="color-input-wrapper">
|
||
<input type="color" id="newEnvBgColor" value="#38a169">
|
||
<span class="color-preview-text" id="newEnvBgColorText">#38a169</span>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">رنگ متن</label>
|
||
<div class="color-input-wrapper">
|
||
<input type="color" id="newEnvTextColor" value="#ffffff">
|
||
<span class="color-preview-text" id="newEnvTextColorText">#ffffff</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-accent" id="saveNewEnvBtn">💾 ثبت محیط</button>
|
||
<button class="btn btn-ghost" data-close-modal>انصراف</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Environment Edit Modal -->
|
||
<div class="modal-overlay" id="envEditModal">
|
||
<div class="modal">
|
||
<div class="modal-header">
|
||
<div class="modal-title">
|
||
<span>✏️</span>
|
||
<span>ویرایش محیط عملیاتی</span>
|
||
</div>
|
||
<button class="modal-close" data-close-modal>✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="form-group">
|
||
<label class="form-label">شناسه محیط <span class="readonly-badge">فقط خواندنی</span></label>
|
||
<input type="text" class="form-input" id="editEnvId" readonly>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">نام محیط <span class="required">*</span></label>
|
||
<input type="text" class="form-input" id="editEnvName">
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">توضیحات</label>
|
||
<input type="text" class="form-input" id="editEnvDesc">
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group">
|
||
<label class="form-label">رنگ پسزمینه</label>
|
||
<div class="color-input-wrapper">
|
||
<input type="color" id="editEnvBgColor">
|
||
<span class="color-preview-text" id="editEnvBgColorText"></span>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">رنگ متن</label>
|
||
<div class="color-input-wrapper">
|
||
<input type="color" id="editEnvTextColor">
|
||
<span class="color-preview-text" id="editEnvTextColorText"></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">پیشنمایش</label>
|
||
<div id="editEnvPreview" class="env-color-preview">نمونه متن</div>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-accent" id="saveEnvEditBtn">💾 ذخیره تغییرات</button>
|
||
<button class="btn btn-ghost" data-close-modal>انصراف</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Product Hierarchy Manager Modal -->
|
||
<div class="modal-overlay" id="projectHierarchyModal">
|
||
<div class="modal modal-lg">
|
||
<div class="modal-header">
|
||
<div class="modal-title"><span>📦</span><span>مدیریت محصولات و پروژهها</span></div>
|
||
<button class="modal-close" data-close-modal>✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div id="projectHierarchyTree" style="max-height: 60vh; overflow-y: auto; padding: 4px;"></div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-accent" onclick="ProductManager.openAddProductModal()">➕ محصول جدید</button>
|
||
<button class="btn btn-ghost" data-close-modal>بستن</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Product Detail Modal -->
|
||
<div class="modal-overlay" id="projectDetailModal">
|
||
<div class="modal modal-xl">
|
||
<div class="modal-header">
|
||
<div class="modal-title" id="projectDetailTitle">
|
||
<span>📦</span>
|
||
<span>جزئیات محصول</span>
|
||
</div>
|
||
<div style="display: flex; gap: 8px;">
|
||
<button class="modal-close" data-close-modal>✕</button>
|
||
</div>
|
||
</div>
|
||
<div class="modal-body" id="projectDetailBody"></div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-danger btn-sm" id="projectDetailDeleteBtn">🗑️ حذف محصول</button>
|
||
<button class="btn btn-ghost" data-close-modal>بستن</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Product Edit Modal -->
|
||
<div class="modal-overlay" id="productEditModal">
|
||
<div class="modal modal-lg">
|
||
<div class="modal-header">
|
||
<div class="modal-title">
|
||
<span>✏️</span>
|
||
<span>ویرایش اطلاعات محصول</span>
|
||
</div>
|
||
<button class="modal-close" data-close-modal>✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="form-group">
|
||
<label class="form-label">شناسه محصول <span class="readonly-badge">فقط خواندنی</span></label>
|
||
<input type="text" class="form-input" id="editProductId" readonly>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">عنوان محصول <span class="required">*</span></label>
|
||
<input type="text" class="form-input" id="editProductTitle">
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">توضیحات</label>
|
||
<textarea class="form-textarea" id="editProductDescription" rows="3"></textarea>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group">
|
||
<label class="form-label">مالک</label>
|
||
<input type="text" class="form-input" id="editProductOwner">
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">تاریخ ایجاد <span class="readonly-badge">فقط خواندنی</span></label>
|
||
<input type="text" class="form-input" id="editProductCreatedAt" readonly>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-accent" id="saveProductEditBtn">💾 ذخیره تغییرات</button>
|
||
<button class="btn btn-ghost" data-close-modal>انصراف</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Add Product Modal -->
|
||
<div class="modal-overlay" id="addProductModal">
|
||
<div class="modal modal-lg">
|
||
<div class="modal-header">
|
||
<div class="modal-title">
|
||
<span>➕</span>
|
||
<span>ایجاد محصول جدید</span>
|
||
</div>
|
||
<button class="modal-close" data-close-modal>✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="readonly-info">
|
||
<span>ℹ️</span>
|
||
<span>لطفاً اطلاعات محصول جدید را با دقت وارد کنید. فیلدهای دارای <span style="color: var(--danger);">*</span> الزامی هستند.</span>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">عنوان محصول <span class="required">*</span></label>
|
||
<input type="text" class="form-input" id="newProductTitle" placeholder="مثلاً: سامانه فروشگاه آنلاین">
|
||
<div class="form-error" id="newProductTitleError">عنوان محصول الزامی است و باید حداقل ۳ کاراکتر باشد</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">توضیحات</label>
|
||
<textarea class="form-textarea" id="newProductDescription" rows="3" placeholder="توضیحات مختصر درباره محصول..."></textarea>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group">
|
||
<label class="form-label">مالک / تیم مسئول</label>
|
||
<input type="text" class="form-input" id="newProductOwner" placeholder="مثلاً: تیم توسعه محصول">
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">تاریخ ایجاد <span class="readonly-badge">فقط خواندنی</span></label>
|
||
<input type="text" class="form-input" id="newProductCreatedAt" readonly>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-accent" id="saveNewProductBtn">💾 ثبت محصول</button>
|
||
<button class="btn btn-ghost" data-close-modal>انصراف</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Add Project Modal -->
|
||
<div class="modal-overlay" id="addProjectModal">
|
||
<div class="modal modal-lg">
|
||
<div class="modal-header">
|
||
<div class="modal-title">
|
||
<span>➕</span>
|
||
<span>افزودن پروژه جدید</span>
|
||
</div>
|
||
<button class="modal-close" data-close-modal>✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="form-group">
|
||
<label class="form-label">عنوان پروژه <span class="required">*</span></label>
|
||
<input type="text" class="form-input" id="newProjectTitle" placeholder="مثلاً: Backend API Service">
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group">
|
||
<label class="form-label">نوع پروژه <span class="required">*</span></label>
|
||
<select class="form-select" id="newProjectType">
|
||
<option value="">انتخاب کنید...</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">فریمورک</label>
|
||
<input type="text" class="form-input" id="newProjectFramework" placeholder="مثلاً: .NET 8">
|
||
</div>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group">
|
||
<label class="form-label">زبان برنامهنویسی</label>
|
||
<input type="text" class="form-input" id="newProjectLanguage" placeholder="مثلاً: C#">
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">آدرس مخزن</label>
|
||
<input type="text" class="form-input" id="newProjectRepo" dir="ltr" placeholder="https://github.com/...">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">توضیحات</label>
|
||
<textarea class="form-textarea" id="newProjectDescription" rows="3" placeholder="توضیحات پروژه..."></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-accent" id="saveNewProjectBtn">💾 ذخیره</button>
|
||
<button class="btn btn-ghost" data-close-modal>انصراف</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Edit Project Modal -->
|
||
<div class="modal-overlay" id="editProjectModal">
|
||
<div class="modal modal-lg">
|
||
<div class="modal-header">
|
||
<div class="modal-title">
|
||
<span>✏️</span>
|
||
<span>ویرایش اطلاعات پروژه</span>
|
||
</div>
|
||
<button class="modal-close" data-close-modal>✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="form-group">
|
||
<label class="form-label">شناسه پروژه <span class="readonly-badge">فقط خواندنی</span></label>
|
||
<input type="text" class="form-input" id="editProjId" readonly>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">عنوان پروژه <span class="required">*</span></label>
|
||
<input type="text" class="form-input" id="editProjTitle">
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group">
|
||
<label class="form-label">نوع پروژه <span class="required">*</span></label>
|
||
<select class="form-select" id="editProjType">
|
||
<option value="">انتخاب کنید...</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">فریمورک</label>
|
||
<input type="text" class="form-input" id="editProjFramework">
|
||
</div>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group">
|
||
<label class="form-label">زبان برنامهنویسی</label>
|
||
<input type="text" class="form-input" id="editProjLanguage">
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">آدرس مخزن</label>
|
||
<input type="text" class="form-input" id="editProjRepo" dir="ltr">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">توضیحات</label>
|
||
<textarea class="form-textarea" id="editProjDescription" rows="3"></textarea>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-accent" id="saveProjEditBtn">💾 ذخیره تغییرات</button>
|
||
<button class="btn btn-ghost" data-close-modal>انصراف</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Deployment Modal -->
|
||
<div class="modal-overlay" id="deploymentModal">
|
||
<div class="modal">
|
||
<div class="modal-header">
|
||
<div class="modal-title" id="deploymentModalTitle">
|
||
<span>🚀</span>
|
||
<span>افزودن نسخه استقرار</span>
|
||
</div>
|
||
<button class="modal-close" data-close-modal>✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="form-group" id="deploymentEnvGroup"></div>
|
||
<div class="form-group">
|
||
<label class="form-label">نسخه <span class="required">*</span></label>
|
||
<input type="text" class="form-input" id="depVersion" dir="ltr" placeholder="مثلاً: 1.2.3 یا 2.0.0-rc.1">
|
||
<div class="form-hint">از فرمت SemVer استفاده کنید (مثال: 1.2.3, 2.0.0-beta.1)</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="form-label">تاریخ و زمان استقرار <span class="required">*</span></label>
|
||
<input type="datetime-local" class="form-input" id="depDate" dir="ltr">
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-accent" id="saveDeploymentBtn">💾 ذخیره</button>
|
||
<button class="btn btn-ghost" data-close-modal>انصراف</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Dependency Manager Modal -->
|
||
<div class="modal-overlay" id="dependencyManagerModal">
|
||
<div class="modal modal-lg">
|
||
<div class="modal-header">
|
||
<div class="modal-title">
|
||
<span>🔗</span>
|
||
<span>مدیریت وابستگیها</span>
|
||
</div>
|
||
<button class="modal-close" data-close-modal>✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="readonly-info">
|
||
<span>ℹ️</span>
|
||
<span>وابستگیهای پروژه فعلی را مدیریت کنید. هر وابستگی شامل یک پروژه و یک نسخه استقرار خاص از آن پروژه است.</span>
|
||
</div>
|
||
|
||
<div class="detail-section-header" style="margin-top: 16px;">📋 وابستگیهای فعلی</div>
|
||
<div id="currentDependenciesList" class="dependency-list"></div>
|
||
|
||
<div class="detail-section-header" style="margin-top: 16px;">🔍 افزودن وابستگی جدید</div>
|
||
<input type="text" class="form-input" id="dependencySearch" placeholder="جستجو در پروژهها..." style="margin-top: 8px;">
|
||
<div id="dependencySearchResults" style="margin-top: 8px; max-height: 200px; overflow-y: auto;"></div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-ghost" data-close-modal>بستن</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Galaxy Graph Modal -->
|
||
<div class="modal-overlay" id="galaxyGraphModal">
|
||
<div class="modal modal-xl" style="max-width: 1200px;">
|
||
<div class="modal-header">
|
||
<div class="modal-title">
|
||
<span>🌌</span>
|
||
<span>نمودار کهکشانی محصولات و وابستگیها</span>
|
||
</div>
|
||
<button class="modal-close" data-close-modal>✕</button>
|
||
</div>
|
||
<div class="modal-body" style="padding: 0;">
|
||
<div class="galaxy-container" id="galaxyContainer">
|
||
<div class="galaxy-legend" id="galaxyLegend"></div>
|
||
<div class="galaxy-controls">
|
||
<button onclick="resetGalaxyZoom()">🔍 بازنشانی نما</button>
|
||
<button onclick="toggleGalaxyAnimation()">⏯️ توقف/ادامه</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-ghost" data-close-modal>بستن</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="toast-container" id="toastContainer"></div>
|
||
|
||
<script>
|
||
const projectData = {
|
||
projectId: '550e8400-e29b-41d4-a716-446655440000',
|
||
projectName: 'xDependencies',
|
||
projectTitle: 'مدیریت محصولات',
|
||
description: 'مدیریت نسخهها و نیازمندیهای محصولات',
|
||
version: '1.4.20',
|
||
developer: 'هادی خزاعی اصل',
|
||
company: 'رایان پرداز کاوش',
|
||
metadata: {
|
||
createdAt: '2026-09-13T00:00:00Z',
|
||
updatedAt: '2026-09-14T00:00:00Z',
|
||
tags: ['release-management', 'architecture', 'product-management'],
|
||
customFields: {}
|
||
},
|
||
webhook: { url: '', clientId: '', enabled: false },
|
||
toolGroups: [
|
||
{
|
||
id: 'product-management', title: 'محصول', icon: '📦', description: 'مدیریت چرخه حیات محصول',
|
||
tools: [
|
||
{ id: 'create-product', title: 'ایجاد', icon: '➕', action: 'createProduct', shortcut: null, description: 'ایجاد یک محصول جدید' },
|
||
{ id: 'edit-product', title: 'ویرایش', icon: '️', action: 'editProduct', shortcut: null, description: 'ویرایش اطلاعات محصول' },
|
||
{ id: 'product-settings', title: 'تنظیمات', icon: '⚙️', action: 'openProductSettings', shortcut: null, description: 'پیکربندی تنظیمات' },
|
||
{ id: 'save-product', title: 'ذخیره', icon: '💾', action: 'saveProduct', shortcut: null, description: 'دانلود دادههای محصول' },
|
||
{ id: 'load-product', title: 'بارگذاری', icon: '📂', action: 'loadProduct', shortcut: null, description: 'بارگذاری از فایل JSON' },
|
||
],
|
||
},
|
||
{
|
||
id: 'management', title: 'مدیریت', icon: '⚙️', description: 'ابزارهای مدیریت پیکربندی',
|
||
tools: [
|
||
{ id: 'manage-envs', title: 'مدیریت محیطها', icon: '', action: 'manageEnvironments', shortcut: null, description: 'مدیریت محیطهای عملیاتی' },
|
||
{ id: 'manage-products', title: 'مدیریت محصولات', icon: '📦', action: 'manageProducts', shortcut: null, description: 'مدیریت سلسلهمراتب' }
|
||
]
|
||
},
|
||
{
|
||
id: 'reports', title: 'گزارشها', icon: '', description: 'تحلیل و گزارشگیری',
|
||
tools: [
|
||
{ id: 'view-reports', title: 'نمایش گزارشها', icon: '📈', action: 'viewReports', shortcut: null, description: 'آمار کلی محصول' },
|
||
{ id: 'dependency-graph', title: 'نمودار وابستگی', icon: '️', action: 'showDependencyGraph', shortcut: null, description: 'نمایش بصری وابستگیها' },
|
||
{ id: 'galaxy-graph', title: 'نمودار کهکشانی', icon: '🌌', action: 'showGalaxyGraph', shortcut: null, description: 'نمایش کهکشانی محصولات و وابستگیها' },
|
||
],
|
||
},
|
||
],
|
||
appData: {
|
||
environments: [
|
||
{ id: 'env-prod-001', name: 'Production', description: 'محیط عملیاتی اصلی' },
|
||
{ id: 'env-stage-002', name: 'Staging', description: 'محیط پیش از تولید' },
|
||
{ id: 'env-dev-003', name: 'Development', description: 'محیط توسعه' },
|
||
],
|
||
products: [
|
||
{
|
||
id: 'prod-1001', title: 'سامانه فروشگاه آنلاین', description: 'پلتفرم جامع فروش محصولات',
|
||
metadata: { createdAt: '2026-09-01T00:00:00Z', owner: 'تیم توسعه محصول', customFields: {} },
|
||
projects: [
|
||
{
|
||
id: 'proj-1001-01', title: 'Backend API Service', description: 'سرویس بکاند اصلی',
|
||
type: 'backend', repositoryUrl: '',
|
||
metadata: { framework: '.NET 8', language: 'C#' },
|
||
dependencies: [],
|
||
lastDeployedVersions: [
|
||
{ environmentId: 'env-prod-001', version: '2.3.1', deploymentDate: '2026-09-10T14:30:00Z' },
|
||
{ environmentId: 'env-stage-002', version: '2.4.0-rc.1', deploymentDate: '2026-09-12T09:00:00Z' },
|
||
],
|
||
},
|
||
{
|
||
id: 'proj-1001-02', title: 'Frontend Web Application', description: 'اپلیکیشن فرانتاند',
|
||
type: 'frontend', repositoryUrl: '',
|
||
metadata: { framework: 'Angular 18', language: 'TypeScript' },
|
||
dependencies: ['proj-1001-01'],
|
||
lastDeployedVersions: [
|
||
{ environmentId: 'env-prod-001', version: '3.1.0', deploymentDate: '2026-09-11T10:00:00Z' },
|
||
],
|
||
},
|
||
{
|
||
id: 'proj-1001-03', title: 'Payment Gateway Service', description: 'سرویس درگاه پرداخت',
|
||
type: 'service', repositoryUrl: '',
|
||
metadata: { framework: '.NET 8', language: 'C#' },
|
||
dependencies: ['proj-1001-01'],
|
||
lastDeployedVersions: [
|
||
{ environmentId: 'env-prod-001', version: '1.2.0', deploymentDate: '2026-09-08T16:00:00Z' },
|
||
],
|
||
},
|
||
],
|
||
},
|
||
],
|
||
},
|
||
};
|
||
|
||
const VALID_PROJECT_TYPES = [
|
||
{ value: 'backend', label: 'بکاند (Backend)', icon: '🖥️' },
|
||
{ value: 'frontend', label: 'فرانتاند (Frontend)', icon: '🌐' },
|
||
{ value: 'service', label: 'میکروسرویس (Service)', icon: '️' },
|
||
{ value: 'database', label: 'پایگاه داده (Database)', icon: '🗄️' },
|
||
{ value: 'mobile', label: 'موبایل (Mobile)', icon: '📱' },
|
||
{ value: 'infrastructure', label: 'زیرساخت (Infrastructure)', icon: '🏗️' }
|
||
];
|
||
|
||
const TYPE_COLORS = {
|
||
backend: '#3182ce',
|
||
frontend: '#38a169',
|
||
service: '#dd6b20',
|
||
database: '#97266d',
|
||
mobile: '#553c9a',
|
||
infrastructure: '#9c4221'
|
||
};
|
||
|
||
function validateAppDataStructure(data) {
|
||
if (!data || typeof data !== 'object') return false;
|
||
if (!Array.isArray(data.environments)) return false;
|
||
if (!Array.isArray(data.products)) return false;
|
||
return true;
|
||
}
|
||
|
||
function populateProjectTypeDropdowns() {
|
||
const selects = ['newProjectType', 'editProjType'];
|
||
selects.forEach(selectId => {
|
||
const select = document.getElementById(selectId);
|
||
if (!select) return;
|
||
const currentValue = select.value;
|
||
select.innerHTML = '<option value="">انتخاب کنید...</option>' +
|
||
VALID_PROJECT_TYPES.map(t => `<option value="${t.value}">${t.icon} ${t.label}</option>`).join('');
|
||
if (currentValue) select.value = currentValue;
|
||
});
|
||
}
|
||
|
||
const ModalManager = {
|
||
open(id) { const m = document.getElementById(id); if (m) m.classList.add('active'); },
|
||
close(id) { const m = document.getElementById(id); if (m) m.classList.remove('active'); },
|
||
closeAll() { document.querySelectorAll('.modal-overlay.active').forEach(m => m.classList.remove('active')); },
|
||
init() {
|
||
document.querySelectorAll('[data-close-modal]').forEach(btn => {
|
||
btn.addEventListener('click', (e) => {
|
||
e.stopPropagation();
|
||
const modal = e.target.closest('.modal-overlay');
|
||
if (modal) modal.classList.remove('active');
|
||
});
|
||
});
|
||
document.querySelectorAll('.modal-overlay').forEach(overlay => {
|
||
overlay.addEventListener('click', (e) => {
|
||
if (e.target === overlay) overlay.classList.remove('active');
|
||
});
|
||
});
|
||
document.addEventListener('keydown', (e) => {
|
||
if (e.key === 'Escape') this.closeAll();
|
||
});
|
||
}
|
||
};
|
||
|
||
const ToolbarManager = {
|
||
currentFilters: { query: '', typeFilter: '', envFilter: '' },
|
||
init() {
|
||
this.populateEnvironmentFilter();
|
||
this.bindEvents();
|
||
this.updateStats();
|
||
},
|
||
populateEnvironmentFilter() {
|
||
const select = document.getElementById('filterEnvironment');
|
||
if (!select) return;
|
||
const envs = projectData.appData.environments || [];
|
||
select.innerHTML = '<option value="">همه محیطها</option>' +
|
||
envs.map(e => `<option value="${e.id}">${e.name}</option>`).join('');
|
||
},
|
||
bindEvents() {
|
||
const searchInput = document.getElementById('toolbarSearch');
|
||
const filterType = document.getElementById('filterType');
|
||
const filterEnv = document.getElementById('filterEnvironment');
|
||
if (searchInput) searchInput.addEventListener('input', () => { this.applyFilters(); BoardRenderer.render(); });
|
||
if (filterType) filterType.addEventListener('change', () => { this.applyFilters(); BoardRenderer.render(); });
|
||
if (filterEnv) filterEnv.addEventListener('change', () => { this.applyFilters(); BoardRenderer.render(); });
|
||
},
|
||
applyFilters() {
|
||
this.currentFilters = {
|
||
query: (document.getElementById('toolbarSearch')?.value || '').trim().toLowerCase(),
|
||
typeFilter: document.getElementById('filterType')?.value || '',
|
||
envFilter: document.getElementById('filterEnvironment')?.value || ''
|
||
};
|
||
this.updateStats();
|
||
},
|
||
updateStats() {
|
||
const products = projectData.appData.products || [];
|
||
let totalProjects = 0;
|
||
let totalDeps = 0;
|
||
products.forEach(p => {
|
||
const projects = p.projects || [];
|
||
projects.forEach(pr => {
|
||
totalProjects++;
|
||
totalDeps += (pr.dependencies || []).length;
|
||
});
|
||
});
|
||
const set = (id, val) => { const el = document.getElementById(id); if (el) el.textContent = val; };
|
||
set('statTotal', products.length + totalProjects);
|
||
set('statProjects', products.length);
|
||
set('statSubProjects', totalProjects);
|
||
set('statDependencies', totalDeps);
|
||
},
|
||
shouldShowProduct(product) {
|
||
const f = this.currentFilters;
|
||
if (!f.query && !f.typeFilter && !f.envFilter) return true;
|
||
const projects = product.projects || [];
|
||
return projects.some(pr => {
|
||
const matchQuery = !f.query || pr.title.toLowerCase().includes(f.query) || product.title.toLowerCase().includes(f.query) || (pr.description || '').toLowerCase().includes(f.query);
|
||
const matchType = !f.typeFilter || pr.type === f.typeFilter;
|
||
const matchEnv = !f.envFilter || (pr.lastDeployedVersions || []).some(d => d.environmentId === f.envFilter);
|
||
return matchQuery && matchType && matchEnv;
|
||
});
|
||
}
|
||
};
|
||
|
||
const BoardRenderer = {
|
||
render() {
|
||
const board = document.getElementById('boardArea');
|
||
const products = projectData.appData.products || [];
|
||
const filteredProducts = products.filter(p => ToolbarManager.shouldShowProduct(p));
|
||
|
||
let html = '';
|
||
|
||
html += `<div class="board-section"><div class="board-header"><div class="board-header-title"><span>📦</span><span>محصولها (${filteredProducts.length} از ${products.length})</span></div><div class="board-header-actions"><button class="btn btn-accent" onclick="ProductManager.openAddProductModal()">➕ محصول جدید</button></div></div>`;
|
||
|
||
if (products.length === 0) {
|
||
html += `<div class="board-empty"><div class="board-empty-icon">📦</div><h2>هیچ محصولی تعریف نشده است</h2><p>برای شروع، از دکمه "ایجاد محصول" استفاده کنید</p></div>`;
|
||
} else if (filteredProducts.length === 0) {
|
||
html += '<div class="no-results">🔍 نتیجهای با فیلترهای فعلی یافت نشد</div>';
|
||
} else {
|
||
html += '<div class="projects-grid">';
|
||
filteredProducts.forEach(prod => {
|
||
const projects = prod.projects || [];
|
||
const typeCounts = {};
|
||
projects.forEach(pr => { typeCounts[pr.type] = (typeCounts[pr.type] || 0) + 1; });
|
||
const totalDeps = projects.reduce((sum, pr) => sum + (pr.dependencies || []).length, 0);
|
||
const totalDeploys = projects.reduce((sum, pr) => sum + (pr.lastDeployedVersions || []).length, 0);
|
||
html += `<div class="project-card" data-product-id="${prod.id}"><div class="project-card-header"><div class="project-card-title-row"><span class="project-card-icon">📦</span><div class="project-card-title">${prod.title}</div></div><div class="project-card-desc">${prod.description || 'بدون توضیحات'}</div></div><div class="project-card-body"><div class="project-stat-row"><span>🌿 پروژهها:</span><span class="project-stat-value">${projects.length}</span></div><div class="project-stat-row"><span>🔗 وابستگیها:</span><span class="project-stat-value">${totalDeps}</span></div><div class="project-stat-row"><span>🚀 استقرارها:</span><span class="project-stat-value">${totalDeploys}</span></div>${Object.keys(typeCounts).length > 0 ? `<div class="project-type-badges">${Object.entries(typeCounts).map(([type, count]) => { const typeInfo = VALID_PROJECT_TYPES.find(t => t.value === type) || { label: type }; return `<span class="type-badge type-${type}">${typeInfo.label}: ${count}</span>`; }).join('')}</div>` : ''}</div><div class="project-card-footer"><div class="card-actions"><button class="btn btn-accent btn-sm" onclick="ProductManager.showDetail('${prod.id}')" title="نمایش جزئیات">️ جزئیات</button></div><button class="btn btn-danger btn-icon" onclick="ProductManager.removeProduct('${prod.id}')" title="حذف">️</button></div></div>`;
|
||
});
|
||
html += '</div>';
|
||
}
|
||
html += `</div>`;
|
||
|
||
board.innerHTML = html;
|
||
}
|
||
};
|
||
|
||
const ActionRegistry = {
|
||
openProductSettings() { openSettingsModal(); },
|
||
manageEnvironments() { EnvironmentManager.render(); ModalManager.open('envManagerModal'); },
|
||
manageProducts() { BoardRenderer.render(); },
|
||
saveProduct() {
|
||
projectData.metadata.updatedAt = new Date().toISOString();
|
||
const jsonString = JSON.stringify(projectData.appData, null, 2);
|
||
const blob = new Blob([jsonString], { type: 'application/json;charset=utf-8' });
|
||
const url = URL.createObjectURL(blob);
|
||
const a = document.createElement('a');
|
||
a.href = url;
|
||
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
|
||
a.download = `${projectData.projectName}_v${projectData.version}_${timestamp}.json`;
|
||
document.body.appendChild(a); a.click(); document.body.removeChild(a);
|
||
URL.revokeObjectURL(url);
|
||
showToast(`💾 دادههای محصول دانلود شد`, 'success', 4000);
|
||
WebhookManager.sendEvent('product_saved', { fileName: a.download });
|
||
},
|
||
loadProduct() {
|
||
const input = document.createElement('input');
|
||
input.type = 'file'; input.accept = '.json,application/json';
|
||
input.addEventListener('change', (e) => {
|
||
const file = e.target.files[0];
|
||
if (!file) return;
|
||
const reader = new FileReader();
|
||
reader.onload = (ev) => {
|
||
try {
|
||
const loaded = JSON.parse(ev.target.result);
|
||
if (!validateAppDataStructure(loaded)) return showToast('❌ ساختار فایل نامعتبر است', 'error', 5000);
|
||
projectData.appData = loaded;
|
||
projectData.metadata.updatedAt = new Date().toISOString();
|
||
updateProductUI();
|
||
renderToolGroups();
|
||
WebhookManager.updateStatusUI();
|
||
ToolbarManager.populateEnvironmentFilter();
|
||
ToolbarManager.updateStats();
|
||
BoardRenderer.render();
|
||
showToast(`📂 محصول بارگذاری شد`, 'success', 4000);
|
||
WebhookManager.sendEvent('product_loaded', { fileName: file.name });
|
||
} catch (err) { showToast('❌ خطا در خواندن فایل: ' + err.message, 'error', 5000); }
|
||
};
|
||
reader.readAsText(file);
|
||
});
|
||
input.click();
|
||
},
|
||
createProduct() { ProductManager.openAddProductModal(); },
|
||
editProduct() { showToast('محصولی را از کارت انتخاب کنید', 'info', 3000); },
|
||
viewReports() {
|
||
const p = projectData.appData.products.length;
|
||
const s = projectData.appData.products.reduce((x, p) => x + p.projects.length, 0);
|
||
const e = projectData.appData.environments.length;
|
||
showToast(`📊 محصولات: ${p} | پروژهها: ${s} | محیطها: ${e}`, 'info', 5000);
|
||
},
|
||
showDependencyGraph() { showToast(`🕸️ نمودار وابستگی...`, 'info', 3000); },
|
||
showGalaxyGraph() { GalaxyGraphManager.show(); },
|
||
defaultAction(tool) { showToast(`ابزار: ${tool.title}`, 'info', 3000); }
|
||
};
|
||
|
||
function showToast(message, type = 'info', duration = 3000) {
|
||
const container = document.getElementById('toastContainer');
|
||
const toast = document.createElement('div');
|
||
toast.className = `toast ${type}`;
|
||
const icons = { success: '✅', error: '❌', warning: '⚠️', info: '️' };
|
||
toast.innerHTML = `<span>${icons[type] || 'ℹ️'}</span><span>${message}</span>`;
|
||
container.appendChild(toast);
|
||
setTimeout(() => {
|
||
toast.style.transition = 'opacity 0.3s, transform 0.3s';
|
||
toast.style.opacity = '0';
|
||
toast.style.transform = 'translateX(-30px)';
|
||
setTimeout(() => toast.remove(), 300);
|
||
}, duration);
|
||
}
|
||
|
||
const WebhookManager = {
|
||
getConfig() { return projectData.webhook; },
|
||
setConfig(config) { projectData.webhook = { ...projectData.webhook, ...config }; this.updateStatusUI(); },
|
||
isValid() { const cfg = this.getConfig(); if (!cfg.enabled || !cfg.url || !cfg.clientId) return false; return /^https?:\/\//i.test(cfg.url); },
|
||
updateStatusUI() {
|
||
const cfg = this.getConfig();
|
||
const dot = document.getElementById('webhookStatusDot');
|
||
const text = document.getElementById('webhookStatusText');
|
||
if (!dot || !text) return;
|
||
dot.className = 'webhook-status-dot';
|
||
if (!cfg.enabled) { text.textContent = 'وضعیت: غیرفعال'; }
|
||
else if (!cfg.url || !cfg.clientId) { dot.classList.add('pending'); text.textContent = 'وضعیت: تنظیمات ناقص'; }
|
||
else if (!/^https?:\/\//i.test(cfg.url)) { dot.classList.add('error'); text.textContent = 'وضعیت: آدرس نامعتبر'; }
|
||
else { dot.classList.add('success'); text.textContent = 'وضعیت: آماده ارسال'; }
|
||
},
|
||
async sendEvent(eventName, payload = {}) {
|
||
if (!this.isValid()) return { success: false, reason: 'invalid_config' };
|
||
const cfg = this.getConfig();
|
||
try {
|
||
const response = await fetch(cfg.url, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Client-Id': cfg.clientId, 'X-Event-Name': eventName }, body: JSON.stringify({ event: eventName, timestamp: new Date().toISOString(), projectId: projectData.projectId, data: payload }) });
|
||
return { success: response.ok, status: response.status };
|
||
} catch (err) { console.error('[Webhook] خطا:', err); return { success: false, reason: 'network_error' }; }
|
||
}
|
||
};
|
||
|
||
const EnvironmentManager = {
|
||
currentEditEnvId: null,
|
||
render() {
|
||
const container = document.getElementById('environmentsList');
|
||
const envs = projectData.appData.environments;
|
||
if (envs.length === 0) {
|
||
container.innerHTML = '<div style="text-align:center; color: var(--text-muted); padding: 30px;">هیچ محیطی تعریف نشده است.</div>';
|
||
return;
|
||
}
|
||
container.innerHTML = envs.map(env => `
|
||
<div class="env-card">
|
||
<div style="flex: 1;">
|
||
<strong style="font-size: 14px;">🌐 ${env.name}</strong>
|
||
<small style="color: var(--text-muted); margin-right: 8px;">(${env.id})</small>
|
||
<div style="font-size: 12px; color: var(--text-light); margin-top: 4px;">${env.description}</div>
|
||
</div>
|
||
<div style="display: flex; gap: 4px;">
|
||
<button class="btn btn-ghost btn-sm" onclick="EnvironmentManager.openEditModal('${env.id}')" title="ویرایش">✏️</button>
|
||
<button class="btn btn-danger btn-sm" onclick="EnvironmentManager.remove('${env.id}')" title="حذف">🗑️</button>
|
||
</div>
|
||
</div>
|
||
`).join('');
|
||
},
|
||
add() {
|
||
const name = document.getElementById('newEnvName').value.trim();
|
||
const desc = document.getElementById('newEnvDesc').value.trim();
|
||
if (!name) return showToast('نام محیط الزامی است', 'error');
|
||
if (projectData.appData.environments.some(e => e.name.toLowerCase() === name.toLowerCase())) {
|
||
return showToast('محیطی با این نام وجود دارد', 'warning');
|
||
}
|
||
projectData.appData.environments.push({ id: `env-${Date.now()}`, name, description: desc || 'بدون توضیحات' });
|
||
document.getElementById('newEnvName').value = '';
|
||
document.getElementById('newEnvDesc').value = '';
|
||
this.render();
|
||
ToolbarManager.populateEnvironmentFilter();
|
||
ToolbarManager.updateStats();
|
||
showToast(`محیط "${name}" اضافه شد`, 'success');
|
||
WebhookManager.sendEvent('environment_added', { envName: name });
|
||
},
|
||
remove(id) {
|
||
const env = projectData.appData.environments.find(e => e.id === id);
|
||
if (!env) return;
|
||
if (!confirm(`حذف محیط "${env.name}"؟`)) return;
|
||
projectData.appData.environments = projectData.appData.environments.filter(e => e.id !== id);
|
||
this.render();
|
||
ToolbarManager.populateEnvironmentFilter();
|
||
ToolbarManager.updateStats();
|
||
showToast(`محیط "${env.name}" حذف شد`, 'warning');
|
||
WebhookManager.sendEvent('environment_removed', { envId: id });
|
||
},
|
||
openEditModal(envId) {
|
||
const env = projectData.appData.environments.find(e => e.id === envId);
|
||
if (!env) return;
|
||
this.currentEditEnvId = envId;
|
||
document.getElementById('editEnvId').value = env.id;
|
||
document.getElementById('editEnvName').value = env.name;
|
||
document.getElementById('editEnvDesc').value = env.description || '';
|
||
ModalManager.open('envEditModal');
|
||
},
|
||
saveEdit() {
|
||
const envId = this.currentEditEnvId;
|
||
if (!envId) return;
|
||
const env = projectData.appData.environments.find(e => e.id === envId);
|
||
if (!env) return;
|
||
const newName = document.getElementById('editEnvName').value.trim();
|
||
const newDesc = document.getElementById('editEnvDesc').value.trim();
|
||
if (!newName) return showToast('نام محیط الزامی است', 'error');
|
||
env.name = newName;
|
||
env.description = newDesc;
|
||
ModalManager.close('envEditModal');
|
||
this.render();
|
||
showToast(`محیط "${env.name}" ویرایش شد`, 'success');
|
||
}
|
||
};
|
||
|
||
const ProductManager = {
|
||
currentDetailProductId: null,
|
||
currentEditProjectId: null,
|
||
currentDependencyProjectId: null,
|
||
currentDependencyProjId: null,
|
||
currentDeploymentProjId: null,
|
||
currentDeploymentMode: null,
|
||
currentDeploymentEnvId: null,
|
||
|
||
getTypeInfo(type) {
|
||
return VALID_PROJECT_TYPES.find(t => t.value === type) || { value: type, label: type, icon: '❓' };
|
||
},
|
||
getEnvironmentName(envId) {
|
||
const env = projectData.appData.environments.find(e => e.id === envId);
|
||
return env ? env.name : envId;
|
||
},
|
||
getEnvironmentColors(envId) {
|
||
const env = projectData.appData.environments.find(e => e.id === envId);
|
||
return { backgroundColor: env?.backgroundColor || '#38a169', textColor: env?.textColor || '#ffffff' };
|
||
},
|
||
getEmptyEnvironmentIds(proj) {
|
||
const allEnvIds = projectData.appData.environments.map(e => e.id);
|
||
const deployedEnvIds = (proj.lastDeployedVersions || []).map(d => d.environmentId);
|
||
return allEnvIds.filter(id => !deployedEnvIds.includes(id));
|
||
},
|
||
normalizeDependency(dep) {
|
||
if (typeof dep === 'string') return { projectId: dep, environmentId: null, version: null };
|
||
return dep;
|
||
},
|
||
showDetail(productId) {
|
||
const prod = projectData.appData.products.find(p => p.id === productId);
|
||
if (!prod) return;
|
||
this.currentDetailProductId = productId;
|
||
document.getElementById('projectDetailTitle').innerHTML = `<span>📦</span><span>${prod.title}</span>`;
|
||
const projects = prod.projects || [];
|
||
const totalDeploys = projects.reduce((sum, pr) => sum + (pr.lastDeployedVersions || []).length, 0);
|
||
let html = `<div class="detail-section"><div class="detail-section-header"><span>📋 اطلاعات محصول</span><div class="detail-section-header-actions"><button class="btn btn-accent btn-sm" onclick="ProductManager.openProductEditModal()" title="ویرایش اطلاعات محصول">✏️ ویرایش</button><span style="font-size: 11px; opacity: 0.8; display: none;">${prod.id}</span></div></div><div class="detail-section-body"><div class="detail-info-grid"><div class="detail-info-item"><span class="detail-info-label">عنوان</span><span class="detail-info-value">${prod.title}</span></div><div class="detail-info-item"><span class="detail-info-label">توضیحات</span><span class="detail-info-value">${prod.description || '—'}</span></div><div class="detail-info-item"><span class="detail-info-label">تاریخ ایجاد</span><span class="detail-info-value">${prod.metadata?.createdAt ? new Date(prod.metadata.createdAt).toLocaleDateString('fa-IR') : '—'}</span></div><div class="detail-info-item"><span class="detail-info-label">مالک</span><span class="detail-info-value">${prod.metadata?.owner || '—'}</span></div><div class="detail-info-item"><span class="detail-info-label">تعداد پروژه</span><span class="detail-info-value">${projects.length}</span></div><div class="detail-info-item"><span class="detail-info-label">استقرارها</span><span class="detail-info-value">${totalDeploys}</span></div></div></div></div><div class="detail-section"><div class="detail-section-header"><span>🌿 پروژهها (${projects.length})</span><div class="detail-section-header-actions"><button class="btn btn-accent btn-sm" onclick="ProductManager.openAddProjectModal()" title="افزودن پروژه جدید">➕ افزودن</button></div></div><div class="detail-section-body">`;
|
||
if (projects.length === 0) {
|
||
html += '<div class="empty-subprojects">🌿 هیچ پروژهای تعریف نشده است</div>';
|
||
} else {
|
||
html += '<div class="subproject-list">';
|
||
projects.forEach(pr => {
|
||
const typeInfo = this.getTypeInfo(pr.type);
|
||
const deps = pr.dependencies || [];
|
||
const deploys = pr.lastDeployedVersions || [];
|
||
const emptyEnvIds = this.getEmptyEnvironmentIds(pr);
|
||
const canAddDeployment = emptyEnvIds.length > 0;
|
||
html += `<div class="subproject-card"><div class="subproject-header"><div class="subproject-title"><span>${typeInfo.icon}</span><span>${pr.title}</span><span class="type-badge type-${pr.type}">${typeInfo.label}</span></div><div class="subproject-actions"><button class="btn btn-ghost btn-sm" onclick="ProductManager.openProjectEditModal('${prod.id}', '${pr.id}')" title="ویرایش">✏️</button><button class="btn btn-danger btn-sm" onclick="ProductManager.removeProject('${prod.id}', '${pr.id}')" title="حذف">🗑️</button></div></div><div class="subproject-meta">${pr.description || 'بدون توضیحات'}</div><div class="detail-info-grid" style="margin-bottom: 8px;">${pr.metadata?.framework ? `<div class="detail-info-item"><span class="detail-info-label">فریمورک</span><span class="detail-info-value">${pr.metadata.framework}</span></div>` : ''}${pr.metadata?.language ? `<div class="detail-info-item"><span class="detail-info-label">زبان</span><span class="detail-info-value">${pr.metadata.language}</span></div>` : ''}${deps.length > 0 ? `<div class="detail-info-item"><span class="detail-info-label">وابستگیها (${deps.length})</span><span class="detail-info-value">${deps.map(d => { const depPr = this.findProjectById(d); return depPr ? depPr.title : d; }).join('، ')}</span></div>` : ''}</div>`;
|
||
html += `<div class="deployment-section"><div class="deployment-header"><span class="deployment-header-title"> نسخههای استقرار (${deploys.length})</span>`;
|
||
if (canAddDeployment) {
|
||
html += `<button class="btn btn-accent btn-xs" onclick="ProductManager.openAddDeploymentModal('${prod.id}', '${pr.id}')" title="افزودن نسخه استقرار جدید">➕ افزودن</button>`;
|
||
} else {
|
||
html += `<span style="font-size: 10px; color: var(--text-muted); font-style: italic;" title="همه محیطها استقرار دارند">✓ کامل</span>`;
|
||
}
|
||
html += `</div>`;
|
||
if (deploys.length === 0) {
|
||
html += '<div class="empty-deployments">هنوز نسخهای استقرار نیافته است</div>';
|
||
} else {
|
||
html += '<div class="deployment-list">';
|
||
deploys.forEach(d => {
|
||
const envName = this.getEnvironmentName(d.environmentId);
|
||
const colors = this.getEnvironmentColors(d.environmentId);
|
||
const formattedDate = d.deploymentDate ? new Date(d.deploymentDate).toLocaleString('fa-IR') : '—';
|
||
html += `<div class="deployment-item"><div class="deployment-item-info"><span class="deployment-env-tag" style="background-color: ${colors.backgroundColor}; color: ${colors.textColor};">${envName}</span><span class="deployment-version">v${d.version}</span><span class="deployment-date">📅 ${formattedDate}</span></div><div class="deployment-actions"><button class="btn btn-ghost btn-xs" onclick="ProductManager.openEditDeploymentModal('${prod.id}', '${pr.id}', '${d.environmentId}', '${d.version}', '${d.deploymentDate}')" title="ویرایش">✏️</button><button class="btn btn-danger btn-xs" onclick="ProductManager.removeDeployment('${prod.id}', '${pr.id}', '${d.environmentId}', '${d.version}')" title="حذف">🗑️</button></div></div>`;
|
||
});
|
||
html += '</div>';
|
||
}
|
||
html += `</div></div>`;
|
||
});
|
||
html += '</div>';
|
||
}
|
||
html += `</div></div>`;
|
||
document.getElementById('projectDetailBody').innerHTML = html;
|
||
ModalManager.open('projectDetailModal');
|
||
},
|
||
findProjectById(projectId) {
|
||
for (const prod of projectData.appData.products) {
|
||
const pr = prod.projects.find(p => p.id === projectId);
|
||
if (pr) return pr;
|
||
}
|
||
return null;
|
||
},
|
||
openAddProductModal() {
|
||
document.getElementById('newProductTitle').value = '';
|
||
document.getElementById('newProductDescription').value = '';
|
||
document.getElementById('newProductOwner').value = '';
|
||
document.getElementById('newProductCreatedAt').value = new Date().toLocaleDateString('fa-IR');
|
||
ModalManager.open('addProductModal');
|
||
setTimeout(() => { document.getElementById('newProductTitle').focus(); }, 100);
|
||
},
|
||
saveNewProduct() {
|
||
const title = document.getElementById('newProductTitle').value.trim();
|
||
const description = document.getElementById('newProductDescription').value.trim();
|
||
const owner = document.getElementById('newProductOwner').value.trim();
|
||
if (!title) {
|
||
document.getElementById('newProductTitleError').classList.add('visible');
|
||
return showToast('عنوان محصول الزامی است', 'error');
|
||
}
|
||
if (projectData.appData.products.some(p => p.title.toLowerCase() === title.toLowerCase())) {
|
||
return showToast('محصولی با این عنوان قبلاً ثبت شده است', 'warning');
|
||
}
|
||
projectData.appData.products.push({
|
||
id: `prod-${Date.now()}`, title, description: description || 'بدون توضیحات',
|
||
metadata: { createdAt: new Date().toISOString(), owner: owner || '', customFields: {} },
|
||
projects: []
|
||
});
|
||
ModalManager.close('addProductModal');
|
||
ToolbarManager.updateStats();
|
||
BoardRenderer.render();
|
||
showToast(`محصول "${title}" با موفقیت ایجاد شد`, 'success');
|
||
},
|
||
openProjectEditModal(productId, projId) {
|
||
const prod = projectData.appData.products.find(p => p.id === productId);
|
||
if (!prod) return;
|
||
const pr = prod.projects.find(p => p.id === projId);
|
||
if (!pr) return;
|
||
this.currentEditProjectId = projId;
|
||
populateProjectTypeDropdowns();
|
||
document.getElementById('editProjId').value = pr.id;
|
||
document.getElementById('editProjTitle').value = pr.title;
|
||
document.getElementById('editProjType').value = pr.type;
|
||
document.getElementById('editProjFramework').value = pr.metadata?.framework || '';
|
||
document.getElementById('editProjLanguage').value = pr.metadata?.language || '';
|
||
document.getElementById('editProjRepo').value = pr.repositoryUrl || '';
|
||
document.getElementById('editProjDescription').value = pr.description || '';
|
||
ModalManager.open('editProjectModal');
|
||
},
|
||
saveProjectEdit() {
|
||
const productId = this.currentDetailProductId;
|
||
const projId = this.currentEditProjectId;
|
||
if (!productId || !projId) return;
|
||
const prod = projectData.appData.products.find(p => p.id === productId);
|
||
if (!prod) return;
|
||
const pr = prod.projects.find(p => p.id === projId);
|
||
if (!pr) return;
|
||
const newTitle = document.getElementById('editProjTitle').value.trim();
|
||
const newType = document.getElementById('editProjType').value;
|
||
const newFramework = document.getElementById('editProjFramework').value.trim();
|
||
const newLanguage = document.getElementById('editProjLanguage').value.trim();
|
||
const newRepo = document.getElementById('editProjRepo').value.trim();
|
||
const newDesc = document.getElementById('editProjDescription').value.trim();
|
||
if (!newTitle) return showToast('عنوان پروژه الزامی است', 'error');
|
||
if (!newType) return showToast('نوع پروژه الزامی است', 'error');
|
||
pr.title = newTitle;
|
||
pr.type = newType;
|
||
pr.description = newDesc || 'توضیحات پیشفرض';
|
||
pr.repositoryUrl = newRepo;
|
||
if (!pr.metadata) pr.metadata = {};
|
||
if (newFramework) pr.metadata.framework = newFramework; else delete pr.metadata.framework;
|
||
if (newLanguage) pr.metadata.language = newLanguage; else delete pr.metadata.language;
|
||
ModalManager.close('editProjectModal');
|
||
ToolbarManager.updateStats();
|
||
this.showDetail(productId);
|
||
showToast(`پروژه "${pr.title}" با موفقیت ویرایش شد`, 'success');
|
||
},
|
||
openAddDeploymentModal(productId, projId) {
|
||
if (!productId || !projId) return;
|
||
const prod = projectData.appData.products.find(p => p.id === productId);
|
||
if (!prod) return;
|
||
const pr = prod.projects.find(p => p.id === projId);
|
||
if (!pr) return;
|
||
const emptyEnvIds = this.getEmptyEnvironmentIds(pr);
|
||
if (emptyEnvIds.length === 0) return showToast('همه محیطها دارای نسخه استقرار هستند', 'warning');
|
||
this.currentDeploymentProjId = projId;
|
||
this.currentDeploymentMode = 'add';
|
||
this.currentDeploymentEnvId = null;
|
||
document.getElementById('deploymentModalTitle').innerHTML = '<span>🚀</span><span>افزودن نسخه استقرار</span>';
|
||
const envGroup = document.getElementById('deploymentEnvGroup');
|
||
const envs = projectData.appData.environments.filter(e => emptyEnvIds.includes(e.id));
|
||
envGroup.innerHTML = `<label class="form-label">محیط استقرار <span class="required">*</span></label><select class="form-select" id="depEnvironment"><option value="">انتخاب محیط...</option>${envs.map(e => `<option value="${e.id}">${e.name}</option>`).join('')}</select>`;
|
||
document.getElementById('depVersion').value = '';
|
||
document.getElementById('depDate').value = '';
|
||
ModalManager.open('deploymentModal');
|
||
},
|
||
openEditDeploymentModal(productId, projId, envId, version, date) {
|
||
if (!productId || !projId) return;
|
||
const prod = projectData.appData.products.find(p => p.id === productId);
|
||
if (!prod) return;
|
||
const pr = prod.projects.find(p => p.id === projId);
|
||
if (!pr) return;
|
||
this.currentDeploymentProjId = projId;
|
||
this.currentDeploymentMode = 'edit';
|
||
this.currentDeploymentEnvId = envId;
|
||
document.getElementById('deploymentModalTitle').innerHTML = '<span>✏️</span><span>ویرایش نسخه استقرار</span>';
|
||
const env = projectData.appData.environments.find(e => e.id === envId);
|
||
const envName = env ? env.name : envId;
|
||
const envGroup = document.getElementById('deploymentEnvGroup');
|
||
envGroup.innerHTML = `<label class="form-label">محیط استقرار <span class="readonly-badge">فقط خواندنی</span></label><div style="padding: 9px 12px; background: var(--border-light); border-radius: var(--radius-sm);">${envName}</div>`;
|
||
document.getElementById('depVersion').value = version;
|
||
let dateValue = '';
|
||
if (date) {
|
||
const d = new Date(date);
|
||
const pad = (n) => n.toString().padStart(2, '0');
|
||
dateValue = `${d.getFullYear()}-${pad(d.getMonth()+1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`;
|
||
}
|
||
document.getElementById('depDate').value = dateValue;
|
||
ModalManager.open('deploymentModal');
|
||
},
|
||
saveDeployment() {
|
||
const productId = this.currentDetailProductId;
|
||
const projId = this.currentDeploymentProjId;
|
||
const mode = this.currentDeploymentMode;
|
||
if (!productId || !projId) return showToast('خطا: محصول یا پروژه مشخص نشده است', 'error');
|
||
const prod = projectData.appData.products.find(p => p.id === productId);
|
||
if (!prod) return showToast('خطا: محصول یافت نشد', 'error');
|
||
const pr = prod.projects.find(p => p.id === projId);
|
||
if (!pr) return showToast('خطا: پروژه یافت نشد', 'error');
|
||
const version = document.getElementById('depVersion').value.trim();
|
||
const date = document.getElementById('depDate').value;
|
||
if (!version) return showToast('نسخه الزامی است', 'error');
|
||
if (!date) return showToast('تاریخ استقرار الزامی است', 'error');
|
||
const deploymentDate = new Date(date).toISOString();
|
||
if (!pr.lastDeployedVersions) pr.lastDeployedVersions = [];
|
||
if (mode === 'add') {
|
||
const envId = document.getElementById('depEnvironment').value;
|
||
if (!envId) return showToast('انتخاب محیط الزامی است', 'error');
|
||
const existingIndex = pr.lastDeployedVersions.findIndex(d => d.environmentId === envId);
|
||
if (existingIndex >= 0) {
|
||
pr.lastDeployedVersions[existingIndex] = { environmentId: envId, version, deploymentDate };
|
||
showToast(`نسخه استقرار در ${this.getEnvironmentName(envId)} بهروز شد`, 'success');
|
||
} else {
|
||
pr.lastDeployedVersions.push({ environmentId: envId, version, deploymentDate });
|
||
showToast(`نسخه v${version} در ${this.getEnvironmentName(envId)} استقرار یافت`, 'success');
|
||
}
|
||
} else if (mode === 'edit') {
|
||
const envId = this.currentDeploymentEnvId;
|
||
if (!envId) return showToast('خطا: محیط استقرار مشخص نشده است', 'error');
|
||
const currentIndex = pr.lastDeployedVersions.findIndex(d => d.environmentId === envId);
|
||
if (currentIndex >= 0) {
|
||
pr.lastDeployedVersions[currentIndex] = { environmentId: envId, version, deploymentDate };
|
||
showToast(`نسخه استقرار در ${this.getEnvironmentName(envId)} بهروز شد`, 'success');
|
||
}
|
||
}
|
||
ModalManager.close('deploymentModal');
|
||
ToolbarManager.updateStats();
|
||
this.showDetail(productId);
|
||
},
|
||
removeDeployment(productId, projId, envId, version) {
|
||
if (!confirm(`حذف نسخه استقرار v${version} از ${this.getEnvironmentName(envId)}؟`)) return;
|
||
const prod = projectData.appData.products.find(p => p.id === productId);
|
||
if (!prod) return;
|
||
const pr = prod.projects.find(p => p.id === projId);
|
||
if (!pr) return;
|
||
if (!pr.lastDeployedVersions) pr.lastDeployedVersions = [];
|
||
pr.lastDeployedVersions = pr.lastDeployedVersions.filter(d => !(d.environmentId === envId && d.version === version));
|
||
ToolbarManager.updateStats();
|
||
this.showDetail(productId);
|
||
showToast(`نسخه استقرار v${version} حذف شد`, 'warning');
|
||
},
|
||
removeProduct(productId) {
|
||
const prod = projectData.appData.products.find(p => p.id === productId);
|
||
if (!prod) return;
|
||
if (!confirm(`حذف محصول "${prod.title}" و تمام پروژههای آن؟`)) return;
|
||
projectData.appData.products = projectData.appData.products.filter(p => p.id !== productId);
|
||
ToolbarManager.updateStats();
|
||
BoardRenderer.render();
|
||
ModalManager.close('projectDetailModal');
|
||
showToast(`محصول "${prod.title}" حذف شد`, 'warning');
|
||
},
|
||
removeProject(productId, projId) {
|
||
const prod = projectData.appData.products.find(p => p.id === productId);
|
||
if (!prod) return;
|
||
const pr = prod.projects.find(p => p.id === projId);
|
||
if (!pr) return;
|
||
if (!confirm(`حذف پروژه "${pr.title}"؟`)) return;
|
||
prod.projects = prod.projects.filter(p => p.id !== projId);
|
||
ToolbarManager.updateStats();
|
||
if (this.currentDetailProductId === productId) this.showDetail(productId);
|
||
showToast(`پروژه "${pr.title}" حذف شد`, 'warning');
|
||
}
|
||
};
|
||
|
||
// Galaxy Graph Manager
|
||
const GalaxyGraphManager = {
|
||
simulation: null,
|
||
animationRunning: true,
|
||
|
||
show() {
|
||
ModalManager.open('galaxyGraphModal');
|
||
setTimeout(() => this.render(), 100);
|
||
},
|
||
|
||
render() {
|
||
const container = document.getElementById('galaxyContainer');
|
||
const width = container.clientWidth;
|
||
const height = container.clientHeight;
|
||
|
||
// Remove existing SVG
|
||
d3.select('#galaxyContainer svg').remove();
|
||
|
||
const svg = d3.select('#galaxyContainer')
|
||
.append('svg')
|
||
.attr('width', width)
|
||
.attr('height', height)
|
||
.attr('viewBox', [0, 0, width, height]);
|
||
|
||
// Create tooltip
|
||
const tooltip = d3.select('#galaxyContainer')
|
||
.append('div')
|
||
.attr('class', 'galaxy-tooltip');
|
||
|
||
// Prepare data
|
||
const nodes = [];
|
||
const links = [];
|
||
const nodeMap = new Map();
|
||
|
||
// Add product nodes (larger, central)
|
||
projectData.appData.products.forEach((product, idx) => {
|
||
const angle = (idx / projectData.appData.products.length) * 2 * Math.PI;
|
||
const radius = Math.min(width, height) * 0.3;
|
||
|
||
nodes.push({
|
||
id: product.id,
|
||
name: product.title,
|
||
type: 'product',
|
||
description: product.description,
|
||
projectCount: (product.projects || []).length,
|
||
x: width/2 + Math.cos(angle) * radius,
|
||
y: height/2 + Math.sin(angle) * radius,
|
||
radius: 30
|
||
});
|
||
nodeMap.set(product.id, nodes[nodes.length - 1]);
|
||
});
|
||
|
||
// Add project nodes (smaller, orbiting)
|
||
projectData.appData.products.forEach(product => {
|
||
(product.projects || []).forEach((project, idx) => {
|
||
const parentNode = nodeMap.get(product.id);
|
||
const angle = (idx / (product.projects || []).length) * 2 * Math.PI;
|
||
const radius = 120;
|
||
|
||
nodes.push({
|
||
id: project.id,
|
||
name: project.title,
|
||
type: project.type,
|
||
description: project.description,
|
||
framework: project.metadata?.framework,
|
||
language: project.metadata?.language,
|
||
dependencies: (project.dependencies || []).length,
|
||
x: parentNode.x + Math.cos(angle) * radius,
|
||
y: parentNode.y + Math.sin(angle) * radius,
|
||
radius: 15,
|
||
parentId: product.id
|
||
});
|
||
nodeMap.set(project.id, nodes[nodes.length - 1]);
|
||
});
|
||
});
|
||
|
||
// Add links (dependencies)
|
||
projectData.appData.products.forEach(product => {
|
||
(product.projects || []).forEach(project => {
|
||
(project.dependencies || []).forEach(depId => {
|
||
const targetNode = nodeMap.get(depId);
|
||
if (targetNode) {
|
||
links.push({
|
||
source: project.id,
|
||
target: depId,
|
||
type: 'dependency'
|
||
});
|
||
}
|
||
});
|
||
});
|
||
});
|
||
|
||
// Add links from projects to their parent products
|
||
projectData.appData.products.forEach(product => {
|
||
(product.projects || []).forEach(project => {
|
||
links.push({
|
||
source: project.id,
|
||
target: product.id,
|
||
type: 'parent'
|
||
});
|
||
});
|
||
});
|
||
|
||
// Create force simulation
|
||
this.simulation = d3.forceSimulation(nodes)
|
||
.force('link', d3.forceLink(links).id(d => d.id).distance(d => d.type === 'parent' ? 100 : 200))
|
||
.force('charge', d3.forceManyBody().strength(-300))
|
||
.force('center', d3.forceCenter(width / 2, height / 2))
|
||
.force('collision', d3.forceCollide().radius(d => d.radius + 10));
|
||
|
||
// Draw links
|
||
const link = svg.append('g')
|
||
.attr('class', 'links')
|
||
.selectAll('line')
|
||
.data(links)
|
||
.join('line')
|
||
.attr('class', 'galaxy-link')
|
||
.attr('stroke', d => d.type === 'parent' ? '#c9a961' : '#3182ce')
|
||
.attr('stroke-width', d => d.type === 'parent' ? 1.5 : 1)
|
||
.attr('stroke-dasharray', d => d.type === 'parent' ? '5,5' : 'none');
|
||
|
||
// Draw nodes
|
||
const node = svg.append('g')
|
||
.attr('class', 'nodes')
|
||
.selectAll('circle')
|
||
.data(nodes)
|
||
.join('circle')
|
||
.attr('class', 'galaxy-node')
|
||
.attr('r', d => d.radius)
|
||
.attr('fill', d => {
|
||
if (d.type === 'product') return '#c9a961';
|
||
return TYPE_COLORS[d.type] || '#718096';
|
||
})
|
||
.attr('stroke', '#fff')
|
||
.attr('stroke-width', 2)
|
||
.call(d3.drag()
|
||
.on('start', (event, d) => {
|
||
if (!event.active) this.simulation.alphaTarget(0.3).restart();
|
||
d.fx = d.x;
|
||
d.fy = d.y;
|
||
})
|
||
.on('drag', (event, d) => {
|
||
d.fx = event.x;
|
||
d.fy = event.y;
|
||
})
|
||
.on('end', (event, d) => {
|
||
if (!event.active) this.simulation.alphaTarget(0);
|
||
d.fx = null;
|
||
d.fy = null;
|
||
}));
|
||
|
||
// Add labels
|
||
const labels = svg.append('g')
|
||
.attr('class', 'labels')
|
||
.selectAll('text')
|
||
.data(nodes)
|
||
.join('text')
|
||
.attr('text-anchor', 'middle')
|
||
.attr('dy', d => d.radius + 15)
|
||
.attr('fill', '#e0c789')
|
||
.attr('font-size', d => d.type === 'product' ? '12px' : '10px')
|
||
.text(d => d.name.length > 20 ? d.name.substring(0, 20) + '...' : d.name);
|
||
|
||
// Update positions on tick
|
||
this.simulation.on('tick', () => {
|
||
link
|
||
.attr('x1', d => d.source.x)
|
||
.attr('y1', d => d.source.y)
|
||
.attr('x2', d => d.target.x)
|
||
.attr('y2', d => d.target.y);
|
||
|
||
node
|
||
.attr('cx', d => d.x)
|
||
.attr('cy', d => d.y);
|
||
|
||
labels
|
||
.attr('x', d => d.x)
|
||
.attr('y', d => d.y);
|
||
});
|
||
|
||
// Tooltip interactions
|
||
node.on('mouseover', (event, d) => {
|
||
let html = `<strong>${d.name}</strong><br/>`;
|
||
if (d.type === 'product') {
|
||
html += `نوع: محصول<br/>تعداد پروژه: ${d.projectCount}`;
|
||
} else {
|
||
html += `نوع: ${d.type}<br/>فریمورک: ${d.framework || 'N/A'}<br/>زبان: ${d.language || 'N/A'}<br/>وابستگیها: ${d.dependencies}`;
|
||
}
|
||
tooltip.html(html)
|
||
.style('left', (event.pageX + 10) + 'px')
|
||
.style('top', (event.pageY - 28) + 'px')
|
||
.style('opacity', 1);
|
||
})
|
||
.on('mouseout', () => {
|
||
tooltip.style('opacity', 0);
|
||
});
|
||
|
||
// Create legend
|
||
this.createLegend();
|
||
},
|
||
|
||
createLegend() {
|
||
const legend = d3.select('#galaxyLegend');
|
||
legend.html('<div class="galaxy-legend-title">راهنما</div>');
|
||
|
||
const items = [
|
||
{ color: '#c9a961', label: 'محصول' },
|
||
{ color: '#3182ce', label: 'بکاند' },
|
||
{ color: '#38a169', label: 'فرانتاند' },
|
||
{ color: '#dd6b20', label: 'میکروسرویس' },
|
||
{ color: '#97266d', label: 'پایگاه داده' },
|
||
{ color: '#553c9a', label: 'موبایل' },
|
||
{ color: '#9c4221', label: 'زیرساخت' }
|
||
];
|
||
|
||
items.forEach(item => {
|
||
legend.append('div')
|
||
.attr('class', 'galaxy-legend-item')
|
||
.html(`<div class="galaxy-legend-color" style="background: ${item.color};"></div><span>${item.label}</span>`);
|
||
});
|
||
},
|
||
|
||
toggleAnimation() {
|
||
if (this.animationRunning) {
|
||
this.simulation.stop();
|
||
this.animationRunning = false;
|
||
} else {
|
||
this.simulation.restart();
|
||
this.animationRunning = true;
|
||
}
|
||
}
|
||
};
|
||
|
||
function resetGalaxyZoom() {
|
||
GalaxyGraphManager.render();
|
||
}
|
||
|
||
function toggleGalaxyAnimation() {
|
||
GalaxyGraphManager.toggleAnimation();
|
||
}
|
||
|
||
document.getElementById('projectDetailDeleteBtn').addEventListener('click', () => {
|
||
if (ProductManager.currentDetailProductId) ProductManager.removeProduct(ProductManager.currentDetailProductId);
|
||
});
|
||
document.getElementById('saveProductEditBtn').addEventListener('click', () => ProductManager.saveProductEdit());
|
||
document.getElementById('saveNewProjectBtn').addEventListener('click', () => ProductManager.saveNewProduct());
|
||
document.getElementById('saveProjEditBtn').addEventListener('click', () => ProductManager.saveProjectEdit());
|
||
document.getElementById('saveDeploymentBtn').addEventListener('click', () => ProductManager.saveDeployment());
|
||
document.getElementById('saveEnvEditBtn').addEventListener('click', () => EnvironmentManager.saveEdit());
|
||
|
||
function handleToolSelect(tool, group) {
|
||
const actionHandler = ActionRegistry[tool.action] || ActionRegistry.defaultAction;
|
||
actionHandler(tool, group);
|
||
WebhookManager.sendEvent('tool_selected', { toolId: tool.id, toolTitle: tool.title, toolAction: tool.action, groupId: group.id });
|
||
}
|
||
|
||
const themeToggle = document.getElementById('themeToggle');
|
||
const themeIcon = document.getElementById('themeIcon');
|
||
const htmlEl = document.documentElement;
|
||
const savedTheme = localStorage.getItem('theme') || 'light';
|
||
htmlEl.setAttribute('data-theme', savedTheme);
|
||
if (themeIcon) themeIcon.textContent = savedTheme === 'dark' ? '☀️' : '🌙';
|
||
if (themeToggle) {
|
||
themeToggle.addEventListener('click', () => {
|
||
const current = htmlEl.getAttribute('data-theme');
|
||
const next = current === 'dark' ? 'light' : 'dark';
|
||
htmlEl.setAttribute('data-theme', next);
|
||
localStorage.setItem('theme', next);
|
||
if (themeIcon) themeIcon.textContent = next === 'dark' ? '☀️' : '🌙';
|
||
});
|
||
}
|
||
|
||
const sidebarToggle = document.getElementById('sidebarToggle');
|
||
const sidebar = document.getElementById('sidebar');
|
||
const sidebarIcon = document.getElementById('sidebarIcon');
|
||
function updateSidebarIcon() { if (!sidebarIcon) return; sidebarIcon.textContent = sidebar.classList.contains('collapsed') ? '☰' : '✕'; }
|
||
if (sidebarToggle) { sidebarToggle.addEventListener('click', () => { sidebar.classList.toggle('collapsed'); updateSidebarIcon(); }); }
|
||
updateSidebarIcon();
|
||
|
||
const sidebarBody = document.getElementById('sidebarBody');
|
||
function renderToolGroups() {
|
||
sidebarBody.innerHTML = '';
|
||
projectData.toolGroups.forEach(group => {
|
||
const groupEl = document.createElement('div');
|
||
groupEl.className = 'sidebar-group';
|
||
const headerEl = document.createElement('div');
|
||
headerEl.className = 'sidebar-group-header';
|
||
if (group.description) headerEl.setAttribute('data-tooltip', group.description);
|
||
headerEl.innerHTML = `<div class="group-icon"><span>${group.icon || ''}</span><span>${group.title}</span></div><span class="group-arrow">▼</span>`;
|
||
const bodyEl = document.createElement('div');
|
||
bodyEl.className = 'sidebar-group-body';
|
||
group.tools.forEach(tool => {
|
||
const btn = document.createElement('button');
|
||
btn.className = 'sidebar-btn';
|
||
btn.title = tool.description;
|
||
btn.innerHTML = `<span class="btn-icon-emoji">${tool.icon || '🔧'}</span><span class="btn-title">${tool.title}</span>`;
|
||
btn.addEventListener('click', () => handleToolSelect(tool, group));
|
||
bodyEl.appendChild(btn);
|
||
});
|
||
headerEl.addEventListener('click', () => groupEl.classList.toggle('collapsed'));
|
||
groupEl.appendChild(headerEl);
|
||
groupEl.appendChild(bodyEl);
|
||
sidebarBody.appendChild(groupEl);
|
||
});
|
||
}
|
||
|
||
function openSettingsModal() {
|
||
document.getElementById('settingProjectTitle').value = projectData.projectTitle;
|
||
document.getElementById('settingVersion').value = projectData.version;
|
||
document.getElementById('settingDescription').value = projectData.description;
|
||
document.getElementById('settingDeveloper').value = projectData.developer;
|
||
document.getElementById('settingCompany').value = projectData.company;
|
||
document.getElementById('settingWebhookUrl').value = projectData.webhook.url;
|
||
document.getElementById('settingWebhookClientId').value = projectData.webhook.clientId;
|
||
document.getElementById('settingWebhookEnabled').checked = projectData.webhook.enabled;
|
||
WebhookManager.updateStatusUI();
|
||
ModalManager.open('settingsModal');
|
||
}
|
||
|
||
['settingWebhookUrl', 'settingWebhookClientId', 'settingWebhookEnabled'].forEach(id => {
|
||
document.getElementById(id).addEventListener('input', () => {
|
||
WebhookManager.setConfig({ url: document.getElementById('settingWebhookUrl').value, clientId: document.getElementById('settingWebhookClientId').value, enabled: document.getElementById('settingWebhookEnabled').checked });
|
||
});
|
||
});
|
||
|
||
document.getElementById('saveSettingsBtn').addEventListener('click', () => {
|
||
WebhookManager.setConfig({ url: document.getElementById('settingWebhookUrl').value.trim(), clientId: document.getElementById('settingWebhookClientId').value.trim(), enabled: document.getElementById('settingWebhookEnabled').checked });
|
||
ModalManager.close('settingsModal');
|
||
showToast('تنظیمات ذخیره شد', 'success');
|
||
WebhookManager.sendEvent('settings_updated', { updatedFields: ['webhook'] });
|
||
});
|
||
|
||
function updateProductUI() {
|
||
document.title = projectData.projectTitle;
|
||
document.getElementById('headerTitle').textContent = projectData.projectTitle;
|
||
document.getElementById('headerSubtitle').textContent = projectData.description;
|
||
document.getElementById('appFooter').innerHTML = `<div><span class="footer-brand">طراح و توسعهدهنده:</span> ${projectData.developer}<span style="margin: 0 10px;">|</span><span class="footer-brand">شرکت:</span> ${projectData.company}</div><div><span class="footer-brand">نسخه:</span> ${projectData.version}</div>`;
|
||
}
|
||
|
||
document.addEventListener('keydown', (e) => {
|
||
if (!(e.ctrlKey || e.metaKey)) return;
|
||
const key = e.key.toLowerCase();
|
||
for (const group of projectData.toolGroups) {
|
||
const tool = group.tools.find(t => t.shortcut && t.shortcut.toLowerCase().replace('ctrl+', '') === key);
|
||
if (tool) { e.preventDefault(); handleToolSelect(tool, group); break; }
|
||
}
|
||
});
|
||
|
||
ModalManager.init();
|
||
renderToolGroups();
|
||
updateProductUI();
|
||
WebhookManager.updateStatusUI();
|
||
ToolbarManager.init();
|
||
BoardRenderer.render();
|
||
setTimeout(() => showToast(`${projectData.projectTitle} (نسخه ${projectData.version}) آماده است`, 'success'), 500);
|
||
</script>
|
||
</body>
|
||
</html> |