Skip to content

Commit 4b636a1

Browse files
author
Jessica Wang
committed
CLOUDSTACK-1910: cloudstack UI - Regions menu - GSLB - load balancer rules - implement "Assign load balancer rule to GSLB" action.
1 parent 32ccb8a commit 4b636a1

1 file changed

Lines changed: 72 additions & 10 deletions

File tree

ui/scripts/regions.js

Lines changed: 72 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -451,16 +451,15 @@
451451
}
452452
}
453453
},
454-
455-
//???
454+
456455
lbUnderGSLB: {
457456
id: 'lbUnderGSLB',
458457
type: 'select',
459-
title: 'load balancer rules assigned to this GSLB',
458+
title: 'assigned load balancer rules',
460459
listView: {
461460
section: 'lbUnderGSLB',
462461
id: 'lbUnderGSLB',
463-
label: 'load balancer rules assigned to this GSLB',
462+
label: 'assigned load balancer rules',
464463
fields: {
465464
name: { label: 'label.name' },
466465
publicport: { label: 'label.public.port' },
@@ -482,7 +481,71 @@
482481
});
483482
}
484483
});
485-
},
484+
},
485+
actions: {
486+
add: {
487+
label: 'assign load balancer rule to GSLB',
488+
messages: {
489+
confirm: function(args) {
490+
return 'Please confirm you want to assign load balancer rule to GSLB';
491+
},
492+
notification: function(args) {
493+
return 'assign load balancer rule to GSLB';
494+
}
495+
},
496+
createForm: {
497+
title: 'assign load balancer rule to GSLB',
498+
fields: {
499+
loadbalancerrule: {
500+
label: 'load balancer rule',
501+
select: function(args) {
502+
var data = {
503+
globalloadbalancerruleid: args.context.GSLB[0].id,
504+
listAll: true
505+
};
506+
$.ajax({
507+
url: createURL('listLoadBalancerRules'),
508+
data: data,
509+
success: function(json) {
510+
var items = json.listloadbalancerrulesresponse.loadbalancerrule;
511+
args.response.success({
512+
data: items,
513+
descriptionField: 'name'
514+
});
515+
}
516+
});
517+
}
518+
}
519+
}
520+
},
521+
action: function(args) {
522+
var data = {
523+
id: args.context.GSLB[0].id,
524+
loadbalancerrulelist: args.data.loadbalancerrule
525+
};
526+
$.ajax({
527+
url: createURL('assignToGlobalLoadBalancerRule'),
528+
data: data,
529+
success: function(json) {
530+
var jid = json.assigntogloballoadbalancerruleresponse.jobid;
531+
args.response.success(
532+
{_custom:
533+
{jobId: jid,
534+
getUpdatedItem: function(json) {
535+
return json.queryasyncjobresultresponse.jobresult.loadbalancerrule;
536+
}
537+
}
538+
}
539+
);
540+
}
541+
});
542+
},
543+
notification: {
544+
poll: pollAsyncJobResult
545+
}
546+
}
547+
},
548+
486549
detailView: {
487550
name: 'load balancer rule details',
488551
actions: {
@@ -528,12 +591,12 @@
528591
publicport: { label: 'label.public.port' },
529592
privateport: { label: 'label.private.port' },
530593
algorithm: { label: 'label.algorithm' },
531-
publicip: { label: 'label.public.ip' },
594+
publicip: { label: 'label.public.ip' },
595+
state: { label: 'label.state' },
532596
id: { label: 'label.id' },
533597
cidrlist: { label: 'label.cidr' },
534598
domain: { label: 'label.domain' },
535-
account: { label: 'label.account' },
536-
state: { label: 'label.state' }
599+
account: { label: 'label.account' }
537600
}
538601
],
539602
dataProvider: function(args) {
@@ -554,8 +617,7 @@
554617
}
555618
}
556619
}
557-
}
558-
//???
620+
}
559621
}
560622
};
561623

0 commit comments

Comments
 (0)