Skip to content
Snippets Groups Projects
Commit e6eb3494 authored by Thomas Mortagne's avatar Thomas Mortagne
Browse files

XWIKI-13781: Filter application keep automatically reloading the log even when the job is finished

parent 2abe52fa
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<xwikidoc version="1.1">
<xwikidoc version="1.2" reference="Filter.ApplicationsPanelEntry" locale="">
<web>Filter</web>
<name>ApplicationsPanelEntry</name>
<language/>
......@@ -30,18 +30,15 @@
<creationDate>1384439645000</creationDate>
<parent>WebHome</parent>
<author>xwiki:XWiki.Admin</author>
<customClass/>
<contentAuthor>xwiki:XWiki.Admin</contentAuthor>
<date>1384439741000</date>
<contentUpdateDate>1384439693000</contentUpdateDate>
<date>1475757366000</date>
<contentUpdateDate>1475757366000</contentUpdateDate>
<version>1.1</version>
<title/>
<defaultTemplate/>
<validationScript/>
<comment/>
<minorEdit>false</minorEdit>
<syntaxId>xwiki/2.1</syntaxId>
<hidden/>
<hidden>false</hidden>
<content/>
<object>
<name>Filter.ApplicationsPanelEntry</name>
......@@ -90,7 +87,9 @@
<nameField/>
<validationScript/>
<content>
<contenttype/>
<disabled>0</disabled>
<editor>Text</editor>
<name>content</name>
<number>3</number>
<prettyName>Extension Content</prettyName>
......@@ -118,7 +117,9 @@
<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
</name>
<parameters>
<contenttype>PureText</contenttype>
<disabled>0</disabled>
<editor>PureText</editor>
<name>parameters</name>
<number>4</number>
<prettyName>Extension Parameters</prettyName>
......@@ -137,7 +138,7 @@
<prettyName>Extension Scope</prettyName>
<relationalStorage>0</relationalStorage>
<separator> </separator>
<separators> ,|</separators>
<separators>|, </separators>
<size>1</size>
<unmodifiable>0</unmodifiable>
<values>wiki=Current Wiki|user=Current User|global=Global</values>
......
......@@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<xwikidoc version="1.1">
<xwikidoc version="1.2" reference="Filter.FilterStreamDescriptorForm" locale="">
<web>Filter</web>
<name>FilterStreamDescriptorForm</name>
<language/>
......@@ -31,8 +31,8 @@
<parent>WebHome</parent>
<author>xwiki:XWiki.Admin</author>
<contentAuthor>xwiki:XWiki.Admin</contentAuthor>
<date>1396260007000</date>
<contentUpdateDate>1396260007000</contentUpdateDate>
<date>1475757366000</date>
<contentUpdateDate>1475757366000</contentUpdateDate>
<version>1.1</version>
<title/>
<comment/>
......
......@@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<xwikidoc version="1.1">
<xwikidoc version="1.2" reference="Filter.FilterStreamJob" locale="">
<web>Filter</web>
<name>FilterStreamJob</name>
<language/>
......@@ -30,150 +30,49 @@
<creationDate>1383901486000</creationDate>
<parent>WebHome</parent>
<author>xwiki:XWiki.Admin</author>
<customClass/>
<contentAuthor>xwiki:XWiki.Admin</contentAuthor>
<date>1384437477000</date>
<contentUpdateDate>1384436951000</contentUpdateDate>
<date>1475764483000</date>
<contentUpdateDate>1475764483000</contentUpdateDate>
<version>1.1</version>
<title/>
<defaultTemplate/>
<validationScript/>
<comment/>
<minorEdit>false</minorEdit>
<syntaxId>xwiki/2.1</syntaxId>
<hidden>true</hidden>
<content>{{velocity}}
#if ($xcontext.action == 'view')
## Include
#set ($discard = $xwiki.jsx.use('Filter.FilterStreamJob'))
(%id="filter_job_status"%)((()))
#end
{{/velocity}}
<content>{{template name="job_macros.vm"/}}
{{velocity wiki="false"}}
#if ($xcontext.action == 'get')
## Ajax
{{velocity output="false"}}
#set ($discard = $xwiki.jsfx.use('uicomponents/job/job.js', true))
{{/velocity}}
{{velocity}}
{{html}}
&lt;div id="filter_job_status"&gt;
#set($job = $services.filter.currentJob)
#if ($job)
## NOTE: We don't use #template because it currently registers the Velocity macros in a different namespace which makes
## them unavailable in the current wiki page or the current template. We also tried #parse but it "randomly" fails to
## register the Velocity macros from the parsed template. The only solution we found is to use #evaluate with #include
## but unfortunately this doesn't allow the template to be overridden from the skin.
#evaluate("#include('extension.vm')")
&lt;div class="extension-body"&gt;
Progress
&lt;div&gt;
#set ($jobStatusURL = $xwiki.getURL('FilterStreamJobJSON', 'get', $escapetool.url({
'outputSyntax': 'plain'
})))
&lt;div class="xcontent job-status" data-url="$jobStatusURL"&gt;
#set($jobStatus = $job.status)
#if ($jobStatus.state.name() == 'RUNNING')
#set($finished = $jobStatus.state.name() == 'FINISHED')
#if (!$finished)
#displayJobProgressBar($jobStatus)
#else
#if ($jobStatus.log.getLogs('ERROR').isEmpty())
&lt;div class="box successmessage"&gt;
Done.
&lt;/div&gt;
#else
&lt;div class="box errormessage"&gt;
Error has been found during the conversion !
&lt;/div&gt;
#end
#end
#printStatusLog($jobStatus)
&lt;/div&gt;
#displayJobStatusLog($jobStatus true)
&lt;/div&gt;
#end
&lt;/div&gt;
#end
{{/html}}
{{/velocity}}</content>
<object>
<name>Filter.FilterStreamJob</name>
<number>0</number>
<className>XWiki.JavaScriptExtension</className>
<guid>0133c9ad-7236-47a8-8a98-d2db76645ac5</guid>
<class>
<name>XWiki.JavaScriptExtension</name>
<customClass/>
<customMapping/>
<defaultViewSheet/>
<defaultEditSheet/>
<defaultWeb/>
<nameField/>
<validationScript/>
<cache>
<cache>0</cache>
<disabled>0</disabled>
<displayType>select</displayType>
<multiSelect>0</multiSelect>
<name>cache</name>
<number>5</number>
<prettyName>Caching policy</prettyName>
<relationalStorage>0</relationalStorage>
<separator> </separator>
<separators> ,|</separators>
<size>1</size>
<unmodifiable>0</unmodifiable>
<values>long|short|default|forbid</values>
<classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
</cache>
<code>
<disabled>0</disabled>
<name>code</name>
<number>2</number>
<prettyName>Code</prettyName>
<rows>20</rows>
<size>50</size>
<unmodifiable>0</unmodifiable>
<classType>com.xpn.xwiki.objects.classes.TextAreaClass</classType>
</code>
<name>
<disabled>0</disabled>
<name>name</name>
<number>1</number>
<prettyName>Name</prettyName>
<size>30</size>
<unmodifiable>0</unmodifiable>
<classType>com.xpn.xwiki.objects.classes.StringClass</classType>
</name>
<parse>
<disabled>0</disabled>
<displayFormType>select</displayFormType>
<displayType>yesno</displayType>
<name>parse</name>
<number>4</number>
<prettyName>Parse content</prettyName>
<unmodifiable>0</unmodifiable>
<classType>com.xpn.xwiki.objects.classes.BooleanClass</classType>
</parse>
<use>
<cache>0</cache>
<disabled>0</disabled>
<displayType>select</displayType>
<multiSelect>0</multiSelect>
<name>use</name>
<number>3</number>
<prettyName>Use this extension</prettyName>
<relationalStorage>0</relationalStorage>
<separator> </separator>
<separators> ,|</separators>
<size>1</size>
<unmodifiable>0</unmodifiable>
<values>currentPage=Always on this page|onDemand=On demand|always=Always on this wiki</values>
<classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
</use>
</class>
<property>
<cache>long</cache>
</property>
<property>
<code>new Ajax.PeriodicalUpdater('filter_job_status', '${xwiki.getURL('FilterStreamJob', 'get')}', {
parameters:
{
type: this.value,
outputSyntax: 'plain',
input: 'true'
}
});</code>
</property>
<property>
<name/>
</property>
<property>
<parse>1</parse>
</property>
<property>
<use>onDemand</use>
</property>
</object>
</xwikidoc>
<?xml version="1.0" encoding="UTF-8"?>
<!--
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<xwikidoc version="1.2" reference="Filter.FilterStreamJobJSON" locale="">
<web>Filter</web>
<name>FilterStreamJobJSON</name>
<language/>
<defaultLanguage/>
<translation>0</translation>
<creator>xwiki:XWiki.Admin</creator>
<creationDate>1475763477000</creationDate>
<author>xwiki:XWiki.Admin</author>
<contentAuthor>xwiki:XWiki.Admin</contentAuthor>
<date>1475764281000</date>
<contentUpdateDate>1475764281000</contentUpdateDate>
<version>1.1</version>
<title/>
<comment/>
<minorEdit>false</minorEdit>
<syntaxId>xwiki/2.1</syntaxId>
<hidden>false</hidden>
<content>{{template name="job_macros.vm"/}}
{{velocity output="false"}}
#macro(filterStreamJobMessage $jobStatus)
#set($finished = $jobStatus.state.name() == 'FINISHED')
#if ($finished)
#if ($jobStatus.log.getLogs('ERROR').isEmpty())
&lt;div class="box successmessage"&gt;
Done toto.
&lt;/div&gt;
#else
&lt;div class="box errormessage"&gt;
Error has been found during the conversion toto !
&lt;/div&gt;
#end
#end
#end
{{/velocity}}
{{velocity wiki="false"}}
#if ($xcontext.action == 'get')
#set($job = $services.filter.currentJob)
#getJobStatusJSON($job.status $json)
#set($jobStatus = $job.status)
#set ($json.message = "#filterStreamJobMessage($jobStatus)")
$response.setContentType('application/json')
$jsontool.serialize($json)
#end
{{/velocity}}</content>
</xwikidoc>
......@@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<xwikidoc version="1.1">
<xwikidoc version="1.2" reference="Filter.WebHome" locale="">
<web>Filter</web>
<name>WebHome</name>
<language/>
......@@ -31,8 +31,8 @@
<parent>Main.WebHome</parent>
<author>xwiki:XWiki.Admin</author>
<contentAuthor>xwiki:XWiki.Admin</contentAuthor>
<date>1417442821000</date>
<contentUpdateDate>1417442821000</contentUpdateDate>
<date>1475761760000</date>
<contentUpdateDate>1475761760000</contentUpdateDate>
<version>1.1</version>
<title>Filter streams</title>
<comment/>
......@@ -41,13 +41,6 @@
<hidden>true</hidden>
<content>{{warning}}Filter module is still young and experimental and while exporting should be safe enough, importing can be more risky for the current instance.{{/warning}}
{{template name="extension.vm" output="false"/}}
{{velocity output="false"}}
#set ($discard = $xwiki.ssfx.use('uicomponents/extension/extension.css', true))
#set ($discard = $xwiki.jsfx.use('uicomponents/extension/extension.js', true))
{{/velocity}}
{{include reference="FilterStreamDescriptorForm"/}}
{{velocity output="true"}}
......@@ -99,7 +92,9 @@
#set($job = $services.filter.startConvert($input, $inputProperties, $output, $outputProperties))
#end
#if ($job)
{{success}}Conversion started.{{/success}}
#if (!$sourceStandardInput)
{{success}}Conversion started.{{/success}}
#end
#else
#set ($lastError = $services.filter.lastError)
#if ($lastError)
......@@ -118,49 +113,61 @@
#end
{{/velocity}}
== Current conversion
{{include reference="FilterStreamJob"/}}
== Configuration ==
{{velocity}}
{{html}}
&lt;form class="xform" method="post"&gt;
&lt;div id="filter_form"&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;label for="filter_input_select"&gt;Input type&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;
&lt;select name="input" id="filter_input_type"&gt;
#foreach($type in $services.filter.availableInputStreams)
&lt;option value="$escapetool.xml($type.serialize())"#if($type.serialize() == $input)selected="selected"#end&gt;$services.filter.getInputFilterStreamDescriptor($type).name ($type)&lt;/option&gt;
#if (!$input)
#set($input = $type.serialize())
&lt;fieldset&gt;
&lt;legend&gt;Input&lt;/legend&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;label for="filter_input_select"&gt;Input type&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;
&lt;select name="input" id="filter_input_type"&gt;
#foreach($type in $services.filter.availableInputStreams)
&lt;option value="$escapetool.xml($type.serialize())"#if($type.serialize() == $input)selected="selected"#end&gt;$services.filter.getInputFilterStreamDescriptor($type).name ($type)&lt;/option&gt;
#if (!$input)
#set($input = $type.serialize())
#end
#end
#end
&lt;/select&gt;
&lt;/dd&gt;
#if ($input)
&lt;dt&gt;&lt;label&gt;Input configuration&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;
#filterDescriptorForm($services.filter.getInputFilterStreamDescriptor($input), 'filter_input_properties')
&lt;/dd&gt;
#end
&lt;/select&gt;
&lt;/dd&gt;
#if ($input)
&lt;dt&gt;&lt;label&gt;Input configuration&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;
#filterDescriptorForm($services.filter.getInputFilterStreamDescriptor($input), 'filter_input_properties')
&lt;/dd&gt;
#end
&lt;/dl&gt;
&lt;/fieldset&gt;
&lt;dt&gt;&lt;label for="filter_output_select"&gt;Output type&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;
&lt;select name="output" id="filter_output_type"&gt;
#foreach($type in $services.filter.availableOutputStreams)
&lt;option value="$escapetool.xml($type.serialize())"#if($type.serialize() == $output)selected="selected"#end&gt;$services.filter.getOutputFilterStreamDescriptor($type).name ($type)&lt;/option&gt;
#if (!$output)
#set($output = $type.serialize())
&lt;fieldset&gt;
&lt;legend&gt;Output&lt;/legend&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;label for="filter_output_select"&gt;Output type&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;
&lt;select name="output" id="filter_output_type"&gt;
#foreach($type in $services.filter.availableOutputStreams)
&lt;option value="$escapetool.xml($type.serialize())"#if($type.serialize() == $output)selected="selected"#end&gt;$services.filter.getOutputFilterStreamDescriptor($type).name ($type)&lt;/option&gt;
#if (!$output)
#set($output = $type.serialize())
#end
#end
#end
&lt;/select&gt;
&lt;/dd&gt;
#if ($output)
&lt;dt&gt;&lt;label&gt;Output configuration&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;
#filterDescriptorForm($services.filter.getOutputFilterStreamDescriptor($output), 'filter_output_properties')
&lt;/dd&gt;
#end
&lt;/dl&gt;
&lt;/select&gt;
&lt;/dd&gt;
#if ($output)
&lt;dt&gt;&lt;label&gt;Output configuration&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;
#filterDescriptorForm($services.filter.getOutputFilterStreamDescriptor($output), 'filter_output_properties')
&lt;/dd&gt;
#end
&lt;/dl&gt;
&lt;/fieldset&gt;
&lt;p&gt;
&lt;input class="button" type="submit" name="convert" value="Convert"/&gt;
......@@ -193,14 +200,16 @@
<prettyName>Caching policy</prettyName>
<relationalStorage>0</relationalStorage>
<separator> </separator>
<separators> ,|</separators>
<separators>|, </separators>
<size>1</size>
<unmodifiable>0</unmodifiable>
<values>long|short|default|forbid</values>
<classType>com.xpn.xwiki.objects.classes.StaticListClass</classType>
</cache>
<code>
<contenttype>PureText</contenttype>
<disabled>0</disabled>
<editor>PureText</editor>
<name>code</name>
<number>2</number>
<prettyName>Code</prettyName>
......@@ -238,7 +247,7 @@
<prettyName>Use this extension</prettyName>
<relationalStorage>0</relationalStorage>
<separator> </separator>
<separators> ,|</separators>
<separators>|, </separators>
<size>1</size>
<unmodifiable>0</unmodifiable>
<values>currentPage|onDemand|always</values>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment