Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio-main
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hardik Juneja
jio-main
Commits
83e5bf99
Commit
83e5bf99
authored
Aug 22, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jobMaker compatible with recovery
parent
53d0f1e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
18 deletions
+33
-18
src/jio/features/jobMaker.js
src/jio/features/jobMaker.js
+33
-18
No files found.
src/jio/features/jobMaker.js
View file @
83e5bf99
...
...
@@ -36,6 +36,24 @@ function enableJobMaker(jio, shared, options) {
"
options
"
]);
function
addCommandToJob
(
param
)
{
param
.
command
=
{};
param
.
command
.
resolve
=
function
()
{
shared
.
emit
(
'
jobDone
'
,
param
,
arguments
);
};
param
.
command
.
success
=
param
.
command
.
resolve
;
param
.
command
.
reject
=
function
()
{
shared
.
emit
(
'
jobFail
'
,
param
,
arguments
);
};
param
.
command
.
error
=
param
.
command
.
reject
;
param
.
command
.
notify
=
function
()
{
shared
.
emit
(
'
jobNotify
'
,
param
,
arguments
);
};
param
.
command
.
storage
=
function
()
{
return
shared
.
createRestApi
.
apply
(
null
,
arguments
);
};
}
// listeners
shared
.
rest_method_names
.
forEach
(
function
(
method
)
{
...
...
@@ -43,27 +61,24 @@ function enableJobMaker(jio, shared, options) {
if
(
param
.
deferred
)
{
// params are good
param
.
created
=
new
Date
();
param
.
tried
=
0
;
param
.
state
=
'
ready
'
;
param
.
command
=
{};
param
.
command
.
resolve
=
function
()
{
shared
.
emit
(
'
jobDone
'
,
param
,
arguments
);
};
param
.
command
.
success
=
param
.
command
.
resolve
;
param
.
command
.
reject
=
function
()
{
shared
.
emit
(
'
jobFail
'
,
param
,
arguments
);
};
param
.
command
.
error
=
param
.
command
.
reject
;
param
.
command
.
notify
=
function
()
{
shared
.
emit
(
'
jobNotify
'
,
param
,
arguments
);
};
param
.
command
.
storage
=
function
()
{
return
shared
.
createRestApi
.
apply
(
null
,
arguments
);
};
param
.
modified
=
new
Date
();
shared
.
emit
(
'
job
'
,
param
);
}
});
});
shared
.
on
(
'
job
'
,
function
(
param
)
{
// new or recovered job
param
.
state
=
'
ready
'
;
if
(
typeof
param
.
tried
!==
'
number
'
||
!
isFinite
(
param
.
tried
))
{
param
.
tried
=
0
;
}
if
(
!
param
.
created
)
{
param
.
created
=
new
Date
();
}
if
(
!
param
.
command
)
{
addCommandToJob
(
param
);
}
param
.
modified
=
new
Date
();
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment