mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-07-31 13:18:46 +00:00
fix: refresh all rows on plugin install (fixes dependencies showing up as not installed)
This commit is contained in:
parent
67e2ade501
commit
9bdda7d63d
2 changed files with 9 additions and 29 deletions
|
@ -49,9 +49,8 @@ pub enum PluginStoreMsg {
|
||||||
Refresh,
|
Refresh,
|
||||||
/// called by Refresh
|
/// called by Refresh
|
||||||
DoRefresh,
|
DoRefresh,
|
||||||
Install(Plugin, relm4::Sender<StoreRowModelMsg>),
|
Install(Plugin),
|
||||||
InstallFromDetails(Plugin),
|
InstallDownload(Vec<Plugin>),
|
||||||
InstallDownload(Vec<Plugin>, relm4::Sender<StoreRowModelMsg>),
|
|
||||||
Remove(Plugin),
|
Remove(Plugin),
|
||||||
SetEnabled(PluginStoreSignalSource, Plugin, bool),
|
SetEnabled(PluginStoreSignalSource, Plugin, bool),
|
||||||
ShowDetails(usize),
|
ShowDetails(usize),
|
||||||
|
@ -291,22 +290,7 @@ impl AsyncComponent for PluginStore {
|
||||||
self.refresh_plugin_rows();
|
self.refresh_plugin_rows();
|
||||||
self.set_refreshing(false);
|
self.set_refreshing(false);
|
||||||
}
|
}
|
||||||
Self::Input::InstallFromDetails(plugin) => {
|
Self::Input::Install(plugin) => {
|
||||||
if let Some(row) = self
|
|
||||||
.plugin_rows
|
|
||||||
.as_mut()
|
|
||||||
.unwrap()
|
|
||||||
.guard()
|
|
||||||
.iter()
|
|
||||||
.find(|row| row.is_some_and(|row| row.plugin.appid == plugin.appid))
|
|
||||||
.flatten()
|
|
||||||
{
|
|
||||||
sender.input(Self::Input::Install(plugin, row.input_sender.clone()))
|
|
||||||
} else {
|
|
||||||
error!("could not find corresponding listbox row")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Self::Input::Install(plugin, row_sender) => {
|
|
||||||
self.set_locked(true);
|
self.set_locked(true);
|
||||||
let mut plugins = vec![plugin];
|
let mut plugins = vec![plugin];
|
||||||
for dep in plugins[0].dependencies.clone().unwrap_or_default() {
|
for dep in plugins[0].dependencies.clone().unwrap_or_default() {
|
||||||
|
@ -333,9 +317,9 @@ impl AsyncComponent for PluginStore {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sender.input(Self::Input::InstallDownload(plugins, row_sender))
|
sender.input(Self::Input::InstallDownload(plugins))
|
||||||
}
|
}
|
||||||
Self::Input::InstallDownload(plugins, row_sender) => {
|
Self::Input::InstallDownload(plugins) => {
|
||||||
for plugin in plugins {
|
for plugin in plugins {
|
||||||
let mut plugin = plugin.clone();
|
let mut plugin = plugin.clone();
|
||||||
match plugin.exec_url.as_ref() {
|
match plugin.exec_url.as_ref() {
|
||||||
|
@ -382,7 +366,7 @@ impl AsyncComponent for PluginStore {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
row_sender.emit(StoreRowModelMsg::Refresh(true, false));
|
self.refresh_plugin_rows();
|
||||||
self.details
|
self.details
|
||||||
.emit(StoreDetailMsg::Refresh(plugin.appid, true, false));
|
.emit(StoreDetailMsg::Refresh(plugin.appid, true, false));
|
||||||
}
|
}
|
||||||
|
@ -534,7 +518,7 @@ impl AsyncComponent for PluginStore {
|
||||||
.launch(())
|
.launch(())
|
||||||
.forward(sender.input_sender(), move |msg| match msg {
|
.forward(sender.input_sender(), move |msg| match msg {
|
||||||
StoreDetailOutMsg::GoBack => Self::Input::ShowPluginList,
|
StoreDetailOutMsg::GoBack => Self::Input::ShowPluginList,
|
||||||
StoreDetailOutMsg::Install(plugin) => Self::Input::InstallFromDetails(plugin),
|
StoreDetailOutMsg::Install(plugin) => Self::Input::Install(plugin),
|
||||||
StoreDetailOutMsg::Remove(plugin) => Self::Input::Remove(plugin),
|
StoreDetailOutMsg::Remove(plugin) => Self::Input::Remove(plugin),
|
||||||
StoreDetailOutMsg::SetEnabled(plugin, enabled) => {
|
StoreDetailOutMsg::SetEnabled(plugin, enabled) => {
|
||||||
Self::Input::SetEnabled(PluginStoreSignalSource::Detail, plugin, enabled)
|
Self::Input::SetEnabled(PluginStoreSignalSource::Detail, plugin, enabled)
|
||||||
|
@ -554,9 +538,7 @@ impl AsyncComponent for PluginStore {
|
||||||
AsyncFactoryVecDeque::builder()
|
AsyncFactoryVecDeque::builder()
|
||||||
.launch(widgets.listbox.clone())
|
.launch(widgets.listbox.clone())
|
||||||
.forward(sender.input_sender(), move |msg| match msg {
|
.forward(sender.input_sender(), move |msg| match msg {
|
||||||
StoreRowModelOutMsg::Install(appid, row_sender) => {
|
StoreRowModelOutMsg::Install(appid) => Self::Input::Install(appid),
|
||||||
Self::Input::Install(appid, row_sender)
|
|
||||||
}
|
|
||||||
StoreRowModelOutMsg::Remove(appid) => Self::Input::Remove(appid),
|
StoreRowModelOutMsg::Remove(appid) => Self::Input::Remove(appid),
|
||||||
StoreRowModelOutMsg::SetEnabled(plugin, enabled) => {
|
StoreRowModelOutMsg::SetEnabled(plugin, enabled) => {
|
||||||
Self::Input::SetEnabled(PluginStoreSignalSource::Row, plugin, enabled)
|
Self::Input::SetEnabled(PluginStoreSignalSource::Row, plugin, enabled)
|
||||||
|
|
|
@ -36,7 +36,7 @@ pub enum StoreRowModelMsg {
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum StoreRowModelOutMsg {
|
pub enum StoreRowModelOutMsg {
|
||||||
Install(Plugin, relm4::Sender<StoreRowModelMsg>),
|
Install(Plugin),
|
||||||
Remove(Plugin),
|
Remove(Plugin),
|
||||||
SetEnabled(Plugin, bool),
|
SetEnabled(Plugin, bool),
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,6 @@ impl AsyncFactoryComponent for StoreRowModel {
|
||||||
sender
|
sender
|
||||||
.output(Self::Output::Install(
|
.output(Self::Output::Install(
|
||||||
plugin.clone(),
|
plugin.clone(),
|
||||||
sender.input_sender().clone()
|
|
||||||
))
|
))
|
||||||
.expect(SENDER_IO_ERR_MSG);
|
.expect(SENDER_IO_ERR_MSG);
|
||||||
}
|
}
|
||||||
|
@ -142,7 +141,6 @@ impl AsyncFactoryComponent for StoreRowModel {
|
||||||
sender
|
sender
|
||||||
.output(Self::Output::Install(
|
.output(Self::Output::Install(
|
||||||
plugin.clone(),
|
plugin.clone(),
|
||||||
sender.input_sender().clone()
|
|
||||||
))
|
))
|
||||||
.expect(SENDER_IO_ERR_MSG);
|
.expect(SENDER_IO_ERR_MSG);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue