Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
229b75b
[BEAM-12967]: Created Examples Component
miamihotline Oct 13, 2021
9d5b229
[BEAM-12967]: Wrapped CategoryBubble and ExpansionPanelItem in MouseR…
miamihotline Oct 15, 2021
5a49ae1
[BEAM-13064]: Implemented Search field and Filter by type components …
miamihotline Oct 15, 2021
3276761
Merge remote-tracking branch 'origin/master' into BEAM-12967
miamihotline Oct 15, 2021
5445526
[BEAM-13064]: Fixed names to clarify code, refactored Category model …
miamihotline Oct 15, 2021
279c4ef
[BEAM-13064]: Increased test coverage of Example Dropdown module
miamihotline Oct 15, 2021
3c577d9
[BEAM-12967] Added generated files
miamihotline Oct 19, 2021
8d04eff
Merge branch 'apache:master' into BEAM-12967
miamihotline Oct 19, 2021
f249c69
[BEAM-12967]: Added license to generated files
miamihotline Oct 19, 2021
573222d
Merge remote-tracking branch 'origin/BEAM-12967' into BEAM-13064
miamihotline Oct 19, 2021
86ccec9
[BEAM-13064]: Fixed sorting functionality, updated tests & mocks
miamihotline Oct 19, 2021
2960e8e
[BEAM-13064]: Refactored code
miamihotline Oct 21, 2021
36fce7e
Merge remote-tracking branch 'origin/master' into BEAM-12967
miamihotline Oct 22, 2021
2c0d3fb
[BEAM-12967]: Deleted duplicate files
miamihotline Oct 22, 2021
b6cbf17
Merge remote-tracking branch 'origin/BEAM-12967' into BEAM-13064
miamihotline Oct 22, 2021
33157a8
[BEAM-13101]: Implementing new Example structure
miamihotline Oct 26, 2021
bb7880f
Merge remote-tracking branch 'origin/master' into BEAM-12967
miamihotline Oct 26, 2021
44e5964
Merge remote-tracking branch 'origin/BEAM-12967' into BEAM-13064
miamihotline Oct 26, 2021
af4274a
Merge branch 'BEAM-13064' into BEAM-13101
miamihotline Oct 26, 2021
52ad7ac
[BEAM-13101] Added getPrecompiledOutputs method
miamihotline Oct 26, 2021
2b1a454
[BEAM-13101]: Added default examples request, changed RunCode functio…
miamihotline Oct 27, 2021
54a6ea3
[BEAM-13101]: Fixed use of precompiledOutputs
miamihotline Oct 27, 2021
a25cfba
[BEAM-13101]: Auto-formatted files, fixed unit tests
miamihotline Oct 27, 2021
8346572
Change protobuf
Oct 29, 2021
a493358
Merge remote-tracking branch 'origin/protobuf-examples' into BEAM-13101
miamihotline Oct 29, 2021
ccff3ad
[BEAM-13101] generate proto
ElessarST Nov 1, 2021
dbe8060
[BEAM-13101] revert generate proto
ElessarST Nov 1, 2021
f828968
[BEAM-13101] Reworked examples structure
miamihotline Nov 2, 2021
057c382
[BEAM-13101] Changed example structure, regenerate proto
miamihotline Nov 12, 2021
02083bd
Merge remote-tracking branch 'origin/master' into BEAM-13101
miamihotline Nov 12, 2021
1a32b63
[BEAM-13101] Fixes after merge request
miamihotline Nov 12, 2021
4ff66ec
[BEAM-13101] Example structure fixes, added licenses
miamihotline Nov 16, 2021
508c82c
[BEAM-13101] Removed unnecessary file and comment
miamihotline Nov 16, 2021
b73f5f7
[Playground][BEAM-12941][Bugfix] Fix workflows for playground applica…
snkalinin Nov 16, 2021
d449275
Revert "[Playground][BEAM-12941][Bugfix] Fix workflows for playground…
ilya-kozyrev Nov 16, 2021
69d0191
Merge branch 'apache:master' into master
ilya-kozyrev Nov 16, 2021
1bf7f6f
Merge branch 'apache:master' into master
Nov 16, 2021
72bad55
Merge branch 'apache:master' into master
ilya-kozyrev Nov 16, 2021
1d6783e
Merge branch 'apache:master' into master
Nov 16, 2021
3a81f54
Merge branch 'apache:master' into master
ilya-kozyrev Nov 16, 2021
d9cce13
Merge branch 'apache:master' into master
Nov 17, 2021
01be927
Merge branch 'master' into BEAM-13101
ElessarST Nov 17, 2021
82ee773
[BEAM-13101]: fix tests and refactor examples api
ElessarST Nov 17, 2021
e9b45b7
[BEAM-13101]: fix linter issues
ElessarST Nov 17, 2021
3881457
[BEAM-13101]: add licence
ElessarST Nov 17, 2021
1a11750
[BEAM-13101]: format code
ElessarST Nov 17, 2021
1dc2b85
[BEAM-13101]: add missing mock file
ElessarST Nov 17, 2021
653f73a
[BEAM-13101] Updated .proto file, regenerated proto
miamihotline Nov 18, 2021
c24b695
Merge branch 'apache:master' into master
Nov 19, 2021
40d6c8a
Merge remote-tracking branch 'origin/master' into BEAM-13101
miamihotline Nov 19, 2021
10e7762
Merge branch 'apache:master' into master
Nov 19, 2021
c3767c5
[BEAM-13101] Fixed import in grpc example client
miamihotline Nov 21, 2021
24ef6bf
Merge branch 'apache:master' into master
pavel-avilov Nov 21, 2021
0eae773
Merge remote-tracking branch 'origin/master' into BEAM-13101
miamihotline Nov 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions playground/backend/internal/api/v1/api.pb.go

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

3 changes: 2 additions & 1 deletion playground/frontend/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ include: package:flutter_lints/flutter.yaml

# exclude generated files
analyzer:
exclude: [lib/api/**, test/**.mocks.dart, lib/**.g.dart]
exclude: [ lib/api/**, test/**.mocks.dart, lib/**.g.dart, build/** ]

linter:
# The lint rules applied to this project can be customized in the
Expand All @@ -43,6 +43,7 @@ linter:
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
eol_at_end_of_file: true
avoid_web_libraries_in_flutter: false
# avoid_print: false # Uncomment to disable the `avoid_print` rule
prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
Expand Down
1 change: 1 addition & 0 deletions playground/frontend/lib/api/v1/api.pb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

///
// Generated code. Do not modify.
// source: api/v1/api.proto
Expand Down
1 change: 1 addition & 0 deletions playground/frontend/lib/api/v1/api.pbenum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

///
// Generated code. Do not modify.
// source: api/v1/api.proto
Expand Down
1 change: 1 addition & 0 deletions playground/frontend/lib/api/v1/api.pbjson.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

///
// Generated code. Do not modify.
// source: api/v1/api.proto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class _EditorTextAreaState extends State<EditorTextArea> {
void didChangeDependencies() {
final themeProvider = Provider.of<ThemeProvider>(context, listen: true);
_codeController = CodeController(
text: _codeController?.text ?? widget.example?.sources[widget.sdk] ?? '',
text: _codeController?.text ?? widget.example?.source ?? '',
language: _getLanguageFromSdk(),
theme: themeProvider.isDarkMode ? kDarkCodeTheme : kLightCodeTheme,
onChange: (newSource) => widget.onSourceChange(newSource),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import 'dart:math' as math;

import 'package:expansion_widget/expansion_widget.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import 'package:flutter/material.dart';
import 'package:playground/constants/sizes.dart';
import 'package:playground/modules/examples/models/example_model.dart';
import 'package:playground/pages/playground/states/examples_state.dart';
import 'package:playground/pages/playground/states/playground_state.dart';
import 'package:provider/provider.dart';

Expand All @@ -29,13 +30,15 @@ class ExpansionPanelItem extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Consumer<PlaygroundState>(
builder: (context, state, child) => MouseRegion(
return Consumer2<PlaygroundState, ExampleState>(
builder: (context, playgroundState, exampleState, child) => MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
if (state.selectedExample != example) {
state.setExample(example);
onTap: () async {
if (playgroundState.selectedExample != example) {
final exampleWithInfo =
await exampleState.loadExampleInfo(example);
playgroundState.setExample(exampleWithInfo);
}
},
child: Container(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,19 @@ class SearchField extends StatelessWidget {
cursorColor: ThemeColors.of(context).lightGreyColor,
cursorWidth: kCursorSize,
textAlignVertical: TextAlignVertical.center,
onFieldSubmitted: (String filterText) {
state.setFilterText(filterText);
state.sortCategories();
},
onChanged: (String filterText) {
state.setFilterText(filterText);
state.sortCategories();
},
onFieldSubmitted: (String filterText) =>
_onChange(state, filterText),
onChanged: (String filterText) => _onChange(state, filterText),
maxLines: kMinLines,
minLines: kMaxLines,
),
),
),
);
}

_onChange(ExampleSelectorState state, String filterText) {
state.setFilterText(filterText);
state.sortCategories();
}
}
14 changes: 6 additions & 8 deletions playground/frontend/lib/modules/examples/example_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import 'package:flutter/material.dart';
import 'package:playground/config/theme.dart';
import 'package:playground/constants/sizes.dart';
import 'package:playground/modules/examples/components/examples_components.dart';
import 'package:playground/modules/examples/models/category_model.dart';
import 'package:playground/modules/examples/models/selector_size_model.dart';
import 'package:playground/pages/playground/states/example_selector_state.dart';
import 'package:playground/pages/playground/states/examples_state.dart';
Expand All @@ -37,13 +36,11 @@ const double kLgContainerWidth = 400.0;
class ExampleSelector extends StatefulWidget {
final Function changeSelectorVisibility;
final bool isSelectorOpened;
final List<CategoryModel> categories;

const ExampleSelector({
Key? key,
required this.changeSelectorVisibility,
required this.isSelectorOpened,
required this.categories,
}) : super(key: key);

@override
Expand Down Expand Up @@ -123,14 +120,14 @@ class _ExampleSelectorState extends State<ExampleSelector>

return OverlayEntry(
builder: (context) {
return Consumer<ExampleState>(
builder: (context, state, child) => Stack(
return Consumer2<ExampleState, PlaygroundState>(
builder: (context, exampleState, playgroundState, child) => Stack(
children: [
GestureDetector(
onTap: () {
animationController.reverse();
examplesDropdown?.remove();
state.changeSelectorVisibility();
exampleState.changeSelectorVisibility();
},
child: Container(
color: Colors.transparent,
Expand All @@ -140,8 +137,9 @@ class _ExampleSelectorState extends State<ExampleSelector>
),
ChangeNotifierProvider(
create: (context) => ExampleSelectorState(
state,
state.categories!,
exampleState,
playgroundState,
exampleState.getCategories(playgroundState.sdk)!,
),
builder: (context, _) => Positioned(
left: posModel.xAlignment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ class CategoryModel {
final String name;
final List<ExampleModel> examples;

const CategoryModel(this.name, this.examples);
const CategoryModel({required this.name, required this.examples});
}
24 changes: 20 additions & 4 deletions playground/frontend/lib/modules/examples/models/example_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
* limitations under the License.
*/

import 'package:playground/modules/sdk/models/sdk.dart';

enum ExampleType {
all,
example,
Expand All @@ -41,9 +39,27 @@ extension ExampleTypeToString on ExampleType {
}

class ExampleModel {
final Map<SDK, String> sources;
final ExampleType type;
final String name;
final String path;
final String description;
String? source;
String? outputs;

ExampleModel({
required this.name,
required this.path,
required this.description,
required this.type,
this.source,
this.outputs,
});

const ExampleModel(this.sources, this.name, this.type);
setSource(String source) {
this.source = source;
}

setOutputs(String outputs) {
this.outputs = outputs;
}
}
25 changes: 25 additions & 0 deletions playground/frontend/lib/modules/examples/models/outputs_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

class OutputsModel {
final String output;
final String graph;
final String log;

OutputsModel(this.output, this.graph, this.log);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import 'package:playground/modules/editor/repository/code_repository/code_client/output_response.dart';
import 'package:playground/modules/examples/repositories/models/get_example_request.dart';
import 'package:playground/modules/examples/repositories/models/get_example_response.dart';
import 'package:playground/modules/examples/repositories/models/get_list_of_examples_request.dart';
import 'package:playground/modules/examples/repositories/models/get_list_of_examples_response.dart';

abstract class ExampleClient {
Future<GetListOfExampleResponse> getListOfExamples(
GetListOfExamplesRequestWrapper request,
);

Future<GetExampleResponse> getExample(GetExampleRequestWrapper request);

Future<OutputResponse> getExampleOutput(GetExampleRequestWrapper request);
}
Loading