2021-02-11 12:54:00 +00:00
|
|
|
|
import React, {
|
|
|
|
|
|
Component,
|
2021-12-20 05:58:01 +00:00
|
|
|
|
useCallback,
|
2021-02-11 12:54:00 +00:00
|
|
|
|
useContext,
|
|
|
|
|
|
useEffect,
|
|
|
|
|
|
useRef,
|
|
|
|
|
|
useState,
|
|
|
|
|
|
} from "react";
|
|
|
|
|
|
import styled, { ThemeContext } from "styled-components";
|
|
|
|
|
|
import { connect, useDispatch, useSelector } from "react-redux";
|
2022-03-03 10:56:53 +00:00
|
|
|
|
import MediaQuery from "react-responsive";
|
2021-01-21 06:19:06 +00:00
|
|
|
|
import { useLocation } from "react-router-dom";
|
2022-08-24 12:16:32 +00:00
|
|
|
|
import { AppState } from "@appsmith/reducers";
|
2021-10-04 15:34:37 +00:00
|
|
|
|
import { Classes as BlueprintClasses } from "@blueprintjs/core";
|
2021-10-20 14:35:12 +00:00
|
|
|
|
import {
|
|
|
|
|
|
thinScrollbar,
|
|
|
|
|
|
truncateTextUsingEllipsis,
|
|
|
|
|
|
} from "constants/DefaultTheme";
|
2019-11-07 04:59:40 +00:00
|
|
|
|
import {
|
|
|
|
|
|
getApplicationList,
|
2021-02-11 12:54:00 +00:00
|
|
|
|
getApplicationSearchKeyword,
|
2019-11-21 10:52:49 +00:00
|
|
|
|
getCreateApplicationError,
|
2021-02-11 12:54:00 +00:00
|
|
|
|
getIsCreatingApplication,
|
2020-02-03 12:19:10 +00:00
|
|
|
|
getIsDeletingApplication,
|
2020-09-01 07:16:54 +00:00
|
|
|
|
getIsDuplicatingApplication,
|
2021-02-11 12:54:00 +00:00
|
|
|
|
getIsFetchingApplications,
|
2022-06-15 15:37:41 +00:00
|
|
|
|
getIsSavingWorkspaceInfo,
|
|
|
|
|
|
getUserApplicationsWorkspaces,
|
|
|
|
|
|
getUserApplicationsWorkspacesList,
|
2019-11-25 05:07:27 +00:00
|
|
|
|
} from "selectors/applicationSelectors";
|
2019-11-07 04:59:40 +00:00
|
|
|
|
import {
|
|
|
|
|
|
ApplicationPayload,
|
2021-02-11 12:54:00 +00:00
|
|
|
|
ReduxActionTypes,
|
2022-04-12 10:50:01 +00:00
|
|
|
|
} from "@appsmith/constants/ReduxActionConstants";
|
2019-12-23 12:16:33 +00:00
|
|
|
|
import PageWrapper from "pages/common/PageWrapper";
|
2019-11-21 10:52:49 +00:00
|
|
|
|
import SubHeader from "pages/common/SubHeader";
|
|
|
|
|
|
import ApplicationCard from "./ApplicationCard";
|
2022-09-02 17:15:08 +00:00
|
|
|
|
import WorkspaceInviteUsersForm from "@appsmith/pages/workspace/WorkspaceInviteUsersForm";
|
2020-05-14 10:47:13 +00:00
|
|
|
|
import FormDialogComponent from "components/editorComponents/form/FormDialogComponent";
|
2020-05-27 13:36:06 +00:00
|
|
|
|
import { User } from "constants/userConstants";
|
2022-11-01 14:59:42 +00:00
|
|
|
|
import { getCurrentUser } from "selectors/usersSelectors";
|
2022-09-29 09:53:25 +00:00
|
|
|
|
import { CREATE_WORKSPACE_FORM_NAME } from "@appsmith/constants/forms";
|
2020-06-11 11:31:32 +00:00
|
|
|
|
import {
|
|
|
|
|
|
DropdownOnSelectActions,
|
2021-02-11 12:54:00 +00:00
|
|
|
|
getOnSelectAction,
|
2020-06-11 11:31:32 +00:00
|
|
|
|
} from "pages/common/CustomizedDropdown/dropdownHelpers";
|
2022-08-22 05:09:39 +00:00
|
|
|
|
import {
|
|
|
|
|
|
AppIconCollection,
|
|
|
|
|
|
Button,
|
|
|
|
|
|
Category,
|
chore: import common variables from design system (#17600)
* Delete CommonComponentProps, Classes, import them from design-system
* Delete Icon.test.tsx
* Remove color utils, add import from design-system
* Remove Variant, add import from design-system
* Remove unused toast parameters from common
* use design-system version 28-alpha-7
* Move ThemeProp from ads/common to widgets/constants
* fix import
* Delete index.ts
* feat: migrated form group from ads folder to design system repository (#17400)
* feat: migrated form group from ads folder to design system repo
* fix: formGroup label color fix
* DS version updated
* Updated Label Config
* chore: Flapdoodle version upgrade to 3.5.0 (#17609)
* chore: code split tenant API CE (#17596)
## Description
We shouldn't expose tenant config on CE , so on CE, we should only return the necessary user permissions hard coded on the saga.
## Type of change
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manual
## Checklist:
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
* chore: BaseAppsmithRepo code split (#17614)
* chore: Updating the tenant API to return the complete object instead of just the configuration (#17615)
* Fix sandbox iframe default setting (#17618)
* feat: upgrade hooks | audit logs (#17525)
* feat: Text Widget Reskinning (#17298)
* feat: Use truncate button color from theme
* fix: Update Truncate Button Color validation regex
* feat: Maintain Focus and Context Phase 1 (#16317)
* fix: update regex and test case for organisation website (#17612)
* chore: Add properties to analytics event (#17621)
* feat: enabled setTimeout/clearTimeout APIs (#17445)
* Update top contributors
* fix: ms sql default port updated to 1433 (#17342)
* fix: removed global style from design system dropdown component (#17392)
* bug: removed global style from design system dropdown component
* changed design system package version
* fix: Dropdown background fix - design system
* design-system - dropdown background color fix
* DS version updated
* chore: Fixing broken client build (#17634)
## Description
EE client build is broken due to not following proper code splitting strategy; one file in particularly didn't get split earlier and changes to that file broke the client build on EE.
This PR fixes the issues.
* Fix/16994 refactor common datatype handling (#17429)
* fix:Add array datatype to execute request
* feat: Consume and store type of array elements in Param class (#16994)
* Append param instead of clientDataType in varargs (#16994)
* Refactor common data type handling w.r.t newer structure (#16994)
This commit takes care of the following items:
- It minimizes the number of usage to the older stringToKnownDataTypeConverter method
- Modifies the existing test cases to conform to the newer structure
- Marks stringToKnownDataTypeConverter method as deprecated to discourage further use
* Remove comma delimited numbers from valid test cases (#16994)
* Fix extracting clientDataType from varargs in MySQL (#16994)
* Pass param as a dedicated parameter in json smart replacement (#16994)
* Remove varargs from json smart replacement method (#16994)
* Move BsonType to mongoplugin module (#16994)
* Introduce NullArrayType and refactor BsonType test cases (#16994)
* Add new test cases on numeric string with leading zero (#16994)
* Refactor test case name (#16994)
* Add comment on the ordering of Json and Bson types (#16994)
* Add comment on the ordering of Json and Bson types (#16994)
* Add NullArrayType in Postgres and introduce postgres-specific types (#16994)
* Add data type test cases for Postgres and change as per review comments (#16994)
Co-authored-by: ChandanBalajiBP <chandan@appsmith.com>
* feat: Update invite modal submit when we have tabs in modal (#17608)
## Description
> Update invite modal submit when we have tabs in modal.
Fixes [#16741](https://github.com/appsmithorg/appsmith/issues/16741)
## Type of change
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
> Tested it locally.
## Checklist:
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
* feat: AST based entity refactor (#17434)
* task: AST based entity refactor
* implemented refactor logic
* jest cases with string manipulation using AST logic
* comments and indentation
* added evalVersion to request
* chore: Added feature flag for datasource environments (#17657)
chore: Added Feature flag for datasource environments
* chore: Corrected analytics event for instance setting events (#17622)
* Update top contributors
* Fix typo in cloud-hosting check and NPE from Segment (#17692)
Signed-off-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
* fix: remove file references on click of cancel button (#17664)
* fix: table does not show data issue fixed (#17459)
* chore: Add recommended indexes (#17704)
Signed-off-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
* chore: Added workspace details to user invite analytic event (#17644)
## Description
This PR adds the workspace details to user invite analytics event
## Type of change
- New feature (non-breaking change which adds functionality)
## How Has This Been Tested?
- Manually on local
## Checklist:
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
* chore: Correct the toast font on windows (#17671)
* fix: JS option missing for Label Font Style in Input widget (#17631)
* fix: replace time based action to event based (#17586)
* fix: replace time based action to event based
- The delete datasource button was getting reset to it's original state after a static time of 2200ms
- Replaced this to reset on completion of deletion instead
* fix: removed unused functions
* fix: updated the condition to show confirm delete icon
* Updated Label Config
* test: Add cypress tests for template phase 2 (#17036)
Co-authored-by: Parthvi Goswami <parthvigoswami@Parthvis-MacBook-Pro.local>
* Change Segment CDN to our proxy (#17714)
* chore: Fixing prettier formatting for AnalyticsUtil.tsx
* chore: Adding base repository function to add user permissions to generic domain object (#17733)
## Description
Adding base function to set the user permissions for a user in any domain object.
As part of this, we also add default permission group to the `SeedMongoData`. Without this fix, the JUnit tests go into an infinite loop. Also fixing the `ExampleWorkspaceClonerTest` file.
## Type of change
- Bug fix (non-breaking change which fixes an issue)
## How Has This Been Tested?
- JUnit
## Checklist:
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
* Update top contributors
Signed-off-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
Co-authored-by: Nikhil Nandagopal <nikhil.nandagopal@gmail.com>
Co-authored-by: Nidhi <nidhi@appsmith.com>
Co-authored-by: Sangeeth Sivan <74818788+berzerkeer@users.noreply.github.com>
Co-authored-by: Trisha Anand <trisha@appsmith.com>
Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
Co-authored-by: f0c1s <anubhav@appsmith.com>
Co-authored-by: Dhruvik Neharia <dhruvik@appsmith.com>
Co-authored-by: Hetu Nandu <hetu@appsmith.com>
Co-authored-by: Nilesh Sarupriya <nilesh@appsmith.com>
Co-authored-by: Anagh Hegde <anagh@appsmith.com>
Co-authored-by: arunvjn <32433245+arunvjn@users.noreply.github.com>
Co-authored-by: Appsmith Bot <74705725+appsmith-bot@users.noreply.github.com>
Co-authored-by: Vaibhav Tanwar <40293928+vaibh1297@users.noreply.github.com>
Co-authored-by: subratadeypappu <subrata@appsmith.com>
Co-authored-by: ChandanBalajiBP <chandan@appsmith.com>
Co-authored-by: Ankita Kinger <ankita@appsmith.com>
Co-authored-by: ChandanBalajiBP <104058110+ChandanBalajiBP@users.noreply.github.com>
Co-authored-by: Vishnu Gp <vishnu@appsmith.com>
Co-authored-by: Keyur Paralkar <keyur@appsmith.com>
Co-authored-by: sneha122 <sneha@appsmith.com>
Co-authored-by: Tanvi Bhakta <tanvibhakta@gmail.com>
Co-authored-by: sanjus-robotic-studio <58104863+sanjus-robotic-studio@users.noreply.github.com>
Co-authored-by: Ayush Pahwa <ayush@appsmith.com>
Co-authored-by: Parthvi <80334441+Parthvi12@users.noreply.github.com>
Co-authored-by: Parthvi Goswami <parthvigoswami@Parthvis-MacBook-Pro.local>
Co-authored-by: Arpit Mohan <arpit@appsmith.com>
Signed-off-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
Co-authored-by: albinAppsmith <87797149+albinAppsmith@users.noreply.github.com>
Co-authored-by: Nikhil Nandagopal <nikhil.nandagopal@gmail.com>
Co-authored-by: Nidhi <nidhi@appsmith.com>
Co-authored-by: Sangeeth Sivan <74818788+berzerkeer@users.noreply.github.com>
Co-authored-by: Trisha Anand <trisha@appsmith.com>
Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
Co-authored-by: f0c1s <anubhav@appsmith.com>
Co-authored-by: Dhruvik Neharia <dhruvik@appsmith.com>
Co-authored-by: Hetu Nandu <hetu@appsmith.com>
Co-authored-by: Nilesh Sarupriya <nilesh@appsmith.com>
Co-authored-by: Anagh Hegde <anagh@appsmith.com>
Co-authored-by: arunvjn <32433245+arunvjn@users.noreply.github.com>
Co-authored-by: Appsmith Bot <74705725+appsmith-bot@users.noreply.github.com>
Co-authored-by: Vaibhav Tanwar <40293928+vaibh1297@users.noreply.github.com>
Co-authored-by: subratadeypappu <subrata@appsmith.com>
Co-authored-by: ChandanBalajiBP <chandan@appsmith.com>
Co-authored-by: Ankita Kinger <ankita@appsmith.com>
Co-authored-by: ChandanBalajiBP <104058110+ChandanBalajiBP@users.noreply.github.com>
Co-authored-by: Vishnu Gp <vishnu@appsmith.com>
Co-authored-by: Keyur Paralkar <keyur@appsmith.com>
Co-authored-by: sneha122 <sneha@appsmith.com>
Co-authored-by: sanjus-robotic-studio <58104863+sanjus-robotic-studio@users.noreply.github.com>
Co-authored-by: Ayush Pahwa <ayush@appsmith.com>
Co-authored-by: Parthvi <80334441+Parthvi12@users.noreply.github.com>
Co-authored-by: Parthvi Goswami <parthvigoswami@Parthvis-MacBook-Pro.local>
Co-authored-by: Arpit Mohan <arpit@appsmith.com>
2022-10-31 01:24:47 +00:00
|
|
|
|
Classes,
|
2022-10-13 20:13:44 +00:00
|
|
|
|
EditableText,
|
|
|
|
|
|
EditInteractionKind,
|
2022-10-10 03:54:41 +00:00
|
|
|
|
DialogComponent as Dialog,
|
2022-08-22 05:09:39 +00:00
|
|
|
|
Icon,
|
|
|
|
|
|
IconName,
|
|
|
|
|
|
IconSize,
|
feat: import changes batch 2 (#15722)
* Remove treedropdown from ads
* Change Treedropdown imports
* Remove Notification Banner, change imports
* Remove Toggle from ads
* Change toggle imports
* explicitly declare function argument types
* Remove Menu from ads
* Change menu imports
* Remove Spinner from ads
* Change spinner imports
* Remove Radio, import changes
* test: updated flaky test under default meta (#15707)
* updated flaky test
* Updated tests
* updated tests
* updated the tests
* updated tests
* Update constants.ts
* add more typecasting
* Remove ListSegmentHeader, import changes
* Remove TagInputComponent, import changes
* Remove Switch, import changes
* Remove SearchInput, change imports
* Rename TagInputComponent to TagInput
* Remove ProgressiveImage, import changes
* import changes for SearchVariant
* Remove menu divider, import changes
* Remove TableDropdown, import changes
* Remove Switcher
* Remove StatusBar, import changes
* Remove showcase carousel
* Remove RectangularSwitcher, import change
* Add types to TableDropdown's args
* Remove MultiSwitch, import change
* Remove GifPlayerComponent, import change
* Remove DraggableList, import change
* Remove DisplayImageUpload, import change
* Remove DatePickerComponent, import change
* Remove CopyToClipBoard, import change
* Remove ColorSelector, import change
* Remove TabItemBackgroundFill, NumberedStep, ColorPickerComponent
* GifPlayerComponent -> GifPlayer
* change named import
* Remove FormFieldError, change imports
* Update to new version of Tree Dropdown
* Fix issue with ads/index.ts
* Test file fix
* Fix issue with merge?!?!??
* update design system to 1.0.18
* Bump ds version
* bump ds version
* bump ds version
Co-authored-by: NandanAnantharamu <67676905+NandanAnantharamu@users.noreply.github.com>
Co-authored-by: Albin <albin@appsmith.com>
2022-09-02 08:38:17 +00:00
|
|
|
|
Menu,
|
2022-08-22 05:09:39 +00:00
|
|
|
|
MenuItem,
|
2022-10-04 11:18:35 +00:00
|
|
|
|
notEmptyValidator,
|
2022-10-13 20:13:44 +00:00
|
|
|
|
SavingState,
|
2022-08-22 05:09:39 +00:00
|
|
|
|
Size,
|
|
|
|
|
|
Text,
|
|
|
|
|
|
TextType,
|
|
|
|
|
|
} from "design-system";
|
2020-09-16 11:50:47 +00:00
|
|
|
|
import {
|
|
|
|
|
|
duplicateApplication,
|
|
|
|
|
|
updateApplication,
|
|
|
|
|
|
} from "actions/applicationActions";
|
|
|
|
|
|
import { Position } from "@blueprintjs/core/lib/esm/common/position";
|
2021-10-04 15:34:37 +00:00
|
|
|
|
import { UpdateApplicationPayload } from "api/ApplicationApi";
|
2020-09-28 06:29:41 +00:00
|
|
|
|
import PerformanceTracker, {
|
|
|
|
|
|
PerformanceTransactionName,
|
|
|
|
|
|
} from "utils/PerformanceTracker";
|
2022-06-15 15:37:41 +00:00
|
|
|
|
import { loadingUserWorkspaces } from "./ApplicationLoaders";
|
2022-09-02 17:15:08 +00:00
|
|
|
|
import { creatingApplicationMap } from "@appsmith/reducers/uiReducers/applicationsReducer";
|
2022-11-03 16:39:51 +00:00
|
|
|
|
import {
|
|
|
|
|
|
deleteWorkspace,
|
|
|
|
|
|
saveWorkspace,
|
|
|
|
|
|
} from "@appsmith/actions/workspaceActions";
|
2022-06-15 15:37:41 +00:00
|
|
|
|
import { leaveWorkspace } from "actions/userActions";
|
2022-04-12 10:50:01 +00:00
|
|
|
|
import CenteredWrapper from "components/designSystems/appsmith/CenteredWrapper";
|
|
|
|
|
|
import NoSearchImage from "assets/images/NoSearchResult.svg";
|
2020-12-09 07:06:02 +00:00
|
|
|
|
import { getNextEntityName, getRandomPaletteColor } from "utils/AppsmithUtils";
|
2022-09-02 17:15:08 +00:00
|
|
|
|
import { createWorkspaceSubmitHandler } from "@appsmith/pages/workspace/helpers";
|
2021-06-03 06:18:08 +00:00
|
|
|
|
import ImportApplicationModal from "./ImportApplicationModal";
|
2021-09-15 12:20:25 +00:00
|
|
|
|
import {
|
|
|
|
|
|
createMessage,
|
2022-09-02 17:15:08 +00:00
|
|
|
|
INVITE_USERS_MESSAGE,
|
|
|
|
|
|
INVITE_USERS_PLACEHOLDER,
|
2022-10-04 11:18:35 +00:00
|
|
|
|
NO_APPS_FOUND,
|
|
|
|
|
|
SEARCH_APPS,
|
|
|
|
|
|
WORKSPACES_HEADING,
|
2022-02-11 18:08:46 +00:00
|
|
|
|
} from "@appsmith/constants/messages";
|
2021-10-04 15:34:37 +00:00
|
|
|
|
import { ReactComponent as NoAppsFoundIcon } from "assets/svg/no-apps-icon.svg";
|
2020-05-27 13:36:06 +00:00
|
|
|
|
|
2021-10-04 15:34:37 +00:00
|
|
|
|
import { setHeaderMeta } from "actions/themeActions";
|
|
|
|
|
|
import SharedUserList from "pages/common/SharedUserList";
|
2022-02-17 16:38:36 +00:00
|
|
|
|
import { useIsMobileDevice } from "utils/hooks/useDeviceDetect";
|
|
|
|
|
|
import { Indices } from "constants/Layers";
|
2022-03-17 10:28:54 +00:00
|
|
|
|
import GitSyncModal from "pages/Editor/gitSync/GitSyncModal";
|
2022-10-26 06:48:04 +00:00
|
|
|
|
import DisconnectGitModal from "pages/Editor/gitSync/DisconnectGitModal";
|
2022-03-17 10:28:54 +00:00
|
|
|
|
import ReconnectDatasourceModal from "pages/Editor/gitSync/ReconnectDatasourceModal";
|
2022-03-03 10:56:53 +00:00
|
|
|
|
import LeftPaneBottomSection from "pages/Home/LeftPaneBottomSection";
|
|
|
|
|
|
import { MOBILE_MAX_WIDTH } from "constants/AppConstants";
|
2022-07-11 04:06:29 +00:00
|
|
|
|
import urlBuilder from "entities/URLRedirect/URLAssembly";
|
2022-06-27 04:50:53 +00:00
|
|
|
|
import RepoLimitExceededErrorModal from "../Editor/gitSync/RepoLimitExceededErrorModal";
|
2022-07-11 04:06:29 +00:00
|
|
|
|
import { resetEditorRequest } from "actions/initActions";
|
2022-10-20 06:03:33 +00:00
|
|
|
|
import {
|
2022-12-01 06:30:50 +00:00
|
|
|
|
hasCreateNewAppPermission,
|
2022-10-20 06:03:33 +00:00
|
|
|
|
isPermitted,
|
|
|
|
|
|
PERMISSION_TYPE,
|
|
|
|
|
|
} from "@appsmith/utils/permissionHelpers";
|
2022-12-01 06:30:50 +00:00
|
|
|
|
import { getTenantPermissions } from "@appsmith/selectors/tenantSelectors";
|
2021-07-29 08:49:46 +00:00
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const WorkspaceDropDown = styled.div<{ isMobile?: boolean }>`
|
2020-05-27 13:36:06 +00:00
|
|
|
|
display: flex;
|
2022-02-17 16:38:36 +00:00
|
|
|
|
padding: ${(props) => (props.isMobile ? `10px 16px` : `10px 10px`)};
|
2020-12-24 04:32:25 +00:00
|
|
|
|
font-size: ${(props) => props.theme.fontSizes[1]}px;
|
2020-06-03 13:54:42 +00:00
|
|
|
|
justify-content: space-between;
|
2020-09-28 05:06:06 +00:00
|
|
|
|
align-items: center;
|
2022-02-17 16:38:36 +00:00
|
|
|
|
${({ isMobile }) =>
|
|
|
|
|
|
isMobile &&
|
|
|
|
|
|
`
|
|
|
|
|
|
position: sticky;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
z-index: ${Indices.Layer8};
|
|
|
|
|
|
`}
|
2020-05-27 13:36:06 +00:00
|
|
|
|
`;
|
2019-11-07 04:59:40 +00:00
|
|
|
|
|
2022-02-17 16:38:36 +00:00
|
|
|
|
const ApplicationCardsWrapper = styled.div<{ isMobile?: boolean }>`
|
2019-11-07 04:59:40 +00:00
|
|
|
|
display: flex;
|
2021-10-04 15:34:37 +00:00
|
|
|
|
flex-wrap: wrap;
|
2022-02-17 16:38:36 +00:00
|
|
|
|
gap: ${({ isMobile }) => (isMobile ? 12 : 20)}px;
|
2020-12-24 04:32:25 +00:00
|
|
|
|
font-size: ${(props) => props.theme.fontSizes[4]}px;
|
2022-02-17 16:38:36 +00:00
|
|
|
|
padding: ${({ isMobile }) => (isMobile ? `10px 16px` : `10px`)};
|
2019-11-07 04:59:40 +00:00
|
|
|
|
`;
|
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const WorkspaceSection = styled.div<{ isMobile?: boolean }>`
|
2022-02-17 16:38:36 +00:00
|
|
|
|
margin-bottom: ${({ isMobile }) => (isMobile ? `8` : `40`)}px;
|
2021-10-04 15:34:37 +00:00
|
|
|
|
`;
|
2020-07-16 10:39:07 +00:00
|
|
|
|
|
2022-02-17 16:38:36 +00:00
|
|
|
|
const PaddingWrapper = styled.div<{ isMobile?: boolean }>`
|
2021-10-04 15:34:37 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: baseline;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
width: ${(props) => props.theme.card.minWidth}px;
|
2020-10-21 09:23:40 +00:00
|
|
|
|
|
|
|
|
|
|
@media screen and (min-width: 1500px) {
|
|
|
|
|
|
.bp3-card {
|
2020-12-24 04:32:25 +00:00
|
|
|
|
width: ${(props) => props.theme.card.minWidth}px;
|
|
|
|
|
|
height: ${(props) => props.theme.card.minHeight}px;
|
2020-10-21 09:23:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@media screen and (min-width: 1500px) and (max-width: 1512px) {
|
2020-12-24 04:32:25 +00:00
|
|
|
|
width: ${(props) =>
|
|
|
|
|
|
props.theme.card.minWidth + props.theme.spaces[4] * 2}px;
|
2020-10-21 09:23:40 +00:00
|
|
|
|
.bp3-card {
|
2020-12-24 04:32:25 +00:00
|
|
|
|
width: ${(props) => props.theme.card.minWidth - 5}px;
|
|
|
|
|
|
height: ${(props) => props.theme.card.minHeight - 5}px;
|
2020-10-21 09:23:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
@media screen and (min-width: 1478px) and (max-width: 1500px) {
|
2020-12-24 04:32:25 +00:00
|
|
|
|
width: ${(props) =>
|
|
|
|
|
|
props.theme.card.minWidth + props.theme.spaces[4] * 2}px;
|
2020-10-21 09:23:40 +00:00
|
|
|
|
.bp3-card {
|
2020-12-24 04:32:25 +00:00
|
|
|
|
width: ${(props) => props.theme.card.minWidth - 8}px;
|
|
|
|
|
|
height: ${(props) => props.theme.card.minHeight - 8}px;
|
2020-10-21 09:23:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@media screen and (min-width: 1447px) and (max-width: 1477px) {
|
2020-12-24 04:32:25 +00:00
|
|
|
|
width: ${(props) =>
|
|
|
|
|
|
props.theme.card.minWidth + props.theme.spaces[3] * 2}px;
|
2020-10-21 09:23:40 +00:00
|
|
|
|
.bp3-card {
|
2020-12-24 04:32:25 +00:00
|
|
|
|
width: ${(props) => props.theme.card.minWidth - 8}px;
|
|
|
|
|
|
height: ${(props) => props.theme.card.minHeight - 8}px;
|
2020-10-21 09:23:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@media screen and (min-width: 1417px) and (max-width: 1446px) {
|
2020-12-24 04:32:25 +00:00
|
|
|
|
width: ${(props) =>
|
|
|
|
|
|
props.theme.card.minWidth + props.theme.spaces[3] * 2}px;
|
2020-10-21 09:23:40 +00:00
|
|
|
|
.bp3-card {
|
2020-12-24 04:32:25 +00:00
|
|
|
|
width: ${(props) => props.theme.card.minWidth - 11}px;
|
|
|
|
|
|
height: ${(props) => props.theme.card.minHeight - 11}px;
|
2020-10-21 09:23:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@media screen and (min-width: 1400px) and (max-width: 1417px) {
|
2020-12-24 04:32:25 +00:00
|
|
|
|
width: ${(props) =>
|
|
|
|
|
|
props.theme.card.minWidth + props.theme.spaces[2] * 2}px;
|
2020-10-21 09:23:40 +00:00
|
|
|
|
.bp3-card {
|
2020-12-24 04:32:25 +00:00
|
|
|
|
width: ${(props) => props.theme.card.minWidth - 15}px;
|
|
|
|
|
|
height: ${(props) => props.theme.card.minHeight - 15}px;
|
2020-10-21 09:23:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@media screen and (max-width: 1400px) {
|
2020-12-24 04:32:25 +00:00
|
|
|
|
width: ${(props) =>
|
|
|
|
|
|
props.theme.card.minWidth + props.theme.spaces[2] * 2}px;
|
2020-10-21 09:23:40 +00:00
|
|
|
|
.bp3-card {
|
2020-12-24 04:32:25 +00:00
|
|
|
|
width: ${(props) => props.theme.card.minWidth - 15}px;
|
|
|
|
|
|
height: ${(props) => props.theme.card.minHeight - 15}px;
|
2020-10-21 09:23:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-02-17 16:38:36 +00:00
|
|
|
|
|
|
|
|
|
|
${({ isMobile }) =>
|
|
|
|
|
|
isMobile &&
|
|
|
|
|
|
`
|
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
|
`}
|
2020-09-16 11:50:47 +00:00
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
|
|
const LeftPaneWrapper = styled.div`
|
2020-09-17 07:57:19 +00:00
|
|
|
|
overflow: auto;
|
2021-10-04 15:34:37 +00:00
|
|
|
|
width: ${(props) => props.theme.homePage.sidebar}px;
|
|
|
|
|
|
height: 100%;
|
2020-09-16 11:50:47 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
|
padding-left: 16px;
|
2021-10-04 15:34:37 +00:00
|
|
|
|
padding-top: 16px;
|
2020-09-16 11:50:47 +00:00
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
position: fixed;
|
2021-10-04 15:34:37 +00:00
|
|
|
|
top: ${(props) => props.theme.homePage.header}px;
|
|
|
|
|
|
box-shadow: 1px 0px 0px #ededed;
|
2020-09-16 11:50:47 +00:00
|
|
|
|
`;
|
2022-02-17 16:38:36 +00:00
|
|
|
|
const ApplicationContainer = styled.div<{ isMobile?: boolean }>`
|
2020-12-24 04:32:25 +00:00
|
|
|
|
padding-right: ${(props) => props.theme.homePage.leftPane.rightMargin}px;
|
2021-10-05 06:33:58 +00:00
|
|
|
|
padding-top: 16px;
|
2022-02-17 16:38:36 +00:00
|
|
|
|
${({ isMobile }) =>
|
|
|
|
|
|
isMobile &&
|
|
|
|
|
|
`
|
|
|
|
|
|
margin-left: 0;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
`}
|
2020-08-03 11:44:18 +00:00
|
|
|
|
`;
|
|
|
|
|
|
|
2020-09-16 11:50:47 +00:00
|
|
|
|
const ItemWrapper = styled.div`
|
|
|
|
|
|
padding: 9px 15px;
|
|
|
|
|
|
`;
|
|
|
|
|
|
const StyledIcon = styled(Icon)`
|
|
|
|
|
|
margin-right: 11px;
|
|
|
|
|
|
`;
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const WorkspaceShareUsers = styled.div`
|
2020-11-11 13:12:05 +00:00
|
|
|
|
display: flex;
|
2021-10-04 15:34:37 +00:00
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
|
|
& .t--options-icon {
|
|
|
|
|
|
margin-left: 8px;
|
2022-03-17 10:28:54 +00:00
|
|
|
|
|
2021-10-04 15:34:37 +00:00
|
|
|
|
svg {
|
|
|
|
|
|
path {
|
|
|
|
|
|
fill: #090707;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-11-11 13:12:05 +00:00
|
|
|
|
|
2021-10-04 15:34:37 +00:00
|
|
|
|
& .t--new-button {
|
|
|
|
|
|
margin-left: 8px;
|
2020-11-11 13:12:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-10-04 15:34:37 +00:00
|
|
|
|
& button,
|
|
|
|
|
|
& a {
|
|
|
|
|
|
padding: 4px 12px;
|
2020-11-11 13:12:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
`;
|
2021-10-04 15:34:37 +00:00
|
|
|
|
|
|
|
|
|
|
const NoAppsFound = styled.div`
|
2020-11-11 13:12:05 +00:00
|
|
|
|
display: flex;
|
2021-10-04 15:34:37 +00:00
|
|
|
|
flex-direction: column;
|
2020-11-11 13:12:05 +00:00
|
|
|
|
align-items: center;
|
2021-10-04 15:34:37 +00:00
|
|
|
|
justify-content: center;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
& > span {
|
|
|
|
|
|
margin-bottom: 24px;
|
|
|
|
|
|
}
|
2020-11-11 13:12:05 +00:00
|
|
|
|
`;
|
2020-09-16 11:50:47 +00:00
|
|
|
|
|
2020-10-14 10:35:19 +00:00
|
|
|
|
function Item(props: {
|
|
|
|
|
|
label: string;
|
|
|
|
|
|
textType: TextType;
|
|
|
|
|
|
icon?: IconName;
|
|
|
|
|
|
isFetchingApplications: boolean;
|
|
|
|
|
|
}) {
|
2020-09-16 11:50:47 +00:00
|
|
|
|
return (
|
|
|
|
|
|
<ItemWrapper>
|
|
|
|
|
|
{props.icon && <StyledIcon />}
|
2020-10-14 10:35:19 +00:00
|
|
|
|
<Text
|
|
|
|
|
|
className={
|
|
|
|
|
|
props.isFetchingApplications ? BlueprintClasses.SKELETON : ""
|
|
|
|
|
|
}
|
2021-04-28 10:28:39 +00:00
|
|
|
|
type={props.textType}
|
2020-10-14 10:35:19 +00:00
|
|
|
|
>
|
|
|
|
|
|
{" "}
|
|
|
|
|
|
{props.label}
|
|
|
|
|
|
</Text>
|
2020-09-16 11:50:47 +00:00
|
|
|
|
</ItemWrapper>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2021-10-04 15:34:37 +00:00
|
|
|
|
|
|
|
|
|
|
const LeftPaneDataSection = styled.div`
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
height: calc(100vh - ${(props) => props.theme.homePage.header + 24}px);
|
2022-10-21 17:35:54 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
2021-10-04 15:34:37 +00:00
|
|
|
|
`;
|
|
|
|
|
|
|
2020-10-14 10:35:19 +00:00
|
|
|
|
function LeftPaneSection(props: {
|
|
|
|
|
|
heading: string;
|
|
|
|
|
|
children?: any;
|
|
|
|
|
|
isFetchingApplications: boolean;
|
|
|
|
|
|
}) {
|
2020-09-16 11:50:47 +00:00
|
|
|
|
return (
|
2021-10-04 15:34:37 +00:00
|
|
|
|
<LeftPaneDataSection>
|
2020-09-16 11:50:47 +00:00
|
|
|
|
{/* <MenuItem text={props.heading}/> */}
|
2020-10-14 10:35:19 +00:00
|
|
|
|
<Item
|
2021-04-28 10:28:39 +00:00
|
|
|
|
isFetchingApplications={props.isFetchingApplications}
|
2020-10-14 10:35:19 +00:00
|
|
|
|
label={props.heading}
|
2021-10-04 15:34:37 +00:00
|
|
|
|
textType={TextType.SIDE_HEAD}
|
2021-02-11 12:54:00 +00:00
|
|
|
|
/>
|
2020-09-16 11:50:47 +00:00
|
|
|
|
{props.children}
|
2021-10-04 15:34:37 +00:00
|
|
|
|
</LeftPaneDataSection>
|
2020-09-16 11:50:47 +00:00
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const StyledAnchor = styled.a`
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
top: -24px;
|
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
|
|
const WorkpsacesNavigator = styled.div`
|
2020-09-17 07:57:19 +00:00
|
|
|
|
overflow: auto;
|
2021-10-20 14:35:12 +00:00
|
|
|
|
${thinScrollbar};
|
2021-10-04 15:34:37 +00:00
|
|
|
|
/* padding-bottom: 160px; */
|
|
|
|
|
|
`;
|
|
|
|
|
|
|
2020-09-16 11:50:47 +00:00
|
|
|
|
const textIconStyles = (props: { color: string; hover: string }) => {
|
|
|
|
|
|
return `
|
|
|
|
|
|
&&&&&& {
|
|
|
|
|
|
.${Classes.TEXT},.${Classes.ICON} svg path {
|
|
|
|
|
|
color: ${props.color};
|
|
|
|
|
|
stroke: ${props.color};
|
|
|
|
|
|
fill: ${props.color};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
.${Classes.TEXT},.${Classes.ICON} svg path {
|
|
|
|
|
|
color: ${props.hover};
|
|
|
|
|
|
stroke: ${props.hover};
|
|
|
|
|
|
fill: ${props.hover};
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
`;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
function WorkspaceMenuItem({
|
|
|
|
|
|
isFetchingApplications,
|
|
|
|
|
|
selected,
|
|
|
|
|
|
workspace,
|
|
|
|
|
|
}: any) {
|
2020-12-21 09:05:58 +00:00
|
|
|
|
const menuRef = useRef<HTMLAnchorElement>(null);
|
2021-01-21 06:19:06 +00:00
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
if (selected) {
|
|
|
|
|
|
menuRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
|
|
|
|
menuRef.current?.click();
|
|
|
|
|
|
}
|
|
|
|
|
|
}, [selected]);
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<MenuItem
|
2021-09-07 09:15:11 +00:00
|
|
|
|
containerClassName={
|
|
|
|
|
|
isFetchingApplications ? BlueprintClasses.SKELETON : ""
|
|
|
|
|
|
}
|
2021-04-28 10:28:39 +00:00
|
|
|
|
ellipsize={20}
|
2022-06-15 15:37:41 +00:00
|
|
|
|
href={`${window.location.pathname}#${workspace.workspace.id}`}
|
2021-01-21 06:19:06 +00:00
|
|
|
|
icon="workspace"
|
2022-06-15 15:37:41 +00:00
|
|
|
|
key={workspace.workspace.id}
|
2021-04-28 10:28:39 +00:00
|
|
|
|
ref={menuRef}
|
2021-01-21 06:19:06 +00:00
|
|
|
|
selected={selected}
|
2022-06-15 15:37:41 +00:00
|
|
|
|
text={workspace.workspace.name}
|
2022-03-23 05:38:57 +00:00
|
|
|
|
tooltipPos={Position.BOTTOM_LEFT}
|
2021-01-21 06:19:06 +00:00
|
|
|
|
/>
|
|
|
|
|
|
);
|
2021-04-28 10:28:39 +00:00
|
|
|
|
}
|
2021-01-21 06:19:06 +00:00
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const submitCreateWorkspaceForm = async (data: any, dispatch: any) => {
|
|
|
|
|
|
const result = await createWorkspaceSubmitHandler(data, dispatch);
|
2021-05-05 07:10:35 +00:00
|
|
|
|
return result;
|
|
|
|
|
|
};
|
2021-06-02 09:56:22 +00:00
|
|
|
|
|
2021-01-21 06:19:06 +00:00
|
|
|
|
function LeftPane() {
|
2021-05-05 07:10:35 +00:00
|
|
|
|
const dispatch = useDispatch();
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const fetchedUserWorkspaces = useSelector(getUserApplicationsWorkspaces);
|
2020-10-14 10:35:19 +00:00
|
|
|
|
const isFetchingApplications = useSelector(getIsFetchingApplications);
|
2022-02-17 16:38:36 +00:00
|
|
|
|
const isMobile = useIsMobileDevice();
|
2022-12-01 06:30:50 +00:00
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
let userWorkspaces;
|
2020-10-14 10:35:19 +00:00
|
|
|
|
if (!isFetchingApplications) {
|
2022-06-15 15:37:41 +00:00
|
|
|
|
userWorkspaces = fetchedUserWorkspaces;
|
2020-10-14 10:35:19 +00:00
|
|
|
|
} else {
|
2022-06-15 15:37:41 +00:00
|
|
|
|
userWorkspaces = loadingUserWorkspaces as any;
|
2020-10-14 10:35:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-01 06:30:50 +00:00
|
|
|
|
const tenantPermissions = useSelector(getTenantPermissions);
|
|
|
|
|
|
const canCreateWorkspace = isPermitted(
|
|
|
|
|
|
tenantPermissions,
|
|
|
|
|
|
PERMISSION_TYPE.CREATE_WORKSPACE,
|
|
|
|
|
|
);
|
|
|
|
|
|
|
2021-01-21 06:19:06 +00:00
|
|
|
|
const location = useLocation();
|
|
|
|
|
|
const urlHash = location.hash.slice(1);
|
2020-12-21 09:05:58 +00:00
|
|
|
|
|
2022-02-17 16:38:36 +00:00
|
|
|
|
if (isMobile) return null;
|
|
|
|
|
|
|
2020-09-16 11:50:47 +00:00
|
|
|
|
return (
|
|
|
|
|
|
<LeftPaneWrapper>
|
2020-10-14 10:35:19 +00:00
|
|
|
|
<LeftPaneSection
|
2022-06-15 15:37:41 +00:00
|
|
|
|
heading={createMessage(WORKSPACES_HEADING)}
|
2020-10-14 10:35:19 +00:00
|
|
|
|
isFetchingApplications={isFetchingApplications}
|
|
|
|
|
|
>
|
2020-10-28 05:39:28 +00:00
|
|
|
|
<WorkpsacesNavigator data-cy="t--left-panel">
|
2022-12-01 06:30:50 +00:00
|
|
|
|
{!isFetchingApplications &&
|
|
|
|
|
|
fetchedUserWorkspaces &&
|
|
|
|
|
|
canCreateWorkspace && (
|
|
|
|
|
|
<MenuItem
|
|
|
|
|
|
cypressSelector="t--workspace-new-workspace-auto-create"
|
|
|
|
|
|
icon="plus"
|
|
|
|
|
|
onSelect={() =>
|
|
|
|
|
|
submitCreateWorkspaceForm(
|
|
|
|
|
|
{
|
|
|
|
|
|
name: getNextEntityName(
|
|
|
|
|
|
"Untitled workspace ",
|
|
|
|
|
|
fetchedUserWorkspaces.map(
|
|
|
|
|
|
(el: any) => el.workspace.name,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
},
|
|
|
|
|
|
dispatch,
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
text={CREATE_WORKSPACE_FORM_NAME}
|
|
|
|
|
|
/>
|
|
|
|
|
|
)}
|
2022-06-15 15:37:41 +00:00
|
|
|
|
{userWorkspaces &&
|
|
|
|
|
|
userWorkspaces.map((workspace: any) => (
|
|
|
|
|
|
<WorkspaceMenuItem
|
2021-11-23 08:01:46 +00:00
|
|
|
|
isFetchingApplications={isFetchingApplications}
|
2022-06-15 15:37:41 +00:00
|
|
|
|
key={workspace.workspace.id}
|
|
|
|
|
|
selected={urlHash === workspace.workspace.id}
|
|
|
|
|
|
workspace={workspace}
|
2021-11-23 08:01:46 +00:00
|
|
|
|
/>
|
|
|
|
|
|
))}
|
2021-10-04 15:34:37 +00:00
|
|
|
|
</WorkpsacesNavigator>
|
2022-03-03 10:56:53 +00:00
|
|
|
|
<LeftPaneBottomSection />
|
2020-09-16 11:50:47 +00:00
|
|
|
|
</LeftPaneSection>
|
|
|
|
|
|
</LeftPaneWrapper>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const CreateNewLabel = styled(Text)`
|
|
|
|
|
|
margin-top: 18px;
|
|
|
|
|
|
`;
|
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const WorkspaceNameElement = styled(Text)<{ isMobile?: boolean }>`
|
2022-02-17 16:38:36 +00:00
|
|
|
|
max-width: ${({ isMobile }) => (isMobile ? 220 : 500)}px;
|
2021-03-16 18:48:36 +00:00
|
|
|
|
${truncateTextUsingEllipsis}
|
2020-10-08 09:49:15 +00:00
|
|
|
|
`;
|
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const WorkspaceNameHolder = styled(Text)`
|
2020-10-08 09:49:15 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
`;
|
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const WorkspaceNameWrapper = styled.div<{ disabled?: boolean }>`
|
2021-11-30 10:38:46 +00:00
|
|
|
|
${(props) => {
|
|
|
|
|
|
const color = props.disabled
|
2022-06-15 15:37:41 +00:00
|
|
|
|
? props.theme.colors.applications.workspaceColor
|
|
|
|
|
|
: props.theme.colors.applications.hover.workspaceColor[9];
|
2021-11-30 10:38:46 +00:00
|
|
|
|
return `${textIconStyles({
|
|
|
|
|
|
color: color,
|
|
|
|
|
|
hover: color,
|
|
|
|
|
|
})}`;
|
|
|
|
|
|
}}
|
|
|
|
|
|
.${Classes.ICON} {
|
|
|
|
|
|
display: ${(props) => (!props.disabled ? "inline" : "none")};
|
|
|
|
|
|
margin-left: 8px;
|
|
|
|
|
|
color: ${(props) => props.theme.colors.applications.iconColor};
|
|
|
|
|
|
}
|
2020-06-11 11:31:32 +00:00
|
|
|
|
`;
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const WorkspaceRename = styled(EditableText)`
|
2020-11-25 12:24:14 +00:00
|
|
|
|
padding: 0 2px;
|
|
|
|
|
|
`;
|
2020-06-11 11:31:32 +00:00
|
|
|
|
|
2020-10-19 12:11:14 +00:00
|
|
|
|
const NoSearchResultImg = styled.img`
|
|
|
|
|
|
margin: 1em;
|
|
|
|
|
|
`;
|
|
|
|
|
|
|
2022-03-03 10:56:53 +00:00
|
|
|
|
const ApplicationsWrapper = styled.div<{ isMobile: boolean }>`
|
|
|
|
|
|
height: calc(100vh - ${(props) => props.theme.homePage.search.height - 40}px);
|
|
|
|
|
|
overflow: auto;
|
|
|
|
|
|
margin-left: ${(props) =>
|
|
|
|
|
|
props.theme.homePage.leftPane.width +
|
|
|
|
|
|
props.theme.homePage.leftPane.rightMargin +
|
|
|
|
|
|
props.theme.homePage.leftPane.leftPadding}px;
|
|
|
|
|
|
width: calc(
|
|
|
|
|
|
100% -
|
|
|
|
|
|
${(props) =>
|
|
|
|
|
|
props.theme.homePage.leftPane.width +
|
|
|
|
|
|
props.theme.homePage.leftPane.rightMargin +
|
|
|
|
|
|
props.theme.homePage.leftPane.leftPadding}px
|
|
|
|
|
|
);
|
|
|
|
|
|
scroll-behavior: smooth;
|
|
|
|
|
|
${({ isMobile }) =>
|
|
|
|
|
|
isMobile &&
|
|
|
|
|
|
`
|
|
|
|
|
|
margin-left: 0;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
`}
|
|
|
|
|
|
`;
|
|
|
|
|
|
|
2021-04-28 10:28:39 +00:00
|
|
|
|
function ApplicationsSection(props: any) {
|
2021-06-03 06:18:08 +00:00
|
|
|
|
const enableImportExport = true;
|
2020-09-16 11:50:47 +00:00
|
|
|
|
const dispatch = useDispatch();
|
2021-02-11 12:54:00 +00:00
|
|
|
|
const theme = useContext(ThemeContext);
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const isSavingWorkspaceInfo = useSelector(getIsSavingWorkspaceInfo);
|
2020-10-14 10:35:19 +00:00
|
|
|
|
const isFetchingApplications = useSelector(getIsFetchingApplications);
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const userWorkspaces = useSelector(getUserApplicationsWorkspacesList);
|
2020-10-14 10:35:19 +00:00
|
|
|
|
const creatingApplicationMap = useSelector(getIsCreatingApplication);
|
2020-09-16 11:50:47 +00:00
|
|
|
|
const currentUser = useSelector(getCurrentUser);
|
2022-02-17 16:38:36 +00:00
|
|
|
|
const isMobile = useIsMobileDevice();
|
2020-11-25 12:24:14 +00:00
|
|
|
|
const deleteApplication = (applicationId: string) => {
|
2020-09-16 11:50:47 +00:00
|
|
|
|
if (applicationId && applicationId.length > 0) {
|
|
|
|
|
|
dispatch({
|
|
|
|
|
|
type: ReduxActionTypes.DELETE_APPLICATION_INIT,
|
|
|
|
|
|
payload: {
|
|
|
|
|
|
applicationId,
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const [warnLeavingWorkspace, setWarnLeavingWorkspace] = useState(false);
|
|
|
|
|
|
const [warnDeleteWorkspace, setWarnDeleteWorkspace] = useState(false);
|
|
|
|
|
|
const [workspaceToOpenMenu, setWorkspaceToOpenMenu] = useState<string | null>(
|
|
|
|
|
|
null,
|
|
|
|
|
|
);
|
2020-09-16 11:50:47 +00:00
|
|
|
|
const updateApplicationDispatch = (
|
|
|
|
|
|
id: string,
|
|
|
|
|
|
data: UpdateApplicationPayload,
|
|
|
|
|
|
) => {
|
|
|
|
|
|
dispatch(updateApplication(id, data));
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2022-03-28 18:30:05 +00:00
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
// Clears URL params cache
|
2022-07-11 04:06:29 +00:00
|
|
|
|
urlBuilder.resetURLParams();
|
2022-03-28 18:30:05 +00:00
|
|
|
|
}, []);
|
|
|
|
|
|
|
2020-09-16 11:50:47 +00:00
|
|
|
|
const duplicateApplicationDispatch = (applicationId: string) => {
|
|
|
|
|
|
dispatch(duplicateApplication(applicationId));
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const [selectedWorkspaceId, setSelectedWorkspaceId] = useState<
|
|
|
|
|
|
string | undefined
|
|
|
|
|
|
>();
|
2021-06-03 06:18:08 +00:00
|
|
|
|
const [
|
2022-06-15 15:37:41 +00:00
|
|
|
|
selectedWorkspaceIdForImportApplication,
|
|
|
|
|
|
setSelectedWorkspaceIdForImportApplication,
|
2021-06-03 06:18:08 +00:00
|
|
|
|
] = useState<string | undefined>();
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const Form: any = WorkspaceInviteUsersForm;
|
2020-11-25 12:24:14 +00:00
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const leaveWS = (workspaceId: string) => {
|
|
|
|
|
|
setWarnLeavingWorkspace(false);
|
|
|
|
|
|
setWorkspaceToOpenMenu(null);
|
|
|
|
|
|
dispatch(leaveWorkspace(workspaceId));
|
2021-06-02 09:56:22 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const handleDeleteWorkspace = useCallback(
|
|
|
|
|
|
(workspaceId: string) => {
|
|
|
|
|
|
setWarnDeleteWorkspace(false);
|
|
|
|
|
|
setWorkspaceToOpenMenu(null);
|
|
|
|
|
|
dispatch(deleteWorkspace(workspaceId));
|
2021-12-20 05:58:01 +00:00
|
|
|
|
},
|
|
|
|
|
|
[dispatch],
|
|
|
|
|
|
);
|
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const WorkspaceNameChange = (newName: string, workspaceId: string) => {
|
2020-11-25 12:24:14 +00:00
|
|
|
|
dispatch(
|
2022-06-15 15:37:41 +00:00
|
|
|
|
saveWorkspace({
|
|
|
|
|
|
id: workspaceId as string,
|
2020-11-25 12:24:14 +00:00
|
|
|
|
name: newName,
|
|
|
|
|
|
}),
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
function WorkspaceMenuTarget(props: {
|
|
|
|
|
|
workspaceName: string;
|
2021-01-21 06:19:06 +00:00
|
|
|
|
disabled?: boolean;
|
2022-06-15 15:37:41 +00:00
|
|
|
|
workspaceSlug: string;
|
2021-04-28 10:28:39 +00:00
|
|
|
|
}) {
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const { disabled, workspaceName, workspaceSlug } = props;
|
2020-09-16 11:50:47 +00:00
|
|
|
|
|
2021-02-11 12:54:00 +00:00
|
|
|
|
return (
|
2022-06-15 15:37:41 +00:00
|
|
|
|
<WorkspaceNameWrapper
|
|
|
|
|
|
className="t--workspace-name-text"
|
|
|
|
|
|
disabled={disabled}
|
|
|
|
|
|
>
|
|
|
|
|
|
<StyledAnchor id={workspaceSlug} />
|
|
|
|
|
|
<WorkspaceNameHolder
|
2020-10-14 10:35:19 +00:00
|
|
|
|
className={isFetchingApplications ? BlueprintClasses.SKELETON : ""}
|
2021-04-28 10:28:39 +00:00
|
|
|
|
type={TextType.H1}
|
2020-10-14 10:35:19 +00:00
|
|
|
|
>
|
2022-06-15 15:37:41 +00:00
|
|
|
|
<WorkspaceNameElement
|
2020-10-14 10:35:19 +00:00
|
|
|
|
className={isFetchingApplications ? BlueprintClasses.SKELETON : ""}
|
2022-02-17 16:38:36 +00:00
|
|
|
|
isMobile={isMobile}
|
2021-04-28 10:28:39 +00:00
|
|
|
|
type={TextType.H1}
|
2020-10-14 10:35:19 +00:00
|
|
|
|
>
|
2022-06-15 15:37:41 +00:00
|
|
|
|
{workspaceName}
|
|
|
|
|
|
</WorkspaceNameElement>
|
|
|
|
|
|
</WorkspaceNameHolder>
|
|
|
|
|
|
</WorkspaceNameWrapper>
|
2020-09-16 11:50:47 +00:00
|
|
|
|
);
|
2021-04-28 10:28:39 +00:00
|
|
|
|
}
|
2020-09-16 11:50:47 +00:00
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
const createNewApplication = (
|
|
|
|
|
|
applicationName: string,
|
|
|
|
|
|
workspaceId: string,
|
|
|
|
|
|
) => {
|
2021-02-11 12:54:00 +00:00
|
|
|
|
const color = getRandomPaletteColor(theme.colors.appCardColors);
|
2020-12-09 07:06:02 +00:00
|
|
|
|
const icon =
|
|
|
|
|
|
AppIconCollection[Math.floor(Math.random() * AppIconCollection.length)];
|
|
|
|
|
|
|
2020-10-14 10:35:19 +00:00
|
|
|
|
return dispatch({
|
|
|
|
|
|
type: ReduxActionTypes.CREATE_APPLICATION_INIT,
|
|
|
|
|
|
payload: {
|
|
|
|
|
|
applicationName,
|
2022-06-15 15:37:41 +00:00
|
|
|
|
workspaceId,
|
2020-12-09 07:06:02 +00:00
|
|
|
|
icon,
|
|
|
|
|
|
color,
|
2020-10-14 10:35:19 +00:00
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
let updatedWorkspaces;
|
2020-10-14 10:35:19 +00:00
|
|
|
|
if (!isFetchingApplications) {
|
2022-06-15 15:37:41 +00:00
|
|
|
|
updatedWorkspaces = userWorkspaces;
|
2020-10-14 10:35:19 +00:00
|
|
|
|
} else {
|
2022-06-15 15:37:41 +00:00
|
|
|
|
updatedWorkspaces = loadingUserWorkspaces as any;
|
2020-10-14 10:35:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-06-15 15:37:41 +00:00
|
|
|
|
let workspacesListComponent;
|
2020-10-19 12:11:14 +00:00
|
|
|
|
if (
|
|
|
|
|
|
!isFetchingApplications &&
|
|
|
|
|
|
props.searchKeyword &&
|
|
|
|
|
|
props.searchKeyword.trim().length > 0 &&
|
2022-06-15 15:37:41 +00:00
|
|
|
|
updatedWorkspaces.length === 0
|
2020-10-19 12:11:14 +00:00
|
|
|
|
) {
|
2022-06-15 15:37:41 +00:00
|
|
|
|
workspacesListComponent = (
|
2021-09-29 05:53:24 +00:00
|
|
|
|
<CenteredWrapper
|
|
|
|
|
|
style={{
|
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
|
position: "static",
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
2020-10-19 12:11:14 +00:00
|
|
|
|
<CreateNewLabel type={TextType.H4}>
|
2021-09-15 12:20:25 +00:00
|
|
|
|
{createMessage(NO_APPS_FOUND)}
|
2020-10-19 12:11:14 +00:00
|
|
|
|
</CreateNewLabel>
|
2021-04-28 10:28:39 +00:00
|
|
|
|
<NoSearchResultImg alt="No result found" src={NoSearchImage} />
|
2020-10-19 12:11:14 +00:00
|
|
|
|
</CenteredWrapper>
|
|
|
|
|
|
);
|
|
|
|
|
|
} else {
|
2022-06-15 15:37:41 +00:00
|
|
|
|
workspacesListComponent = updatedWorkspaces.map(
|
|
|
|
|
|
(workspaceObject: any, index: number) => {
|
|
|
|
|
|
const { applications, workspace } = workspaceObject;
|
|
|
|
|
|
const hasManageWorkspacePermissions = isPermitted(
|
|
|
|
|
|
workspace.userPermissions,
|
|
|
|
|
|
PERMISSION_TYPE.MANAGE_WORKSPACE,
|
2020-10-19 12:11:14 +00:00
|
|
|
|
);
|
2022-08-29 09:16:24 +00:00
|
|
|
|
const hasCreateNewApplicationPermission =
|
2022-12-01 06:30:50 +00:00
|
|
|
|
hasCreateNewAppPermission(workspace.userPermissions) && !isMobile;
|
2022-08-29 09:16:24 +00:00
|
|
|
|
|
|
|
|
|
|
const onClickAddNewButton = (workspaceId: string) => {
|
|
|
|
|
|
if (
|
|
|
|
|
|
Object.entries(creatingApplicationMap).length === 0 ||
|
|
|
|
|
|
(creatingApplicationMap && !creatingApplicationMap[workspaceId])
|
|
|
|
|
|
) {
|
|
|
|
|
|
createNewApplication(
|
|
|
|
|
|
getNextEntityName(
|
|
|
|
|
|
"Untitled application ",
|
|
|
|
|
|
applications.map((el: any) => el.name),
|
|
|
|
|
|
),
|
|
|
|
|
|
workspaceId,
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2020-10-19 12:11:14 +00:00
|
|
|
|
return (
|
2022-06-15 15:37:41 +00:00
|
|
|
|
<WorkspaceSection
|
|
|
|
|
|
className="t--workspace-section"
|
2022-02-17 16:38:36 +00:00
|
|
|
|
isMobile={isMobile}
|
|
|
|
|
|
key={index}
|
|
|
|
|
|
>
|
2022-06-15 15:37:41 +00:00
|
|
|
|
<WorkspaceDropDown isMobile={isMobile}>
|
2021-10-04 15:34:37 +00:00
|
|
|
|
{(currentUser || isFetchingApplications) &&
|
2022-06-15 15:37:41 +00:00
|
|
|
|
WorkspaceMenuTarget({
|
|
|
|
|
|
workspaceName: workspace.name,
|
|
|
|
|
|
workspaceSlug: workspace.id,
|
2021-10-04 15:34:37 +00:00
|
|
|
|
})}
|
2022-06-15 15:37:41 +00:00
|
|
|
|
{hasManageWorkspacePermissions && (
|
2021-10-04 15:34:37 +00:00
|
|
|
|
<Dialog
|
2020-10-19 12:11:14 +00:00
|
|
|
|
canEscapeKeyClose={false}
|
2021-10-11 06:01:05 +00:00
|
|
|
|
canOutsideClickClose
|
2022-06-15 15:37:41 +00:00
|
|
|
|
isOpen={selectedWorkspaceId === workspace.id}
|
|
|
|
|
|
onClose={() => setSelectedWorkspaceId("")}
|
|
|
|
|
|
title={`Invite Users to ${workspace.name}`}
|
2020-10-19 12:11:14 +00:00
|
|
|
|
>
|
2022-09-02 17:15:08 +00:00
|
|
|
|
<Form
|
|
|
|
|
|
message={createMessage(INVITE_USERS_MESSAGE)}
|
|
|
|
|
|
workspaceId={workspace.id}
|
|
|
|
|
|
/>
|
2021-10-04 15:34:37 +00:00
|
|
|
|
</Dialog>
|
2020-10-19 12:11:14 +00:00
|
|
|
|
)}
|
2022-06-15 15:37:41 +00:00
|
|
|
|
{selectedWorkspaceIdForImportApplication && (
|
2022-03-17 10:28:54 +00:00
|
|
|
|
<ImportApplicationModal
|
|
|
|
|
|
isModalOpen={
|
2022-06-15 15:37:41 +00:00
|
|
|
|
selectedWorkspaceIdForImportApplication === workspace.id
|
2022-03-17 10:28:54 +00:00
|
|
|
|
}
|
2022-06-15 15:37:41 +00:00
|
|
|
|
onClose={() => setSelectedWorkspaceIdForImportApplication("")}
|
|
|
|
|
|
workspaceId={selectedWorkspaceIdForImportApplication}
|
2022-03-17 10:28:54 +00:00
|
|
|
|
/>
|
|
|
|
|
|
)}
|
2022-12-01 06:30:50 +00:00
|
|
|
|
{!isFetchingApplications && (
|
|
|
|
|
|
<WorkspaceShareUsers>
|
|
|
|
|
|
<SharedUserList workspaceId={workspace.id} />
|
|
|
|
|
|
{isPermitted(
|
|
|
|
|
|
workspace.userPermissions,
|
|
|
|
|
|
PERMISSION_TYPE.INVITE_USER_TO_WORKSPACE,
|
|
|
|
|
|
) &&
|
|
|
|
|
|
!isMobile && (
|
2022-02-17 16:38:36 +00:00
|
|
|
|
<FormDialogComponent
|
2022-06-15 15:37:41 +00:00
|
|
|
|
Form={WorkspaceInviteUsersForm}
|
2022-02-17 16:38:36 +00:00
|
|
|
|
canOutsideClickClose
|
2022-09-02 17:15:08 +00:00
|
|
|
|
message={createMessage(INVITE_USERS_MESSAGE)}
|
|
|
|
|
|
placeholder={createMessage(INVITE_USERS_PLACEHOLDER)}
|
2022-06-15 15:37:41 +00:00
|
|
|
|
title={`Invite Users to ${workspace.name}`}
|
2022-02-17 16:38:36 +00:00
|
|
|
|
trigger={
|
|
|
|
|
|
<Button
|
|
|
|
|
|
category={Category.tertiary}
|
2022-02-18 09:51:02 +00:00
|
|
|
|
icon={"share-line"}
|
2022-02-17 16:38:36 +00:00
|
|
|
|
size={Size.medium}
|
|
|
|
|
|
tag="button"
|
|
|
|
|
|
text={"Share"}
|
|
|
|
|
|
/>
|
|
|
|
|
|
}
|
2022-06-15 15:37:41 +00:00
|
|
|
|
workspaceId={workspace.id}
|
2022-02-17 16:38:36 +00:00
|
|
|
|
/>
|
|
|
|
|
|
)}
|
2022-12-01 06:30:50 +00:00
|
|
|
|
{hasCreateNewApplicationPermission &&
|
|
|
|
|
|
!isFetchingApplications &&
|
|
|
|
|
|
applications.length !== 0 && (
|
|
|
|
|
|
<Button
|
|
|
|
|
|
className="t--new-button createnew"
|
|
|
|
|
|
icon={"plus"}
|
|
|
|
|
|
isLoading={
|
|
|
|
|
|
creatingApplicationMap &&
|
|
|
|
|
|
creatingApplicationMap[workspace.id]
|
2021-10-04 15:34:37 +00:00
|
|
|
|
}
|
2022-12-01 06:30:50 +00:00
|
|
|
|
onClick={() => onClickAddNewButton(workspace.id)}
|
|
|
|
|
|
size={Size.medium}
|
|
|
|
|
|
tag="button"
|
|
|
|
|
|
text={"New"}
|
|
|
|
|
|
/>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{(currentUser || isFetchingApplications) && !isMobile && (
|
|
|
|
|
|
<Menu
|
|
|
|
|
|
autoFocus={false}
|
|
|
|
|
|
className="t--workspace-name"
|
|
|
|
|
|
closeOnItemClick
|
|
|
|
|
|
cypressSelector="t--workspace-name"
|
|
|
|
|
|
disabled={isFetchingApplications}
|
|
|
|
|
|
isOpen={workspace.id === workspaceToOpenMenu}
|
|
|
|
|
|
onClose={() => {
|
|
|
|
|
|
setWorkspaceToOpenMenu(null);
|
|
|
|
|
|
}}
|
|
|
|
|
|
onClosing={() => {
|
|
|
|
|
|
setWarnLeavingWorkspace(false);
|
|
|
|
|
|
setWarnDeleteWorkspace(false);
|
|
|
|
|
|
}}
|
|
|
|
|
|
position={Position.BOTTOM_RIGHT}
|
|
|
|
|
|
target={
|
|
|
|
|
|
<Icon
|
|
|
|
|
|
className="t--options-icon"
|
|
|
|
|
|
name="context-menu"
|
|
|
|
|
|
onClick={() => {
|
|
|
|
|
|
setWorkspaceToOpenMenu(workspace.id);
|
|
|
|
|
|
}}
|
|
|
|
|
|
size={IconSize.XXXL}
|
|
|
|
|
|
/>
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
|
|
|
|
|
{hasManageWorkspacePermissions && (
|
|
|
|
|
|
<>
|
|
|
|
|
|
<div className="px-3 py-2">
|
|
|
|
|
|
<WorkspaceRename
|
|
|
|
|
|
cypressSelector="t--workspace-rename-input"
|
|
|
|
|
|
defaultValue={workspace.name}
|
|
|
|
|
|
editInteractionKind={EditInteractionKind.SINGLE}
|
|
|
|
|
|
fill
|
|
|
|
|
|
hideEditIcon={false}
|
|
|
|
|
|
isEditingDefault={false}
|
|
|
|
|
|
isInvalid={(value: string) => {
|
|
|
|
|
|
return notEmptyValidator(value).message;
|
|
|
|
|
|
}}
|
|
|
|
|
|
onBlur={(value: string) => {
|
|
|
|
|
|
WorkspaceNameChange(value, workspace.id);
|
|
|
|
|
|
}}
|
|
|
|
|
|
placeholder="Workspace name"
|
|
|
|
|
|
savingState={
|
|
|
|
|
|
isSavingWorkspaceInfo
|
|
|
|
|
|
? SavingState.STARTED
|
|
|
|
|
|
: SavingState.NOT_STARTED
|
2022-06-15 15:37:41 +00:00
|
|
|
|
}
|
2022-12-01 06:30:50 +00:00
|
|
|
|
underline
|
2021-10-04 15:34:37 +00:00
|
|
|
|
/>
|
2022-12-01 06:30:50 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
<MenuItem
|
|
|
|
|
|
cypressSelector="t--workspace-setting"
|
|
|
|
|
|
icon="settings-2-line"
|
|
|
|
|
|
onSelect={() =>
|
|
|
|
|
|
getOnSelectAction(
|
|
|
|
|
|
DropdownOnSelectActions.REDIRECT,
|
|
|
|
|
|
{
|
|
|
|
|
|
path: `/workspace/${workspace.id}/settings/general`,
|
|
|
|
|
|
},
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
text="Settings"
|
|
|
|
|
|
/>
|
|
|
|
|
|
{enableImportExport && (
|
2021-10-04 15:34:37 +00:00
|
|
|
|
<MenuItem
|
2022-12-01 06:30:50 +00:00
|
|
|
|
cypressSelector="t--workspace-import-app"
|
|
|
|
|
|
icon="download"
|
2021-10-04 15:34:37 +00:00
|
|
|
|
onSelect={() =>
|
2022-12-01 06:30:50 +00:00
|
|
|
|
setSelectedWorkspaceIdForImportApplication(
|
|
|
|
|
|
workspace.id,
|
2021-10-04 15:34:37 +00:00
|
|
|
|
)
|
|
|
|
|
|
}
|
2022-12-01 06:30:50 +00:00
|
|
|
|
text="Import"
|
2022-06-15 15:37:41 +00:00
|
|
|
|
/>
|
|
|
|
|
|
)}
|
2022-12-01 06:30:50 +00:00
|
|
|
|
<MenuItem
|
|
|
|
|
|
icon="share-line"
|
|
|
|
|
|
onSelect={() =>
|
|
|
|
|
|
setSelectedWorkspaceId(workspace.id)
|
|
|
|
|
|
}
|
|
|
|
|
|
text="Share"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<MenuItem
|
|
|
|
|
|
icon="member"
|
|
|
|
|
|
onSelect={() =>
|
|
|
|
|
|
getOnSelectAction(
|
|
|
|
|
|
DropdownOnSelectActions.REDIRECT,
|
|
|
|
|
|
{
|
|
|
|
|
|
path: `/workspace/${workspace.id}/settings/members`,
|
|
|
|
|
|
},
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
text="Members"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</>
|
|
|
|
|
|
)}
|
|
|
|
|
|
<MenuItem
|
|
|
|
|
|
icon="logout"
|
|
|
|
|
|
onSelect={(e: React.MouseEvent) => {
|
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
!warnLeavingWorkspace
|
|
|
|
|
|
? setWarnLeavingWorkspace(true)
|
|
|
|
|
|
: leaveWS(workspace.id);
|
|
|
|
|
|
}}
|
|
|
|
|
|
text={
|
|
|
|
|
|
!warnLeavingWorkspace
|
|
|
|
|
|
? "Leave Workspace"
|
|
|
|
|
|
: "Are you sure?"
|
|
|
|
|
|
}
|
|
|
|
|
|
type={!warnLeavingWorkspace ? undefined : "warning"}
|
|
|
|
|
|
/>
|
|
|
|
|
|
{applications.length === 0 &&
|
|
|
|
|
|
hasManageWorkspacePermissions && (
|
|
|
|
|
|
<MenuItem
|
|
|
|
|
|
icon="trash"
|
|
|
|
|
|
onSelect={(e: React.MouseEvent) => {
|
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
warnDeleteWorkspace
|
|
|
|
|
|
? handleDeleteWorkspace(workspace.id)
|
|
|
|
|
|
: setWarnDeleteWorkspace(true);
|
|
|
|
|
|
}}
|
|
|
|
|
|
text={
|
|
|
|
|
|
!warnDeleteWorkspace
|
|
|
|
|
|
? "Delete Workspace"
|
|
|
|
|
|
: "Are you sure?"
|
|
|
|
|
|
}
|
|
|
|
|
|
type={!warnDeleteWorkspace ? undefined : "warning"}
|
|
|
|
|
|
/>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</Menu>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</WorkspaceShareUsers>
|
|
|
|
|
|
)}
|
2022-06-15 15:37:41 +00:00
|
|
|
|
</WorkspaceDropDown>
|
|
|
|
|
|
<ApplicationCardsWrapper isMobile={isMobile} key={workspace.id}>
|
2020-10-19 12:11:14 +00:00
|
|
|
|
{applications.map((application: any) => {
|
|
|
|
|
|
return (
|
2022-02-17 16:38:36 +00:00
|
|
|
|
<PaddingWrapper isMobile={isMobile} key={application.id}>
|
2021-03-02 05:55:45 +00:00
|
|
|
|
<ApplicationCard
|
|
|
|
|
|
application={application}
|
|
|
|
|
|
delete={deleteApplication}
|
|
|
|
|
|
duplicate={duplicateApplicationDispatch}
|
2021-06-03 06:18:08 +00:00
|
|
|
|
enableImportExport={enableImportExport}
|
2022-12-01 21:26:21 +00:00
|
|
|
|
hasCreateNewApplicationPermission={
|
|
|
|
|
|
hasCreateNewApplicationPermission
|
|
|
|
|
|
}
|
2022-02-17 16:38:36 +00:00
|
|
|
|
isMobile={isMobile}
|
2021-04-28 10:28:39 +00:00
|
|
|
|
key={application.id}
|
|
|
|
|
|
update={updateApplicationDispatch}
|
2021-03-02 05:55:45 +00:00
|
|
|
|
/>
|
|
|
|
|
|
</PaddingWrapper>
|
2020-10-19 12:11:14 +00:00
|
|
|
|
);
|
|
|
|
|
|
})}
|
2021-10-04 15:34:37 +00:00
|
|
|
|
{applications.length === 0 && (
|
|
|
|
|
|
<NoAppsFound>
|
|
|
|
|
|
<NoAppsFoundIcon />
|
2022-07-20 11:54:16 +00:00
|
|
|
|
<span>There’s nothing inside this workspace</span>
|
2021-10-04 15:34:37 +00:00
|
|
|
|
{/* below component is duplicate. This is because of cypress test were failing */}
|
2022-08-29 09:16:24 +00:00
|
|
|
|
{hasCreateNewApplicationPermission && (
|
2022-02-17 16:38:36 +00:00
|
|
|
|
<Button
|
|
|
|
|
|
className="t--new-button createnew"
|
|
|
|
|
|
icon={"plus"}
|
|
|
|
|
|
isLoading={
|
|
|
|
|
|
creatingApplicationMap &&
|
2022-06-15 15:37:41 +00:00
|
|
|
|
creatingApplicationMap[workspace.id]
|
2021-10-04 15:34:37 +00:00
|
|
|
|
}
|
2022-08-29 09:16:24 +00:00
|
|
|
|
onClick={() => onClickAddNewButton(workspace.id)}
|
2022-02-17 16:38:36 +00:00
|
|
|
|
size={Size.medium}
|
|
|
|
|
|
tag="button"
|
|
|
|
|
|
text={"New"}
|
|
|
|
|
|
/>
|
|
|
|
|
|
)}
|
2021-10-04 15:34:37 +00:00
|
|
|
|
</NoAppsFound>
|
|
|
|
|
|
)}
|
2020-10-19 12:11:14 +00:00
|
|
|
|
</ApplicationCardsWrapper>
|
2022-06-15 15:37:41 +00:00
|
|
|
|
</WorkspaceSection>
|
2020-10-19 12:11:14 +00:00
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
2022-02-17 16:38:36 +00:00
|
|
|
|
<ApplicationContainer
|
|
|
|
|
|
className="t--applications-container"
|
|
|
|
|
|
isMobile={isMobile}
|
|
|
|
|
|
>
|
2022-06-15 15:37:41 +00:00
|
|
|
|
{workspacesListComponent}
|
2022-11-01 14:59:42 +00:00
|
|
|
|
<>
|
|
|
|
|
|
<GitSyncModal isImport />
|
|
|
|
|
|
<DisconnectGitModal />
|
|
|
|
|
|
</>
|
2022-03-23 05:38:57 +00:00
|
|
|
|
<ReconnectDatasourceModal />
|
2020-09-16 11:50:47 +00:00
|
|
|
|
</ApplicationContainer>
|
|
|
|
|
|
);
|
2021-04-28 10:28:39 +00:00
|
|
|
|
}
|
2022-03-17 10:28:54 +00:00
|
|
|
|
|
2019-11-07 04:59:40 +00:00
|
|
|
|
type ApplicationProps = {
|
|
|
|
|
|
applicationList: ApplicationPayload[];
|
2020-09-16 11:50:47 +00:00
|
|
|
|
searchApplications: (keyword: string) => void;
|
2020-10-14 10:35:19 +00:00
|
|
|
|
isCreatingApplication: creatingApplicationMap;
|
2019-11-21 10:52:49 +00:00
|
|
|
|
isFetchingApplications: boolean;
|
|
|
|
|
|
createApplicationError?: string;
|
2020-01-27 08:24:58 +00:00
|
|
|
|
deleteApplication: (id: string) => void;
|
2020-02-03 12:19:10 +00:00
|
|
|
|
deletingApplication: boolean;
|
2020-09-01 07:16:54 +00:00
|
|
|
|
duplicatingApplication: boolean;
|
2020-05-27 13:36:06 +00:00
|
|
|
|
getAllApplication: () => void;
|
2022-06-15 15:37:41 +00:00
|
|
|
|
userWorkspaces: any;
|
2020-05-27 13:36:06 +00:00
|
|
|
|
currentUser?: User;
|
2020-10-19 12:11:14 +00:00
|
|
|
|
searchKeyword: string | undefined;
|
2021-10-04 15:34:37 +00:00
|
|
|
|
setHeaderMetaData: (
|
|
|
|
|
|
hideHeaderShadow: boolean,
|
|
|
|
|
|
showHeaderSeparator: boolean,
|
|
|
|
|
|
) => void;
|
2022-07-11 04:06:29 +00:00
|
|
|
|
resetEditor: () => void;
|
2021-06-04 07:48:17 +00:00
|
|
|
|
};
|
2021-06-16 15:51:18 +00:00
|
|
|
|
|
2020-06-11 11:31:32 +00:00
|
|
|
|
class Applications extends Component<
|
|
|
|
|
|
ApplicationProps,
|
2022-06-15 15:37:41 +00:00
|
|
|
|
{ selectedWorkspaceId: string; showOnboardingForm: boolean }
|
2020-06-11 11:31:32 +00:00
|
|
|
|
> {
|
|
|
|
|
|
constructor(props: ApplicationProps) {
|
|
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
|
|
|
|
this.state = {
|
2022-06-15 15:37:41 +00:00
|
|
|
|
selectedWorkspaceId: "",
|
2021-06-04 07:48:17 +00:00
|
|
|
|
showOnboardingForm: false,
|
2020-06-11 11:31:32 +00:00
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-11-07 04:59:40 +00:00
|
|
|
|
componentDidMount() {
|
2020-09-28 06:29:41 +00:00
|
|
|
|
PerformanceTracker.stopTracking(PerformanceTransactionName.LOGIN_CLICK);
|
|
|
|
|
|
PerformanceTracker.stopTracking(PerformanceTransactionName.SIGN_UP);
|
2022-06-15 15:37:41 +00:00
|
|
|
|
if (!this.props.userWorkspaces.length) {
|
2022-03-03 10:56:53 +00:00
|
|
|
|
this.props.getAllApplication();
|
|
|
|
|
|
}
|
2021-10-04 15:34:37 +00:00
|
|
|
|
this.props.setHeaderMetaData(true, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
|
|
this.props.setHeaderMetaData(false, false);
|
2021-08-20 07:30:36 +00:00
|
|
|
|
}
|
2021-06-28 07:38:44 +00:00
|
|
|
|
|
2019-11-07 04:59:40 +00:00
|
|
|
|
public render() {
|
|
|
|
|
|
return (
|
2019-12-23 12:16:33 +00:00
|
|
|
|
<PageWrapper displayName="Applications">
|
2021-08-20 07:30:36 +00:00
|
|
|
|
<LeftPane />
|
2022-03-03 10:56:53 +00:00
|
|
|
|
<MediaQuery maxWidth={MOBILE_MAX_WIDTH}>
|
|
|
|
|
|
{(matches: boolean) => (
|
|
|
|
|
|
<ApplicationsWrapper isMobile={matches}>
|
|
|
|
|
|
<SubHeader
|
|
|
|
|
|
search={{
|
|
|
|
|
|
placeholder: createMessage(SEARCH_APPS),
|
|
|
|
|
|
queryFn: this.props.searchApplications,
|
|
|
|
|
|
defaultValue: this.props.searchKeyword,
|
|
|
|
|
|
}}
|
|
|
|
|
|
/>
|
|
|
|
|
|
<ApplicationsSection searchKeyword={this.props.searchKeyword} />
|
2022-06-27 04:50:53 +00:00
|
|
|
|
<RepoLimitExceededErrorModal />
|
2022-03-03 10:56:53 +00:00
|
|
|
|
</ApplicationsWrapper>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</MediaQuery>
|
2019-12-23 12:16:33 +00:00
|
|
|
|
</PageWrapper>
|
2019-11-07 04:59:40 +00:00
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-09-01 07:16:54 +00:00
|
|
|
|
|
2019-11-07 04:59:40 +00:00
|
|
|
|
const mapStateToProps = (state: AppState) => ({
|
|
|
|
|
|
applicationList: getApplicationList(state),
|
|
|
|
|
|
isFetchingApplications: getIsFetchingApplications(state),
|
|
|
|
|
|
isCreatingApplication: getIsCreatingApplication(state),
|
2019-11-21 10:52:49 +00:00
|
|
|
|
createApplicationError: getCreateApplicationError(state),
|
2020-02-03 12:19:10 +00:00
|
|
|
|
deletingApplication: getIsDeletingApplication(state),
|
2020-09-01 07:16:54 +00:00
|
|
|
|
duplicatingApplication: getIsDuplicatingApplication(state),
|
2022-06-15 15:37:41 +00:00
|
|
|
|
userWorkspaces: getUserApplicationsWorkspacesList(state),
|
2020-05-27 13:36:06 +00:00
|
|
|
|
currentUser: getCurrentUser(state),
|
2020-10-19 12:11:14 +00:00
|
|
|
|
searchKeyword: getApplicationSearchKeyword(state),
|
2019-11-07 04:59:40 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch: any) => ({
|
2021-09-13 07:22:51 +00:00
|
|
|
|
getAllApplication: () => {
|
|
|
|
|
|
dispatch({ type: ReduxActionTypes.GET_ALL_APPLICATION_INIT });
|
2019-11-07 04:59:40 +00:00
|
|
|
|
},
|
2022-07-11 04:06:29 +00:00
|
|
|
|
resetEditor: () => {
|
|
|
|
|
|
dispatch(resetEditorRequest());
|
|
|
|
|
|
},
|
2020-01-20 08:07:00 +00:00
|
|
|
|
searchApplications: (keyword: string) => {
|
|
|
|
|
|
dispatch({
|
|
|
|
|
|
type: ReduxActionTypes.SEARCH_APPLICATIONS,
|
|
|
|
|
|
payload: {
|
|
|
|
|
|
keyword,
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2021-10-04 15:34:37 +00:00
|
|
|
|
setHeaderMetaData: (
|
|
|
|
|
|
hideHeaderShadow: boolean,
|
|
|
|
|
|
showHeaderSeparator: boolean,
|
|
|
|
|
|
) => {
|
|
|
|
|
|
dispatch(setHeaderMeta(hideHeaderShadow, showHeaderSeparator));
|
|
|
|
|
|
},
|
2019-11-07 04:59:40 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
2019-11-22 14:02:55 +00:00
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Applications);
|