mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Remove the git commits widget from the admin dashboard
This commit is contained in:
parent
0eaf023025
commit
d492bac587
6 changed files with 40 additions and 115 deletions
|
@ -1,7 +0,0 @@
|
||||||
export default Ember.ArrayController.extend({
|
|
||||||
actions: {
|
|
||||||
goToGithub: function() {
|
|
||||||
window.open('https://github.com/discourse/discourse');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,41 +0,0 @@
|
||||||
/**
|
|
||||||
A model for a git commit to the discourse repo, fetched from the github.com api.
|
|
||||||
|
|
||||||
@class GithubCommit
|
|
||||||
@extends Discourse.Model
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
Discourse.GithubCommit = Discourse.Model.extend({
|
|
||||||
gravatarUrl: function(){
|
|
||||||
if( this.get('author') && this.get('author.gravatar_id') ){
|
|
||||||
return("https://www.gravatar.com/avatar/" + this.get('author.gravatar_id') + ".png?s=38&r=pg&d=identicon");
|
|
||||||
} else {
|
|
||||||
return "https://www.gravatar.com/avatar/b30fff48d257cdd17c4437afac19fd30.png?s=38&r=pg&d=identicon";
|
|
||||||
}
|
|
||||||
}.property("commit"),
|
|
||||||
|
|
||||||
commitUrl: function(){
|
|
||||||
return("https://github.com/discourse/discourse/commit/" + this.get('sha'));
|
|
||||||
}.property("sha"),
|
|
||||||
|
|
||||||
timeAgo: function() {
|
|
||||||
return moment(this.get('commit.committer.date')).relativeAge({format: 'medium', leaveAgo: true});
|
|
||||||
}.property("commit.committer.date")
|
|
||||||
});
|
|
||||||
|
|
||||||
Discourse.GithubCommit.reopenClass({
|
|
||||||
findAll: function() {
|
|
||||||
var result = Em.A();
|
|
||||||
Discourse.ajax( "https://api.github.com/repos/discourse/discourse/commits?callback=callback", {
|
|
||||||
dataType: 'jsonp',
|
|
||||||
type: 'get',
|
|
||||||
data: { per_page: 40 }
|
|
||||||
}).then(function (response) {
|
|
||||||
_.each(response.data,function(commit) {
|
|
||||||
result.pushObject( Discourse.GithubCommit.create(commit) );
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -11,7 +11,6 @@ export default Discourse.Route.extend({
|
||||||
|
|
||||||
setupController: function(c) {
|
setupController: function(c) {
|
||||||
this.fetchDashboardData(c);
|
this.fetchDashboardData(c);
|
||||||
this.fetchGithubCommits(c);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchDashboardData: function(c) {
|
fetchDashboardData: function(c) {
|
||||||
|
@ -45,13 +44,6 @@ export default Discourse.Route.extend({
|
||||||
c.set('problemsFetchedAt', new Date());
|
c.set('problemsFetchedAt', new Date());
|
||||||
c.loadProblems();
|
c.loadProblems();
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
fetchGithubCommits: function(c) {
|
|
||||||
if( !c.get('commitsCheckedAt') || moment().subtract(1, 'hour').toDate() > c.get('commitsCheckedAt') ) {
|
|
||||||
c.set('commitsCheckedAt', new Date());
|
|
||||||
c.set('githubCommits', Discourse.GithubCommit.findAll());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
<div class="commits-widget">
|
|
||||||
<div class="header" {{action "goToGithub"}}>
|
|
||||||
<h1>
|
|
||||||
<i class="fa fa-github"></i>
|
|
||||||
{{i18n admin.commits.latest_changes}}
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
<ul class="commits-list">
|
|
||||||
{{#each controller}}
|
|
||||||
<li>
|
|
||||||
<div class="left">
|
|
||||||
<img {{bind-attr src="gravatarUrl"}}>
|
|
||||||
</div>
|
|
||||||
<div class="right">
|
|
||||||
<span class="commit-message"><a {{bind-attr href="commitUrl"}} target="_blank">{{ commit.message }}</a></span><br/>
|
|
||||||
<span class="commit-meta">{{i18n admin.commits.by}} <span class="committer-name">{{ commit.author.name }}</span> - <span class="commit-time">{{{ timeAgo }}}</span></span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{{/each}}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
|
@ -1,38 +1,4 @@
|
||||||
<div class="dashboard-left">
|
<div class="dashboard-left">
|
||||||
{{#if foundProblems}}
|
|
||||||
<div class="dashboard-stats detected-problems">
|
|
||||||
<div class="look-here"><i class="fa fa-exclamation-triangle"></i></div>
|
|
||||||
<div class="problem-messages">
|
|
||||||
<p {{bind-attr class="loadingProblems:invisible"}}>
|
|
||||||
{{i18n admin.dashboard.problems_found}}
|
|
||||||
<ul {{bind-attr class="loadingProblems:invisible"}}>
|
|
||||||
{{#each problem in problems}}
|
|
||||||
<li>{{{problem}}}</li>
|
|
||||||
{{/each}}
|
|
||||||
</ul>
|
|
||||||
</p>
|
|
||||||
<p class="actions">
|
|
||||||
<small>{{i18n admin.dashboard.last_checked}}: {{problemsTimestamp}}</small>
|
|
||||||
<button {{action refreshProblems}} class="btn btn-small"><i class="fa fa-refresh"></i>{{i18n admin.dashboard.refresh_problems}}</button>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
</div>
|
|
||||||
{{else}}
|
|
||||||
{{#if thereWereProblems}}
|
|
||||||
<div class="dashboard-stats detected-problems">
|
|
||||||
<div class="look-here"> </div>
|
|
||||||
<div class="problem-messages">
|
|
||||||
<p>
|
|
||||||
{{i18n admin.dashboard.no_problems}}
|
|
||||||
<button {{action refreshProblems}} class="btn btn-small"><i class="fa fa-refresh"></i>{{i18n admin.dashboard.refresh_problems}}</button>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if Discourse.SiteSettings.version_checks}}
|
{{#if Discourse.SiteSettings.version_checks}}
|
||||||
{{partial 'admin/templates/version_checks'}}
|
{{partial 'admin/templates/version_checks'}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -138,7 +104,40 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dashboard-right">
|
<div class="dashboard-right">
|
||||||
{{ render 'admin/templates/commits' githubCommits }}
|
|
||||||
|
{{#if foundProblems}}
|
||||||
|
<div class="dashboard-stats detected-problems">
|
||||||
|
<div class="look-here"><i class="fa fa-exclamation-triangle"></i></div>
|
||||||
|
<div class="problem-messages">
|
||||||
|
<p {{bind-attr class="loadingProblems:invisible"}}>
|
||||||
|
{{i18n admin.dashboard.problems_found}}
|
||||||
|
<ul {{bind-attr class="loadingProblems:invisible"}}>
|
||||||
|
{{#each problem in problems}}
|
||||||
|
<li>{{{problem}}}</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
<p class="actions">
|
||||||
|
<small>{{i18n admin.dashboard.last_checked}}: {{problemsTimestamp}}</small>
|
||||||
|
<button {{action refreshProblems}} class="btn btn-small"><i class="fa fa-refresh"></i>{{i18n admin.dashboard.refresh_problems}}</button>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
{{#if thereWereProblems}}
|
||||||
|
<div class="dashboard-stats detected-problems">
|
||||||
|
<div class="look-here"> </div>
|
||||||
|
<div class="problem-messages">
|
||||||
|
<p>
|
||||||
|
{{i18n admin.dashboard.no_problems}}
|
||||||
|
<button {{action refreshProblems}} class="btn btn-small"><i class="fa fa-refresh"></i>{{i18n admin.dashboard.refresh_problems}}</button>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<div class="dashboard-stats">
|
<div class="dashboard-stats">
|
||||||
<table class="table table-condensed table-hover">
|
<table class="table table-condensed table-hover">
|
||||||
|
|
|
@ -591,6 +591,7 @@ section.details {
|
||||||
|
|
||||||
.dashboard-left {
|
.dashboard-left {
|
||||||
float: left;
|
float: left;
|
||||||
|
margin-top: 10px;
|
||||||
width: 60%;
|
width: 60%;
|
||||||
}
|
}
|
||||||
.dashboard-right {
|
.dashboard-right {
|
||||||
|
@ -606,6 +607,8 @@ section.details {
|
||||||
}
|
}
|
||||||
|
|
||||||
.version-check {
|
.version-check {
|
||||||
|
margin-top: 10px;
|
||||||
|
|
||||||
.version-number {
|
.version-number {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -790,9 +793,9 @@ table.api-keys {
|
||||||
}
|
}
|
||||||
|
|
||||||
.referred-topic-title {
|
.referred-topic-title {
|
||||||
width: 410px;
|
width: 355px;
|
||||||
@include medium-width { width: 360px; }
|
@include medium-width { width: 305px; }
|
||||||
@include small-width { width: 320px; }
|
@include small-width { width: 265px; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue