Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos.core
Commits
42bdbc93
Commit
42bdbc93
authored
Apr 20, 2012
by
Thomas Lechauve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: keeping context in ajax request
Also modified all tests to use slapos plugin new structure
parent
674bb1bc
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
116 additions
and
115 deletions
+116
-115
jQuery/static/js/slapOs.js
jQuery/static/js/slapOs.js
+30
-27
jQuery/static/js/test.js
jQuery/static/js/test.js
+86
-88
No files found.
jQuery/static/js/slapOs.js
View file @
42bdbc93
(
function
(
$
)
{
;
(
function
(
$
)
{
var
methods
=
{
defaults
:
{
host
:
''
},
init
:
function
(
options
){
var
settings
=
$
.
extend
({
'
host
'
:
''
},
options
);
return
this
.
each
(
function
(){
methods
.
config
=
$
.
extend
({},
methods
.
defaults
,
methods
.
options
,
methods
.
metadata
);
methods
[
'
store
'
]
=
Modernizr
.
localstorage
?
methods
.
lStore
:
methods
.
cStore
;
methods
.
store
(
'
host
'
,
methods
.
config
.
host
);
$
(
this
).
slapos
(
'
store
'
,
'
host
'
,
settings
.
host
);
});
},
...
...
@@ -41,67 +44,68 @@
}
},
request
:
function
(
context
,
type
,
url
,
callback
,
statusEvent
,
data
){
request
:
function
(
type
,
url
,
callback
,
statusEvent
,
data
){
data
=
data
||
''
;
statusEvent
=
statusEvent
||
this
.
statusDefault
;
$
.
ajax
({
url
:
methods
.
store
(
'
host
'
)
+
url
,
dataType
:
'
json
'
,
data
:
data
,
context
:
context
,
type
:
type
,
statusCode
:
statusEvent
}).
done
(
callback
);
return
this
.
each
(
function
(){
$
.
ajax
({
url
:
methods
.
store
(
'
host
'
)
+
url
,
dataType
:
'
json
'
,
data
:
data
,
context
:
$
(
this
),
type
:
type
,
statusCode
:
statusEvent
,
success
:
callback
});
});
},
newInstance
:
function
(
data
,
callback
,
statusEvent
){
return
this
.
request
(
'
POST
'
,
'
/request
'
,
callback
,
statusEvent
,
data
);
return
$
(
this
).
slapos
(
'
request
'
,
'
POST
'
,
'
/request
'
,
callback
,
statusEvent
,
data
);
},
deleteInstance
:
function
(
id
,
callback
,
statusEvent
){
return
this
.
request
(
'
DELETE
'
,
'
/instance/
'
+
id
,
callback
,
statusEvent
);
return
$
(
this
).
slapos
(
'
request
'
,
'
DELETE
'
,
'
/instance/
'
+
id
,
callback
,
statusEvent
);
},
getInstance
:
function
(
id
,
callback
,
statusEvent
){
return
this
.
each
(
function
(){
methods
.
request
(
this
,
'
GET
'
,
'
/instance/
'
+
id
,
callback
,
statusEvent
);
});
return
$
(
this
).
slapos
(
'
request
'
,
'
GET
'
,
'
/instance/
'
+
id
,
callback
,
statusEvent
);
},
getInstanceCert
:
function
(
id
,
callback
,
statusEvent
){
return
this
.
request
(
'
GET
'
,
'
/instance/
'
+
id
+
'
/certificate
'
,
callback
,
statusEvent
);
return
$
(
this
).
slapos
(
'
request
'
,
'
GET
'
,
'
/instance/
'
+
id
+
'
/certificate
'
,
callback
,
statusEvent
);
},
bangInstance
:
function
(
id
,
log
,
callback
,
statusEvent
){
return
this
.
request
(
'
POST
'
,
'
/instance/
'
+
id
+
'
/bang
'
,
callback
,
statusEvent
,
log
);
return
$
(
this
).
slapos
(
'
request
'
,
'
POST
'
,
'
/instance/
'
+
id
+
'
/bang
'
,
callback
,
statusEvent
,
log
);
},
editInstance
:
function
(
id
,
data
,
callback
,
statusEvent
){
return
this
.
request
(
'
PUT
'
,
'
/instance/
'
+
id
,
callback
,
statusEvent
,
data
);
return
$
(
this
).
slapos
(
'
request
'
,
'
PUT
'
,
'
/instance/
'
+
id
,
callback
,
statusEvent
,
data
);
},
newComputer
:
function
(
data
,
callback
,
statusEvent
){
return
this
.
request
(
'
POST
'
,
'
/computer
'
,
callback
,
statusEvent
,
data
);
return
$
(
this
).
slapos
(
'
request
'
,
'
POST
'
,
'
/computer
'
,
callback
,
statusEvent
,
data
);
},
getComputer
:
function
(
id
,
callback
,
statusEvent
){
return
this
.
request
(
'
GET
'
,
'
/computer/
'
+
id
,
callback
,
statusEvent
);
return
$
(
this
).
slapos
(
'
request
'
,
'
GET
'
,
'
/computer/
'
+
id
,
callback
,
statusEvent
);
},
editComputer
:
function
(
id
,
data
,
callback
,
statusEvent
){
return
this
.
request
(
'
PUT
'
,
'
/computer/
'
+
id
,
callback
,
statusEvent
,
data
);
return
$
(
this
).
slapos
(
'
request
'
,
'
PUT
'
,
'
/computer/
'
+
id
,
callback
,
statusEvent
,
data
);
},
newSoftware
:
function
(
computerId
,
data
,
callback
,
statusEvent
){
return
this
.
request
(
'
POST
'
,
'
/computer/
'
+
computerId
+
'
/supply
'
,
callback
,
statusEvent
,
data
);
return
$
(
this
).
slapos
(
'
request
'
,
'
POST
'
,
'
/computer/
'
+
computerId
+
'
/supply
'
,
callback
,
statusEvent
,
data
);
},
bangComputer
:
function
(
id
,
log
,
callback
,
statusEvent
){
return
this
.
request
(
'
POST
'
,
'
/computer/
'
+
id
+
'
/bang
'
,
callback
,
statusEvent
,
log
);
return
$
(
this
).
slapos
(
'
request
'
,
'
POST
'
,
'
/computer/
'
+
id
+
'
/bang
'
,
callback
,
statusEvent
,
log
);
},
computerReport
:
function
(
id
,
data
,
callback
,
statusEvent
){
return
this
.
request
(
'
POST
'
,
'
/computer/
'
+
id
+
'
/report
'
,
callback
,
statusEvent
,
data
);
return
$
(
this
).
slapos
(
'
request
'
,
'
POST
'
,
'
/computer/
'
+
id
+
'
/report
'
,
callback
,
statusEvent
,
data
);
}
};
...
...
@@ -114,5 +118,4 @@
$
.
error
(
'
Method
'
+
method
+
'
does not exist on jQuery.slapos
'
);
}
};
})(
jQuery
);
\ No newline at end of file
jQuery/static/js/test.js
View file @
42bdbc93
This diff is collapsed.
Click to expand it.
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