Add common cron pattern dropdown
This commit is contained in:
+11
-1
@@ -1015,7 +1015,17 @@
|
||||
<div class="col-md-12">
|
||||
<form role="form" name="cronForm" ng-submit="cron.submit()" autocomplete="off">
|
||||
<div class="form-group" ng-class="{ 'has-error': cron.error.crontab }">
|
||||
<label class="control-label" style="width: 100%">{{ 'app.cron.title' | tr }} <sup><a ng-href="https://docs.cloudron.io/apps/#cron" class="help" target="_blank"><i class="fa fa-question-circle"></i></a></sup></label>
|
||||
<label class="control-label" style="width: 100%">{{ 'app.cron.title' | tr }} <sup><a ng-href="https://docs.cloudron.io/apps/#cron" class="help" target="_blank"><i class="fa fa-question-circle"></i></a></sup>
|
||||
<div class="dropdown pull-right">
|
||||
<a class="dropdown-toggle hand" style="font-weight: normal;" id="commonCronPatternDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
Add common pattern
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="commonCronPatternDropdown">
|
||||
<li ng-repeat="pattern in cron.commonPatterns"><a class="hand" ng-click="cron.addCommonPattern(pattern.value)">{{ pattern.label }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</label>
|
||||
<div ng-show="cron.error.crontab"><small>{{ cron.error.crontab }}</small></div>
|
||||
<textarea ng-trim="false" style="white-space: pre-wrap" ng-model="cron.crontab" class="form-control text-monospace" rows="10"></textarea>
|
||||
</div>
|
||||
|
||||
+20
-7
@@ -903,16 +903,25 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
busy: false,
|
||||
error: {},
|
||||
|
||||
commonPatterns: [
|
||||
{ value: '* * * * *', label: 'Every Minute' },
|
||||
{ value: '0 * * * *', label: 'Every Hour' },
|
||||
{ value: '*/30 * * * *', label: 'Twice per Hour' },
|
||||
{ value: '0 0 * * *', label: 'Every Day' },
|
||||
{ value: '0 */12 * * *', label: 'Twice per Day' },
|
||||
{ value: '0 0 * * 0', label: 'Every Sunday' }
|
||||
],
|
||||
|
||||
crontab: '',
|
||||
|
||||
crontabDefault: ''
|
||||
+ '# +---------------- minute (0 - 59)\n'
|
||||
+ '# | +------------- hour (0 - 23)\n'
|
||||
+ '# | | +---------- day of month (1 - 31)\n'
|
||||
+ '# | | | +------- month (1 - 12)\n'
|
||||
+ '# | | | | +---- day of week (0 - 6) (Sunday=0 or 7)\n'
|
||||
+ '# | | | | |\n'
|
||||
+ '# * * * * * command to be executed\n\n',
|
||||
+ '# +------------------------ minute (0 - 59)\n'
|
||||
+ '# | +------------------- hour (0 - 23)\n'
|
||||
+ '# | | +-------------- day of month (1 - 31)\n'
|
||||
+ '# | | | +--------- month (1 - 12)\n'
|
||||
+ '# | | | | +---- day of week (0 - 6) (Sunday=0 or 7)\n'
|
||||
+ '# | | | | |\n'
|
||||
+ '# * * * * * command to be executed\n\n',
|
||||
|
||||
show: function () {
|
||||
$scope.cronForm.$setPristine();
|
||||
@@ -938,6 +947,10 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
|
||||
$timeout(function () { $scope.cron.busy = false; }, 1000);
|
||||
});
|
||||
},
|
||||
|
||||
addCommonPattern: function (pattern) {
|
||||
$scope.cron.crontab += ' ' + pattern + ' command to be executed\n';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user