-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Status service and component to dashboard; adjust database connec…
…tion pool settings
- Loading branch information
1 parent
15d4f60
commit 2726233
Showing
11 changed files
with
187 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { Seat } from "../models/copilot.seats.model.js"; | ||
import { Survey } from "../models/survey.model.js"; | ||
import { Member } from "../models/teams.model.js"; | ||
|
||
export interface StatusType { | ||
github?: { | ||
isGood: boolean | ||
}; | ||
pollingHistory?: { | ||
isGood: boolean; | ||
message: string; | ||
value?: any; | ||
progress?: string; | ||
}; | ||
repos?: { | ||
value: number; | ||
}; | ||
surveys?: StatusType; | ||
} | ||
|
||
class StatusService { | ||
constructor() { | ||
|
||
} | ||
|
||
async getStatus(): Promise<StatusType> { | ||
const status = {} as StatusType; | ||
|
||
const assignee = await Member.findOne(); | ||
if (assignee) { | ||
const seats = await Seat.findAll({ | ||
include: [{ | ||
model: Member, | ||
as: 'assignee' | ||
}], | ||
where: { | ||
assignee_id: assignee.id | ||
}, | ||
order: [['createdAt', 'DESC']], | ||
}); | ||
const oldestSeat = seats.find(seat => seat.createdAt); | ||
const daysSince = oldestSeat ? Math.floor((new Date().getTime() - oldestSeat.createdAt.getTime()) / (1000 * 3600 * 24)) : undefined; | ||
status.pollingHistory = { | ||
isGood: true, | ||
message: `${oldestSeat?.createdAt}`, | ||
value: daysSince | ||
} | ||
} | ||
|
||
const surveys = await Survey.findAll({ | ||
order: [['updatedAt', 'DESC']] | ||
}); | ||
|
||
if (surveys) { | ||
// status.surveys = { | ||
// message: `${surveys.length} surveys created`, | ||
// value: surveys.length | ||
// } | ||
} | ||
|
||
return status; | ||
} | ||
} | ||
|
||
export default StatusService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@for (s of status; track $index) { | ||
<div class="status"> | ||
<div class="status-header"> | ||
<mat-card-title>{{s.title}}</mat-card-title> | ||
<mat-card-subtitle>{{s.statusMessage}}</mat-card-subtitle> | ||
</div> | ||
<span class="spacer"></span> | ||
<div class="status-icon"> | ||
<button mat-mini-fab [class]="1 ? 'success' : 'error'"> | ||
<mat-icon>checked</mat-icon> | ||
</button> | ||
</div> | ||
</div> | ||
} |
26 changes: 25 additions & 1 deletion
26
frontend/src/app/main/copilot/copilot-dashboard/status/status.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,27 @@ | ||
:host { | ||
display: block; | ||
display: grid; | ||
grid-template-columns: 1fr 1fr 1fr; | ||
} | ||
|
||
.status { | ||
display: flex; | ||
padding: 17.6px 20px 16px 20px; | ||
border: var(--mdc-outlined-card-outline-width) solid var(--mdc-outlined-card-outline-color, var(--mat-app-outline-variant)); | ||
.status-icon { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
} | ||
|
||
.error { | ||
background-color: var(--error) !important; | ||
} | ||
|
||
.success { | ||
background-color: var(--success) !important; | ||
} | ||
|
||
.warning { | ||
background-color: var(--warning) !important; | ||
} |
22 changes: 19 additions & 3 deletions
22
frontend/src/app/main/copilot/copilot-dashboard/status/status.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,27 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; | ||
import { MatButtonModule } from '@angular/material/button'; | ||
import { MatCardModule } from '@angular/material/card'; | ||
import { MatIconModule } from '@angular/material/icon'; | ||
|
||
@Component({ | ||
selector: 'app-status', | ||
standalone: true, | ||
imports: [], | ||
imports: [ | ||
MatCardModule, | ||
MatIconModule, | ||
MatButtonModule | ||
], | ||
templateUrl: './status.component.html', | ||
styleUrl: './status.component.scss', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class StatusComponent { } | ||
export class StatusComponent { | ||
@Input() status?: any[]; | ||
|
||
constructor() { | ||
} | ||
|
||
ngOnInit() { | ||
console.log(this.status); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters