Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
cb0d1842
Commit
cb0d1842
authored
Nov 17, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(bootgrid) add copy item command, closes
https://github.com/opnsense/core/issues/1260
parent
8731c5f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
opnsense_bootgrid_plugin.js
src/opnsense/www/js/opnsense_bootgrid_plugin.js
+36
-0
No files found.
src/opnsense/www/js/opnsense_bootgrid_plugin.js
View file @
cb0d1842
...
...
@@ -44,6 +44,7 @@ function stdBootgridUI(obj, sourceUrl, options) {
formatters
:
{
"
commands
"
:
function
(
column
,
row
)
{
return
"
<button type=
\"
button
\"
class=
\"
btn btn-xs btn-default command-edit
\"
data-row-id=
\"
"
+
row
.
uuid
+
"
\"
><span class=
\"
fa fa-pencil
\"
></span></button>
"
+
"
<button type=
\"
button
\"
class=
\"
btn btn-xs btn-default command-copy
\"
data-row-id=
\"
"
+
row
.
uuid
+
"
\"
><span class=
\"
fa fa-clone
\"
></span></button>
"
+
"
<button type=
\"
button
\"
class=
\"
btn btn-xs btn-default command-delete
\"
data-row-id=
\"
"
+
row
.
uuid
+
"
\"
><span class=
\"
fa fa-trash-o
\"
></span></button>
"
;
},
"
rowtoggle
"
:
function
(
column
,
row
)
{
...
...
@@ -145,6 +146,41 @@ $.fn.UIBootgrid = function (params) {
}
}).
end
();
// copy item, save as new
grid
.
find
(
"
.command-copy
"
).
on
(
"
click
"
,
function
(
e
)
{
if
(
editDlg
!=
undefined
&&
gridParams
[
'
get
'
]
!=
undefined
)
{
var
uuid
=
$
(
this
).
data
(
"
row-id
"
);
var
urlMap
=
{};
urlMap
[
'
frm_
'
+
editDlg
]
=
gridParams
[
'
get
'
]
+
uuid
;
mapDataToFormUI
(
urlMap
).
done
(
function
()
{
// update selectors
formatTokenizersUI
();
$
(
'
.selectpicker
'
).
selectpicker
(
'
refresh
'
);
// clear validation errors (if any)
clearFormValidation
(
'
frm_
'
+
editDlg
);
});
// show dialog for pipe edit
$
(
'
#
'
+
editDlg
).
modal
({
backdrop
:
'
static
'
,
keyboard
:
false
});
// define save action
$
(
"
#btn_
"
+
editDlg
+
"
_save
"
).
unbind
(
'
click
'
).
click
(
function
(){
if
(
gridParams
[
'
add
'
]
!=
undefined
)
{
saveFormToEndpoint
(
url
=
gridParams
[
'
add
'
],
formid
=
'
frm_
'
+
editDlg
,
callback_ok
=
function
(){
$
(
"
#
"
+
editDlg
).
modal
(
'
hide
'
);
$
(
"
#
"
+
gridId
).
bootgrid
(
"
reload
"
);
},
true
);
}
else
{
console
.
log
(
"
[grid] action add missing
"
)
}
});
}
else
{
console
.
log
(
"
[grid] action get or data-editDialog missing
"
)
}
}).
end
();
// delete item
grid
.
find
(
"
.command-delete
"
).
on
(
"
click
"
,
function
(
e
)
{
...
...
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