added status
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
Scott E. Graves 2025-03-01 15:18:30 -06:00
parent bcda2abfd2
commit 968633a5b9
6 changed files with 38 additions and 20 deletions

View File

@ -166,7 +166,8 @@ void handlers::handle_get_mount_list(auto &&res) const {
void handlers::handle_get_mount_status(auto &&req, auto &&res) const {
REPERTORY_USES_FUNCTION_NAME();
auto prov = provider_type_from_string(req.get_param_value("type"));
auto type = req.get_param_value("type");
auto prov = provider_type_from_string(type);
auto status_name = app_config::get_provider_display_name(prov);
auto name = req.get_param_value("name");

View File

@ -17,7 +17,7 @@ class MyApp extends StatelessWidget {
return MaterialApp(
title: constants.app_title,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepOrange),
colorScheme: ColorScheme.fromSeed(seedColor: Colors.orange),
),
home: const MyHomePage(title: constants.app_title),
);

View File

@ -1,6 +1,6 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:repertory/types/mount_config.dart';
@ -11,6 +11,8 @@ class Mount with ChangeNotifier {
}
String get name => mountConfig.name;
String get path => mountConfig.path;
IconData get state => mountConfig.state;
String get type => mountConfig.type;
Future<void> _fetch() async {
@ -43,6 +45,7 @@ class Mount with ChangeNotifier {
}
mountConfig.updateStatus(jsonDecode(response.body));
notifyListeners();
}
Future<void> refresh() async {

View File

@ -1,16 +1,23 @@
import 'dart:convert';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
class MountConfig {
final String _name;
final String _type;
String _path = "";
Map<String, dynamic> _settings = {};
IconData _state = Icons.toggle_off;
Map<String, dynamic> _status = {};
final String _type;
MountConfig({required name, required type}) : _name = name, _type = type;
UnmodifiableMapView get settings => UnmodifiableMapView(_settings);
UnmodifiableMapView get status => UnmodifiableMapView(_status);
String get name => _name;
String get path => _path;
IconData get state => _state;
String get type => _type;
factory MountConfig.fromJson(String type, String name) {
@ -23,5 +30,7 @@ class MountConfig {
void updateStatus(Map<String, dynamic> status) {
_status = status;
_state = _status["Active"] as bool ? Icons.toggle_on : Icons.toggle_off;
_path = _status["Location"] as String;
}
}

View File

@ -8,14 +8,19 @@ class MountWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
child: Container(
height: 40,
color: Colors.blue,
child: Consumer<Mount>(
builder: (context, mount, widget) {
return Text('${mount.type} ${mount.name}');
},
),
child: Consumer<Mount>(
builder: (context, mount, widget) {
return ListTile(
isThreeLine: true,
leading: const Icon(Icons.settings),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [Text(mount.name), Text(mount.path)],
),
title: Text(mount.type),
trailing: Icon(mount.state),
);
},
),
);
}

View File

@ -5,10 +5,10 @@ packages:
dependency: transitive
description:
name: async
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
url: "https://pub.dev"
source: hosted
version: "2.13.0"
version: "2.12.0"
boolean_selector:
dependency: transitive
description:
@ -53,10 +53,10 @@ packages:
dependency: transitive
description:
name: fake_async
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
url: "https://pub.dev"
source: hosted
version: "1.3.3"
version: "1.3.2"
flutter:
dependency: "direct main"
description: flutter
@ -95,10 +95,10 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
url: "https://pub.dev"
source: hosted
version: "10.0.9"
version: "10.0.8"
leak_tracker_flutter_testing:
dependency: transitive
description:
@ -244,10 +244,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
url: "https://pub.dev"
source: hosted
version: "15.0.0"
version: "14.3.1"
web:
dependency: transitive
description: