Coder Social home page Coder Social logo

cat-angular's People

Contributors

andreasgerstmayr avatar exordian avatar frechl avatar ftorghele avatar georgebejan avatar haraldvogl avatar hupfis avatar mittemi avatar mkurz000 avatar tsalzinger avatar vgunda avatar wbernhofer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cat-angular's Issues

Allow applications to configure i18n key prefixes

Right now all cat-angular cat-i18n keys look like this:

'cc.catalysts.cat-[breadcrumbs|menu|facets|paginated|sortable].[...whatever...]'.

Among all application-specific keys in our application, namespaced with the application's context, this strict naming convention is not elegant and we'd like to use our own prefix.
Therefore I'd like to propose a configurable prefix for cat-i18n to optionally replace 'cc.catalysts' from the above prefix by whatever is the application's context.

cat-select should not use ui-select2 as part of its "settings" interface.

Reason:

  • Currently ui-select2 is used to configure parts of cat-select.
  • This violates the encapsulation, as ui-select2 is IMHO an implementation detail of cat-select.
  • It would be nice to if all relevant settings would be provided as direct cat-select attributes, which could be forwarded to the ui-select2 internally.
  • So the implementation switches to some other control internally later, the interface could stay stable.

Make cat-angular to an npm module

NPM provides frontend dependency management features. Some libraries don't support bower (e.g. angular2). Having two frontend package management mechanisms would be an overkill for us, therefore we decided to go with npm only.
In order to be able to use cat-angular with npm, we need the dist folder to be part of the npm package.

Replace hard-coded naming conventions with cat-naming-service

At the moment cat-angular has a lot of hard-coded naming conventions throughout it's code. Especially for somebody who hasn't used it before these are quite daunting as they don't follow any particular pattern. (Note: this is not entirely true, and there have been reasons for all of the current conventions at the time, but it should still be cahnged)

A way to get rid of all these strange patterns would be to replace them by function calls to a dedicated service. This would mean that the only thing the user provides would be a single string at the entry point of listAndDetailView which will then be passed to different service methods.

function CatNamingService {
    /* State names */
    this.getListStateName = function(name, parents) {/**/};
    this.getDetailStateName= function(name, parents) {/**/};
    /* Template names */
    this.getDetailViewTemplate= function(name, parents) {/**/};
    /* Endpoint names */
    this.getEndpointName= function(name) {/**/};
    // ...
}

The above code is just a first idea of how it could look like (no real though has gone into it).
The actual implementation should be quite straight forward and probably don't transform the name at all and just use it as is, and concatenate with parent names where applicable.

For the legacy part i would just add a separate module cat-legacy-naming in cat-angular (but not part of the cat module dependencies) which decorates the service to provide the current naming conventions.

A more sophisticated approach could be to provide multiple naming strategies.

Improving on the single cat-naming-service one could even go a step further and split the different parts where the name is used into different services like cat-template-source, cat-state-service etc. which would probably better handle separation of concerns.

Furthermore we should get rid of all our ugly window.cat.util stuff ;)

mainMenuService should support submenus

Currently it is only possible to add a MenuEntry or MenuGroup to a Menu.

It should also be possible to add another Menu (Submenu) to a Menu if there are to many Entries to display in the first Level or an additional hierarchy makes sense.

Allow configuration of 'default' values of SearchRequest

Currently window.cat.SearchRequests defaults to a page size of 100 - which is in many cases already too much. For any custom request utilizing such search requests this isn't really a problem but for list pages where the actual data is loaded via a hole lot of 'magic' configuration the page size can only be changed via decoration of the catListDataLoadingService.
This already requires some quite deep knowledge of the internal workings of cat-angular and doesn't provide a very good user experience.

A better way would be to have

  • a service for 'global' defaults
  • a configuration option during view configuration to specify a 'default' search-request for the list view

catApiService endpoints list requests should reuse an existing promise if it's still pending

If several angular components have to refresh the same list at the same time, using the same catApi endpoint, several requests are made and all of them load the list of elements. This is a problem for the performance and could be resolved in different ways.

One possibility is to keep running (unresolved) promises until resolution (or rejection) and return it to all subsequent callers if they have the same Search request parameters.

Has "all", "any" operator for authorities

we implemented such an operator into cat-main-menu.js , but because of the new way the visibility is evaluated, we have to add this operator somewhere again.

with the new visiblity service, we also can implement this for buttons and actions.

This is the old code of cat-main-menu.js

angular.module('cat.directives.menu')
    .directive('catMainMenu', ['$mainMenu', '$rootScope', '$location', function CatMainMenuDirective($mainMenu, $rootScope, $location) {
        return {
            restrict: 'E',
            scope: {},
            link: function CatMainMenuLink(scope) {
                scope.menus = $mainMenu.getMenus();
                scope.isVisible = function (entry) {
                    var visible = false;
                    if (entry.isMenu() || entry.isGroup()) {
                        _.forEach(entry.getEntries(), function (subEntry) {
                            visible = visible || scope.isVisible(subEntry);
                        });
                        if (entry.isMenu()) {
                            _.forEach(entry.getGroups(), function (groups) {
                                visible = visible || scope.isVisible(groups);
                            });
                        }
                    } else {
                        return scope.isAllowed(entry);
                    }
                    return visible;
                };
                scope.isAllowed = function (entry) {
                    var rights = entry.getOptions().rights;
                    var rightsOperator = entry.getOptions().rightsOperator || 'all';
                    if (!!rights) {
                        if (_.isArray(rights)) {
                            var allowed = true;
                            if ('all' === rightsOperator) {
                                for (var i = 0; i < rights.length; i++) {
                                    allowed = allowed && $rootScope.isAllowed(rights[i]);
                                }
                            } else if ('any' === rightsOperator) {
                                allowed = false;
                                for (var j = 0; j < rights.length; j++) {
                                    allowed = allowed || $rootScope.isAllowed(rights[j]);
                                }
                            }
                            return allowed;
                        }
                        return $rootScope.isAllowed(rights);
                    }
                    return true;
                };

                scope.isActive = function (path) {
                    return $location.path().substr(0, path.length) === path;
                };
            },
            templateUrl: 'template/cat-main-menu.tpl.html'
        };
    }]);

cat-select should allow creation of none existing endpoints (suggestion)

Reason:

  • If you are using a UI which is quite dynamically composed by aggregation of multiple HTML templates (Some templates could even be provided by plugins).
  • If these templates contain "cat-select" directives the definition of the "endpoint" would require an additional block of javascript code (Code-Behind).

Possible solutions:

  • Add a "autocreate" option to cat-select, which will create none existing endponts.
  • Add an attribute directive, which creates none existing endpoints.

Search param serialisation broke

Commit 8b6d8b52a broke the search filtering in our project. Why was this change necessary? Before you could pass an array or an object into the search and it rendered it into the url like param[]=12&param[]=34 for arrays and as param[asdf]=123 for objects. Now it serializes param=12&param=34 for arrays and param=[oject object] for objects.

cat-paginated element should support RefreshList event

The cat-paginated element should support RefreshList event (or similar) so that a surrounding scope can broadcast it in case the data changed on the backend (this information comes from another channel). On such an event the same query should be fired and the result listed in the cat-paginated element.

Replace ngRoute with ui.router

The ngRoute with it's route based configuration makes it hard to handle sub routes and impossible to have multiple independent view parts on a single page.
Both would be easy to accomplish with ui.router

For the goal should be to make the transition for cat-angular users as easy as possible.

Further improvements utilizing the features of ui.router can follow later.

Outdated gulp-ng-annotate version

I get the following error when I try to run 'gulpw' on cloned cat-angular:

TypeError: Cannot assign to read only property '$methodName' of false at matchRegular (C:\catalysts\Apps\cat-angular\node_modules\gulp-ng-annotate\node_modules\ng-annotate\build\es5\ng-annotate-main.js:272:24) at match (C:\catalysts\Apps\cat-angular\node_modules\gulp-ng-annotate\node_modules\ng-annotate\build\es5\ng-annotate-main.js:32:10) at traverse.post (C:\catalysts\Apps\cat-angular\node_modules\gulp-ng-annotate\node_modules\ng-annotate\build\es5\ng-annotate-main.js:912:23) at visit (C:\catalysts\Apps\cat-angular\node_modules\gulp-ng-annotate\node_modules\ng-annotate\node_modules\ordered-ast-traverse\ordered-ast-traverse.js:50:13) at visit (C:\catalysts\Apps\cat-angular\node_modules\gulp-ng-annotate\node_modules\ng-annotate\node_modules\ordered-ast-traverse\ordered-ast-traverse.js:44:21) at visit (C:\catalysts\Apps\cat-angular\node_modules\gulp-ng-annotate\node_modules\ng-annotate\node_modules\ordered-ast-traverse\ordered-ast-traverse.js:44:21) at visit (C:\catalysts\Apps\cat-angular\node_modules\gulp-ng-annotate\node_modules\ng-annotate\node_modules\ordered-ast-traverse\ordered-ast-traverse.js:41:25) at visit (C:\catalysts\Apps\cat-angular\node_modules\gulp-ng-annotate\node_modules\ng-annotate\node_modules\ordered-ast-traverse\ordered-ast-traverse.js:44:21) at visit (C:\catalysts\Apps\cat-angular\node_modules\gulp-ng-annotate\node_modules\ng-annotate\node_modules\ordered-ast-traverse\ordered-ast-traverse.js:41:25) at visit (C:\catalysts\Apps\cat-angular\node_modules\gulp-ng-annotate\node_modules\ng-annotate\node_modules\ordered-ast-traverse\ordered-ast-traverse.js:44:21)

After some googling I found out that this can be solved by updating the version of gulp-ng-annotate.

Well, the update commant does not work as expected. But I found a way which really updates the package and solves the issue

  1. manually change the version in package.json to "grunt-ng-annotate": "^1.0.1"
  2. run npm install
  3. Issue is solved.

Solution was found here

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.