You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: addon/services/modals-manager.js
+88-3
Original file line number
Diff line number
Diff line change
@@ -276,6 +276,44 @@ import {defer} from 'rsvp';
276
276
*
277
277
* **IMPORTANT** Here `options.promises` is a list of _FUNCTIONS_ that returns Promises!
278
278
*
279
+
* ### `process`
280
+
*
281
+
* This modal is used to show a "placeholder" while some process is running. This modal doesn't have any controls like confirm/decline-buttons in the footer or "×" in the header and can't be closed by pressing Esc or clicking somewhere outside a modal. Modal will be confirmed and self-closed after provided promise (`process`) is fulfilled or it will be declined (and self-closed) if it becomes rejected.
282
+
*
283
+
* ```js
284
+
* import Controller from '@ember/controller';
285
+
* import {inject as service} from '@ember/service';
286
+
* import {get} from '@ember/object';
287
+
* import {Promise} from 'rsvp';
288
+
*
289
+
* export default Controller.extend({
290
+
* modalsManager: service(),
291
+
*
292
+
* actions: {
293
+
* showProcessModal() {
294
+
* get(this, 'modalsManager')
295
+
* .process({
296
+
* body: 'Some text goes here',
297
+
* iconClass: 'text-center fa fa-spinner fa-spin fa-3x fa-fw',
298
+
* title: '',
299
+
* // this is required
300
+
* process: () => new Promise(resolve => setTimeout(resolve(1), 100))
301
+
* })
302
+
* .then(result => {
303
+
* // called after `process` is resolved
304
+
* // here "result" is value of fulfilled Promise
305
+
* })
306
+
* .catch(error => {
307
+
* // called after `process` is rejected
308
+
* // here "error" is a reason why last promise was rejected
309
+
* });
310
+
* }
311
+
* }
312
+
* });
313
+
* ```
314
+
*
315
+
* **IMPORTANT** Here `options.process` is a _FUNCTION_ that return Promise!
316
+
*
279
317
* ## Go Pro
280
318
*
281
319
* ### Custom components for `title`, `body` and `footer`
@@ -622,7 +660,7 @@ import {defer} from 'rsvp';
622
660
*
623
661
* #### Title Component
624
662
*
625
-
* It takes a single parameter options. Its value is an object passed to the modalsManager.progress.
663
+
* It takes a single parameter `options`. Its value is an object passed to the `modalsManager.progress`.
626
664
*
627
665
* ```hbs
628
666
* <h4 class="modal-title"><i class="glyphicon glyphicon-info-sign"></i> Custom Progress Title Component</h4>
@@ -653,6 +691,45 @@ import {defer} from 'rsvp';
653
691
* <p>Custom Progress Footer Component</p>
654
692
* ```
655
693
*
694
+
* ### `process`
695
+
*
696
+
* ```js
697
+
* import Controller from '@ember/controller';
698
+
* import {inject as service} from '@ember/service';
699
+
* import {get} from '@ember/object';
700
+
* import {Promise} from 'rsvp';
701
+
*
702
+
* export default Controller.extend({
703
+
* modalsManager: service(),
704
+
*
705
+
* actions: {
706
+
* showProcessModal() {
707
+
* get(this, 'modalsManager')
708
+
* .process({
709
+
* bodyComponent: 'custom-process-body',
710
+
* headerComponent: 'custom-process-footer',
711
+
* footerComponent: 'custom-process-header',
712
+
* process: () => new Promise(resolve => setTimeout(resolve(1), 100))
713
+
* })
714
+
* .then(result => {})
715
+
* .catch(error => {});
716
+
* }
717
+
* }
718
+
* });
719
+
* ```
720
+
*
721
+
* #### Title Component
722
+
*
723
+
* It takes a single parameter `options`. Its value is an object passed to the `modalsManager.process`.
724
+
*
725
+
* #### Body Component
726
+
*
727
+
* It takes a single parameter `options`. Its value is an object passed to the `modalsManager.process`.
728
+
*
729
+
* #### Footer Component
730
+
*
731
+
* It takes a single parameter `options`. Its value is an object passed to the `modalsManager.process`.
0 commit comments