Merge pull request #3943 from guerler/show_default_value_for_runtime_values

Show default value for runtime values
This commit is contained in:
John Chilton
2017-04-27 09:16:17 -04:00
committed by GitHub
4 changed files with 8 additions and 5 deletions
@@ -151,15 +151,16 @@ define([ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view'
if ( step.step_type == 'tool' ) {
var data_resolved = true;
FormData.visitInputs( step.inputs, function ( input, name, context ) {
var is_runtime_value = input.value && input.value.__class__ == 'RuntimeValue';
var is_data_input = ([ 'data', 'data_collection' ]).indexOf( input.type ) != -1;
var data_ref = context[ input.data_ref ];
input.step_linked && !self._isDataStep( input.step_linked ) && ( data_resolved = false );
input.options && ( ( input.options.length == 0 && !data_resolved ) || input.wp_linked ) && ( input.is_workflow = true );
data_ref && ( input.is_workflow = ( data_ref.step_linked && !self._isDataStep( data_ref.step_linked ) ) || input.wp_linked );
( is_data_input || ( input.value && input.value.__class__ == 'RuntimeValue' && !input.step_linked ) ) && ( step.collapsed = false );
input.value && input.value.__class__ == 'RuntimeValue' && ( input.value = null );
is_runtime_value && ( input.value = input.default_value );
input.flavor = 'workflow';
if ( !is_data_input && input.type !== 'hidden' && !input.wp_linked ) {
if ( !is_runtime_value && !is_data_input && input.type !== 'hidden' && !input.wp_linked ) {
if ( input.optional || ( !Utils.isEmpty( input.value ) && input.value !== '' ) ) {
input.collapsible_value = input.value;
input.collapsible_preview = true;
+3 -1
View File
@@ -1835,8 +1835,10 @@ class Tool( object, Dictifiable ):
populate_model( input.inputs, group_state, tool_dict[ 'inputs' ], other_values )
else:
try:
initial_value = input.get_initial_value( request_context, other_values )
tool_dict = input.to_dict( request_context, other_values=other_values )
tool_dict[ 'value' ] = input.value_to_basic( state_inputs.get( input.name, input.get_initial_value( request_context, other_values ) ), self.app, use_security=True )
tool_dict[ 'value' ] = input.value_to_basic( state_inputs.get( input.name, initial_value ), self.app, use_security=True )
tool_dict[ 'default_value' ] = input.value_to_basic( initial_value, self.app, use_security=True )
tool_dict[ 'text_value' ] = input.value_to_display_text( tool_dict[ 'value' ] )
except Exception as e:
tool_dict = input.to_dict( request_context )
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long