<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>scheduledfile UI Component</title><link>https://community.telligent.com/community/11/w/api-documentation/67409/scheduledfile-ui-component</link><description /><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>scheduledfile UI Component</title><link>https://community.telligent.com/community/11/w/api-documentation/67409/scheduledfile-ui-component</link><pubDate>Tue, 19 Nov 2019 20:28:43 GMT</pubDate><guid isPermaLink="false">19980db5-8457-4baa-a548-7a23ff89ca50</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/api-documentation/67409/scheduledfile-ui-component#comments</comments><description>Current Revision posted to API Documentation by Ben Tiedt on 11/19/2019 20:28:43&lt;br /&gt;
&lt;hr class="generated-documentation-start" style="border-width:0;" /&gt;&lt;h3&gt;&lt;a id="jQuery_telligent_evolution_ui_components_scheduledfile" name="jQuery_telligent_evolution_ui_components_scheduledfile"&gt;&lt;/a&gt;jQuery.telligent.evolution.ui.components.scheduledfile&lt;/h3&gt;
&lt;p&gt;[[ui JavaScript API Module|UI Component]] which allows client-side declarative rendering of a scheduled script file execution&amp;#39;s status. Transforms the output from &lt;code&gt;core_v2_ui.ScheduledFile()&lt;/code&gt;, which is a &lt;code&gt;&amp;lt;span class=&amp;quot;ui-scheduledfile&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;/code&gt; stub. The default implementation uses the [[evolutionProgressIndicator jQuery Plugin|evolutionProgressIndicator plugin]]. [[ui JavaScript API Module|Overrides can be provided]] at the theme level to present file status differently.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Options" name="Options"&gt;&lt;/a&gt;Options&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;progresskey&lt;/code&gt;: Identifier matching the &lt;code&gt;ProgressKey&lt;/code&gt; passed to &lt;code&gt;core_v2_widget.ScheduleFile()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;percentcomplete&lt;/code&gt;: Optional initial percent complete&lt;/li&gt;
&lt;li&gt;&lt;code&gt;includepercentcomplete&lt;/code&gt;: Includes a progress bar displaying completion percentage reported by the script with context_v2_scheduledFile.Report()&lt;/li&gt;
&lt;li&gt;&lt;code&gt;includelatestmessage&lt;/code&gt;: Includes only the latest message reported by the script with &lt;code&gt;context_v2_scheduledFile.Report()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;includeallmessages&lt;/code&gt;: Includes a log of all messages reported by the script with &lt;code&gt;context_v2_scheduledFile.Report()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a id="Example" name="Example"&gt;&lt;/a&gt;Example&lt;/h3&gt;
&lt;p&gt;A barebones UI component override which would result in rendering a read-only message of &amp;#39;Indicator: [Key] [Percent]&amp;#39;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$.telligent.evolution.ui.components.scheduledfile = {
    setup: function() {},
    add: function(elm, options) {
        $(elm).html(&amp;#39;Indicator &amp;#39; + options.progresskey + &amp;#39; &amp;#39; + options.percentcomplete);
    }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;&lt;a id="Default_Implementation" name="Default_Implementation"&gt;&lt;/a&gt;Default Implementation&lt;/h3&gt;
&lt;p&gt;For reference purposes or as the basis for an override:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(function($){

    // Handle scheduleFile API messages and calling updates on the progress indicator
    function handleMessages(context) {
        messaging.subscribe(&amp;#39;scheduledFile.complete&amp;#39;, getMessageNamespace(context), function(data) {
            if (data.progressKey !== context.progressKey)
                return;

            context.indicator.evolutionProgressIndicator(&amp;#39;complete&amp;#39;, data);
            dispose(context);
        });

        messaging.subscribe(&amp;#39;scheduledFile.error&amp;#39;, getMessageNamespace(context), function(data) {
            if (data.progressKey !== context.progressKey)
                return;

            context.indicator.evolutionProgressIndicator(&amp;#39;error&amp;#39;, data ? data.message : null);
            dispose(context);
        });

        messaging.subscribe(&amp;#39;scheduledFile.progress&amp;#39;, getMessageNamespace(context), function(data) {
            if (data.progressKey !== context.progressKey)
                return;

            context.indicator.evolutionProgressIndicator(&amp;#39;progress&amp;#39;, data);
        });
    }

    function dispose(context) {
        setTimeout(function() {
            messaging.unsubscribe(getMessageNamespace(context));
        }, 100);
    }

    function getMessageNamespace(context) {
        return &amp;#39;messages-&amp;#39; + context.progressKey;
    }

    $.telligent.evolution.ui.components.scheduledfile = {
        setup: function () {

        },
        add: function (elm, options) {
            // Start monitoring the progress key to ensure ajax fallbacks are called
            // in case sockets disconnect so that scheduleFile messages are guaranteed to be raised
            $.telligent.evolution.scheduledFile.monitor(options.progresskey);

            // render an indicator
            var context = $.extend({}, {
                progressKey: options.progresskey,
                percentComplete: options.percentcomplete,
                log: JSON.parse(options.log),
                indicator: $(elm).evolutionProgressIndicator({
                    includePercentComplete: options.includepercentcomplete == &amp;#39;true&amp;#39;,
                    includeLatestMessage: options.includelatestmessage == &amp;#39;true&amp;#39;,
                    includeAllMessages: options.includeallmessages == &amp;#39;true&amp;#39;
                })
            });

            // If any initial progress or log messages at render-time, render those as well

            if(context.percentComplete &amp;amp;&amp;amp; context.percentComplete &amp;gt; 0) {
                context.indicator.evolutionProgressIndicator(&amp;#39;progress&amp;#39;, {
                    percentComplete: parseFloat(context.percentComplete)
                });
            }

            if(context.log) {
                for (var i = 0; i &amp;lt; context.log.length; i++) {
                    context.indicator.evolutionProgressIndicator(&amp;#39;progress&amp;#39;, {
                        message: context.log[i]
                    });
                }
            }

            handleMessages(context);
        }
    };

}(jQuery));
&lt;/code&gt;&lt;/pre&gt;

&lt;hr class="generated-documentation-end" style="border-width:0;" /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item></channel></rss>