Skip to content

Commit

Permalink
INIT V1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Manzadey committed Mar 16, 2023
1 parent b3ecd6f commit e8ff158
Show file tree
Hide file tree
Showing 27 changed files with 1,199 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.idea
/vendor

composer.lock
.phpunit.result.cache
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

All notable changes to `laravel-orchid-storage-logs` will be documented in this file

## 1.0.0 - 2023-03-16

- initial release
55 changes: 55 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Contributing

Contributions are **welcome** and will be fully **credited**.

Please read and understand the contribution guide before creating an issue or pull request.

## Etiquette

This project is open source, and as such, the maintainers give their free time to build and maintain the source code
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
extremely unfair for them to suffer abuse or anger for their hard work.

Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
world that developers are civilized and selfless people.

It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.

## Viability

When requesting or submitting new features, first consider whether it might be useful to others. Open
source projects are used by many developers, who may have entirely different needs to your own. Think about
whether or not your feature is likely to be used by other users of the project.

## Procedure

Before filing an issue:

- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
- Check to make sure your feature suggestion isn't already present within the project.
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
- Check the pull requests tab to ensure that the feature isn't already in progress.

Before submitting a pull request:

- Check the codebase to ensure that your feature doesn't already exist.
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.

## Requirements

If the project maintainer has any additional requirements, you will find them listed here.

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.

**Happy coding**!
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Andrey Manzadey

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
111 changes: 111 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Laravel Orchid Storage Logs Screen

[![Latest Version on Packagist](https://img.shields.io/packagist/v/manzadey/laravel-orchid-storage-logs.svg?style=flat-square)](https://packagist.org/packages/manzadey/laravel-orchid-storage-logs)
[![Total Downloads](https://img.shields.io/packagist/dt/manzadey/laravel-orchid-storage-logs.svg?style=flat-square)](https://packagist.org/packages/manzadey/laravel-orchid-storage-logs)

This package allows you to view logs directly in the Laravel Orchid admin panel.

### List of logs
![Screenshot List Logs](https://user-images.githubusercontent.com/34869211/225702577-92d0589f-6d01-48b5-8916-16d69918a331.png)

### Show Log
![Screenshot Show Log](https://user-images.githubusercontent.com/34869211/225709127-47744ad5-9767-4338-be19-e9f400c250f2.png)
## Features:
- Download logs
- Views logs
- Delete logs
- Sorting logs by name, date, size
- Filtering logs by name
- Sorting log messages by date, environment, type
- Filtering log messages by environment, type, message

## Installation

You can install the package via composer:

```bash
composer require manzadey/laravel-orchid-storage-logs
```

## Usage
Optional publish config:
```bash
php artisan vendor:publish --tag=storage-logs-config
```

Publish routes:
```bash
php artisan vendor:publish --tag=storage-logs-routes
```
Or add yourself to the file platform.php
```php
use Illuminate\Support\Facades\Route;
use Manzadey\LaravelOrchidStorageLogs\Screens as StorageLogScreens;
use Tabuna\Breadcrumbs\Trail;

Route::name('platform.storage-logs.')
->prefix('storage-logs')
->group(static function() {
Route::screen('', StorageLogScreens\StorageLogListScreen::class)
->name('list')
->breadcrumbs(static fn(Trail $trail) : Trail => $trail
->parent('platform.index')
->push(__('Storage Logs'), route('platform.storage-logs.list'))
);

Route::screen('{storageLog}', StorageLogScreens\StorageLogShowScreen::class)
->name('show')
->breadcrumbs(static fn(Trail $trail, string $storageLog) : Trail => $trail
->parent('platform.storage-logs.list')
->push($storageLog, route('platform.storage-logs.show', $storageLog))
);
});
```

Add a menu item to the method `registerMainMenu()` in the `PlatformProvider` to access logs:
```php
use Manzadey\LaravelOrchidStorageLogs\Screen\Actions\StorageLogsMenu;

class PlatformProvider extends OrchidServiceProvider
{
/**
* @return Menu[]
*/
public function registerMainMenu(): array
{
return [
// Menu items

StorageLogsMenu::make()
->route('platform.storage-logs.list'),
] ;
}
}
```

### Testing

```bash
composer test
```

### Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

If you discover any security related issues, please email andrey.manzadey@gmail.com instead of using the issue tracker.

## Credits

- [Andrey Manzadey](https://github.com/manzadey)
- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
49 changes: 49 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "manzadey/laravel-orchid-storage-logs",
"description": "Package for Laravel Admin Panel Orchid. Allows you to view laravel logs in the Orchid admin panel.",
"license": "MIT",
"authors": [
{
"name": "Andrey Manzadey",
"email": "andrey.manzadey@gmail.com",
"homepage": "https://github.com/Manzadey",
"role": "Developer"
}
],
"minimum-stability": "dev",
"require": {
"php": "^8.1",
"ext-zip": "*",
"orchid/platform": "^13.9"
},
"require-dev": {
"orchestra/testbench": "^7.0",
"phpunit/phpunit": "^9.6",
"roave/security-advisories": "dev-latest"
},
"autoload": {
"psr-4": {
"Manzadey\\LaravelOrchidStorageLogs\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Manzadey\\LaravelOrchidStorageLogs\\Tests\\": "tests"
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"

},
"config": {
"sort-packages": true
},
"extra": {
"laravel": {
"providers": [
"Manzadey\\LaravelOrchidStorageLogs\\FoundationServiceProvider"
]
}
}
}
31 changes: 31 additions & 0 deletions config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

return [
'path' => storage_path('logs'),

'disk' => 'logs',

'error_type_color_default' => 'secondary',

'error_type_colors' => [
'emergency' => 'dark',
'alert' => 'danger',
'critical' => 'danger',
'error' => 'danger',
'warning' => 'warning',
'notice' => 'primary',
'info' => 'info',
'debug' => 'secondary',
],

'production_color_default' => 'secondary',

'production_colors' => [
'local' => 'primary',
'production' => 'success',
'test' => 'info',
],
];

12 changes: 12 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd">
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_KEY" value="base64:2fl+Ktvkfl+Fuz4Qp/A75G2RTiWVA/ZoKZvp6fiiM10="/>
</php>
</phpunit>
26 changes: 26 additions & 0 deletions phpunit.xml.dist.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
>
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Manzadey Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
</phpunit>
32 changes: 32 additions & 0 deletions resources/lang/ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"Download all": "Скачать все",
"Total size": "Общий размер",
"Number of files": "Кол-во файлов",
"Directory": "Директория",
"Select a directory": "Выберите директорию",
"Search": "Поиск",
"Search for files containing a substring": "Поиск файлов, содержащих подстроку",
"Apply": "Применить",
"Name": "Название",
"Size": "Размер",
"Last update": "Последнее обновление",
"More": "Подробнее",
"Download": "Скачать",
"Delete": "Удалить",
"Delete %s?": "Удалить %s?",
"Logs": "Логи",
"Path": "Путь",
"Date": "Дата",
"List of entries": "Список записей",
"Environment": "Окружение",
"Type": "Тип",
"Message": "Сообщение",
"Content": "Содержимое",
"Number of messages": "Кол-во сообщений",
"The %s file was successfully deleted": "Файл %s был успешно удален.",
"The %s file has not been deleted": "Файл %s не был удален",
"Storage Logs": "Хранилище логов",
"Date of last update": "Дата последнего обновления",
"List of files from \"%s\" folder": "Список файлов из папки \"%s\"",
"Error when uploading a file": "Ошибка при загрузке файла"
}
3 changes: 3 additions & 0 deletions resources/views/components/environment-component.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<span class="badge bg-{{ $color() }}">
{{ strtoupper($environment()) }}
</span>
3 changes: 3 additions & 0 deletions resources/views/components/type-component.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<span class="badge bg-{{ $color() }}">
{{ $type() }}
</span>
1 change: 1 addition & 0 deletions resources/views/log.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div class="layout"><pre class="bg-transparent">{!! $data !!}</pre></div>
Loading

0 comments on commit e8ff158

Please sign in to comment.