Bläddra i källkod

[CHORE] Cleanup based on SonarCloud report (#306)

* [CHORE] FIx security risk. Use FonAwesome package

* [CHORE] Cleanup

* [CHORE] Remove unused file
Oleg Shur 4 år sedan
förälder
incheckning
7672f5e4cd

+ 0 - 100
docker/message.json

@@ -1,100 +0,0 @@
-{"message":"hello1","destination":"kafka2"}
-{"message":"hello2","destination":"kafka2"}
-{"message":"hello3","destination":"kafka2"}
-{"message":"hello4","destination":"kafka2"}
-{"message":"hello5","destination":"kafka2"}
-{"message":"hello6","destination":"kafka2"}
-{"message":"hello7","destination":"kafka2"}
-{"message":"hello8","destination":"kafka2"}
-{"message":"hello9","destination":"kafka2"}
-{"message":"hello10","destination":"kafka2"}
-{"message":"hello11","destination":"kafka2"}
-{"message":"hello12","destination":"kafka2"}
-{"message":"hello13","destination":"kafka2"}
-{"message":"hello14","destination":"kafka2"}
-{"message":"hello15","destination":"kafka2"}
-{"message":"hello16","destination":"kafka2"}
-{"message":"hello17","destination":"kafka2"}
-{"message":"hello18","destination":"kafka2"}
-{"message":"hello19","destination":"kafka2"}
-{"message":"hello20","destination":"kafka2"}
-{"message":"hello21","destination":"kafka2"}
-{"message":"hello22","destination":"kafka2"}
-{"message":"hello23","destination":"kafka2"}
-{"message":"hello24","destination":"kafka2"}
-{"message":"hello25","destination":"kafka2"}
-{"message":"hello26","destination":"kafka2"}
-{"message":"hello27","destination":"kafka2"}
-{"message":"hello28","destination":"kafka2"}
-{"message":"hello29","destination":"kafka2"}
-{"message":"hello30","destination":"kafka2"}
-{"message":"hello31","destination":"kafka2"}
-{"message":"hello32","destination":"kafka2"}
-{"message":"hello33","destination":"kafka2"}
-{"message":"hello34","destination":"kafka2"}
-{"message":"hello35","destination":"kafka2"}
-{"message":"hello36","destination":"kafka2"}
-{"message":"hello37","destination":"kafka2"}
-{"message":"hello38","destination":"kafka2"}
-{"message":"hello39","destination":"kafka2"}
-{"message":"hello40","destination":"kafka2"}
-{"message":"hello41","destination":"kafka2"}
-{"message":"hello42","destination":"kafka2"}
-{"message":"hello43","destination":"kafka2"}
-{"message":"hello44","destination":"kafka2"}
-{"message":"hello45","destination":"kafka2"}
-{"message":"hello46","destination":"kafka2"}
-{"message":"hello47","destination":"kafka2"}
-{"message":"hello48","destination":"kafka2"}
-{"message":"hello49","destination":"kafka2"}
-{"message":"hello50","destination":"kafka2"}
-{"message":"hello51","destination":"kafka2"}
-{"message":"hello52","destination":"kafka2"}
-{"message":"hello53","destination":"kafka2"}
-{"message":"hello54","destination":"kafka2"}
-{"message":"hello55","destination":"kafka2"}
-{"message":"hello56","destination":"kafka2"}
-{"message":"hello57","destination":"kafka2"}
-{"message":"hello58","destination":"kafka2"}
-{"message":"hello59","destination":"kafka2"}
-{"message":"hello60","destination":"kafka2"}
-{"message":"hello61","destination":"kafka2"}
-{"message":"hello62","destination":"kafka2"}
-{"message":"hello63","destination":"kafka2"}
-{"message":"hello64","destination":"kafka2"}
-{"message":"hello65","destination":"kafka2"}
-{"message":"hello66","destination":"kafka2"}
-{"message":"hello67","destination":"kafka2"}
-{"message":"hello68","destination":"kafka2"}
-{"message":"hello69","destination":"kafka2"}
-{"message":"hello70","destination":"kafka2"}
-{"message":"hello71","destination":"kafka2"}
-{"message":"hello72","destination":"kafka2"}
-{"message":"hello73","destination":"kafka2"}
-{"message":"hello74","destination":"kafka2"}
-{"message":"hello75","destination":"kafka2"}
-{"message":"hello76","destination":"kafka2"}
-{"message":"hello77","destination":"kafka2"}
-{"message":"hello78","destination":"kafka2"}
-{"message":"hello79","destination":"kafka2"}
-{"message":"hello80","destination":"kafka2"}
-{"message":"hello81","destination":"kafka2"}
-{"message":"hello82","destination":"kafka2"}
-{"message":"hello83","destination":"kafka2"}
-{"message":"hello84","destination":"kafka2"}
-{"message":"hello85","destination":"kafka2"}
-{"message":"hello86","destination":"kafka2"}
-{"message":"hello87","destination":"kafka2"}
-{"message":"hello88","destination":"kafka2"}
-{"message":"hello89","destination":"kafka2"}
-{"message":"hello90","destination":"kafka2"}
-{"message":"hello91","destination":"kafka2"}
-{"message":"hello92","destination":"kafka2"}
-{"message":"hello93","destination":"kafka2"}
-{"message":"hello94","destination":"kafka2"}
-{"message":"hello95","destination":"kafka2"}
-{"message":"hello96","destination":"kafka2"}
-{"message":"hello97","destination":"kafka2"}
-{"message":"hello98","destination":"kafka2"}
-{"message":"hello99","destination":"kafka2"}
-{"message":"hello100","destination":"kafka2"}

+ 5 - 0
kafka-ui-react-app/package-lock.json

@@ -3047,6 +3047,11 @@
         }
       }
     },
+    "@fortawesome/fontawesome-free": {
+      "version": "5.15.3",
+      "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.15.3.tgz",
+      "integrity": "sha512-rFnSUN/QOtnOAgqFRooTA3H57JLDm0QEG/jPdk+tLQNL/eWd+Aok8g3qCI+Q1xuDPWpGW/i9JySpJVsq8Q0s9w=="
+    },
     "@hapi/address": {
       "version": "2.1.4",
       "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz",

+ 1 - 1
kafka-ui-react-app/package.json

@@ -3,6 +3,7 @@
   "version": "0.1.0",
   "private": true,
   "dependencies": {
+    "@fortawesome/fontawesome-free": "^5.15.3",
     "@hookform/error-message": "0.0.5",
     "@rooks/use-outside-click-ref": "^4.10.0",
     "bulma": "^0.9.2",
@@ -33,7 +34,6 @@
   "lint-staged": {
     "*.{js,ts,jsx,tsx}": [
       "eslint -c .eslintrc.json --fix",
-      "git add",
       "npm test -- --bail --findRelatedTests --watchAll=false"
     ]
   },

+ 0 - 1
kafka-ui-react-app/public/index.html

@@ -6,7 +6,6 @@
     <meta name="viewport" content="width=device-width, initial-scale=1" />
     <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
     <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
-    <script defer src="https://use.fontawesome.com/releases/v5.12.0/js/all.js"></script>
     <title>Kafka UI</title>
   </head>
   <body>

+ 2 - 2
kafka-ui-react-app/src/redux/reducers/schemas/reducer.ts

@@ -39,8 +39,8 @@ const addToSchemaList = (
   const newState: SchemasState = {
     ...state,
   };
-  newState.allNames.push(payload.subject as string);
-  newState.byName[payload.subject as string] = { ...payload };
+  newState.allNames.push(payload.subject);
+  newState.byName[payload.subject] = { ...payload };
   return newState;
 };
 

+ 2 - 2
kafka-ui-react-app/src/redux/reducers/schemas/selectors.ts

@@ -1,6 +1,7 @@
 import { createSelector } from 'reselect';
 import { RootState, SchemasState } from 'redux/interfaces';
 import { createFetchingSelector } from 'redux/reducers/loader/selectors';
+import { sortBy } from 'lodash';
 
 const schemasState = ({ schemas }: RootState): SchemasState => schemas;
 
@@ -55,6 +56,5 @@ export const getSchema = createSelector(
 
 export const getSortedSchemaVersions = createSelector(
   schemasState,
-  ({ currentSchemaVersions }) =>
-    currentSchemaVersions.sort((a, b) => a.id - b.id)
+  ({ currentSchemaVersions }) => sortBy(currentSchemaVersions, ['id'])
 );

+ 1 - 6
kafka-ui-react-app/src/redux/store/configureStore/dev.ts

@@ -12,13 +12,8 @@ declare global {
 
 export default () => {
   const middlewares = [thunk as ThunkMiddleware<RootState, Action>];
-
   const composeEnhancers =
     window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
-
   const enhancer = composeEnhancers(applyMiddleware(...middlewares));
-
-  const store = createStore(rootReducer, undefined, enhancer);
-
-  return store;
+  return createStore(rootReducer, undefined, enhancer);
 };

+ 1 - 5
kafka-ui-react-app/src/redux/store/configureStore/prod.ts

@@ -4,10 +4,6 @@ import rootReducer from 'redux/reducers';
 
 export default () => {
   const middlewares = [thunk];
-
   const enhancer = applyMiddleware(...middlewares);
-
-  const store = createStore(rootReducer, undefined, enhancer);
-
-  return store;
+  return createStore(rootReducer, undefined, enhancer);
 };

+ 1 - 0
kafka-ui-react-app/src/theme/index.scss

@@ -1,3 +1,4 @@
+@import '@fortawesome/fontawesome-free/css/all.min.css';
 @import 'bulma';
 @import '~bulma-switch';
 @import 'src/theme/bulma_overrides';