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";
|
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] 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
- [x] 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
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
import type { 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,
|
2023-09-13 10:09:34 +00:00
|
|
|
getDeletingMultipleApps,
|
2021-02-11 12:54:00 +00:00
|
|
|
getIsCreatingApplication,
|
2020-02-03 12:19:10 +00:00
|
|
|
getIsDeletingApplication,
|
2021-02-11 12:54:00 +00:00
|
|
|
getIsFetchingApplications,
|
2022-06-15 15:37:41 +00:00
|
|
|
getIsSavingWorkspaceInfo,
|
|
|
|
|
getUserApplicationsWorkspaces,
|
|
|
|
|
getUserApplicationsWorkspacesList,
|
2023-03-29 17:07:06 +00:00
|
|
|
} from "@appsmith/selectors/applicationSelectors";
|
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] 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
- [x] 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
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
import type { ApplicationPayload } from "@appsmith/constants/ReduxActionConstants";
|
|
|
|
|
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
|
2023-08-28 15:37:32 +00:00
|
|
|
import PageWrapper from "pages/common/PageWrapper";
|
2019-11-21 10:52:49 +00:00
|
|
|
import SubHeader from "pages/common/SubHeader";
|
2023-10-08 18:48:46 +00:00
|
|
|
import WorkspaceInviteUsersForm from "pages/workspace/WorkspaceInviteUsersForm";
|
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] 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
- [x] 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
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
import type { 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";
|
2022-08-22 05:09:39 +00:00
|
|
|
import {
|
|
|
|
|
AppIconCollection,
|
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,
|
2023-05-19 18:37:06 +00:00
|
|
|
MenuItem as ListItem,
|
2022-08-22 05:09:39 +00:00
|
|
|
Text,
|
|
|
|
|
TextType,
|
2023-01-23 03:50:47 +00:00
|
|
|
} from "design-system-old";
|
2023-08-31 08:21:04 +00:00
|
|
|
import { Divider, Icon } from "design-system";
|
2023-09-11 04:14:32 +00:00
|
|
|
import { updateApplication } from "@appsmith/actions/applicationActions";
|
2020-09-16 11:50:47 +00:00
|
|
|
import { Position } from "@blueprintjs/core/lib/esm/common/position";
|
2023-03-29 17:07:06 +00:00
|
|
|
import type { UpdateApplicationPayload } from "@appsmith/api/ApplicationApi";
|
2020-09-28 06:29:41 +00:00
|
|
|
import PerformanceTracker, {
|
|
|
|
|
PerformanceTransactionName,
|
|
|
|
|
} from "utils/PerformanceTracker";
|
2023-01-10 05:39:15 +00:00
|
|
|
import { loadingUserWorkspaces } from "pages/Applications/ApplicationLoaders";
|
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] 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
- [x] 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
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
import type { creatingApplicationMap } from "@appsmith/reducers/uiReducers/applicationsReducer";
|
2022-11-03 16:39:51 +00:00
|
|
|
import {
|
|
|
|
|
deleteWorkspace,
|
fix: import issue with workspace id fixed (#27653)
## Description
In a case where we are inside an application, then we come back to home
page and add a new workspace and try importing application in that newly
created workspace, the workspace Id that is being sent along with test
API is workspaceId of previous workspace and not the new one. This PR
fixes that issue.
Issue occurs because for test API we are sending workspaceId which we
get from redux state. Whenever we enter inside any application, we set
the currentWorkspace object inside state, this object contains data
about current workspace, but when we leave the application and come back
to home page, we are not resetting this currentWorkspace object, it
still contains stale data, hence when we create new workspace and import
application, it gets workspace id from this stale object.
#### PR fixes following issue(s)
Fixes #27594
> if no issue exists, please create an issue and ask the maintainers
about this first
>
>
#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
- Bug fix (non-breaking change which fixes an issue)
>
>
>
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
1. Login to appsmith, create a new app in a new workspace. Now come back
to home page, and create a new workspace and then import an application.
The reported error should no longer appear
2. Tried with new workspace, new app created and app level import. Here
also the error does not appear.
3. Tried forking an app into a new workspace. Here also error does not
occur
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [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
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [x] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [x] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
---------
Co-authored-by: “sneha122” <“sneha@appsmith.com”>
Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2023-09-29 18:25:48 +00:00
|
|
|
resetCurrentWorkspace,
|
2022-11-03 16:39:51 +00:00
|
|
|
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";
|
2023-01-10 05:39:15 +00:00
|
|
|
import ImportApplicationModal from "pages/Applications/ImportApplicationModal";
|
2021-09-15 12:20:25 +00:00
|
|
|
import {
|
|
|
|
|
createMessage,
|
2022-09-02 17:15:08 +00:00
|
|
|
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";
|
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";
|
2023-08-28 15:37:32 +00:00
|
|
|
import LeftPaneBottomSection from "pages/Home/LeftPaneBottomSection";
|
2022-03-03 10:56:53 +00:00
|
|
|
import { MOBILE_MAX_WIDTH } from "constants/AppConstants";
|
2023-10-12 05:31:22 +00:00
|
|
|
import urlBuilder from "@appsmith/entities/URLRedirect/URLAssembly";
|
2023-01-10 05:39:15 +00:00
|
|
|
import RepoLimitExceededErrorModal from "pages/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-12-07 05:37:59 +00:00
|
|
|
hasDeleteWorkspacePermission,
|
2023-11-07 06:34:47 +00:00
|
|
|
hasManageWorkspaceEnvironmentPermission,
|
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";
|
2022-12-23 04:31:46 +00:00
|
|
|
import { getAppsmithConfigs } from "@appsmith/configs";
|
2023-05-19 18:37:06 +00:00
|
|
|
import FormDialogComponent from "components/editorComponents/form/FormDialogComponent";
|
2023-09-19 06:24:43 +00:00
|
|
|
import WorkspaceMenu from "@appsmith/pages/Applications/WorkspaceMenu";
|
|
|
|
|
import ApplicationCardList from "@appsmith/pages/Applications/ApplicationCardList";
|
2023-08-31 08:21:04 +00:00
|
|
|
import { usePackage } from "@appsmith/pages/Applications/helpers";
|
|
|
|
|
import PackageCardList from "@appsmith/pages/Applications/PackageCardList";
|
|
|
|
|
import WorkspaceAction from "@appsmith/pages/Applications/WorkspaceAction";
|
2023-09-22 06:57:31 +00:00
|
|
|
import ResourceListLoader from "@appsmith/pages/Applications/ResourceListLoader";
|
2023-09-29 20:42:56 +00:00
|
|
|
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
|
|
|
|
|
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
|
|
|
|
|
import { getHasCreateWorkspacePermission } from "@appsmith/utils/BusinessFeatures/permissionPageHelpers";
|
2023-11-07 06:34:47 +00:00
|
|
|
import { allowManageEnvironmentAccessForUser } from "@appsmith/selectors/environmentSelectors";
|
2022-12-23 04:31:46 +00:00
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export const { cloudHosting } = getAppsmithConfigs();
|
2021-07-29 08:49:46 +00:00
|
|
|
|
2023-08-31 08:21:04 +00:00
|
|
|
export const CONTAINER_WRAPPER_PADDING = "var(--ads-v2-spaces-7)";
|
|
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export const WorkspaceDropDown = styled.div<{ isMobile?: boolean }>`
|
2020-05-27 13:36:06 +00:00
|
|
|
display: flex;
|
2023-08-31 08:21:04 +00:00
|
|
|
padding: ${(props) => (props.isMobile ? `10px 16px` : `24px 0`)};
|
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 &&
|
|
|
|
|
`
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
z-index: ${Indices.Layer8};
|
|
|
|
|
`}
|
2020-05-27 13:36:06 +00:00
|
|
|
`;
|
2019-11-07 04:59:40 +00:00
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export const WorkspaceSection = styled.div<{ isMobile?: boolean }>`
|
2023-08-31 08:21:04 +00:00
|
|
|
padding: ${({ isMobile }) =>
|
|
|
|
|
isMobile ? 0 : `0 ${CONTAINER_WRAPPER_PADDING}`};
|
|
|
|
|
margin-bottom: ${({ isMobile }) => (isMobile ? `8` : `0`)}px;
|
2020-09-16 11:50:47 +00:00
|
|
|
`;
|
|
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export const LeftPaneWrapper = styled.div<{ isBannerVisible?: boolean }>`
|
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;
|
2023-02-03 04:18:50 +00:00
|
|
|
height: ${(props) =>
|
|
|
|
|
props.isBannerVisible
|
|
|
|
|
? `calc(100% - ${props.theme.homePage.header * 2}px)`
|
|
|
|
|
: "100%"};
|
2020-09-16 11:50:47 +00:00
|
|
|
display: flex;
|
2021-10-04 15:34:37 +00:00
|
|
|
padding-top: 16px;
|
2020-09-16 11:50:47 +00:00
|
|
|
flex-direction: column;
|
|
|
|
|
position: fixed;
|
2023-01-10 05:39:15 +00:00
|
|
|
top: calc(
|
|
|
|
|
${(props) => props.theme.homePage.header}px +
|
|
|
|
|
${(props) => (props.isBannerVisible ? "48px" : "0px")}
|
|
|
|
|
);
|
2023-05-19 18:37:06 +00:00
|
|
|
border-right: 1px solid var(--ads-v2-color-border);
|
|
|
|
|
padding: 0 16px;
|
2020-09-16 11:50:47 +00:00
|
|
|
`;
|
2023-01-10 05:39:15 +00:00
|
|
|
export const ApplicationContainer = styled.div<{ isMobile?: boolean }>`
|
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
|
|
|
`;
|
|
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export const ItemWrapper = styled.div`
|
2023-05-19 18:37:06 +00:00
|
|
|
padding: 16px;
|
2020-09-16 11:50:47 +00:00
|
|
|
`;
|
2023-01-10 05:39:15 +00:00
|
|
|
export const StyledIcon = styled(Icon)`
|
2020-09-16 11:50:47 +00:00
|
|
|
margin-right: 11px;
|
|
|
|
|
`;
|
2023-09-13 10:09:34 +00:00
|
|
|
export const WorkspaceShareUsers = styled.div<{ isHidden?: boolean }>`
|
2020-11-11 13:12:05 +00:00
|
|
|
display: flex;
|
2021-10-04 15:34:37 +00:00
|
|
|
align-items: center;
|
2023-09-13 10:09:34 +00:00
|
|
|
${(props) => props.isHidden && "opacity: 0; visibility: hidden;"}
|
2021-10-04 15:34:37 +00:00
|
|
|
|
|
|
|
|
& .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
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export 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
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export function Item(props: {
|
2020-10-14 10:35:19 +00:00
|
|
|
label: string;
|
|
|
|
|
textType: TextType;
|
2023-05-19 18:37:06 +00:00
|
|
|
icon?: string;
|
2023-02-22 07:02:43 +00:00
|
|
|
isFetchingApplications?: boolean;
|
2020-10-14 10:35:19 +00:00
|
|
|
}) {
|
2020-09-16 11:50:47 +00:00
|
|
|
return (
|
|
|
|
|
<ItemWrapper>
|
2023-05-19 18:37:06 +00:00
|
|
|
{props.icon && <StyledIcon name={props.icon} />}
|
2020-10-14 10:35:19 +00:00
|
|
|
<Text
|
|
|
|
|
className={
|
2023-02-22 07:02:43 +00:00
|
|
|
!!props.isFetchingApplications ? BlueprintClasses.SKELETON : ""
|
2020-10-14 10:35:19 +00:00
|
|
|
}
|
2023-05-19 18:37:06 +00:00
|
|
|
color={"var(--ads-v2-color-fg-emphasis)"}
|
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
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
const LeftPaneDataSection = styled.div<{ isBannerVisible?: boolean }>`
|
2021-10-04 15:34:37 +00:00
|
|
|
position: relative;
|
2023-07-18 09:48:48 +00:00
|
|
|
height: calc(100vh - ${(props) => 48 + (props.isBannerVisible ? 48 : 0)}px);
|
2022-10-21 17:35:54 +00:00
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
2021-10-04 15:34:37 +00:00
|
|
|
`;
|
|
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export function LeftPaneSection(props: {
|
2020-10-14 10:35:19 +00:00
|
|
|
heading: string;
|
|
|
|
|
children?: any;
|
|
|
|
|
isFetchingApplications: boolean;
|
2023-01-10 05:39:15 +00:00
|
|
|
isBannerVisible?: boolean;
|
2020-10-14 10:35:19 +00:00
|
|
|
}) {
|
2020-09-16 11:50:47 +00:00
|
|
|
return (
|
2023-01-10 05:39:15 +00:00
|
|
|
<LeftPaneDataSection isBannerVisible={props.isBannerVisible}>
|
2023-02-22 07:02:43 +00:00
|
|
|
<Item label={props.heading} textType={TextType.SIDE_HEAD} />
|
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
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export const StyledAnchor = styled.a`
|
2020-09-16 11:50:47 +00:00
|
|
|
position: relative;
|
|
|
|
|
top: -24px;
|
|
|
|
|
`;
|
|
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export const WorkpsacesNavigator = styled.div`
|
2020-09-17 07:57:19 +00:00
|
|
|
overflow: auto;
|
2023-05-19 18:37:06 +00:00
|
|
|
margin-bottom: 4px;
|
2021-10-20 14:35:12 +00:00
|
|
|
${thinScrollbar};
|
2021-10-04 15:34:37 +00:00
|
|
|
`;
|
|
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export const textIconStyles = (props: { color: string; hover: string }) => {
|
2020-09-16 11:50:47 +00:00
|
|
|
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};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export function WorkspaceMenuItem({
|
2022-06-15 15:37:41 +00:00
|
|
|
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 (
|
2023-05-19 18:37:06 +00:00
|
|
|
<ListItem
|
2021-09-07 09:15:11 +00:00
|
|
|
containerClassName={
|
|
|
|
|
isFetchingApplications ? BlueprintClasses.SKELETON : ""
|
|
|
|
|
}
|
2023-08-29 08:51:29 +00:00
|
|
|
ellipsize={
|
|
|
|
|
isFetchingApplications ? 100 : 19
|
|
|
|
|
} /* this is to avoid showing tooltip for loaders */
|
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
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export const submitCreateWorkspaceForm = async (data: any, dispatch: any) => {
|
2022-06-15 15:37:41 +00:00
|
|
|
const result = await createWorkspaceSubmitHandler(data, dispatch);
|
2021-05-05 07:10:35 +00:00
|
|
|
return result;
|
|
|
|
|
};
|
2021-06-02 09:56:22 +00:00
|
|
|
|
2023-10-11 07:35:24 +00:00
|
|
|
export interface LeftPaneProps {
|
2023-01-10 05:39:15 +00:00
|
|
|
isBannerVisible?: boolean;
|
2023-10-11 07:35:24 +00:00
|
|
|
}
|
2023-01-10 05:39:15 +00:00
|
|
|
|
|
|
|
|
export function LeftPane(props: LeftPaneProps) {
|
|
|
|
|
const { isBannerVisible = false } = props;
|
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();
|
2023-09-29 20:42:56 +00:00
|
|
|
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
|
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);
|
2023-09-29 20:42:56 +00:00
|
|
|
const canCreateWorkspace = getHasCreateWorkspacePermission(
|
|
|
|
|
isFeatureEnabled,
|
|
|
|
|
tenantPermissions,
|
|
|
|
|
);
|
2022-12-01 06:30:50 +00:00
|
|
|
|
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 (
|
2023-01-10 05:39:15 +00:00
|
|
|
<LeftPaneWrapper isBannerVisible={isBannerVisible}>
|
2020-10-14 10:35:19 +00:00
|
|
|
<LeftPaneSection
|
2022-06-15 15:37:41 +00:00
|
|
|
heading={createMessage(WORKSPACES_HEADING)}
|
2023-08-18 10:26:02 +00:00
|
|
|
isBannerVisible={isBannerVisible}
|
2020-10-14 10:35:19 +00:00
|
|
|
isFetchingApplications={isFetchingApplications}
|
|
|
|
|
>
|
2023-05-19 18:37:06 +00:00
|
|
|
<WorkpsacesNavigator data-testid="t--left-panel">
|
2023-02-22 07:02:43 +00:00
|
|
|
{canCreateWorkspace && (
|
2023-05-19 18:37:06 +00:00
|
|
|
<ListItem
|
|
|
|
|
color="var(--ads-v2-color-fg-emphasis)"
|
|
|
|
|
data-testid="t--workspace-new-workspace-auto-create"
|
2023-02-22 07:02:43 +00:00
|
|
|
icon="plus"
|
2023-10-09 13:54:06 +00:00
|
|
|
onSelect={async () =>
|
2023-02-22 07:02:43 +00:00
|
|
|
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>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export const CreateNewLabel = styled(Text)`
|
2020-09-16 11:50:47 +00:00
|
|
|
margin-top: 18px;
|
|
|
|
|
`;
|
|
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export const WorkspaceNameElement = styled(Text)<{ isMobile?: boolean }>`
|
2022-02-17 16:38:36 +00:00
|
|
|
max-width: ${({ isMobile }) => (isMobile ? 220 : 500)}px;
|
2023-05-19 18:37:06 +00:00
|
|
|
${truncateTextUsingEllipsis};
|
2023-08-31 08:21:04 +00:00
|
|
|
color: var(--ads-v2-color-fg);
|
|
|
|
|
font-weight: var(--ads-font-weight-bold-xl);
|
2020-10-08 09:49:15 +00:00
|
|
|
`;
|
|
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export const WorkspaceNameHolder = styled(Text)`
|
2020-10-08 09:49:15 +00:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
`;
|
|
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export 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
|
|
|
`;
|
2023-01-10 05:39:15 +00:00
|
|
|
export const WorkspaceRename = styled(EditableText)`
|
2020-11-25 12:24:14 +00:00
|
|
|
padding: 0 2px;
|
|
|
|
|
`;
|
2020-06-11 11:31:32 +00:00
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export const NoSearchResultImg = styled.img`
|
2020-10-19 12:11:14 +00:00
|
|
|
margin: 1em;
|
|
|
|
|
`;
|
|
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export const ApplicationsWrapper = styled.div<{ isMobile: boolean }>`
|
2022-03-03 10:56:53 +00:00
|
|
|
height: calc(100vh - ${(props) => props.theme.homePage.search.height - 40}px);
|
|
|
|
|
overflow: auto;
|
2023-05-19 18:37:06 +00:00
|
|
|
margin-left: ${(props) => props.theme.homePage.leftPane.width}px;
|
|
|
|
|
width: calc(100% - ${(props) => props.theme.homePage.leftPane.width}px);
|
2022-03-03 10:56:53 +00:00
|
|
|
scroll-behavior: smooth;
|
2023-09-13 10:09:34 +00:00
|
|
|
${({ isMobile }) =>
|
|
|
|
|
isMobile
|
|
|
|
|
? `padding: ${CONTAINER_WRAPPER_PADDING} 0;`
|
|
|
|
|
: `padding: 0 0 ${CONTAINER_WRAPPER_PADDING};`}
|
|
|
|
|
|
2022-03-03 10:56:53 +00:00
|
|
|
${({ isMobile }) =>
|
|
|
|
|
isMobile &&
|
|
|
|
|
`
|
|
|
|
|
margin-left: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding: 0;
|
|
|
|
|
`}
|
|
|
|
|
`;
|
|
|
|
|
|
2023-01-10 05:39:15 +00:00
|
|
|
export 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);
|
2023-08-31 08:21:04 +00:00
|
|
|
const { isFetchingPackages } = usePackage();
|
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();
|
2023-09-13 10:09:34 +00:00
|
|
|
const deleteMultipleApplicationObject = useSelector(getDeletingMultipleApps);
|
|
|
|
|
const isEnabledMultipleSelection =
|
|
|
|
|
!!deleteMultipleApplicationObject.list?.length;
|
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,
|
|
|
|
|
);
|
2023-11-07 06:34:47 +00:00
|
|
|
const isManageEnvironmentEnabled = useSelector(
|
|
|
|
|
allowManageEnvironmentAccessForUser,
|
|
|
|
|
);
|
2020-09-16 11:50:47 +00:00
|
|
|
const updateApplicationDispatch = (
|
|
|
|
|
id: string,
|
|
|
|
|
data: UpdateApplicationPayload,
|
|
|
|
|
) => {
|
|
|
|
|
dispatch(updateApplication(id, data));
|
|
|
|
|
};
|
2023-08-31 08:21:04 +00:00
|
|
|
const isLoadingResources = isFetchingApplications || isFetchingPackages;
|
2023-10-05 06:38:35 +00:00
|
|
|
const isGACEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
|
2020-09-16 11:50:47 +00:00
|
|
|
|
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
|
|
|
}, []);
|
|
|
|
|
|
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>();
|
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],
|
|
|
|
|
);
|
|
|
|
|
|
2023-08-31 08:21:04 +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
|
2023-08-31 08:21:04 +00:00
|
|
|
className={isLoadingResources ? BlueprintClasses.SKELETON : ""}
|
|
|
|
|
type={TextType.H4}
|
2020-10-14 10:35:19 +00:00
|
|
|
>
|
2022-06-15 15:37:41 +00:00
|
|
|
<WorkspaceNameElement
|
2023-08-31 08:21:04 +00:00
|
|
|
className={isLoadingResources ? BlueprintClasses.SKELETON : ""}
|
2022-02-17 16:38:36 +00:00
|
|
|
isMobile={isMobile}
|
2023-08-31 08:21:04 +00:00
|
|
|
type={TextType.H4}
|
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;
|
2023-08-31 08:21:04 +00:00
|
|
|
if (!isLoadingResources) {
|
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 (
|
2023-08-31 08:21:04 +00:00
|
|
|
!isLoadingResources &&
|
2020-10-19 12:11:14 +00:00
|
|
|
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) => {
|
2023-08-31 08:21:04 +00:00
|
|
|
const isLastWorkspace = updatedWorkspaces.length === index + 1;
|
|
|
|
|
const { applications, packages, workspace } = workspaceObject;
|
2022-06-15 15:37:41 +00:00
|
|
|
const hasManageWorkspacePermissions = isPermitted(
|
|
|
|
|
workspace.userPermissions,
|
|
|
|
|
PERMISSION_TYPE.MANAGE_WORKSPACE,
|
2020-10-19 12:11:14 +00:00
|
|
|
);
|
2022-12-07 05:37:59 +00:00
|
|
|
const canInviteToWorkspace = isPermitted(
|
|
|
|
|
workspace.userPermissions,
|
|
|
|
|
PERMISSION_TYPE.INVITE_USER_TO_WORKSPACE,
|
|
|
|
|
);
|
|
|
|
|
const canDeleteWorkspace = hasDeleteWorkspacePermission(
|
|
|
|
|
workspace?.userPermissions || [],
|
|
|
|
|
);
|
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
|
|
|
|
2023-11-07 06:34:47 +00:00
|
|
|
const renderManageEnvironmentMenu =
|
|
|
|
|
isManageEnvironmentEnabled &&
|
|
|
|
|
hasManageWorkspaceEnvironmentPermission(workspace.userPermissions);
|
|
|
|
|
|
2023-08-31 08:21:04 +00:00
|
|
|
const onClickAddNewAppButton = (workspaceId: string) => {
|
2022-08-29 09:16:24 +00:00
|
|
|
if (
|
|
|
|
|
Object.entries(creatingApplicationMap).length === 0 ||
|
|
|
|
|
(creatingApplicationMap && !creatingApplicationMap[workspaceId])
|
|
|
|
|
) {
|
|
|
|
|
createNewApplication(
|
|
|
|
|
getNextEntityName(
|
|
|
|
|
"Untitled application ",
|
|
|
|
|
applications.map((el: any) => el.name),
|
|
|
|
|
),
|
|
|
|
|
workspaceId,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2022-12-07 05:37:59 +00:00
|
|
|
const showWorkspaceMenuOptions =
|
|
|
|
|
canInviteToWorkspace ||
|
|
|
|
|
hasManageWorkspacePermissions ||
|
2022-12-09 10:16:00 +00:00
|
|
|
hasCreateNewApplicationPermission ||
|
2023-11-07 06:34:47 +00:00
|
|
|
(canDeleteWorkspace && applications.length === 0) ||
|
|
|
|
|
renderManageEnvironmentMenu;
|
2022-12-07 05:37:59 +00:00
|
|
|
|
2023-05-19 18:37:06 +00:00
|
|
|
const handleResetMenuState = () => {
|
|
|
|
|
setWorkspaceToOpenMenu(null);
|
|
|
|
|
setWarnLeavingWorkspace(false);
|
|
|
|
|
setWarnDeleteWorkspace(false);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleWorkspaceMenuClose = (open: boolean) => {
|
|
|
|
|
if (!open && !warnLeavingWorkspace && !warnDeleteWorkspace) {
|
|
|
|
|
handleResetMenuState();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2020-10-19 12:11:14 +00:00
|
|
|
return (
|
2023-08-31 08:21:04 +00:00
|
|
|
<React.Fragment key={workspace.id}>
|
|
|
|
|
<WorkspaceSection
|
|
|
|
|
className="t--workspace-section"
|
|
|
|
|
isMobile={isMobile}
|
|
|
|
|
key={index}
|
|
|
|
|
>
|
|
|
|
|
<WorkspaceDropDown isMobile={isMobile}>
|
|
|
|
|
{(currentUser || isLoadingResources) &&
|
|
|
|
|
WorkspaceMenuTarget({
|
|
|
|
|
workspaceName: workspace.name,
|
|
|
|
|
workspaceSlug: workspace.id,
|
|
|
|
|
})}
|
|
|
|
|
{selectedWorkspaceIdForImportApplication && (
|
|
|
|
|
<ImportApplicationModal
|
|
|
|
|
isModalOpen={
|
|
|
|
|
selectedWorkspaceIdForImportApplication === workspace.id
|
|
|
|
|
}
|
|
|
|
|
onClose={() =>
|
|
|
|
|
setSelectedWorkspaceIdForImportApplication("")
|
|
|
|
|
}
|
|
|
|
|
workspaceId={selectedWorkspaceIdForImportApplication}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
{!isLoadingResources && (
|
2023-09-13 10:09:34 +00:00
|
|
|
<WorkspaceShareUsers isHidden={isEnabledMultipleSelection}>
|
2023-08-31 08:21:04 +00:00
|
|
|
<SharedUserList workspaceId={workspace.id} />
|
|
|
|
|
{canInviteToWorkspace && !isMobile && (
|
|
|
|
|
<FormDialogComponent
|
|
|
|
|
Form={WorkspaceInviteUsersForm}
|
|
|
|
|
placeholder={createMessage(
|
|
|
|
|
INVITE_USERS_PLACEHOLDER,
|
2023-10-05 06:38:35 +00:00
|
|
|
!isGACEnabled,
|
2023-08-31 08:21:04 +00:00
|
|
|
)}
|
|
|
|
|
workspace={workspace}
|
|
|
|
|
/>
|
2022-12-07 05:37:59 +00:00
|
|
|
)}
|
2023-08-31 08:21:04 +00:00
|
|
|
<WorkspaceAction
|
2022-02-17 16:38:36 +00:00
|
|
|
isMobile={isMobile}
|
2023-08-31 08:21:04 +00:00
|
|
|
onCreateNewApplication={onClickAddNewAppButton}
|
2023-03-29 17:07:06 +00:00
|
|
|
workspaceId={workspace.id}
|
2021-03-02 05:55:45 +00:00
|
|
|
/>
|
2023-08-31 08:21:04 +00:00
|
|
|
{(currentUser || isLoadingResources) &&
|
|
|
|
|
!isMobile &&
|
|
|
|
|
showWorkspaceMenuOptions && (
|
|
|
|
|
<WorkspaceMenu
|
|
|
|
|
canDeleteWorkspace={
|
|
|
|
|
applications.length === 0 &&
|
|
|
|
|
packages.length === 0 &&
|
|
|
|
|
canDeleteWorkspace
|
|
|
|
|
}
|
|
|
|
|
canInviteToWorkspace={canInviteToWorkspace}
|
|
|
|
|
enableImportExport={enableImportExport}
|
|
|
|
|
handleDeleteWorkspace={handleDeleteWorkspace}
|
|
|
|
|
handleResetMenuState={handleResetMenuState}
|
|
|
|
|
handleWorkspaceMenuClose={handleWorkspaceMenuClose}
|
|
|
|
|
hasCreateNewApplicationPermission={
|
|
|
|
|
hasCreateNewApplicationPermission
|
|
|
|
|
}
|
|
|
|
|
hasManageWorkspacePermissions={
|
|
|
|
|
hasManageWorkspacePermissions
|
|
|
|
|
}
|
|
|
|
|
isFetchingResources={isLoadingResources}
|
|
|
|
|
isSavingWorkspaceInfo={isSavingWorkspaceInfo}
|
|
|
|
|
leaveWS={leaveWS}
|
|
|
|
|
setSelectedWorkspaceIdForImportApplication={
|
|
|
|
|
setSelectedWorkspaceIdForImportApplication
|
|
|
|
|
}
|
|
|
|
|
setWarnDeleteWorkspace={setWarnDeleteWorkspace}
|
|
|
|
|
setWarnLeavingWorkspace={setWarnLeavingWorkspace}
|
|
|
|
|
setWorkspaceToOpenMenu={setWorkspaceToOpenMenu}
|
|
|
|
|
warnDeleteWorkspace={warnDeleteWorkspace}
|
|
|
|
|
warnLeavingWorkspace={warnLeavingWorkspace}
|
|
|
|
|
workspace={workspace}
|
|
|
|
|
workspaceNameChange={workspaceNameChange}
|
|
|
|
|
workspaceToOpenMenu={workspaceToOpenMenu}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</WorkspaceShareUsers>
|
|
|
|
|
)}
|
|
|
|
|
</WorkspaceDropDown>
|
2023-09-22 06:57:31 +00:00
|
|
|
{isLoadingResources && (
|
|
|
|
|
<ResourceListLoader
|
|
|
|
|
isMobile={isMobile}
|
|
|
|
|
resources={applications}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
{!isLoadingResources && (
|
|
|
|
|
<ApplicationCardList
|
|
|
|
|
applications={applications}
|
|
|
|
|
canInviteToWorkspace={canInviteToWorkspace}
|
|
|
|
|
deleteApplication={deleteApplication}
|
|
|
|
|
enableImportExport={enableImportExport}
|
|
|
|
|
hasCreateNewApplicationPermission={
|
|
|
|
|
hasCreateNewApplicationPermission
|
|
|
|
|
}
|
|
|
|
|
hasManageWorkspacePermissions={hasManageWorkspacePermissions}
|
|
|
|
|
isMobile={isMobile}
|
|
|
|
|
onClickAddNewButton={onClickAddNewAppButton}
|
|
|
|
|
updateApplicationDispatch={updateApplicationDispatch}
|
|
|
|
|
workspaceId={workspace.id}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2023-08-31 08:21:04 +00:00
|
|
|
{!isLoadingResources && (
|
|
|
|
|
<PackageCardList
|
|
|
|
|
isMobile={isMobile}
|
|
|
|
|
packages={packages}
|
|
|
|
|
workspaceId={workspace.id}
|
|
|
|
|
/>
|
2021-10-04 15:34:37 +00:00
|
|
|
)}
|
2023-08-31 08:21:04 +00:00
|
|
|
</WorkspaceSection>
|
|
|
|
|
{!isLastWorkspace && <Divider />}
|
|
|
|
|
</React.Fragment>
|
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
|
|
|
|
2023-02-02 06:25:20 +00:00
|
|
|
export interface ApplicationProps {
|
2019-11-07 04:59:40 +00:00
|
|
|
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-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;
|
2023-08-31 08:21:04 +00:00
|
|
|
queryModuleFeatureFlagEnabled: boolean;
|
fix: import issue with workspace id fixed (#27653)
## Description
In a case where we are inside an application, then we come back to home
page and add a new workspace and try importing application in that newly
created workspace, the workspace Id that is being sent along with test
API is workspaceId of previous workspace and not the new one. This PR
fixes that issue.
Issue occurs because for test API we are sending workspaceId which we
get from redux state. Whenever we enter inside any application, we set
the currentWorkspace object inside state, this object contains data
about current workspace, but when we leave the application and come back
to home page, we are not resetting this currentWorkspace object, it
still contains stale data, hence when we create new workspace and import
application, it gets workspace id from this stale object.
#### PR fixes following issue(s)
Fixes #27594
> if no issue exists, please create an issue and ask the maintainers
about this first
>
>
#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
- Bug fix (non-breaking change which fixes an issue)
>
>
>
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
1. Login to appsmith, create a new app in a new workspace. Now come back
to home page, and create a new workspace and then import an application.
The reported error should no longer appear
2. Tried with new workspace, new app created and app level import. Here
also the error does not appear.
3. Tried forking an app into a new workspace. Here also error does not
occur
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [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
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [x] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [x] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
---------
Co-authored-by: “sneha122” <“sneha@appsmith.com”>
Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2023-09-29 18:25:48 +00:00
|
|
|
resetCurrentWorkspace: () => void;
|
2023-02-02 06:25:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ApplicationState {
|
|
|
|
|
selectedWorkspaceId: string;
|
|
|
|
|
showOnboardingForm: boolean;
|
|
|
|
|
}
|
2021-06-16 15:51:18 +00:00
|
|
|
|
2023-02-02 06:25:20 +00:00
|
|
|
export class Applications<
|
|
|
|
|
Props extends ApplicationProps,
|
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] 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
- [x] 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
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
State extends ApplicationState,
|
2023-02-02 06:25:20 +00:00
|
|
|
> extends Component<Props, State> {
|
|
|
|
|
constructor(props: Props) {
|
2020-06-11 11:31:32 +00:00
|
|
|
super(props);
|
|
|
|
|
|
|
|
|
|
this.state = {
|
2022-06-15 15:37:41 +00:00
|
|
|
selectedWorkspaceId: "",
|
2021-06-04 07:48:17 +00:00
|
|
|
showOnboardingForm: false,
|
2023-02-02 06:25:20 +00:00
|
|
|
} as State;
|
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);
|
2023-01-11 05:38:20 +00:00
|
|
|
this.props.getAllApplication();
|
2021-10-04 15:34:37 +00:00
|
|
|
this.props.setHeaderMetaData(true, true);
|
fix: import issue with workspace id fixed (#27653)
## Description
In a case where we are inside an application, then we come back to home
page and add a new workspace and try importing application in that newly
created workspace, the workspace Id that is being sent along with test
API is workspaceId of previous workspace and not the new one. This PR
fixes that issue.
Issue occurs because for test API we are sending workspaceId which we
get from redux state. Whenever we enter inside any application, we set
the currentWorkspace object inside state, this object contains data
about current workspace, but when we leave the application and come back
to home page, we are not resetting this currentWorkspace object, it
still contains stale data, hence when we create new workspace and import
application, it gets workspace id from this stale object.
#### PR fixes following issue(s)
Fixes #27594
> if no issue exists, please create an issue and ask the maintainers
about this first
>
>
#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
- Bug fix (non-breaking change which fixes an issue)
>
>
>
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
1. Login to appsmith, create a new app in a new workspace. Now come back
to home page, and create a new workspace and then import an application.
The reported error should no longer appear
2. Tried with new workspace, new app created and app level import. Here
also the error does not appear.
3. Tried forking an app into a new workspace. Here also error does not
occur
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [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
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [x] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [x] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
---------
Co-authored-by: “sneha122” <“sneha@appsmith.com”>
Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2023-09-29 18:25:48 +00:00
|
|
|
|
|
|
|
|
// Whenever we go back to home page from application page,
|
|
|
|
|
// we should reset current workspace, as this workspace is not in context anymore
|
|
|
|
|
this.props.resetCurrentWorkspace();
|
2021-10-04 15:34:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
|
this.props.setHeaderMetaData(false, false);
|
2023-08-07 04:58:21 +00:00
|
|
|
this.props.searchApplications("");
|
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
|
|
|
|
2023-09-30 06:28:05 +00:00
|
|
|
export const mapStateToProps = (state: AppState) => ({
|
2019-11-07 04:59:40 +00:00
|
|
|
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),
|
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
|
|
|
});
|
|
|
|
|
|
2023-09-30 06:28:05 +00:00
|
|
|
export 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));
|
|
|
|
|
},
|
fix: import issue with workspace id fixed (#27653)
## Description
In a case where we are inside an application, then we come back to home
page and add a new workspace and try importing application in that newly
created workspace, the workspace Id that is being sent along with test
API is workspaceId of previous workspace and not the new one. This PR
fixes that issue.
Issue occurs because for test API we are sending workspaceId which we
get from redux state. Whenever we enter inside any application, we set
the currentWorkspace object inside state, this object contains data
about current workspace, but when we leave the application and come back
to home page, we are not resetting this currentWorkspace object, it
still contains stale data, hence when we create new workspace and import
application, it gets workspace id from this stale object.
#### PR fixes following issue(s)
Fixes #27594
> if no issue exists, please create an issue and ask the maintainers
about this first
>
>
#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
- Bug fix (non-breaking change which fixes an issue)
>
>
>
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
1. Login to appsmith, create a new app in a new workspace. Now come back
to home page, and create a new workspace and then import an application.
The reported error should no longer appear
2. Tried with new workspace, new app created and app level import. Here
also the error does not appear.
3. Tried forking an app into a new workspace. Here also error does not
occur
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [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
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [x] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [x] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
---------
Co-authored-by: “sneha122” <“sneha@appsmith.com”>
Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2023-09-29 18:25:48 +00:00
|
|
|
resetCurrentWorkspace: () => dispatch(resetCurrentWorkspace()),
|
2019-11-07 04:59:40 +00:00
|
|
|
});
|
|
|
|
|
|
2019-11-22 14:02:55 +00:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Applications);
|