Skip to content

Commit

Permalink
[CE-259] Change operator dashboard theme react.
Browse files Browse the repository at this point in the history
Remove old js file for operator dashboard theme react.
Add empty framework for operator dashboard theme react.
Add js code check for make check.

Change-Id: I08c5adadd5df573681cbb471a3c35dd036d54206
Signed-off-by: Haitao Yue <hightall@me.com>
  • Loading branch information
hightall committed Apr 13, 2018
1 parent d8624d9 commit 30e0264
Show file tree
Hide file tree
Showing 155 changed files with 3,434 additions and 5,181 deletions.
33 changes: 19 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,20 @@ endif
ifeq (${THEME}, basic) # basic theme doesn't need js compiling
START_OPTIONS = initial-env
else
ifeq (${THEME}, react) # react needs compiling js first
ifneq ($(wildcard ./src/${STATIC_FOLDER}/js/dist),)
BUILD_JS=
else
BUILD_JS=build-admin-js build-user-dashboard-js
endif
else
ifneq ($(wildcard ./src/${STATIC_FOLDER}/dist),)
BUILD_JS=
else
BUILD_JS=build-admin-js build-user-dashboard-js
endif
endif
BUILD_JS=
# ifeq (${THEME}, react) # react needs compiling js first
# ifneq ($(wildcard ./src/${STATIC_FOLDER}/dist),)
# BUILD_JS=
# else
# BUILD_JS=build-admin-js build-user-dashboard-js
# endif
# else
# ifneq ($(wildcard ./src/${STATIC_FOLDER}/dist),)
# BUILD_JS=
# else
# BUILD_JS=build-admin-js build-user-dashboard-js
# endif
# endif
START_OPTIONS = initial-env $(BUILD_JS)
endif

Expand Down Expand Up @@ -149,10 +150,14 @@ license:

install: $(patsubst %,build/docker/%/.push,$(DOCKER_IMAGES))

check-js: ##@Code Check check js code format
docker-compose -f docker-compose-check-js.yaml up

check: setup-master ##@Code Check code format
@$(MAKE) license
find ./docs -type f -name "*.md" -exec egrep -l " +$$" {} \;
tox
@$(MAKE) check-js
@$(MAKE) test-case
make start && sleep 60 && make stop

Expand Down Expand Up @@ -218,7 +223,7 @@ watch-mode: ##@Nodejs Run watch mode with js files for react

npm-install: ##@Nodejs Install modules with npm package management
bash scripts/master_node/npm_install.sh
@$(MAKE) -C user-dashboard/ npm-install
# @$(MAKE) -C user-dashboard/ npm-install

help: ##@other Show this help.
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
Expand Down
6 changes: 2 additions & 4 deletions docker-compose-build-js.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ services:
build-admin-js:
build:
context: $ROOT_PATH/src/themes/$THEME/static
image: build-$THEME
volumes:
- ./src/$STATIC_FOLDER:/app
- ./src/$TEMPLATE_FOLDER:/app/templates
command: bash -c "cd /app && npm run build"
- ./src/$STATIC_FOLDER:/var/www
- ./src/$TEMPLATE_FOLDER:/templates
13 changes: 13 additions & 0 deletions docker-compose-check-js.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright IBM Corp., All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

version: '2'
services:
check-js:
build:
context: $ROOT_PATH/src/themes/react/static
volumes:
- ./src/themes/react/static:/var/www
command: bash -c "ln -sf /node_modules /var/www/dashboard/node_modules && cd /var/www/dashboard && npm run lint && rm -rf node_modules"
4 changes: 2 additions & 2 deletions scripts/check_license.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
#

CHECK=$(git diff --name-only HEAD * | grep -v check_license.sh | grep -v .json$ | grep -v .jpg$ | grep -v .JPG$ | grep -v .png$ | grep -v .ico$ \
| grep -v .graffle$ | grep -v .svg$ | grep -v .pug$ | grep -v .rst$ | grep -v .git \
| grep -v .graffle$ | grep -v .svg$ | grep -v .pug$ | grep -v .rst$ | grep -v .git \ grep -v .eslintrc$ \ grep -v .prettierignore$ \ grep -v .prettierrc$ \ grep -v .stylelintrc$ \
| grep -v .pem$ | grep -v .crt$ | grep -v .key$ | grep -v lib/ | grep -v fonts/ | grep -v .min.css$ \
| grep -v .block$ | grep -v .less$ | grep -v crypto-config/ | grep -v .min.js$ | grep -v .tx$ | grep -v .go$ | grep -v docker/ | grep -v dockerhub/ | grep -v agent/ \
| grep -v .md$ | grep -v ^vendor/ | grep -v ^build/ | grep -v .pb.go$ | grep -v .txt | grep -v .env | sort -u)

if [[ -z "$CHECK" ]]; then
CHECK=$(git diff-tree --no-commit-id --name-only -r $(git log -2 \
--pretty=format:"%h") | grep -v check_license.sh | grep -v .json$ | grep -v .jpg$ | grep -v .JPG$ | grep -v .png$ | grep -v .ico$ \
| grep -v .graffle$ | grep -v .svg$ | grep -v .pug$ | grep -v .rst$ | grep -v .git \
| grep -v .graffle$ | grep -v .svg$ | grep -v .pug$ | grep -v .rst$ | grep -v .git \ grep -v .eslintrc$ \ grep -v .prettierignore$ \ grep -v .prettierrc$ \ grep -v .stylelintrc$ \
| grep -v .pem$ | grep -v .crt$ | grep -v .key$ | grep -v lib/ | grep -v fonts/ | grep -v .min.css$ \
| grep -v .block$ | grep -v .less$ | grep -v crypto-config/ | grep -v .min.js$ | grep -v .tx$ | grep -v .go$ | grep -v docker/ | grep -v dockerhub/ | grep -v agent/ \
| grep -v .md$ | grep -v ^vendor/ | grep -v ^build/ | grep -v .pb.go$ | grep -v .txt | grep -v .env | sort -u)
Expand Down
8 changes: 4 additions & 4 deletions src/themes/react/static/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#
# SPDX-License-Identifier: Apache-2.0
#
FROM node:9.2
FROM node:8.11
MAINTAINER haitao yue "hightall@me.com"
COPY package.json /
RUN cd / && npm config set registry 'https://registry.npm.taobao.org' && npm install --loglevel http
ENV PATH ${PATH}:/node_modules/.bin
COPY dashboard/package.json /
RUN cd / && npm install
CMD bash -c "ln -sf /node_modules /var/www/dashboard/node_modules && cd /var/www/dashboard && npm run build && rm -rf node_modules"
15 changes: 15 additions & 0 deletions src/themes/react/static/dashboard/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
SPDX-License-Identifier: Apache-2.0
*/
module.exports = {
plugins: [
[
'babel-plugin-module-resolver',
{
alias: {
components: './src/components',
},
},
],
],
};
71 changes: 71 additions & 0 deletions src/themes/react/static/dashboard/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"parser": "babel-eslint",
"extends": ["airbnb", "prettier"],
"env": {
"browser": true,
"node": true,
"es6": true,
"mocha": true,
"jest": true,
"jasmine": true
},
"rules": {
"generator-star-spacing": [0],
"consistent-return": [0],
"react/forbid-prop-types": [0],
"react/jsx-filename-extension": [1, { "extensions": [".js"] }],
"global-require": [1],
"import/prefer-default-export": [0],
"react/jsx-no-bind": [0],
"react/prop-types": [0],
"react/prefer-stateless-function": [0],
"react/jsx-wrap-multilines": [
"error",
{
"declaration": "parens-new-line",
"assignment": "parens-new-line",
"return": "parens-new-line",
"arrow": "parens-new-line",
"condition": "parens-new-line",
"logical": "parens-new-line",
"prop": "ignore"
}
],
"no-else-return": [0],
"no-restricted-syntax": [0],
"import/no-extraneous-dependencies": [0],
"no-use-before-define": [0],
"jsx-a11y/no-static-element-interactions": [0],
"jsx-a11y/no-noninteractive-element-interactions": [0],
"jsx-a11y/click-events-have-key-events": [0],
"jsx-a11y/anchor-is-valid": [0],
"no-nested-ternary": [0],
"arrow-body-style": [0],
"import/extensions": [0],
"no-bitwise": [0],
"no-cond-assign": [0],
"import/no-unresolved": [0],
"comma-dangle": [
"error",
{
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "ignore"
}
],
"object-curly-newline": [0],
"function-paren-newline": [0],
"no-restricted-globals": [0],
"require-yield": [1]
},
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
},
"settings": {
"polyfills": ["fetch", "promises"]
}
}
3 changes: 3 additions & 0 deletions src/themes/react/static/dashboard/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/*.md
**/*.svg
package.json
11 changes: 11 additions & 0 deletions src/themes/react/static/dashboard/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 100,
"overrides": [
{
"files": ".prettierrc",
"options": { "parser": "json" }
}
]
}
27 changes: 27 additions & 0 deletions src/themes/react/static/dashboard/.stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"extends": ["stylelint-config-standard", "stylelint-config-prettier"],
"rules": {
"selector-pseudo-class-no-unknown": null,
"shorthand-property-no-redundant-values": null,
"at-rule-empty-line-before": null,
"at-rule-name-space-after": null,
"comment-empty-line-before": null,
"declaration-bang-space-before": null,
"declaration-empty-line-before": null,
"function-comma-newline-after": null,
"function-name-case": null,
"function-parentheses-newline-inside": null,
"function-max-empty-lines": null,
"function-whitespace-after": null,
"number-leading-zero": null,
"number-no-trailing-zeros": null,
"rule-empty-line-before": null,
"selector-combinator-space-after": null,
"selector-descendant-combinator-no-non-space": null,
"selector-list-comma-newline-after": null,
"selector-pseudo-element-colon-notation": null,
"unit-no-unknown": null,
"no-descending-specificity": null,
"value-list-max-empty-lines": null
}
}
25 changes: 25 additions & 0 deletions src/themes/react/static/dashboard/.webpackrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
SPDX-License-Identifier: Apache-2.0
*/
const path = require('path');

export default {
entry: 'src/index.js',
extraBabelPlugins: [
'transform-decorators-legacy',
['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }],
],
env: {
development: {
extraBabelPlugins: ['dva-hmr'],
},
},
alias: {
components: path.resolve(__dirname, 'src/components/'),
},
ignoreMomentLocale: true,
theme: './src/theme.js',
outputPath: '/var/www/dist/',
publicPath: '/static/dist/',
hash: false,
};
97 changes: 97 additions & 0 deletions src/themes/react/static/dashboard/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"name": "cello-operator",
"version": "0.8.0",
"description": "Cello operator dashboard ui",
"private": true,
"scripts": {
"precommit": "npm run lint-staged",
"start": "cross-env ESLINT=none roadhog dev",
"start:no-proxy": "cross-env NO_PROXY=true ESLINT=none roadhog dev",
"build": "cross-env ESLINT=none COMPRESS=none roadhog build --watch",
"site": "roadhog-api-doc static && gh-pages -d dist",
"analyze": "cross-env ANALYZE=true roadhog build",
"lint:style": "stylelint \"src/**/*.less\" --syntax less",
"lint": "eslint --ext .js src mock tests && npm run lint:style",
"lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style",
"lint-staged": "lint-staged",
"lint-staged:js": "eslint --ext .js",
"test": "roadhog test",
"test:component": "roadhog test ./src/components",
"test:all": "node ./tests/run-tests.js",
"prettier": "prettier --write ./src/**/**/**/*"
},
"dependencies": {
"@antv/data-set": "^0.8.0",
"@babel/polyfill": "^7.0.0-beta.36",
"antd": "^3.3.0",
"babel-runtime": "^6.9.2",
"bizcharts": "^3.1.3-beta.1",
"bizcharts-plugin-slider": "^2.0.1",
"classnames": "^2.2.5",
"dva": "^2.1.0",
"dva-loading": "^1.0.4",
"enquire-js": "^0.1.1",
"lodash": "^4.17.4",
"lodash-decorators": "^4.4.1",
"moment": "^2.19.1",
"numeral": "^2.0.6",
"omit.js": "^1.0.0",
"path-to-regexp": "^2.1.0",
"prop-types": "^15.5.10",
"qs": "^6.5.0",
"rc-drawer-menu": "^0.5.0",
"react": "^16.2.0",
"react-container-query": "^0.9.1",
"react-document-title": "^2.0.3",
"react-dom": "^16.2.0",
"react-fittext": "^1.0.0",
"react-intl": "^2.4.0",
"url-polyfill": "^1.0.10"
},
"devDependencies": {
"babel-eslint": "^8.1.2",
"babel-plugin-dva-hmr": "^0.4.1",
"babel-plugin-import": "^1.6.7",
"babel-plugin-module-resolver": "^3.1.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"cross-env": "^5.1.1",
"cross-port-killer": "^1.0.1",
"enzyme": "^3.1.0",
"eslint": "^4.14.0",
"eslint-config-airbnb": "^16.0.0",
"eslint-plugin-babel": "^4.0.0",
"eslint-plugin-compat": "^2.1.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-markdown": "^1.0.0-beta.6",
"eslint-plugin-react": "^7.0.1",
"eslint-config-prettier": "^2.9.0",
"lint-staged": "^6.0.0",
"mockjs": "^1.0.1-beta3",
"prettier": "1.11.1",
"pro-download": "^1.0.1",
"redbox-react": "^1.5.0",
"regenerator-runtime": "^0.11.1",
"roadhog": "^2.3.0",
"roadhog-api-doc": "^0.3.4",
"stylelint": "^8.4.0",
"stylelint-config-prettier": "^3.0.4",
"stylelint-config-standard": "^18.0.0"
},
"lint-staged": {
"**/*.{js,jsx,less}": [
"prettier --wirter",
"git add"
],
"**/*.{js,jsx}": "lint-staged:js",
"**/*.less": "stylelint --syntax less"
},
"engines": {
"node": ">=8.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 10"
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/themes/react/static/dashboard/src/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 30e0264

Please sign in to comment.