Skip to content

Commit

Permalink
fixed #21
Browse files Browse the repository at this point in the history
  • Loading branch information
dinans committed Jan 12, 2017
1 parent 40b4226 commit d7ad9ee
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 23 deletions.
2 changes: 0 additions & 2 deletions app/scripts/controllers/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ angular.module('grafterizerApp')

if(toParams.distributionId ){
$scope.$parent.showPreview = $rootScope.previewmode;
console.log( $scope.$parent.showPreview);
console.log($rootScope.upwizardMode);
} else {
$scope.$parent.showPreview = false;
$rootScope.previewmode = false;
Expand Down
11 changes: 11 additions & 0 deletions app/scripts/pipelineDirectives/addcolumnsfunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ angular.module('grafterizerApp')
scope.function = newFunction;
}

if (scope.function) {
scope.addcolumnsmode = [];
for (var i=0; i< scope.function.columnsArray.length; ++i)
{
if (scope.function.columnsArray[i].colValue)
scope.addcolumnsmode.splice(i,0,'value');
else
scope.addcolumnsmode.splice(i,0,'expression');
}
}

scope.newColumnValues = ['Dataset filename', 'Current date', 'Row number', 'custom expression'];
scope.$parent.generateCurrFunction = function() {
return new transformationDataModel.AddColumnsFunction(
Expand Down
9 changes: 9 additions & 0 deletions app/scripts/pipelineDirectives/mapc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@ angular.module('grafterizerApp')
templateUrl: 'views/pipelineFunctions/mapcFunction.html',
restrict: 'E',
link: function postLink(scope, element, attrs) {
scope.showArgs=[];
if (!scope.function) {
var keyfuncpair = new transformationDataModel.KeyFunctionPair(
'', scope.$parent.transformation.findPrefixerOrCustomFunctionByName('string-literal'), []);
scope.function = new transformationDataModel.MapcFunction([keyfuncpair], null);
scope.function.docstring = null;
scope.showArgs.push(true);
} else {
for (var i = 0; i < scope.function.keyFunctionPairs.length; ++i) {
var currFunc = scope.function.keyFunctionPairs[i].func;
if (!currFunc.hasOwnProperty('name')) scope.function.keyFunctionPairs[i].func = scope.$parent.transformation.findPrefixerOrCustomFunctionByName(currFunc);
scope.showArgs.push(false);
}

}

if (!(scope.function instanceof transformationDataModel.MapcFunction)) {
Expand All @@ -41,6 +45,7 @@ angular.module('grafterizerApp')
return new transformationDataModel.MapcFunction(scope.function.keyFunctionPairs, scope.function.docstring);
};


scope.getCustomFunctionsAndPrefixers = function() {

var customFunctionsAndPrefixers = [];
Expand All @@ -63,10 +68,14 @@ angular.module('grafterizerApp')
};

scope.addKeyFunctionPair = function() {
for (var i = 0; i < scope.function.keyFunctionPairs.length; ++i) {
scope.showArgs[i]=false;
}
var newKeyFunctionPair = new transformationDataModel.KeyFunctionPair('',{name:'string-literal',
group:'CONVERT_DATATYPE',
id:0},[]);
this.function.keyFunctionPairs.push(newKeyFunctionPair);
scope.showArgs[scope.function.keyFunctionPairs.length-1]=true;
};
scope.removeKeyFunctionPair = function(kfPair) {
scope.function.removeKeyFunctionPair(kfPair);
Expand Down
7 changes: 7 additions & 0 deletions app/scripts/pipelineDirectives/renamecolumnsfunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ angular.module('grafterizerApp')
};
};

if (scope.function) {
if (scope.function.functionsToRenameWith[0])
scope.renamecolumnsmode = 'function';
else
scope.renamecolumnsmode = 'map';

}
scope.$parent.generateCurrFunction = function() {
var functArray = [];
var newrenfunc;
Expand Down
17 changes: 12 additions & 5 deletions app/views/pipelineFunctions/addColumnsFunction.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,34 @@
<h3>Parameters</h3>
<p>Columns to add</p>
<div layout="column" ng-repeat="columnSpec in function.columnsArray">

<div layout="row">
<md-button class="md-primary button-tight md-default-theme" ng-disabled="function.columnsArray.length === 1 || $root.readonlymode" ng-click="removeColumn($index)" aria-label="Remove column"> <i class="fa fa-trash fa-lg"></i>
</md-button>
<md-input-container flex>
<label>Name of new column</label>
<input ng-model="columnSpec.colName" type="text" required ng-readonly="$root.readonlymode"></md-input-container>
<md-input-container flex>

</div>
<md-radio-group ng-model="addcolumnsmode[$index]" readonly="$root.readonlymode">
<md-radio-button value="value">Text value</md-radio-button>
<md-radio-button value="expression">Expression</md-radio-button>

</md-radio-group>
<md-input-container ng-show = "addcolumnsmode[$index]==='value'" flex>
<label>Value</label>
<input ng-model="columnSpec.colValue" ng-disabled="columnSpec.specValue" type="text" ng-readonly="$root.readonlymode" />
</md-input-container>
</div>
<div layout="row">
<div layout="row" ng-show="addcolumnsmode[$index]==='expression'">
<md-input-container flex>
<md-select ng-disabled="columnSpec.colValue" aria-label="new column expression" placeholder="{{columnSpec.specValue?columnSpec.specValue:'Choose expression type'}}" ng-model="columnSpec.specValue" ng-disabled="$root.readonlymode">
<md-option ng-repeat="val in newColumnValues" value = {{val}}>{{val}}</md-option>
</md-select>

</md-input-container>
<md-input-container ng-if="columnSpec.specValue==='custom expression'" flex>
<md-input-container style= "padding-top:17px;" ng-if="columnSpec.specValue==='custom expression'" flex>
<label>Expression</label>
<input ng-model="columnSpec.expression" type="text" ng-readonly="$root.readonlymode"/>
<input ng-model="columnSpec.expression" type="text" ng-readonly="$root.readonlymode"/>
</md-input-container>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/pipelineFunctions/grepFunction.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h3>Parameters</h3>
<i class="fa fa-question-circle fa-lg"></i>
</md-button>
</div>
<div ng-show = "showRegex">
<div ng-show = "showRegex" class="api-doc-docstring">
<p>
The most simple regular expressions are just literal characters. Example: to narrow dataset just to rows containing text fragment <mark>abc</mark> you should use <mark>abc</mark> regular expression.
<br>
Expand Down
15 changes: 12 additions & 3 deletions app/views/pipelineFunctions/mapcFunction.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<h3>Parameters</h3>
<md-button class="md-raised" ng-click="addKeyFunctionPair()" aria-label="Add mapping" ng-disabled="$root.readonlymode">Add mapping</md-button>
<div layout="row" ng-repeat="keyFunctionPair in function.keyFunctionPairs">
<div layout="row" layout-align="start center">
<div layout="row" layout-align="start start">
<md-button class="md-primary button-tight md-default-theme" ng-disabled="function.keyFunctionPairs.length === 1 || $root.readonlymode" ng-click="removeKeyFunctionPair(keyFunctionPair)" aria-label="Remove column mapping">
<i class="fa fa-trash fa-lg"></i>
</md-button>
Expand All @@ -47,11 +47,20 @@ <h3>Parameters</h3>
<oi-select oi-options="customFunction.name group by customFunction.group for customFunction in getCustomFunctionsAndPrefixers() track by customFunction.id" title="customFunction.docstring" ng-model="keyFunctionPair.func" ng-disabled="$root.readonlymode"></oi-select>
</div>
<div layout="column" style="margin-left:20px">
<md-input-container ng-repeat="param in keyFunctionPair.getParams()">
<md-button ng-show="keyFunctionPair.getParams().length > 0" style="margin-top:20px" aria-label="Arguments" ng-click="showArgs[$index] = !showArgs[$index]">
<span ng-hide="showArgs[$index]"> <i class="fa fa-angle-down"></i>
Arguments
</span>
<span ng-show="showArgs[$index]"> <i class="fa fa-angle-up"></i>
Arguments
</span>
</md-button>
<div ng-show="showArgs[$index]" layout="column">
<md-input-container ng-repeat="param in keyFunctionPair.getParams()">
<label>{{param}}</label>
<input ng-model = "keyFunctionPair.funcParams[$index]">
</md-input-container>

</div>
</div>
</div>

Expand Down
27 changes: 15 additions & 12 deletions app/views/pipelineFunctions/renameColumnsFunction.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
</div>
</div>
<h3 style="padding-left: 20px;">Parameters</h3>
<div class="whiteframedemoBasicUsage" layout="row" style="padding-bottom: 32px;">
<div>
<md-whiteframe class="md-whiteframe-z1" layout="column" layout-align="left ">

<md-radio-group ng-model="renamecolumnsmode" readonly="$root.readonlymode">
<md-radio-button value="function">Transform with function</md-radio-button>
<md-radio-button value="map">Map values</md-radio-button>
</md-radio-group>

<div ng-show="renamecolumnsmode==='function'">
<p> Transform current column names </p>
<div ng-repeat="renameFunction in function.functionsToRenameWith track by $index ">
<div >
Expand All @@ -27,12 +31,10 @@ <h3 style="padding-left: 20px;">Parameters</h3>


</div>
<md-button class="md-raised" ng-click="addRenameFunction()" aria-label="Compose with function" ng-disabled="$root.readonlymode">Compose with </md-button>
</md-whiteframe>
</div>

<div>
<md-whiteframe class="md-whiteframe-z1" layout="column" layout-align="left ">

<md-button class="md-raised" ng-click="addRenameFunction()" aria-label="Compose with function" ng-disabled="$root.readonlymode">Compose with </md-button>
</div>
<div ng-show="renamecolumnsmode==='map'">
<p> Map values </p>
<div layout="row" ng-repeat="i in getMapLength(function.mappings.length) ">
<div layout="row">
Expand All @@ -50,12 +52,13 @@ <h3 style="padding-left: 20px;">Parameters</h3>
<input ng-model="function.mappings[i+1]" type="text" required ng-readonly="$root.readonlymode">
</md-input-container>
</div>
</div>

</div>
</div>
<md-button class="md-raised" ng-click="addRenameMapping()" aria-label="Add mapping pair" ng-disabled="$root.readonlymode">Add mapping pair</md-button>
</md-whiteframe>
</div>



</div>
<md-input-container flex>
<label>Comment</label>
Expand Down

0 comments on commit d7ad9ee

Please sign in to comment.