a6608c140e
* build(deps): bump chart.js from 2.9.4 to 3.0.2 in /web Bumps [chart.js](https://github.com/chartjs/Chart.js) from 2.9.4 to 3.0.2. - [Release notes](https://github.com/chartjs/Chart.js/releases) - [Commits](https://github.com/chartjs/Chart.js/compare/v2.9.4...v3.0.2) Signed-off-by: dependabot[bot] <support@github.com> * web/elements/chart: upgrade to chart.js 3 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jens Langhammer <jens.langhammer@beryju.org>
34 lines
1,016 B
TypeScript
34 lines
1,016 B
TypeScript
import { customElement, property } from "lit-element";
|
|
import { Coordinate, CoreApi } from "authentik-api";
|
|
import { DEFAULT_CONFIG } from "../../api/Config";
|
|
import { AKChart } from "./Chart";
|
|
import { ChartDataset } from "chart.js";
|
|
|
|
@customElement("ak-charts-application-authorize")
|
|
export class ApplicationAuthorizeChart extends AKChart<Coordinate[]> {
|
|
|
|
@property()
|
|
applicationSlug!: string;
|
|
|
|
apiRequest(): Promise<Coordinate[]> {
|
|
return new CoreApi(DEFAULT_CONFIG).coreApplicationsMetrics({ slug: this.applicationSlug });
|
|
}
|
|
|
|
getDatasets(data: Coordinate[]): ChartDataset[] {
|
|
return [
|
|
{
|
|
label: "Authorizations",
|
|
backgroundColor: "rgba(189, 229, 184, .5)",
|
|
spanGaps: true,
|
|
data: data.map((cord) => {
|
|
return {
|
|
x: cord.xCord || 0,
|
|
y: cord.yCord || 0,
|
|
};
|
|
}) || [],
|
|
},
|
|
];
|
|
}
|
|
|
|
}
|