Skip to content

Commit

Permalink
Releasing 1.2.0 into master (#28)
Browse files Browse the repository at this point in the history
* Update README.md

* improve support for bypassing log

* Improve better separation of reactive diffs

* minor bugfixes

* Improve handling of new records

* upgrade for new agiledata

* Minor bug-fixes

* drop php 5.5 and update phpunit

* prevent php7.1 from complaining

* clanup

* add licnse

* Update README.md

* make it work with verisons or dev version

* fix license

* try with dev-develop

* Sample SQL for audit_log table in MySQL

* typo

* model_id was missing

* remove database name

* don't log dsql expressions. maybe also helps with #21

* Cleanup and refactor

* Theoretical implementation of audit Lister view

* Implement Lister and create demo

* nice lister template and update lister class

* work in progress

* work in progress

* now all works good

* add pug files

* address @romans comments and rename controller property to auditController

* empty audit records

* make demo nicer and move db migrator to separate page

* more test cases for nested audit logs and undo etc

* help with backward compatibility

* model->no_audit=true support

* fix audit for serialized fields, adds test

* add release tools

* added suggest

* fixes

* tweak release script

* minor cleanups

* minor fix

* minor cleanups

* Added release notes for 1.1.1

* minor cleanups

* minor celanup

* add manage of caption and reference/One values in place of ref->id

* fix issue related to atk4/data#439

* Fix problem with using audit log under cli

* update composer

* Create release-drafter.yml

* Create bundler.yml

* Create unit-tests.yml

* release drafter

* Setting release dependencies

Co-authored-by: Romans Malinovskis <me@nearly.guru>
Co-authored-by: Imants Horsts <DarkSide666@users.noreply.github.com>
Co-authored-by: PhilippGrashoff <33204878+PhilippGrashoff@users.noreply.github.com>
Co-authored-by: Francesco Danti <fdanti@gmail.com>
Co-authored-by: Svetlozar Kondakov <skondakoff@gmail.com>
Co-authored-by: GitHub Web Flow <noreply@github.com>
  • Loading branch information
7 people authored Feb 11, 2020
1 parent 9173ed2 commit b27ef62
Show file tree
Hide file tree
Showing 37 changed files with 1,474 additions and 247 deletions.
5 changes: 5 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See https://github.com/release-drafter/release-drafter#configuration
template: |
## What’s Changed
$CHANGES
43 changes: 43 additions & 0 deletions .github/workflows/bundler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Bundler

on: create

jobs:
autocommit:
name: Update to stable dependencies
if: startsWith(github.ref, 'refs/heads/release/')
runs-on: ubuntu-latest
container:
image: atk4/image:latest # https://github.com/atk4/image
steps:
- uses: actions/checkout@master
- run: echo ${{ github.ref }}
- name: Update to stable dependencies
run: |
# replaces X keys with X-release keys
jq '. as $in | reduce (keys_unsorted[] | select(endswith("-release")|not)) as $k ({}; . + {($k) : (($k + "-release") as $kr | $in | if has($kr) then .[$kr] else .[$k] end) } )' < composer.json > tmp && mv tmp composer.json
v=$(echo ${{ github.ref }} | cut -d / -f 4)
echo "::set-env name=version::$v"
- uses: teaminkling/autocommit@master
with:
commit-message: Setting release dependencies
- uses: ad-m/github-push-action@master
with:
branch: ${{ github.ref }}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: pull-request
uses: romaninsh/pull-request@master
with:
source_branch: "release/${{ env.version }}"
destination_branch: "master" # If blank, default: master
pr_title: "Releasing ${{ env.version }} into master"
pr_body: |
- [ ] Review changes (must include stable dependencies)
- [ ] Merge this PR into master (will delete ${{ github.ref }})
- [ ] Go to Releases and create TAG from master
Do not merge master into develop
pr_reviewer: "romaninsh"
pr_assignee: "romaninsh"
github_token: ${{ secrets.GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- develop

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: toolmantim/release-drafter@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50 changes: 50 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Unit Testing

on:
pull_request:
branches: '*'
push:
branches:
- master
- develop

jobs:
unit-test:
name: Unit Testing
runs-on: ubuntu-latest
container:
image: atk4/image:${{ matrix.php }} # https://github.com/atk4/image
strategy:
matrix:
php: ['7.2', '7.3', 'latest']
steps:
- uses: actions/checkout@v1
# need this to trick composer
- run: php --version
- run: "git branch develop; git checkout develop"
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
- run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader

- name: Run Tests
run: |
mkdir -p build/logs
- name: SQLite Testing
run: vendor/bin/phpunit --configuration phpunit.xml --coverage-text

- uses: codecov/codecov-action@v1
if: matrix.php == 'latest'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: build/logs/clover.xml
2 changes: 2 additions & 0 deletions .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
usernames-as-github-logins=true
output=CHANGELOG.md
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ docs/build
/build
/vendor
.DS_Store
/.idea
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Change Log

## [1.1.1](https://github.com/atk4/audit/tree/1.1.1) (2019-03-01)

[Full Changelog](https://github.com/atk4/audit/compare/1.1.0...1.1.1)

## [1.1.0](https://github.com/atk4/audit/tree/1.1.0) (2019-03-01)

[Full Changelog](https://github.com/atk4/audit/compare/1.0...1.1.0)

**Fixed bugs:**

- Problem with using fields of type 'array' in model [\#21](https://github.com/atk4/audit/issues/21)

**Closed issues:**

- Add UI widget for showing "history" [\#23](https://github.com/atk4/audit/issues/23)
- add ability to mark fields to exclude from audit [\#7](https://github.com/atk4/audit/issues/7)

**Merged pull requests:**

- Refactor and implement views [\#24](https://github.com/atk4/audit/pull/24) (@DarkSide666)
- don't log dsql expressions [\#22](https://github.com/atk4/audit/pull/22) (@DarkSide666)
- typo [\#20](https://github.com/atk4/audit/pull/20) (@PhilippGrashoff)
- Sample SQL for audit\_log table in MySQL [\#19](https://github.com/atk4/audit/pull/19) (@PhilippGrashoff)
- drop php 5.5 and update phpunit [\#18](https://github.com/atk4/audit/pull/18) (@DarkSide666)

## [1.0](https://github.com/atk4/audit/tree/1.0) (2016-10-04)

[Full Changelog](https://github.com/atk4/audit/compare/8952b0b6ca0b0a1490bcd6e00a42ed777a65a842...1.0)

**Closed issues:**

- Add documentation [\#16](https://github.com/atk4/audit/issues/16)
- Add undo feature. [\#13](https://github.com/atk4/audit/issues/13)
- add support for "view" [\#11](https://github.com/atk4/audit/issues/11)
- Add documentation and test for hook priorities [\#8](https://github.com/atk4/audit/issues/8)
- Add support for custom user operations. [\#5](https://github.com/atk4/audit/issues/5)
- custom messages possibly with tempalte [\#4](https://github.com/atk4/audit/issues/4)
- Test multi-record reactive actions [\#3](https://github.com/atk4/audit/issues/3)
- Add Audit log for insert and delete operations [\#2](https://github.com/atk4/audit/issues/2)
- Basic audit on update. [\#1](https://github.com/atk4/audit/issues/1)

**Merged pull requests:**

- Feature/add insert delete log [\#15](https://github.com/atk4/audit/pull/15) (@romaninsh)



\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
10 changes: 0 additions & 10 deletions CHANGES.md

This file was deleted.

22 changes: 21 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
Commercial
The MIT License (MIT)

Copyright (c) 2016 Agile Toolkit Limited (UK)

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.
38 changes: 12 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# Agile Data - Audit Add-on

This extension for Agile Data implements advanced logging capabilities as well as some elements of
This extension for [Agile Data](https://github.com/atk4/data) implements advanced logging capabilities as well as some elements of
Event Sourcing.

## Installation and Usage

This package have been re-released under MIT license, so you are welcome to use it!

``` bash
composer require atk4/audit
```

You may need to adjust your `minimum-stability` setting.

## Documentation

https://github.com/atk4/audit/blob/develop/docs/index.md
Expand All @@ -11,30 +21,6 @@ https://github.com/atk4/audit/blob/develop/docs/index.md

https://github.com/atk4/audit/blob/develop/docs/full-example.md

## Installation

Add the following inside your `composer.json` file:

``` json
{
"require": {
"atk4/audit": "dev-develop"
},
"repositories": [
{
"type": "vcs",
"url": "git@github.com:atk4/audit.git"
}
]
}
```


``` console
composer require atk4/audit
```

## Current Status

Audit extension is currently under development.

Audit add-on is implemented and used in some projects. Some clean-ups may be needed.
75 changes: 46 additions & 29 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,49 @@
{
"name": "atk4/audit",
"type": "library",
"description": "Agile Data - Audit Extension",
"keywords": ["agile", "data", "framework", "audit", "event sourcing", "crud", "acl"],
"homepage": "http://agiletoolkit.org/data/extension/audit",
"license": "Commercial",
"authors": [
{
"name": "Romans Malinovskis",
"email": "romans@agiletoolkit.org",
"homepage": "https://nearly.guru/"
}
],
"require": {
"php": ">=5.5.0",
"atk4/data": "^1.1",
"atk4/schema": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "4.*",
"codeclimate/php-test-reporter": "*"
},
"autoload": {
"psr-4": {"atk4\\audit\\":"src/"}
},
"autoload-dev": {
"psr-4": {
"atk4\\audit\\tests\\":"tests/"
}
"name": "atk4/audit",
"type": "library",
"description": "Agile Data - Audit Extension",
"keywords": [
"agile",
"data",
"framework",
"audit",
"event sourcing",
"crud",
"acl"
],
"homepage": "http://agiletoolkit.org/data/extension/audit",
"license": "MIT",
"minimum-stability": "dev",
"prefer-stable": true,
"authors": [
{
"name": "Romans Malinovskis",
"email": "romans@agiletoolkit.org",
"homepage": "https://nearly.guru/"
}
],
"require": {
"php": ">=7.2.0",
"atk4/data": "^2.0",
"atk4/schema": "^2.0"
},
"suggest": {
"atk4/ui": "Provides you with extra Views to display history",
"atk4/mastercrud": "Intergates with MasterCRUD showingh change history of your records"
},
"require-dev": {
"atk4/ui": "^2.0",
"phpunit/phpunit": "<6",
"codeclimate/php-test-reporter": "*"
},
"autoload": {
"psr-4": {
"atk4\\audit\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"atk4\\audit\\tests\\": "tests/"
}
}
}
50 changes: 50 additions & 0 deletions demos/demo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

require_once 'include/init.php';
require_once 'include/database.php';

// set up data model with audit add-on enabled
$m = new Country($db);
$c = $m->add(new \atk4\audit\Controller());



// 2 columns
$cols = $app->add('Columns');
$c1 = $cols->addColumn();
$c2 = $cols->addColumn();



// left side country CRUD
$c1->add('Header')->set('Countries');
$crud = $c1->add('CRUD', []);
$crud->setModel($m, ['id', 'name', 'iso', 'iso3']);
$crud->setIpp(5);

// Delete audit data button
$crud->menu
->addItem(['Delete ALL audit data', 'icon' => 'trash'])
->on('click', function()use($m, $c2){
$m->ref('AuditLog')->action('delete')->execute();
return $c2->jsReload();
});

// add CRUD action to load jailed audit records in lister
$crud->addAction('Audit ->', function($js, $id)use($c2){
return $c2->jsReload(['model_id'=>$id]);
});



// right side Audit History

// create model for form
$m2 = clone $m;
if ($id = $app->stickyGet('model_id')) {
$m2->load($id);
}

$c2->add('Header')->set($m2->loaded() ? 'History of '.$m2->getTitle() : 'All History');
$h = $c2->add(new \atk4\audit\view\History());
$h->setModel($m2);
Loading

0 comments on commit b27ef62

Please sign in to comment.