Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Dart frontend organization #59

@BenBlaisdell

Description

@BenBlaisdell

I've been doing more research into angular and how the frontend is organized in order to make adding new features easier in the future. Right now there seems to be a decent amount of duplicate js and html that could be turned int abstract templates and initialized with a specialized controller for each entity.

How states currently operate (omitted non-relevant lines)

.state('app.entities', {
    views: {
        'content@': {
            template: '<h3>choose an entity from the navbar :D</h3>'
        }
    },
})
.state('app.entities.engines', {
    views: {
        'content@': {
            templateUrl: 'static/partials/entities/engines.html',
            controller: 'EnginesEntityController'
        }
    },
})
.state('app.entities.datasets', {
    views: {
        'content@': {
            templateUrl: 'static/partials/entities/datasets.html',
            controller: 'DatasetsEntityController'
        }
    },
})

What I'm thinking

.state('app.entities', {
    abstract: true,
    views: {
        'content@': {
            templateUrl: 'static/app/components/actions_view/entities_view.html',
            controllerAs: 'entityCtrl'
        }
    }
})
.state('app.entities.engines', {
    views: {
        'content@': {
            controller: 'EnginesViewCtrl'
        }
    },
})
.state('app.entities.datasets', {
    views: {
        'content@': {
            controller: 'DatasetsViewCtrl'
        }
    },
})

Passing the controller with entity-specific data into the abstract create button and entity table

<dt-entites-table ng-init="init(entityCtrl)"></dt-entites-table>
<dt-create-entity-button ng-init="init(entityCtrl)"></dt-create-entity-button>

This would make it much easier to add features to general entity tools in the future. Disclaimer: I'm not sure if my controllerAs trickery in app.entities will work as intended, but that can be easily moved into child states if it doesn't.

@dannymcpherson, @maybeiambatman suggested I talk to you before spending too much time on this. Is there a reason you went with the current implementation aside from ease of initial setup, and do you have any comments/critiques of the route I'm thinking of trying?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions