diff --git a/ui/scripts/globalSettings.js b/ui/scripts/globalSettings.js index 4cbfd07b238..34d65a2a593 100644 --- a/ui/scripts/globalSettings.js +++ b/ui/scripts/globalSettings.js @@ -234,7 +234,140 @@ } } } - }, + }, + baremetalRct: { + type: 'select', + title: 'Baremetal Rack Configuration', + listView: { + id: 'baremetalRct', + label: 'Baremetal Rack Configuration', + fields: { + id: { + label: 'label.id' + }, + url: { + label: 'label.url' + } + }, + dataProvider: function(args) { + var data = {}; + listViewDataProvider(args, data); + + $.ajax({ + url: createURL("listBaremetalRct"), + data: data, + success: function(json) { + args.response.success({ data: json.listbaremetalrctresponse.baremetalrct }); + } + }); + }, + actions: { + add: { + label: 'Add Baremetal Rack Configuration', + messages: { + notification: function(args) { + return 'Add Baremetal Rack Configuration'; + } + }, + createForm: { + title: 'Add Baremetal Rack Configuration', + fields: { + url: { + label: 'label.url', + validation: { + required: true + } + } + } + }, + action: function(args) { + $.ajax({ + url: createURL("addBaremetalRct"), + data: { + baremetalrcturl: args.data.url + }, + success: function(json) { + var jid = json.addbaremetalrctresponse.jobid + args.response.success({ + _custom: { + jobId: jid, + getUpdatedItem: function(json) { + return json.queryasyncjobresultresponse.jobresult.baremetalrct; + } + } + }); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + } + }, + + detailView: { + name: "details", + actions: { + remove: { + label: 'Delete Baremetal Rack Configuration', + messages: { + confirm: function(args) { + return 'Please confirm that you want to delete Baremetal Rack Configuration.'; + }, + notification: function(args) { + return 'Delete Baremetal Rack Configuration'; + } + }, + action: function(args) { + var data = { + id: args.context.baremetalRct[0].id + }; + $.ajax({ + url: createURL('deleteBaremetalRct'), + data: data, + success: function(json) { + var jid = json.deletebaremetalrctresponse.jobid; + args.response.success({ + _custom: { + jobId: jid + } + }); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + } + }, + tabs: { + details: { + title: 'label.details', + fields: [{ + id: { + label: 'label.id' + }, + url: { + label: 'label.url' + } + }], + dataProvider: function(args) { + var data = { + id: args.context.baremetalRct[0].id + }; + $.ajax({ + url: createURL("listBaremetalRct"), + data: data, + success: function(json) { + args.response.success({ data: json.listbaremetalrctresponse.baremetalrct[0] }); + } + }); + } + } + } + } + } + }, hypervisorCapabilities: { type: 'select', title: 'label.hypervisor.capabilities',