Rebuild: Angular 22 shell with Material, Plotly and the generated API client
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
dist
|
||||
.angular
|
||||
@@ -0,0 +1,17 @@
|
||||
# Editor configuration, see https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.ts]
|
||||
quote_type = single
|
||||
ij_typescript_use_double_quotes = false
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
|
||||
|
||||
# Compiled output
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
/bazel-out
|
||||
|
||||
# Node
|
||||
/node_modules
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# IDEs and editors
|
||||
.idea/
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/mcp.json
|
||||
.history/*
|
||||
|
||||
# Miscellaneous
|
||||
/.angular/cache
|
||||
.sass-cache/
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
testem.log
|
||||
/typings
|
||||
__screenshots__/
|
||||
|
||||
# System files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"printWidth": 100,
|
||||
"singleQuote": true,
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.html",
|
||||
"options": {
|
||||
"parser": "angular"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
FROM node:24-alpine AS build
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY . .
|
||||
RUN npx ng build
|
||||
|
||||
FROM nginx:1.29-alpine
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build /app/dist/webapp/browser /usr/share/nginx/html
|
||||
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"version": 1,
|
||||
"cli": {
|
||||
"packageManager": "npm"
|
||||
},
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"webapp": {
|
||||
"projectType": "application",
|
||||
"schematics": {
|
||||
"@schematics/angular:component": {
|
||||
"style": "scss"
|
||||
}
|
||||
},
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"prefix": "app",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular/build:application",
|
||||
"options": {
|
||||
"browser": "src/main.ts",
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "public"
|
||||
}
|
||||
],
|
||||
"styles": ["src/styles.scss"]
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "500kB",
|
||||
"maximumError": "1MB"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "4kB",
|
||||
"maximumError": "8kB"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"optimization": false,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular/build:dev-server",
|
||||
"configurations": {
|
||||
"production": {
|
||||
"buildTarget": "webapp:build:production"
|
||||
},
|
||||
"development": {
|
||||
"buildTarget": "webapp:build:development"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "development"
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular/build:unit-test"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"$schema": "node_modules/ng-openapi-gen/ng-openapi-gen-schema.json",
|
||||
"input": "openapi.json",
|
||||
"output": "src/app/api",
|
||||
"ignoreUnusedModels": false
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
server {
|
||||
listen 80;
|
||||
root /usr/share/nginx/html;
|
||||
location /api/ {
|
||||
proxy_pass http://api:8000/;
|
||||
proxy_read_timeout 30s;
|
||||
}
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
{
|
||||
"components": {
|
||||
"schemas": {
|
||||
"Domain": {
|
||||
"enum": [
|
||||
"cacu",
|
||||
"cama",
|
||||
"tea"
|
||||
],
|
||||
"title": "Domain",
|
||||
"type": "string"
|
||||
},
|
||||
"HTTPValidationError": {
|
||||
"properties": {
|
||||
"detail": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/ValidationError"
|
||||
},
|
||||
"title": "Detail",
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"title": "HTTPValidationError",
|
||||
"type": "object"
|
||||
},
|
||||
"ValidationError": {
|
||||
"properties": {
|
||||
"ctx": {
|
||||
"title": "Context",
|
||||
"type": "object"
|
||||
},
|
||||
"input": {
|
||||
"title": "Input"
|
||||
},
|
||||
"loc": {
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "integer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"title": "Location",
|
||||
"type": "array"
|
||||
},
|
||||
"msg": {
|
||||
"title": "Message",
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"title": "Error Type",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"loc",
|
||||
"msg",
|
||||
"type"
|
||||
],
|
||||
"title": "ValidationError",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"info": {
|
||||
"title": "ISSSTELEON",
|
||||
"version": "0.0.0"
|
||||
},
|
||||
"openapi": "3.1.0",
|
||||
"paths": {
|
||||
"/domains": {
|
||||
"get": {
|
||||
"operationId": "domains",
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Domain"
|
||||
},
|
||||
"title": "Response Domains",
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
}
|
||||
},
|
||||
"summary": "Domains"
|
||||
}
|
||||
},
|
||||
"/health": {
|
||||
"get": {
|
||||
"operationId": "health",
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": "Response Health",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
}
|
||||
},
|
||||
"summary": "Health"
|
||||
}
|
||||
},
|
||||
"/runs/{run_id}": {
|
||||
"get": {
|
||||
"operationId": "run_status",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "run_id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"title": "Run Id",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": "Response Run Status",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
},
|
||||
"422": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/HTTPValidationError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Validation Error"
|
||||
}
|
||||
},
|
||||
"summary": "Run Status"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+7501
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "webapp",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve --proxy-config proxy.conf.json",
|
||||
"build": "ng build",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test",
|
||||
"api": "ng-openapi-gen -c ng-openapi-gen.json"
|
||||
},
|
||||
"private": true,
|
||||
"packageManager": "npm@11.20.0",
|
||||
"dependencies": {
|
||||
"@angular/cdk": "^22.3.0",
|
||||
"@angular/common": "^22.3.0",
|
||||
"@angular/compiler": "^22.3.0",
|
||||
"@angular/core": "^22.3.0",
|
||||
"@angular/forms": "^22.3.0",
|
||||
"@angular/material": "^22.3.0",
|
||||
"@angular/platform-browser": "^22.3.0",
|
||||
"@angular/router": "^22.3.0",
|
||||
"plotly.js-cartesian-dist-min": "4.1.2",
|
||||
"rxjs": "~7.8.0",
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/build": "^22.3.0",
|
||||
"@angular/cli": "^22.3.0",
|
||||
"@angular/compiler-cli": "^22.3.0",
|
||||
"jsdom": "^31.0.0",
|
||||
"ng-openapi-gen": "^1.1.0",
|
||||
"prettier": "^3.8.1",
|
||||
"typescript": "~6.0.2",
|
||||
"vitest": "^5.0.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "/api": { "target": "http://127.0.0.1:5711", "pathRewrite": { "^/api": "" } } }
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,27 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
/**
|
||||
* Provides the ApiConfiguration configuration object with a given root URL.
|
||||
*/
|
||||
export function provideApiConfiguration(rootUrl: string) {
|
||||
var config = new ApiConfiguration();
|
||||
config.rootUrl = rootUrl;
|
||||
return {
|
||||
provide: ApiConfiguration,
|
||||
useValue: config
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Global configuration
|
||||
*/
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ApiConfiguration {
|
||||
rootUrl: string = '';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
|
||||
import { Observable, firstValueFrom } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
import { ApiConfiguration } from './api-configuration';
|
||||
import { StrictHttpResponse } from './strict-http-response';
|
||||
|
||||
export type ApiFnOptional<P, R> = (http: HttpClient, rootUrl: string, params?: P, context?: HttpContext) => Observable<StrictHttpResponse<R>>;
|
||||
export type ApiFnRequired<P, R> = (http: HttpClient, rootUrl: string, params: P, context?: HttpContext) => Observable<StrictHttpResponse<R>>;
|
||||
|
||||
/**
|
||||
* Helper service to call API functions directly
|
||||
*/
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class Api {
|
||||
constructor(
|
||||
private config: ApiConfiguration,
|
||||
private http: HttpClient
|
||||
) {
|
||||
}
|
||||
|
||||
private _rootUrl?: string;
|
||||
|
||||
/**
|
||||
* Returns the root url for API operations. If not set directly here,
|
||||
* will fallback to `ApiConfiguration.rootUrl`.
|
||||
*/
|
||||
get rootUrl(): string {
|
||||
return this._rootUrl || this.config.rootUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the root URL for API operations
|
||||
*/
|
||||
set rootUrl(rootUrl: string) {
|
||||
this._rootUrl = rootUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes an API call, returning the response body only
|
||||
*/
|
||||
invoke<P, R>(fn: ApiFnRequired<P, R>, params: P, context?: HttpContext): Promise<R>;
|
||||
invoke<P, R>(fn: ApiFnOptional<P, R>, params?: P, context?: HttpContext): Promise<R>;
|
||||
async invoke<P, R>(fn: ApiFnRequired<P, R> | ApiFnOptional<P, R>, params: P, context?: HttpContext): Promise<R> {
|
||||
const resp = this.invoke$Response(fn, params, context);
|
||||
return (await resp).body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes an API call, returning the entire response
|
||||
*/
|
||||
invoke$Response<P, R>(fn: ApiFnRequired<P, R>, params: P, context?: HttpContext): Promise<StrictHttpResponse<R>>;
|
||||
invoke$Response<P, R>(fn: ApiFnOptional<P, R>, params?: P, context?: HttpContext): Promise<StrictHttpResponse<R>>;
|
||||
invoke$Response<P, R>(fn: ApiFnRequired<P, R> | ApiFnOptional<P, R>, params: P, context?: HttpContext): Promise<StrictHttpResponse<R>> {
|
||||
const obs = fn(this.http, this.rootUrl, params, context)
|
||||
.pipe(
|
||||
filter(r => r instanceof HttpResponse),
|
||||
map(r => r as StrictHttpResponse<R>));
|
||||
return firstValueFrom(obs);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
import { StrictHttpResponse } from '../../strict-http-response';
|
||||
import { RequestBuilder } from '../../request-builder';
|
||||
|
||||
import { Domain } from '../../models/domain';
|
||||
|
||||
export interface Domains$Params {
|
||||
}
|
||||
|
||||
export function domains(http: HttpClient, rootUrl: string, params?: Domains$Params, context?: HttpContext): Observable<StrictHttpResponse<Array<Domain>>> {
|
||||
const rb = new RequestBuilder(rootUrl, domains.PATH, 'get');
|
||||
if (params) {
|
||||
}
|
||||
|
||||
return http.request(
|
||||
rb.build({ responseType: 'json', accept: 'application/json', context })
|
||||
).pipe(
|
||||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
|
||||
map((r: HttpResponse<any>) => {
|
||||
return r as StrictHttpResponse<Array<Domain>>;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
domains.PATH = '/domains';
|
||||
@@ -0,0 +1,33 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
import { StrictHttpResponse } from '../../strict-http-response';
|
||||
import { RequestBuilder } from '../../request-builder';
|
||||
|
||||
|
||||
export interface Health$Params {
|
||||
}
|
||||
|
||||
export function health(http: HttpClient, rootUrl: string, params?: Health$Params, context?: HttpContext): Observable<StrictHttpResponse<{
|
||||
[key: string]: string;
|
||||
}>> {
|
||||
const rb = new RequestBuilder(rootUrl, health.PATH, 'get');
|
||||
if (params) {
|
||||
}
|
||||
|
||||
return http.request(
|
||||
rb.build({ responseType: 'json', accept: 'application/json', context })
|
||||
).pipe(
|
||||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
|
||||
map((r: HttpResponse<any>) => {
|
||||
return r as StrictHttpResponse<{
|
||||
[key: string]: string;
|
||||
}>;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
health.PATH = '/health';
|
||||
@@ -0,0 +1,35 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
import { StrictHttpResponse } from '../../strict-http-response';
|
||||
import { RequestBuilder } from '../../request-builder';
|
||||
|
||||
|
||||
export interface RunStatus$Params {
|
||||
run_id: string;
|
||||
}
|
||||
|
||||
export function runStatus(http: HttpClient, rootUrl: string, params: RunStatus$Params, context?: HttpContext): Observable<StrictHttpResponse<{
|
||||
[key: string]: string;
|
||||
}>> {
|
||||
const rb = new RequestBuilder(rootUrl, runStatus.PATH, 'get');
|
||||
if (params) {
|
||||
rb.path('run_id', params.run_id, {});
|
||||
}
|
||||
|
||||
return http.request(
|
||||
rb.build({ responseType: 'json', accept: 'application/json', context })
|
||||
).pipe(
|
||||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
|
||||
map((r: HttpResponse<any>) => {
|
||||
return r as StrictHttpResponse<{
|
||||
[key: string]: string;
|
||||
}>;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
runStatus.PATH = '/runs/{run_id}';
|
||||
@@ -0,0 +1,9 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
export type { Domains$Params as Domains$Params } from './fn/operations/domains';
|
||||
export { domains as domains } from './fn/operations/domains';
|
||||
export type { Health$Params as Health$Params } from './fn/operations/health';
|
||||
export { health as health } from './fn/operations/health';
|
||||
export type { RunStatus$Params as RunStatus$Params } from './fn/operations/run-status';
|
||||
export { runStatus as runStatus } from './fn/operations/run-status';
|
||||
@@ -0,0 +1,6 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
export type { Domain } from './models/domain';
|
||||
export type { HttpValidationError } from './models/http-validation-error';
|
||||
export type { ValidationError } from './models/validation-error';
|
||||
@@ -0,0 +1,13 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { Domain } from './domain';
|
||||
|
||||
/**
|
||||
* Each possible value of `Domain`
|
||||
*/
|
||||
export const DOMAIN: Domain[] = [
|
||||
'cacu',
|
||||
'cama',
|
||||
'tea'
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
export type Domain = 'cacu' | 'cama' | 'tea';
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { ValidationError } from '../models/validation-error';
|
||||
export interface HttpValidationError {
|
||||
detail?: Array<ValidationError>;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
export interface ValidationError {
|
||||
ctx?: {
|
||||
};
|
||||
input?: any;
|
||||
loc: Array<(string | number)>;
|
||||
msg: string;
|
||||
type: string;
|
||||
}
|
||||
@@ -0,0 +1,369 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { HttpRequest, HttpParameterCodec, HttpParams, HttpHeaders, HttpContext } from '@angular/common/http';
|
||||
|
||||
/**
|
||||
* Custom parameter codec to correctly handle the plus sign in parameter
|
||||
* values. See https://github.com/angular/angular/issues/18261
|
||||
*/
|
||||
class ParameterCodec implements HttpParameterCodec {
|
||||
encodeKey(key: string): string {
|
||||
return encodeURIComponent(key);
|
||||
}
|
||||
|
||||
encodeValue(value: string): string {
|
||||
return encodeURIComponent(value);
|
||||
}
|
||||
|
||||
decodeKey(key: string): string {
|
||||
return decodeURIComponent(key);
|
||||
}
|
||||
|
||||
decodeValue(value: string): string {
|
||||
return decodeURIComponent(value);
|
||||
}
|
||||
}
|
||||
const ParameterCodecInstance = new ParameterCodec();
|
||||
|
||||
/**
|
||||
* Defines the options for appending a parameter
|
||||
*/
|
||||
interface ParameterOptions {
|
||||
style?: string;
|
||||
explode?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for a parameter
|
||||
*/
|
||||
abstract class Parameter {
|
||||
constructor(public name: string, public value: any, public options: ParameterOptions, defaultStyle: string, defaultExplode: boolean) {
|
||||
this.options = options || {};
|
||||
if (this.options.style === null || this.options.style === undefined) {
|
||||
this.options.style = defaultStyle;
|
||||
}
|
||||
if (this.options.explode === null || this.options.explode === undefined) {
|
||||
this.options.explode = defaultExplode;
|
||||
}
|
||||
}
|
||||
|
||||
serializeValue(value: any, separator = ','): string {
|
||||
if (value === null || value === undefined) {
|
||||
return '';
|
||||
} else if (value instanceof Array) {
|
||||
return value.map(v => this.serializeValue(v).split(separator).join(encodeURIComponent(separator))).join(separator);
|
||||
} else if (typeof value === 'object') {
|
||||
const array: string[] = [];
|
||||
for (const key of Object.keys(value)) {
|
||||
let propVal = value[key];
|
||||
if (propVal !== null && propVal !== undefined) {
|
||||
propVal = this.serializeValue(propVal).split(separator).join(encodeURIComponent(separator));
|
||||
if (this.options.explode) {
|
||||
array.push(`${key}=${propVal}`);
|
||||
} else {
|
||||
array.push(key);
|
||||
array.push(propVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
return array.join(separator);
|
||||
} else {
|
||||
return String(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A parameter in the operation path
|
||||
*/
|
||||
class PathParameter extends Parameter {
|
||||
constructor(name: string, value: any, options: ParameterOptions) {
|
||||
super(name, value, options, 'simple', false);
|
||||
}
|
||||
|
||||
append(path: string): string {
|
||||
let value = this.value;
|
||||
if (value === null || value === undefined) {
|
||||
value = '';
|
||||
}
|
||||
let prefix = this.options.style === 'label' ? '.' : '';
|
||||
let separator = this.options.explode ? prefix === '' ? ',' : prefix : ',';
|
||||
let alreadySerialized = false;
|
||||
if (this.options.style === 'matrix') {
|
||||
// The parameter name is just used as prefix, except in some cases...
|
||||
prefix = `;${this.name}=`;
|
||||
if (this.options.explode && typeof value === 'object') {
|
||||
prefix = ';';
|
||||
if (value instanceof Array) {
|
||||
// For arrays we have to repeat the name for each element
|
||||
value = value.map(v => `${this.name}=${this.serializeValue(v, ';')}`);
|
||||
value = value.join(';');
|
||||
alreadySerialized = true;
|
||||
} else {
|
||||
// For objects we have to put each the key / value pairs
|
||||
value = this.serializeValue(value, ';');
|
||||
alreadySerialized = true
|
||||
}
|
||||
}
|
||||
}
|
||||
value = prefix + (alreadySerialized ? value : this.serializeValue(value, separator));
|
||||
// Replace both the plain variable and the corresponding variant taking in the prefix and explode into account
|
||||
path = path.replace(`{${this.name}}`, value);
|
||||
path = path.replace(`{${prefix}${this.name}${this.options.explode ? '*' : ''}}`, value);
|
||||
return path;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
serializeValue(value: any, separator = ','): string {
|
||||
var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator);
|
||||
result = result.replace(/%3D/g, '=');
|
||||
result = result.replace(/%3B/g, ';');
|
||||
result = result.replace(/%2C/g, ',');
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A parameter in the query
|
||||
*/
|
||||
class QueryParameter extends Parameter {
|
||||
constructor(name: string, value: any, options: ParameterOptions) {
|
||||
super(name, value, options, 'form', true);
|
||||
}
|
||||
|
||||
append(params: HttpParams): HttpParams {
|
||||
if (this.value instanceof Array) {
|
||||
// Array serialization
|
||||
if (this.options.explode) {
|
||||
for (const v of this.value) {
|
||||
params = params.append(this.name, this.serializeValue(v));
|
||||
}
|
||||
} else {
|
||||
const separator = this.options.style === 'spaceDelimited'
|
||||
? ' ' : this.options.style === 'pipeDelimited'
|
||||
? '|' : ',';
|
||||
return params.append(this.name, this.serializeValue(this.value, separator));
|
||||
}
|
||||
} else if (this.value !== null && typeof this.value === 'object') {
|
||||
// Object serialization
|
||||
if (this.options.style === 'deepObject') {
|
||||
// Append a parameter for each key, in the form `name[key]`
|
||||
for (const key of Object.keys(this.value)) {
|
||||
const propVal = this.value[key];
|
||||
if (propVal !== null && propVal !== undefined) {
|
||||
params = params.append(`${this.name}[${key}]`, this.serializeValue(propVal));
|
||||
}
|
||||
}
|
||||
} else if (this.options.explode) {
|
||||
// Append a parameter for each key without using the parameter name
|
||||
for (const key of Object.keys(this.value)) {
|
||||
const propVal = this.value[key];
|
||||
if (propVal !== null && propVal !== undefined) {
|
||||
params = params.append(key, this.serializeValue(propVal));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Append a single parameter whose values are a comma-separated list of key,value,key,value...
|
||||
const array: any[] = [];
|
||||
for (const key of Object.keys(this.value)) {
|
||||
const propVal = this.value[key];
|
||||
if (propVal !== null && propVal !== undefined) {
|
||||
array.push(key);
|
||||
array.push(propVal);
|
||||
}
|
||||
}
|
||||
params = params.append(this.name, this.serializeValue(array));
|
||||
}
|
||||
} else if (this.value !== null && this.value !== undefined) {
|
||||
// Plain value
|
||||
params = params.append(this.name, this.serializeValue(this.value));
|
||||
}
|
||||
return params;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A parameter in the HTTP request header
|
||||
*/
|
||||
class HeaderParameter extends Parameter {
|
||||
constructor(name: string, value: any, options: ParameterOptions) {
|
||||
super(name, value, options, 'simple', false);
|
||||
}
|
||||
|
||||
append(headers: HttpHeaders): HttpHeaders {
|
||||
if (this.value !== null && this.value !== undefined) {
|
||||
if (this.value instanceof Array) {
|
||||
for (const v of this.value) {
|
||||
headers = headers.append(this.name, this.serializeValue(v));
|
||||
}
|
||||
} else {
|
||||
headers = headers.append(this.name, this.serializeValue(this.value));
|
||||
}
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to build http requests from parameters
|
||||
*/
|
||||
export class RequestBuilder {
|
||||
|
||||
private _path = new Map<string, PathParameter>();
|
||||
private _query = new Map<string, QueryParameter>();
|
||||
private _header = new Map<string, HeaderParameter>();
|
||||
_bodyContent: any | null;
|
||||
_bodyContentType?: string;
|
||||
|
||||
constructor(
|
||||
public rootUrl: string,
|
||||
public operationPath: string,
|
||||
public method: string) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a path parameter
|
||||
*/
|
||||
path(name: string, value: any, options?: ParameterOptions): void {
|
||||
this._path.set(name, new PathParameter(name, value, options || {}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a query parameter
|
||||
*/
|
||||
query(name: string, value: any, options?: ParameterOptions): void {
|
||||
this._query.set(name, new QueryParameter(name, value, options || {}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a header parameter
|
||||
*/
|
||||
header(name: string, value: any, options?: ParameterOptions): void {
|
||||
this._header.set(name, new HeaderParameter(name, value, options || {}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the body content, along with the content type
|
||||
*/
|
||||
body(value: any, contentType = 'application/json'): void {
|
||||
if (value instanceof Blob) {
|
||||
this._bodyContentType = value.type;
|
||||
} else {
|
||||
this._bodyContentType = contentType;
|
||||
}
|
||||
if (this._bodyContentType === 'application/x-www-form-urlencoded' && value !== null && typeof value === 'object') {
|
||||
// Handle URL-encoded data
|
||||
const pairs: Array<[string, string]> = [];
|
||||
for (const key of Object.keys(value)) {
|
||||
let val = value[key];
|
||||
if (!(val instanceof Array)) {
|
||||
val = [val];
|
||||
}
|
||||
for (const v of val) {
|
||||
const formValue = this.formDataValue(v);
|
||||
if (formValue !== null) {
|
||||
pairs.push([key, formValue]);
|
||||
}
|
||||
}
|
||||
}
|
||||
this._bodyContent = pairs.map(p => `${encodeURIComponent(p[0])}=${encodeURIComponent(p[1])}`).join('&');
|
||||
} else if (this._bodyContentType === 'multipart/form-data') {
|
||||
// Handle multipart form data
|
||||
const formData = new FormData();
|
||||
if (value !== null && value !== undefined) {
|
||||
for (const key of Object.keys(value)) {
|
||||
const val = value[key];
|
||||
if (val instanceof Array) {
|
||||
for (const v of val) {
|
||||
const toAppend = this.formDataValue(v);
|
||||
if (toAppend !== null) {
|
||||
formData.append(key, toAppend);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const toAppend = this.formDataValue(val);
|
||||
if (toAppend !== null) {
|
||||
formData.set(key, toAppend);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this._bodyContent = formData;
|
||||
} else {
|
||||
// The body is the plain content
|
||||
this._bodyContent = value;
|
||||
}
|
||||
}
|
||||
|
||||
private formDataValue(value: any): any {
|
||||
if (value === null || value === undefined) {
|
||||
return null;
|
||||
}
|
||||
if (value instanceof Blob) {
|
||||
return value;
|
||||
}
|
||||
if (typeof value === 'object') {
|
||||
return new Blob([JSON.stringify(value)], {type: 'application/json'})
|
||||
}
|
||||
return String(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the request with the current set parameters
|
||||
*/
|
||||
build<T = any>(options?: {
|
||||
/** Which content types to accept */
|
||||
accept?: string;
|
||||
|
||||
/** The expected response type */
|
||||
responseType?: 'json' | 'text' | 'blob' | 'arraybuffer';
|
||||
|
||||
/** Whether to report progress on uploads / downloads */
|
||||
reportProgress?: boolean;
|
||||
|
||||
/** Allow passing HttpContext for HttpClient */
|
||||
context?: HttpContext;
|
||||
}): HttpRequest<T> {
|
||||
|
||||
options = options || {};
|
||||
|
||||
// Path parameters
|
||||
let path = this.operationPath;
|
||||
for (const pathParam of this._path.values()) {
|
||||
path = pathParam.append(path);
|
||||
}
|
||||
const url = this.rootUrl + path;
|
||||
|
||||
// Query parameters
|
||||
let httpParams = new HttpParams({
|
||||
encoder: ParameterCodecInstance
|
||||
});
|
||||
for (const queryParam of this._query.values()) {
|
||||
httpParams = queryParam.append(httpParams);
|
||||
}
|
||||
|
||||
// Header parameters
|
||||
let httpHeaders = new HttpHeaders();
|
||||
if (options.accept) {
|
||||
httpHeaders = httpHeaders.append('Accept', options.accept);
|
||||
}
|
||||
for (const headerParam of this._header.values()) {
|
||||
httpHeaders = headerParam.append(httpHeaders);
|
||||
}
|
||||
|
||||
// Request content headers
|
||||
if (this._bodyContentType && !(this._bodyContent instanceof FormData)) {
|
||||
httpHeaders = httpHeaders.set('Content-Type', this._bodyContentType);
|
||||
}
|
||||
|
||||
// Perform the request
|
||||
return new HttpRequest<T>(this.method.toUpperCase(), url, this._bodyContent, {
|
||||
params: httpParams,
|
||||
headers: httpHeaders,
|
||||
responseType: options.responseType,
|
||||
reportProgress: options.reportProgress,
|
||||
context: options.context
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/* eslint-disable */
|
||||
/* Code generated by ng-openapi-gen DO NOT EDIT. */
|
||||
|
||||
import { HttpResponse } from '@angular/common/http';
|
||||
|
||||
/**
|
||||
* Constrains the http response to not have the body defined as `T | null`, but `T` only.
|
||||
*/
|
||||
export type StrictHttpResponse<T> = HttpResponse<T> & {
|
||||
readonly body: T;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/core';
|
||||
import { provideRouter } from '@angular/router';
|
||||
import { provideApiConfiguration } from './api/api-configuration';
|
||||
import { routes } from './app.routes';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
provideBrowserGlobalErrorListeners(),
|
||||
provideRouter(routes),
|
||||
provideHttpClient(),
|
||||
provideApiConfiguration('/api'),
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
<mat-toolbar class="bar">
|
||||
<span class="brand">ISSSTELEON</span>
|
||||
<mat-button-toggle-group
|
||||
aria-label="Dominio"
|
||||
[value]="domain()"
|
||||
(change)="domain.set($event.value)"
|
||||
>
|
||||
@for (d of domains.value() ?? []; track d) {
|
||||
<mat-button-toggle [value]="d">{{ labels[d] }}</mat-button-toggle>
|
||||
}
|
||||
</mat-button-toggle-group>
|
||||
<span class="spacer"></span>
|
||||
<span class="status" [class.down]="health.error()">
|
||||
API {{ health.value()?.['status'] ?? (health.error() ? 'sin conexión' : '…') }}
|
||||
</span>
|
||||
</mat-toolbar>
|
||||
<main>
|
||||
<router-outlet />
|
||||
</main>
|
||||
@@ -0,0 +1,3 @@
|
||||
import { Routes } from '@angular/router';
|
||||
|
||||
export const routes: Routes = [];
|
||||
@@ -0,0 +1,19 @@
|
||||
.bar {
|
||||
gap: 16px;
|
||||
}
|
||||
.brand {
|
||||
font-weight: 500;
|
||||
}
|
||||
.spacer {
|
||||
flex: 1;
|
||||
}
|
||||
.status {
|
||||
font-size: 14px;
|
||||
opacity: 0.8;
|
||||
}
|
||||
.status.down {
|
||||
color: var(--mat-sys-error);
|
||||
}
|
||||
main {
|
||||
padding: 16px;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { App } from './app';
|
||||
|
||||
describe('App', () => {
|
||||
it('creates the shell', async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [App],
|
||||
providers: [provideHttpClient(), provideHttpClientTesting()],
|
||||
}).compileComponents();
|
||||
expect(TestBed.createComponent(App).componentInstance).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
import { Component, inject, resource, signal } from '@angular/core';
|
||||
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { RouterOutlet } from '@angular/router';
|
||||
import { Api } from './api/api';
|
||||
import { domains } from './api/fn/operations/domains';
|
||||
import { health } from './api/fn/operations/health';
|
||||
import { Domain } from './api/models/domain';
|
||||
|
||||
const LABELS: Record<Domain, string> = { cacu: 'CaCu', cama: 'CaMa', tea: 'TEA' };
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
imports: [RouterOutlet, MatToolbarModule, MatButtonToggleModule],
|
||||
templateUrl: './app.html',
|
||||
styleUrl: './app.scss',
|
||||
})
|
||||
export class App {
|
||||
private readonly api = inject(Api);
|
||||
protected readonly labels = LABELS;
|
||||
protected readonly domain = signal<Domain>('cacu');
|
||||
protected readonly domains = resource({ loader: () => this.api.invoke(domains) });
|
||||
protected readonly health = resource({ loader: () => this.api.invoke(health) });
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Webapp</title>
|
||||
<base href="/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,5 @@
|
||||
import { bootstrapApplication } from '@angular/platform-browser';
|
||||
import { appConfig } from './app/app.config';
|
||||
import { App } from './app/app';
|
||||
|
||||
bootstrapApplication(App, appConfig).catch((err) => console.error(err));
|
||||
@@ -0,0 +1,39 @@
|
||||
// Include theming for Angular Material with `mat.theme()`.
|
||||
// This Sass mixin will define CSS variables that are used for styling Angular Material
|
||||
// components according to the Material 3 design spec.
|
||||
// Learn more about theming and how to use it for your application's
|
||||
// custom components at https://material.angular.dev/guide/theming
|
||||
@use '@angular/material' as mat;
|
||||
|
||||
html {
|
||||
height: 100%;
|
||||
@include mat.theme(
|
||||
(
|
||||
color: (
|
||||
primary: mat.$azure-palette,
|
||||
tertiary: mat.$blue-palette,
|
||||
),
|
||||
typography: Roboto,
|
||||
density: 0,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
body {
|
||||
// Default the application to a light color theme. This can be changed to
|
||||
// `dark` to enable the dark color theme, or to `light dark` to defer to the
|
||||
// user's system settings.
|
||||
color-scheme: light;
|
||||
|
||||
// Set a default background, font and text colors for the application using
|
||||
// Angular Material's system-level CSS variables. Learn more about these
|
||||
// variables at https://material.angular.dev/guide/system-variables
|
||||
background-color: var(--mat-sys-surface);
|
||||
color: var(--mat-sys-on-surface);
|
||||
font: var(--mat-sys-body-medium);
|
||||
|
||||
// Reset the user agent margin.
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
}
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
@@ -0,0 +1,10 @@
|
||||
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
||||
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"types": []
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["src/**/*.spec.ts"]
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
||||
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"skipLibCheck": true,
|
||||
"isolatedModules": true,
|
||||
"experimentalDecorators": true,
|
||||
"importHelpers": true,
|
||||
"target": "ES2022",
|
||||
"module": "preserve"
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false,
|
||||
"strictInjectionParameters": true,
|
||||
"strictInputAccessModifiers": true
|
||||
},
|
||||
"files": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.app.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.spec.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
||||
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"types": ["vitest/globals"]
|
||||
},
|
||||
"include": ["src/**/*.d.ts", "src/**/*.spec.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user