New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config.js modularized #14470

Merged
merged 6 commits into from Aug 7, 2018

Conversation

Projects
None yet
2 participants
@Piyush3079
Contributor

Piyush3079 commented Jul 8, 2018

This pr contains the modular code for Config.js file. This file is used for settings on various pages.

This pr is in continuation of Mod_Jd_Import_Export. Before reviewing this pr, review Mod_Js_Import_Export and merge and then compare with this pr.
Before submitting pull request, please check that every commit:

  • Has proper Signed-Off-By
  • Has commit message which describes it
  • Is needed on it's own, if you have just minor fixes to previous commits, you can squash them
  • Any new functionality is covered by tests

@devenbansod devenbansod changed the base branch from master to gsoc-js-refactoring Aug 1, 2018

@devenbansod

This comment has been minimized.

Show comment
Hide comment
@devenbansod

devenbansod Aug 1, 2018

Member

Please rebase and squash

Member

devenbansod commented Aug 1, 2018

Please rebase and squash

Piyush3079 added some commits Jun 22, 2018

Add config related imports in files to use config.js in modular code.
Signed-Off-By: Piyush Vijay <piyushvijay.1997@gmail.com>
Config.js is modularised.
Signed-off-by: Piyush Vijay <piyushvijay.1997@gmail.com>

@devenbansod devenbansod self-requested a review Aug 1, 2018

@devenbansod devenbansod self-assigned this Aug 1, 2018

@devenbansod

Some minor comments and queries.

Show outdated Hide outdated js/src/config.js
@@ -483,7 +483,7 @@ public function addJsValidate($fieldId, $validators, array &$jsArray): void
$vArgs[] = Sanitize::escapeJsString($arg);
}
$vArgs = $vArgs ? ", ['" . implode("', '", $vArgs) . "']" : '';
$jsArray[] = "validateField('$fieldId', '$vName', true$vArgs)";
$jsArray[] = "['$fieldId', '$vName', true$vArgs]";

This comment has been minimized.

@devenbansod

devenbansod Aug 2, 2018

Member

Any reason why this is required?

@devenbansod

devenbansod Aug 2, 2018

Member

Any reason why this is required?

This comment has been minimized.

@Piyush3079

Piyush3079 Aug 2, 2018

Contributor

This function is not available in global scope so it is giving reference error. There fore it is removed and an array is returrned from the function instead of a function call.

@Piyush3079

Piyush3079 Aug 2, 2018

Contributor

This function is not available in global scope so it is giving reference error. There fore it is removed and an array is returrned from the function instead of a function call.

Show outdated Hide outdated js/src/variables/get_config.js
Show outdated Hide outdated js/src/variables/get_config.js
Show outdated Hide outdated js/src/functions/config.js

Piyush3079 added some commits Jul 8, 2018

Commented code removed and debug statements removed.
Signed-Off-By: Piyush Vijay <piyushvijay.1997@gmail.com>
Add isStorageSupport in functions.js for code compatibility and add c…
…onfig.js in file loading object.

Signed-Off-By: Piyush Vijay <piyushvijay.1997@gmail.com>
Pass env variable to webpack.config file for making production build.
Build script for js files.
Signed-Off-By: Piyush Vijay <piyushvijay.1997@gmail.com>
@Piyush3079

Requesting review from @devenbansod

@@ -7,7 +7,7 @@
"license": "GPL-2.0",
"scripts": {
"dev:wds": "webpack-dev-server --progress",
"prod:build": "del js/lib js/dist && babel js/src/ -d js/lib --ignore .test.js && cross-env NODE_ENV=production webpack -p --progress",
"prod:build": "del js/lib js/dist && babel js/src/ -d js/lib --ignore .test.js && cross-env NODE_ENV=production webpack -p --env.production --progress",

This comment has been minimized.

@Piyush3079

Piyush3079 Aug 2, 2018

Contributor

Adding production environment variable in webpack.config file.

@Piyush3079

Piyush3079 Aug 2, 2018

Contributor

Adding production environment variable in webpack.config file.

Show outdated Hide outdated scripts/build-js-files
@@ -2,84 +2,95 @@ import path from 'path';
import webpack from 'webpack';

This comment has been minimized.

@Piyush3079

Piyush3079 Aug 2, 2018

Contributor

Update webpack.config file for creating production build using command line.

@Piyush3079

Piyush3079 Aug 2, 2018

Contributor

Update webpack.config file for creating production build using command line.

@codecov

This comment has been minimized.

Show comment
Hide comment
@codecov

codecov bot Aug 2, 2018

Codecov Report

❗️ No coverage uploaded for pull request base (gsoc-js-refactoring@5e9d705). Click here to learn what that means.
The diff coverage is 75%.

@@                  Coverage Diff                   @@
##             gsoc-js-refactoring   #14470   +/-   ##
======================================================
  Coverage                       ?   50.53%           
  Complexity                     ?    14434           
======================================================
  Files                          ?      501           
  Lines                          ?    68012           
  Branches                       ?        0           
======================================================
  Hits                           ?    34372           
  Misses                         ?    33640           
  Partials                       ?        0

codecov bot commented Aug 2, 2018

Codecov Report

❗️ No coverage uploaded for pull request base (gsoc-js-refactoring@5e9d705). Click here to learn what that means.
The diff coverage is 75%.

@@                  Coverage Diff                   @@
##             gsoc-js-refactoring   #14470   +/-   ##
======================================================
  Coverage                       ?   50.53%           
  Complexity                     ?    14434           
======================================================
  Files                          ?      501           
  Lines                          ?    68012           
  Branches                       ?        0           
======================================================
  Hits                           ?    34372           
  Misses                         ?    33640           
  Partials                       ?        0
@devenbansod

Looks good overall. Some comments.

Tested locally. Works fine.

Show outdated Hide outdated webpack.config.babel.js
return {
mode: MODE,
entry: {
index_new: './js/src/index.js'

This comment has been minimized.

@devenbansod

devenbansod Aug 2, 2018

Member

Still needs to be called as index_new?

@devenbansod

devenbansod Aug 2, 2018

Member

Still needs to be called as index_new?

This comment has been minimized.

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

Yeah as some of the files are still remaining.

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

Yeah as some of the files are still remaining.

Show outdated Hide outdated scripts/build-js-files
Show outdated Hide outdated scripts/build-js-files
Show outdated Hide outdated scripts/build-js-files
Show outdated Hide outdated scripts/build-js-files
Show outdated Hide outdated scripts/build-js-files
Test fixtures for travis.
Signed-Off-By: Piyush Vijay <piyushvijay.1997@gmail.com>
@Piyush3079

General comments to increase the understandability of the pr.

@@ -5165,3 +5165,21 @@ function checkPasswordStrength (value, meter_obj, meter_object_label, username)
case 4: meter_object_label.html(PMA_messages.strStrong);
}
}

This comment has been minimized.

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

Created a copy of function to make it globally available.

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

Created a copy of function to make it globally available.

@@ -0,0 +1,80 @@
import { PMA_Messages as PMA_messages } from '../variables/export_variables';

This comment has been minimized.

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

Validation class to validate input for settings tab

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

Validation class to validate input for settings tab

@@ -0,0 +1,176 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */

This comment has been minimized.

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

Modular code for config.js

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

Modular code for config.js

@@ -0,0 +1,589 @@
import { PMA_ajaxShowMessage } from '../utils/show_ajax_messages';

This comment has been minimized.

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

General functions required to be imported in config.js for proper functionality.

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

General functions required to be imported in config.js for proper functionality.

@@ -0,0 +1,33 @@
import { validators } from '../classes/Config';

This comment has been minimized.

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

File containing functions for importing validation parameters in Modular code which are to be used in modular code.

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

File containing functions for importing validation parameters in Modular code which are to be used in modular code.

@@ -355,12 +355,12 @@ public function getDisplay(
foreach ($this->_jsLangStrings as $strName => $strValue) {
$jsLang[] = "'$strName': '" . Sanitize::jsFormat($strValue, false) . '\'';
}
$js[] = "$.extend(PMA_messages, {\n\t"
. implode(",\n\t", $jsLang) . '})';
$js[] = "{\n\t"

This comment has been minimized.

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

Minor change as PMA_messages will not be available in global scope.

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

Minor change as PMA_messages will not be available in global scope.

}
$js[] = "$.extend(defaultValues, {\n\t"
. implode(",\n\t", $jsDefault) . '})';
$js[] = "{\n\t"

This comment has been minimized.

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

Minor change as defaultValues will not be available in global scope

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

Minor change as defaultValues will not be available in global scope

@@ -0,0 +1,42 @@
#!/bin/sh

This comment has been minimized.

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

Build script for creating production build of javascript files.

@Piyush3079

Piyush3079 Aug 3, 2018

Contributor

Build script for creating production build of javascript files.

@devenbansod

LGTM.

@devenbansod devenbansod merged commit 0e16cc5 into phpmyadmin:gsoc-js-refactoring Aug 7, 2018

1 of 3 checks passed

Codacy/PR Quality Review Codacy was unable to analyse your pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details
DCO All commits have a DCO sign-off from the author
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment