Yes, there is a way to achieve this. Basically you need to hide the modal window, show the spinner on calling the webservice and show toast message.
1) You need to add a CSS file in the static resource.Having below code. The CSS file will help you over write the app.css style class in the modal.
.slds-fade-in-open {
visibility: hidden !important;
}
.slds-modal__content {
background-color: transparent;
}
.slds-modal__container{
background-color: transparent;
}
.slds-spinner_container{
background-color: transparent;
background: transparent;
}
Reference to add CSS to static resource
2) Add "force:lightningQuickActionWithoutHeader" to your interfaces i.e. implements="...".
3) Add toat message to your controllers.
component:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickActionWithoutHeader" access="global"
controller="SubmitChangeRequestController">
<aura:attribute name="hideSpinner" type="boolean" default="false"/>
<aura:attribute name="recordId" type="String"/>
<ltng:require styles="{!$Resource.SubmitCrCss}"/>
<aura:handler name="init" value="{!this}" action="{!c.doinIt}"/>
<div class="invisibleClass">
<aura:if isTrue="{! v.hideSpinner }">
<div aura:id="spinnerId" class="slds-spinner_container">
<div class="slds-spinner--brand slds-spinner slds-spinner--large slds-is-relative" role="alert">
<span class="slds-assistive-text">Loading</span>
<div class="slds-spinner__dot-a"></div>
<div class="slds-spinner__dot-b"></div>
</div>
</div>
</aura:if>
</div>
</aura:component>
Js:
({
doinIt : function(component, event, helper) {
component.set("v.hideSpinner",true);
var recId = component.get("v.recordId");
var action = component.get("c.updateCR");
action.setParams({
recId :recId
});
action.setCallback(this, function (response) {
var retVal = response.getReturnValue();
if(retVal == 'A'){
component.set("v.hideSpinner",false);
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
Title:'title',
type:'success',
message:'message'
});
$A.get("e.force:closeQuickAction").fire();
toastEvent.fire();
$A.get('e.force:refreshView').fire();
}else{
component.set("v.hideSpinner",false);
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
Title:'title',
type:'info_alt',
message:'Some error occured'
});
$A.get("e.force:closeQuickAction").fire();
toastEvent.fire();
$A.get('e.force:refreshView').fire();
}
});
$A.enqueueAction(action);
}
})
Thanks
Ranjit