This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { DashboardCard } from './dashboard-gallery/dashboard-card'; | |
import { datasources, cards } from './data'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class DataService { | |
getData(): DashboardCard[]{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function SubtituteString(urlStr: string, json: { [key: string] : string }) { | |
Object.keys(json).forEach(function(key) { | |
urlStr = urlStr.replace('${' + key + '}', json[key]) | |
}) | |
return urlStr; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getCardData(card: DashboardCard, i: number = 0) { | |
let resource = card.resources[i]; | |
let variables = card.variables; | |
let request = prepareRequest(resource, variables, card.pat); | |
console.log(request.url); | |
return this.http.get<string>(request.url, { headers: request.httpOptions }).subscribe( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function postRequest(data: any, resource: DashboardCardResource, variables: { [key: string] : string }) { | |
Object.keys(resource.values).forEach(function(key) { | |
var query = SubtituteString(resource.values[key], variables).replace(/'/g, '"'); | |
var result = jsonQuery(query, { data: data, allowRegexp: true }); | |
variables[key] = result.value; | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<div class="m-auto row justify-content-md-left py-4"> | |
<div class="w-100 border-bottom border-dark fw-bold"> | |
<h1>{{ title }}</h1> | |
</div> | |
</div> | |
<div class="m-auto"> | |
<div *ngFor="let card of cards; let i = index;" class="card border m-2 w-auto"> | |
<div class="row g-0 bg-light text-dark"> | |
<div class="col-md-2 d-flex justify-content-center align-items-center {{ card.variables['status'] | DashboardStylePipe }}"> |
OlderNewer