Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions ui_src/src/components/filter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const Filter = ({ filterComponent, height, applyFilter }) => {

useEffect(() => {
handleFilter();
}, [searchInput, filterTerms, state?.domainList]);
}, [searchInput, filterTerms, state?.stationList, state?.schemaList]);

const getFilterDetails = async () => {
try {
Expand Down Expand Up @@ -92,7 +92,7 @@ const Filter = ({ filterComponent, height, applyFilter }) => {
for await (const msg of sub) {
let data = jc.decode(msg.data);
data?.sort((a, b) => new Date(b.station.creation_date) - new Date(a.station.creation_date));
dispatch({ type: 'SET_DOMAIN_LIST', payload: data });
dispatch({ type: 'SET_STATION_LIST', payload: data });
}
})();
}
Expand All @@ -118,7 +118,7 @@ const Filter = ({ filterComponent, height, applyFilter }) => {
(async () => {
for await (const msg of sub) {
let data = jc.decode(msg.data);
dispatch({ type: 'SET_DOMAIN_LIST', payload: data });
dispatch({ type: 'SET_SCHEMA_LIST', payload: data });
}
})();
}
Expand Down Expand Up @@ -268,33 +268,35 @@ const Filter = ({ filterComponent, height, applyFilter }) => {
let objStorage = [];
let objType = '';
let objUsage = null;
let data = state?.domainList;

switch (filterComponent) {
case 'stations':
let stationData = state?.stationList;
if (filterTerms?.find((o) => o?.name === 'tags')) {
objTags = filterTerms?.find((o) => o?.name === 'tags')?.fields?.map((element) => element?.toLowerCase());
data = data?.filter((item) =>
stationData = stationData?.filter((item) =>
objTags?.length > 0 ? item.tags.some((tag) => objTags?.includes(tag?.name)) : !item.tags.some((tag) => objTags?.includes(tag?.name))
);
}
if (filterTerms?.find((o) => o?.name === 'created')) {
objCreated = filterTerms?.find((o) => o?.name === 'created')?.fields?.map((element) => element?.toLowerCase());
data = data?.filter((item) =>
stationData = stationData?.filter((item) =>
objCreated?.length > 0 ? objCreated?.includes(item.station.created_by_user) : !objCreated?.includes(item.station.created_by_user)
);
}
if (filterTerms?.find((o) => o?.name === 'storage')) {
objStorage = filterTerms?.find((o) => o?.name === 'storage')?.fields?.map((element) => element?.toLowerCase());
data = data.filter((item) =>
stationData = stationData.filter((item) =>
objStorage?.length > 0 ? objStorage?.includes(item.station.storage_type) : !objStorage?.includes(item.station.storage_type)
);
}
if (searchInput !== '' && searchInput?.length >= 2) {
data = data.filter((station) => station.station?.name.includes(searchInput));
stationData = stationData.filter((station) => station.station?.name.includes(searchInput));
}
dispatch({ type: 'SET_FILTERED_LIST', payload: data });
dispatch({ type: 'SET_STATION_FILTERED_LIST', payload: stationData });
return;
case 'schemaverse':
let data = state?.schemaList;
if (filterTerms?.find((o) => o?.name === 'tags')) {
objTags = filterTerms?.find((o) => o?.name === 'tags')?.fields?.map((element) => element?.toLowerCase());
data = data?.filter((item) =>
Expand All @@ -316,7 +318,7 @@ const Filter = ({ filterComponent, height, applyFilter }) => {
if (searchInput !== '' && searchInput?.length >= 2) {
data = data.filter((schema) => schema?.name.includes(searchInput));
}
dispatch({ type: 'SET_FILTERED_LIST', payload: data });
dispatch({ type: 'SET_SCHEMA_FILTERED_LIST', payload: data });
return;
default:
return;
Expand Down
22 changes: 11 additions & 11 deletions ui_src/src/domain/schema/components/schemaList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ function SchemaList({ createNew }) {
useEffect(() => {
getAllSchemas();
return () => {
dispatch({ type: 'SET_DOMAIN_LIST', payload: [] });
dispatch({ type: 'SET_FILTERED_LIST', payload: [] });
dispatch({ type: 'SET_SCHEMA_LIST', payload: [] });
dispatch({ type: 'SET_STATION_FILTERED_LIST', payload: [] });
};
}, []);

const getAllSchemas = async () => {
setisLoading(true);
try {
const data = await httpRequest('GET', ApiEndpoints.GET_ALL_SCHEMAS);
dispatch({ type: 'SET_DOMAIN_LIST', payload: data });
dispatch({ type: 'SET_FILTERED_LIST', payload: data });
dispatch({ type: 'SET_SCHEMA_LIST', payload: data });
dispatch({ type: 'SET_STATION_FILTERED_LIST', payload: data });
setTimeout(() => {
setisLoading(false);
}, 500);
Expand All @@ -64,7 +64,7 @@ function SchemaList({ createNew }) {

const onCheckedAll = (e) => {
setIsCheckAll(!isCheckAll);
setIsCheck(state.filteredList.map((li) => li.name));
setIsCheck(state.schemaFilteredList.map((li) => li.name));
if (isCheckAll) {
setIsCheck([]);
}
Expand All @@ -88,7 +88,7 @@ function SchemaList({ createNew }) {
schema_names: isCheck
});
if (data) {
dispatch({ type: 'SET_DOMAIN_LIST', payload: filterArray(state.filteredList, isCheck) });
dispatch({ type: 'SET_SCHEMA_LIST', payload: filterArray(state.schemaFilteredList, isCheck) });
setIsCheck([]);
setIsCheckAll(false);
}
Expand All @@ -108,7 +108,7 @@ function SchemaList({ createNew }) {
<div className="schema-container">
<div className="header-wraper">
<label className="main-header-h1">
Schemaverse <label className="length-list">{state.filteredList?.length > 0 && `(${state.filteredList?.length})`}</label>
Schemaverse <label className="length-list">{state.schemaFilteredList?.length > 0 && `(${state.schemaFilteredList?.length})`}</label>
</label>
<div className="action-section">
<Button
Expand Down Expand Up @@ -136,7 +136,7 @@ function SchemaList({ createNew }) {
fontWeight="600"
aria-haspopup="true"
boxShadowStyle="float"
disabled={state?.filteredList?.length === 0}
disabled={state?.schemaFilteredList?.length === 0}
onClick={() => onCheckedAll()}
/>
<Filter filterComponent="schemaverse" height="34px" />
Expand All @@ -162,10 +162,10 @@ function SchemaList({ createNew }) {
</div>
)}
{!isLoading &&
state.filteredList?.map((schema, index) => {
state.schemaFilteredList?.map((schema, index) => {
return <SchemaBox key={index} schema={schema} isCheck={isCheck.includes(schema.name)} handleCheckedClick={handleCheckedClick} />;
})}
{!isLoading && state.domainList?.length === 0 && (
{!isLoading && state.schemaList?.length === 0 && (
<div className="no-schema-to-display">
<img src={placeholderSchema} width="100" height="100" alt="placeholderSchema" />
<p className="title">No schemas found</p>
Expand All @@ -186,7 +186,7 @@ function SchemaList({ createNew }) {
/>
</div>
)}
{!isLoading && state.domainList?.length > 0 && state.filteredList?.length === 0 && (
{!isLoading && state.schemaList?.length > 0 && state.schemaFilteredList?.length === 0 && (
<div className="no-schema-to-display">
<img src={placeholderSchema} width="100" height="100" alt="placeholderSchema" />
<p className="title">No schemas found</p>
Expand Down
26 changes: 13 additions & 13 deletions ui_src/src/domain/stationsList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const StationsList = () => {
dispatch({ type: 'SET_ROUTE', payload: 'stations' });
getAllStations();
return () => {
dispatch({ type: 'SET_DOMAIN_LIST', payload: [] });
dispatch({ type: 'SET_FILTERED_LIST', payload: [] });
dispatch({ type: 'SET_STATION_LIST', payload: [] });
dispatch({ type: 'SET_SCHEMA_FILTERED_LIST', payload: [] });
};
}, []);

Expand All @@ -64,8 +64,8 @@ const StationsList = () => {
try {
const res = await httpRequest('GET', `${ApiEndpoints.GET_STATIONS}`);
res.stations.sort((a, b) => new Date(b.station.creation_date) - new Date(a.station.creation_date));
dispatch({ type: 'SET_DOMAIN_LIST', payload: res.stations });
dispatch({ type: 'SET_FILTERED_LIST', payload: res.stations });
dispatch({ type: 'SET_STATION_LIST', payload: res.stations });
dispatch({ type: 'SET_SCHEMA_FILTERED_LIST', payload: res.stations });
setTimeout(() => {
setisLoading(false);
}, 500);
Expand All @@ -76,14 +76,14 @@ const StationsList = () => {
};

const renderStationsOverview = () => {
if (state?.domainList?.length > 0) {
if (state.filteredList?.length === 0) {
if (state?.stationList?.length > 0) {
if (state.stationFilteredList?.length === 0) {
return <StationsInstructions header="No stations found" des="Please try to search again" image={stationsIcon} />;
}
if (state?.domainList?.length <= 2) {
if (state?.stationList?.length <= 2) {
return (
<div>
{state.filteredList?.map((station) => (
{state.stationFilteredList?.map((station) => (
<StationBoxOverview
key={station?.station?.id}
isCheck={isCheck.includes(station?.station?.name)}
Expand All @@ -97,7 +97,7 @@ const StationsList = () => {
}
return (
<Virtuoso
data={state?.filteredList}
data={state?.stationFilteredList}
overscan={100}
itemContent={(index, station) => (
<StationBoxOverview
Expand All @@ -115,7 +115,7 @@ const StationsList = () => {

const onCheckedAll = (e) => {
setIsCheckAll(!isCheckAll);
setIsCheck(state.filteredList.map((li) => li.station?.name));
setIsCheck(state.stationFilteredList.map((li) => li.station?.name));
if (isCheckAll) {
setIsCheck([]);
}
Expand All @@ -139,7 +139,7 @@ const StationsList = () => {
station_names: isCheck
});
if (data) {
dispatch({ type: 'SET_DOMAIN_LIST', payload: stationFilterArray(state?.filteredList, isCheck) });
dispatch({ type: 'SET_STATION_LIST', payload: stationFilterArray(state?.stationFilteredList, isCheck) });
setIsCheck([]);
setIsCheckAll(false);
setDeleteLoader(false);
Expand All @@ -155,7 +155,7 @@ const StationsList = () => {
<div className="stations-details-header">
<div className="header-wraper">
<label className="main-header-h1">
Stations <label className="length-list">{state?.filteredList?.length > 0 && `(${state?.filteredList?.length})`}</label>
Stations <label className="length-list">{state?.stationFilteredList?.length > 0 && `(${state?.stationFilteredList?.length})`}</label>
</label>
<div className="right-side">
<Button
Expand Down Expand Up @@ -183,7 +183,7 @@ const StationsList = () => {
fontWeight="600"
aria-haspopup="true"
boxShadowStyle="float"
disabled={state?.filteredList?.length === 0}
disabled={state?.stationFilteredList?.length === 0}
onClick={() => onCheckedAll()}
/>
<Filter filterComponent="stations" height="34px" />
Expand Down
6 changes: 3 additions & 3 deletions ui_src/src/domain/sysLogs/components/logContent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import './style.scss';
import React from 'react';

import LogBadge from '../../../../components/logBadge';
import { cutInfoLog, parsingDate } from '../../../../services/valueConvertor';
import { parsingDate } from '../../../../services/valueConvertor';
import Copy from '../../../../components/copy';

const LogContent = ({ displayedLog }) => {
Expand All @@ -43,9 +43,9 @@ const LogContent = ({ displayedLog }) => {
<div></div>
</log-payload>
<log-content is="3xd">
<p>{cutInfoLog(displayedLog?.data)}</p>
<p>{displayedLog?.data}</p>
<div className="copy-button">
<Copy data={cutInfoLog(displayedLog?.data)} />
<Copy data={displayedLog?.data} />
</div>
</log-content>
</div>
Expand Down
4 changes: 2 additions & 2 deletions ui_src/src/domain/sysLogs/components/logPayload/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ import './style.scss';

import React from 'react';

import { cutInfoLog, parsingDate } from '../../../../services/valueConvertor';
import { parsingDate } from '../../../../services/valueConvertor';
import sourceIcon from '../../../../assets/images/sourceIcon.svg';
import LogBadge from '../../../../components/logBadge';

const LogPayload = ({ value, onSelected, selectedRow }) => {
return (
<div className={selectedRow === value?.message_seq ? 'log-payload log-selected' : 'log-payload'} onClick={() => onSelected(value?.message_seq)}>
{selectedRow === value?.message_seq && <div className="selected"></div>}
<p className="title">{cutInfoLog(value?.data)}</p>
<p className="title">{value?.data}</p>
<p className="created-date">{parsingDate(value?.creation_date)}</p>
<div className="log-info">
<div className="source">
Expand Down
38 changes: 24 additions & 14 deletions ui_src/src/hooks/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

const Reducer = (state, action) => {
let index;
let updateDomainState = state?.domainList;
let updateSchemaListState = state?.schemaList;
let copyIntegration = state?.integrationsList;
switch (action.type) {
case 'SET_USER_DATA':
Expand Down Expand Up @@ -68,41 +68,51 @@ const Reducer = (state, action) => {
...state,
skipSignup: action.payload
};
case 'SET_DOMAIN_LIST':
case 'SET_STATION_LIST':
return {
...state,
domainList: action.payload
stationList: action.payload
};
case 'SET_FILTERED_LIST':
case 'SET_STATION_FILTERED_LIST':
return {
...state,
filteredList: action.payload
stationFilteredList: action.payload
};
case 'SET_SCHEMA_LIST':
return {
...state,
schemaList: action.payload
};
case 'SET_SCHEMA_FILTERED_LIST':
return {
...state,
schemaFilteredList: action.payload
};
case 'SET_FILTERED_OPTION':
return {
...state,
FilterOption: action.payload
};
case 'SET_SCHEMA_TAGS':
index = state?.domainList?.findIndex((schema) => schema.name === action.payload?.schemaName);
updateDomainState[index].tags = action.payload.tags;
index = state?.schemaList?.findIndex((schema) => schema.name === action.payload?.schemaName);
updateSchemaListState[index].tags = action.payload.tags;
return {
...state,
domainList: updateDomainState
schemaList: updateSchemaListState
};
case 'SET_IS_USED':
index = state?.domainList?.findIndex((schema) => schema.name === action.payload?.schemaName);
updateDomainState[index].used = true;
index = state?.schemaList?.findIndex((schema) => schema.name === action.payload?.schemaName);
updateSchemaListState[index].used = true;
return {
...state,
domainList: updateDomainState
schemaList: updateSchemaListState
};
case 'SET_UPDATE_SCHEMA':
index = state?.domainList?.findIndex((schema) => schema.name === action.payload?.schemaName);
updateDomainState[index] = action.payload.schemaDetails;
index = state?.schemaList?.findIndex((schema) => schema.name === action.payload?.schemaName);
updateSchemaListState[index] = action.payload.schemaDetails;
return {
...state,
domainList: updateDomainState
schemaList: updateSchemaListState
};
case 'SET_INTEGRATIONS':
return {
Expand Down
6 changes: 4 additions & 2 deletions ui_src/src/hooks/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ const initialState = {
analytics_modal: true,
socket: null,
skipSignup: false,
domainList: [],
filteredList: [],
stationList: [],
stationFilteredList: [],
schemaList: [],
schemaFilteredList: [],
logsFilter: '',
integrationsList: []
};
Expand Down
4 changes: 0 additions & 4 deletions ui_src/src/services/valueConvertor.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@ export const capitalizeFirst = (str) => {
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
};

export const cutInfoLog = (str) => {
return str?.split('] ')[2];
};

export const filterArray = (arr1, arr2) => {
const filtered = arr1.filter((el) => {
return arr2.indexOf(el.name) === -1;
Expand Down
4 changes: 2 additions & 2 deletions ui_static_files/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "/static/css/main.731e44cd.css",
"main.js": "/static/js/main.2250f7b9.js",
"main.js": "/static/js/main.eced6e31.js",
"static/js/617.a5f8c4fc.chunk.js": "/static/js/617.a5f8c4fc.chunk.js",
"static/js/2542.27de8743.chunk.js": "/static/js/2542.27de8743.chunk.js",
"static/js/1737.e134cfd4.chunk.js": "/static/js/1737.e134cfd4.chunk.js",
Expand Down Expand Up @@ -235,6 +235,6 @@
},
"entrypoints": [
"static/css/main.731e44cd.css",
"static/js/main.2250f7b9.js"
"static/js/main.eced6e31.js"
]
}
Loading