mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Localization for storage->volumes section
This commit is contained in:
parent
a4d991f848
commit
9ee043efde
@ -1,3 +1,14 @@
|
||||
label.done=Done
|
||||
label.vm.name=VM name
|
||||
message.migrate.volume=Please confirm that you want to migrate volume to another primary storage.
|
||||
label.migrate.volume=Migrate volume to another primary storage
|
||||
message.create.template=Are you sure you want to create template?
|
||||
label.create.template=Create template
|
||||
message.download.volume.confirm=Please confirm that you want to download this volume
|
||||
message.detach.disk=Are you sure you want to detach this disk?
|
||||
state.Ready=Ready
|
||||
label.vm.display.name=VM display name
|
||||
label.select-view=Select view
|
||||
label.local.storage=Local Storage
|
||||
label.direct.ips=Direct IPs
|
||||
label.view.all=View all
|
||||
@ -308,7 +319,7 @@ label.action.reboot.router.processing=Rebooting Router....
|
||||
label.action.reboot.router=Reboot Router
|
||||
label.action.reboot.systemvm.processing=Rebooting System VM....
|
||||
label.action.reboot.systemvm=Reboot System VM
|
||||
label.action.recurring.snapshot=Recurring Snapshot
|
||||
label.action.recurring.snapshot=Recurring Snapshots
|
||||
label.action.release.ip.processing=Releasing IP....
|
||||
label.action.release.ip=Release IP
|
||||
label.action.remove.host.processing=Removing Host....
|
||||
@ -587,7 +598,7 @@ label.menu.virtual.resources=Virtual Resources
|
||||
label.menu.volumes=Volumes
|
||||
label.migrate.instance.to=Migrate instance to
|
||||
label.minimum=Minimum
|
||||
label.minute.past.hour=Minute(s) Past the Hour
|
||||
label.minute.past.hour=minute(s) Past the Hour
|
||||
label.monday=Monday
|
||||
label.monthly=Monthly
|
||||
label.more.templates=More Templates
|
||||
@ -694,7 +705,7 @@ label.size=Size
|
||||
label.snapshot.limits=Snapshot Limits
|
||||
label.snapshot.name=Snapshot Name
|
||||
label.snapshot.s=Snapshot (s)
|
||||
label.snapshot.schedule=Snapshot Schedule
|
||||
label.snapshot.schedule=Setup Recurring Snapshot
|
||||
label.snapshot=Snapshot
|
||||
label.snapshots=Snapshots
|
||||
label.source.nat=Source NAT
|
||||
@ -842,7 +853,7 @@ message.action.start.systemvm=Please confirm that you want to start this system
|
||||
message.action.stop.instance=Please confirm that you want to stop this instance.
|
||||
message.action.stop.router=Please confirm that you want to stop this router.
|
||||
message.action.stop.systemvm=Please confirm that you want to stop this system VM.
|
||||
message.action.take.snapshot=Please confirm that you want to take snapshot.
|
||||
message.action.take.snapshot=Please confirm that you want to take a snapshot of this volume.
|
||||
message.add.cluster.zone=Add a hypervisor managed cluster for zone <b><span id="zone_name"></span></b>
|
||||
message.add.cluster=Add a hypervisor managed cluster for zone <b><span id="zone_name"></span></b>, pod <b><span id="pod_name"></span></b>
|
||||
message.add.disk.offering=Please specify the following parameters to add a new disk offering
|
||||
|
||||
66
ui/index.jsp
66
ui/index.jsp
@ -1237,10 +1237,10 @@
|
||||
|
||||
<div class="forms">
|
||||
<ul>
|
||||
<li class="hourly"><a href="#recurring-snapshots-hourly">Hourly</a></li>
|
||||
<li class="daily"><a href="#recurring-snapshots-daily">Daily</a></li>
|
||||
<li class="weekly"><a href="#recurring-snapshots-weekly">Weekly</a></li>
|
||||
<li class="monthly"><a href="#recurring-snapshots-monthly">Monthly</a></li>
|
||||
<li class="hourly"><a href="#recurring-snapshots-hourly"></a></li>
|
||||
<li class="daily"><a href="#recurring-snapshots-daily"></a></li>
|
||||
<li class="weekly"><a href="#recurring-snapshots-weekly"></a></li>
|
||||
<li class="monthly"><a href="#recurring-snapshots-monthly"></a></li>
|
||||
</ul>
|
||||
|
||||
<!-- Hourly -->
|
||||
@ -1250,7 +1250,7 @@
|
||||
|
||||
<!-- Time -->
|
||||
<div class="field time">
|
||||
<div class="name">Time</div>
|
||||
<div class="name"></div>
|
||||
<div class="value">
|
||||
<select name="schedule"></select>
|
||||
<label for="schedule">minutes(s) past the hour</label>
|
||||
@ -1259,7 +1259,7 @@
|
||||
|
||||
<!-- Timezone -->
|
||||
<div class="field timezone">
|
||||
<div class="name">Timezone</div>
|
||||
<div class="name"></div>
|
||||
<div class="value">
|
||||
<select name="timezone">
|
||||
<option value="Etc/GMT+12">[UTC-12:00] GMT-12:00</option>
|
||||
@ -1456,7 +1456,7 @@
|
||||
</div>
|
||||
|
||||
<div class="add-snapshot-actions">
|
||||
<div class="add-snapshot-action add">Add</div>
|
||||
<div class="add-snapshot-action add"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1599,6 +1599,58 @@
|
||||
|
||||
<script language="javascript">
|
||||
dictionary = {
|
||||
'label.instance': '<fmt:message key="label.instance"/>',
|
||||
'label.add': '<fmt:message key="label.add"/>',
|
||||
'label.done': '<fmt:message key="label.done"/>',
|
||||
'label.timezone': '<fmt:message key="label.timezone"/>',
|
||||
'label.time': '<fmt:message key="label.time"/>',
|
||||
'label.minute.past.hour': '<fmt:message key="label.minute.past.hour"/>',
|
||||
'label.monthly': '<fmt:message key="label.monthly"/>',
|
||||
'label.weekly': '<fmt:message key="label.weekly"/>',
|
||||
'label.daily': '<fmt:message key="label.daily"/>',
|
||||
'label.hourly': '<fmt:message key="label.hourly"/>',
|
||||
'message.action.take.snapshot': '<fmt:message key="message.action.take.snapshot"/>',
|
||||
'label.zone': '<fmt:message key="label.zone"/>',
|
||||
'label.vm.name': '<fmt:message key="label.vm.name"/>',
|
||||
'label.storage.type': '<fmt:message key="label.storage.type"/>',
|
||||
'label.device.id': '<fmt:message key="label.device.id"/>',
|
||||
'message.action.delete.volume': '<fmt:message key="message.action.delete.volume"/>',
|
||||
'label.action.delete.volume': '<fmt:message key="label.action.delete.volume"/>',
|
||||
'label.primary.storage': '<fmt:message key="label.primary.storage"/>',
|
||||
'label.migrate.volume': '<fmt:message key="label.migrate.volume"/>',
|
||||
'message.migrate.volume': '<fmt:message key="message.migrate.volume"/>',
|
||||
'label.password.enabled': '<fmt:message key="label.password.enabled"/>',
|
||||
'label.public': '<fmt:message key="label.public"/>',
|
||||
'message.create.template': '<fmt:message key="message.create.template"/>',
|
||||
'label.create.template': '<fmt:message key="label.create.template"/>',
|
||||
'message.download.volume.confirm': '<fmt:message key="message.download.volume.confirm"/>',
|
||||
'message.download.volume': '<fmt:message key="message.download.volume"/>',
|
||||
'label.action.download.volume': '<fmt:message key="label.action.download.volume"/>',
|
||||
'label.action.detach.disk': '<fmt:message key="label.action.detach.disk"/>',
|
||||
'message.detach.disk': '<fmt:message key="message.detach.disk"/>',
|
||||
'label.action.attach.disk': '<fmt:message key="label.action.attach.disk"/>',
|
||||
'label.saturday': '<fmt:message key="label.saturday"/>',
|
||||
'label.friday': '<fmt:message key="label.friday"/>',
|
||||
'label.thursday': '<fmt:message key="label.thursday"/>',
|
||||
'label.wednesday': '<fmt:message key="label.wednesday"/>',
|
||||
'label.tuesday': '<fmt:message key="label.tuesday"/>',
|
||||
'label.monday': '<fmt:message key="label.monday"/>',
|
||||
'label.sunday': '<fmt:message key="label.sunday"/>',
|
||||
'message.snapshot.schedule': '<fmt:message key="message.snapshot.schedule"/>',
|
||||
'label.action.recurring.snapshot': '<fmt:message key="label.action.recurring.snapshot"/>',
|
||||
'label.take.snapshot': '<fmt:message key="label.take.snapshot"/>',
|
||||
'label.snapshots': '<fmt:message key="label.snapshots"/>',
|
||||
'label.disk.size.gb': '<fmt:message key="label.disk.size.gb"/>',
|
||||
'label.disk.offering': '<fmt:message key="label.disk.offering"/>',
|
||||
'label.availability.zone': '<fmt:message key="label.availability.zone"/>',
|
||||
'message.add.volume': '<fmt:message key="message.add.volume"/>',
|
||||
'label.add.volume': '<fmt:message key="label.add.volume"/>',
|
||||
'state.Ready': '<fmt:message key="state.Ready"/>',
|
||||
'label.vm.display.name': '<fmt:message key="label.vm.display.name"/>',
|
||||
'label.storage.type': '<fmt:message key="label.storage.type"/>',
|
||||
'label.volumes': '<fmt:message key="label.volumes"/>',
|
||||
'label.select-view': '<fmt:message key="label.select-view"/>',
|
||||
'label.storage': '<fmt:message key="label.storage"/>',
|
||||
'label.local.storage': '<fmt:message key="label.local.storage"/>',
|
||||
'label.direct.ips': '<fmt:message key="label.direct.ips"/>',
|
||||
'label.secondary.storage': '<fmt:message key="label.secondary.storage"/>',
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
var diskofferingObjs, selectedDiskOfferingObj;
|
||||
|
||||
cloudStack.sections.storage = {
|
||||
title: 'Storage',
|
||||
title: 'label.storage',
|
||||
id: 'storage',
|
||||
sectionSelect: {
|
||||
label: 'Select view'
|
||||
label: 'label.select-view'
|
||||
},
|
||||
sections: {
|
||||
/**
|
||||
@ -14,21 +14,22 @@
|
||||
*/
|
||||
volumes: {
|
||||
type: 'select',
|
||||
title: 'Volumes',
|
||||
title: 'label.volumes',
|
||||
listView: {
|
||||
id: 'volumes',
|
||||
label: 'Volumes',
|
||||
label: 'label.volumes',
|
||||
fields: {
|
||||
name: { label: 'Name' },
|
||||
type: { label: 'Type' },
|
||||
storagetype: { label: 'Storage Type' },
|
||||
vmdisplayname: { label: 'VM Display Name' },
|
||||
name: { label: 'label.name' },
|
||||
type: { label: 'label.type' },
|
||||
storagetype: { label: 'label.storage.type' },
|
||||
vmdisplayname: { label: 'label.vm.display.name' },
|
||||
state: {
|
||||
converter: function(str) {
|
||||
// For localization
|
||||
return str;
|
||||
return 'state.' + str;
|
||||
},
|
||||
label: 'State', indicator: { 'Ready': 'on' }
|
||||
label: 'State',
|
||||
indicator: { 'Ready': 'on' }
|
||||
}
|
||||
},
|
||||
|
||||
@ -36,27 +37,27 @@
|
||||
actions: {
|
||||
// Add volume
|
||||
add: {
|
||||
label: 'Add volume',
|
||||
label: 'label.add.volume',
|
||||
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Are you sure you want to add a volume?';
|
||||
return 'message.add.volume';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'create volume';
|
||||
return 'label.add.volume';
|
||||
}
|
||||
},
|
||||
|
||||
createForm: {
|
||||
title: 'Add volume',
|
||||
desc: 'Please fill in the following data to add a new volume.',
|
||||
title: 'label.add.volume',
|
||||
desc: 'message.add.volume',
|
||||
fields: {
|
||||
name: {
|
||||
label: 'Name',
|
||||
label: 'label.name',
|
||||
validation: { required: true }
|
||||
},
|
||||
availabilityZone: {
|
||||
label: 'Availability Zone',
|
||||
label: 'label.availability.zone',
|
||||
select: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("listZones&available=true"),
|
||||
@ -70,7 +71,7 @@
|
||||
}
|
||||
},
|
||||
diskOffering: {
|
||||
label: 'Disk Offering',
|
||||
label: 'label.disk.offering',
|
||||
select: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("listDiskOfferings"),
|
||||
@ -111,7 +112,7 @@
|
||||
|
||||
,
|
||||
diskSize: {
|
||||
label: 'Disk size (in GB)',
|
||||
label: 'label.disk.size.gb',
|
||||
validation: { required: true, number: true },
|
||||
isHidden: true
|
||||
}
|
||||
@ -158,23 +159,23 @@
|
||||
notification: {
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
dataProvider: function(args) {
|
||||
var array1 = [];
|
||||
if(args.filterBy != null) {
|
||||
if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) {
|
||||
switch(args.filterBy.search.by) {
|
||||
case "name":
|
||||
if(args.filterBy.search.value.length > 0)
|
||||
array1.push("&keyword=" + args.filterBy.search.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dataProvider: function(args) {
|
||||
var array1 = [];
|
||||
if(args.filterBy != null) {
|
||||
if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) {
|
||||
switch(args.filterBy.search.by) {
|
||||
case "name":
|
||||
if(args.filterBy.search.value.length > 0)
|
||||
array1.push("&keyword=" + args.filterBy.search.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var apiCmd = "listVolumes&listAll=true&page=" + args.page + "&pagesize=" + pageSize+ array1.join("");
|
||||
if(args.context != null) {
|
||||
if("instances" in args.context) {
|
||||
@ -198,19 +199,19 @@
|
||||
|
||||
detailView: {
|
||||
name: 'Volume details',
|
||||
viewAll: { path: 'storage.snapshots', label: 'Snapshots' },
|
||||
viewAll: { path: 'storage.snapshots', label: 'label.snapshots' },
|
||||
actions: {
|
||||
takeSnapshot: {
|
||||
label: 'Take snapshot',
|
||||
label: 'label.take.snapshot',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Please confirm that you want to take a snapshot' ;
|
||||
return 'message.action.take.snapshot' ;
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'Take snapshot';
|
||||
return 'label.take.snapshot';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("createSnapshot&volumeid=" + args.context.volumes[0].id),
|
||||
dataType: "json",
|
||||
@ -236,265 +237,265 @@
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
},
|
||||
|
||||
recurringSnapshot: {
|
||||
label: 'Setup recurring snapshots',
|
||||
action: {
|
||||
custom: cloudStack.uiCustom.recurringSnapshots({
|
||||
desc: 'You can setup recurring snapshot schedules by selecting from the available options below and applying your policy preference.',
|
||||
dataProvider: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listSnapshotPolicies'),
|
||||
data: {
|
||||
volumeid: args.context.volumes[0].id
|
||||
},
|
||||
async: true,
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
args.response.success({
|
||||
data: $.map(
|
||||
data.listsnapshotpoliciesresponse.snapshotpolicy ? data.listsnapshotpoliciesresponse.snapshotpolicy : [],
|
||||
function(snapshot, index) {
|
||||
return {
|
||||
id: snapshot.id,
|
||||
type: snapshot.intervaltype,
|
||||
time: snapshot.intervaltype > 0 ?
|
||||
snapshot.schedule.split(':')[1] + ':' + snapshot.schedule.split(':')[0] :
|
||||
snapshot.schedule,
|
||||
timezone: snapshot.timezone,
|
||||
keep: snapshot.maxsnaps,
|
||||
'day-of-week': snapshot.intervaltype == 2 ?
|
||||
snapshot.schedule.split(':')[2] : null,
|
||||
'day-of-month': snapshot.intervaltype == 3 ?
|
||||
snapshot.schedule.split(':')[2] : null
|
||||
};
|
||||
}
|
||||
)
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
actions: {
|
||||
add: function(args) {
|
||||
var snap = args.snapshot;
|
||||
|
||||
var data = {
|
||||
keep: snap.maxsnaps,
|
||||
timezone: snap.timezone
|
||||
};
|
||||
recurringSnapshot: {
|
||||
label: 'label.snapshot.schedule',
|
||||
action: {
|
||||
custom: cloudStack.uiCustom.recurringSnapshots({
|
||||
desc: 'message.snapshot.schedule',
|
||||
dataProvider: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listSnapshotPolicies'),
|
||||
data: {
|
||||
volumeid: args.context.volumes[0].id
|
||||
},
|
||||
async: true,
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
args.response.success({
|
||||
data: $.map(
|
||||
data.listsnapshotpoliciesresponse.snapshotpolicy ? data.listsnapshotpoliciesresponse.snapshotpolicy : [],
|
||||
function(snapshot, index) {
|
||||
return {
|
||||
id: snapshot.id,
|
||||
type: snapshot.intervaltype,
|
||||
time: snapshot.intervaltype > 0 ?
|
||||
snapshot.schedule.split(':')[1] + ':' + snapshot.schedule.split(':')[0] :
|
||||
snapshot.schedule,
|
||||
timezone: snapshot.timezone,
|
||||
keep: snapshot.maxsnaps,
|
||||
'day-of-week': snapshot.intervaltype == 2 ?
|
||||
snapshot.schedule.split(':')[2] : null,
|
||||
'day-of-month': snapshot.intervaltype == 3 ?
|
||||
snapshot.schedule.split(':')[2] : null
|
||||
};
|
||||
}
|
||||
)
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
actions: {
|
||||
add: function(args) {
|
||||
var snap = args.snapshot;
|
||||
|
||||
var convertTime = function(minute, hour, meridiem, extra) {
|
||||
var convertedHour = meridiem == 'PM' ?
|
||||
(hour != 12 ? parseInt(hour) + 12 : 12) : (hour != 12 ? hour : '00');
|
||||
var time = minute + ':' + convertedHour;
|
||||
if (extra) time += ':' + extra;
|
||||
var data = {
|
||||
keep: snap.maxsnaps,
|
||||
timezone: snap.timezone
|
||||
};
|
||||
|
||||
return time;
|
||||
};
|
||||
var convertTime = function(minute, hour, meridiem, extra) {
|
||||
var convertedHour = meridiem == 'PM' ?
|
||||
(hour != 12 ? parseInt(hour) + 12 : 12) : (hour != 12 ? hour : '00');
|
||||
var time = minute + ':' + convertedHour;
|
||||
if (extra) time += ':' + extra;
|
||||
|
||||
switch (snap['snapshot-type']) {
|
||||
case 'hourly': // Hourly
|
||||
$.extend(data, {
|
||||
schedule: snap.schedule
|
||||
}); break;
|
||||
return time;
|
||||
};
|
||||
|
||||
case 'daily': // Daily
|
||||
$.extend(data, {
|
||||
schedule: convertTime(
|
||||
snap['time-minute'],
|
||||
snap['time-hour'],
|
||||
snap['time-meridiem']
|
||||
)
|
||||
}); break;
|
||||
switch (snap['snapshot-type']) {
|
||||
case 'hourly': // Hourly
|
||||
$.extend(data, {
|
||||
schedule: snap.schedule
|
||||
}); break;
|
||||
|
||||
case 'weekly': // Weekly
|
||||
$.extend(data, {
|
||||
schedule: convertTime(
|
||||
snap['time-minute'],
|
||||
snap['time-hour'],
|
||||
snap['time-meridiem'],
|
||||
snap['day-of-week']
|
||||
)
|
||||
}); break;
|
||||
case 'daily': // Daily
|
||||
$.extend(data, {
|
||||
schedule: convertTime(
|
||||
snap['time-minute'],
|
||||
snap['time-hour'],
|
||||
snap['time-meridiem']
|
||||
)
|
||||
}); break;
|
||||
|
||||
case 'monthly': // Monthly
|
||||
$.extend(data, {
|
||||
schedule: convertTime(
|
||||
snap['time-minute'],
|
||||
snap['time-hour'],
|
||||
snap['time-meridiem'],
|
||||
snap['day-of-month']
|
||||
)
|
||||
}); break;
|
||||
}
|
||||
case 'weekly': // Weekly
|
||||
$.extend(data, {
|
||||
schedule: convertTime(
|
||||
snap['time-minute'],
|
||||
snap['time-hour'],
|
||||
snap['time-meridiem'],
|
||||
snap['day-of-week']
|
||||
)
|
||||
}); break;
|
||||
|
||||
$.ajax({
|
||||
url: createURL('createSnapshotPolicy'),
|
||||
data: {
|
||||
volumeid: args.context.volumes[0].id,
|
||||
intervaltype: snap['snapshot-type'],
|
||||
maxsnaps: snap.maxsnaps,
|
||||
schedule: data.schedule,
|
||||
timezone: snap.timezone
|
||||
},
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
success: function(successData) {
|
||||
var snapshot = successData.createsnapshotpolicyresponse.snapshotpolicy;
|
||||
case 'monthly': // Monthly
|
||||
$.extend(data, {
|
||||
schedule: convertTime(
|
||||
snap['time-minute'],
|
||||
snap['time-hour'],
|
||||
snap['time-meridiem'],
|
||||
snap['day-of-month']
|
||||
)
|
||||
}); break;
|
||||
}
|
||||
|
||||
args.response.success({
|
||||
data: {
|
||||
id: snapshot.id,
|
||||
type: snapshot.intervaltype,
|
||||
time: snapshot.intervaltype > 0 ?
|
||||
snapshot.schedule.split(':')[1] + ':' + snapshot.schedule.split(':')[0] :
|
||||
snapshot.schedule,
|
||||
timezone: snapshot.timezone,
|
||||
keep: snapshot.maxsnaps,
|
||||
'day-of-week': snapshot.intervaltype == 2 ?
|
||||
snapshot.schedule.split(':')[2] : null,
|
||||
'day-of-month': snapshot.intervaltype == 3 ?
|
||||
snapshot.schedule.split(':')[2] : null
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
remove: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('deleteSnapshotPolicies'),
|
||||
data: {
|
||||
id: args.snapshot.id
|
||||
},
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
success: function(data) {
|
||||
args.response.success();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
$.ajax({
|
||||
url: createURL('createSnapshotPolicy'),
|
||||
data: {
|
||||
volumeid: args.context.volumes[0].id,
|
||||
intervaltype: snap['snapshot-type'],
|
||||
maxsnaps: snap.maxsnaps,
|
||||
schedule: data.schedule,
|
||||
timezone: snap.timezone
|
||||
},
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
success: function(successData) {
|
||||
var snapshot = successData.createsnapshotpolicyresponse.snapshotpolicy;
|
||||
|
||||
// Select data
|
||||
selects: {
|
||||
schedule: function(args) {
|
||||
var time = [];
|
||||
args.response.success({
|
||||
data: {
|
||||
id: snapshot.id,
|
||||
type: snapshot.intervaltype,
|
||||
time: snapshot.intervaltype > 0 ?
|
||||
snapshot.schedule.split(':')[1] + ':' + snapshot.schedule.split(':')[0] :
|
||||
snapshot.schedule,
|
||||
timezone: snapshot.timezone,
|
||||
keep: snapshot.maxsnaps,
|
||||
'day-of-week': snapshot.intervaltype == 2 ?
|
||||
snapshot.schedule.split(':')[2] : null,
|
||||
'day-of-month': snapshot.intervaltype == 3 ?
|
||||
snapshot.schedule.split(':')[2] : null
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
remove: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('deleteSnapshotPolicies'),
|
||||
data: {
|
||||
id: args.snapshot.id
|
||||
},
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
success: function(data) {
|
||||
args.response.success();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
for (var i = 1; i <= 59; i++) {
|
||||
time.push({
|
||||
id: i,
|
||||
name: i
|
||||
});
|
||||
}
|
||||
// Select data
|
||||
selects: {
|
||||
schedule: function(args) {
|
||||
var time = [];
|
||||
|
||||
args.response.success({
|
||||
data: time
|
||||
});
|
||||
},
|
||||
timezone: function(args) {
|
||||
args.response.success({
|
||||
data: $.map(timezoneMap, function(value, key) {
|
||||
return {
|
||||
id: key,
|
||||
name: value
|
||||
};
|
||||
})
|
||||
});
|
||||
},
|
||||
'day-of-week': function(args) {
|
||||
args.response.success({
|
||||
data: [
|
||||
{ id: 1, name: 'Sunday' },
|
||||
{ id: 2, name: 'Monday' },
|
||||
{ id: 3, name: 'Tuesday' },
|
||||
{ id: 4, name: 'Wednesday' },
|
||||
{ id: 5, name: 'Thursday' },
|
||||
{ id: 6, name: 'Friday' },
|
||||
{ id: 7, name: 'Saturday' }
|
||||
]
|
||||
});
|
||||
},
|
||||
for (var i = 1; i <= 59; i++) {
|
||||
time.push({
|
||||
id: i,
|
||||
name: i
|
||||
});
|
||||
}
|
||||
|
||||
'day-of-month': function(args) {
|
||||
var time = [];
|
||||
args.response.success({
|
||||
data: time
|
||||
});
|
||||
},
|
||||
timezone: function(args) {
|
||||
args.response.success({
|
||||
data: $.map(timezoneMap, function(value, key) {
|
||||
return {
|
||||
id: key,
|
||||
name: value
|
||||
};
|
||||
})
|
||||
});
|
||||
},
|
||||
'day-of-week': function(args) {
|
||||
args.response.success({
|
||||
data: [
|
||||
{ id: 1, name: 'label.sunday' },
|
||||
{ id: 2, name: 'label.monday' },
|
||||
{ id: 3, name: 'label.tuesday' },
|
||||
{ id: 4, name: 'label.wednesday' },
|
||||
{ id: 5, name: 'label.thursday' },
|
||||
{ id: 6, name: 'label.friday' },
|
||||
{ id: 7, name: 'label.saturday' }
|
||||
]
|
||||
});
|
||||
},
|
||||
|
||||
for (var i = 1; i <= 31; i++) {
|
||||
time.push({
|
||||
id: i,
|
||||
name: i
|
||||
});
|
||||
}
|
||||
'day-of-month': function(args) {
|
||||
var time = [];
|
||||
|
||||
args.response.success({
|
||||
data: time
|
||||
});
|
||||
},
|
||||
for (var i = 1; i <= 31; i++) {
|
||||
time.push({
|
||||
id: i,
|
||||
name: i
|
||||
});
|
||||
}
|
||||
|
||||
'time-hour': function(args) {
|
||||
var time = [];
|
||||
args.response.success({
|
||||
data: time
|
||||
});
|
||||
},
|
||||
|
||||
for (var i = 1; i <= 12; i++) {
|
||||
time.push({
|
||||
id: i,
|
||||
name: i
|
||||
});
|
||||
}
|
||||
'time-hour': function(args) {
|
||||
var time = [];
|
||||
|
||||
args.response.success({
|
||||
data: time
|
||||
});
|
||||
},
|
||||
for (var i = 1; i <= 12; i++) {
|
||||
time.push({
|
||||
id: i,
|
||||
name: i
|
||||
});
|
||||
}
|
||||
|
||||
'time-minute': function(args) {
|
||||
var time = [];
|
||||
args.response.success({
|
||||
data: time
|
||||
});
|
||||
},
|
||||
|
||||
for (var i = 0; i <= 59; i++) {
|
||||
time.push({
|
||||
id: i < 10 ? '0' + i : i,
|
||||
name: i < 10 ? '0' + i : i
|
||||
});
|
||||
}
|
||||
'time-minute': function(args) {
|
||||
var time = [];
|
||||
|
||||
args.response.success({
|
||||
data: time
|
||||
});
|
||||
},
|
||||
for (var i = 0; i <= 59; i++) {
|
||||
time.push({
|
||||
id: i < 10 ? '0' + i : i,
|
||||
name: i < 10 ? '0' + i : i
|
||||
});
|
||||
}
|
||||
|
||||
args.response.success({
|
||||
data: time
|
||||
});
|
||||
},
|
||||
|
||||
'time-meridiem': function(args) {
|
||||
args.response.success({
|
||||
data: [
|
||||
{ id: 'AM', name: 'AM' },
|
||||
{ id: 'PM', name: 'PM' }
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
messages: {
|
||||
notification: function(args) {
|
||||
return 'label.snapshot.schedule';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
'time-meridiem': function(args) {
|
||||
args.response.success({
|
||||
data: [
|
||||
{ id: 'AM', name: 'AM' },
|
||||
{ id: 'PM', name: 'PM' }
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
messages: {
|
||||
notification: function(args) {
|
||||
return 'Setup recurring snapshot';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
attachDisk: {
|
||||
addRow: 'false',
|
||||
label: 'Attach Disk',
|
||||
label: 'label.action.attach.disk',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Are you sure you want to attach disk?';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'Attach disk';
|
||||
return 'label.action.attach.disk';
|
||||
}
|
||||
},
|
||||
createForm: {
|
||||
title: 'Attach Disk',
|
||||
desc: 'Attach Disk to Instance',
|
||||
title: 'label.action.attach.disk',
|
||||
desc: 'label.action.attach.disk',
|
||||
fields: {
|
||||
virtualMachineId: {
|
||||
label: 'Instance',
|
||||
label: 'label.instance',
|
||||
select: function(args) {
|
||||
var zoneid = args.context.volumes[0].zoneid;
|
||||
var items = [];
|
||||
@ -505,7 +506,7 @@
|
||||
zoneid: zoneid,
|
||||
domainid: args.context.volumes[0].domainid,
|
||||
account: args.context.volumes[0].account
|
||||
};
|
||||
};
|
||||
} else {
|
||||
data = {
|
||||
zoneid: zoneid,
|
||||
@ -523,12 +524,15 @@
|
||||
success: function(json) {
|
||||
var instanceObjs= json.listvirtualmachinesresponse.virtualmachine;
|
||||
$(instanceObjs).each(function() {
|
||||
items.push({id: this.id, description: this.displayname});
|
||||
items.push({
|
||||
id: this.id, description: this.displayname ?
|
||||
this.displayname : this.name
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
args.response.success({data: items});
|
||||
}
|
||||
}
|
||||
@ -561,13 +565,13 @@
|
||||
}
|
||||
},
|
||||
detachDisk: {
|
||||
label: 'Detach disk',
|
||||
label: 'label.action.detach.disk',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Are you sure you want to detach disk?';
|
||||
return 'message.detach.disk';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'Detach disk';
|
||||
return 'label.action.detach.disk';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
@ -601,17 +605,17 @@
|
||||
},
|
||||
|
||||
downloadVolume: {
|
||||
label: 'Download volume',
|
||||
label: 'label.action.download.volume',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Are you sure you want to download volume?';
|
||||
return 'message.download.volume.confirm';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'Downloading volume';
|
||||
return 'label.action.download.volume';
|
||||
},
|
||||
complete: function(args) {
|
||||
var url = decodeURIComponent(args.url);
|
||||
var htmlMsg = 'Please click <a href="#">00000</a> to download volume';
|
||||
var htmlMsg = _l('message.download.volume');
|
||||
var htmlMsg2 = htmlMsg.replace(/#/, url).replace(/00000/, url);
|
||||
//$infoContainer.find("#info").html(htmlMsg2);
|
||||
return htmlMsg2;
|
||||
@ -645,23 +649,23 @@
|
||||
},
|
||||
|
||||
createTemplate: {
|
||||
label: 'Create template',
|
||||
label: 'label.create.template',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Are you sure you want to create template?';
|
||||
return 'message.create.template';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'Create template';
|
||||
return 'label.create.template';
|
||||
}
|
||||
},
|
||||
createForm: {
|
||||
title: 'Create Template',
|
||||
title: 'label.create.template',
|
||||
desc: '',
|
||||
fields: {
|
||||
name: { label: 'Name', validation: { required: true }},
|
||||
displayText: { label: 'Description', validation: { required: true }},
|
||||
name: { label: 'label.name', validation: { required: true }},
|
||||
displayText: { label: 'label.description', validation: { required: true }},
|
||||
osTypeId: {
|
||||
label: 'OS Type',
|
||||
label: 'label.os.type',
|
||||
select: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("listOsTypes"),
|
||||
@ -678,8 +682,8 @@
|
||||
});
|
||||
}
|
||||
},
|
||||
isPublic: { label: 'Public', isBoolean: true },
|
||||
isPasswordEnabled: { label: 'Password enabled', isBoolean: true }
|
||||
isPublic: { label: 'label.public', isBoolean: true },
|
||||
isPasswordEnabled: { label: 'label.password.enabled', isBoolean: true }
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
@ -726,27 +730,21 @@
|
||||
},
|
||||
|
||||
migrateToAnotherStorage: {
|
||||
label: 'Migrate volume to another primary storage',
|
||||
label: 'label.migrate.volume',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Please confirm that you want to migrate volume to another primary storage.';
|
||||
},
|
||||
success: function(args) {
|
||||
return 'Volume is being migrated to another primary storage.';
|
||||
return 'message.migrate.volume';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'Migrating volume to another primary storage.';
|
||||
},
|
||||
complete: function(args) {
|
||||
return 'Volume has been migrated to another primary storage.';
|
||||
return 'label.migrate.volume';
|
||||
}
|
||||
},
|
||||
createForm: {
|
||||
title: 'Migrate volumeto another primary storage',
|
||||
title: 'label.migrate.volume',
|
||||
desc: '',
|
||||
fields: {
|
||||
storageId: {
|
||||
label: 'Primary storage',
|
||||
label: 'label.primary.storage',
|
||||
validation: { required: true },
|
||||
select: function(args) {
|
||||
$.ajax({
|
||||
@ -794,13 +792,13 @@
|
||||
},
|
||||
|
||||
'destroy': {
|
||||
label: 'Delete volume',
|
||||
label: 'label.action.delete.volume',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Are you sure you want to delete volume?';
|
||||
return 'message.action.delete.volume';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'Delete volume';
|
||||
return 'label.action.delete.volume';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
@ -826,7 +824,7 @@
|
||||
},
|
||||
tabs: {
|
||||
details: {
|
||||
title: 'Details',
|
||||
title: 'label.details',
|
||||
|
||||
preFilter: function(args) {
|
||||
var hiddenFields;
|
||||
@ -841,16 +839,16 @@
|
||||
|
||||
fields: [
|
||||
{
|
||||
name: { label: 'Name', isEditable: true }
|
||||
name: { label: 'label.name', isEditable: true }
|
||||
},
|
||||
{
|
||||
id: { label: 'ID' },
|
||||
zonename: { label: 'Zone' },
|
||||
deviceid: { label: 'Device ID' },
|
||||
state: { label: 'State' },
|
||||
type: { label: 'Type' },
|
||||
storagetype: { label: 'Storage Type' },
|
||||
storage: { label: 'Storage' },
|
||||
zonename: { label: 'label.zone' },
|
||||
deviceid: { label: 'label.device.id' },
|
||||
state: { label: 'label.state' },
|
||||
type: { label: 'label.type' },
|
||||
storagetype: { label: 'label.storage.type' },
|
||||
storage: { label: 'label.storage' },
|
||||
size : {
|
||||
label: 'Size ',
|
||||
converter: function(args) {
|
||||
@ -869,11 +867,11 @@
|
||||
return args;
|
||||
}
|
||||
},
|
||||
vmname: { label: 'VM Name' },
|
||||
vmdisplayname: { label: 'VM Display Name' },
|
||||
created: { label: 'Created', converter: cloudStack.converters.toLocalDate },
|
||||
domain: { label: 'Domain' },
|
||||
account: { label: 'Account' }
|
||||
vmname: { label: 'label.vm.name' },
|
||||
vmdisplayname: { label: 'label.vm.display.name' },
|
||||
created: { label: 'label.created', converter: cloudStack.converters.toLocalDate },
|
||||
domain: { label: 'label.domain' },
|
||||
account: { label: 'label.account' }
|
||||
}
|
||||
],
|
||||
|
||||
@ -912,21 +910,21 @@
|
||||
},
|
||||
label: 'State', indicator: { 'BackedUp': 'on', 'Destroyed': 'off' }
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
dataProvider: function(args) {
|
||||
var array1 = [];
|
||||
if(args.filterBy != null) {
|
||||
if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) {
|
||||
switch(args.filterBy.search.by) {
|
||||
case "name":
|
||||
if(args.filterBy.search.value.length > 0)
|
||||
array1.push("&keyword=" + args.filterBy.search.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dataProvider: function(args) {
|
||||
var array1 = [];
|
||||
if(args.filterBy != null) {
|
||||
if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) {
|
||||
switch(args.filterBy.search.by) {
|
||||
case "name":
|
||||
if(args.filterBy.search.value.length > 0)
|
||||
array1.push("&keyword=" + args.filterBy.search.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var apiCmd = "listSnapshots&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("");
|
||||
if(args.context != null) {
|
||||
if("volumes" in args.context) {
|
||||
@ -1183,7 +1181,7 @@
|
||||
}
|
||||
}
|
||||
else { // Disk not attached
|
||||
allowedActions.push("destroy");
|
||||
allowedActions.push("destroy");
|
||||
allowedActions.push("migrateToAnotherStorage");
|
||||
if (jsonObj.storagetype == "shared") {
|
||||
allowedActions.push("attachDisk");
|
||||
|
||||
@ -9,8 +9,18 @@
|
||||
var $snapshots = $('#template').find('.recurring-snapshots').clone();
|
||||
var context = args.context;
|
||||
|
||||
// Update labels
|
||||
$snapshots.find('.forms ul li.hourly a').html(_l('label.hourly'));
|
||||
$snapshots.find('.forms ul li.daily a').html(_l('label.daily'));
|
||||
$snapshots.find('.forms ul li.weekly a').html(_l('label.weekly'));
|
||||
$snapshots.find('.forms ul li.monthly a').html(_l('label.monthly'));
|
||||
$snapshots.find('.field.timezone .name').html(_l('label.timezone'));
|
||||
$snapshots.find('.field.time .name').html(_l('label.time'));
|
||||
$snapshots.find('.field.time .value label').html(_l('label.minute.past.hour'));
|
||||
$snapshots.find('.add-snapshot-action.add').html(_l('label.add'));
|
||||
|
||||
// Get description
|
||||
$snapshots.find('.desc').html(desc);
|
||||
$snapshots.find('.desc').html(_l(desc));
|
||||
|
||||
// Snapshot type tabs
|
||||
$snapshots.find('.forms').tabs();
|
||||
@ -27,7 +37,7 @@
|
||||
$(args.data).each(function() {
|
||||
var $option = $('<option>').appendTo($select);
|
||||
|
||||
$option.val(this.id).html(this.name);
|
||||
$option.val(this.id).html(_l(this.name));
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -59,13 +69,13 @@
|
||||
|
||||
// Update fields
|
||||
$snapshotRow.find('td.time span').html(args.data.time);
|
||||
$snapshotRow.find('td.day-of-week span').html(
|
||||
$snapshotRow.find('td.day-of-week span').html(_l(
|
||||
args.data['day-of-week'] ?
|
||||
$snapshots.find('select[name=day-of-week] option').filter(function() {
|
||||
return $(this).val() == args.data['day-of-week'];
|
||||
}).html() :
|
||||
args.data['day-of-month']
|
||||
);
|
||||
));
|
||||
$snapshotRow.find('td.timezone span').html(
|
||||
$snapshots.find('select[name=timezone] option').filter(function() {
|
||||
return $(this).val() == args.data['timezone'];
|
||||
@ -161,12 +171,12 @@
|
||||
|
||||
// Create dialog
|
||||
var $dialog = $snapshots.dialog({
|
||||
title: 'Recurring Snapshots',
|
||||
title: _l('label.action.recurring.snapshot'),
|
||||
dialogClass: 'recurring-snapshots',
|
||||
width: 600,
|
||||
buttons: [
|
||||
{
|
||||
text: 'Done',
|
||||
text: _l('label.done'),
|
||||
'class': 'ok',
|
||||
click: function() {
|
||||
$dialog.fadeOut(function() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user