Skip to content

Commit a6d90ca

Browse files
author
Jessica Wang
committed
cloudStack 3.0 new UI - system service offering page - add details tab, Edit action, Delete action.
1 parent dd3757a commit a6d90ca

1 file changed

Lines changed: 123 additions & 5 deletions

File tree

‎ui/scripts/configuration.js‎

Lines changed: 123 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,7 @@
309309
label: 'System Service Offerings',
310310
fields: {
311311
name: { label: 'Name', editable: true },
312-
storagetype: { label: 'Storage Type' },
313-
cpuspeed: { label: 'CPU' },
314-
memory: { label: 'Memory' },
315-
domain: { label: 'Domain'}
312+
displaytext: { label: 'Description' }
316313
},
317314

318315
actions: {
@@ -481,7 +478,120 @@
481478
args.response.success({data:items});
482479
}
483480
});
484-
}
481+
},
482+
483+
detailView: {
484+
name: 'System service offering details',
485+
actions: {
486+
edit: {
487+
label: 'Edit',
488+
action: function(args) {
489+
var array1 = [];
490+
array1.push("&name=" + todb(args.data.name));
491+
array1.push("&displaytext=" + todb(args.data.displaytext));
492+
$.ajax({
493+
url: createURL("updateServiceOffering&id=" + args.context.systemServiceOfferings[0].id + array1.join("")),
494+
dataType: "json",
495+
success: function(json) {
496+
var item = json.updateserviceofferingresponse.serviceoffering;
497+
args.response.success({data: item});
498+
}
499+
});
500+
}
501+
},
502+
503+
'delete': {
504+
label: 'Delete system service offering',
505+
messages: {
506+
confirm: function(args) {
507+
return 'Are you sure you want to delete this system service offering?';
508+
},
509+
success: function(args) {
510+
return 'System service offering is being deleted.';
511+
},
512+
notification: function(args) {
513+
return 'Deleting system service offering';
514+
},
515+
complete: function(args) {
516+
return 'System service offering has been deleted.';
517+
}
518+
},
519+
action: function(args) {
520+
$.ajax({
521+
url: createURL("deleteServiceOffering&id=" + args.context.systemServiceOfferings[0].id),
522+
dataType: "json",
523+
async: true,
524+
success: function(json) {
525+
args.response.success();
526+
}
527+
});
528+
},
529+
notification: {
530+
poll: function(args) {
531+
args.complete();
532+
}
533+
}
534+
}
535+
},
536+
537+
tabs: {
538+
details: {
539+
title: 'Details',
540+
541+
fields: [
542+
{
543+
name: {
544+
label: 'Name',
545+
isEditable: true
546+
}
547+
},
548+
{
549+
id: { label: 'ID' },
550+
displaytext: {
551+
label: 'Description',
552+
isEditable: true
553+
},
554+
storagetype: { label: 'Storage Type' },
555+
cpunumber: { label: 'CPU number' },
556+
cpuspeed: {
557+
label: 'CPU speed',
558+
converter: function(args) {
559+
return cloudStack.converters.convertHz(args);
560+
}
561+
},
562+
memory: {
563+
label: 'Memory',
564+
converter: function(args) {
565+
return cloudStack.converters.convertBytes(args*1024*1024);
566+
}
567+
},
568+
networkrate: { label: 'Network rate' },
569+
offerha: {
570+
label: 'Offer HA',
571+
converter: cloudStack.converters.toBooleanText
572+
},
573+
limitcpuuse: {
574+
label: 'CPU cap',
575+
converter: cloudStack.converters.toBooleanText
576+
},
577+
tags: { label: 'Storage tags' },
578+
hosttags: { label: 'Host tags' },
579+
domain: { label: 'Domain' },
580+
created: { label: 'Created' }
581+
}
582+
],
583+
584+
dataProvider: function(args) {
585+
args.response.success(
586+
{
587+
actionFilter: systemServiceOfferingActionfilter,
588+
data:args.context.systemServiceOfferings[0]
589+
}
590+
);
591+
}
592+
}
593+
}
594+
}
485595
}
486596
},
487597

@@ -736,6 +846,14 @@
736846
return allowedActions;
737847
}
738848

849+
var systemServiceOfferingActionfilter = function(args) {
850+
var jsonObj = args.context.item;
851+
var allowedActions = [];
852+
allowedActions.push("edit");
853+
allowedActions.push("delete");
854+
return allowedActions;
855+
}
856+
739857
var networkOfferingsActionfilter = function(args) {
740858
var jsonObj = args.context.item;
741859
var allowedActions = [];

0 commit comments

Comments
 (0)