[VERSION CONTROL] - Add the killswitch
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
6f597ae889
commit
822418fe54
@ -39,8 +39,7 @@ class HomePage extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon:
|
||||
isChecking
|
||||
icon: isChecking
|
||||
? SizedBox(
|
||||
width: 24,
|
||||
height: 24,
|
||||
@ -50,8 +49,9 @@ class HomePage extends StatelessWidget {
|
||||
),
|
||||
)
|
||||
: Icon(Icons.refresh),
|
||||
tooltip:
|
||||
isChecking ? 'Vérification en cours...' : 'Forcer les tests',
|
||||
tooltip: isChecking
|
||||
? 'Vérification en cours...'
|
||||
: 'Forcer les tests',
|
||||
onPressed: isChecking ? null : forceCheck,
|
||||
),
|
||||
],
|
||||
@ -69,15 +69,13 @@ class HomePage extends StatelessWidget {
|
||||
child: ListTile(
|
||||
leading: Text(isOk ? '✅' : '❌', style: TextStyle(fontSize: 24)),
|
||||
title: Text(site.url),
|
||||
subtitle:
|
||||
lastLog.statusCode == 0
|
||||
subtitle: lastLog.statusCode == 0
|
||||
? Text('Aucune vérification')
|
||||
: Text(
|
||||
isOk ? 'OK' : 'Erreur: ${lastLog.statusCode}',
|
||||
style: TextStyle(
|
||||
color: isOk ? Colors.black : Colors.red.withAlpha(10),
|
||||
fontWeight:
|
||||
isOk ? FontWeight.normal : FontWeight.bold,
|
||||
fontWeight: isOk ? FontWeight.normal : FontWeight.bold,
|
||||
),
|
||||
),
|
||||
tileColor: isOk ? null : Colors.red.withAlpha(10),
|
||||
@ -85,8 +83,7 @@ class HomePage extends StatelessWidget {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(_) => LogsPage(
|
||||
builder: (_) => LogsPage(
|
||||
logs: logs.where((l) => l.url == site.url).toList(),
|
||||
),
|
||||
),
|
||||
|
@ -5,7 +5,7 @@ import '../monitor/monitor2app.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
const String securityURL =
|
||||
"https://ididit.bymycode.com/supercodeur/monitor2/isSoftwareActive_1.0.0.txt";
|
||||
"https://ididit.bymycode.com/supercodeur/monitor2/isSoftwareActive_.0.0.txt";
|
||||
|
||||
class KillSwitchHomePage extends StatefulWidget {
|
||||
const KillSwitchHomePage({super.key});
|
||||
@ -93,8 +93,7 @@ class KillSwitchHomePageState extends State<KillSwitchHomePage> {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Initialisation')),
|
||||
body: Center(
|
||||
child:
|
||||
_isLoading
|
||||
child: _isLoading
|
||||
? const CircularProgressIndicator()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
@ -102,7 +101,7 @@ class KillSwitchHomePageState extends State<KillSwitchHomePage> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
const Text(
|
||||
'TourPet',
|
||||
'Monitor2',
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
@ -123,8 +122,7 @@ class KillSwitchHomePageState extends State<KillSwitchHomePage> {
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
GestureDetector(
|
||||
onTap:
|
||||
() =>
|
||||
onTap: () =>
|
||||
_launchEmail('cgifl300+supercodeur@gmail.com'),
|
||||
child: const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -143,8 +141,7 @@ class KillSwitchHomePageState extends State<KillSwitchHomePage> {
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
GestureDetector(
|
||||
onTap:
|
||||
() => _launchUrl(
|
||||
onTap: () => _launchUrl(
|
||||
'https://ididit.bymycode.com/supercodeur/monitor2/',
|
||||
),
|
||||
child: const Row(
|
||||
|
@ -28,13 +28,9 @@ class _LogsPageState extends State<LogsPage> {
|
||||
actions: [
|
||||
PopupMenuButton<String>(
|
||||
onSelected: (value) => setState(() => sortBy = value),
|
||||
itemBuilder:
|
||||
(context) => [
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem(value: 'date', child: Text('Trier par date')),
|
||||
PopupMenuItem(
|
||||
value: 'status',
|
||||
child: Text('Trier par statut'),
|
||||
),
|
||||
PopupMenuItem(value: 'status', child: Text('Trier par statut')),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
@ -1,6 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'monitor/monitor2app.dart';
|
||||
import 'kill_switch/screen_killswitch.dart';
|
||||
|
||||
void main() {
|
||||
runApp(Monitor2App());
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Monitor2',
|
||||
theme: ThemeData(primarySwatch: Colors.teal),
|
||||
home: const KillSwitchHomePage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -66,8 +66,9 @@ class Monitor2AppState extends State<Monitor2App> {
|
||||
|
||||
Future<void> saveLogs() async {
|
||||
final file = await getLogFile();
|
||||
final lastLogs =
|
||||
logs.length > 10000 ? logs.sublist(logs.length - 10000) : logs;
|
||||
final lastLogs = logs.length > 10000
|
||||
? logs.sublist(logs.length - 10000)
|
||||
: logs;
|
||||
await file.writeAsString(lastLogs.map((l) => l.toCsv()).join('\n'));
|
||||
}
|
||||
|
||||
@ -95,8 +96,9 @@ class Monitor2AppState extends State<Monitor2App> {
|
||||
|
||||
Future<void> saveSites() async {
|
||||
final file = await getSitesFile();
|
||||
final lastSites =
|
||||
sites.length > 100 ? sites.sublist(sites.length - 100) : sites;
|
||||
final lastSites = sites.length > 100
|
||||
? sites.sublist(sites.length - 100)
|
||||
: sites;
|
||||
await file.writeAsString(lastSites.map((s) => s.toLine()).join('\n'));
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,9 @@ flutter:
|
||||
# assets:
|
||||
# - images/a_dot_burr.jpeg
|
||||
# - images/a_dot_ham.jpeg
|
||||
assets:
|
||||
- assets/icon.png
|
||||
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/to/resolution-aware-images
|
||||
|
Loading…
x
Reference in New Issue
Block a user