Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add JS component to show stage in the process and dataset identifier
The component itself is a very simple Vue component doing very simple thing (display the stage in the wizard process and which dataset author is working on), but it's implemented within the Javascript application architecture that will be used for all the components of the File Upload wizard user facing interface. * The Javascript codebase's root directory is located at ``gigadb/app/client/web`` and inside it, package.json is the main project configuration and dependency management file (like composer.json for the PHP applications) to be operated upon using the ``npm`` command. * ``src/index.js`` is the entry point to the codebase. It's where the main Vue app (https://github.com/vuejs/vue) is instantiated and associated with an id (here #gigadb-fuw) that will be used in the view file (filesUpload.php) to bring the application into the Yii controller's web view. * The component's code at location ``src/components/DatasetInfoComponent.vue`` has a unit test suite at ``test/DatasetInfoComponent.spec.js``. The test syntax is of the "Spec" style, very common in Javascript and Ruby codebases. The test framework used here is Jasmine (https://jasmine.github.io/tutorials/your_first_suite). Karma (https://github.com/karma-runner/karma) is the test runner we use to run the Jasmine unit tests against web browsers (at the moment headless Firefox). For the code coverage we use karma-coverage in conjunction with the transpiler Babel. Babel is used here for instrumenting the code coverage, but it will be useful later for transpiling between javascript dialects. The javascript application needs to be compiled (build stage) in order to: * be bundled in one file with all the dependencies (for compatibility and performances) * transpiled into the dialect of javacript that web browser understands (which allow developers to use more modern and productive dialects) * run various pre-processing stages (like minification or in this case, instrumentation of code for code coverage) During the build stage, the javascript app and all the required and imported components, modules and dependencies are bundled into one javascript file at location ``dist/main.js`` (which is .gitignored as it's a build artifact) The tool used for building is webpack (https://webpack.js.org/) and is plugin-based, so here we have plugins for loading Vue components, CSS files and Babel. Webpack, Karma and Babel have all their own config files at the javascript root directory (``webpack.config.js``, ``karma.conf.js``, ``babel.config.js`` respectively) When the Javascript application is deployed into GigaDB, the ``dist/main.js`` file is copied into the git project's top-level ``js/`` directory as ``fuw-$npm_package_version.js`` where **$npm_package_version** is the version defined in ``package.json`` ``package-lock.json`` is the javascript equivalent of PHP's ``composer.lock`` file with a record of the exact version of all dependencies installed in the project (in the .gitignored ``node_modules/`` directory). It's better to have that file versioned in git so to be shared across all environments and amongst all developers as javascript dependencencies can be very volatile due to extreme modularity and extreme paces (very frequent to rare) of updates.
- Loading branch information