-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
567 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Spira framework. | ||
* | ||
* @link https://github.com/spira/spira | ||
* | ||
* For the full copyright and license information, please view the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Support\Facades\Storage; | ||
use Spira\Core\Controllers\ApiController; | ||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||
|
||
class UtilityController extends ApiController | ||
{ | ||
/** | ||
* Enable permissions checks. | ||
*/ | ||
protected $permissionsEnabled = true; | ||
|
||
public function getSystemInformation() | ||
{ | ||
$file = 'system-information.json'; | ||
|
||
if (! Storage::disk('local')->has($file)) { | ||
throw new NotFoundHttpException("file $file not found"); | ||
} | ||
|
||
$file = Storage::disk('local')->get($file); | ||
$data = json_decode($file, true); | ||
|
||
return $this->getResponse() | ||
->item($data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
app/src/app/admin/utilities/systemInformation/systemInformation.tpl.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<section layout="row" id="shopping-list-builder" layout-align="space-around start"> | ||
|
||
<md-card flex novalidate class="md-whiteframe-z2" layout-padding> | ||
|
||
<md-toolbar> | ||
<div class="md-toolbar-tools"> | ||
<h2>System Information</h2> | ||
</div> | ||
</md-toolbar> | ||
|
||
|
||
<div ng-repeat="(source, commitDetails) in SystemInformationController.systemInformation" ng-if="!SystemInformationController.appMatchesApi || source == 'app'"> | ||
|
||
|
||
<h2> | ||
<span ng-if="SystemInformationController.appMatchesApi">Commit Details (APP and API match)</span> | ||
<span ng-if="!SystemInformationController.appMatchesApi">{{source | uppercase}} Commit Details</span> | ||
</h2> | ||
|
||
<div ng-if="source == 'app'"> | ||
<h3>Last App Build</h3> | ||
<h4>{{commitDetails.appBuildDate}} ({{commitDetails.appBuildDate | fromNow}})</h4> | ||
</div> | ||
|
||
<h3>Latest Commit</h3> | ||
<div layout="row"> | ||
<strong flex>Commit Hash</strong> | ||
<span flex>{{commitDetails.latestCommit.commit}}</span> | ||
</div> | ||
<div layout="row"> | ||
<strong flex>Author</strong> | ||
<span flex>{{commitDetails.latestCommit.author}}</span> | ||
</div> | ||
<div layout="row"> | ||
<strong flex>Message</strong> | ||
<span flex>{{commitDetails.latestCommit.message}}</span> | ||
</div> | ||
<div layout="row"> | ||
<strong flex>Date</strong> | ||
<span flex>{{commitDetails.latestCommit.date}}</span> | ||
</div> | ||
<div layout="row"> | ||
<strong flex>Refs</strong> | ||
<span flex>{{commitDetails.latestCommit.refs}}</span> | ||
</div> | ||
|
||
<div ng-if="commitDetails.latestCommit.commit !== commitDetails.tagCommit.commit"> | ||
<h3>Latest Tag (not the head commit)</h3> | ||
<div layout="row"> | ||
<strong flex>Commit Hash</strong> | ||
<span flex>{{commitDetails.tagCommit.commit}}</span> | ||
</div> | ||
<div layout="row"> | ||
<strong flex>Author</strong> | ||
<span flex>{{commitDetails.tagCommit.author}}</span> | ||
</div> | ||
<div layout="row"> | ||
<strong flex>Message</strong> | ||
<span flex>{{commitDetails.tagCommit.message}}</span> | ||
</div> | ||
<div layout="row"> | ||
<strong flex>Date</strong> | ||
<span flex>{{commitDetails.tagCommit.date}} ({{commitDetails.tagCommit.date | fromNow}})</span> | ||
</div> | ||
<div layout="row"> | ||
<strong flex>Refs</strong> | ||
<span flex>{{commitDetails.tagCommit.refs}}</span> | ||
</div> | ||
|
||
</div> | ||
|
||
<h3>Continuous Integration</h3> | ||
<div layout="row"> | ||
<strong flex>Build ID</strong> | ||
<span flex><a target="_blank" href="{{commitDetails.ciBuild.url}}">{{commitDetails.ciBuild.id}}</a></span> | ||
</div> | ||
<div layout="row"> | ||
<strong flex>Build Date</strong> | ||
<span flex>{{commitDetails.ciBuild.date}} ({{commitDetails.ciBuild.date | fromNow}})</span> | ||
</div> | ||
<div layout="row"> | ||
<strong flex>Deployment ID</strong> | ||
<span flex><a target="_blank" href="{{commitDetails.ciDeployment.url}}">{{commitDetails.ciDeployment.id}}</a></span> | ||
</div> | ||
<div layout="row"> | ||
<strong flex>Build Date</strong> | ||
<span flex>{{commitDetails.ciDeployment.date}} ({{commitDetails.ciDeployment.date | fromNow}})</span> | ||
</div> | ||
|
||
</div> | ||
|
||
</md-card> | ||
</section> |
61 changes: 61 additions & 0 deletions
61
app/src/app/admin/utilities/systemInformation/systemInformation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
namespace app.admin.utilities.systemInformation { | ||
|
||
export const namespace = 'app.admin.utilities.systemInformation'; | ||
|
||
export class SystemInformationConfig { | ||
|
||
static $inject = ['stateHelperServiceProvider']; | ||
constructor(private stateHelperServiceProvider){ | ||
|
||
let state:global.IState = { | ||
url: '/system-information', | ||
views: { | ||
"main@app.admin": { | ||
controller: namespace+'.controller', | ||
controllerAs: 'SystemInformationController', | ||
templateUrl: 'templates/app/admin/utilities/systemInformation/systemInformation.tpl.html', | ||
} | ||
}, | ||
resolve: /*@ngInject*/{ | ||
systemInformation: (systemInformationService:common.services.systemInformation.SystemInformationService):ng.IPromise<common.services.systemInformation.ISystemInformationSources> => { | ||
return systemInformationService.getSystemInformation(); | ||
}, | ||
}, | ||
data: { | ||
title: "System Information", | ||
icon: 'developer_mode', | ||
navigation: true, | ||
} | ||
}; | ||
|
||
stateHelperServiceProvider.addState(namespace, state); | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
export class SystemInformationController { | ||
|
||
public appMatchesApi:boolean; | ||
|
||
static $inject = [ | ||
'systemInformation', | ||
]; | ||
constructor( | ||
public systemInformation:common.services.systemInformation.ISystemInformationSources | ||
) { | ||
|
||
this.appMatchesApi = systemInformation.app.latestCommit.commit === systemInformation.api.latestCommit.commit; | ||
} | ||
|
||
} | ||
|
||
angular.module(namespace, []) | ||
.config(SystemInformationConfig) | ||
.controller(namespace+'.controller', SystemInformationController); | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
namespace app.admin.utilities { | ||
|
||
export const namespace = 'app.admin.utilities'; | ||
|
||
export class UtilitiesConfig { | ||
|
||
static $inject = ['stateHelperServiceProvider']; | ||
constructor(private stateHelperServiceProvider){ | ||
|
||
let state:global.IState = { | ||
url: '/utilities', | ||
abstract: true, | ||
data: { | ||
title: "Utilities", | ||
icon: 'settings_applications', | ||
navigation: true, | ||
navigationGroup: 'admin', | ||
sortAfter: app.admin.users.namespace, | ||
} | ||
}; | ||
|
||
stateHelperServiceProvider.addState(namespace, state); | ||
} | ||
|
||
} | ||
|
||
angular.module(namespace, [ | ||
namespace + '.systemInformation', | ||
]) | ||
.config(UtilitiesConfig); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace common.filters.momentFilters { | ||
|
||
describe('Moment filter', function () { | ||
let $filter:ng.IFilterService; | ||
|
||
beforeEach(function () { | ||
module('app'); | ||
|
||
inject(function (_$filter_) { | ||
$filter = _$filter_; | ||
}); | ||
}); | ||
|
||
it('should filter a moment object to a friendly date', function () { | ||
|
||
let dt = moment().subtract(10, 'minutes'); | ||
|
||
let result = $filter('fromNow')(dt); | ||
|
||
expect(result).to.equal('10 minutes ago'); | ||
}); | ||
}); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace common.filters.momentFilters { | ||
|
||
export const namespace = 'common.filters.momentFilters'; | ||
|
||
export function FromNowFilter() { | ||
|
||
return function fromNow(date:moment.Moment):string|any{ | ||
if(!moment.isMoment(date)){ | ||
return date; | ||
} | ||
return date.fromNow(); | ||
} | ||
} | ||
|
||
angular.module(namespace, []) | ||
.filter('fromNow', FromNowFilter) | ||
; | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.