Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
24bd795421
|
|||
1a6c468473
|
|||
a1d5b894bb
|
|||
0dea862c1b
|
|||
b4e6b8d746
|
|||
59ec8fe245
|
|||
c73ef175ea
|
|||
11ea4869a9
|
|||
ce4033eb5f
|
@ -24,8 +24,10 @@ check:
|
||||
|
||||
|
||||
build:
|
||||
image: node:14-buster
|
||||
image: registry.hottis.de/hv2/hv2-node-build-env:1.0.0
|
||||
stage: build
|
||||
variables:
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
tags:
|
||||
- hottis
|
||||
- linux
|
||||
@ -37,9 +39,12 @@ build:
|
||||
script:
|
||||
- cd hv2-ui
|
||||
- if [ "$CI_COMMIT_TAG" != "" ]; then
|
||||
sed -i -e 's/GITTAGVERSION/'"$CI_COMMIT_TAG"'/' ./src/app/navigation/navigation.component.html;
|
||||
sed -i -e 's/GITTAGVERSION/'"$CI_COMMIT_TAG"':'"$CI_COMMIT_SHORT_SHA"'/' ./src/app/navigation/navigation.component.html;
|
||||
fi
|
||||
- npm install
|
||||
- for F in ./src/app/*.tmpl; do
|
||||
python ../helpers/hv2-api/generate.py -s ../helpers/hv2-api/schema.json -t $F;
|
||||
done
|
||||
- ./node_modules/.bin/ng build --prod
|
||||
- tar -czf ../dist.tgz dist
|
||||
|
||||
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "helpers/hv2-api"]
|
||||
path = helpers/hv2-api
|
||||
url = ../hv2-api
|
1
helpers/hv2-api
Submodule
1
helpers/hv2-api
Submodule
Submodule helpers/hv2-api added at 717d2bc7d8
@ -7,7 +7,9 @@
|
||||
"build": "ng build",
|
||||
"test": "ng test",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e"
|
||||
"e2e": "ng e2e",
|
||||
"generate": "python ../helpers/hv2-api/generate.py -s ../helpers/hv2-api/schema.json -t ./src/app/*.tmpl"
|
||||
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
35
hv2-ui/src/app/data-object-service.ts.tmpl
Normal file
35
hv2-ui/src/app/data-object-service.ts.tmpl
Normal file
@ -0,0 +1,35 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { MessageService } from './message.service';
|
||||
import { serviceBaseUrl } from './config';
|
||||
|
||||
|
||||
#for $table in $tables
|
||||
import { ${JsNameConverter($table.name)} } from './data-objects';
|
||||
#end for
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#from generateHelper import JsNameConverter
|
||||
|
||||
#for $table in $tables
|
||||
export class ${JsNameConverter($table.name)}Service {
|
||||
constructor(private messageService: MessageService, private http: HttpClient) { }
|
||||
|
||||
async get${JsNameConverter($table.name)}(): Promise<${JsNameConverter($table.name)}> {
|
||||
this.messageService.add(`${JsNameConverter($table.name)}Service: fetch data`);
|
||||
return this.http.get<${JsNameConverter($table.name)}>(`\${serviceBaseUrl}/v1/${table.name}`).toPromise()
|
||||
}
|
||||
}
|
||||
|
||||
#end for
|
||||
|
11
hv2-ui/src/app/data-objects.ts.tmpl
Normal file
11
hv2-ui/src/app/data-objects.ts.tmpl
Normal file
@ -0,0 +1,11 @@
|
||||
#from generateHelper import JsNameConverter
|
||||
|
||||
#for $table in $tables
|
||||
export interface $JsNameConverter($table.name) {
|
||||
#for $column in $table.columns
|
||||
${column.name}: ${column.jstype}
|
||||
#end for
|
||||
}
|
||||
|
||||
#end for
|
||||
|
Reference in New Issue
Block a user