chore: bug fixes agents (#40206)
- [x] Bug in the select widget that makes it always show Please select an option even when an option is selected - [x] Add documentation link to the help modal in the editor - [x] Share Modal update <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced the non-public application view by grouping content with an added banner for improved layout. - Updated the documentation link to conditionally use a tailored URL based on the active AI flow. - Streamlined the help menu by removing the bug reporting option. - **Refactor** - Optimized the internal processing of widget options for clearer and more efficient handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
e87479f3d9
commit
0c9d96c149
|
|
@ -217,11 +217,14 @@ export function EmbedSnippetTab({
|
|||
|
||||
if (!isPublicApp) {
|
||||
return (
|
||||
<PrivateEmbeddingContent
|
||||
changeTab={changeTab}
|
||||
isAppSettings={isAppSettings}
|
||||
userAppPermissions={currentApplicationDetails?.userPermissions ?? []}
|
||||
/>
|
||||
<div className="flex flex-col gap-6">
|
||||
<PrivateEmbeddingContent
|
||||
changeTab={changeTab}
|
||||
isAppSettings={isAppSettings}
|
||||
userAppPermissions={currentApplicationDetails?.userPermissions ?? []}
|
||||
/>
|
||||
<ChromeExtensionBanner />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import { Colors } from "constants/Colors";
|
|||
import { getCurrentApplicationId } from "selectors/editorSelectors";
|
||||
import type { ThemeProp } from "WidgetProvider/constants";
|
||||
import { toast } from "@appsmith/ads";
|
||||
import { DOCS_BASE_URL } from "constants/ThirdPartyConstants";
|
||||
import { DOCS_AI_BASE_URL, DOCS_BASE_URL } from "constants/ThirdPartyConstants";
|
||||
import { getAppsmithConfigs } from "ee/configs";
|
||||
import { getCurrentUser } from "selectors/usersSelectors";
|
||||
import { getIsAiAgentFlowEnabled } from "ee/selectors/aiAgentSelectors";
|
||||
|
|
@ -151,7 +151,10 @@ export const useNavigationMenuData = ({
|
|||
children: [
|
||||
{
|
||||
text: "Documentation",
|
||||
onClick: () => openExternalLink(DOCS_BASE_URL),
|
||||
onClick: () =>
|
||||
openExternalLink(
|
||||
isAiAgentFlowEnabled ? DOCS_AI_BASE_URL : DOCS_BASE_URL,
|
||||
),
|
||||
type: MenuTypes.MENU,
|
||||
isVisible: true,
|
||||
startIcon: "book-line",
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ interface HelpItem {
|
|||
icon: string;
|
||||
}
|
||||
|
||||
const HELP_MENU_ITEMS: HelpItem[] = [
|
||||
let HELP_MENU_ITEMS: HelpItem[] = [
|
||||
{
|
||||
icon: "book-line",
|
||||
label: "Documentation",
|
||||
|
|
@ -201,9 +201,8 @@ function HelpButton() {
|
|||
docItem.link = DOCS_AI_BASE_URL;
|
||||
}
|
||||
|
||||
HELP_MENU_ITEMS.splice(
|
||||
HELP_MENU_ITEMS.findIndex((item) => item.label === "Report a bug"),
|
||||
1,
|
||||
HELP_MENU_ITEMS = HELP_MENU_ITEMS.filter(
|
||||
(item) => item.label !== "Report a bug",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,29 +16,6 @@ export default {
|
|||
: optionArray;
|
||||
};
|
||||
|
||||
/**
|
||||
* SourceData:
|
||||
* [{
|
||||
* "name": "Blue",
|
||||
* "code": "name"
|
||||
* },{
|
||||
* "name": "Green",
|
||||
* "code": "name"
|
||||
* },{
|
||||
* "name": "Red",
|
||||
* "code": "name"
|
||||
* }]
|
||||
* The `Label key` in UI can take following values:
|
||||
* 1. Normal string, without any quotes. e.g `name`
|
||||
* This can be assumed as a key in each item of sourceData. We search it in each item of sourceData.
|
||||
* 2. Except this everything comes in `{{}}`. It can have 2 types of values:
|
||||
* a. Expressions that evaluate to a normal string. e.g `{{(() => `name`)()}}`
|
||||
* In this case evaluated value will be ['name', 'name', 'name'].
|
||||
* i. This can be assumed as a key in each item of sourceData. Handled by `allLabelsEqual` check.
|
||||
* b. Dynamic property accessed via `item` object. e.g `{{item.name}}`
|
||||
* In this case evaluated value will be actual values form sourceData ['Red', 'Green', 'Blue'].
|
||||
* Hence we can assume that this array is the labels array.
|
||||
* */
|
||||
if (typeof props.optionLabel === "string") {
|
||||
labels = sourceData.map((d) => d[props.optionLabel]);
|
||||
} else if (_.isArray(props.optionLabel)) {
|
||||
|
|
@ -56,11 +33,13 @@ export default {
|
|||
value: values[i],
|
||||
}));
|
||||
},
|
||||
//
|
||||
getIsValid: (props, moment, _) => {
|
||||
return props.isRequired
|
||||
? !_.isNil(props.selectedOptionValue) && props.selectedOptionValue !== ""
|
||||
: true;
|
||||
},
|
||||
//
|
||||
getSelectedOptionValue: (props, moment, _) => {
|
||||
const isServerSideFiltered = props.serverSideFiltering;
|
||||
const options = props.options ?? [];
|
||||
|
|
|
|||
|
|
@ -20,9 +20,8 @@ import {
|
|||
} from "../config";
|
||||
import { validateInput } from "./helpers";
|
||||
import type { WDSSelectWidgetProps } from "./types";
|
||||
import derivedPropertyFns from "./derived";
|
||||
import { parseDerivedProperties } from "widgets/WidgetUtils";
|
||||
import isArray from "lodash/isArray";
|
||||
import derivedProperties from "./parseDerivedProperties";
|
||||
|
||||
const isTrueObject = (item: unknown): item is Record<string, unknown> => {
|
||||
return Object.prototype.toString.call(item) === "[object Object]";
|
||||
|
|
@ -67,13 +66,11 @@ class WDSSelectWidget extends BaseWidget<WDSSelectWidgetProps, WidgetState> {
|
|||
}
|
||||
|
||||
static getDerivedPropertiesMap() {
|
||||
const parsedDerivedProperties = parseDerivedProperties(derivedPropertyFns);
|
||||
|
||||
return {
|
||||
options: `{{(()=>{${parsedDerivedProperties.getOptions}})()}}`,
|
||||
isValid: `{{(()=>{${parsedDerivedProperties.getIsValid}})()}}`,
|
||||
selectedOptionValue: `{{(()=>{${parsedDerivedProperties.getSelectedOptionValue}})()}}`,
|
||||
selectedOptionLabel: `{{(()=>{${parsedDerivedProperties.getSelectedOptionLabel}})()}}`,
|
||||
options: `{{(()=>{${derivedProperties.getOptions}})()}}`,
|
||||
isValid: `{{(()=>{${derivedProperties.getIsValid}})()}}`,
|
||||
selectedOptionValue: `{{(()=>{${derivedProperties.getSelectedOptionValue}})()}}`,
|
||||
selectedOptionLabel: `{{(()=>{${derivedProperties.getSelectedOptionLabel}})()}}`,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
// @ts-expect-error: Types are not available
|
||||
import widgetPropertyFns from "!!raw-loader!./derived.js";
|
||||
|
||||
// TODO(abhinav):
|
||||
// Add unit test cases
|
||||
// Handle edge cases
|
||||
// Error out on wrong values
|
||||
// TODO: Fix this the next time the file is edited
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const derivedProperties: any = {};
|
||||
// const regex = /(\w+):\s?\(props\)\s?=>\s?{([\w\W]*?)},/gim;
|
||||
const regex =
|
||||
/(\w+):\s?\(props, moment, _\)\s?=>\s?{([\w\W\n]*?)},\n?\s+?\/\//gim;
|
||||
|
||||
let m;
|
||||
|
||||
while ((m = regex.exec(widgetPropertyFns)) !== null) {
|
||||
// This is necessary to avoid infinite loops with zero-width matches
|
||||
if (m.index === regex.lastIndex) {
|
||||
regex.lastIndex++;
|
||||
}
|
||||
|
||||
let key = "";
|
||||
|
||||
// The result can be accessed through the `m`-variable.
|
||||
m.forEach((match, groupIndex) => {
|
||||
if (groupIndex === 1) {
|
||||
key = match;
|
||||
}
|
||||
|
||||
if (groupIndex === 2) {
|
||||
derivedProperties[key] = match
|
||||
.trim()
|
||||
.replace(/\n/g, "")
|
||||
.replace(/props\./g, "this.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export default derivedProperties;
|
||||
Loading…
Reference in New Issue
Block a user