add endpoint for general stats

load build data to graph
redesign top info tiles
place add button on header
folder restructure
This commit is contained in:
2023-12-30 00:45:33 +01:00
parent ce7a260760
commit 600c2057fe
38 changed files with 563 additions and 886 deletions

View File

@ -0,0 +1,21 @@
class Build {
final int id;
final String pkg_name;
final String version;
final int status;
Build(
{required this.id,
required this.pkg_name,
required this.version,
required this.status});
factory Build.fromJson(Map<String, dynamic> json) {
return Build(
id: json["id"] as int,
status: json["status"] as int,
pkg_name: json["pkg_name"] as String,
version: json["version"] as String,
);
}
}

View File

@ -1,289 +0,0 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import '../core/constants/color_constants.dart';
class DailyInfoModel {
IconData? icon;
String? title;
String? totalStorage;
int? volumeData;
int? percentage;
Color? color;
List<Color>? colors;
List<FlSpot>? spots;
DailyInfoModel({
this.icon,
this.title,
this.totalStorage,
this.volumeData,
this.percentage,
this.color,
this.colors,
this.spots,
});
DailyInfoModel.fromJson(Map<String, dynamic> json) {
title = json['title'];
volumeData = json['volumeData'];
icon = json['icon'];
totalStorage = json['totalStorage'];
color = json['color'];
percentage = json['percentage'];
colors = json['colors'];
spots = json['spots'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['title'] = this.title;
data['volumeData'] = this.volumeData;
data['icon'] = this.icon;
data['totalStorage'] = this.totalStorage;
data['color'] = this.color;
data['percentage'] = this.percentage;
data['colors'] = this.colors;
data['spots'] = this.spots;
return data;
}
}
List<DailyInfoModel> dailyDatas =
dailyData.map((item) => DailyInfoModel.fromJson(item)).toList();
//List<FlSpot> spots = yValues.asMap().entries.map((e) {
// return FlSpot(e.key.toDouble(), e.value);
//}).toList();
var dailyData = [
{
"title": "Employee",
"volumeData": 1328,
"icon": Icons.ac_unit,
"totalStorage": "+ %20",
"color": primaryColor,
"percentage": 35,
"colors": [
Color(0xff23b6e6),
Color(0xff02d39a),
],
"spots": [
FlSpot(
1,
2,
),
FlSpot(
2,
1.0,
),
FlSpot(
3,
1.8,
),
FlSpot(
4,
1.5,
),
FlSpot(
5,
1.0,
),
FlSpot(
6,
2.2,
),
FlSpot(
7,
1.8,
),
FlSpot(
8,
1.5,
)
]
},
{
"title": "On Leave",
"volumeData": 1328,
"icon": Icons.ac_unit,
"totalStorage": "+ %5",
"color": Color(0xFFFFA113),
"percentage": 35,
"colors": [Color(0xfff12711), Color(0xfff5af19)],
"spots": [
FlSpot(
1,
1.3,
),
FlSpot(
2,
1.0,
),
FlSpot(
3,
4,
),
FlSpot(
4,
1.5,
),
FlSpot(
5,
1.0,
),
FlSpot(
6,
3,
),
FlSpot(
7,
1.8,
),
FlSpot(
8,
1.5,
)
]
},
{
"title": "Onboarding",
"volumeData": 1328,
"icon": Icons.ac_unit,
"totalStorage": "+ %8",
"color": Color(0xFFA4CDFF),
"percentage": 10,
"colors": [Color(0xff2980B9), Color(0xff6DD5FA)],
"spots": [
FlSpot(
1,
1.3,
),
FlSpot(
2,
5,
),
FlSpot(
3,
1.8,
),
FlSpot(
4,
6,
),
FlSpot(
5,
1.0,
),
FlSpot(
6,
2.2,
),
FlSpot(
7,
1.8,
),
FlSpot(
8,
1,
)
]
},
{
"title": "Open Position",
"volumeData": 1328,
"icon": Icons.ac_unit,
"totalStorage": "+ %8",
"color": Color(0xFFd50000),
"percentage": 10,
"colors": [Color(0xff93291E), Color(0xffED213A)],
"spots": [
FlSpot(
1,
3,
),
FlSpot(
2,
4,
),
FlSpot(
3,
1.8,
),
FlSpot(
4,
1.5,
),
FlSpot(
5,
1.0,
),
FlSpot(
6,
2.2,
),
FlSpot(
7,
1.8,
),
FlSpot(
8,
1.5,
)
]
},
{
"title": "Efficiency",
"volumeData": 5328,
"icon": Icons.ac_unit,
"totalStorage": "- %5",
"color": Color(0xFF00F260),
"percentage": 78,
"colors": [Color(0xff0575E6), Color(0xff00F260)],
"spots": [
FlSpot(
1,
1.3,
),
FlSpot(
2,
1.0,
),
FlSpot(
3,
1.8,
),
FlSpot(
4,
1.5,
),
FlSpot(
5,
1.0,
),
FlSpot(
6,
2.2,
),
FlSpot(
7,
1.8,
),
FlSpot(
8,
1.5,
)
]
}
];
//final List<double> yValues = [
// 2.3,
// 1.8,
// 1.9,
// 1.5,
// 1.0,
// 2.2,
// 1.8,
// 1.5,
//];

View File

@ -0,0 +1,21 @@
class Package {
final int id;
final String name;
final int count;
final int status;
Package(
{required this.id,
required this.name,
required this.count,
required this.status});
factory Package.fromJson(Map<String, dynamic> json) {
return Package(
id: json["id"] as int,
count: json["count"] as int,
status: json["status"] as int,
name: json["name"] as String,
);
}
}

View File

@ -0,0 +1,15 @@
import 'package:flutter/material.dart';
class QuickInfoData {
const QuickInfoData({
Key? key,
required this.color,
required this.icon,
required this.title,
required this.subtitle,
});
final Color color;
final IconData icon;
final String title, subtitle;
}

View File

@ -1,64 +0,0 @@
class SliderModel {
String? image;
String? text;
String? altText;
String? bAltText;
String? productImage;
int? kBackgroundColor;
SliderModel(this.image, this.text, this.altText, this.bAltText,
this.productImage, this.kBackgroundColor);
SliderModel.fromJson(Map<String, dynamic> json) {
image = json['image'];
kBackgroundColor = json['kBackgroundColor'];
text = json['text'];
altText = json['altText'];
bAltText = json['bAltText'];
productImage = json['productImage'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['image'] = this.image;
data['kBackgroundColor'] = this.kBackgroundColor;
data['text'] = this.text;
data['altText'] = this.altText;
data['bAltText'] = this.bAltText;
data['productImage'] = this.productImage;
return data;
}
}
List<SliderModel> slides =
slideData.map((item) => SliderModel.fromJson(item)).toList();
var slideData = [
{
"image": "assets/slides/background-1.jpeg",
"kBackgroundColor": 0xFF2c614f,
"text": "Welcome to the Smart Smart Admin Dashboard!",
"altText": "You can access & track your services in real-time.",
"bAltText": "Are you ready for the next generation AI supported Dashboard?",
"productImage": "assets/images/mockup.png"
},
{
"image": "assets/slides/background-2.jpeg",
"kBackgroundColor": 0xFF8a1a4c,
"text": "¡Bienvenido al tablero Smart Admin Dashboard!",
"altText": "Puede acceder y rastrear sus servicios en tiempo real.",
"bAltText":
"¿Estás listo para el panel de control impulsado por IA de próxima generación?",
"productImage": "assets/images/mockup-2.png"
},
{
"image": "assets/slides/background-3.jpeg",
"kBackgroundColor": 0xFF0ab3ec,
"text": "Willkommen im Smart Admin Dashboard!",
"altText":
"Sie können in Echtzeit auf Ihre Dienste zugreifen und diese verfolgen.",
"bAltText":
"Sind Sie bereit für das AI-unterstützte Dashboard der nächsten Generation?",
"productImage": "assets/images/mockup-3.png"
}
];

View File

@ -0,0 +1,30 @@
class Stats {
final int total_builds,
failed_builds,
avg_queue_wait_time,
avg_build_time,
repo_storage_size,
active_builds,
total_packages;
factory Stats.fromJson(Map<String, dynamic> json) {
return Stats(
total_builds: json["total_builds"] as int,
failed_builds: json["failed_builds"] as int,
avg_queue_wait_time: json["avg_queue_wait_time"] as int,
avg_build_time: json["avg_build_time"] as int,
repo_storage_size: json["repo_storage_size"] as int,
active_builds: json["active_builds"] as int,
total_packages: json["total_packages"] as int,
);
}
Stats(
{required this.total_builds,
required this.failed_builds,
required this.avg_queue_wait_time,
required this.avg_build_time,
required this.repo_storage_size,
required this.active_builds,
required this.total_packages});
}