Automatically select 'Download' for store functions

This minor fix selects the 'Download' radio button by default if the
function has a label with `com.openfaas.ui.ext`.
Closes #827

Signed-off-by: Ken Fukuyama <kenfdev@gmail.com>
This commit is contained in:
Ken Fukuyama 2018-08-23 21:17:22 +09:00 committed by Alex Ellis
parent b3a71b456a
commit b73e14be92
2 changed files with 7 additions and 3 deletions

View File

@ -158,8 +158,8 @@
<md-input-container class="md-block" flex-gt-sm>
<md-radio-group ng-model="invocation.contentType" layout="row" layout-align="start center">
<md-radio-button value="text" class="md-primary"> Text </md-radio-button>
<md-radio-button value="json"> JSON </md-radio-button>
<md-radio-button value="binary"> Download </md-radio-button>
<md-radio-button value="json" class="md-primary"> JSON </md-radio-button>
<md-radio-button value="binary" class="md-primary"> Download </md-radio-button>
</md-radio-group>
</md-input-container>
</div>

View File

@ -225,7 +225,11 @@ app.controller("home", ['$scope', '$log', '$http', '$location', '$interval', '$f
$scope.invocationResponse = "";
$scope.invocationStatus = "";
$scope.invocationInProgress = false;
$scope.invocation.contentType = "text";
if (fn.labels && fn.labels['com.openfaas.ui.ext']) {
$scope.invocation.contentType = "binary";
} else {
$scope.invocation.contentType = "text";
}
$scope.invocation.roundTripDuration = "";
}
};