Skip to content

Commit c2d2889

Browse files
committed
Updated lora request feature to show pending loras, status of loras etc
1 parent 0cc4717 commit c2d2889

File tree

4 files changed

+327
-10
lines changed

4 files changed

+327
-10
lines changed

src/app/home/add-loras/add-loras.component.css

Lines changed: 141 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
display: flex;
4949
align-items: center;
5050
gap: 10px;
51+
flex-wrap: wrap;
5152
margin-bottom: 10px;
5253
/* Add spacing between header and body */
5354
}
@@ -62,6 +63,7 @@
6263
.lora-card-title {
6364
font-size: 1.1rem;
6465
font-weight: bold;
66+
flex: 1 1 auto;
6567
}
6668

6769
/* Body part with creator and stats */
@@ -111,14 +113,12 @@
111113

112114
/* Highlight the selected card */
113115
.lora-card.selected {
114-
background-color: #e0f7fa;
115-
/* Light blue highlight */
116116
border-color: #00796b;
117+
box-shadow: 0 0 0 2px rgba(0, 121, 107, 0.35);
117118
}
118119

119120
.lora-card:hover {
120-
background-color: #e0f7fa;
121-
/* Slight hover effect */
121+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
122122
}
123123

124124
.preview-image {
@@ -151,6 +151,142 @@
151151
bottom: 10px;
152152
}
153153

154+
/* Status highlighting */
155+
.lora-card.status-approved {
156+
border-color: #2e7d32;
157+
background-color: #e8f5e9;
158+
}
159+
160+
.lora-card.status-pending {
161+
border-color: #f9a825;
162+
background-color: #fff8e1;
163+
}
164+
165+
.lora-card.status-rejected {
166+
border-color: #ef9a9a;
167+
background-color: #ffebee;
168+
}
169+
170+
.status-pill {
171+
margin-left: auto;
172+
font-size: 0.75rem;
173+
padding: 2px 8px;
174+
border-radius: 999px;
175+
font-weight: 600;
176+
text-transform: uppercase;
177+
letter-spacing: 0.02em;
178+
}
179+
180+
.status-pill.status-approved {
181+
background-color: #2e7d32;
182+
color: #fff;
183+
}
184+
185+
.status-pill.status-pending {
186+
background-color: #f9a825;
187+
color: #fff;
188+
}
189+
190+
.status-pill.status-rejected {
191+
background-color: #ef5350;
192+
color: #fff;
193+
}
194+
195+
/* Pending requests section */
196+
.pending-requests {
197+
margin-top: 12px;
198+
padding: 12px;
199+
border-radius: 8px;
200+
border: 1px solid #f5d76e;
201+
background-color: #fffde7;
202+
}
203+
204+
.pending-toggle {
205+
margin-top: 12px;
206+
display: flex;
207+
align-items: center;
208+
gap: 8px;
209+
}
210+
211+
.pending-count {
212+
font-weight: 600;
213+
color: #7a6b24;
214+
}
215+
216+
.pending-toggle-btn {
217+
border-color: #f5d76e !important;
218+
color: #7a6b24 !important;
219+
}
220+
221+
.pending-toggle-btn:hover {
222+
background-color: #fff8d6 !important;
223+
}
224+
225+
.pending-header {
226+
display: flex;
227+
align-items: center;
228+
justify-content: space-between;
229+
margin-bottom: 8px;
230+
}
231+
232+
.pending-title {
233+
font-weight: 600;
234+
}
235+
236+
.pending-list {
237+
display: flex;
238+
flex-direction: column;
239+
gap: 8px;
240+
}
241+
242+
.pending-item {
243+
display: flex;
244+
align-items: center;
245+
justify-content: space-between;
246+
gap: 10px;
247+
padding: 8px 0;
248+
border-bottom: 1px dashed #f0e7b3;
249+
}
250+
251+
.pending-item:last-child {
252+
border-bottom: none;
253+
}
254+
255+
.pending-cancel-btn {
256+
width: 110px;
257+
justify-content: center;
258+
}
259+
260+
:host ::ng-deep .pending-cancel-btn.p-button {
261+
background-color: #e53935;
262+
border-color: #e53935;
263+
color: #fff;
264+
}
265+
266+
:host ::ng-deep .pending-cancel-btn.p-button:enabled:hover {
267+
background-color: #c62828;
268+
border-color: #c62828;
269+
}
270+
271+
.pending-cancel-btn .pi {
272+
margin-right: 6px;
273+
}
274+
275+
.pending-info {
276+
display: flex;
277+
flex-direction: column;
278+
gap: 2px;
279+
}
280+
281+
.pending-name {
282+
font-weight: 600;
283+
}
284+
285+
.pending-meta {
286+
font-size: 0.85rem;
287+
color: #666;
288+
}
289+
154290
@media screen and (max-width: 600px) {
155291
.p-field.mobile-results {
156292
padding: 10px;
@@ -165,4 +301,4 @@
165301
#search-options {
166302
font-size: 0.7rem;
167303
}
168-
}
304+
}

src/app/home/add-loras/add-loras.component.html

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,51 @@
6464
<p-progressSpinner *ngIf="isLoading" styleClass="ml-2" strokeWidth="4" animationDuration=".5s"></p-progressSpinner>
6565
</div>
6666

67+
<!-- User pending requests (hidden by default) -->
68+
<div *ngIf="userPendingSuggestions.length > 0" class="p-field pending-toggle">
69+
<button
70+
pButton
71+
type="button"
72+
[label]="showPendingRequests ? 'Hide my pending requests' : 'Show my pending requests'"
73+
[icon]="showPendingRequests ? 'pi pi-chevron-up' : 'pi pi-chevron-down'"
74+
class="p-button-outlined pending-toggle-btn"
75+
(click)="togglePendingRequests()"
76+
></button>
77+
<span class="pending-count">({{ userPendingSuggestions.length }})</span>
78+
<p-progressSpinner *ngIf="loadingStatuses" styleClass="ml-2" strokeWidth="3" animationDuration=".5s"></p-progressSpinner>
79+
</div>
80+
81+
<div *ngIf="userPendingSuggestions.length > 0 && showPendingRequests" class="p-field pending-requests">
82+
<div class="pending-header">
83+
<div class="pending-title">
84+
Your pending requests
85+
</div>
86+
</div>
87+
<div class="pending-list">
88+
<div *ngFor="let item of userPendingSuggestions" class="pending-item">
89+
<div class="pending-info">
90+
<div class="pending-name">{{ item.name }}</div>
91+
<div class="pending-meta">
92+
{{ item.version || 'Unknown version' }} • {{ item.base_model || 'Unknown base model' }}
93+
</div>
94+
</div>
95+
<button pButton type="button" label="Cancel" icon="pi pi-times" class="p-button-danger pending-cancel-btn" (click)="cancelSuggestion(item)"></button>
96+
</div>
97+
</div>
98+
</div>
99+
67100
<!-- Mobile View: Card layout for LoRA results -->
68101
<div *ngIf="!isLoading && searchResults && searchResults.length > 0" class="p-field mobile-results">
69-
<div *ngFor="let lora of searchResults" class="lora-card" [ngClass]="{'selected': lora === selectedLoRA}" (click)="selectLora(lora)">
102+
<div *ngFor="let lora of searchResults" class="lora-card"
103+
[ngClass]="[getLoraStatusClass(lora), lora === selectedLoRA ? 'selected' : '']"
104+
(click)="selectLora(lora)">
70105
<div class="lora-card-header">
71106
<!-- Image click triggers the image expansion dialog -->
72107
<img *ngIf="lora.images && lora.images.length > 0" [src]="lora.images[0].url" alt="LoRA Preview" class="preview-image" (click)="openImageDialog(lora.images[0].url)" />
73108
<div class="lora-card-title">{{ lora.name }}</div>
109+
<ng-container *ngIf="getLoraStatus(lora) as status">
110+
<span class="status-pill" [ngClass]="'status-' + status">{{ statusLabels[status] }}</span>
111+
</ng-container>
74112
</div>
75113
<div class="lora-card-body">
76114
<div class="lora-creator">

0 commit comments

Comments
 (0)