A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/signumsoftware/framework/commit/75c713fbd8023824344f8a270afc1c24dc5496b7 below:

Merge remote-tracking branch 'AlejandroCano/CustomDrilldowns' into Cu… · signumsoftware/framework@75c713f · GitHub

File tree Expand file treeCollapse file tree 10 files changed

+79

-89

lines changed

Filter options

Expand file treeCollapse file tree 10 files changed

+79

-89

lines changed Original file line number Diff line number Diff line change

@@ -487,7 +487,6 @@ export module Encoder {

487 487

return p.element.value != defaultParameterValue(scriptParam, c?.token && c.token.token);

488 488

})

489 489

.map(p => ({ name: p.element.name, value: p.element.value }) as ChartParameterOption),

490 -

customDrilldowns: cr.customDrilldowns,

491 490

};

492 491

}

493 492 Original file line number Diff line number Diff line change

@@ -3,7 +3,7 @@ import { DomUtils, Dic } from '@framework/Globals'

3 3

import * as Finder from '@framework/Finder'

4 4

import * as Navigator from '@framework/Navigator'

5 5

import { FilterOptionParsed, ColumnOption, hasAggregate, withoutAggregate, FilterOption, FindOptions, withoutPinned } from '@framework/FindOptions'

6 -

import { ChartRequestModel, ChartMessage } from '../Signum.Entities.Chart'

6 +

import { ChartRequestModel, ChartMessage, UserChartEntity } from '../Signum.Entities.Chart'

7 7

import * as ChartClient from '../ChartClient'

8 8

import { toFilterOptions } from '@framework/Finder';

9 9

@@ -19,8 +19,10 @@ import { toAbsoluteUrl } from '@framework/AppContext'

19 19

import * as UserQueryClient from '../../UserQueries/UserQueryClient'

20 20

import { DynamicTypeConditionSymbolEntity } from '../../Dynamic/Signum.Entities.Dynamic'

21 21

import { extractFindOptions } from '../../UserQueries/UserQueryClient'

22 +

import { Lite } from '@framework/Signum.Entities'

22 23 23 24

export interface ChartRendererProps {

25 +

userChart?: Lite<UserChartEntity>;

24 26

chartRequest: ChartRequestModel;

25 27

loading: boolean;

26 28

@@ -56,7 +58,7 @@ export default function ChartRenderer(p: ChartRendererProps) {

56 58

data={p.data}

57 59

dashboardFilter={p.dashboardFilter}

58 60

loading={p.loading}

59 -

onDrillDown={p.onDrillDown ?? ((r, e) => handleDrillDown(r, e, p.lastChartRequest!, p.autoRefresh ? p.onReload : undefined))}

61 +

onDrillDown={p.onDrillDown ?? ((r, e) => handleDrillDown(r, e, p.lastChartRequest!, p.userChart, p.autoRefresh ? p.onReload : undefined))}

60 62

onBackgroundClick={p.onBackgroundClick}

61 63

parameters={parameters}

62 64

onReload={p.onReload}

@@ -69,12 +71,12 @@ export default function ChartRenderer(p: ChartRendererProps) {

69 71

);

70 72

}

71 73 72 -

export function handleDrillDown(r: ChartRow, e: React.MouseEvent | MouseEvent, cr: ChartRequestModel, onReload?: () => void) {

74 +

export function handleDrillDown(r: ChartRow, e: React.MouseEvent | MouseEvent, cr: ChartRequestModel, uc?: Lite<UserChartEntity>, onReload?: () => void) {

73 75 74 76

e.stopPropagation();

75 77

var newWindow = e.ctrlKey || e.button == 1;

76 78 77 -

UserQueryClient.onDrilldownUserChart(cr, r, { openInNewTab: newWindow, onReload })

79 +

UserQueryClient.onDrilldownUserChart(cr, r, uc, { openInNewTab: newWindow, onReload })

78 80

.then(done => {

79 81

if (done == false) {

80 82

if (r.entity) {

Original file line number Diff line number Diff line change

@@ -3,7 +3,7 @@ import { DomUtils, Dic } from '@framework/Globals'

3 3

import * as Finder from '@framework/Finder'

4 4

import * as Navigator from '@framework/Navigator'

5 5

import { FilterOptionParsed, ColumnOption, hasAggregate, withoutAggregate, FilterOption, FindOptions, withoutPinned } from '@framework/FindOptions'

6 -

import { ChartRequestModel, ChartMessage } from '../Signum.Entities.Chart'

6 +

import { ChartRequestModel, ChartMessage, UserChartEntity } from '../Signum.Entities.Chart'

7 7

import * as ChartClient from '../ChartClient'

8 8

import { toFilterOptions } from '@framework/Finder';

9 9

@@ -17,6 +17,7 @@ import { TypeInfo } from '@framework/Reflection'

17 17

import { FullscreenComponent } from './FullscreenComponent'

18 18

import { handleDrillDown } from './ChartRenderer'

19 19

import { ReactChartCombined } from '../D3Scripts/Components/ReactChartCombined'

20 +

import { Lite } from '@framework/Signum.Entities'

20 21 21 22 22 23

@@ -28,6 +29,7 @@ export interface ChartRendererCombinedProps {

28 29

}

29 30 30 31

export interface ChartRendererCombinedInfo {

32 +

userChart: Lite<UserChartEntity>;

31 33

chartRequest: ChartRequestModel;

32 34

chartScript: ChartScript;

33 35

data?: ChartClient.ChartTable;

@@ -41,7 +43,7 @@ export default function ChartRendererCombined(p: ChartRendererCombinedProps) {

41 43

<ErrorBoundary deps={p.infos.map(a => a.data)}>

42 44

<ReactChartCombined useSameScale={p.useSameScale} minHeigh={p.minHeigh} infos={p.infos.map(info => ({

43 45

chartRequest: info.chartRequest,

44 -

onDrillDown: (r, e) => handleDrillDown(r, e, info.chartRequest),

46 +

onDrillDown: (r, e) => handleDrillDown(r, e, info.chartRequest, info.userChart),

45 47

parameters: ChartClient.API.getParameterWithDefault(info.chartRequest, info.chartScript),

46 48

data: info.data,

47 49

memo: info.memo

Original file line number Diff line number Diff line change

@@ -24,7 +24,6 @@ import { ChartScript, cleanedChartRequest, getCustomDrilldownsFindOptions, hasAg

24 24

import { useForceUpdate, useAPI } from '@framework/Hooks'

25 25

import { AutoFocus } from '@framework/Components/AutoFocus';

26 26

import PinnedFilterBuilder from '@framework/SearchControl/PinnedFilterBuilder';

27 -

import { EntityStrip } from '../../../Signum.React/Scripts/Lines';

28 27 29 28

interface ChartRequestViewProps {

30 29

chartRequest: ChartRequestModel;

@@ -58,19 +57,6 @@ export default function ChartRequestView(p: ChartRequestViewProps) {

58 57

loading: boolean;

59 58

} | undefined>(undefined);

60 59 61 -

const hasAggregatesRef = React.useRef<boolean>(hasAggregates(p.chartRequest));

62 - 63 -

React.useEffect(() => {

64 -

const ha = hasAggregates(p.chartRequest);

65 -

if (ha == hasAggregatesRef.current)

66 -

return;

67 - 68 -

hasAggregatesRef.current = ha;

69 -

p.chartRequest.customDrilldowns = [];

70 -

p.chartRequest.modified = true;

71 -

forceUpdate();

72 -

});

73 - 74 60

const queryDescription = useAPI(signal => p.chartRequest ? Finder.getQueryDescription(p.chartRequest.queryKey) : Promise.resolve(undefined),

75 61

[p.chartRequest.queryKey]);

76 62

@@ -215,11 +201,6 @@ export default function ChartRequestView(p: ChartRequestViewProps) {

215 201

forceUpdate();

216 202

}}

217 203

/>

218 -

<EntityStrip ctx={tc.subCtx(e => e.customDrilldowns)}

219 -

findOptions={getCustomDrilldownsFindOptions(p.chartRequest.queryKey, qd, hasAggregatesRef.current)}

220 -

avoidDuplicates={true}

221 -

vertical={true}

222 -

iconStart={true} />

223 204

</>}

224 205

</div>

225 206

<div className="sf-query-button-bar btn-toolbar mb-2">

@@ -239,7 +220,7 @@ export default function ChartRequestView(p: ChartRequestViewProps) {

239 220

<div className="sf-chart-tab-container">

240 221

<Tabs id="chartResultTabs" key={showChartSettings + ""}>

241 222

<Tab eventKey="chart" title={ChartMessage.Chart.niceToString()}>

242 -

<ChartRenderer chartRequest={cr} loading={loading == true} autoRefresh={false} lastChartRequest={result?.lastChartRequest} data={result?.chartResult.chartTable} minHeight={null} />

223 +

<ChartRenderer userChart={p.userChart} chartRequest={cr} loading={loading == true} autoRefresh={false} lastChartRequest={result?.lastChartRequest} data={result?.chartResult.chartTable} minHeight={null} />

243 224

</Tab>

244 225

{result &&

245 226

<Tab eventKey="data" title={<span>{ChartMessage.Data.niceToString()} (

Original file line number Diff line number Diff line change

@@ -73,7 +73,6 @@ export module Converter {

73 73

export async function applyUserChart(cr: ChartRequestModel, uc: UserChartEntity, entity?: Lite<Entity>): Promise<ChartRequestModel> {

74 74

cr.chartScript = uc.chartScript;

75 75

cr.maxRows = uc.maxRows;

76 -

cr.customDrilldowns = uc.customDrilldowns;

77 76 78 77

const filters = await UserAssetsClient.API.parseFilters({

79 78

queryKey: uc.query.key,

Original file line number Diff line number Diff line change

@@ -153,7 +153,6 @@ export default function UserChartMenu(p: UserChartMenuProps) {

153 153

filters: qfs.map(f => newMListElement(UserAssetClient.Converter.toQueryFilterEmbedded(f))),

154 154

columns: cr.columns.map(a => newMListElement(JSON.parse(JSON.stringify(a.element)))),

155 155

parameters: cr.parameters.map(p => newMListElement(JSON.parse(JSON.stringify(p.element)))),

156 -

customDrilldowns: cr.customDrilldowns.map(p => newMListElement(JSON.parse(JSON.stringify(p.element)))),

157 156

});

158 157 159 158

return uc;

Original file line number Diff line number Diff line change

@@ -175,7 +175,7 @@ export default function CombinedUserChartPart(p: PanelPartContentProps<CombinedU

175 175

onReload={e => { e.preventDefault(); c.makeQuery!(); }}

176 176

/>) :

177 177

<ChartRendererCombined

178 -

infos={infos.map(c => ({ chartRequest: c.chartRequest!, data: c.result?.chartTable, chartScript: c.chartScript!, memo: c.memo }))}

178 +

infos={infos.map(c => ({ userChart: toLite(c.userChart, true), chartRequest: c.chartRequest!, data: c.result?.chartTable, chartScript: c.chartScript!, memo: c.memo }))}

179 179

onReload={e => { infos.forEach(a => a.makeQuery!()) }}

180 180

useSameScale={p.content.useSameScale}

181 181

minHeigh={p.content.minHeight}

Original file line number Diff line number Diff line change

@@ -148,13 +148,14 @@ export default function UserChartPart(p: PanelPartContentProps<UserChartPartEnti

148 148

);

149 149

}

150 150 151 -

const result = resultOrError?.result;

152 - 153 151

function handleReload(e?: React.MouseEvent<any>) {

154 152

e?.preventDefault();

155 153

reloadQuery();

156 154

}

157 155 156 +

const result = resultOrError?.result;

157 +

const userChart = toLite(p.content.userChart, true);

158 + 158 159

return (

159 160

<div className="d-flex flex-column flex-grow-1">

160 161

<PinnedFilterBuilder filterOptions={chartRequest.filterOptions} onFiltersChanged={() => reloadQuery()} pinnedFilterVisible={fop => fop.dashboardBehaviour == null} extraSmall={true} />

@@ -175,6 +176,7 @@ export default function UserChartPart(p: PanelPartContentProps<UserChartPartEnti

175 176

onReload={handleReload}

176 177

/>) :

177 178

<ChartRenderer

179 +

userChart={userChart}

178 180

chartRequest={chartRequest}

179 181

lastChartRequest={chartRequest}

180 182

data={result?.chartTable}

@@ -189,7 +191,7 @@ export default function UserChartPart(p: PanelPartContentProps<UserChartPartEnti

189 191

onDrillDown={(row, e) => {

190 192

e.stopPropagation();

191 193

if (e.altKey || p.partEmbedded.interactionGroup == null)

192 -

handleDrillDown(row, e, chartRequest, handleReload);

194 +

handleDrillDown(row, e, chartRequest, userChart, handleReload);

193 195

else {

194 196

const dashboardFilter = p.dashboardController.filters.get(p.partEmbedded);

195 197

const filterRow = toDashboardFilterRow(row, chartRequest);

Original file line number Diff line number Diff line change

@@ -27,7 +27,7 @@ import SearchControlLoaded, { OnDrilldownOptions } from '@framework/SearchContro

27 27

import SelectorModal from '@framework/SelectorModal';

28 28

import { DynamicTypeConditionSymbolEntity } from '../Dynamic/Signum.Entities.Dynamic';

29 29

import { Dic } from '@framework/Globals';

30 -

import { ChartRequestModel } from '../Chart/Signum.Entities.Chart';

30 +

import { ChartRequestModel, UserChartEntity } from '../Chart/Signum.Entities.Chart';

31 31

import { ChartRow, hasAggregates } from '../Chart/ChartClient';

32 32 33 33

export function start(options: { routes: RouteObject[] }) {

@@ -164,22 +164,28 @@ export async function onDrilldownSearchControl(scl: SearchControlLoaded, row: Re

164 164

return drilldownToUserQuery(val.fo, val.uq, options);

165 165

}

166 166 167 -

export function onDrilldownUserChart(cr: ChartRequestModel, row: ChartRow, options?: OnDrilldownOptions): Promise<boolean | undefined> {

168 -

if (cr.customDrilldowns.length == 0)

169 -

return Promise.resolve(false);

167 +

export async function onDrilldownUserChart(cr: ChartRequestModel, row: ChartRow, uc?: Lite<UserChartEntity>, options?: OnDrilldownOptions): Promise<boolean | undefined> {

168 +

if (uc == null)

169 +

return false;

170 + 171 +

await Navigator.API.fetchAndRemember(uc);

172 + 173 +

if (uc.entity!.customDrilldowns.length == 0 || hasAggregates(uc.entity!) != hasAggregates(cr))

174 +

return false;

170 175 176 +

debugger;

171 177

const fo = extractFindOptions(cr, row);

172 178

const entity = row.entity ?? (hasAggregates(cr) ? undefined : fo.filterOptions?.singleOrNull(f => f?.token == "Entity")?.value);

173 - 174 179

const filters = fo.filterOptions?.notNull();

175 -

const promise = entity ? onDrilldownEntity(cr.customDrilldowns, entity) : onDrilldownGroup(cr.customDrilldowns, filters);

176 -

return promise

177 -

.then(val => {

178 -

if (!val)

179 -

return undefined;

180 180 181 -

return drilldownToUserQuery(val.fo, val.uq, options);

182 -

});

181 +

const val = entity ?

182 +

await onDrilldownEntity(uc.entity!.customDrilldowns, entity) :

183 +

await onDrilldownGroup(uc.entity!.customDrilldowns, filters);

184 + 185 +

if (!val)

186 +

return undefined;

187 + 188 +

return drilldownToUserQuery(val.fo, val.uq, options);

183 189

}

184 190 185 191

export function onDrilldownEntity(items: MList<Lite<Entity>>, entity: Lite<Entity>) {

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4