Skip to content

Commit 3ca335a

Browse files
authored
Merge pull request #3 from Sander0542/feature/about
About page
2 parents a2f63fd + 0293deb commit 3ca335a

9 files changed

Lines changed: 238 additions & 2 deletions

File tree

.github/workflows/docker.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
steps:
3131
- name: Checkout repository
3232
uses: actions/checkout@v2
33+
with:
34+
fetch-depth: 0
3335

3436
# Install the npm tool
3537
- name: Setup node
@@ -46,6 +48,10 @@ jobs:
4648
- name: Laravel mix
4749
run: npm run production
4850

51+
# Store the version
52+
- name: Store version
53+
run: git describe > public/version
54+
4955
# Workaround: https://github.com/docker/build-push-action/issues/461
5056
- name: Setup Docker buildx
5157
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf

.idea/php.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Http\Request;
6+
use Inertia\Inertia;
7+
use MCStreetguy\ComposerParser\Factory as ComposerParser;
8+
9+
class AboutController extends Controller
10+
{
11+
public function index()
12+
{
13+
$versionFilePath = public_path('version');
14+
$applicationVersion = 'Unknown';
15+
if (file_exists($versionFilePath)) {
16+
$applicationVersion = file_get_contents($versionFilePath);
17+
}
18+
19+
$composerFile = ComposerParser::parseComposerJson(base_path('composer.json'));
20+
$composerLock = ComposerParser::parseLockfile(base_path('composer.lock'));
21+
$composerPackages = collect($composerLock->getPackages()->getData())->map(function ($package) {
22+
return [
23+
'name' => $package['name'],
24+
'description' => $package['description'] ?? null,
25+
'version' => $package['version'],
26+
'licenses' => $package['license'] ?? [],
27+
];
28+
})->toArray();
29+
30+
$npmJson = json_decode(file_get_contents(base_path('package-lock.json')), true);
31+
$npmPackages = collect($npmJson['packages']['']['devDependencies'])->map(function ($version, $package) use ($npmJson) {
32+
return $npmJson['dependencies'][$package]['version'];
33+
});
34+
35+
return Inertia::render('About/Index', [
36+
'application' => [
37+
'about' => [
38+
'Authors' => collect($composerFile->getAuthors())->map(function ($author) {
39+
return $author->getName();
40+
}),
41+
'License' => $composerFile->getLicense()[0],
42+
],
43+
'versions' => [
44+
'Application' => $applicationVersion,
45+
'PHP' => phpversion(),
46+
'Laravel' => app()->version(),
47+
],
48+
'extensions' => collect(get_loaded_extensions())->mapWithKeys(function ($extension) {
49+
return [$extension => phpversion($extension)];
50+
})->toArray(),
51+
'libraries' => [
52+
'composer' => $composerPackages,
53+
'npm' => $npmPackages,
54+
],
55+
],
56+
]);
57+
}
58+
}

composer.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,19 @@
22
"name": "sander0542/network-manager",
33
"type": "project",
44
"description": "The Laravel Framework.",
5-
"keywords": ["framework", "laravel"],
5+
"keywords": [
6+
"framework",
7+
"laravel"
8+
],
69
"license": "MIT",
10+
"authors": [
11+
{
12+
"name": "Sander Jochems",
13+
"email": "contact@sanderjochems.com",
14+
"homepage": "https://sanderjochems.com",
15+
"role": "Founder"
16+
}
17+
],
718
"require": {
819
"php": "^8.0",
920
"fruitcake/laravel-cors": "^2.0",
@@ -15,6 +26,7 @@
1526
"laravel/sanctum": "^2.11",
1627
"laravel/tinker": "^2.5",
1728
"markrogoyski/ipv4-subnet-calculator": "^3.1",
29+
"mcstreetguy/composer-parser": "^1.1",
1830
"tightenco/ziggy": "^1.0"
1931
},
2032
"require-dev": {

composer.lock

Lines changed: 42 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/Layouts/AppLayout.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,20 @@
106106

107107
<hr class="dropdown-divider">
108108

109+
<h6 class="dropdown-header small text-muted">
110+
Application
111+
</h6>
112+
113+
<jet-dropdown-link :href="route('about.index')">
114+
About
115+
</jet-dropdown-link>
116+
117+
<a class="dropdown-item px-4 link-donate" href="https://github.com/sponsors/Sander0542" target="_blank">
118+
Donate
119+
</a>
120+
121+
<hr class="dropdown-divider">
122+
109123
<!-- Authentication -->
110124
<form @submit.prevent="logout">
111125
<jet-dropdown-link as="button">

resources/js/Pages/About/Index.vue

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<template>
2+
<app-layout title="About">
3+
<template #header>
4+
<h2 class="h4 font-weight-bold">
5+
About
6+
</h2>
7+
</template>
8+
9+
<div class="row">
10+
<div class="col-4">
11+
<div class="card">
12+
<div class="card-body">
13+
<h5 class="card-title">Application</h5>
14+
<table class="table table-borderless">
15+
<tr v-for="(information, title) in application.about">
16+
<th>{{ title }}</th>
17+
<td v-if=" typeof information == 'object'" v-for="item in information">{{ item }}</td>
18+
<td v-else>{{ information }}</td>
19+
</tr>
20+
</table>
21+
</div>
22+
</div>
23+
<div class="card mt-4">
24+
<div class="card-body">
25+
<h5 class="card-title">Versions</h5>
26+
<table class="table table-borderless">
27+
<tr v-for="(version, type) in application.versions">
28+
<th>{{ type }}</th>
29+
<td>{{ version }}</td>
30+
</tr>
31+
</table>
32+
</div>
33+
</div>
34+
<div class="card mt-4">
35+
<div class="card-body">
36+
<h5 class="card-title">PHP Extensions</h5>
37+
<table class="table table-borderless">
38+
<tr v-for="(version, extension) in application.extensions">
39+
<th>{{ extension }}</th>
40+
<td>{{ version }}</td>
41+
</tr>
42+
</table>
43+
</div>
44+
</div>
45+
<div class="card mt-4">
46+
<div class="card-body">
47+
<h5 class="card-title">NPM Packages</h5>
48+
<table class="table table-borderless">
49+
<tr v-for="(version, library) in application.libraries.npm">
50+
<th>{{ library }}</th>
51+
<td>{{ version }}</td>
52+
</tr>
53+
</table>
54+
</div>
55+
</div>
56+
</div>
57+
<div class="col-8">
58+
<div class="card">
59+
<div class="card-body pb-0">
60+
<h5 class="card-title m-0">Composer Packages</h5>
61+
</div>
62+
<ul class="list-group">
63+
<li v-for="library in application.libraries.composer" class="list-group-item d-flex justify-content-between align-items-center border-0 border-bottom">
64+
<div class="me-auto">
65+
<div class="fw-bold">{{ library.name }}</div>
66+
{{ library.description }}
67+
</div>
68+
<span v-for="license in library.licenses" class="badge bg-success rounded-pill me-1">{{ license }}</span>
69+
<span class="badge bg-success rounded-pill">{{ library.version }}</span>
70+
</li>
71+
</ul>
72+
</div>
73+
</div>
74+
</div>
75+
76+
</app-layout>
77+
</template>
78+
79+
<script>
80+
import {defineComponent} from "vue"
81+
import AppLayout from "@/Layouts/AppLayout.vue"
82+
83+
export default defineComponent({
84+
components: {
85+
AppLayout,
86+
},
87+
props: {
88+
application: Object
89+
}
90+
});
91+
</script>

resources/sass/_custom.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,11 @@
135135
margin-right: 2px;
136136
}
137137
}
138+
139+
.link-donate {
140+
background-color: #ffd700;
141+
142+
&:hover, &:focus {
143+
background-color: #bfa100;
144+
}
145+
}

routes/web.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use App\Http\Controllers\AboutController;
34
use App\Http\Controllers\DashboardController;
45
use App\Http\Controllers\NetworkController;
56
use App\Http\Controllers\NetworkIpController;
@@ -23,4 +24,8 @@
2324

2425
Route::resource('networks.ips', NetworkIpController::class)->only(['store', 'destroy']);
2526
Route::resource('networks', NetworkController::class);
27+
28+
Route::prefix('about')->name('about.')->group(function () {
29+
Route::get('', [AboutController::class, 'index'])->name('index');
30+
});
2631
});

0 commit comments

Comments
 (0)