Migration to Ext JS 6 - Roadshow 2016 presentation by Lee Boonstra & Olga Petrova, Sales Engineers DACH
View Slide
Migration to Ext JS 6!Lee Boonstra!@ladysign - http://www.ladysign-apps.com!Sales Engineer / Trainer EMEA!
Migration to Ext JS 6!Olga Petrova !Sales Engineers DACH!
CONFIDENTIAL • Sencha Inc. ©2015Agenda!• Pros and cons of staying on legacy!• Why move to Ext JS 6!• Improvements: !• Ext JS 4!• Ext JS 5!• Ext JS 6!• Migration in action!4!
CONFIDENTIAL • Sencha Inc. ©2015Why do people stick to older Sencha versions?!• Demand for new apps, takes resources!• Application seems stable!• Application is complex!• Original developers are not in the company anymore!
CONFIDENTIAL • Sencha Inc. ©2015Risks!• Browsers push automated updates!• Hard to maintain and support!• No Sencha support!• Performance, memory usage !• Doesn’t work on mobile!• No access to new Sencha features!• Changing business demands!6!
CONFIDENTIAL • Sencha Inc. ©2015Pros & Cons of developing in legacy Ext JS versions!Pros• Least effort (short term)!• Current team has legacy Ext JS skills!Cons• Does not remove risks!• The longer you leave migration, themore risk increases!• Investing in an app that has to bemigrated!• Isn’t optimized for mobile!7!
CONFIDENTIAL • Sencha Inc. ©2015Ext JS Advantages overview!8!• Custom Builds / Dynamic Loading• Advanced Class System• MVC Architecture• Advanced Charts• Sass Themes• MVVM Architecture• Responsive Design• Touch Support• Data package improvements• Universal Apps• Fashion: JS theme compilaDon• Asynchronous JavaScript: PromisesExt JS 4New ComponentsARIA supportBrowser supportPerformance and memory opDmizaDonTooling (Cmd, Architect, Plugins, Inspector, Test)Ext JS 5Ext JS 6Ext JS 3
CONFIDENTIAL • Sencha Inc. ©2015Ext JS 3 to Ext JS 6!9!
CONFIDENTIAL • Sencha Inc. ©2015Migration Steps!Step by Step Directly move to 610!Ext JS 3Ext JS 6Ext JS 5Ext JS 4Ext JS 3Ext JS 6Ext JS 5Ext JS 4
CONFIDENTIAL • Sencha Inc. ©2015We recommend:!11!Ext JS 3Ext JS 6Ext JS 5Ext JS 4• Direct move to Ext JS 6!
CONFIDENTIAL • Sencha Inc. ©2015Improvements compared to!Ext JS 3!12!
CONFIDENTIAL • Sencha Inc. ©2015Custom Builds / Dynamic Loading!Ext JS 3 & below• ext-all.js!• ext-all.css!• Manually ordering of scripts in!!Ext JS 6• Microloader!• Custom builds with Sencha Cmd!!13!
CONFIDENTIAL • Sencha Inc. ©2015MVC Architecture!Ext JS 3 & below• Spaghetti code!!Ext JS 6• Advanced class system!• MVVM or MVC!• Models!14!
CONFIDENTIAL • Sencha Inc. ©2015Charts!Ext JS 3 & below• Flash based!• Limited!!Ext JS 6• SVG & Canvas –based!• Broad range of chart types!• Run on mobile devices!• Support touch gestures!!15!
CONFIDENTIAL • Sencha Inc. ©2015Theming!Ext JS 3 & below.x-grid3-row { border: 1px !important; font-size: 16px !important; }!Ext JS 6• Sass themes!• Sharable packages!• Theme inheritance!16!
CONFIDENTIAL • Sencha Inc. ©2015Continuous Improvements!17!…because some things improve all the time.!
CONFIDENTIAL • Sencha Inc. ©2015• Dashboard!• Tree Grid!• Infinitive Grid!• Widget Column!• Widgets!• Pivot Grid!• Excel Exporter!• Spreadsheet Model!• Clipboard!! 18!• Multi Selector!• Toast Window!• New Charts!• Chart Themes!• New Themes!• Modern Toolkit Components!• Routing!New Components / Features!
CONFIDENTIAL • Sencha Inc. ©2015 19!ARIA support!• DOM attributes provide semantic information!• Keyboard Navigation!• Focus Management!• High Contrast Theme!
CONFIDENTIAL • Sencha Inc. ©2015 20!Latest framework!• Browser support!• Performance updates!• Memory optimization!
CONFIDENTIAL • Sencha Inc. ©2015Tooling!Productivity and quality improvements:!!• Sencha Cmd!• Sencha Architect!• Sencha Inspector!• IDE plugins!• Sencha Test!!21!
CONFIDENTIAL • Sencha Inc. ©2015Migration in Action!22!
CONFIDENTIAL • Sencha Inc. ©2015 23!Divide and Rule - Separation of concerns!
CONFIDENTIAL • Sencha Inc. ©2015Key approach for Ext JS 3 & below!24!ComponentModel View ViewModel ViewController
CONFIDENTIAL • Sencha Inc. ©2015Key approach for Ext JS 3 & below!• Data Layer -> Model!• Component Definition -> View!• Data between View and Model -> ViewModel!• Business logic, Event handlers -> ViewController !25!
CONFIDENTIAL • Sencha Inc. ©2015For each re-usable component!26!
CONFIDENTIAL • Sencha Inc. ©2015Components & Classes can inherit from each other!27!
CONFIDENTIAL • Sencha Inc. ©2015Ext JS 3.x Grid example!28!
CONFIDENTIAL • Sencha Inc. ©2015Generate a fresh new Ext JS 6 project!29!
CONFIDENTIAL • Sencha Inc. ©2015 30!
CONFIDENTIAL • Sencha Inc. ©2015 31!Model(Model DefiniDon)
CONFIDENTIAL • Sencha Inc. ©2015Entity(Model Definition)!32!app/model/Company.js!Ext JS 3 migration!Ext.data.Model
CONFIDENTIAL • Sencha Inc. ©2015 33!Model(Store DefiniDon)
CONFIDENTIAL • Sencha Inc. ©2015Store Definition!34!app/store/Companies.js!Ext JS 3 migration!Ext.data.ArrayStoreLink to the Model
CONFIDENTIAL • Sencha Inc. ©2015 35!View
CONFIDENTIAL • Sencha Inc. ©2015View (Grid Definition)!36!app/view/company/Grid.js!Ext JS 3 migration!
CONFIDENTIAL • Sencha Inc. ©2015 37!Viewport willRender the grid.
CONFIDENTIAL • Sencha Inc. ©2015View (Viewport)!38!app/view/main/Main.js!Ext JS 3 migration!Create an instanceof the grid.
CONFIDENTIAL • Sencha Inc. ©2015 39!The data will be inViewModelThe data will be inViewModel
CONFIDENTIAL • Sencha Inc. ©2015ViewModel!40!app/view/company/GridModel.js!Ext JS 3 migration!Ext.app.ViewModelData in VMAlias
CONFIDENTIAL • Sencha Inc. ©2015 41!We will link the storevia DataBinding
CONFIDENTIAL • Sencha Inc. ©2015Databinding!42!app/view/company/Grid.js!Ext JS 3 migration!Bind syntax,to bind the Storeto the ViewWire up the VM
CONFIDENTIAL • Sencha Inc. ©2015 43!Move implementaDonto VCMove implementaDonto VC
CONFIDENTIAL • Sencha Inc. ©2015View Controller!44!app/view/company/GridController.js!Ext JS 3 migration!Alias
CONFIDENTIAL • Sencha Inc. ©2015Wiring up the VC!45!app/view/company/Grid.js!Ext JS 3 migration!Wire up the VCThe event methodheader is in the ViewThe event methodheader is in the View
CONFIDENTIAL • Sencha Inc. ©2015Events in MVVM!46!app/view/company/Grid.js!Ext JS 3 migration!The event methodheader is in the ViewThe event methodheader is in the View
CONFIDENTIAL • Sencha Inc. ©2015Method implementation in the View Controller!47!app/view/company/GridController.js!Ext JS 3 migration!
CONFIDENTIAL • Sencha Inc. ©2015Final Result!48!http://github.com/olga-petrova/Migration_3.4_to_6
CONFIDENTIAL • Sencha Inc. ©2015Ext JS 4 to Ext JS 6!49!
CONFIDENTIAL • Sencha Inc. ©2015Ext JS Advantages overview!50!• Custom Builds / Dynamic Loading• Advanced Class System• MVC Architecture• Advanced Charts• Sass Themes• MVVM Architecture• Responsive Design• Touch Support• Data package improvements• Universal Apps• Fashion: JS theme compilaDon• Asynchronous JavaScript: PromisesExt JS 4New ComponentsARIA supportBrowser supportPerformance and memory opDmizaDonTooling (Cmd, Architect, Plugins, Inspector, Test)Ext JS 5Ext JS 6Ext JS 3
CONFIDENTIAL • Sencha Inc. ©2015Ext JS 4 to Ext JS 6!51!Ext JS 3Ext JS 6Ext JS 5Ext JS 4
CONFIDENTIAL • Sencha Inc. ©2015Sencha Touch 2 to Ext JS 6!52!
CONFIDENTIAL • Sencha Inc. ©2015Ext JS Advantages overview!53!• MVVM Architecture• MVVM Architecture• Data package improvements• Advanced Charts• Advanced Theming• Mouse & Keyboard support• Universal Apps• Fashion: JS theme compilaDon• Asynchronous JavaScript: Promises New ComponentsARIA supportBrowser supportPerformance and memory opDmizaDonTooling (Cmd, Architect, Plugins, Inspector, Test)Ext JS 6Sencha Touch 2
CONFIDENTIAL • Sencha Inc. ©2015Sencha Touch 2 to Ext JS 6!54!Sencha Touch 2Ext JS 6
CONFIDENTIAL • Sencha Inc. ©2015Improvements compared to!Ext JS 4!55!
CONFIDENTIAL • Sencha Inc. ©2015Responsive Design!Ext JS 4 and below• Viewport resizes!Ext JS 6• Responsive Design with CSS or JS!• Device Profiles!56!
CONFIDENTIAL • Sencha Inc. ©2015Touch support!Ext JS 4 and below• Browser default!Ext JS 6• Event normalization!• Gestures (pinch, swipe…)!• Touch themes!57!
CONFIDENTIAL • Sencha Inc. ©2015Ext JS 4 and below• Every fields needs to be declared inModel!• Model Relations was difficult!Ext JS 6• Set fields for converted data only!• Custom field types / validations!• Simplified Associations!• Chained Stores!!58!Data package improvements!
CONFIDENTIAL • Sencha Inc. ©2015Improvements compared to!Sencha Touch 2!59!
CONFIDENTIAL • Sencha Inc. ©2015Mouse & Keyboard support!Sencha Touch 2 & below• Odd behavior on a desktop!!Ext JS 6• Modern toolkit on a desktop:!• List can scroll with a mouse!• Keyboard navigation!60!Introduced in Ext JS 6
CONFIDENTIAL • Sencha Inc. ©2015Advanced Themes (packages) & new themes!Sencha Touch 2 & below• Default!• Cupertino!• Mountain View!• Tizen!• Blackberry!!Ext JS 6• Neptune!• Triton!• Cupertino!• Mountain View!61!Introduced in Ext JS 6
CONFIDENTIAL • Sencha Inc. ©2015Migration in Action!62!for Sencha Touch 2 / Ext JS 4 it’s pretty similar…!
CONFIDENTIAL • Sencha Inc. ©20153 types of migration!• Simple migration (keep MVC pattern)!• Advanced migration (move to MVVM pattern)!• Advanced migration + universal app!63!
CONFIDENTIAL • Sencha Inc. ©2015Simple migration (keep MVC pattern)!64!
CONFIDENTIAL • Sencha Inc. ©2015Generate a fresh new Ext JS 6 project, with the same namespace!65!Modern only (Migrating Sencha Touch mobile app)!Classic only (Migrating Ext JS desktop app)!Simple migration!
CONFIDENTIAL • Sencha Inc. ©2015Copy files over!• Copy over the app folder from Ext JS 4/ ST2project!• Copy over app.js from Ext JS 4 / ST project!!66!Simple migration!
CONFIDENTIAL • Sencha Inc. ©2015Manually merge app.json & index.html!• Take changes in app.json & index.html over manually!(links to external StyleSheets, JS files etc…)!67!Simple migration!
CONFIDENTIAL • Sencha Inc. ©2015A new theme?!• Ext JS 4 users, might want to switch to Triton.!• Sencha Touch 2 users: there’s no default theme anymore.!!68!Simple migration!
CONFIDENTIAL • Sencha Inc. ©2015sencha app refresh!• Run on the command-line:!69!Simple migration!
CONFIDENTIAL • Sencha Inc. ©2015ERRORS!!• Let’s fix the errors!• IMAGE ERRRORS IN CMD + BROWSER!70!Simple migration ![ERR] ERROR![ERR] ERROR!WAIT? WHAT?!!!
CONFIDENTIAL • Sencha Inc. ©2015Those errors are actually good…!• You can fix it!!71!Simple migration!TIP!!http://docs.sencha.com/extjs/6.0/6.0.0-classic/!http://docs.sencha.com/extjs/6.0/6.0.0-modern/!http://docs.sencha.com/extjs/5.0/api_diffs/500_diff_changes.html!!
CONFIDENTIAL • Sencha Inc. ©2015Some examples!• [ERR] C2008: Requirement had no matching files (Ext.data.UuidGenerator)– myapp/app/model/MyModel:5:7Look in the API Docs, and see: Ext.data.UuidGenerator is deprecated, !use Ext.data.identifier.Uuid instead.!!• root in the Proxy reader is deprecated. Use rootProperty instead.!!• Ext JS 6 Stores don’t automatically set the storeId to the name of the class!!!72!Simple migration!
CONFIDENTIAL • Sencha Inc. ©2015Ext JS 4 Specific: Viewport!• When you generate a new project, the microloader expects the new viewport is: !app/view/main/Main.js!!Therefore, your browser errors this:!GET http://localhost:1841/myapp/app/view/main/Main.js?_dc=1402907827207404 (Not Found) bootstrap.js:511[E] [Ext.Loader] Some requested files failed to load.• Fix, this by renaming the Viewport.js file or setting the mainView, property in app.js!73!Simple migration!
CONFIDENTIAL • Sencha Inc. ©2015Ext JS 4 Specific: Charts!• Charts in Ext JS 6 are packages. You can choose to take the legacy SVG charts or themodern Canvas charts. When you see this error:!![ERR] com.sencha.exceptions.ExNotFound: Unknown definition fordependency : Ext.chart.Chart!Use this fix in app.json:!"requires": ["charts" //ext-charts for legacy charts],74!Simple migration!
CONFIDENTIAL • Sencha Inc. ©2015Clean up the Ext.data.Model!• No longer you need to define every field in the fields array!• You retrieve the data from a feed!• You set fields, only for data conversion!75!Simple migration!
CONFIDENTIAL • Sencha Inc. ©2015Sencha Touch Specific!• launch() in the Controller is deprecated. Use onLaunch() instead!!• Pictos icons are replaced by FontAwesome, you can set it like this:!iconCls: ‘x-fa fa-cog’!• Sencha Touch validations are now called validatorsTIP: http://docs.sencha.com/extjs/6.0/api_diffs/600_modern_diff.html!76!Simple migration!
CONFIDENTIAL • Sencha Inc. ©2015Advanced migration !(move to MVVM pattern)!77!
CONFIDENTIAL • Sencha Inc. ©2015MVVM Architecture!Ext JS 4 / Sencha Touch 2: MVC Ext JS 6: MVC + VM (databinding)78!ControllerModelViewVMViewModel VCDatabinding!Methods!Events!Advanced migration!Methods!Events!
CONFIDENTIAL • Sencha Inc. ©2015MVC!79!Advanced migration!Controller 2Model 2View 2 Model 3View 3Controller 1Model 1View 1Controller 3
CONFIDENTIAL • Sencha Inc. ©2015MVVM is more scalable!80!ViewModel View ViewControllerModelAdvanced migration!ViewModel View ViewControllerModelViewModel View ViewController
CONFIDENTIAL • Sencha Inc. ©2015Key approach for Ext JS 4 & Sencha Touch 2!Ext JS 4 / Sencha Touch 2: MVC Ext JS 6: MVC + VM81!ModelViewVMVCModelViewControllerAdvanced migration!New!!New!!
CONFIDENTIAL • Sencha Inc. ©2015Key approach for Ext JS 4 & Sencha Touch 2!• Create view subfolders!• Create a ViewModel (Ext.app.ViewModel), wire up the data (stores)!• Migrate Global Controllers to ViewControllers (Ext.app.ViewController)• Link VC and VM to View!• TIP: Generate a view with Sencha Cmd (sencha generate view MyView), generates thesubfolder with the 3 classes.!82!Advanced migration!
CONFIDENTIAL • Sencha Inc. ©2015Create for every view a subfolder!83!Advanced migration!
CONFIDENTIAL • Sencha Inc. ©2015Migrate Global Controllers to ViewControllers!84!Ext.app.ViewControllerSet an aliasTake over the methodsapp/view/main/MainController.js!Advanced migration!
CONFIDENTIAL • Sencha Inc. ©2015There are various new ways to query for components!VIEW VIEW CONTROLLER / VIEW MODEL• Ext.ComponentQuery.query(‘myxtype’)[0]• .down(‘myxtype’)• .up(‘myxtype’)• this.lookupReference(‘myview’);• this.getView()• this.getViewModel()• this.getViewController()85!• xtype: ‘myxtype’• reference: ‘myview’Advanced migration!
CONFIDENTIAL • Sencha Inc. ©2015Wire up the VC to the View!86!Link to the VCvia the aliasViews can listento eventsapp/view/main/Main.js!Advanced migration!
CONFIDENTIAL • Sencha Inc. ©2015Modify the Store!87!Set an aliasapp/store/Settings.js!Advanced migration!
CONFIDENTIAL • Sencha Inc. ©2015Create a ViewModel!88!Ext.app.ViewModelSet an aliasWire up the storeapp/view/main/MainModel.js!Advanced migration!
CONFIDENTIAL • Sencha Inc. ©2015Wire up the VM to the View!89!Link to the VMvia the aliasapp/view/main/Main.js!Advanced migration!
CONFIDENTIAL • Sencha Inc. ©2015A store can be bound to a view!bind: {store: ‘{settings}’}!90!Bind syntaxAdvanced migration!
CONFIDENTIAL • Sencha Inc. ©2015Universal app migration!91!
CONFIDENTIAL • Sencha Inc. ©2015Universal apps. Views from various toolkits!• Classic toolkit!- Advanced desktop components!- Legacy browser support!• Modern toolkit!- Simple DOM, CSS3 based!- Fast performing !- Modern browsers!- Components for Touch/Mobile!- Components for Mouse/Keyboard!92!Universal app migration!
CONFIDENTIAL • Sencha Inc. ©2015Generate a universal Ext JS 6 app with the same namespace!93!Universal app migration!
CONFIDENTIAL • Sencha Inc. ©2015Copy over the existing code!• Copy over the Ext JS 4 / 5 contents of app to the classic/src folder!• Copy over the Sencha Touch contents of app folder to the modern/src folder!• (You can follow the approach of MVVM migration)!94!Universal app migration!
CONFIDENTIAL • Sencha Inc. ©2015The magic is in the generated app.json file!95!"classpath": ["app","${toolkit.name}/src"],!Looks into app folder firstIf not found,check the toolkit/srcUniversal app migration!
CONFIDENTIAL • Sencha Inc. ©2015app.json contains build targets!96!"builds": {"desktopprofile": {"toolkit": "classic","theme": "theme-triton“,},"iphoneprofile": {"toolkit": "modern","theme": "theme-cupertino",}},!Every profile can have aToolkit and a Theme.You will need tocreate buildsfor every profile.sencha app buildUniversal app migration!
CONFIDENTIAL • Sencha Inc. ©2015Serve the right experience!97!MyApp<br/>var Ext = Ext || {}; // Ext namespace won't be defined yet...<br/>Ext.beforeLoad = function (tags) {<br/>var s = location.search, // the query string (ex "?foo=1&bar")<br/>profile;<br/>if (s.match(/\bdesktop\b/)) {<br/>profile = 'desktopprofile';<br/>}<br/>else if (s.match(/\biphone\b/)) {<br/>profile = 'iphoneprofile';<br/>}<br/>else {<br/>profile = tags.desktop ? 'desktopprofile' : 'iphoneprofile';<br/>}<br/>Ext.manifest = profile;<br/>};<br/>index.html!Universal app migration!
CONFIDENTIAL • Sencha Inc. ©2015Final Result!98!• https://www.sencha.com/blog/how-to-upgrade-a-sencha-touch-app-to-ext-js-6-modern-toolkit-part-1/• https://www.sencha.com/blog/how-to-upgrade-a-sencha-touch-app-to-ext-js-6-modern-toolkit-part-2/• https://www.sencha.com/blog/how-to-upgrade-a-sencha-touch-app-to-ext-js-6-modern-toolkit-part-3/Universal app migration!
CONFIDENTIAL • Sencha Inc. ©2015Ext JS 5 to Ext JS 6!99!
CONFIDENTIAL • Sencha Inc. ©2015Ext JS Advantages overview!100!• Custom Builds / Dynamic Loading• Advanced Class System• MVC Architecture• Advanced Charts• Sass Themes• MVVM Architecture• Responsive Design• Touch Support• Data package improvements• Universal Apps• Fashion: JS theme compilaDon• Asynchronous JavaScript: PromisesExt JS 4New ComponentsARIA supportBrowser supportPerformance and memory opDmizaDonTooling (Cmd, Architect, Plugins, Inspector, Test)Ext JS 5Ext JS 6Ext JS 3
CONFIDENTIAL • Sencha Inc. ©2015Ext JS 5 to Ext JS 6!101!Ext JS 3Ext JS 6Ext JS 5Ext JS 4
CONFIDENTIAL • Sencha Inc. ©2015Improvements compared to!Ext JS 5!102!
CONFIDENTIAL • Sencha Inc. ©2015Create universal apps!• Various toolkits, apps for!- all devices!- all screen sizes!- all platforms!- all browsers!103!
CONFIDENTIAL • Sencha Inc. ©2015Fast theme compilation!Ext JS 4, 5 & Sencha Touch 2• Sloooowwwww compilation!• Requires Ruby to be installed!• Requires Ruby knowledge!!Ext JS 6• Fashion: JS based theme compilation!• Compile order improvements!• Write your own extensions with JS!• Debug!104!
CONFIDENTIAL • Sencha Inc. ©2015Asynchronous JavaScript: Promises!Ext JS 5 & below• Callbacks…!!!Ext JS 6• Chainable promises!• Ext.Promise & Ext.Deferred!• EC6 A+ Spec!• Integrated in Ext.Ajax!105!
CONFIDENTIAL • Sencha Inc. ©2015Migration in Action!106!
CONFIDENTIAL • Sencha Inc. ©2015Ext JS 6 is backwards compatible with Ext JS 5!107!• It shares the same core!• You just need to re-generate the project with the Ext JS 6 sdk & copy over!• Additionally you want to switch to Triton theme in app.json!• You might want to create universal views!
CONFIDENTIAL • Sencha Inc. ©2015Training!• Comprehensive training programs for developers of all experience levels!• Helps with overcoming learning curve!• Delivered onsite, public, and online!!108!
CONFIDENTIAL • Sencha Inc. ©2015Professional Services!The Sencha Professional Services team stands ready to provide you and your teamwith hands-on expert assistance in the use of Sencha frameworks and tools!109!Enterprise mentoring and architectural planning!Embedded development expertise!Code review and best practices knowledge transfer!Custom application and component development!
CONFIDENTIAL • Sencha Inc. ©2015Support & Maintenance!• Subscription-based support and maintenance service available to commerciallicense holders, provides access to software patches and updates!• Technical advice for all stages of application development process, from designthrough to deployment!110!Free upgrade to next major release!Access to Premium Forums!Early access to custom bug fixes!Access to online ticketing system!Performance tuning!Remote troubleshooting!
CONFIDENTIAL • Sencha Inc. ©2015Conclusion & Resources!• http://speakerdeck.com/savelee/!• http://docs.sencha.com/extjs/6.0/whats_new/whats_new.html!• http://github.com/olga-petrova/Migration_3.4_to_6!• https://www.sencha.com/blog/how-to-upgrade-a-sencha-touch-app-to-ext-js-6-modern-toolkit-part-1/!111!
112!Questions?!
113!Coffee !!