Skip to content

Commit

Permalink
rename ValueSearchControl -> SearchValue
Browse files Browse the repository at this point in the history
  • Loading branch information
JafarMirzaie committed Mar 29, 2022
1 parent 0194798 commit 8057968
Show file tree
Hide file tree
Showing 40 changed files with 697 additions and 679 deletions.
2 changes: 1 addition & 1 deletion Signum.Engine/CodeGeneration/ReactCodeGenerator.cs
Expand Up @@ -392,7 +392,7 @@ protected virtual string WriteEntityComponentFile(Type type)
sb.AppendLine("import * as React from 'react'");
sb.AppendLine("import { " + type.Name + " } from '../" + type.Namespace + "'");
sb.AppendLine("import { TypeContext, ValueLine, EntityLine, EntityCombo, EntityList, EntityDetail, EntityStrip, EntityRepeater, EntityTable, FormGroup } from '@framework/Lines'");
sb.AppendLine("import { SearchControl, ValueSearchControl, FilterOperation, OrderType, PaginationMode } from '@framework/Search'");
sb.AppendLine("import { SearchControl, SearchValue, FilterOperation, OrderType, PaginationMode } from '@framework/Search'");

var v = GetVarName(type);

Expand Down
4 changes: 2 additions & 2 deletions Signum.React.Extensions.Selenium/Frames/LineContainer.cs
Expand Up @@ -285,13 +285,13 @@ public static SearchControlProxy GetSearchControl(this ILineContainer lineContai
return new SearchControlProxy(element);
}

public static ValueSearchControlLineProxy GetValueSearchControlLine(this ILineContainer lineContainer, object queryName)
public static SearchValueLineProxy GetSearchValueLine(this ILineContainer lineContainer, object queryName)
{
string queryKey = QueryUtils.GetKey(queryName);

var element = lineContainer.Element.WaitElementVisible(By.CssSelector("[data-value-query-key={0}]".FormatWith(queryKey)));

return new ValueSearchControlLineProxy(element);
return new SearchValueLineProxy(element);
}
}

Expand Down
Expand Up @@ -4,13 +4,13 @@

namespace Signum.React.Extensions.Selenium.Search;

public class ValueSearchControlLineProxy
public class SearchValueLineProxy
{
public WebDriver Selenium { get; private set; }

public IWebElement Element { get; private set; }

public ValueSearchControlLineProxy(IWebElement element)
public SearchValueLineProxy(IWebElement element)
{
this.Selenium = element.GetDriver();
this.Element = element;
Expand Down
Expand Up @@ -4,7 +4,7 @@ import { EntityCheckboxList, ValueLine } from '@framework/Lines'
import { TypeContext } from '@framework/TypeContext'
import { AlertEntity, AlertState, AlertTypeSymbol, SendNotificationEmailTaskEntity } from '../Signum.Entities.Alerts'
import { useForceUpdate } from '../../../Signum.React/Scripts/Hooks';
import { ValueSearchControlLine } from '../../../Signum.React/Scripts/Search';
import { SearchValueLine } from '../../../Signum.React/Scripts/Search';
import { toLite } from '@framework/Signum.Entities'

export default function SendNotificationEmailTask(p: { ctx: TypeContext<SendNotificationEmailTaskEntity> }) {
Expand All @@ -17,7 +17,7 @@ export default function SendNotificationEmailTask(p: { ctx: TypeContext<SendNoti
<ValueLine ctx={ctx.subCtx(n => n.ignoreNotificationsOlderThan)} labelColumns={4} onChange={forceUpdate} valueColumns={2}/>
<ValueLine ctx={ctx.subCtx(n => n.sendBehavior)} labelColumns={4} onChange={forceUpdate} />
{(ctx.value.sendBehavior == "Exclude" || ctx.value.sendBehavior == "Include") && < EntityCheckboxList ctx={ctx.subCtx(n => n.alertTypes)} columnCount={1} onChange={forceUpdate}/>}
<ValueSearchControlLine ctx={ctx} findOptions={{
<SearchValueLine ctx={ctx} findOptions={{
queryName: AlertEntity,
filterOptions: [
{ token: AlertEntity.token(a => a.entity.state), value: AlertState.value("Saved") },
Expand Down
4 changes: 2 additions & 2 deletions Signum.React.Extensions/Authorization/AzureAD/ADGroup.tsx
Expand Up @@ -3,14 +3,14 @@ import { EntityLine, EntityTable, ValueLine } from '@framework/Lines'
import { TypeContext } from '@framework/TypeContext'
import { useForceUpdate } from '@framework/Hooks';
import { ADGroupEntity, UserADQuery } from '../Signum.Entities.Authorization';
import { ValueSearchControlLine } from '@framework/Search';
import { SearchValueLine } from '@framework/Search';

export default function ADGroup(p: { ctx: TypeContext<ADGroupEntity> }) {
const ctx = p.ctx;
return (
<div>
<ValueLine ctx={ctx.subCtx(n => n.displayName)} />
<ValueSearchControlLine ctx={ctx} findOptions={{ queryName: UserADQuery.ActiveDirectoryUsers, filterOptions: [{ token: "InGroup", value: ctx.value }] }} />
<SearchValueLine ctx={ctx} findOptions={{ queryName: UserADQuery.ActiveDirectoryUsers, filterOptions: [{ token: "InGroup", value: ctx.value }] }} />
</div>
);
}
6 changes: 3 additions & 3 deletions Signum.React.Extensions/Authorization/Templates/Role.tsx
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react'
import { RoleEntity, AuthAdminMessage, UserEntity } from '../Signum.Entities.Authorization'
import { ValueLine, EntityStrip, TypeContext } from '@framework/Lines'
import { useForceUpdate } from '@framework/Hooks'
import { ValueSearchControlLine } from '@framework/Search';
import { SearchValue, SearchValueLine } from '@framework/Search';

export default function Role(p : { ctx: TypeContext<RoleEntity> }){
const forceUpdate = useForceUpdate();
Expand All @@ -25,12 +25,12 @@ export default function Role(p : { ctx: TypeContext<RoleEntity> }){
}}
onChange={() => forceUpdate()} />

{!ctx.value.isNew && <ValueSearchControlLine ctx={ctx} findOptions={{
{!ctx.value.isNew && <SearchValueLine ctx={ctx} findOptions={{
queryName: UserEntity,
filterOptions: [{ token: UserEntity.token(u => u.entity.role), value: ctx.value }]
}} />
}
{!ctx.value.isNew && <ValueSearchControlLine ctx={ctx} findOptions={{
{!ctx.value.isNew && <SearchValueLine ctx={ctx} findOptions={{
queryName: RoleEntity,
filterOptions: [{ token: RoleEntity.token(a => a.entity).append(u => u.roles).any(), value: ctx.value }]
}} />
Expand Down
4 changes: 2 additions & 2 deletions Signum.React.Extensions/Dashboard/Admin/Dashboard.tsx
Expand Up @@ -13,7 +13,7 @@ import { ColorTypeaheadLine } from "../../Basics/Templates/ColorTypeahead";
import "../Dashboard.css"
import { getToString, toLite } from '@framework/Signum.Entities';
import { useForceUpdate } from '@framework/Hooks'
import { ValueSearchControlLine } from '../../../Signum.React/Scripts/Search';
import { SearchValueLine } from '../../../Signum.React/Scripts/Search';
import { withClassName } from '../../Dynamic/View/HtmlAttributesExpression';
import { classes } from '../../../Signum.React/Scripts/Globals';
import { OperationButton } from '../../../Signum.React/Scripts/Operations/EntityOperations';
Expand Down Expand Up @@ -162,7 +162,7 @@ export default function Dashboard(p: { ctx: TypeContext<DashboardEntity> }) {
<ValueLine ctx={ectx.subCtx(cp => cp.autoRegenerateWhenOlderThan)} />
</div>
<div className="col-sm-2">
{!ctx.value.isNew && <ValueSearchControlLine ctx={ectx} findOptions={{ queryName: CachedQueryEntity, filterOptions: [{ token: CachedQueryEntity.token(a => a.dashboard), value: ctxBasic.value }] }} />}
{!ctx.value.isNew && <SearchValueLine ctx={ectx} findOptions={{ queryName: CachedQueryEntity, filterOptions: [{ token: CachedQueryEntity.token(a => a.dashboard), value: ctxBasic.value }] }} />}
</div>
<div className="col-sm-3 pt-4">
{!ctx.value.isNew && <OperationButton eoc={EntityOperationContext.fromTypeContext(ctx, DashboardOperation.RegenerateCachedQueries)} hideOnCanExecute className="w-100" />}
Expand Down
2 changes: 1 addition & 1 deletion Signum.React.Extensions/Dashboard/Admin/LinkListPart.tsx
Expand Up @@ -4,7 +4,7 @@ import { ValueLine, EntityRepeater, EntityTable } from '@framework/Lines'
import { TypeContext } from '@framework/TypeContext'
import { LinkListPartEntity, LinkElementEmbedded } from '../Signum.Entities.Dashboard'

export default function ValueSearchControlPart(p : { ctx: TypeContext<LinkListPartEntity> }){
export default function SearchValuePart(p : { ctx: TypeContext<LinkListPartEntity> }){
const ctx = p.ctx.subCtx({ formGroupStyle: "SrOnly", placeholderLabels: true });

return (
Expand Down
6 changes: 3 additions & 3 deletions Signum.React.Extensions/Dashboard/View/UserQueryPart.tsx
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react'
import { FindOptions } from '@framework/FindOptions'
import { getQueryKey, getQueryNiceName, getTypeInfos } from '@framework/Reflection'
import { Entity, Lite, is, JavascriptMessage, toLite, liteKey } from '@framework/Signum.Entities'
import { SearchControl, ValueSearchControl, ValueSearchControlController } from '@framework/Search'
import { SearchControl, SearchValue, SearchValueController } from '@framework/Search'
import * as UserQueryClient from '../../UserQueries/UserQueryClient'
import { UserQueryPartEntity, PanelPartEmbedded } from '../Signum.Entities.Dashboard'
import { classes, getColorContrasColorBWByHex, softCast } from '@framework/Globals';
Expand Down Expand Up @@ -142,7 +142,7 @@ interface BigValueBadgeProps {

export function BigValueSearchCounter(p: BigValueBadgeProps) {

const vsc = React.useRef<ValueSearchControlController>(null);
const vsc = React.useRef<SearchValueController>(null);

return (
<div className={classes(
Expand All @@ -158,7 +158,7 @@ export function BigValueSearchCounter(p: BigValueBadgeProps) {
</div>
<div className={classes("col-9 flip", "text-end")}>
<h1>
<ValueSearchControl ref={vsc} findOptions={p.findOptions} isLink={false} isBadge={false} deps={p.deps}
<SearchValue ref={vsc} findOptions={p.findOptions} isLink={false} isBadge={false} deps={p.deps}
customRequest={p.cachedQuery && ((req, fop, token) => p.cachedQuery!.then(cq => executeQueryValueCached(req, fop, token, cq)))}
/>
</h1>
Expand Down
2 changes: 1 addition & 1 deletion Signum.React.Extensions/Dashboard/View/UserTreePart.tsx
Expand Up @@ -4,7 +4,7 @@ import { FindOptions } from '@framework/FindOptions'
import * as Finder from '@framework/Finder'
import { getQueryNiceName, getTypeInfos } from '@framework/Reflection'
import { Entity, Lite, is, JavascriptMessage } from '@framework/Signum.Entities'
import { SearchControl, ValueSearchControl } from '@framework/Search'
import { SearchControl, SearchValue } from '@framework/Search'
import * as UserQueryClient from '../../UserQueries/UserQueryClient'
import { UserTreePartEntity } from '../Signum.Entities.Dashboard'
import { classes } from '@framework/Globals';
Expand Down
Expand Up @@ -4,7 +4,7 @@ import { FormGroup } from '@framework/Lines'
import { FindOptions } from '@framework/FindOptions'
import { getQueryNiceName } from '@framework/Reflection'
import { Entity, Lite, is, JavascriptMessage, liteKey, toLite } from '@framework/Signum.Entities'
import { ValueSearchControlLine } from '@framework/Search'
import { SearchValueLine } from '@framework/Search'
import { TypeContext, mlistItemContext } from '@framework/TypeContext'
import * as UserQueryClient from '../../UserQueries/UserQueryClient'
import { ValueUserQueryListPartEntity, ValueUserQueryElementEmbedded, PanelPartEmbedded, CachedQueryEntity } from '../Signum.Entities.Dashboard'
Expand Down Expand Up @@ -60,7 +60,7 @@ export function ValueUserQueryElement(p: ValueUserQueryElementProps) {
<span>{ctx.value.label ?? getQueryNiceName(fo.queryName)}</span>
</div>
<div className="col-auto">
<ValueSearchControlLine ctx={ctx2} findOptions={fo}
<SearchValueLine ctx={ctx2} findOptions={fo}
customRequest={p.cachedQuery && ((qr, fo, token) => p.cachedQuery!.then(cq => executeQueryValueCached(qr, fo, token, cq)))} />
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions Signum.React.Extensions/Dynamic/DynamicApiClient.tsx
Expand Up @@ -2,15 +2,15 @@ import * as React from 'react'
import { EntitySettings } from '@framework/Navigator'
import * as Navigator from '@framework/Navigator'
import { DynamicApiEntity, DynamicApiEval } from './Signum.Entities.Dynamic'
import { SearchControl, ValueSearchControlLine } from '@framework/Search'
import { SearchControl, SearchValueLine } from '@framework/Search'
import * as Finder from '@framework/Finder'
import * as Constructor from '@framework/Constructor'
import * as DynamicClientOptions from './DynamicClientOptions'

export function start(options: { routes: JSX.Element[] }) {
Navigator.addSettings(new EntitySettings(DynamicApiEntity, w => import('./Api/DynamicApi')));
Constructor.registerConstructor(DynamicApiEntity, () => DynamicApiEntity.New({ eval: DynamicApiEval.New() }));
DynamicClientOptions.Options.onGetDynamicLineForPanel.push(ctx => <ValueSearchControlLine ctx={ctx} findOptions={{ queryName: DynamicApiEntity }} />);
DynamicClientOptions.Options.onGetDynamicLineForPanel.push(ctx => <SearchValueLine ctx={ctx} findOptions={{ queryName: DynamicApiEntity }} />);
DynamicClientOptions.Options.registerDynamicPanelSearch(DynamicApiEntity, t => [
{ token: t.append(p => p.name), type: "Text" },
{ token: t.append(p => p.entity.eval!.script), type: "Code" },
Expand Down
2 changes: 1 addition & 1 deletion Signum.React.Extensions/Dynamic/DynamicClientClient.tsx
@@ -1,6 +1,6 @@
import * as React from 'react'
import { ajaxPost, ajaxGet } from '@framework/Services';
import { ValueSearchControlLine } from '@framework/Search'
import { SearchValueLine } from '@framework/Search'
import { EntitySettings } from '@framework/Navigator'
import * as Navigator from '@framework/Navigator'
import { Entity } from '@framework/Signum.Entities'
Expand Down
4 changes: 2 additions & 2 deletions Signum.React.Extensions/Dynamic/DynamicClientOptions.tsx
Expand Up @@ -4,7 +4,7 @@ import { StyleContext } from '@framework/TypeContext'
import { FindOptions, FilterConditionOption, ColumnOption } from '@framework/FindOptions';
import { Type, QueryTokenString } from '@framework/Reflection';
import { Entity } from '@framework/Signum.Entities';
import { ValueSearchControlLine } from '@framework/Search';
import { SearchValueLine } from '@framework/Search';
import { CellFormatter } from '@framework/Finder';
import { expandNumbers, DiffDocument } from '../DiffLog/Templates/DiffDocument';

Expand Down Expand Up @@ -32,7 +32,7 @@ export namespace Options {


return (
<ValueSearchControlLine ctx={ctx} findOptions={findOptions} searchControlProps={{
<SearchValueLine ctx={ctx} findOptions={findOptions} searchControlProps={{
formatters: columns.toObjectDistinct(a => a.token.toString(), a => new CellFormatter((cell, cfc) => cell && <HighlightText search={search} text={cell} type={a.type} />))
}} />
);
Expand Down
6 changes: 3 additions & 3 deletions Signum.React.Extensions/Dynamic/DynamicExpressionClient.tsx
@@ -1,7 +1,7 @@

import * as React from 'react'
import { ajaxPost } from '@framework/Services';
import { ValueSearchControlLine } from '@framework/Search'
import { SearchValueLine } from '@framework/Search'
import { EntitySettings } from '@framework/Navigator'
import * as Navigator from '@framework/Navigator'
import { Entity } from '@framework/Signum.Entities'
Expand All @@ -11,8 +11,8 @@ import { DynamicExpressionEntity } from './Signum.Entities.Dynamic'
export function start(options: { routes: JSX.Element[] }) {

Navigator.addSettings(new EntitySettings(DynamicExpressionEntity, w => import('./Expression/DynamicExpression')));
DynamicClientOptions.Options.onGetDynamicLineForPanel.push(ctx => <ValueSearchControlLine ctx={ctx} findOptions={{ queryName: DynamicExpressionEntity }} />);
DynamicClientOptions.Options.onGetDynamicLineForType.push((ctx, type) => <ValueSearchControlLine ctx={ctx} findOptions={{ queryName: DynamicExpressionEntity, filterOptions: [{ token: DynamicExpressionEntity.token(e => e.fromType), value: type + "Entity" }]}} />);
DynamicClientOptions.Options.onGetDynamicLineForPanel.push(ctx => <SearchValueLine ctx={ctx} findOptions={{ queryName: DynamicExpressionEntity }} />);
DynamicClientOptions.Options.onGetDynamicLineForType.push((ctx, type) => <SearchValueLine ctx={ctx} findOptions={{ queryName: DynamicExpressionEntity, filterOptions: [{ token: DynamicExpressionEntity.token(e => e.fromType), value: type + "Entity" }]}} />);
DynamicClientOptions.Options.registerDynamicPanelSearch(DynamicExpressionEntity, t => [
{ token: t.append(p => p.entity.body), type: "Code" },
{ token: t.append(p => p.name), type: "Text" },
Expand Down
Expand Up @@ -6,7 +6,7 @@ import { StyleContext } from '@framework/TypeContext'
import * as Finder from '@framework/Finder'
import * as AppContext from '@framework/AppContext'
import { WebApiHttpError } from '@framework/Services'
import { ValueSearchControl, FindOptions, ValueSearchControlLine } from '@framework/Search'
import { SearchValue, FindOptions, SearchValueLine } from '@framework/Search'
import EntityLink from '@framework/SearchControl/EntityLink'
import { QueryEntitiesRequest } from '@framework/FindOptions'
import { getQueryNiceName, QueryTokenString } from '@framework/Reflection'
Expand Down
4 changes: 2 additions & 2 deletions Signum.React.Extensions/Dynamic/DynamicPanelSimplePage.tsx
Expand Up @@ -6,7 +6,7 @@ import { StyleContext } from '@framework/TypeContext'
import * as Finder from '@framework/Finder'
import * as AppContext from '@framework/AppContext'
import { WebApiHttpError } from '@framework/Services'
import { ValueSearchControl, FindOptions, ValueSearchControlLine } from '@framework/Search'
import { SearchValue, FindOptions, SearchValueLine } from '@framework/Search'
import EntityLink from '@framework/SearchControl/EntityLink'
import { QueryEntitiesRequest } from '@framework/FindOptions'
import { getQueryNiceName, QueryTokenString } from '@framework/Reflection'
Expand Down Expand Up @@ -144,7 +144,7 @@ export function CheckEvalType(p: CheckEvalTypeProps) {

return (
<FormGroup ctx={p.ctx} labelText={getQueryNiceName(p.findOptions.queryName)}>
<ValueSearchControl findOptions={p.findOptions} isLink={true} />
<SearchValue findOptions={p.findOptions} isLink={true} />
{
state == "loading" ?
<FontAwesomeIcon icon="sync" spin={true} /> :
Expand Down
6 changes: 3 additions & 3 deletions Signum.React.Extensions/Dynamic/DynamicTypeClient.tsx
Expand Up @@ -2,7 +2,7 @@
import * as React from 'react'
import { ifError } from '@framework/Globals';
import { ajaxPost, ajaxGet, ValidationError } from '@framework/Services';
import { SearchControl, ValueSearchControlLine } from '@framework/Search'
import { SearchControl, SearchValueLine } from '@framework/Search'
import * as Finder from '@framework/Finder'
import { EntitySettings } from '@framework/Navigator'
import * as AppContext from '@framework/AppContext'
Expand Down Expand Up @@ -61,8 +61,8 @@ export function start(options: { routes: JSX.Element[] }) {
iconColor: "purple",
}));

DynamicClientOptions.Options.onGetDynamicLineForPanel.push(ctx => <ValueSearchControlLine ctx={ctx} findOptions={{ queryName: DynamicTypeEntity }} />);
DynamicClientOptions.Options.onGetDynamicLineForPanel.push(ctx => <ValueSearchControlLine ctx={ctx} findOptions={{ queryName: DynamicMixinConnectionEntity }} />);
DynamicClientOptions.Options.onGetDynamicLineForPanel.push(ctx => <SearchValueLine ctx={ctx} findOptions={{ queryName: DynamicTypeEntity }} />);
DynamicClientOptions.Options.onGetDynamicLineForPanel.push(ctx => <SearchValueLine ctx={ctx} findOptions={{ queryName: DynamicMixinConnectionEntity }} />);
DynamicClientOptions.Options.getDynaicMigrationsStep = () =>
<>
<h3>{DynamicSqlMigrationEntity.nicePluralName()}</h3>
Expand Down
@@ -1,7 +1,7 @@

import * as React from 'react'
import { ajaxPost } from '@framework/Services';
import { ValueSearchControlLine } from '@framework/Search'
import { SearchValueLine } from '@framework/Search'
import { EntitySettings } from '@framework/Navigator'
import * as Navigator from '@framework/Navigator'
import { EntityOperationSettings } from '@framework/Operations'
Expand All @@ -20,8 +20,8 @@ export function start(options: { routes: JSX.Element[] }) {
}))

Constructor.registerConstructor(DynamicTypeConditionEntity, () => DynamicTypeConditionEntity.New({ eval: DynamicTypeConditionEval.New() }));
DynamicClientOptions.Options.onGetDynamicLineForPanel.push(ctx => <ValueSearchControlLine ctx={ctx} findOptions={{ queryName: DynamicTypeConditionEntity }} />);
DynamicClientOptions.Options.onGetDynamicLineForType.push((ctx, type) => <ValueSearchControlLine ctx={ctx} findOptions={{
DynamicClientOptions.Options.onGetDynamicLineForPanel.push(ctx => <SearchValueLine ctx={ctx} findOptions={{ queryName: DynamicTypeConditionEntity }} />);
DynamicClientOptions.Options.onGetDynamicLineForType.push((ctx, type) => <SearchValueLine ctx={ctx} findOptions={{
queryName: DynamicTypeConditionEntity,
filterOptions: [{ token: DynamicTypeConditionEntity.token(a => a.entityType!.cleanName), value: type}]
}} />);
Expand Down

1 comment on commit 8057968

@olmobrutall
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ValueSearchControl(Line) renamed to SearchValue(Line)

We have ported ValueSearchControl and ValueSearchControlLine to React functional components to solve problems with initialValue.

This required creating new ValueSearchControlController and ValueSearchControlLineController classes, making a bad name even worst.

So they have been renamed to SearchValue and SearchValueLine respectively.

Just run Signum.Upgrade, and Upgrade_20220329_SearchValue should do all the heavy lifting.

Please sign in to comment.