Skip to content

Commit

Permalink
Add run selection syntax on frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
briantu committed Nov 22, 2024
1 parent 41f3fab commit 30036c1
Show file tree
Hide file tree
Showing 12 changed files with 2,249 additions and 0 deletions.
1 change: 1 addition & 0 deletions js_modules/dagster-ui/.gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ packages/ui-core/src/graphql/* linguist-generated=true
packages/ui-core/src/**/types/* linguist-generated=true
packages/ui-core/client.json linguist-generated=true
packages/ui-core/src/asset-selection/generated/* linguist-generated=true
packages/ui-core/src/run-selection/generated/* linguist-generated=true
1 change: 1 addition & 0 deletions js_modules/dagster-ui/packages/ui-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"generate-graphql": "ts-node -O '{\"module\": \"commonjs\"}' ./src/scripts/generateGraphQLTypes.ts",
"generate-perms": "ts-node -O '{\"module\": \"commonjs\"}' ./src/scripts/generatePermissions.ts",
"generate-asset-selection": "ts-node -O '{\"module\": \"commonjs\"}' ./src/scripts/generateAssetSelection.ts && eslint src/asset-selection/generated/ --fix -c .eslintrc.js",
"generate-run-selection": "ts-node -O '{\"module\": \"commonjs\"}' ./src/scripts/generateRunSelection.ts && eslint src/run-selection/generated/ --fix -c .eslintrc.js",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
grammar RunSelection;

start: expr EOF;

// Root rule for parsing expressions
expr
: traversalAllowedExpr # TraversalAllowedExpression
| traversal traversalAllowedExpr traversal # UpAndDownTraversalExpression
| traversal traversalAllowedExpr # UpTraversalExpression
| traversalAllowedExpr traversal # DownTraversalExpression
| NOT expr # NotExpression
| expr AND expr # AndExpression
| expr OR expr # OrExpression
| STAR # AllExpression
;

// Allowed expressions for traversals
traversalAllowedExpr
: attributeExpr # AttributeExpression
| functionName LPAREN expr RPAREN # FunctionCallExpression
| LPAREN expr RPAREN # ParenthesizedExpression
;

// Traversal operators
traversal
: STAR
| PLUS+
;

// Function names as tokens
functionName
: SINKS
| ROOTS
;

// Attribute expressions for specific attributes
attributeExpr
: NAME COLON value # NameExpr
| NAME_SUBSTRING COLON value # NameSubstringExpr
| STATUS COLON value # StatusAttributeExpr
;

// Value can be a quoted or unquoted string
value
: QUOTED_STRING
| UNQUOTED_STRING
;

// Tokens for operators and keywords
AND : 'and';
OR : 'or';
NOT : 'not';

STAR : '*';
PLUS : '+';

COLON : ':';

LPAREN : '(';
RPAREN : ')';

// Tokens for attributes
NAME : 'name';
NAME_SUBSTRING : 'name_substring';
STATUS : 'status';

// Tokens for function names
SINKS : 'sinks';
ROOTS : 'roots';

// Tokens for strings
QUOTED_STRING : '"' (~["\\\r\n])* '"' ;
UNQUOTED_STRING : [a-zA-Z_][a-zA-Z0-9_]*;
// Whitespace
WS : [ \t\r\n]+ -> skip ;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 30036c1

Please sign in to comment.