Skip to content

Commit

Permalink
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
Browse files Browse the repository at this point in the history
…37853-new-integrations
  • Loading branch information
AmanAgarwal041 committed Dec 18, 2024
2 parents 3112223 + 836b544 commit 7fdca47
Show file tree
Hide file tree
Showing 151 changed files with 8,947 additions and 5,310 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/ci-test-custom-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,14 @@ jobs:
chmod a+x ./cypress/setup-test-ci.sh
./cypress/setup-test-ci.sh
- uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- run: |
echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV
- name: Install Google Chrome 129.0.6668.100
run: |
sudo apt-get remove google-chrome-stable
wget -q https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_129.0.6668.100-1_amd64.deb
sudo apt-get update
sudo apt-get install -y ./google-chrome-stable_129.0.6668.100-1_amd64.deb
echo "BROWSER_PATH=$(which google-chrome)" >> $GITHUB_ENV
google-chrome --version
- name: Save Git values
# pass env variables from this step to other steps
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/ci-test-hosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,14 @@ jobs:
chmod a+x ./cypress/setup-test-ci.sh
./cypress/setup-test-ci.sh
- uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- run: |
echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV
- name: Install Google Chrome 129.0.6668.100
run: |
sudo apt-get remove google-chrome-stable
wget -q https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_129.0.6668.100-1_amd64.deb
sudo apt-get update
sudo apt-get install -y ./google-chrome-stable_129.0.6668.100-1_amd64.deb
echo "BROWSER_PATH=$(which google-chrome)" >> $GITHUB_ENV
google-chrome --version
- name: Save Git values
# pass env variables from this step to other steps
Expand Down Expand Up @@ -243,6 +246,7 @@ jobs:
CYPRESS_S3_SECRET: ${{ secrets.CYPRESS_S3_SECRET }}
CYPRESS_STATIC_ALLOCATION: true
with:
browser: ${{ env.BROWSER_PATH }}
install: false
config-file: cypress_ci_hosted.config.ts
working-directory: app/client
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/ci-test-limited-with-count.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,14 @@ jobs:
chmod a+x ./cypress/setup-test-ci.sh
./cypress/setup-test-ci.sh
- uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- run: |
echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV
- name: Install Google Chrome 129.0.6668.100
run: |
sudo apt-get remove google-chrome-stable
wget -q https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_129.0.6668.100-1_amd64.deb
sudo apt-get update
sudo apt-get install -y ./google-chrome-stable_129.0.6668.100-1_amd64.deb
echo "BROWSER_PATH=$(which google-chrome)" >> $GITHUB_ENV
google-chrome --version
- name: Save Git values
# pass env variables from this step to other steps
Expand Down Expand Up @@ -348,7 +351,8 @@ jobs:
cd app/client
npx cypress-repeat-pro run -n ${{ inputs.run_count }} --force \
--spec ${{ env.specs_to_run }} \
--config-file "cypress_ci_custom.config.ts"
--config-file "cypress_ci_custom.config.ts" \
--browser ${{ env.BROWSER_PATH }}
cat cy-repeat-summary.txt
# Define the path for the failure flag file
FAILURE_FLAG_FILE="ci_test_status.txt"
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/ci-test-limited.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,15 @@ jobs:
cd app/client
chmod a+x ./cypress/setup-test-ci.sh
./cypress/setup-test-ci.sh
- uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- run: |
echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV
- name: Install Google Chrome 129.0.6668.100
run: |
sudo apt-get remove google-chrome-stable
wget -q https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_129.0.6668.100-1_amd64.deb
sudo apt-get update
sudo apt-get install -y ./google-chrome-stable_129.0.6668.100-1_amd64.deb
echo "BROWSER_PATH=$(which google-chrome)" >> $GITHUB_ENV
google-chrome --version
- name: Save Git values
# pass env variables from this step to other steps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,9 @@ describe("Embed settings options", { tags: ["@tag.Settings"] }, function () {
.click()
.wait(1000);
_.agHelper.ClickButton("Copy application url");
cy.window()
.its("navigator.clipboard")
.invoke("readText")
.then((text) => {
cy.wrap(text).as("deployUrl");
});
cy.window().then((win) => {
cy.stub(win.navigator.clipboard, "writeText").as("deployUrl").resolves();
});
cy.enablePublicAccess();
cy.wait(8000); //adding wait time for iframe to load fully!
_.agHelper.RefreshPage();
Expand Down
11 changes: 6 additions & 5 deletions app/client/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,19 @@ module.exports = {
before: [
{
path: "node_modules/ts-jest-mock-import-meta",
options: { metaObjectReplacement: { url: "https://www.url.com" } },
options: {
metaObjectReplacement: { url: "https://www.url.com" },
},
},
],
},
}
},
],
},
testEnvironment: "jsdom",
testTimeout: 9000,
setupFilesAfterEnv: ["<rootDir>/test/setup.ts"],
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(tsx|ts|js)?$",
testRegex: "\\.(test|spec)\\.(tsx|ts|js)?$",
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node", "css"],
moduleDirectories: ["node_modules", "src", "test"],
transformIgnorePatterns: [
Expand Down Expand Up @@ -68,8 +70,7 @@ module.exports = {
"<rootDir>/node_modules/@blueprintjs/select/lib/esnext",
"@appsmith/ads": "<rootDir>/node_modules/@appsmith/ads",
"^canvas$": "jest-canvas-mock",
"^entities/(.*)$": "<rootDir>/src/entities/$1", // Match 'entities/*'

"^entities/(.*)$": "<rootDir>/src/entities/$1", // Match 'entities/*'
},
globals: {
APPSMITH_FEATURE_CONFIGS: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ export const StyledControlContainer = styled.div`
cursor: pointer;
height: 100%;
&[data-selected="false"]:hover {
background-color: var(--ads-v2-color-bg-muted);
}
&:focus-visible {
outline: var(--ads-v2-border-width-outline) solid
var(--ads-v2-color-outline);
Expand All @@ -77,7 +81,7 @@ export const StyledControlContainer = styled.div`
/* Select all segments which is not a selected and last child */
/* seperator */
&:not(:last-child):not([data-selected="true"]):not(
&:not(:hover):not(:last-child):not([data-selected="true"]):not(
:has(+ [data-selected="true"])
):after {
content: "";
Expand All @@ -87,15 +91,4 @@ export const StyledControlContainer = styled.div`
height: 16px;
background-color: var(--ads-v2-colors-control-field-default-border);
}
/* This before is to mask the separator in left side of selected control */
/* Mask the seperator with track background color */
&[data-selected="true"]:not(:first-child):after {
content: "";
position: absolute;
left: -7px;
width: 2px;
height: 16px;
background-color: var(--ads-v2-colors-control-track-default-bg);
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Canvas, Meta } from "@storybook/blocks";

import * as EditorSegmentsStories from "./EditorSegments.stories";

<Meta of={EditorSegmentsStories} />

# Editor Segments

Editor Segments is is built on top of the ADS component - Segmented Control. It is a preset template built for Entity Explorer which has a `max-width of 247px` and has extra padding around each of the segments.

Editor Segments present a range of options, and should be used when the user can execute those options instantaneously. It can also accept `children` to add more UI controls, if needed. These will be placed on the right side of the segments. It takes `options`, `selectedSegment` and `onSegmentChange` props to handle the value and onChange functionalities of Segmented Control component.

The options presented should not be binary. If you have a `yes | no` scenario, use a switch, instead.

## Anatomy

### Default implementation

Note: The `options` needs to be passed as required, the UI shown below are not default values being provided to the Editor segments. It also means the `selectedSegment` and `onSegmentChange` props needs to be passed as well.

<Canvas of={EditorSegmentsStories.EditorSegmentsStory} />

### More UI controls

<Canvas of={EditorSegmentsStories.EditorSegmentsStoryWithChildren} />
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import React from "react";
import { EditorSegments } from "./EditorSegments";
import type { EditorSegmentsProps } from "./EditorSegments.types";
import type { StoryObj } from "@storybook/react";
import { Button } from "../../../Button";

export default {
title: "ADS/Templates/Entity Explorer/Editor Segments",
component: EditorSegments,
};

// eslint-disable-next-line react/function-component-definition
const Template = (args: EditorSegmentsProps) => {
return <EditorSegments {...args}>{args.children}</EditorSegments>;
};

export const EditorSegmentsStory = Template.bind({}) as StoryObj;
EditorSegmentsStory.storyName = "Default";
EditorSegmentsStory.args = {
options: [
{
value: "queries",
label: "Queries",
startIcon: "queries-v3",
},
{
value: "js",
label: "JS",
startIcon: "content-type-json",
},
{
value: "ui",
label: "UI",
startIcon: "dashboard-line",
isDisabled: true,
},
],
defaultValue: "queries",
};

export const EditorSegmentsStoryWithIcons = Template.bind({}) as StoryObj;
EditorSegmentsStoryWithIcons.storyName = "Only Icons";
EditorSegmentsStoryWithIcons.args = {
options: [
{
value: "queries",
startIcon: "queries-v3",
},
{
value: "js",
startIcon: "content-type-json",
},
{
value: "ui",
startIcon: "dashboard-line",
},
],
defaultValue: "queries",
};

export const EditorSegmentsStoryWithLabels = Template.bind({}) as StoryObj;
EditorSegmentsStoryWithLabels.storyName = "Only Labels";
EditorSegmentsStoryWithLabels.args = {
options: [
{
value: "queries",
label: "Queries",
},
{
value: "js",
label: "JS",
},
{
value: "ui",
label: "UI",
},
],
defaultValue: "queries",
};

export const EditorSegmentsStoryWithChildren = Template.bind({}) as StoryObj;
EditorSegmentsStoryWithChildren.storyName = "With Children";
EditorSegmentsStoryWithChildren.args = {
options: [
{
value: "queries",
label: "Queries",
},
{
value: "js",
label: "JS",
},
{
value: "ui",
label: "UI",
},
],
defaultValue: "queries",
isFullWidth: true,
children: <Button isIconButton kind="secondary" startIcon="plus" />,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import styled from "styled-components";
import { Flex } from "../../../Flex";

export const Container = styled(Flex)`
.editor-pane-segment-control {
max-width: 247px;
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from "react";
import { SegmentedControl } from "../../../SegmentedControl";
import { Container } from "./EditorSegments.styles";
import type { EditorSegmentsProps } from "./EditorSegments.types";

const EditorSegments = (props: EditorSegmentsProps) => {
const { children, onSegmentChange, options, selectedSegment } = props;

return (
<Container
alignItems="center"
backgroundColor="var(--ads-v2-colors-control-track-default-bg)"
className="ide-editor-left-pane__header"
gap="spaces-2"
justifyContent="space-between"
padding="spaces-2"
>
<SegmentedControl
className="editor-pane-segment-control"
onChange={onSegmentChange}
options={options}
value={selectedSegment}
/>
{children}
</Container>
);
};

EditorSegments.displayName = "EditorSegments";

EditorSegments.defaultProps = {};

export { EditorSegments };
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { SegmentedControlOption } from "../../../SegmentedControl";

export interface EditorSegmentsProps {
selectedSegment: string;
onSegmentChange: (value: string) => void;
options: SegmentedControlOption[];
children?: React.ReactNode | React.ReactNode[];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./EditorSegments";
export * from "./EditorSegments.types";
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { ListItemContainer, ListHeaderContainer } from "./styles";
export { ListWithHeader } from "./ListWithHeader";
export { EditorSegments } from "./EditorSegments";
Loading

0 comments on commit 7fdca47

Please sign in to comment.