Skip to content

Commit

Permalink
Merge pull request #3 from Sander0542/feature/about
Browse files Browse the repository at this point in the history
About page
  • Loading branch information
Sander0542 authored Dec 25, 2021
2 parents a2f63fd + 0293deb commit 3ca335a
Show file tree
Hide file tree
Showing 9 changed files with 238 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

# Install the npm tool
- name: Setup node
Expand All @@ -46,6 +48,10 @@ jobs:
- name: Laravel mix
run: npm run production

# Store the version
- name: Store version
run: git describe > public/version

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
Expand Down
1 change: 1 addition & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 58 additions & 0 deletions app/Http/Controllers/AboutController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Inertia\Inertia;
use MCStreetguy\ComposerParser\Factory as ComposerParser;

class AboutController extends Controller
{
public function index()
{
$versionFilePath = public_path('version');
$applicationVersion = 'Unknown';
if (file_exists($versionFilePath)) {
$applicationVersion = file_get_contents($versionFilePath);
}

$composerFile = ComposerParser::parseComposerJson(base_path('composer.json'));
$composerLock = ComposerParser::parseLockfile(base_path('composer.lock'));
$composerPackages = collect($composerLock->getPackages()->getData())->map(function ($package) {
return [
'name' => $package['name'],
'description' => $package['description'] ?? null,
'version' => $package['version'],
'licenses' => $package['license'] ?? [],
];
})->toArray();

$npmJson = json_decode(file_get_contents(base_path('package-lock.json')), true);
$npmPackages = collect($npmJson['packages']['']['devDependencies'])->map(function ($version, $package) use ($npmJson) {
return $npmJson['dependencies'][$package]['version'];
});

return Inertia::render('About/Index', [
'application' => [
'about' => [
'Authors' => collect($composerFile->getAuthors())->map(function ($author) {
return $author->getName();
}),
'License' => $composerFile->getLicense()[0],
],
'versions' => [
'Application' => $applicationVersion,
'PHP' => phpversion(),
'Laravel' => app()->version(),
],
'extensions' => collect(get_loaded_extensions())->mapWithKeys(function ($extension) {
return [$extension => phpversion($extension)];
})->toArray(),
'libraries' => [
'composer' => $composerPackages,
'npm' => $npmPackages,
],
],
]);
}
}
14 changes: 13 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@
"name": "sander0542/network-manager",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"authors": [
{
"name": "Sander Jochems",
"email": "[email protected]",
"homepage": "https://sanderjochems.com",
"role": "Founder"
}
],
"require": {
"php": "^8.0",
"fruitcake/laravel-cors": "^2.0",
Expand All @@ -15,6 +26,7 @@
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5",
"markrogoyski/ipv4-subnet-calculator": "^3.1",
"mcstreetguy/composer-parser": "^1.1",
"tightenco/ziggy": "^1.0"
},
"require-dev": {
Expand Down
43 changes: 42 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions resources/js/Layouts/AppLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@

<hr class="dropdown-divider">

<h6 class="dropdown-header small text-muted">
Application
</h6>

<jet-dropdown-link :href="route('about.index')">
About
</jet-dropdown-link>

<a class="dropdown-item px-4 link-donate" href="https://github.com/sponsors/Sander0542" target="_blank">
Donate
</a>

<hr class="dropdown-divider">

<!-- Authentication -->
<form @submit.prevent="logout">
<jet-dropdown-link as="button">
Expand Down
91 changes: 91 additions & 0 deletions resources/js/Pages/About/Index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<template>
<app-layout title="About">
<template #header>
<h2 class="h4 font-weight-bold">
About
</h2>
</template>

<div class="row">
<div class="col-4">
<div class="card">
<div class="card-body">
<h5 class="card-title">Application</h5>
<table class="table table-borderless">
<tr v-for="(information, title) in application.about">
<th>{{ title }}</th>
<td v-if=" typeof information == 'object'" v-for="item in information">{{ item }}</td>
<td v-else>{{ information }}</td>
</tr>
</table>
</div>
</div>
<div class="card mt-4">
<div class="card-body">
<h5 class="card-title">Versions</h5>
<table class="table table-borderless">
<tr v-for="(version, type) in application.versions">
<th>{{ type }}</th>
<td>{{ version }}</td>
</tr>
</table>
</div>
</div>
<div class="card mt-4">
<div class="card-body">
<h5 class="card-title">PHP Extensions</h5>
<table class="table table-borderless">
<tr v-for="(version, extension) in application.extensions">
<th>{{ extension }}</th>
<td>{{ version }}</td>
</tr>
</table>
</div>
</div>
<div class="card mt-4">
<div class="card-body">
<h5 class="card-title">NPM Packages</h5>
<table class="table table-borderless">
<tr v-for="(version, library) in application.libraries.npm">
<th>{{ library }}</th>
<td>{{ version }}</td>
</tr>
</table>
</div>
</div>
</div>
<div class="col-8">
<div class="card">
<div class="card-body pb-0">
<h5 class="card-title m-0">Composer Packages</h5>
</div>
<ul class="list-group">
<li v-for="library in application.libraries.composer" class="list-group-item d-flex justify-content-between align-items-center border-0 border-bottom">
<div class="me-auto">
<div class="fw-bold">{{ library.name }}</div>
{{ library.description }}
</div>
<span v-for="license in library.licenses" class="badge bg-success rounded-pill me-1">{{ license }}</span>
<span class="badge bg-success rounded-pill">{{ library.version }}</span>
</li>
</ul>
</div>
</div>
</div>

</app-layout>
</template>

<script>
import {defineComponent} from "vue"
import AppLayout from "@/Layouts/AppLayout.vue"
export default defineComponent({
components: {
AppLayout,
},
props: {
application: Object
}
});
</script>
8 changes: 8 additions & 0 deletions resources/sass/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,11 @@
margin-right: 2px;
}
}

.link-donate {
background-color: #ffd700;

&:hover, &:focus {
background-color: #bfa100;
}
}
5 changes: 5 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use App\Http\Controllers\AboutController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\NetworkController;
use App\Http\Controllers\NetworkIpController;
Expand All @@ -23,4 +24,8 @@

Route::resource('networks.ips', NetworkIpController::class)->only(['store', 'destroy']);
Route::resource('networks', NetworkController::class);

Route::prefix('about')->name('about.')->group(function () {
Route::get('', [AboutController::class, 'index'])->name('index');
});
});

0 comments on commit 3ca335a

Please sign in to comment.