2021-08-17 06:01:12 +00:00
|
|
|
import '@/_styles/left-sidebar.scss';
|
2023-06-15 07:28:44 +00:00
|
|
|
import React, { useState, useImperativeHandle, forwardRef, useEffect, useRef } from 'react';
|
|
|
|
|
import _ from 'lodash';
|
2021-11-10 08:43:22 +00:00
|
|
|
import { LeftSidebarInspector } from './SidebarInspector';
|
|
|
|
|
import { LeftSidebarDataSources } from './SidebarDatasources';
|
2021-08-17 06:01:12 +00:00
|
|
|
import { DarkModeToggle } from '../../_components/DarkModeToggle';
|
|
|
|
|
import useRouter from '../../_hooks/use-router';
|
2021-08-27 06:35:53 +00:00
|
|
|
import { LeftSidebarDebugger } from './SidebarDebugger';
|
Feature: Collaboration ( realtime comments for canvas ) 🔥 (#810)
* feat: initial commit for collaboration feature
* add dnd to comments
* add positions endpoint
* feat: encapsulate all http common logic in http-client
* segregate sections and transfer responsibility of state
* feat: use-spring to add fade effect :zap:
* fix: open in right
* fix: left-right position css
* add footer for message
* integrate getcomment endpoint
* use fromnow for date ago
* add dnd
* - Add data trasfer object for comment
- Add class-validator package to check the response type from client
- Add comment repository class for persistance layer
- Add comment service with std. http methods
- Update controller with all http methods
- Update comment module
- Fix http-client bug when error is thrown
* fix http client bug when error is thrown
* feat: add entity thread
* feat: add migrations for thread and comment
* update entitites
* add tid to migration
* filter comments by tid(thread_id)
* fix: comment migration, add missing column comment
* feat: integrate in ui
* feat: split comments based on app_id
* fix: dnd to correct position
* package json engines
* engines update
* update npm
* npm 6 to 7
* fix: add user initials to thread
* fix: add firtname lastname to the comments
* - Return user object when save thread called
- Hide password field from user response
- Fix created_at date typo
- Instead of fetch all threads on new thread added, add the response to array of existing threads
* feat: update ui components
* change icon on comments view
* ui fixes
* fix: close icon close the popover
* temp: comment select: false
* use currentUser from localStorage
* fix: on click outside if comment is open, dont hit addThread
* fix: auth token issue in http-client
* on drag hide the comment if open
* add jwt auth
* spec: add test for comment & thread
* cleanup: remove console.log
* feat: add comment actions
* feat: add edit, delete, resolve options
* feat: add mentions component
* feat: add nestjs websockets
* temp
* websocket: establish client-server communication
* ws: add message listner to comments module in ui
* feat: add broadcast method to broadcast new events to all clients :bomb:
* ws: cleanup :call_me_hand:
* fix: remove max height from comment actions
* feat: add user mentions, emoji support
* fix: add static list of users - temp
* update and delete iterations
* - Rename comment, thread to comments, threads
- Add conditional actions
- Show edit, delete only if he is comment owner
- Show resolve only if he is thread owner
* reset engines
* move svgr webpack to deps
* fix: ui issues
* remove log stmt
* refactor: move resolved icon to comment-header
* feat: allow comments to be added on top of widgets
* feat: add keyboard shortcut
* scroll to bottom on comment add
* ui fixes
* feat: add react toast for notification display
* feat: add comment badge
* fix: ws connection
* fix: ws
* remove rvrse
* feat: add comment sidebar
* feat: add comment right sidebar
* fix: add missing foreign key elements
* - upgrade typeorm to 0.2.38
- comment sidebar ui
- added filter ui
* feat: on click of right sidebar notificaiton open the comment box
* reset engines
* fix: add organization id to the comment and thread module
* fix: add current version id
* add currentversion id
* disable comments if no id present
* temp:checking for heroku deploy
* fetch app on edit and deploy version
* rename current_version_id to app_versions_id
* ui fixes
* show mentioned user in blue color
* add ui changes
* add authorization for create thread
* change color to blue on click of comment, add auth for other endpoints of thread
* update threads, notifications using socket
* add auth for comments
* remove events spec file
* fix duplicate key error
* fix notificaitons updation on edit, delete, resolve buttons clicked
* update notifications for edit
* feature toggle changes for frontend
* add check for comments server
* add emoji mart package for emoji
* add reply count in comment sidebar
* subtract 1 from count in comment sidebar
* change empty text when no comments available
2021-11-01 07:28:03 +00:00
|
|
|
import { LeftSidebarComment } from './SidebarComment';
|
2022-12-08 12:21:09 +00:00
|
|
|
import LeftSidebarPageSelector from './SidebarPageSelector';
|
2021-10-13 04:02:18 +00:00
|
|
|
import { ConfirmDialog } from '@/_components';
|
Feature: Collaboration ( realtime comments for canvas ) 🔥 (#810)
* feat: initial commit for collaboration feature
* add dnd to comments
* add positions endpoint
* feat: encapsulate all http common logic in http-client
* segregate sections and transfer responsibility of state
* feat: use-spring to add fade effect :zap:
* fix: open in right
* fix: left-right position css
* add footer for message
* integrate getcomment endpoint
* use fromnow for date ago
* add dnd
* - Add data trasfer object for comment
- Add class-validator package to check the response type from client
- Add comment repository class for persistance layer
- Add comment service with std. http methods
- Update controller with all http methods
- Update comment module
- Fix http-client bug when error is thrown
* fix http client bug when error is thrown
* feat: add entity thread
* feat: add migrations for thread and comment
* update entitites
* add tid to migration
* filter comments by tid(thread_id)
* fix: comment migration, add missing column comment
* feat: integrate in ui
* feat: split comments based on app_id
* fix: dnd to correct position
* package json engines
* engines update
* update npm
* npm 6 to 7
* fix: add user initials to thread
* fix: add firtname lastname to the comments
* - Return user object when save thread called
- Hide password field from user response
- Fix created_at date typo
- Instead of fetch all threads on new thread added, add the response to array of existing threads
* feat: update ui components
* change icon on comments view
* ui fixes
* fix: close icon close the popover
* temp: comment select: false
* use currentUser from localStorage
* fix: on click outside if comment is open, dont hit addThread
* fix: auth token issue in http-client
* on drag hide the comment if open
* add jwt auth
* spec: add test for comment & thread
* cleanup: remove console.log
* feat: add comment actions
* feat: add edit, delete, resolve options
* feat: add mentions component
* feat: add nestjs websockets
* temp
* websocket: establish client-server communication
* ws: add message listner to comments module in ui
* feat: add broadcast method to broadcast new events to all clients :bomb:
* ws: cleanup :call_me_hand:
* fix: remove max height from comment actions
* feat: add user mentions, emoji support
* fix: add static list of users - temp
* update and delete iterations
* - Rename comment, thread to comments, threads
- Add conditional actions
- Show edit, delete only if he is comment owner
- Show resolve only if he is thread owner
* reset engines
* move svgr webpack to deps
* fix: ui issues
* remove log stmt
* refactor: move resolved icon to comment-header
* feat: allow comments to be added on top of widgets
* feat: add keyboard shortcut
* scroll to bottom on comment add
* ui fixes
* feat: add react toast for notification display
* feat: add comment badge
* fix: ws connection
* fix: ws
* remove rvrse
* feat: add comment sidebar
* feat: add comment right sidebar
* fix: add missing foreign key elements
* - upgrade typeorm to 0.2.38
- comment sidebar ui
- added filter ui
* feat: on click of right sidebar notificaiton open the comment box
* reset engines
* fix: add organization id to the comment and thread module
* fix: add current version id
* add currentversion id
* disable comments if no id present
* temp:checking for heroku deploy
* fetch app on edit and deploy version
* rename current_version_id to app_versions_id
* ui fixes
* show mentioned user in blue color
* add ui changes
* add authorization for create thread
* change color to blue on click of comment, add auth for other endpoints of thread
* update threads, notifications using socket
* add auth for comments
* remove events spec file
* fix duplicate key error
* fix notificaitons updation on edit, delete, resolve buttons clicked
* update notifications for edit
* feature toggle changes for frontend
* add check for comments server
* add emoji mart package for emoji
* add reply count in comment sidebar
* subtract 1 from count in comment sidebar
* change empty text when no comments available
2021-11-01 07:28:03 +00:00
|
|
|
import config from 'config';
|
2023-06-15 07:28:44 +00:00
|
|
|
import { LeftSidebarItem } from './SidebarItem';
|
|
|
|
|
import Popover from '@/_ui/Popover';
|
2023-05-10 10:14:38 +00:00
|
|
|
import { usePanelHeight } from '@/_stores/queryPanelStore';
|
2023-06-29 10:00:10 +00:00
|
|
|
import { useAppVersionStore } from '@/_stores/appVersionStore';
|
2023-07-18 07:41:31 +00:00
|
|
|
import { useEditorStore } from '@/_stores/editorStore';
|
2023-06-20 05:38:56 +00:00
|
|
|
import { useDataSources } from '@/_stores/dataSourcesStore';
|
2023-06-29 10:00:10 +00:00
|
|
|
import { shallow } from 'zustand/shallow';
|
2021-08-17 06:01:12 +00:00
|
|
|
|
2022-06-15 10:46:51 +00:00
|
|
|
export const LeftSidebar = forwardRef((props, ref) => {
|
2021-09-12 04:24:47 +00:00
|
|
|
const router = useRouter();
|
2022-06-15 10:46:51 +00:00
|
|
|
const {
|
|
|
|
|
appId,
|
|
|
|
|
switchDarkMode,
|
|
|
|
|
darkMode = false,
|
|
|
|
|
components,
|
|
|
|
|
dataSourcesChanged,
|
2023-03-24 16:11:21 +00:00
|
|
|
globalDataSourcesChanged,
|
2022-06-15 10:46:51 +00:00
|
|
|
dataQueriesChanged,
|
2023-06-15 07:28:44 +00:00
|
|
|
errorLogs: errors,
|
2022-07-19 13:21:45 +00:00
|
|
|
debuggerActions,
|
2022-06-15 10:46:51 +00:00
|
|
|
currentState,
|
|
|
|
|
appDefinition,
|
|
|
|
|
setSelectedComponent,
|
|
|
|
|
removeComponent,
|
|
|
|
|
runQuery,
|
2022-12-08 12:21:09 +00:00
|
|
|
currentPageId,
|
|
|
|
|
addNewPage,
|
|
|
|
|
switchPage,
|
|
|
|
|
deletePage,
|
|
|
|
|
renamePage,
|
|
|
|
|
hidePage,
|
|
|
|
|
unHidePage,
|
|
|
|
|
updateHomePage,
|
|
|
|
|
updatePageHandle,
|
|
|
|
|
showHideViewerNavigationControls,
|
|
|
|
|
updateOnSortingPages,
|
|
|
|
|
updateOnPageLoadEvents,
|
|
|
|
|
apps,
|
|
|
|
|
clonePage,
|
2023-06-15 07:28:44 +00:00
|
|
|
setEditorMarginLeft,
|
2022-06-15 10:46:51 +00:00
|
|
|
} = props;
|
2023-06-20 05:38:56 +00:00
|
|
|
|
|
|
|
|
const dataSources = useDataSources();
|
|
|
|
|
const prevSelectedSidebarItem = localStorage.getItem('selectedSidebarItem');
|
2023-05-10 10:14:38 +00:00
|
|
|
const queryPanelHeight = usePanelHeight();
|
2023-06-20 05:38:56 +00:00
|
|
|
const [selectedSidebarItem, setSelectedSidebarItem] = useState(
|
|
|
|
|
dataSources?.length === 0 && prevSelectedSidebarItem === 'database' ? 'inspect' : prevSelectedSidebarItem
|
|
|
|
|
);
|
2021-10-13 04:02:18 +00:00
|
|
|
const [showLeaveDialog, setShowLeaveDialog] = useState(false);
|
2022-06-15 10:46:51 +00:00
|
|
|
const [showDataSourceManagerModal, toggleDataSourceManagerModal] = useState(false);
|
2023-01-05 09:17:24 +00:00
|
|
|
const [popoverContentHeight, setPopoverContentHeight] = useState(queryPanelHeight);
|
2023-06-29 10:00:10 +00:00
|
|
|
const { isVersionReleased } = useAppVersionStore(
|
|
|
|
|
(state) => ({
|
|
|
|
|
isVersionReleased: state.isVersionReleased,
|
|
|
|
|
}),
|
|
|
|
|
shallow
|
|
|
|
|
);
|
2023-07-18 07:41:31 +00:00
|
|
|
const { showComments } = useEditorStore(
|
|
|
|
|
(state) => ({
|
|
|
|
|
showComments: state?.showComments,
|
|
|
|
|
}),
|
|
|
|
|
shallow
|
|
|
|
|
);
|
2023-06-15 07:28:44 +00:00
|
|
|
const [pinned, setPinned] = useState(!!localStorage.getItem('selectedSidebarItem'));
|
|
|
|
|
const [errorLogs, setErrorLogs] = useState([]);
|
|
|
|
|
const [errorHistory, setErrorHistory] = useState({ appLevel: [], pageLevel: [] });
|
|
|
|
|
const [unReadErrorCount, setUnReadErrorCount] = useState({ read: 0, unread: 0 });
|
|
|
|
|
|
|
|
|
|
const sideBarBtnRefs = useRef({});
|
|
|
|
|
|
|
|
|
|
const open = !!selectedSidebarItem;
|
|
|
|
|
|
|
|
|
|
const clearErrorLogs = () => {
|
|
|
|
|
setUnReadErrorCount({ read: 0, unread: 0 });
|
|
|
|
|
|
|
|
|
|
setErrorLogs([]);
|
|
|
|
|
setErrorHistory({ appLevel: [], pageLevel: [] });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (currentPageId) {
|
|
|
|
|
const olderPageErrorFromHistory = errorHistory.pageLevel[currentPageId] ?? [];
|
|
|
|
|
const olderAppErrorFromHistory = errorHistory.appLevel ?? [];
|
|
|
|
|
setErrorLogs(() => [...olderPageErrorFromHistory, ...olderAppErrorFromHistory]);
|
|
|
|
|
}
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [currentPageId]);
|
|
|
|
|
|
2023-01-05 09:17:24 +00:00
|
|
|
useEffect(() => {
|
2023-06-15 07:28:44 +00:00
|
|
|
const newError = _.flow([
|
|
|
|
|
Object.entries,
|
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
|
|
(arr) => arr.filter(([key, value]) => value.data?.status),
|
|
|
|
|
Object.fromEntries,
|
|
|
|
|
])(errors);
|
|
|
|
|
|
|
|
|
|
const newErrorLogs = debuggerActions.generateErrorLogs(newError);
|
|
|
|
|
const newPageLevelErrorLogs = newErrorLogs.filter((error) => error.strace === 'page_level');
|
|
|
|
|
const newAppLevelErrorLogs = newErrorLogs.filter((error) => error.strace === 'app_level');
|
|
|
|
|
if (newErrorLogs) {
|
|
|
|
|
setErrorLogs((prevErrors) => {
|
|
|
|
|
const copy = JSON.parse(JSON.stringify(prevErrors));
|
|
|
|
|
|
|
|
|
|
return [...newAppLevelErrorLogs, ...newPageLevelErrorLogs, ...copy];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setErrorHistory((prevErrors) => {
|
|
|
|
|
const copy = JSON.parse(JSON.stringify(prevErrors));
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
appLevel: [...newAppLevelErrorLogs, ...copy.appLevel],
|
|
|
|
|
pageLevel: {
|
|
|
|
|
[currentPageId]: [...newPageLevelErrorLogs, ...(copy.pageLevel[currentPageId] ?? [])],
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
debuggerActions.flush();
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [JSON.stringify({ errors })]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (open) {
|
2023-06-20 05:38:56 +00:00
|
|
|
// eslint-disable-next-line no-unused-vars
|
2023-06-15 07:28:44 +00:00
|
|
|
setUnReadErrorCount((prev) => ({ read: errorLogs.length, unread: 0 }));
|
|
|
|
|
}
|
2023-06-20 05:38:56 +00:00
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2023-06-15 07:28:44 +00:00
|
|
|
}, [open]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const unReadErrors = errorLogs.length - unReadErrorCount.read;
|
|
|
|
|
setUnReadErrorCount((prev) => {
|
|
|
|
|
return { ...prev, unread: unReadErrors };
|
|
|
|
|
});
|
2023-06-20 05:38:56 +00:00
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2023-06-15 07:28:44 +00:00
|
|
|
}, [errorLogs.length]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setPopoverContentHeight(((window.innerHeight - queryPanelHeight - 45) / window.innerHeight) * 100);
|
2023-01-05 09:17:24 +00:00
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [queryPanelHeight]);
|
2022-06-15 10:46:51 +00:00
|
|
|
|
2023-06-15 07:28:44 +00:00
|
|
|
useEffect(() => {
|
|
|
|
|
if (!selectedSidebarItem) {
|
|
|
|
|
setEditorMarginLeft(0);
|
|
|
|
|
} else {
|
|
|
|
|
setEditorMarginLeft(350);
|
|
|
|
|
}
|
2023-06-20 05:38:56 +00:00
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2023-06-15 07:28:44 +00:00
|
|
|
}, [selectedSidebarItem]);
|
|
|
|
|
|
2022-06-15 10:46:51 +00:00
|
|
|
useImperativeHandle(ref, () => ({
|
|
|
|
|
dataSourceModalToggleStateHandler() {
|
|
|
|
|
toggleDataSourceManagerModal(true);
|
|
|
|
|
},
|
|
|
|
|
}));
|
2022-12-30 06:39:07 +00:00
|
|
|
|
2022-12-29 11:48:24 +00:00
|
|
|
const handleSelectedSidebarItem = (item) => {
|
2023-06-15 07:28:44 +00:00
|
|
|
if (item === selectedSidebarItem && !pinned) {
|
2022-12-29 11:48:24 +00:00
|
|
|
setSelectedSidebarItem(null);
|
|
|
|
|
} else {
|
|
|
|
|
setSelectedSidebarItem(item);
|
2023-06-15 07:28:44 +00:00
|
|
|
pinned && localStorage.setItem('selectedSidebarItem', item);
|
2022-12-29 11:48:24 +00:00
|
|
|
}
|
2022-12-30 06:39:07 +00:00
|
|
|
};
|
2022-12-29 11:48:24 +00:00
|
|
|
|
2023-06-15 07:28:44 +00:00
|
|
|
const handlePin = (isPin) => {
|
|
|
|
|
isPin
|
|
|
|
|
? localStorage.setItem('selectedSidebarItem', selectedSidebarItem)
|
|
|
|
|
: localStorage.removeItem('selectedSidebarItem');
|
|
|
|
|
|
|
|
|
|
setPinned(isPin);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleInteractOutside = (ev) => {
|
|
|
|
|
const isBtnClicked = Object.values(sideBarBtnRefs.current).some((btnRef) => {
|
|
|
|
|
return btnRef.contains(ev.target);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!isBtnClicked && !pinned) {
|
|
|
|
|
setSelectedSidebarItem(null);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const setSideBarBtnRefs = (page) => (ref) => {
|
|
|
|
|
sideBarBtnRefs.current[page] = ref;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const SELECTED_ITEMS = {
|
|
|
|
|
page: (
|
2022-12-08 12:21:09 +00:00
|
|
|
<LeftSidebarPageSelector
|
|
|
|
|
darkMode={darkMode}
|
2022-12-29 11:48:24 +00:00
|
|
|
selectedSidebarItem={selectedSidebarItem}
|
2022-12-08 12:21:09 +00:00
|
|
|
appDefinition={appDefinition}
|
|
|
|
|
currentPageId={currentPageId}
|
|
|
|
|
addNewPage={addNewPage}
|
|
|
|
|
switchPage={switchPage}
|
|
|
|
|
deletePage={deletePage}
|
|
|
|
|
renamePage={renamePage}
|
|
|
|
|
hidePage={hidePage}
|
|
|
|
|
unHidePage={unHidePage}
|
|
|
|
|
updateHomePage={updateHomePage}
|
|
|
|
|
updatePageHandle={updatePageHandle}
|
|
|
|
|
clonePage={clonePage}
|
|
|
|
|
pages={Object.entries(appDefinition.pages).map(([id, page]) => ({ id, ...page })) || []}
|
|
|
|
|
homePageId={appDefinition.homePageId}
|
|
|
|
|
showHideViewerNavigationControls={showHideViewerNavigationControls}
|
|
|
|
|
updateOnSortingPages={updateOnSortingPages}
|
|
|
|
|
updateOnPageLoadEvents={updateOnPageLoadEvents}
|
|
|
|
|
currentState={currentState}
|
|
|
|
|
apps={apps}
|
2023-01-05 09:17:24 +00:00
|
|
|
popoverContentHeight={popoverContentHeight}
|
2023-06-15 07:28:44 +00:00
|
|
|
setPinned={handlePin}
|
|
|
|
|
pinned={pinned}
|
2022-12-08 12:21:09 +00:00
|
|
|
/>
|
2023-06-15 07:28:44 +00:00
|
|
|
),
|
|
|
|
|
inspect: (
|
2022-12-29 11:48:24 +00:00
|
|
|
<LeftSidebarInspector
|
|
|
|
|
darkMode={darkMode}
|
|
|
|
|
selectedSidebarItem={selectedSidebarItem}
|
|
|
|
|
currentState={currentState}
|
|
|
|
|
appDefinition={appDefinition}
|
|
|
|
|
setSelectedComponent={setSelectedComponent}
|
|
|
|
|
removeComponent={removeComponent}
|
|
|
|
|
runQuery={runQuery}
|
2023-01-05 09:17:24 +00:00
|
|
|
popoverContentHeight={popoverContentHeight}
|
2023-06-15 07:28:44 +00:00
|
|
|
setPinned={handlePin}
|
|
|
|
|
pinned={pinned}
|
2023-07-11 04:40:03 +00:00
|
|
|
isVersionReleased={isVersionReleased}
|
2023-06-15 07:28:44 +00:00
|
|
|
/>
|
|
|
|
|
),
|
2023-06-20 05:38:56 +00:00
|
|
|
database: (
|
|
|
|
|
<LeftSidebarDataSources
|
|
|
|
|
darkMode={darkMode}
|
|
|
|
|
appId={appId}
|
|
|
|
|
dataSourcesChanged={dataSourcesChanged}
|
|
|
|
|
globalDataSourcesChanged={globalDataSourcesChanged}
|
|
|
|
|
dataQueriesChanged={dataQueriesChanged}
|
|
|
|
|
toggleDataSourceManagerModal={toggleDataSourceManagerModal}
|
|
|
|
|
showDataSourceManagerModal={showDataSourceManagerModal}
|
|
|
|
|
isVersionReleased={isVersionReleased}
|
|
|
|
|
onDeleteofAllDataSources={() => {
|
|
|
|
|
handleSelectedSidebarItem(null);
|
|
|
|
|
handlePin(false);
|
|
|
|
|
delete sideBarBtnRefs.current['database'];
|
|
|
|
|
}}
|
|
|
|
|
setPinned={handlePin}
|
|
|
|
|
pinned={pinned}
|
|
|
|
|
/>
|
|
|
|
|
),
|
2023-06-15 07:28:44 +00:00
|
|
|
debugger: (
|
|
|
|
|
<LeftSidebarDebugger
|
|
|
|
|
darkMode={darkMode}
|
|
|
|
|
selectedSidebarItem={selectedSidebarItem}
|
|
|
|
|
components={components}
|
|
|
|
|
errors={errorLogs}
|
|
|
|
|
debuggerActions={debuggerActions}
|
|
|
|
|
currentPageId={currentPageId}
|
|
|
|
|
popoverContentHeight={popoverContentHeight}
|
|
|
|
|
clearErrorLogs={clearErrorLogs}
|
|
|
|
|
setPinned={handlePin}
|
|
|
|
|
pinned={pinned}
|
|
|
|
|
setEditorMarginLeft={setEditorMarginLeft}
|
2022-12-29 11:48:24 +00:00
|
|
|
/>
|
2023-06-15 07:28:44 +00:00
|
|
|
),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="left-sidebar" data-cy="left-sidebar-inspector">
|
|
|
|
|
<LeftSidebarItem
|
|
|
|
|
selectedSidebarItem={selectedSidebarItem}
|
|
|
|
|
onClick={() => handleSelectedSidebarItem('page')}
|
|
|
|
|
icon="page"
|
|
|
|
|
className={`left-sidebar-item left-sidebar-layout left-sidebar-page-selector`}
|
|
|
|
|
tip="Pages"
|
|
|
|
|
ref={setSideBarBtnRefs('page')}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<LeftSidebarItem
|
|
|
|
|
selectedSidebarItem={selectedSidebarItem}
|
|
|
|
|
onClick={() => handleSelectedSidebarItem('inspect')}
|
|
|
|
|
icon="inspect"
|
|
|
|
|
className={`left-sidebar-item left-sidebar-layout left-sidebar-inspector`}
|
|
|
|
|
tip="Inspector"
|
|
|
|
|
ref={setSideBarBtnRefs('inspect')}
|
|
|
|
|
/>
|
2023-06-20 05:38:56 +00:00
|
|
|
{dataSources?.length > 0 && (
|
|
|
|
|
<LeftSidebarItem
|
|
|
|
|
selectedSidebarItem={selectedSidebarItem}
|
|
|
|
|
onClick={() => handleSelectedSidebarItem('database')}
|
|
|
|
|
icon="database"
|
|
|
|
|
className={`left-sidebar-item left-sidebar-layout sidebar-datasources`}
|
|
|
|
|
tip="Sources"
|
|
|
|
|
ref={setSideBarBtnRefs('database')}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2023-06-15 07:28:44 +00:00
|
|
|
<Popover
|
|
|
|
|
onInteractOutside={handleInteractOutside}
|
|
|
|
|
open={pinned || !!selectedSidebarItem}
|
|
|
|
|
popoverContentClassName="p-0 sidebar-h-100-popover"
|
|
|
|
|
side="right"
|
|
|
|
|
popoverContent={SELECTED_ITEMS[selectedSidebarItem]}
|
|
|
|
|
popoverContentHeight={popoverContentHeight}
|
|
|
|
|
/>
|
|
|
|
|
|
Feature: Collaboration ( realtime comments for canvas ) 🔥 (#810)
* feat: initial commit for collaboration feature
* add dnd to comments
* add positions endpoint
* feat: encapsulate all http common logic in http-client
* segregate sections and transfer responsibility of state
* feat: use-spring to add fade effect :zap:
* fix: open in right
* fix: left-right position css
* add footer for message
* integrate getcomment endpoint
* use fromnow for date ago
* add dnd
* - Add data trasfer object for comment
- Add class-validator package to check the response type from client
- Add comment repository class for persistance layer
- Add comment service with std. http methods
- Update controller with all http methods
- Update comment module
- Fix http-client bug when error is thrown
* fix http client bug when error is thrown
* feat: add entity thread
* feat: add migrations for thread and comment
* update entitites
* add tid to migration
* filter comments by tid(thread_id)
* fix: comment migration, add missing column comment
* feat: integrate in ui
* feat: split comments based on app_id
* fix: dnd to correct position
* package json engines
* engines update
* update npm
* npm 6 to 7
* fix: add user initials to thread
* fix: add firtname lastname to the comments
* - Return user object when save thread called
- Hide password field from user response
- Fix created_at date typo
- Instead of fetch all threads on new thread added, add the response to array of existing threads
* feat: update ui components
* change icon on comments view
* ui fixes
* fix: close icon close the popover
* temp: comment select: false
* use currentUser from localStorage
* fix: on click outside if comment is open, dont hit addThread
* fix: auth token issue in http-client
* on drag hide the comment if open
* add jwt auth
* spec: add test for comment & thread
* cleanup: remove console.log
* feat: add comment actions
* feat: add edit, delete, resolve options
* feat: add mentions component
* feat: add nestjs websockets
* temp
* websocket: establish client-server communication
* ws: add message listner to comments module in ui
* feat: add broadcast method to broadcast new events to all clients :bomb:
* ws: cleanup :call_me_hand:
* fix: remove max height from comment actions
* feat: add user mentions, emoji support
* fix: add static list of users - temp
* update and delete iterations
* - Rename comment, thread to comments, threads
- Add conditional actions
- Show edit, delete only if he is comment owner
- Show resolve only if he is thread owner
* reset engines
* move svgr webpack to deps
* fix: ui issues
* remove log stmt
* refactor: move resolved icon to comment-header
* feat: allow comments to be added on top of widgets
* feat: add keyboard shortcut
* scroll to bottom on comment add
* ui fixes
* feat: add react toast for notification display
* feat: add comment badge
* fix: ws connection
* fix: ws
* remove rvrse
* feat: add comment sidebar
* feat: add comment right sidebar
* fix: add missing foreign key elements
* - upgrade typeorm to 0.2.38
- comment sidebar ui
- added filter ui
* feat: on click of right sidebar notificaiton open the comment box
* reset engines
* fix: add organization id to the comment and thread module
* fix: add current version id
* add currentversion id
* disable comments if no id present
* temp:checking for heroku deploy
* fetch app on edit and deploy version
* rename current_version_id to app_versions_id
* ui fixes
* show mentioned user in blue color
* add ui changes
* add authorization for create thread
* change color to blue on click of comment, add auth for other endpoints of thread
* update threads, notifications using socket
* add auth for comments
* remove events spec file
* fix duplicate key error
* fix notificaitons updation on edit, delete, resolve buttons clicked
* update notifications for edit
* feature toggle changes for frontend
* add check for comments server
* add emoji mart package for emoji
* add reply count in comment sidebar
* subtract 1 from count in comment sidebar
* change empty text when no comments available
2021-11-01 07:28:03 +00:00
|
|
|
{config.COMMENT_FEATURE_ENABLE && (
|
2023-05-11 07:02:21 +00:00
|
|
|
<div className={`${isVersionReleased && 'disabled'}`}>
|
|
|
|
|
<LeftSidebarComment
|
|
|
|
|
selectedSidebarItem={showComments ? 'comments' : ''}
|
|
|
|
|
currentPageId={currentPageId}
|
2023-06-15 07:28:44 +00:00
|
|
|
ref={setSideBarBtnRefs('comments')}
|
2023-05-11 07:02:21 +00:00
|
|
|
/>
|
|
|
|
|
</div>
|
Feature: Collaboration ( realtime comments for canvas ) 🔥 (#810)
* feat: initial commit for collaboration feature
* add dnd to comments
* add positions endpoint
* feat: encapsulate all http common logic in http-client
* segregate sections and transfer responsibility of state
* feat: use-spring to add fade effect :zap:
* fix: open in right
* fix: left-right position css
* add footer for message
* integrate getcomment endpoint
* use fromnow for date ago
* add dnd
* - Add data trasfer object for comment
- Add class-validator package to check the response type from client
- Add comment repository class for persistance layer
- Add comment service with std. http methods
- Update controller with all http methods
- Update comment module
- Fix http-client bug when error is thrown
* fix http client bug when error is thrown
* feat: add entity thread
* feat: add migrations for thread and comment
* update entitites
* add tid to migration
* filter comments by tid(thread_id)
* fix: comment migration, add missing column comment
* feat: integrate in ui
* feat: split comments based on app_id
* fix: dnd to correct position
* package json engines
* engines update
* update npm
* npm 6 to 7
* fix: add user initials to thread
* fix: add firtname lastname to the comments
* - Return user object when save thread called
- Hide password field from user response
- Fix created_at date typo
- Instead of fetch all threads on new thread added, add the response to array of existing threads
* feat: update ui components
* change icon on comments view
* ui fixes
* fix: close icon close the popover
* temp: comment select: false
* use currentUser from localStorage
* fix: on click outside if comment is open, dont hit addThread
* fix: auth token issue in http-client
* on drag hide the comment if open
* add jwt auth
* spec: add test for comment & thread
* cleanup: remove console.log
* feat: add comment actions
* feat: add edit, delete, resolve options
* feat: add mentions component
* feat: add nestjs websockets
* temp
* websocket: establish client-server communication
* ws: add message listner to comments module in ui
* feat: add broadcast method to broadcast new events to all clients :bomb:
* ws: cleanup :call_me_hand:
* fix: remove max height from comment actions
* feat: add user mentions, emoji support
* fix: add static list of users - temp
* update and delete iterations
* - Rename comment, thread to comments, threads
- Add conditional actions
- Show edit, delete only if he is comment owner
- Show resolve only if he is thread owner
* reset engines
* move svgr webpack to deps
* fix: ui issues
* remove log stmt
* refactor: move resolved icon to comment-header
* feat: allow comments to be added on top of widgets
* feat: add keyboard shortcut
* scroll to bottom on comment add
* ui fixes
* feat: add react toast for notification display
* feat: add comment badge
* fix: ws connection
* fix: ws
* remove rvrse
* feat: add comment sidebar
* feat: add comment right sidebar
* fix: add missing foreign key elements
* - upgrade typeorm to 0.2.38
- comment sidebar ui
- added filter ui
* feat: on click of right sidebar notificaiton open the comment box
* reset engines
* fix: add organization id to the comment and thread module
* fix: add current version id
* add currentversion id
* disable comments if no id present
* temp:checking for heroku deploy
* fetch app on edit and deploy version
* rename current_version_id to app_versions_id
* ui fixes
* show mentioned user in blue color
* add ui changes
* add authorization for create thread
* change color to blue on click of comment, add auth for other endpoints of thread
* update threads, notifications using socket
* add auth for comments
* remove events spec file
* fix duplicate key error
* fix notificaitons updation on edit, delete, resolve buttons clicked
* update notifications for edit
* feature toggle changes for frontend
* add check for comments server
* add emoji mart package for emoji
* add reply count in comment sidebar
* subtract 1 from count in comment sidebar
* change empty text when no comments available
2021-11-01 07:28:03 +00:00
|
|
|
)}
|
2021-10-13 04:02:18 +00:00
|
|
|
<ConfirmDialog
|
|
|
|
|
show={showLeaveDialog}
|
|
|
|
|
message={'The unsaved changes will be lost if you leave the editor, do you want to leave?'}
|
|
|
|
|
onConfirm={() => router.push('/')}
|
|
|
|
|
onCancel={() => setShowLeaveDialog(false)}
|
2023-01-06 11:44:56 +00:00
|
|
|
darkMode={darkMode}
|
2021-10-13 04:02:18 +00:00
|
|
|
/>
|
2021-09-12 04:24:47 +00:00
|
|
|
<div className="left-sidebar-stack-bottom">
|
2023-06-15 07:28:44 +00:00
|
|
|
<LeftSidebarItem
|
|
|
|
|
icon="debugger"
|
2022-12-29 11:48:24 +00:00
|
|
|
selectedSidebarItem={selectedSidebarItem}
|
2023-06-20 05:38:56 +00:00
|
|
|
// eslint-disable-next-line no-unused-vars
|
2023-06-15 07:28:44 +00:00
|
|
|
onClick={(e) => handleSelectedSidebarItem('debugger')}
|
|
|
|
|
className={`left-sidebar-item left-sidebar-layout`}
|
|
|
|
|
badge={true}
|
|
|
|
|
count={unReadErrorCount.unread}
|
|
|
|
|
tip="Debugger"
|
|
|
|
|
ref={setSideBarBtnRefs('debugger')}
|
2022-12-29 11:48:24 +00:00
|
|
|
/>
|
2023-06-15 07:28:44 +00:00
|
|
|
|
2021-09-12 04:24:47 +00:00
|
|
|
<div className="left-sidebar-item no-border">
|
2021-10-21 17:27:31 +00:00
|
|
|
<DarkModeToggle switchDarkMode={switchDarkMode} darkMode={darkMode} tooltipPlacement="right" />
|
2021-08-17 06:01:12 +00:00
|
|
|
</div>
|
|
|
|
|
{/* <LeftSidebarItem icon='support' className='left-sidebar-item' /> */}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-09-12 04:24:47 +00:00
|
|
|
);
|
2022-06-15 10:46:51 +00:00
|
|
|
});
|