Skip to content

Commit

Permalink
Adding Detail Widget
Browse files Browse the repository at this point in the history
  • Loading branch information
joncrain committed Oct 2, 2019
1 parent b44a0dd commit fcc89fd
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
5 changes: 5 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
"report": {
"title": "Munki Manifests Report"
},
"detail_widget": {
"title": "Munki Manifests",
"manifest_item": "Included Manifests",
"catalog_item": "Included Catalogs"
},
"widget": {
"title": "Included Manifests",
"catalog": "Munki Catalogs",
Expand Down
3 changes: 3 additions & 0 deletions provides.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
'client_tabs' => array(
'manifests-tab' => array('view' => 'manifests_tab', 'i18n' => 'manifests.listing.title'),
),
'detail_widgets' => [
'manifests_detail' => ['view' => 'manifests_detail_widget'],
],
'widgets' => array(
'manifests-included' => array('view' => 'included_manifests_widget'),
'manifests-catalog' => array('view' => 'catalog_widget'),
Expand Down
36 changes: 36 additions & 0 deletions views/manifests_detail_widget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<div class="col-lg-4">
<h4><i class="fa fa-book"></i> <span data-i18n="manifests.detail_widget.title"></span></h4>
<table id="manifests-data"></table>
</div>

<script>
$(document).on('appReady', function(){
mr.mwa2Link = "<?=conf('mwa2_link')?>";
$('#manifests-data')
.append($('<tr>')
.append($('<th>')
.text(i18n.t("manifests.detail_widget.manifest_item")))
.append($('<th>')
.text(i18n.t("manifests.detail_widget.catalog_item"))));
// Get Manifests data
$.getJSON( appUrl + '/module/manifests/get_data/' + serialNumber, function( data ) {
$.each(data, function(index, item){
if (mr.mwa2Link !== "") {
if (item.manifest_name !== "SelfServeManifest") {
link=' <a href="'+mr.mwa2Link+'/manifests/#'+item.manifest_name+'">'+item.manifest_name+'</a>'
} else {
link=' '+item.manifest_name
}
} else {
link=' '+item.manifest_name
}
$('#manifests-data')
.append($('<tr>')
.append($('<td>')
.append($(link)))
.append($('<td>')
.text(item.catalogs)));
});
});
});
</script>

0 comments on commit fcc89fd

Please sign in to comment.