Skip to content

Instantly share code, notes, and snippets.

@BlindDespair
BlindDespair / .gilab-ci.yml
Created April 7, 2020 11:50
Gilab CI configuration
build_frontend:
stage: build
image: buildkite/puppeteer
script:
- npm run build — — prod
- npm run scully
artifacts:
expose_as: static_site
paths:
- dist/static
@BlindDespair
BlindDespair / cockpit.service.ts
Created April 7, 2020 11:42
Enhanced cockpit service
@Injectable({ providedIn: ‘root’ })
export class CockpitService {
private readonly baseApiUrl = environment.cockpit.apiUrl;
constructor(
private readonly http: HttpClient,
private readonly transferStateService: TransferStateService
) {}
requestCockpitData<T>(
path: string,
queryParams: HttpParams = new HttpParams()
@BlindDespair
BlindDespair / home.component.html
Created April 7, 2020 11:40
Home page component template
<ng-container *ngIf=”content”>
<div class=”default-text”>
<h1 class=”large-title”>{{ content.title }}</h1>
<div [innerHtml]=”content.info | safeHtml”></div>
</div>
</ng-container>
@BlindDespair
BlindDespair / home.component.ts
Last active April 7, 2020 11:40
Home page component
export class HomeComponent implements OnInit {
content?: HomeContent;
constructor(
private readonly cockpitService: CockpitService,
private readonly cdr: ChangeDetectorRef
) {}
ngOnInit(): void {
this.cockpitService
.getSingleton('home')
.pipe(first())
@BlindDespair
BlindDespair / home.component.ts
Created April 7, 2020 11:39
Home page component
export class HomeComponent implements OnInit {
content?: HomeContent;
constructor(
private readonly cockpitService: CockpitService,
private readonly cdr: ChangeDetectorRef
) {}
ngOnInit(): void {
this.cockpitService
.getSingleton('home')
.pipe(first())
@BlindDespair
BlindDespair / cockpit.service.ts
Created April 7, 2020 11:36
Initial cockpit service
@Injectable({ providedIn: 'root' })
export class CockpitService {
private readonly baseApiUrl = environment.cockpit.apiUrl;
constructor(private readonly http: HttpClient) {}
requestCockpitData<T>(
path: string,
queryParams: HttpParams = new HttpParams()
): Observable<T> {
const url = mergePaths(this.baseApiUrl, path);
const headers = new HttpHeaders(
@BlindDespair
BlindDespair / app-routing.module.ts
Created April 7, 2020 11:32
Application routes
const routes: Routes = [
{
path: ‘’,
loadChildren: () => import(‘./home/home.module’).then((m) => m.HomeModule)
}
];