Skip to content

Commit

Permalink
Merge pull request #246 from razee-io/add_deployables_link
Browse files Browse the repository at this point in the history
Add deployables link
  • Loading branch information
mckaymic committed Mar 3, 2020
2 parents abb9e1f + b232031 commit 583e0e9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion imports/api/stat/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { Meteor } from 'meteor/meteor';
import { Stats } from './stats.js';
import { Clusters } from '../cluster/clusters/clusters.js';
import { Resources } from '../resource/resources.js';
import { Subscriptions } from '../deployables/subscriptions/subscriptions.js';

Meteor.methods({
updateResourceStats(orgId){
Expand All @@ -27,6 +28,7 @@ Meteor.methods({
}
const clusterCount = Clusters.find({org_id: orgId}).count();
const resourceCount = Resources.find({org_id: orgId, deleted: false}).count();
Stats.update({ org_id: orgId }, { $set: { deploymentCount: resourceCount, clusterCount: clusterCount } } );
const deployablesCount = Subscriptions.find({org_id: orgId}).count();
Stats.update({ org_id: orgId }, { $set: { deploymentCount: resourceCount, clusterCount: clusterCount, deployablesCount: deployablesCount } } );
},
});
1 change: 1 addition & 0 deletions imports/ui/layouts/body/body.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ Template.nav.helpers({
},
clusterCount: () => (_.get(Stats.findOne({org_id:Session.get('currentOrgId')}), 'clusterCount') || 0).toLocaleString(),
deploymentCount: () => (_.get(Stats.findOne({org_id:Session.get('currentOrgId')}), 'deploymentCount') || 0).toLocaleString(),
deployablesCount: () => (_.get(Stats.findOne({org_id:Session.get('currentOrgId')}), 'deployablesCount') || 0).toLocaleString()
});

Template.nav.events({
Expand Down
7 changes: 7 additions & 0 deletions imports/ui/layouts/body/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@
<span class="badge badge-dark align-middle">{{deploymentCount}}</span>
</a>
</li>

<li class="nav-item {{isActive 'deployables'}}">
<a class="nav-link" href="{{pathFor 'deployables'}}">
<span class="align-middle">Deployables</span>
<span class="badge badge-dark align-middle">{{deployablesCount}}</span>
</a>
</li>
{{/if}}
{{/if}}
{{/if}}
Expand Down
2 changes: 2 additions & 0 deletions imports/ui/pages/deployables/subscriptions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ Template.Subscriptions.events({
if(error) {
toastr.error('Error adding a subscription', error);
}
Meteor.call('updateResourceStats', Session.get('currentOrgId'));
});
showNewGroupRow.set(false);
editMode.set(false);
Expand Down Expand Up @@ -195,6 +196,7 @@ Template.Subscriptions.events({
if(error) {
toastr.error(`Error removing the subscription ${groupName}`, error);
}
Meteor.call('updateResourceStats', Session.get('currentOrgId'));
});
}
return false;
Expand Down

0 comments on commit 583e0e9

Please sign in to comment.