luyadev / luya

LUYA is a scalable web framework and content management system with the goal to please developers, clients and users alike.
https://luya.io
MIT License
811 stars 205 forks source link

Migration to Angular 2 #1824

Closed arollmann closed 6 years ago

arollmann commented 6 years ago

AngularJS will be moving to Long Term Support (LTS) mode on July 1st 2018. Have you planned a migration of the admin UI based on Angular 2 ?

nadar commented 6 years ago

First of all: This is a very good question we where thinking about this a lot, currently (state june 2018) i can summarize the following:

LTS

Angular JS LTS will end at 2021 (https://blog.angular.io/stable-angularjs-and-long-term-support-7e077635ee9c) we will see what happens then. Maybe they will provide some security patches, or there will be a community fork.

AngularJs vs Angular 2

What we love about AngularJS is that we can mix it with PHP, i can make you an example of this: People using LUYA are commonly very familiar with Yii, so we try to adopt this strategy. In order to extend the LUYA Admin or the CMS you don't need to know angular at all, but you can. An example with the NgRest Active Windows:

<?php
use luya\admin\ngrest\aw\CallbackFormWidget;

/* @var $this \luya\admin\ngrest\base\ActiveWindowView */
/* @var $this \luya\admin\ngrest\aw\CallbackFormWidget */ 

?>
<div>
    <?php $form = CallbackFormWidget::begin(['callback' => 'post-data', 'buttonValue' => 'Submit']); ?>
    <?= $form->field('firstname', 'Firstname'); ?>
    <?= $form->field('password', 'Password')->passwordInput(); ?>
    <?= $form->field('message', 'Message')->textarea(); ?>
    <?php $form::end(); ?>
</div>

This will generate an angular form, submiting the data to the API. So we are in an angular context, we can not use jquery or "original" post request. Therfore we need a javascript language where we can mix. Otherwise people would need to know angular in order to build such forms. We don't want this, you can if you are experienced with angular, but you can also use PHP and yii2 similar form building technique.

And now this is what currently is the problem with angular 2, it should really contain only html and angular 2 code, the strategy and structure of angular 2 has changed. It recommends type script, must be compiled, etc. LUYA admin is not a "true" angular only application, so we are unable to migrate to angular 2.

(i don't say its not possible to mix php with angular 2 but it seems not to be part of the angular 2 strategy, angular 2 is perfect for "angular only" applications, this is what its made for.)

LUYA 2

Rewrite the existing code to angular 2 or any other technique would take so much time, instead we will plan a version 2 of LUYA. What i currently can say is we want to finish a few things (estore, account module, admin for large amount of data) before thinking about LUYA 2.

Alternatives

If we reach the point where we start the planing for LUYA 2, there will be the time to decide what technique is part of. Maybe using vue.js, as its similar to angularjs, maybe there are other competitors at this time. In terms of technology, a lot can go on in 3 years.

Any suggestions and inputs are very welcome. I hope this gives you somewhat an idea of how we think and plan for the future.

arollmann commented 6 years ago

OK, I can only agree with that. Indeed, the interest of LUYA is to complete Yii. And there are more urgent issues than the frontend language.

nadar commented 6 years ago

Thanks for asking the question, so i had time to answer this, cause i am sure there will be more people looking for this. 👍 Can we close it?

flashjay commented 4 years ago

So, it's time to have a conclusion ? Thinking vue.js is a better solution...

nadar commented 4 years ago

In terms of mixing with PHP, yes it definitely looks like VUE.

flashjay commented 4 years ago

Do you have any plan migrate to vue.js? Laravel intergrated with Vue may be a good ref... But I don't learn much on Laravel. I like ur luya project, has write something depend on it. Luya is awesome project. Hope it's going better...

nadar commented 4 years ago

Currently, we don't have any plans to move to vue, this would take sooooooo much time. I guess instead we will create LUYA 2 instead. Maybe then we should also think about the backend technology, which could be Yii 3 or something else.