Skip to content
Merged

Dev #706

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions apps/server/clara-api/src/routes/core/health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { FastifyPluginAsync } from 'fastify';
import { pool } from '../../infra/db';

const route: FastifyPluginAsync = async (app) => {
// app.get('/health', async () => ({ ok: true, openai: app.hasOpenAI }));

app.get('/health', async (_req, reply) => {
const meta = await pool.query(`
select
Expand All @@ -13,14 +11,12 @@ const route: FastifyPluginAsync = async (app) => {
inet_server_port() as port,
version()
`);
const counts = await pool.query(`
select
(select count(*) from companies) as companies,
(select count(*) from contacts) as contacts,
(select count(*) from tasks) as tasks,
(select count(*) from activities)as activities
`);
return reply.send({ conn: meta.rows[0], counts: counts.rows[0] });

return reply.send({
ok: true,
openai: app.hasOpenAI,
conn: meta.rows[0],
});
});
};

Expand Down
1 change: 1 addition & 0 deletions docker/admin-api/Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ EXPOSE 9102

# Entry point waits for DB then runs the app
ENTRYPOINT ["./wait-for-postgres.sh", "postgres-service-prod", "dotnet", "/app/EDb.AdminApi.dll"]

2 changes: 0 additions & 2 deletions docker/clara-api/Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ WORKDIR /srv/app

# Use Nx-pruned artifacts
COPY dist/apps/server/clara-api/pnpm-lock.yaml ./pnpm-lock.yaml
COPY dist/apps/server/clara-api/workspace_modules ./workspace_modules
# IMPORTANT: use the generated dist package.json (has deps)
COPY dist/apps/server/clara-api/package.json ./package.json

Expand All @@ -17,7 +16,6 @@ WORKDIR /srv/app

COPY --from=deps /srv/app/node_modules ./node_modules
COPY dist/apps/server/clara-api/main.cjs ./main.cjs
COPY dist/apps/server/clara-api/package.json ./package.json

ENV PORT=9101
CMD ["main.cjs"]
2 changes: 0 additions & 2 deletions docker/clara-api/Dockerfile.staging
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ WORKDIR /srv/app

# Use Nx-pruned artifacts
COPY dist/apps/server/clara-api/pnpm-lock.yaml ./pnpm-lock.yaml
COPY dist/apps/server/clara-api/workspace_modules ./workspace_modules
# IMPORTANT: use the generated dist package.json (has deps)
COPY dist/apps/server/clara-api/package.json ./package.json

Expand All @@ -17,7 +16,6 @@ WORKDIR /srv/app

COPY --from=deps /srv/app/node_modules ./node_modules
COPY dist/apps/server/clara-api/main.cjs ./main.cjs
COPY dist/apps/server/clara-api/package.json ./package.json

ENV PORT=9101
CMD ["main.cjs"]
2 changes: 1 addition & 1 deletion docker/edb/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ COPY . .
EXPOSE 4200

# Start the Nx server in development mode
CMD ["pnpm", "start:web"]
CMD ["pnpm", "start:web"]
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ function summarizeParams(schema?: JSONSchema): CapabilityItem['summary'] {
if (!schema || typeof schema !== 'object') return;

const out: CapabilityItem['summary'] = {};
const props = schema?.properties as Record<string, JSONSchema | { enum?: unknown; oneOf?: JSONSchema[] }> | undefined;

const kindEnum = props?.kind && 'enum' in props.kind ? (props.kind.enum as string[] | readonly string[] | undefined) : undefined;
const props = schema?.properties as
| Record<string, JSONSchema | { enum?: unknown; oneOf?: JSONSchema[] }>
| undefined;

const kindEnum =
props?.kind && 'enum' in props.kind
? (props.kind.enum as string[] | readonly string[] | undefined)
: undefined;
if (Array.isArray(kindEnum) && kindEnum.length) out.kinds = kindEnum;

const req = schema?.required as string[] | undefined;
Expand All @@ -79,9 +84,12 @@ function summarizeParams(schema?: JSONSchema): CapabilityItem['summary'] {
});
}

const rootOne = Array.isArray((schema as JSONSchema & { oneOf?: unknown })?.oneOf)
const rootOne = Array.isArray(
(schema as JSONSchema & { oneOf?: unknown })?.oneOf,
)
? (schema as JSONSchema & { oneOf?: JSONSchema[] }).oneOf
: [];

if (rootOne.length) {
const rootVariants = rootOne.map((v: JSONSchema, i: number) => {
const vReq = Array.isArray(v?.required) ? v.required : [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
ViewChild,
} from '@angular/core';
import { NavigationStart, Router } from '@angular/router';
import { UiIconComponent } from '@edb/shared-ui';
import { DialogModule } from 'carbon-components-angular';
import { filter } from 'rxjs';
import { UiIconComponent } from '../../../components/icon/icon.component';

@Component({
selector: 'ui-platform-overflow-menu',
Expand All @@ -35,7 +35,6 @@ import { UiIconComponent } from '../../../components/icon/icon.component';
</cds-overflow-menu>

<ng-template #customTriggerTemplate>
<!-- wrapper adds the padding -->
<div class="p-[9px] flex items-center justify-center">
<ui-icon
[name]="icon()"
Expand All @@ -48,52 +47,53 @@ import { UiIconComponent } from '../../../components/icon/icon.component';
`,
})
export class UiPlatformOverflowMenuComponent implements AfterViewInit {
/* ------------- existing @inputs / @outputs ------------------ */
readonly menuOptions = input<{ id: string; label: string }[]>([]);
readonly placement = input<'bottom' | 'top'>('bottom');
readonly flip = input<boolean>(true);
readonly offset = input<{ x: number; y: number }>({ x: 20, y: 0 });
readonly icon = input<string>('');
readonly iconSize = input<string>('1rem');
readonly iconColor = input<string>('white');

@Output() menuOptionSelected = new EventEmitter<string>();

/* ------------------------------------------------------------- */
isMenuOpen = false;

@ViewChild('menu', { static: true })
private menuEl!: HTMLElement & { open: boolean };
private menuEl?: HTMLElement & { open: boolean };

private readonly router = inject(Router);

/* close the popover on every navigation ----------------------- */
ngAfterViewInit(): void {
this.router.events
.pipe(filter((e) => e instanceof NavigationStart))
.pipe(filter((event) => event instanceof NavigationStart))
.subscribe(() => this.hardClose());
}

/* ------------------------------------------------------------- */
protected hardClose(): void {
this.isMenuOpen = false;
if (this.menuEl) this.menuEl.open = false;

if (this.menuEl) {
this.menuEl.open = false;
}
}

/* unchanged click helpers ------------------------------------- */
handleOptionSelect(opt: { id: string }) {
handleOptionSelect(option: { id: string }): void {
this.hardClose();
this.onOptionClick(opt.id);
this.onOptionClick(option.id);
}

onMenuSelect(): void {
this.hardClose();
}

onOptionClick(id: string) {
onOptionClick(id: string): void {
if (id === 'logout') {
console.log('Logging out…');
} else {
this.router.navigate([id]);
}

this.menuOptionSelected.emit(id);
}
}
7 changes: 3 additions & 4 deletions libs/shared/client/ui/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"declarationMap": true,
"inlineSources": true,
"types": [],
"module": "Node16",
"moduleResolution": "node16"
"module": "ES2022",
"moduleResolution": "bundler"
},
"exclude": [
"src/**/*.spec.ts",
Expand All @@ -23,8 +23,7 @@
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/test-setup.ts"
"src/**/*.spec.jsx"
],
"include": ["src/**/*.ts"]
}
Loading