mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
display loading indicator immediately when necessary
This commit is contained in:
@@ -41,7 +41,6 @@ interface State {
|
|||||||
stack: ActionStack;
|
stack: ActionStack;
|
||||||
inHome: boolean;
|
inHome: boolean;
|
||||||
currentApp: MenuItem | null;
|
currentApp: MenuItem | null;
|
||||||
isLoading: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -56,8 +55,7 @@ export class Root extends Widget<Props, State> {
|
|||||||
notifications: [],
|
notifications: [],
|
||||||
stack: [],
|
stack: [],
|
||||||
inHome: false,
|
inHome: false,
|
||||||
currentApp: null,
|
currentApp: null
|
||||||
isLoading: false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(env: Env, props: Props) {
|
constructor(env: Env, props: Props) {
|
||||||
@@ -77,7 +75,8 @@ export class Root extends Widget<Props, State> {
|
|||||||
|
|
||||||
// loading indicator
|
// loading indicator
|
||||||
this.env.ajax.on("rpc_status", this, status => {
|
this.env.ajax.on("rpc_status", this, status => {
|
||||||
this.updateState({ isLoading: status === "loading" });
|
const method = status === "loading" ? "remove" : "add";
|
||||||
|
(<any>this.refs.loading_indicator).classList[method]("d-none");
|
||||||
});
|
});
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<t t-widget="Notification" t-props="notif"/>
|
<t t-widget="Notification" t-props="notif"/>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<div class="o_loading" t-if="state.isLoading">Loading</div>
|
<div class="o_loading d-none" t-ref="loading_indicator">Loading</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div t-name="web.navbar" class="o_navbar" t-att-class="props.inHome ? 'o_navbar o_in_home' : 'o_navbar'">
|
<div t-name="web.navbar" class="o_navbar" t-att-class="props.inHome ? 'o_navbar o_in_home' : 'o_navbar'">
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ exports[`can be rendered (in home menu) 1`] = `
|
|||||||
<div class=\\"o_notification_container\\">
|
<div class=\\"o_notification_container\\">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class=\\"o_loading d-none\\">Loading</div>
|
||||||
</div>"
|
</div>"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ exports[`if url has action_id, will render action and navigate to proper menu_id
|
|||||||
<div class=\\"o_notification_container\\">
|
<div class=\\"o_notification_container\\">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class=\\"o_loading\\">Loading</div>
|
||||||
</div>"
|
</div>"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -174,6 +174,6 @@ exports[`start with no action => clicks on client action => discuss is rendered
|
|||||||
<div class=\\"o_notification_container\\">
|
<div class=\\"o_notification_container\\">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class=\\"o_loading d-none\\">Loading</div>
|
||||||
</div>"
|
</div>"
|
||||||
`;
|
`;
|
||||||
|
|||||||
Reference in New Issue
Block a user