Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
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
Administrator
pve-manager
Commits
1ade470d
Commit
1ade470d
authored
Apr 20, 2012
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add startup option to GUI
parent
ab71c272
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
165 additions
and
1 deletion
+165
-1
Makefile
www/manager/Makefile
+1
-0
Parser.js
www/manager/Parser.js
+50
-0
Utils.js
www/manager/Utils.js
+22
-1
Options.js
www/manager/qemu/Options.js
+7
-0
StartupEdit.js
www/manager/qemu/StartupEdit.js
+85
-0
No files found.
www/manager/Makefile
View file @
1ade470d
...
...
@@ -96,6 +96,7 @@ JSSRC= \
qemu/DisplayEdit.js
\
qemu/KeyboardEdit.js
\
qemu/HardwareView.js
\
qemu/StartupEdit.js
\
qemu/Options.js
\
qemu/Config.js
\
qemu/CreateWizard.js
\
...
...
www/manager/Parser.js
View file @
1ade470d
...
...
@@ -185,5 +185,55 @@ Ext.define('PVE.Parser', { statics: {
});
return
netarray
.
join
(
'
;
'
);
},
parseStartup
:
function
(
value
)
{
if
(
value
===
undefined
)
{
return
;
}
var
res
=
{};
var
errors
=
false
;
Ext
.
Array
.
each
(
value
.
split
(
'
,
'
),
function
(
p
)
{
if
(
!
p
||
p
.
match
(
/^
\s
*$/
))
{
return
;
// continue
}
var
match_res
;
if
((
match_res
=
p
.
match
(
/^
(
order
)?
=
(\d
+
)
$/
))
!==
null
)
{
res
.
order
=
match_res
[
2
];
}
else
if
((
match_res
=
p
.
match
(
/^up=
(\d
+
)
$/
))
!==
null
)
{
res
.
up
=
match_res
[
1
];
}
else
if
((
match_res
=
p
.
match
(
/^down=
(\d
+
)
$/
))
!==
null
)
{
res
.
down
=
match_res
[
1
];
}
else
{
errors
=
true
;
return
false
;
// break
}
});
if
(
errors
)
{
return
;
}
return
res
;
},
printStartup
:
function
(
startup
)
{
var
arr
=
[];
if
(
startup
.
order
!==
undefined
&&
startup
.
order
!==
''
)
{
arr
.
push
(
'
order=
'
+
startup
.
order
);
}
if
(
startup
.
up
!==
undefined
&&
startup
.
up
!==
''
)
{
arr
.
push
(
'
up=
'
+
startup
.
up
);
}
if
(
startup
.
down
!==
undefined
&&
startup
.
down
!==
''
)
{
arr
.
push
(
'
down=
'
+
startup
.
down
);
}
return
arr
.
join
(
'
,
'
);
}
}});
www/manager/Utils.js
View file @
1ade470d
...
...
@@ -244,6 +244,25 @@ Ext.define('PVE.Utils', { statics: {
return
data
;
},
render_kvm_startup
:
function
(
value
)
{
var
startup
=
PVE
.
Parser
.
parseStartup
(
value
);
var
res
=
'
order=
'
;
if
(
startup
.
order
===
undefined
)
{
res
+=
'
any
'
;
}
else
{
res
+=
startup
.
order
;
}
if
(
startup
.
up
!==
undefined
)
{
res
+=
'
,up=
'
+
startup
.
up
;
}
if
(
startup
.
down
!==
undefined
)
{
res
+=
'
,down=
'
+
startup
.
down
;
}
return
res
;
},
authOK
:
function
()
{
return
Ext
.
util
.
Cookies
.
get
(
'
PVEAuthCookie
'
);
},
...
...
@@ -419,7 +438,9 @@ Ext.define('PVE.Utils', { statics: {
imgcopy
:
[
''
,
gettext
(
'
Copy data
'
)
],
imgdel
:
[
''
,
gettext
(
'
Erase data
'
)
],
download
:
[
''
,
gettext
(
'
Download
'
)
],
vzdump
:
[
''
,
gettext
(
'
Backup
'
)
]
vzdump
:
[
''
,
gettext
(
'
Backup
'
)
],
startall
:
[
''
,
gettext
(
'
Start all VMs and Containers
'
)
],
stopall
:
[
''
,
gettext
(
'
Stop all VMs and Containers
'
)
]
},
format_task_description
:
function
(
type
,
id
)
{
...
...
www/manager/qemu/Options.js
View file @
1ade470d
...
...
@@ -54,6 +54,13 @@ Ext.define('PVE.qemu.Options', {
}
}
:
undefined
},
startup
:
{
header
:
gettext
(
'
Start/Shutdown order
'
),
defaultValue
:
''
,
renderer
:
PVE
.
Utils
.
render_kvm_startup
,
editor
:
caps
.
vms
[
'
VM.Config.Options
'
]
&&
caps
.
nodes
[
'
Sys.Modify
'
]
?
'
PVE.qemu.StartupEdit
'
:
undefined
},
ostype
:
{
header
:
'
OS Type
'
,
editor
:
caps
.
vms
[
'
VM.Config.Options
'
]
?
'
PVE.qemu.OSTypeEdit
'
:
undefined
,
...
...
www/manager/qemu/StartupEdit.js
0 → 100644
View file @
1ade470d
Ext
.
define
(
'
PVE.qemu.StartupInputPanel
'
,
{
extend
:
'
PVE.panel.InputPanel
'
,
onGetValues
:
function
(
values
)
{
var
me
=
this
;
var
res
=
PVE
.
Parser
.
printStartup
(
values
);
if
(
res
===
undefined
||
res
===
''
)
{
return
{
'
delete
'
:
'
startup
'
};
}
return
{
startup
:
res
};
},
setStartup
:
function
(
value
)
{
var
me
=
this
;
var
startup
=
PVE
.
Parser
.
parseStartup
(
value
);
if
(
startup
)
{
console
.
dir
(
startup
);
me
.
setValues
(
startup
);
}
},
initComponent
:
function
()
{
var
me
=
this
;
me
.
items
=
[
{
xtype
:
'
textfield
'
,
name
:
'
order
'
,
defaultValue
:
''
,
emptyText
:
'
any
'
,
fieldLabel
:
gettext
(
'
Start order
'
)
},
{
xtype
:
'
textfield
'
,
name
:
'
up
'
,
defaultValue
:
''
,
emptyText
:
'
default
'
,
fieldLabel
:
gettext
(
'
Startup delay
'
)
},
{
xtype
:
'
textfield
'
,
name
:
'
down
'
,
defaultValue
:
''
,
emptyText
:
'
default
'
,
fieldLabel
:
gettext
(
'
Shutdown timeout
'
)
}
];
me
.
callParent
();
}
});
Ext
.
define
(
'
PVE.qemu.StartupEdit
'
,
{
extend
:
'
PVE.window.Edit
'
,
initComponent
:
function
()
{
/*jslint confusion: true */
var
me
=
this
;
var
ipanel
=
Ext
.
create
(
'
PVE.qemu.StartupInputPanel
'
,
{});
Ext
.
applyIf
(
me
,
{
subject
:
gettext
(
'
Start/Shutdown order
'
),
fieldDefaults
:
{
labelWidth
:
120
},
items
:
ipanel
});
me
.
callParent
();
me
.
load
({
success
:
function
(
response
,
options
)
{
var
i
,
confid
;
me
.
vmconfig
=
response
.
result
.
data
;
ipanel
.
setStartup
(
me
.
vmconfig
.
startup
);
}
});
}
});
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