Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 6ca5bc9

Browse files
ghillertericbottard
authored andcommitted
gh-168 Add support to register apps with its companion artifact
1 parent b289449 commit 6ca5bc9

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

ui/app/scripts/app/controllers/register-apps.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ define(function () {
3535
type: $scope.types[0],
3636
force: false,
3737
uri: '',
38+
metadataUri: ''
3839
};
3940
}
4041

@@ -57,7 +58,7 @@ define(function () {
5758
var successMsg = 'Successfully registered ' + ($scope.apps.length === 1 ? 'application "' + $scope.apps[0].name + '" of type "' + $scope.apps[0].type + '"' : $scope.apps.length + ' applications.');
5859
// Fire off a registration request for each app
5960
$scope.apps.forEach(function(app) {
60-
promise = appService.registerApp(app.type, app.name, app.uri, app.force).$promise;
61+
promise = appService.registerApp(app.type, app.name, app.uri, app.force, app.metadataUri).$promise;
6162
promise.then(function() {
6263
// Need to find app index because index might have been changed by the time promise is resolved due to other removals
6364
index = $scope.apps.indexOf(app);

ui/app/scripts/app/services.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,19 @@ define(['angular', 'lodash'], function (angular, _) {
7878
url: $rootScope.dataflowServerUrl + '/apps/'+appType+'/'+appName
7979
});
8080
},
81-
registerApp: function(type, name, uri, force) {
81+
registerApp: function(type, name, uri, force, metadataUri) {
82+
83+
var httpParams = {
84+
uri: uri,
85+
force: force ? true : false
86+
};
87+
if (metadataUri) {
88+
httpParams['metadata-uri'] = metadataUri;
89+
}
8290
var request = $resource($rootScope.dataflowServerUrl + '/apps/' + type + '/' + name, {}, {
8391
registerApp: {
8492
method: 'POST',
85-
params: {
86-
uri: uri,
87-
force: force ? true : false
88-
}
93+
params: httpParams
8994
}
9095
}).registerApp();
9196
request.$promise.then(function() {

ui/app/scripts/app/views/register-apps.html

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<h1>Register Applications</h1>
2-
<p>Register one or more applications by entering a <strong>Name</strong>, <strong>Type</strong> and <strong>URI</strong> of the application Jar. The URI is typically provided using the Maven coordinates of the Jar (e.g. <code>maven://io.spring.cloud:scdf-sample-app:jar:1.0.0.BUILD-SNAPSHOT</code>), but can be a local file or a docker image URI.</p>
2+
<p>
3+
Register one or more applications by entering a <strong>Name</strong>,
4+
<strong>Type</strong> and <strong>App URI</strong> of the application Jar.
5+
You can also provide an optional <strong>metadata artifact URI</strong>.
6+
The App URI &amp; the Metadata Artifact URI are typically provided using the Maven coordinates of the Jar
7+
(e.g. <code>maven://io.spring.cloud:scdf-sample-app:jar:1.0.0.BUILD-SNAPSHOT</code>),
8+
but can be a local file or a docker image URI.
9+
</p>
310
<hr/>
411
<form name="registerAppsForm" role="form" ng-submit="register()" novalidate>
512
<table class="table form-table">
@@ -11,7 +18,7 @@ <h1>Register Applications</h1>
1118
<tr>
1219
<th>Name</th>
1320
<th>Type</th>
14-
<th>URI</th>
21+
<th>App URI &amp; optional Metadata URI</th>
1522
<th>
1623
<span>
1724
<input type="checkbox" ng-model="toggleAllForce" ng-model-options="{ getterSetter: true }" ui-indeterminate="someForceButNotAll()"/>
@@ -35,9 +42,13 @@ <h1>Register Applications</h1>
3542
</td>
3643
<td>
3744
<div ng-class="registerAppsForm[$index + '_uri'].$invalid ? 'has-warning has-feedback' : ''">
38-
<input type="text" id="{{'uri_' + $index}}" name="{{$index + '_uri'}}" class="form-control" placeholder="<maven://io.spring.cloud:scdf-sample-app:jar:1.0.0.BUILD-SNAPSHOT>" required ng-model="app.uri" ng-pattern="uriPattern">
45+
<input type="text" id="{{'uri_' + $index}}" name="{{$index + '_uri'}}" class="form-control" placeholder="<maven://io.spring.cloud:scdf-sample-app:jar:1.0.0>" required ng-model="app.uri" ng-pattern="uriPattern">
3946
<span class="glyphicon glyphicon-warning-sign form-control-feedback" ng-show="registerAppsForm[$index + '_uri'].$invalid"></span>
4047
</div>
48+
<div style="margin-top: 2px;" ng-class="registerAppsForm[$index + '_metadataUri'].$invalid ? 'has-warning has-feedback' : ''">
49+
<input type="text" id="{{'metadataUri_' + $index}}" name="{{$index + '_metadataUri'}}" class="form-control" placeholder="<maven://io.spring.cloud:scdf-sample-app:jar:metadata:1.0.0> [OPTIONAL]" ng-model="app.metadataUri" ng-pattern="uriPattern">
50+
<span class="glyphicon glyphicon-warning-sign form-control-feedback" ng-show="registerAppsForm[$index + '_metadataUri'].$invalid"></span>
51+
</div>
4152
</td>
4253
<td class="text-center">
4354
<input type="checkbox" id="{{$index + '_force'}}" name="{{$index + '_force'}}" ng-model="app.force">

0 commit comments

Comments
 (0)