Skip to content

Commit

Permalink
Merge pull request #3 from chenz24/initial-project
Browse files Browse the repository at this point in the history
feat: initial project
  • Loading branch information
chenz24 authored Sep 28, 2022
2 parents 8937143 + ef9b61a commit 92b0496
Show file tree
Hide file tree
Showing 47 changed files with 11,720 additions and 1,933 deletions.
9 changes: 9 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dist/
build/
cypress/
jest/
scripts/
node_modules/
jest.config.js
babel.config.js
.eslintrc.js
85 changes: 85 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// http://eslint.org/docs/user-guide/configuring

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
project: ['./tsconfig.json'],
},
env: {
es6: true,
commonjs: true,
browser: true,
},
extends: ['airbnb-typescript', 'plugin:prettier/recommended', 'prettier/react'],
plugins: ['prettier', '@typescript-eslint', 'react', 'babel', 'promise', 'import'],
settings: {
'import/resolver': {
webpack: {
config: 'scripts/webpack.base.conf.js',
},
},
react: {
createClass: 'createReactClass',
pragma: 'React',
version: 'detect',
},
},
// add your custom rules here
rules: {
'object-curly-newline': 0,
'class-methods-use-this': 0,
// allow paren-less arrow functions
'arrow-parens': 'off',
'max-len': [
1,
{
code: 100,
ignoreComments: true,
ignorePattern: '^(\\s*[a-zA-Z_]+: \'[^\']+\'[,;]*)|(.*interpolate.*)|(.*require.*)|(.*_\\.template.*)|(<svg .*)|(<rect .*)|(<polygon .*)$',
ignoreRegExpLiterals: true,
ignoreTrailingComments: true,
ignoreUrls: true,
tabWidth: 2,
},
],
// 'dot-notation': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'no-mixed-operators': 0,
'no-param-reassign': 0,
'import/no-extraneous-dependencies': 0,
'react/forbid-prop-types': 0,
'react/prefer-stateless-function': 1,
'react/require-default-props': 0,
'react/no-find-dom-node': 0,
'react/no-did-mount-set-state': 0,
'react/static-property-placement': 0,
'react/jsx-filename-extension': 0,
'react/jsx-props-no-spreading': 0,
'react/prop-types': 0,
'react/destructuring-assignment': 0,
'jsx-a11y/click-events-have-key-events': 0,
'jsx-a11y/no-static-element-interactions': 0,
'jsx-a11y/label-has-associated-control': 0,
'jsx-a11y/no-noninteractive-element-interactions': 0,
// rules are broken and provide falsy mistakes
'jsx-a11y/label-has-for': 'off',
'jsx-a11y/anchor-is-valid': 'off',

camelcase: 0,
'no-console': 0,
'no-underscore-dangle': 0,
'consistent-return': 0,
},
globals: {
t: true,
globals: true,
},
};
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@

# Dependency directories (remove the comment below to include it)
# vendor/

.idea
node_modules
dist
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
yarn.lock
package-lock.json
30 changes: 30 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"arrowParens": "avoid",
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"semi": true,
"useTabs": false,
"parser": "typescript",
"jsxBracketSameLine": false,
"overrides": [
{
"files": "*.jsx?",
"options": { "parser": "babel" }
},
{
"files": "*.scss",
"options": { "parser": "scss" }
},
{
"files": "*.json",
"options": { "parser": "json" }
},
{
"files": "*.md",
"options": { "parser": "markdown" }
}
]
}
63 changes: 63 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Contributing to KubeEye Console

The following is a set of guidelines for contributing to KubeEye Console. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.

Table Of Contents

[Code of Conduct](#code-of-conduct)

[How Can I Contribute?](#how-can-i-contribute)
* [Reporting Bugs](#reporting-bugs)
* [Pull Requests](#pull-requests)

[Styleguides](#styleguides)
* [Git Commit Messages](#git-commit-messages)
* [JavaScript Styleguide](#javascript-styleguide)

## Code of Conduct
All members of the KubeSphere community must abide by [Code of Conduct](docs/code-of-conduct.md). Only by respecting each other can we develop a productive, collaborative community.

## How Can I Contribute?

### Reporting Bugs

This section guides you through submitting a bug report for KubeEye Console. Following these guidelines helps maintainers and the community understand your report, reproduce the behavior, and find related reports.

When you are creating a bug report, please fill out [the required template](https://github.com/kubesphere/kubeeye-console/blob/master/.github/ISSUE_TEMPLATE/bug_report.md), the information it asks for helps us resolve issues faster.

#### Before Submitting A Bug Report

* **Check the [FAQs on the docs](https://kubesphere.io/docs/v2.1/zh-CN/faq/faq-console/)** for a list of common questions and problems.
* **Check the [Forum](https://kubesphere.io/forum/)** to see if there is a way to resolve.
* **Perform a [cursory search](https://github.com/kubesphere/kubeeye-console/issues)** to see if the problem has already been reported. If it has **and the issue is still open**, add a comment to the existing issue instead of opening a new one.

### Pull Requests

The process described here has several goals:

- Maintain KubeEye Console's quality
- Fix problems that are important to users

Please follow these steps to have your contribution considered by the maintainers:

1. Follow all instructions in [the template](https://github.com/kubesphere/kubeeye-console/blob/master/.github/PULL_REQUEST_TEMPLATE.md)
2. Follow the [styleguides](#styleguides)
3. After you submit your pull request, verify that all [status checks](https://help.github.com/articles/about-status-checks/) are passing <details><summary>What if the status checks are failing?</summary>If a status check is failing, and you believe that the failure is unrelated to your change, please leave a comment on the pull request explaining why you believe the failure is unrelated. A maintainer will re-run the status check for you. If we conclude that the failure was a false positive, then we will open an issue to track that problem with our status check suite.</details>

While the prerequisites above must be satisfied prior to having your pull request reviewed, the reviewer(s) may ask you to complete additional design work, tests, or other changes before your pull request can be ultimately accepted.

## Styleguides

### Git Commit Messages

Follow the [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/).

### JavaScript Styleguide

Follow the [Airbnb Javascript Style Guide](https://github.com/airbnb/javascript#table-of-contents).

This project use Eslint to format code. Check the rules in [.eslintrc.js](../.eslintrc.js)

### CSS, SCSS Styleguide

Using Prettier to format css and scss files. Check the rules in [.prettierrc](../.prettierrc)
63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# KubeEye Console

[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/kubesphere/console)
![](https://github.com/kubesphere/console/workflows/Main/badge.svg)
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)

KubeEye console is the web interface for [KubeEye](https://github.com/kubesphere/kubeeye).


## Getting Started

Console should be always used with KubeEye, To install kubeeye, please refer to this [README](https://github.com/kubesphere/kubeeye)
The following will show you how to build console from source code.


### Prerequisite
#### Node.js
Console is written using Javascript. If you don't have a Node.js development environment, please [set it up](https://nodejs.org/en/download/). The minimum version required is 12.18.

#### Yarn
We use [Yarn](https://yarnpkg.com/) to do package management. If you don't have yarn, use the following to install:
```
npm install -g [email protected]
```
The minimum version required is 1.22.4, but you can use a newer version.

#### Go
We use [Golang](https://go.dev/) as the forwarding layer, If you don't have go environment, please [set it up](https://go.dev/doc/install).

## How to build

Clone the repository, and run `yarn && yarn build`
```sh
git clone https://github.com/kubesphere/kubeeye-console.git
cd kubeeye-console/
yarn && yarn build
go build web.go
./web
```
> If you have trouble downloading the dependencies, try the following
>
> `yarn config set registry https://registry.npmmirror.com`

After `./web`, you should see the output like the following

```
> I0424 16:10:52.142951 332 web.go:122] Start listening on 9088
```
Now, console is up and running.

## How to debug
A KubeEye backend is required to start debugging. You can refer to [Installation](https://github.com/kubesphere/kubeeye) to create install KubeEye.

Once the kubeeye is up, you run `yarn dev` to start the development environment.

## How to submit a PR

Follow [Development Workflow](/docs/development-workflow.md) to commit your codes.

## Contributing to the project

Welcome to contribute to KubeEye Console, see [Contributing Guide](CONTRIBUTING.md).
68 changes: 68 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
modules: false,
},
],
'@babel/preset-react',
],
plugins: [
'@babel/plugin-transform-runtime',
'lodash',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-syntax-import-meta',
['@babel/plugin-proposal-decorators', { legacy: true }],
['@babel/plugin-proposal-class-properties', { loose: true }],
['@babel/plugin-proposal-private-methods', { loose: true }],
['@babel/plugin-proposal-private-property-in-object', { loose: true }],
'@babel/plugin-proposal-json-strings',
'@babel/plugin-proposal-function-sent',
'@babel/plugin-proposal-export-namespace-from',
'@babel/plugin-proposal-numeric-separator',
'@babel/plugin-proposal-throw-expressions',
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-proposal-logical-assignment-operators',
'@babel/plugin-proposal-optional-chaining',
[
'@babel/plugin-proposal-pipeline-operator',
{
proposal: 'minimal',
},
],
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-do-expressions',
'babel-plugin-styled-components',
],
env: {
production: {
plugins: [
[
'transform-react-remove-prop-types',
{
removeImport: true,
ignoreFilenames: ['node_modules'],
},
],
],
},
publish: {
presets: [
[
'@babel/preset-env',
{
targets: {
browsers: ['> 1%', 'last 2 versions', 'not ie <= 8'],
},
},
],
'@babel/preset-react',
],
plugins: ['@babel/plugin-proposal-object-rest-spread'],
},
test: {
presets: ['@babel/preset-env', '@babel/preset-react'],
},
},
};
3 changes: 3 additions & 0 deletions docs/code-of-conduct.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# KubeSphere Code of Conduct

Please refer to [KubeSphere Code of Conduct](https://github.com/kubesphere/kubesphere/blob/master/docs/code-of-conduct.md)
Loading

0 comments on commit 92b0496

Please sign in to comment.