Compare commits

..

No commits in common. "e886940999ed3196359030340816139702baf491" and "7d1574d0425bb7e2bbe77e4d6255eadcc1033519" have entirely different histories.

4 changed files with 4 additions and 53 deletions

View File

@ -64,10 +64,9 @@ private:
void handle_get_mount_status(auto &&req, auto &&res) const;
void handle_post_mount(auto &&req, auto &&res) const;
static auto read_process(provider_type prov, std::string_view name,
std::string_view command)
[[nodiscard]] static auto read_process(provider_type prov,
std::string_view name,
std::string_view command)
-> std::vector<std::string>;
};
} // namespace repertory::ui

View File

@ -83,9 +83,6 @@ handlers::handlers(mgmt_app_config *config, httplib::Server *server)
handle_get_mount_status(req, res);
});
server->Post("/api/v1/mount",
[this](auto &&req, auto &&res) { handle_post_mount(req, res); });
event_system::instance().start();
static std::atomic<httplib::Server *> this_server{server_};
@ -203,18 +200,6 @@ void handlers::handle_get_mount_status(auto &&req, auto &&res) const {
res.status = http_error_codes::ok;
}
void handlers::handle_post_mount(auto &&req, auto &&res) const {
auto type = req.get_param_value("type");
auto name = req.get_param_value("name");
auto unmount = utils::string::to_bool(req.get_param_value("unmount"));
auto prov = provider_type_from_string(type);
if (unmount) {
read_process(prov, name, "-unmount");
}
res.status = http_error_codes::ok;
}
auto handlers::read_process(provider_type prov, std::string_view name,
std::string_view command)
-> std::vector<std::string> {

View File

@ -48,18 +48,6 @@ class Mount with ChangeNotifier {
notifyListeners();
}
Future<void> mount(bool unmount) async {
await http.post(
Uri.parse(
Uri.encodeFull(
'${Uri.base.origin}/api/v1/mount?unmount=$unmount&name=$name&type=$type',
),
),
);
return refresh();
}
Future<void> refresh() async {
await _fetch();
return _fetchStatus();

View File

@ -14,7 +14,6 @@ class MountWidget extends StatefulWidget {
class _MountWidgetState extends State<MountWidget> {
Timer? _timer;
bool _enabled = true;
@override
Widget build(BuildContext context) {
@ -58,27 +57,7 @@ class _MountWidgetState extends State<MountWidget> {
mount.state,
color: isActive ? Colors.blue : Colors.grey,
),
onPressed:
_enabled
? () async {
setState(() {
_enabled = false;
});
if (isActive) {
mount.mount(isActive).then((_) {
setState(() {
_enabled = true;
});
});
return;
}
setState(() {
_enabled = false;
});
}
: null,
onPressed: () {},
),
);
},