
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
angular-cron-jobs
Advanced tools
UI Component For Creating Cron Job Syntax To Send To Server
Install using bower:
bower install angular-cron-jobs
Include the component in your application:
angular.module('myApp', ['angular-cron-jobs']);
Insert the directive where you would like it to appear in your application:
<cron-selection ng-model="myOutput"></cron-selection>
By setting the ng-model attribute equal to a value in your controller (i.e. $scope.myOutput
in the example above) you have access to the cron syntax output.
For example, a job selected to run every month on the 11th at 4:10 AM would output the follow:
'10 4 11 * *'
as a string.
The directive takes an optional attribute of config
<cron-selection ng-model="myOutput" config="myConfig"></cron-selection>
This is an object in your controller you can use to remove options from the user. For example if you would like the user to be able to set Minute, Hour, and Day but not Week, Month, and Year you would create the following object in your controller:
$scope.myConfig = {
options: {
allowWeek : false,
allowMonth : false,
allowYear : false
}
}
Currently the config object accepts an options property with an object of allowed selections. These include:
Setting the keys as booleans will turn the selection on and off.
You can also set whether or not you want to allow a user to select multiple calues for a cron:
$scope.myConfig = {
allowMultiple: true
}
Setting allowMultiple to either true or false will toggle the ability.
By default, the cron expression generated is Unix Cron compatible. Incase you use the Quartz Scheduler, you would want to enable the quartz
mode in the options.
You can do so by passing that flag as true
in the config object.
$scope.myConfig = {
quartz: true
}
In case you are using a custom template, please be sure to pass an extra argument cronStyle
to the cronDayName
filter. So your code should look something like this:
value as (value | cronDayName: cronStyle) for value in dayValues
A complete config object may look like the following:
$scope.myConfig = {
allowMultiple: true,
options: {
allowWeek : false,
allowMonth : false,
allowYear : false
},
quartz: true
}
As noted by TimotheeJeannin you can use custom template by setting the template attribute on your cron DOM element:
<cron-selection template="path/to/my/template.html"></cron-selection>
The directive takes an attribute of ng-model
used for init and output data.
<cron-selection ng-model="myOutput" config="myConfig"></cron-selection>
This is a string in your controller of cron syntax that was recieved from your server or any other source:
$scope.myOutput = "30 2 4 * *"
Thew directive will properly build out the UI to reflect this data.
The ng-model
attribute also works as a reset attribute
<cron-selection ng-model="myOutput" config="myConfig"></cron-selection>
This is an expression paired with a value in your controller. Whenever the value changes (or is set for the first time) and passed the angular.isDefined()
method the cron will reset itself to match that value
$timeout(function(){
$scope.myOutput = "0 0 * * *"
}, 3000);
The directive will properly build out the UI to reflect this data.
the frequency
attribute grants you exposure to the $scope.myFrequency
object inside the directive. It is two way bound so you can manipulate it from outside the directive as well.
The type of {number|Array.<number>}
depends on the following: number if allowMultiple
is false
and Array if allowMultiple
is true
Properties you now have access to via frequency
attribute include:
{number}
1-6 (minute thru year){number|Array.<number>}
0-55 (increments of 5){number|Array.<number>}
1-23{number|Array.<number>}
0-6 (Sunday thru Saturday){number|Array.<number>}
1-12frequency
attribute.@jacobscarter - Author
The next big to-do's on my list include:
* Support generlized selections such as a one button click for "Every Five Minutes" or "Last Thursday of Every Month"
FAQs
UI Component For Creating Cron Job Syntax To Send To Server
The npm package angular-cron-jobs receives a total of 1,431 weekly downloads. As such, angular-cron-jobs popularity was classified as popular.
We found that angular-cron-jobs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.