-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(ava/advisor): init new advisor pipeline & built-in modules to plugin-based architecture #784
Open
chenluli
wants to merge
6
commits into
refactor-advisor-pipeline
Choose a base branch
from
dev-refactor-pipeline1
base: refactor-advisor-pipeline
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
refactor(ava/advisor): init new advisor pipeline & built-in modules to plugin-based architecture #784
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a6af04d
refactor(ava/advisor): split visual-encoder and chart-type-recommend …
chenluli c35a204
refactor(ava/advisor): init new advisor pipeline & built-in modules t…
chenluli a86960e
fix(ava/advisor): fix single datapoint line chart and area chart
chenluli 3d32447
fix(ava/advisor): add advisor export types
chenluli 85cc0ce
feat(ava/advisor): add async and condition type to advisor plugin
chenluli 70b5899
refactor(ava/advisor): adjustments to the concepts and APIs of compon…
chenluli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from './data-to-advices'; | ||
export * from './spec-generator'; | ||
export * from './data-processors'; | ||
export * from './plugin/presets/spec-generator'; | ||
export * from './plugin/presets/data-processors'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './presets'; |
16 changes: 12 additions & 4 deletions
16
...advisor/advise-pipeline/get-chart-Type.ts → ...ts/chart-type-recommend/get-chart-Type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/ava/src/advisor/advise-pipeline/plugin/presets/chart-type-recommend/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './get-chart-Type'; | ||
export { chartTypeRecommendPlugin } from './plugin-config'; |
25 changes: 25 additions & 0 deletions
25
...ages/ava/src/advisor/advise-pipeline/plugin/presets/chart-type-recommend/plugin-config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { getChartTypeRecommendations } from './get-chart-Type'; | ||
|
||
import type { | ||
AdvisorPipelineContext, | ||
ChartTypeRecommendInput, | ||
ChartTypeRecommendOutput, | ||
AdvisorPluginType, | ||
} from '../../../../types'; | ||
|
||
export const chartTypeRecommendPlugin: AdvisorPluginType<ChartTypeRecommendInput, ChartTypeRecommendOutput> = { | ||
name: 'defaultChartTypeRecommend', | ||
stage: ['chartTypeRecommend'], | ||
execute(input: ChartTypeRecommendInput, context?: AdvisorPipelineContext): ChartTypeRecommendOutput { | ||
const { dataProps } = input; | ||
const { advisor, options, extra } = context || {}; | ||
const chartTypeRecommendations = getChartTypeRecommendations({ | ||
dataProps, | ||
chartWIKI: advisor.ckb, | ||
ruleBase: advisor.ruleBase, | ||
options, | ||
advisorContext: { extra }, | ||
}); | ||
return { chartTypeRecommendations }; | ||
}, | ||
}; |
6 changes: 3 additions & 3 deletions
6
...ne/data-processors/get-data-properties.ts → ...ts/data-processors/get-data-properties.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...line/data-processors/get-selected-data.ts → ...sets/data-processors/get-selected-data.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
.../advise-pipeline/data-processors/index.ts → ...e/plugin/presets/data-processors/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './get-data-properties'; | ||
export * from './get-selected-data'; | ||
export { dataProcessorPlugin } from './plugin-config'; |
27 changes: 27 additions & 0 deletions
27
packages/ava/src/advisor/advise-pipeline/plugin/presets/data-processors/plugin-config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { cloneDeep } from 'lodash'; | ||
|
||
import { getDataProps } from './get-data-properties'; | ||
import { getSelectedData } from './get-selected-data'; | ||
|
||
import type { | ||
AdvisorPipelineContext, | ||
DataProcessorInput, | ||
DataProcessorOutput, | ||
AdvisorPluginType, | ||
} from '../../../../types'; | ||
|
||
export const dataProcessorPlugin: AdvisorPluginType<DataProcessorInput, DataProcessorOutput> = { | ||
name: 'defaultDataProcessor', | ||
stage: ['dataAnalyze'], | ||
execute: (input: DataProcessorInput, context: AdvisorPipelineContext): DataProcessorOutput => { | ||
const { data, customDataProps } = input; | ||
const { fields } = context?.options || {}; | ||
const copyData = cloneDeep(data); | ||
const dataProps = getDataProps(copyData, fields, customDataProps); | ||
const filteredData = getSelectedData({ data: copyData, fields }); | ||
return { | ||
data: filteredData, | ||
dataProps, | ||
}; | ||
}, | ||
}; |
4 changes: 4 additions & 0 deletions
4
packages/ava/src/advisor/advise-pipeline/plugin/presets/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from './chart-type-recommend'; | ||
export * from './data-processors'; | ||
export * from './spec-generator'; | ||
export * from './visual-encoder'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...ise-pipeline/spec-generator/charts/bar.ts → ...ugin/presets/spec-generator/charts/bar.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...-pipeline/spec-generator/charts/column.ts → ...n/presets/spec-generator/charts/column.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...pipeline/spec-generator/charts/heatmap.ts → .../presets/spec-generator/charts/heatmap.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...peline/spec-generator/charts/histogram.ts → ...resets/spec-generator/charts/histogram.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...ise-pipeline/spec-generator/charts/pie.ts → ...ugin/presets/spec-generator/charts/pie.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...pipeline/spec-generator/charts/scatter.ts → .../presets/spec-generator/charts/scatter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/ava/src/advisor/advise-pipeline/plugin/presets/spec-generator/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { getChartTypeSpec } from './get-chart-spec'; | ||
export { specGeneratorPlugin } from './plugin-config'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看到了个之前遗留的不统一的点:
chartWIKI
是不是要小驼峰?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
内部的函数我改了,但是之前有 validator 和 trigger 对外的 api 里有 chartWIKI,这个版本目前还不想产生不向下兼容的 break change... 所以对外接口里的还是先不改吧