Skip to content

Commit

Permalink
RCP improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
kwin committed Jul 13, 2020
1 parent c588590 commit 4e99a13
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,10 @@ function ($scope, $http, $timeout, $interval, NotificationsService) {

/**
* Set the scope values from a task
* Used for the duplicate functionality
* @param {*} task The task to duplicate
* @param {*} task The task to edit
*/
$scope.duplicate = function (task) {
$scope.task_id = task.id + "-copy"; // unique
$scope.edit = function (task) {
$scope.task_id = task.id;
$scope.task_src = task.src;
$scope.task_dst = task.dst;
$scope.task_batchSize = task.batchsize;
Expand All @@ -115,20 +114,37 @@ function ($scope, $http, $timeout, $interval, NotificationsService) {
update: task.update,
onlyNewer: task.onlyNewer,
noOrdering: task.noOrdering,
autoRefresh: false
autoRefresh: false,
useSystemProperties: task.useSystemProperties,
allowSelfSignedCertificate: task.allowSelfSignedCertificate,
disableHostnameVerification: task.disableHostnameVerification
};

if (task.excludes) {
$scope.excludes = task.excludes.map(function(exclude){
return {value: exclude};
});
} else if (task.filter) {
$scope.filter = task.filter;
}

if (task.resumeFrom) {
$scope.task_resumeFrom = task.resumeFrom;
}
};


/**
* Set the scope values from a task
* Used for the duplicate functionality
* @param {*} task The task to duplicate
*/
$scope.duplicate = function (task) {
$scope.edit(task);
// different task id
$scope.task_id = task.id + "-copy"; // unique
};

/*
* Start task
*/
Expand Down Expand Up @@ -202,6 +218,9 @@ function ($scope, $http, $timeout, $interval, NotificationsService) {
"onlyNewer": $scope.checkboxModel.onlyNewer,
"recursive": $scope.checkboxModel.recursive,
"noOrdering": $scope.checkboxModel.noOrdering,
"useSystemProperties": $scope.checkboxModel.useSystemProperties,
"allowSelfSignedCertificate": $scope.checkboxModel.allowSelfSignedCertificate,
"disableHostnameVerification": $scope.checkboxModel.disableHostnameVerification,
"throttle": $scope.task_throttle || 0
};
if ($scope.task_resumeFrom !== "") {
Expand All @@ -212,8 +231,9 @@ function ($scope, $http, $timeout, $interval, NotificationsService) {
cmd.excludes = $scope.excludes.map(function(exclude){
return exclude.value;
});
} else if ($scope.filter && $scope.filter.length > 0) {
cmd.filter = $scope.filter;
}

$http
.post($scope.app.uri, cmd)
.success(function (data, status, headers, config) {
Expand All @@ -228,10 +248,31 @@ function ($scope, $http, $timeout, $interval, NotificationsService) {
});
};

/*
* Set credentials task
*/
$scope.set_credentials = function (task) {
var cmd = {
"cmd": "set-credentials",
"id": task.id,
"srcCreds": $scope.task_src_username + ":" + $scope.task_src_password
};

$http.post($scope.app.uri, cmd).
success(function (data, status, headers, config) {
NotificationsService.add('info', 'INFO', 'Set credentials for task ' + task.id + '.');
$scope.refresh();
}).
error(function (data, status, headers, config) {
NotificationsService.add('error', 'ERROR', 'Could not set credentials for task.');
});
};

$scope.reset = function() {
$scope.task_id = '';
$scope.task_src = 'http://localhost:4502/crx/server/crx.default/jcr:root/content/dam/my-site';
$scope.task_src_username = '';
$scope.task_src_password = '';
$scope.task_dst = '/content/dam/my-site';
$scope.task_batchSize = '1024';
$scope.task_throttle = '';
Expand All @@ -240,9 +281,13 @@ function ($scope, $http, $timeout, $interval, NotificationsService) {
update: false,
onlyNewer: false,
noOrdering: false,
autoRefresh: false
autoRefresh: false,
useSystemProperties: false,
allowSelfSignedCertificate: false,
disableHostnameVerification: false
};
$scope.excludes = [];
$scope.filter = '';
};

$scope.addExclude = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
<li>
The VLT-RCP endpoint URL must be accessible and not blocked via
Dispatcher or another reverse proxy. Note: The VLT RCP servlet
endpoint changed from &quot;/system/jackrabbit/filevault/rcp&quot; to
&quot;/libs/granite/packaging/rcp&quot; in VLT-RCP 3.1.6.
endpoint changed from &quot;/libs/granite/packaging/rcp&quot; to
&quot;/system/jackrabbit/filevault/rcp&quot; in VLT-RCP 3.1.6.
</li>
</ol>
</div>
Expand Down Expand Up @@ -117,6 +117,12 @@
</span>
<!-- Task Action buttons -->
<span class="task-actions">
<button class="coral-Button--quiet"
title="Edit task"
ng-click="edit(task)"
data-target="#create-new-task-modal"
data-toggle="modal">
<i class="coral-Icon coral-Icon--sizeS coral-Icon--edit"></i>
<button class="coral-Button--quiet"
title="Create new duplicate task with this tasks values"
ng-click="duplicate(task)"
Expand All @@ -126,7 +132,7 @@
</button>
<button class="coral-Button--quiet"
title="Start task"
ng-show="task.status.state == 'NEW'"
ng-show="task.status.state != 'RUNNING' || task.status.state == 'STOPPING'"
ng-click="start(task)">
<i class="coral-Icon coral-Icon--sizeS coral-Icon--playCircle"></i>
</button>
Expand All @@ -136,6 +142,13 @@
ng-click="stop(task)">
<i class="coral-Icon coral-Icon--sizeS coral-Icon--stopCircle"></i>
</button>
<button class="coral-Button--quiet"
title="Set credentials"
ng-click="duplicate(task)"
data-target="#set-credentials-modal"
data-toggle="modal">
<i class="coral-Icon coral-Icon--sizeS coral-Icon--userEdit"></i>
</button>
<button class="coral-Button--quiet"
title="Delete Task"
ng-click="remove(task)">
Expand Down Expand Up @@ -172,12 +185,16 @@
<li><b>No ordering:</b> {{ task.noOrdering }}</li>
<li><b>Throttle:</b> {{ task.throttle || 0}} seconds</li>
<li><b>Resume from:</b> {{ task.resumeFrom || 'Not set'}}</li>
<li><b>Use system properties:</b> {{ task.useSystemProperties || 'No'}}</li>
<li><b>Allow self-signed certificate:</b> {{ task.allowSelfSignedCertificate || 'No'}}</li>
<li><b>Disable hostname verification:</b> {{ task.disableHostnameVerification || 'No'}}</li>
<li ng-show="task.excludes.length > 0">
Excludes:
<ul>
<li ng-repeat="exclude in task.excludes track by $index">{{exclude}}</li>
</ul>
</li>
<li ng-show="task.filter && task.filter.length > 0"><b>Filter:</b> {{ task.filter || 'Not set'}}</li>
</ul>
</div>
</div>
Expand All @@ -187,6 +204,7 @@
<!-- // Tasks accordion section -->

<cq:include script="includes/create-task-modal.jsp"/>
<cq:include script="includes/set-credentials-modal.jsp"/>
</div>

</div>
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
~ #L%
--%>
<div id="create-new-task-modal" class="coral-Modal">

<!-- // TODO: reuse for both create and edit, while the latter should make id read-only -->
<div class="coral-Modal-header">
<i class="coral-Modal-typeIcon coral-Icon coral-Icon--sizeS"></i>
<h2 class="coral-Modal-title coral-Heading coral-Heading--2">Create a new task</h2>
<h2 class="coral-Modal-title coral-Heading coral-Heading--2">Create a new/Edit a task</h2>
<button type="button" class="coral-MinimalButton coral-Modal-closeButton" title="Close" data-dismiss="modal" ng-click="reset();">
<i class="coral-Icon coral-Icon--sizeXS coral-Icon--close coral-MinimalButton-icon "></i>
</button>
Expand All @@ -47,28 +47,30 @@
placeholder="http://localhost:4502/crx/server/-/jcr:root/content/dam/my-site"/>
</div>

<!-- Credintial Fields -->
<!-- Credential Fields -->
<div class="coral-Form-fieldwrapper">
<label class="coral-Form-fieldlabel">Source User Name</label>
<input class="coral-Form-field coral-Textfield" type="text"
autocomplete="username"
ng-model="task_src_username"
name="username"/>
name="username"
placeholder="Set again with each edit"/>
</div>

<div class="coral-Form-fieldwrapper">
<label class="coral-Form-fieldlabel">Source Password</label>
<input class="coral-Form-field coral-Textfield" ng-attr-type="{{showpassword ? 'text' : 'password'}}"
ng-model="task_src_password"
name="passsword"/>
name="passsword"
placeholder="Set again with each edit"/>
</div>
<label class="coral-Form-fieldlabel">Show Password</label>
<span class="coral-Form-field coral-Switch">
<input class="coral-Switch-input" type="checkbox"
name="showpassword"
ng-model="showpassword"><span class="coral-Switch-offLabel">No</span><span class="coral-Switch-onLabel">Yes</span>
</span>
<!-- // Credintial Fields -->
<!-- // Credential Fields -->

<!-- Switch Options -->
<label class="coral-Form-fieldlabel">Destination</label>
Expand Down Expand Up @@ -104,6 +106,27 @@
name="noOrdering"
ng-model="checkboxModel.noOrdering"><span class="coral-Switch-offLabel">No</span><span class="coral-Switch-onLabel">Yes</span>
</span>

<label class="coral-Form-fieldlabel">Use system properties for connection settings</label>
<span class="coral-Form-field coral-Switch">
<input class="coral-Switch-input" type="checkbox"
name="useSystemProperties"
ng-model="checkboxModel.useSystemProperties"><span class="coral-Switch-offLabel">No</span><span class="coral-Switch-onLabel">Yes</span>
</span>

<label class="coral-Form-fieldlabel">Allow self-signed certificate</label>
<span class="coral-Form-field coral-Switch">
<input class="coral-Switch-input" type="checkbox"
name="allowSelfSignedCertificate"
ng-model="checkboxModel.allowSelfSignedCertificate"><span class="coral-Switch-offLabel">No</span><span class="coral-Switch-onLabel">Yes</span>
</span>

<label class="coral-Form-fieldlabel">Disable hostname verification</label>
<span class="coral-Form-field coral-Switch">
<input class="coral-Switch-input" type="checkbox"
name="disableHostnameVerification"
ng-model="checkboxModel.disableHostnameVerification"><span class="coral-Switch-offLabel">No</span><span class="coral-Switch-onLabel">Yes</span>
</span>
<!-- // Switch Options -->

<!-- Extra Options -->
Expand Down Expand Up @@ -142,6 +165,12 @@
</ul>
</div>
</div>

<label class="coral-Form-fieldlabel">Filter</label>
<textarea class="coral-Form-field coral-Textfield coral-Textfield--multiline" type="text"
ng-model="task_filter"
name="filter">
</textarea>
<!-- // Extra Options -->
</section>
</form>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<%--
~ #%L
~ ACS AEM Tools Bundle
~ %%
~ Copyright (C) 2020 Konrad Windszus, Netcentric
~ %%
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~ #L%
--%>
<div id="set-credentials-modal" class="coral-Modal">

<div class="coral-Modal-header">
<i class="coral-Modal-typeIcon coral-Icon coral-Icon--sizeS"></i>
<h2 class="coral-Modal-title coral-Heading coral-Heading--2">Set credentials</h2>
<button type="button" class="coral-MinimalButton coral-Modal-closeButton" title="Close" data-dismiss="modal">
<i class="coral-Icon coral-Icon--sizeXS coral-Icon--close coral-MinimalButton-icon "></i>
</button>
</div>

<div class="coral-Modal-body">

<form name="myForm" class="coral-Form coral-Form--aligned" autocomplete="off" novalidate>
<section class="create-new-task">

<!-- Credential Fields -->
<div class="coral-Form-fieldwrapper">
<label class="coral-Form-fieldlabel">Source User Name</label>
<input class="coral-Form-field coral-Textfield" type="text"
autocomplete="username"
ng-model="task_src_username"
name="username"/>
</div>

<div class="coral-Form-fieldwrapper">
<label class="coral-Form-fieldlabel">Source Password</label>
<input class="coral-Form-field coral-Textfield" ng-attr-type="{{showpassword ? 'text' : 'password'}}"
ng-model="task_src_password"
name="passsword"/>
</div>
<label class="coral-Form-fieldlabel">Show Password</label>
<span class="coral-Form-field coral-Switch">
<input class="coral-Switch-input" type="checkbox"
name="showpassword"
ng-model="showpassword"><span class="coral-Switch-offLabel">No</span><span class="coral-Switch-onLabel">Yes</span>
</span>
<!-- // Credential Fields -->

</section>
</form>
</div>

<div class="coral-Modal-footer">
<!-- // TODO: how to access task, somehow inject into controller -->
<button class="coral-Button coral-Button--primary" data-dismiss="modal" ng-click="set_credentials(task)">Set credentials</button>
<button class="coral-Button" data-dismiss="modal" ng-click="reset();">Cancel</button>
</div>

</div>

0 comments on commit 4e99a13

Please sign in to comment.