Home: Get weather directly without reload

This commit is contained in:
nathan 2023-03-15 11:02:42 -06:00
parent 17018a7a24
commit a169c39373
4 changed files with 7 additions and 3 deletions

View File

@ -635,6 +635,10 @@ class home_ui
// Update client side
$update = array('attributes' => $attributes);
if($content && is_array($content))
{
$update['attributes'] = array_merge_recursive($update['attributes'], $content);
}
// New portlet? Flag going straight to edit mode
if($add)

View File

@ -103,6 +103,7 @@ class home_weather_portlet extends home_portlet
public function exec($id = null, Etemplate &$etemplate = null)
{
return ['settings' => $this->get_value()];
}
/**

View File

@ -127,8 +127,7 @@ export class Et2PortletFavorite extends Et2Portlet
return super.update_settings(settings)
.then(result =>
{
// Response did not ask for settings, and was not understandable for us
if(result == false && !this.nm)
if(!this.nm)
{
// If child was added recently (not loaded in normal reload), resize them all
etemplate2.getByTemplate("home.favorite").forEach(et => (<etemplate2>et).resize(undefined))

View File

@ -131,7 +131,7 @@ export class Et2PortletWeather extends Et2Portlet
const current = this.settings?.weather?.current || {weather: [{icon: "question-lg"}], temp: {temp: "?"}};
// Get the forecast, excluding today
let list = this.settings.weather && (Object.values(this.settings?.weather?.list || {}).slice(1) || []);
let list = this.settings.weather && (Object.values(this.settings?.weather?.list || {}).slice(1) || []) || [];
return html`
<div