Giter Club home page Giter Club logo

cube-common-bundle's Introduction

Common Code for the CUBE Tools

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require cubetools/cube-common-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new CubeTools\CubeCommonBundle\CubeToolsCubeCommonBundle(),
        );

        // ...
    }

    // ...
}

Step 3: Import the routes

To give access to routing information, import routing into app/config/routing.yml:

# app/config/routing.yml

# ...

_cube_common:
    resource: "@CubeToolsCubeCommonBundle/Resources/config/routing/all.yml"

Step 4 (optional): Set different user class

When FosUserBundle is enabled, the user class is set to the one configured for this bundle. To use a different user class (for the cube_common.user_settings service), set your User class in app/config/config.yml.

# app/config/config.yml
doctrine:
    # ...
    orm:
        # ...
        resolve_target_entities:
            Symfony\Component\Security\Core\User\UserInterface: YourBundle\Entity\YourUser

Use the bundle

Do some index page filtering, hide table columns dynamically with ColumnSelector, or use another functionality (see in src).

cube-common-bundle's People

Contributors

krzysztofruszczynski avatar markussc avatar paschke avatar simonheimberg avatar

Watchers

 avatar  avatar  avatar  avatar

cube-common-bundle's Issues

[CustomFields] Add custom fields to entity through configuration

User requirement / use case:

  • Entity is based on existing entity (e.g. Document or Reservation) but needs project specific adaptations (e.g. Plan-Identifier or various project-specific fields such as TestBench etc.). These project specific adaptations change over time.

Requirements:

  • Allow configuring additional fields for an entity
  • Additional fields can be of type: free-text (single line), text (text field), select (pre-defined, configured values), date, entity (select referring to other, existing entity)
  • Additional fields may be dependent on each other (mainly select type), with choices dependent on selected parent field choice ➡️ postpone
  • Additional fields may have access rights defined on them (e.g. for select, certain selectable values only available to certain groups / users)
  • Additional fields should be populated in index pages of entities to which they are attached
  • Additional fields may be required dependent on status (e.g. when creating a Reservation, only a subset of fields is mandatory; When assigning a reservation to the supplier, more fields are mandatory; When assigning a reservation back to the customer, all fields are required) ➡️ postpone

We need to identify:

  • Is there a bundle available that solves this?
  • If not, do we implement this in CUBE Common Bundle?

[Filter] extend functionality: filter-url, custom save/load

  • allow to generate a filter url: EmchBerger/projectassistant#753
  • allow to save and load filters (in usersettings)
  • allow to define filters for everybody (from config or ...)
  • auto-generate query from filterdata for simple cases (needs custom attributes like dbTable and dbColumn in filter elements)
  • special handling for pre-formatted (as html) values (from xxxEditor)
    generate a glob query which ignores formatting
  • To be verified: Return variables directly as $qb->expr()->literal($variable)
  • allow filtering for empty value (no text, no choice selected, no date) https://github.com/EmchBerger/projectassistant/issues/375
  • ...

[Logs] long values are shown incomplete in history

The value for associations is at maximum 255 characters in length (because of column label length in audit_log).
We should at least indicate a shortened value in history.

This generates problems with html code. It is returned incomplete.
Possibilities to handle this case:

  • clean up (shortened) html strings with tidy: https://secure.php.net/manual/en/tidy.examples.php#89334
  • do not show (all) html formatting: {{ some_html\|striptags('<br><p>') }} {# only keep br and p #}
  • do not show all html formatting for shortened texts
  • show full value (must be read separately from audit_log)

[Logs] changes in assosiation value are not necessary shown in history

The changes in the association (when entity is owning side) are only shown when the association is dissociated and associated on the owner.

This is no issue often because

  • The associations values (almost) never changes (like tag names)
  • The entity is the inverse side (this is handled differently)
  • The association is associated and dissociated on every entity change

Because we are improving in associate +dissociate, this bug begins to show up.

[phpexcel] make dependency on phpexcel really optional

When using cube-common-bundle in another project, I get the error message as follows:

The service "cube_common.excel.converter" has a dependency on a non-existent service "phpexcel".

I assume this is missing in the composer.json as dependency.
Version: 1.0.21

[DataDogAudit] indicate unknown changes less obtrusive

When the associations have changed (in the class), DataDogAudit::getAttributeNameForNtoN() throws a ContextErrorException in dev mode.

Possibilities:

  • just warn when this happens
  • show a note in the audit log (do indicate that something is missing)
  • other method to get the correct attribute name
  • ...

[GitVersion] there is a dependency on CUBE PA's DashboardController

An exception has been thrown during the rendering of a template ("The _controller value "AppBundle:Dashboard:getGitVersion" maps to a "AppBundle\Controller\DashboardController" class, but this class was not found. Create this class or check the spelling of the class and its namespace.").

Version: 1.0.21

[branch naming] version branches

  • Why are there releases on development branch? Specifically 8e0f0cc
  • Why do we have v1.0 branch but no other version branches? I assume: We will create a version branch for v2 (suggest omitting .0) once it exists.
  • If my assumption above is not correct: Why are there no branches for v1.1, v1.2, ...?

[ColumnSelection] allow to append rows dynamically simple

Modifying dynamically a table with hidden columns should work automatically or with simple helpers.

maybe

  • provide a convenient function to filter the new rows (before inserting)
  • do hiding automatically
    • add a change listener to the table (slow)
    • set column to visible collapse, is not supported by many browsers
    • set style in stylesheet (with stylesheet.addRule(), rule.selectorText = xxx, ...)
      set class to each hidable column optionally (when colspan is used)
      https://davidwalsh.name/add-rules-stylesheets
  • do column filtering on server side (how??? hiding in twig (macro in filterHelper), read current state in Controller??? )

[EntityHistory] service to store logging information into entites

Entities containing a method called "historicizedFields" (or similar) and contain a field "entityHistory" can be logged with 2 simple calls:

  • before changing the entity, initialize the entityHistory service with the entity. Before flushing, pass the entity again with the new status. The service will return an array with the diff and update the entityHistory field of the entity.

[Translation] make labels dynamic

  • ColSelection: colSelCloseBtn "Close" (line 224 in cubecommon.js)
  • Logs: initial change entry when entity exists before activating audit bundle ("UNKNOWN USER", "unknown document versions before")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.