ciyidogan commited on
Commit
9fa416c
Β·
verified Β·
1 Parent(s): b9c256e

Update flare-ui/src/app/components/projects/projects.component.html

Browse files
flare-ui/src/app/components/projects/projects.component.html CHANGED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="projects-container">
2
+ <div class="toolbar">
3
+ <h2>Projects</h2>
4
+ <div class="toolbar-actions">
5
+ <button class="btn btn-primary" (click)="createProject()">
6
+ New Project
7
+ </button>
8
+ <button class="btn btn-secondary" disabled>
9
+ Import Project
10
+ </button>
11
+ <input
12
+ type="text"
13
+ placeholder="Search projects..."
14
+ [(ngModel)]="searchTerm"
15
+ (input)="filterProjects()"
16
+ class="search-input"
17
+ >
18
+ <label class="checkbox-label">
19
+ <input
20
+ type="checkbox"
21
+ [(ngModel)]="showDeleted"
22
+ (change)="loadProjects()"
23
+ >
24
+ Display Deleted
25
+ </label>
26
+ <div class="view-toggle">
27
+ <button [class.active]="viewMode === 'card'" (click)="viewMode = 'card'">
28
+ Card
29
+ </button>
30
+ <button [class.active]="viewMode === 'list'" (click)="viewMode = 'list'">
31
+ List
32
+ </button>
33
+ </div>
34
+ </div>
35
+ </div>
36
+
37
+ @if (loading) {
38
+ <div class="loading">
39
+ <span class="spinner"></span> Loading projects...
40
+ </div>
41
+ } @else if (filteredProjects.length === 0) {
42
+ <div class="empty-state">
43
+ <p>No projects found.</p>
44
+ <button class="btn btn-primary" (click)="createProject()">
45
+ Create your first project
46
+ </button>
47
+ </div>
48
+ } @else {
49
+ @if (viewMode === 'card') {
50
+ <div class="project-cards">
51
+ @for (project of filteredProjects; track project.id) {
52
+ <div class="project-card" [class.disabled]="!project.enabled" [class.deleted]="project.deleted">
53
+ <div class="project-icon">πŸ›©οΈ</div>
54
+ <h3>{{ project.name }}</h3>
55
+ <p>{{ project.caption || 'No description' }}</p>
56
+ <div class="project-meta">
57
+ <span>Versions: {{ project.versions.length || 0 }} ({{ getPublishedCount(project) }} published)</span>
58
+ <span>Status: {{ project.enabled ? 'βœ“ Enabled' : 'βœ— Disabled' }}</span>
59
+ <span>Last update: {{ getRelativeTime(project.last_update_date) }}</span>
60
+ </div>
61
+ <div class="project-actions">
62
+ <button class="btn btn-secondary" (click)="editProject(project)">Edit</button>
63
+ <button class="btn btn-secondary" (click)="manageVersions(project)">Versions</button>
64
+ <button class="btn btn-secondary" (click)="exportProject(project)">Export</button>
65
+ <button class="btn btn-secondary" (click)="toggleProject(project)">
66
+ {{ project.enabled ? 'Disable' : 'Enable' }}
67
+ </button>
68
+ </div>
69
+ </div>
70
+ }
71
+ </div>
72
+ } @else {
73
+ <table class="table">
74
+ <thead>
75
+ <tr>
76
+ <th>Name</th>
77
+ <th>Caption</th>
78
+ <th>Versions</th>
79
+ <th>Enabled</th>
80
+ <th>Deleted</th>
81
+ <th>Last Update</th>
82
+ <th>Actions</th>
83
+ </tr>
84
+ </thead>
85
+ <tbody>
86
+ @for (project of filteredProjects; track project.id) {
87
+ <tr [class.deleted]="project.deleted">
88
+ <td>{{ project.name }}</td>
89
+ <td>{{ project.caption || '-' }}</td>
90
+ <td>{{ project.versions.length || 0 }} ({{ getPublishedCount(project) }} published)</td>
91
+ <td>
92
+ @if (project.enabled) {
93
+ <span class="status-badge enabled">βœ“</span>
94
+ } @else {
95
+ <span class="status-badge">βœ—</span>
96
+ }
97
+ </td>
98
+ <td>
99
+ @if (project.deleted) {
100
+ <span class="status-badge deleted">βœ“</span>
101
+ } @else {
102
+ <span class="status-badge">βœ—</span>
103
+ }
104
+ </td>
105
+ <td>{{ getRelativeTime(project.last_update_date) }}</td>
106
+ <td class="actions">
107
+ <button class="action-btn" title="Edit" (click)="editProject(project)">πŸ–ŠοΈ</button>
108
+ <button class="action-btn" title="Versions" (click)="manageVersions(project)">πŸ“‹</button>
109
+ <button class="action-btn" title="Export" (click)="exportProject(project)">πŸ“€</button>
110
+ @if (!project.deleted) {
111
+ <button class="action-btn danger" title="Delete" (click)="deleteProject(project)">πŸ—‘οΈ</button>
112
+ }
113
+ </td>
114
+ </tr>
115
+ }
116
+ </tbody>
117
+ </table>
118
+ }
119
+ }
120
+
121
+ @if (message) {
122
+ <div class="alert" [class.alert-success]="!isError" [class.alert-danger]="isError">
123
+ {{ message }}
124
+ </div>
125
+ }
126
+ </div>