Problem/Motivation

Port this module to Drupal 8.

Proposed resolution

-

Remaining tasks

  • log_type configuration entity,
  • log entity
  • permission + access check
  • admin theme while adding, editing and deleting entity instances
  • autogenerate title
  • access check (query alter)
  • actions
  • log text filter
  • view/revert/delete revisions

User interface changes

  • admin_theme checkbox moved to /appearance, next to similar function for nodes
  • global settings form has been removed
  • /admin/content/log - list of all logs stored in Drupal

API changes

-

Data model changes

  • new "description" property in log_type entity
  • additional table for revisions

See: https://github.com/zaporylie/log

Comments

m.stenta’s picture

Title: Drupal 8 » Port Log to Drupal 8
zaporylie’s picture

Title: Port Log to Drupal 8 » [meta] Port Log to Drupal 8

I've been working on similar module for D8 for two days now. We could use it as a starting point for D8 module development. If you'd like my help, please let me know.

m.stenta’s picture

Sure! Do you have your module posted to a drupal.org sandbox so I can take a look?

zaporylie’s picture

Nah, it's on my Github. You can take a look and create remaining task list in this issue. I'm planning to work on it later today.

m.stenta’s picture

Nice! You've done a lot!

What was your process? It looks like it was copied from the Node module, and then modified for Log? Were you using this Log module as a basis as well?

What are you using it for? Does it have the same goals as this Log module? (drupal.org/project/log)

Ultimately, I will need to replicate all of the existing functionality that currently exists in this Log module, because it is a major dependency of farmOS (http://drupal.org/project/farm). So it would be helpful for me to understand what the similarities/differences are with the module you are developing.

Thanks for the great start on this!

zaporylie’s picture

Drupal Console + Node module. That's my very first D8 module so fireworks and lazers not included ;)

My plan is to use Log module to track events registered by IoT devices. I think it can be identical (===) to your module so I'll just replicate all missing parts (properties, settings) later today and let you know. I'd like to keep log revisions though, but that's a feature which should not destroy backward compatibility I hope.

m.stenta’s picture

Sounds great! I really appreciate the help!!!

We are actually working towards a similar use-case in farmOS (IoT related). Currently we have the Farm Sensor module (http://drupal.org/project/farm_sensor), which allows you to define various sensor devices you have on your farm (as "Farm Asset" entities). Each sensor can have logs associated with it (currently the three default Log types that come with farmOS: Activities, Observations, and Movements). Currently sensors do not create logs on their own - but eventually that is the goal. Right now, the Farm Sensor: Listener sub-module provides a JSON endpoint that sensors can push data to over HTTP, and it stores those data points in a {farm_sensor_data} table. The data points themselves are not entities, just rows in the table. So we will use that for the raw data - but then we will add logic (probably with Rules) to automatically create Log entities when certain patterns in the data develop (ie: create an "Observation" log attached to the sensor entity when the greenhouse gets too hot, or similar useful things). So logs in this context will be for more important events, whereas the {farm_log_data} table can be used to store the whole stream of data from the sensor.

m.stenta’s picture

PS: And I am all for having revisions! It's something that isn't immediately necessary in farmOS, but would be a great addition! The more records of what happened the better!

zaporylie’s picture

We've been working with my colleague on exposing Log entity with built-in D8 Rest API + custom authentication provider (api key per user account) and it works great. Our goal is to create log entities directly from associated IoT devices and log beer temperature (for now only that) during brewing process.

I didn't have as much time as I've planned but I moved forward in development. I implemented more granular permissions (consistent with _your_ Log module). Also entity properties are now the same for both D7 and D8.

zaporylie’s picture

Issue summary: View changes

I added information to issue summary about progress, changes and remaining tasks. There is a few tasks we should discuss before porting but I was thinking about doing it in separate issue(s).

Would be nice if you could create new branch, most likely 8.x-2.x and use code from github or let me know so I could post a patch. I wish to move further development to d.o.

zaporylie’s picture

Issue summary: View changes
Status: Active » Needs work

I found time to add token replacement to log name. The only change (and suggestion) is to store token (i.e. name_pattern) in database instead of replacing it on entity insert/update. Render array will be cached anyway so there is no performance overhead. I believe this way interface should be more intuitive and flexible and we could use all kinds of field tokens in name.
To make it happen I created new plugin, string formatter called Log name (log_name).

m.stenta’s picture

@zaporylie: FYI, I posted this to the github issue queue https://github.com/zaporylie/log/issues/18

I'm eager to get the 8.x version of Log completed!

m.stenta’s picture

Status: Needs work » Closed (fixed)

@zaporylie's branch has been merged in! We officially have an 8.x-1.x branch and a development snapshot release! https://www.drupal.org/project/log/releases/8.x-1.x-dev

There are still some things to do... our job is never done! I will start by copying the open issues from @zaporylie's Github project, and add a few of my own. I have some cleanup commits that I will be pushing up soon as well.

Let's create new issues for future development - and consider this one closed!