feat: Runtime configuration and Docker deployment improvements

Frontend:
- Add runtime configuration service for deployment-time API URL injection
- Create docker-entrypoint.sh to generate config.json from environment variables
- Update ApiService, ApprovalService, and DocumentViewer to use RuntimeConfigService
- Add APP_INITIALIZER to load runtime config before app starts

Backend:
- Fix init-blockchain.js to properly quote mnemonic phrases in .env file
- Improve docker-entrypoint.sh with health checks and better error handling

Docker:
- Add API_BASE_URL environment variable to frontend container
- Update docker-compose.yml with clear documentation for remote deployment
- Reorganize .env.example with clear categories (REQUIRED FOR REMOTE, PRODUCTION, AUTO-GENERATED)

Workflow fixes:
- Fix DepartmentApproval interface to match backend schema
- Fix stage transformation for 0-indexed stageOrder
- Fix workflow list to show correct stage count from definition.stages

Cleanup:
- Move development artifacts to .trash directory
- Remove root-level package.json (was only for utility scripts)
- Add .trash/ to .gitignore
This commit is contained in:
Mahi
2026-02-08 18:44:05 -04:00
parent 2c10cd5662
commit d9de183e51
171 changed files with 10236 additions and 8386 deletions

View File

@@ -141,7 +141,7 @@ import { AdminStatsDto } from '../../../api/models';
</div>
<div class="card-content">
<div class="status-grid">
@for (item of stats()!.requestsByStatus; track item.status) {
@for (item of (stats()?.requestsByStatus || []); track item.status) {
<div class="status-item" [routerLink]="['/requests']" [queryParams]="{ status: item.status }">
<app-status-badge [status]="item.status" />
<span class="count">{{ item.count }}</span>
@@ -205,23 +205,13 @@ import { AdminStatsDto } from '../../../api/models';
/* Welcome Section */
.welcome-section {
background: linear-gradient(135deg, var(--dbim-blue-dark, #1D0A69) 0%, var(--dbim-blue-mid, #2563EB) 100%);
color: white;
background: linear-gradient(135deg, #1D0A69 0%, #2563EB 100%) !important;
color: white !important;
padding: 32px;
margin: -24px -24px 24px -24px;
margin: 0 0 24px 0;
border-radius: 16px;
position: relative;
overflow: hidden;
&::before {
content: '';
position: absolute;
top: -50%;
right: -10%;
width: 50%;
height: 200%;
background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
pointer-events: none;
}
}
.welcome-content {
@@ -233,32 +223,29 @@ import { AdminStatsDto } from '../../../api/models';
gap: 24px;
position: relative;
z-index: 1;
@media (max-width: 768px) {
flex-direction: column;
align-items: flex-start;
}
}
.welcome-text {
.greeting {
font-size: 0.9rem;
opacity: 0.8;
text-transform: uppercase;
letter-spacing: 1px;
}
.welcome-text .greeting {
font-size: 0.9rem;
opacity: 0.9;
text-transform: uppercase;
letter-spacing: 1px;
color: rgba(255, 255, 255, 0.9) !important;
display: block;
}
h1 {
margin: 8px 0;
font-size: 2rem;
font-weight: 700;
}
.welcome-text h1 {
margin: 8px 0;
font-size: 2rem;
font-weight: 700;
color: white !important;
}
.subtitle {
margin: 0;
opacity: 0.85;
font-size: 0.95rem;
}
.welcome-text .subtitle {
margin: 0;
opacity: 0.9;
font-size: 0.95rem;
color: rgba(255, 255, 255, 0.9) !important;
}
.quick-actions {
@@ -266,24 +253,22 @@ import { AdminStatsDto } from '../../../api/models';
gap: 12px;
}
.action-btn {
&.primary {
background: white;
color: var(--dbim-blue-dark, #1D0A69);
}
.action-btn.primary {
background: white !important;
color: #1D0A69 !important;
}
&:not(.primary) {
color: white;
border-color: rgba(255, 255, 255, 0.5);
.action-btn:not(.primary) {
color: white;
border-color: rgba(255, 255, 255, 0.5);
}
&:hover {
background: rgba(255, 255, 255, 0.1);
}
}
.action-btn:not(.primary):hover {
background: rgba(255, 255, 255, 0.1);
}
mat-icon {
margin-right: 8px;
}
.action-btn mat-icon {
margin-right: 8px;
}
.loading-container {
@@ -293,10 +278,10 @@ import { AdminStatsDto } from '../../../api/models';
justify-content: center;
padding: 64px;
gap: 16px;
}
p {
color: var(--dbim-grey-2, #8E8E8E);
}
.loading-container p {
color: #8E8E8E;
}
/* Stats Section */
@@ -320,54 +305,57 @@ import { AdminStatsDto } from '../../../api/models';
transition: all 0.3s ease;
position: relative;
overflow: hidden;
color: white;
background: white !important;
color: #150202;
border: 1px solid #EBEAEA;
}
&:hover {
transform: translateY(-4px);
box-shadow: var(--shadow-elevated, 0 8px 24px rgba(0, 0, 0, 0.15));
}
&.requests {
background: linear-gradient(135deg, var(--dbim-blue-dark, #1D0A69) 0%, var(--dbim-blue-mid, #2563EB) 100%);
}
&.approvals {
background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}
&.documents {
background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
}
&.departments {
background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
}
&.applicants {
background: linear-gradient(135deg, #0891b2 0%, #22d3ee 100%);
}
&.blockchain {
background: linear-gradient(135deg, #475569 0%, #64748b 100%);
}
.stat-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.stat-icon-wrapper {
width: 52px;
height: 52px;
border-radius: 14px;
background: rgba(255, 255, 255, 0.2);
width: 48px;
height: 48px;
border-radius: 12px;
background: rgba(29, 10, 105, 0.08);
display: flex;
align-items: center;
justify-content: center;
backdrop-filter: blur(10px);
flex-shrink: 0;
color: #1D0A69;
}
mat-icon {
font-size: 26px;
width: 26px;
height: 26px;
}
.stat-icon-wrapper mat-icon {
font-size: 24px;
width: 24px;
height: 24px;
}
.stat-card.approvals .stat-icon-wrapper {
background: rgba(5, 150, 105, 0.1);
color: #059669;
}
.stat-card.documents .stat-icon-wrapper {
background: rgba(245, 158, 11, 0.1);
color: #f59e0b;
}
.stat-card.departments .stat-icon-wrapper {
background: rgba(124, 58, 237, 0.1);
color: #7c3aed;
}
.stat-card.applicants .stat-icon-wrapper {
background: rgba(8, 145, 178, 0.1);
color: #0891b2;
}
.stat-card.blockchain .stat-icon-wrapper {
background: rgba(71, 85, 105, 0.1);
color: #475569;
}
.stat-content {
@@ -379,22 +367,17 @@ import { AdminStatsDto } from '../../../api/models';
font-size: 1.75rem;
font-weight: 700;
line-height: 1.2;
color: #150202;
}
.stat-label {
font-size: 0.8rem;
opacity: 0.9;
color: #8E8E8E;
margin-top: 4px;
}
.stat-decoration {
position: absolute;
top: -20px;
right: -20px;
width: 80px;
height: 80px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.1);
display: none;
}
/* Content Grid */
@@ -402,10 +385,6 @@ import { AdminStatsDto } from '../../../api/models';
display: grid;
grid-template-columns: 1fr 400px;
gap: 24px;
@media (max-width: 1200px) {
grid-template-columns: 1fr;
}
}
.content-main {
@@ -423,31 +402,31 @@ import { AdminStatsDto } from '../../../api/models';
justify-content: space-between;
align-items: center;
padding: 20px 24px;
border-bottom: 1px solid var(--dbim-linen, #EBEAEA);
border-bottom: 1px solid #EBEAEA;
}
.header-left {
display: flex;
align-items: center;
gap: 12px;
.card-header .header-left {
display: flex;
align-items: center;
gap: 12px;
}
mat-icon {
color: var(--dbim-blue-mid, #2563EB);
}
.card-header .header-left mat-icon {
color: #2563EB;
}
h2 {
margin: 0;
font-size: 1.1rem;
font-weight: 600;
color: var(--dbim-brown, #150202);
}
}
.card-header .header-left h2 {
margin: 0;
font-size: 1.1rem;
font-weight: 600;
color: #150202;
}
button mat-icon {
margin-left: 4px;
font-size: 18px;
width: 18px;
height: 18px;
}
.card-header button mat-icon {
margin-left: 4px;
font-size: 18px;
width: 18px;
height: 18px;
}
.card-content {
@@ -465,20 +444,20 @@ import { AdminStatsDto } from '../../../api/models';
justify-content: space-between;
align-items: center;
padding: 14px 16px;
background: var(--dbim-linen, #EBEAEA);
background: #F5F5F5;
border-radius: 10px;
cursor: pointer;
transition: all 0.2s;
}
&:hover {
background: rgba(0, 0, 0, 0.08);
}
.status-item:hover {
background: rgba(0, 0, 0, 0.08);
}
.count {
font-size: 1.25rem;
font-weight: 700;
color: var(--dbim-brown, #150202);
}
.status-item .count {
font-size: 1.25rem;
font-weight: 700;
color: #150202;
}
/* Quick Actions */
@@ -486,10 +465,6 @@ import { AdminStatsDto } from '../../../api/models';
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 16px;
@media (max-width: 768px) {
grid-template-columns: repeat(2, 1fr);
}
}
.action-item {
@@ -502,16 +477,16 @@ import { AdminStatsDto } from '../../../api/models';
cursor: pointer;
transition: all 0.2s;
text-align: center;
}
&:hover {
background: var(--dbim-linen, #EBEAEA);
}
.action-item:hover {
background: #F5F5F5;
}
span {
font-size: 0.85rem;
color: var(--dbim-brown, #150202);
font-weight: 500;
}
.action-item span {
font-size: 0.85rem;
color: #150202;
font-weight: 500;
}
.action-icon {
@@ -521,39 +496,57 @@ import { AdminStatsDto } from '../../../api/models';
display: flex;
align-items: center;
justify-content: center;
}
mat-icon {
font-size: 26px;
width: 26px;
height: 26px;
}
.action-icon mat-icon {
font-size: 26px;
width: 26px;
height: 26px;
}
&.departments {
background: linear-gradient(135deg, #7c3aed, #a78bfa);
color: white;
}
.action-icon.departments {
background: linear-gradient(135deg, #7c3aed, #a78bfa);
color: white;
}
&.workflows {
background: linear-gradient(135deg, var(--dbim-blue-dark, #1D0A69), var(--dbim-blue-mid, #2563EB));
color: white;
}
.action-icon.workflows {
background: linear-gradient(135deg, #1D0A69, #2563EB);
color: white;
}
&.audit {
background: linear-gradient(135deg, #f59e0b, #fbbf24);
color: white;
}
.action-icon.audit {
background: linear-gradient(135deg, #f59e0b, #fbbf24);
color: white;
}
&.webhooks {
background: linear-gradient(135deg, #059669, #10b981);
color: white;
}
.action-icon.webhooks {
background: linear-gradient(135deg, #059669, #10b981);
color: white;
}
.content-sidebar {
@media (max-width: 1200px) {
min-width: 0;
}
/* Responsive adjustments */
@media (max-width: 1200px) {
.content-grid {
grid-template-columns: 1fr;
}
.content-sidebar {
order: -1;
}
}
@media (max-width: 768px) {
.welcome-content {
flex-direction: column;
align-items: flex-start;
}
.actions-grid {
grid-template-columns: repeat(2, 1fr);
}
}
`],
})
export class AdminDashboardComponent implements OnInit {