Skip to content

Commit

Permalink
Merge pull request #35256 from appsmithorg/release
Browse files Browse the repository at this point in the history
29/07 Daily Promotion
  • Loading branch information
yatinappsmith authored Jul 29, 2024
2 parents 0ce381e + 58f0c0d commit eb10789
Show file tree
Hide file tree
Showing 92 changed files with 1,829 additions and 871 deletions.
2 changes: 1 addition & 1 deletion .github/config.json

Large diffs are not rendered by default.

22 changes: 12 additions & 10 deletions .github/workflows/test-build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,20 +227,22 @@ jobs:
# This step triggers an external workflow for automated analysis of Cypress test runs.
- name: Invoke Automated analysis workflow
if: ( always() && github.ref == 'refs/heads/release' && github.run_attempt <= 2)
run: |
curl --location --request POST ${{secrets.CYPRESS_WORKFLOW_API}} \
--header 'x-appsmith-key: ${{ secrets.CYPRESS_WORKFLOW_KEY }}' \
--header 'Content-Type: application/json' \
--data-raw '{ "workflow_id" : ${{ github.run_id }} ,
"commit_id" : "${{ github.sha }}" ,
"repo" : "${{ github.event.repository.full_name }}" ,
"task" : "${{ github.job }}" ,
"workflow_type" : "${{ github.event_name }}",
"workflow_name" : "${{ github.workflow }}",
"job_id" : "",
"job_data": {
"ci_test_result_sample_data" : "sample_data"
}
--data-raw '{ "workflow_id" : ${{ github.run_id }} ,
"commit_id" : "${{ github.sha }}" ,
"repo" : "${{ github.event.repository.full_name }}" ,
"task" : "${{ github.job }}" ,
"workflow_type" : "${{ github.event_name }}",
"workflow_name" : "TBD",
"job_id" : "",
"attempt" : "${{ github.run_attempt }}",
"job_data": {
"ci_test_result_sample_data" : "sample_data"
}
}'
# Force save the CI failed spec list into a cache
Expand Down
8 changes: 7 additions & 1 deletion app/client/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ export REACT_APP_SENTRY_RELEASE=$GIT_SHA
export REACT_APP_CLIENT_LOG_LEVEL=ERROR
# Disable CRA built-in ESLint checks since we have our own config and a separate step for this
export DISABLE_ESLINT_PLUGIN=true
craco --max-old-space-size=7168 build --config craco.build.config.js
if [ "$APPSMITH_CLOUD_HOSTING" == "true" ]; then
echo "Building profiled build"
craco --max-old-space-size=7168 build --profile --config craco.build.config.js --verbose
else
craco --max-old-space-size=7168 build --config craco.build.config.js
fi


echo "build finished"
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,7 @@ describe(
);
};

before(() => {
entityExplorer.DragDropWidgetNVerify(draggableWidgets.INPUT_V2);
PageLeftPane.switchToAddNew();
});

it("1. All widget tags should be visible but only Suggested tag is open.", () => {
it("1. All widget tags should be visible and open by default.", () => {
agHelper.AssertElementLength(
entityExplorer._widgetTagsList,
Object.keys(WIDGET_TAGS).length,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {

const commonlocators = require("../../../../../../locators/commonlocators.json");
import * as _ from "../../../../../../support/Objects/ObjectsCore";
import { featureFlagIntercept } from "../../../../../../support/Objects/FeatureFlags";

describe(
"Table widget - Select column type functionality",
Expand Down Expand Up @@ -153,23 +154,43 @@ describe(
});

it("5. should check that on option select is working", () => {
featureFlagIntercept({ release_table_cell_label_value_enabled: true });
cy.openPropertyPane("tablewidgetv2");
cy.editColumn("step");
cy.get(".t--property-control-onoptionchange .t--js-toggle").click();
cy.updateCodeInput(
".t--property-control-onoptionchange",
`
{{showAlert(currentRow.step)}}
`,
);
cy.updateCodeInput(
".t--property-control-options",
`
[
{
"label": "#1label",
"value": "#1value"
},
{
"label": "#2label",
"value": "#2value"
},
{
"label": "#3label",
"value": "#3value"
}
]
`,
);
cy.editTableSelectCell(0, 0);
cy.get(".menu-item-link").contains("#3").click();
cy.get(".menu-item-link").contains("#3label").click();

_.agHelper.ValidateToastMessage("#3");
_.agHelper.ValidateToastMessage("#3value");

cy.get(".menu-virtual-list").should("not.exist");
cy.readTableV2data(0, 0).then((val) => {
expect(val).to.equal("#3");
expect(val).to.equal("#3label");
});
cy.discardTableRow(4, 0);
});
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions app/client/cypress/support/Pages/Anvil/AnvilSnapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export class AnvilSnapshot {

this.agHelper.GetElement(locator).matchImageSnapshot(snapshotName, {
comparisonMethod: "ssim",
failureThreshold: 0.01,
failureThresholdType: "percent",
});
}

Expand Down
20 changes: 11 additions & 9 deletions app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"clean:workspaces": "yarn workspaces foreach -pAv exec rm -rf node_modules",
"cypress:snapshot": "npx cypress run -b chromium -s",
"cypress:snapshot:docker": "docker run --network='host' -it --rm -e CYPRESS_$1 -v $PWD:/cypress -w /cypress cypress-snapshot $0",
"cypress:snapshot:docker:build": " docker build . -f cypress/Dockerfile -t cypress-snapshot"
"cypress:snapshot:docker:build": "docker build . -f cypress/Dockerfile -t cypress-snapshot"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.441.0",
Expand All @@ -69,14 +69,16 @@
"@manaflair/redux-batch": "^1.0.0",
"@mantine/hooks": "^5.10.1",
"@newrelic/browser-agent": "^1.255.0",
"@opentelemetry/auto-instrumentations-web": "^0.33.2",
"@opentelemetry/context-zone": "^1.17.1",
"@opentelemetry/exporter-trace-otlp-proto": "^0.44.0",
"@opentelemetry/instrumentation": "^0.44.0",
"@opentelemetry/resources": "^1.17.1",
"@opentelemetry/sdk-trace-base": "^1.17.1",
"@opentelemetry/sdk-trace-web": "^1.17.1",
"@opentelemetry/semantic-conventions": "^1.17.1",
"@opentelemetry/auto-instrumentations-web": "0.40.0",
"@opentelemetry/context-zone": "1.25.1",
"@opentelemetry/exporter-metrics-otlp-http": "0.52.1",
"@opentelemetry/exporter-trace-otlp-proto": "0.52.1",
"@opentelemetry/instrumentation": "0.52.1",
"@opentelemetry/resources": "1.25.1",
"@opentelemetry/sdk-metrics": "1.25.1",
"@opentelemetry/sdk-trace-base": "1.25.1",
"@opentelemetry/sdk-trace-web": "1.25.1",
"@opentelemetry/semantic-conventions": "1.25.1",
"@react-types/shared": "^3.23.0",
"@sentry/react": "^6.2.4",
"@sentry/tracing": "^6.2.4",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,52 @@
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
import { WebTracerProvider } from "@opentelemetry/sdk-trace-web";
import { registerInstrumentations } from "@opentelemetry/instrumentation";
import { ZoneContextManager } from "@opentelemetry/context-zone";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
import { Resource } from "@opentelemetry/resources";
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
import {
SEMRESATTRS_SERVICE_NAME,
SEMRESATTRS_SERVICE_VERSION,
SEMRESATTRS_SERVICE_INSTANCE_ID,
} from "@opentelemetry/semantic-conventions";
import { getAppsmithConfigs } from "@appsmith/configs";
import { W3CTraceContextPropagator } from "@opentelemetry/core";
import {
MeterProvider,
PeriodicExportingMetricReader,
} from "@opentelemetry/sdk-metrics";
import {
OTLPMetricExporter,
AggregationTemporalityPreference,
} from "@opentelemetry/exporter-metrics-otlp-http";
import type { Context, TextMapSetter } from "@opentelemetry/api";
import { metrics } from "@opentelemetry/api";

enum CompressionAlgorithm {
NONE = "none",
GZIP = "gzip",
}
const { newRelic } = getAppsmithConfigs();
const { applicationId, otlpEndpoint, otlpLicenseKey, otlpServiceName } =
newRelic;

const provider = new WebTracerProvider({
const tracerProvider = new WebTracerProvider({
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: otlpServiceName,
[SemanticResourceAttributes.SERVICE_INSTANCE_ID]: applicationId,
[SemanticResourceAttributes.SERVICE_VERSION]: "1.0.0",
[SEMRESATTRS_SERVICE_NAME]: otlpServiceName,
[SEMRESATTRS_SERVICE_INSTANCE_ID]: applicationId,
[SEMRESATTRS_SERVICE_VERSION]: "1.0.0",
}),
});

const newRelicExporter = new OTLPTraceExporter({
const nrTracesExporter = new OTLPTraceExporter({
url: `${otlpEndpoint}/v1/traces`,
compression: CompressionAlgorithm.GZIP,
headers: {
"api-key": otlpLicenseKey,
},
});

const processor = new BatchSpanProcessor(
newRelicExporter,
nrTracesExporter,
//Optional BatchSpanProcessor Configurations
{
// The maximum queue size. After the size is reached spans are dropped.
Expand All @@ -47,7 +65,11 @@ const CUSTOM_OTLP_TRACE_HEADER = "traceparent-otlp";
//We are overriding the default header "traceparent" used for trace context because the browser
// agent shares the same header's distributed tracing
class CustomW3CTraceContextPropagator extends W3CTraceContextPropagator {
inject(context, carrier, setter) {
inject(
context: Context,
carrier: Record<string, unknown>,
setter: TextMapSetter,
) {
// Call the original inject method to get the default traceparent header
super.inject(context, carrier, setter);

Expand All @@ -59,12 +81,34 @@ class CustomW3CTraceContextPropagator extends W3CTraceContextPropagator {
}
}

provider.addSpanProcessor(processor);
provider.register({
tracerProvider.addSpanProcessor(processor);
tracerProvider.register({
contextManager: new ZoneContextManager(),
propagator: new CustomW3CTraceContextPropagator(),
});

registerInstrumentations({
instrumentations: [],
const nrMetricsExporter = new OTLPMetricExporter({
compression: CompressionAlgorithm.GZIP,
temporalityPreference: AggregationTemporalityPreference.DELTA,
url: `${otlpEndpoint}/v1/metrics`,
headers: {
"api-key": otlpLicenseKey,
},
});

const meterProvider = new MeterProvider({
resource: new Resource({
[SEMRESATTRS_SERVICE_NAME]: otlpServiceName,
[SEMRESATTRS_SERVICE_INSTANCE_ID]: applicationId,
[SEMRESATTRS_SERVICE_VERSION]: "1.0.0",
}),
readers: [
new PeriodicExportingMetricReader({
exporter: nrMetricsExporter,
exportIntervalMillis: 30000, // Adjust the export interval as needed
}),
],
});

// Register the MeterProvider globally
metrics.setGlobalMeterProvider(meterProvider);
32 changes: 30 additions & 2 deletions app/client/src/UITelemetry/generateTraces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import { deviceType } from "react-device-detect";

import { APP_MODE } from "entities/App";
import { matchBuilderPath, matchViewerPath } from "constants/routes";
import memoizeOne from "memoize-one";

const GENERATOR_TRACE = "generator-tracer";

export type OtlpSpan = Span;
export type SpanAttributes = Attributes;

const getCommonTelemetryAttributes = () => {
const pathname = window.location.pathname;
const getAppMode = memoizeOne((pathname: string) => {
const isEditorUrl = matchBuilderPath(pathname);
const isViewerUrl = matchViewerPath(pathname);

Expand All @@ -27,6 +27,11 @@ const getCommonTelemetryAttributes = () => {
: isViewerUrl
? APP_MODE.PUBLISHED
: "";
return appMode;
});
const getCommonTelemetryAttributes = () => {
const pathname = window.location.pathname;
const appMode = getAppMode(pathname);

return {
appMode,
Expand Down Expand Up @@ -87,7 +92,30 @@ export function setAttributesToSpan(
span?.setAttributes(spanAttributes);
}

export const startAndEndSpanForFn = <T>(
spanName: string,
spanAttributes: SpanAttributes = {},
fn: () => T,
) => {
const span = startRootSpan(spanName, spanAttributes);
const res: T = fn();
span.end();
return res;
};

export function wrapFnWithParentTraceContext(parentSpan: Span, fn: () => any) {
const parentContext = trace.setSpan(context.active(), parentSpan);
return context.with(parentContext, fn);
}

export function startAndEndSpan(
spanName: string,
startTime: number,
difference: number,
spanAttributes: SpanAttributes = {},
) {
const endTime = startTime + Math.floor(difference);

const span = startRootSpan(spanName, spanAttributes, startTime);
span.end(endTime);
}
15 changes: 15 additions & 0 deletions app/client/src/WidgetProvider/factory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class WidgetFactory {
Partial<WidgetProps> & WidgetConfigProps & { type: string }
> = new Map();

static widgetDefaultPropertiesMap: Map<string, Record<string, unknown>> =
new Map();

static widgetsMap: Map<WidgetType, typeof BaseWidget> = new Map();

static widgetBuilderMap: Map<WidgetType, any> = new Map();
Expand Down Expand Up @@ -132,6 +135,18 @@ class WidgetFactory {
onCanvasUI,
};

// When adding widgets to canvas in Anvil, we don't need all of configured properties
// (See _config object)
// and that should ideally be the case for Fixed mode widgets as well
// So, creating this map to use in WidgetAdditionSagas for both Fixed
// and Anvil.
// Before this we were using "ALL" configured properties when creating
// the newly added widget. This lead to many extra properties being added
// to the DSL
WidgetFactory.widgetDefaultPropertiesMap.set(
widget.type,
Object.freeze({ ...defaultConfig }),
);
WidgetFactory.widgetConfigMap.set(widget.type, Object.freeze(_config));
}

Expand Down
3 changes: 3 additions & 0 deletions app/client/src/ce/entities/FeatureFlag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export const FEATURE_FLAG = {
"rollout_remove_feature_walkthrough_enabled",
release_drag_drop_building_blocks_enabled:
"release_drag_drop_building_blocks_enabled",
release_table_cell_label_value_enabled:
"release_table_cell_label_value_enabled",
rollout_js_enabled_one_click_binding_enabled:
"rollout_js_enabled_one_click_binding_enabled",
rollout_side_by_side_enabled: "rollout_side_by_side_enabled",
Expand Down Expand Up @@ -63,6 +65,7 @@ export const DEFAULT_FEATURE_FLAG_VALUE: FeatureFlags = {
license_gac_enabled: false,
release_anvil_enabled: false,
release_drag_drop_building_blocks_enabled: false,
release_table_cell_label_value_enabled: false,
license_git_branch_protection_enabled: false,
release_git_autocommit_feature_enabled: false,
license_git_continuous_delivery_enabled: false,
Expand Down
6 changes: 6 additions & 0 deletions app/client/src/ce/reducers/uiReducers/apiPaneReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ export const handlers = {
},
};
},
[ReduxActionTypes.RESET_EDITOR_REQUEST]: (state: ApiPaneReduxState) => {
return {
...state,
isSaving: {},
};
},
};

const apiPaneReducer = createReducer(initialState, handlers);
Expand Down
Loading

0 comments on commit eb10789

Please sign in to comment.