5a803da2ce8b98c37c13bdbd5e17ba0e9e91854c
[osm/LW-UI.git] / static / src / projecthandler / descriptorslist.js
1 function deletePackage(project_id, descriptor_type, package_id) {
2 bootbox.confirm("Are you sure want to delete?", function (result) {
3 if (result) {
4 location.href = '/projects/' + project_id + '/descriptors/' + descriptor_type + '/' + package_id + '/delete'
5 }
6 })
7 }
8
9
10
11 function openPackageContentList(project_id, type, pkg_id) {
12 var dialog = bootbox.dialog({
13 message: '<div class="text-center"><i class="fa fa-spin fa-spinner"></i> Loading...</div>',
14 closeButton: true
15 });
16 $.ajax({
17 url: '/projects/' + project_id + '/descriptors/' + type + '/' + pkg_id + '/action/get_package_files_list',
18 type: 'GET',
19 dataType: "json",
20 contentType: "application/json;charset=utf-8",
21 success: function (result) {
22 //$('#modal_show_vim_body').empty();
23 dialog.modal('hide');
24 build_file_list("Files in " + pkg_id, result.files);
25 },
26 error: function (result) {
27 dialog.modal('hide');
28 bootbox.alert("An error occurred while retrieving the package content.");
29 }
30 });
31 }
32
33
34 function build_file_list(title, list) {
35 $('#files_list_tbody').find('tr:gt(0)').remove();
36 $('#files_list_tbody_title').text(title)
37 for (var i in list) {
38 var template = '<tr><td>-</td><td>' + list[i] + '</td><td><button type="button" class="btn btn-default" onclick="" disabled><i class="fa fa-folder-open"></i></button></td></tr>'
39 $('#files_list_tbody').append(template)
40 }
41 $('#modal_files_list').modal('show');
42 }