alexeyinkin commented on code in PR #24708:
URL: https://github.com/apache/beam/pull/24708#discussion_r1052303821


##########
playground/frontend/lib/modules/examples/components/example_list/example_item_actions.dart:
##########
@@ -38,6 +43,7 @@ class ExampleItemActions extends StatelessWidget {
         if (example.isMultiFile) multifilePopover,
         if (example.complexity != null)
           ComplexityWidget(complexity: example.complexity!),
+        if (example.usesEmulatedData) const _EmulatedDataIcon(),

Review Comment:
   Place this before the complexity please. All examples have complexity, so 
these icons should be aligned to the right. Optional icons should be added to 
the left.



##########
playground/frontend/playground_components/lib/src/enums/emulator_type.dart:
##########
@@ -0,0 +1,43 @@
+/*
+ * 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 '../api/v1/api.pb.dart' as grpc;
+
+enum EmulatorType {
+  kafka;
+
+  static EmulatorType? fromProto(grpc.EmulatorType? type) {
+    EmulatorType? result;
+    switch (type) {
+      case grpc.EmulatorType.EMULATOR_TYPE_KAFKA:
+        result = EmulatorType.kafka;
+        break;
+      case grpc.EmulatorType.EMULATOR_TYPE_UNSPECIFIED:
+        result = null;
+        break;
+    }
+    return result;
+  }
+
+  grpc.EmulatorType toProto() {
+    switch (this) {
+      case EmulatorType.kafka:
+        return grpc.EmulatorType.EMULATOR_TYPE_KAFKA;
+    }
+  }

Review Comment:
   These are not inherent to `EmulatorType`. Please extract them the way we did 
with `Sdk`:
   
https://github.com/apache/beam/blob/master/playground/frontend/playground_components/lib/src/repositories/sdk_grpc_extension.dart



##########
playground/frontend/playground_components/lib/src/models/example.dart:
##########
@@ -56,6 +57,7 @@ class Example extends ExampleBase {
           contextLine: example.contextLine,
           description: example.description,
           isMultiFile: example.isMultiFile,
+          datasets: example.datasets,

Review Comment:
   Sort.



##########
playground/frontend/playground_components/test/src/common/examples.dart:
##########
@@ -50,6 +50,7 @@ const exampleWithoutSourceMock = ExampleBase(
   description: 'description',
   path: 'SDK_PYTHON/Category/Name',
   complexity: Complexity.basic,
+  datasets: [],

Review Comment:
   `const []`? Or delete?



##########
playground/frontend/lib/modules/examples/components/example_list/example_item_actions.dart:
##########
@@ -65,3 +71,22 @@ class ExampleItemActions extends StatelessWidget {
     Provider.of<PopoverState>(context, listen: false).setOpen(isOpen);
   }
 }
+
+class _EmulatedDataIcon extends StatelessWidget {
+  const _EmulatedDataIcon();
+
+  @override
+  Widget build(BuildContext context) {
+    AppLocalizations appLocale = AppLocalizations.of(context)!;
+    return IconButton(
+      iconSize: kIconSizeMd,
+      splashRadius: kIconButtonSplashRadius,
+      icon: SvgPicture.asset(
+        kStreamingIconAsset,
+        color: Theme.of(context).extension<BeamThemeExtension>()?.iconColor,
+      ),
+      tooltip: appLocale.usesEmulatedData,
+      onPressed: () {},
+    );

Review Comment:
   Why making this a button? If it is for the tooltip, is there a less verbose 
way?



##########
playground/frontend/lib/l10n/app_en.arb:
##########
@@ -234,5 +234,9 @@
   "iframeCodeReady": "With this code you can embed Playground to your 
website.",
   "@iframeCodeReady": {
     "description": "Text that appears when user sees Playground iframe code"
+  },
+  "usesEmulatedData": "Emulated data",
+  "@usesEmulatedData": {
+    "description": "This examples uses emulated data"
   }

Review Comment:
   For new strings we want to use EasyLocalization instead of this.
   Existing strings will be migrated to EasyLocalization later.



##########
playground/frontend/lib/modules/examples/components/example_list/example_item_actions.dart:
##########
@@ -17,12 +17,17 @@
  */
 
 import 'package:flutter/material.dart';
+import 'package:flutter_svg/flutter_svg.dart';
+import 'package:playground/constants/assets.dart';
 import 
'package:playground/modules/examples/components/description_popover/description_popover_button.dart';
 import 
'package:playground/modules/examples/components/multifile_popover/multifile_popover_button.dart';
 import 'package:playground/modules/examples/models/popover_state.dart';

Review Comment:
   If you modify a file in `playground` package, please make all its existing 
imports relative. This is how we plan to migrate to exclusively relative 
imports.



##########
playground/frontend/playground_components/assets/symbols/go.g.yaml:
##########
@@ -348,6 +348,7 @@
   - ImpulseValue

Review Comment:
   Please revert the symbols update. We should commit them separately. 
Otherwise they will be hard to merge.



##########
playground/frontend/playground_components/lib/src/models/example_base.dart:
##########
@@ -61,12 +62,14 @@ class ExampleBase with Comparable<ExampleBase>, 
EquatableMixin {
   final List<String> tags;
   final ExampleType type;
   final ExampleViewOptions viewOptions;
+  final List<Dataset> datasets;
 
   const ExampleBase({
     required this.name,
     required this.path,
     required this.sdk,
     required this.type,
+    required this.datasets,

Review Comment:
   Sort among required.



##########
playground/frontend/lib/constants/assets.dart:
##########
@@ -34,6 +34,7 @@ const kLinkIconAsset = 'link.svg';
 const kDragHorizontalIconAsset = 'drag_horizontal.svg';
 const kDragVerticalIconAsset = 'drag_vertical.svg';
 const kMultifileIconAsset = 'multifile.svg';
+const kStreamingIconAsset = 'streaming.svg';

Review Comment:
   Please start this migration: https://github.com/apache/beam/issues/24709
   and use it for this new single asset.
   
   Other assets will be migrated to it one-by-one as we asses whether they 
should go in `playground_components` or not.



##########
playground/frontend/playground_components/lib/src/repositories/models/run_code_request.dart:
##########
@@ -16,16 +16,19 @@
  * limitations under the License.
  */
 
+import '../../api/v1/api.pb.dart' show Dataset;

Review Comment:
   Use `models/dataset.dart` here. Datasets should be converted to proto format 
at the same place where `Sdk` is.



##########
playground/frontend/playground_components/lib/src/models/dataset.dart:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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 '../api/v1/api.pb.dart' as grpc;
+import '../enums/emulator_type.dart';
+
+class Dataset {
+  final EmulatorType? type;
+  final Map<String, String> options;
+  final String datasetPath;
+
+  Dataset({
+    required this.type,
+    required this.options,
+    required this.datasetPath,
+  });
+
+  factory Dataset.fromProto(grpc.Dataset proto) {
+    return Dataset(
+      type: EmulatorType.fromProto(proto.type),
+      options: proto.options,
+      datasetPath: proto.datasetPath,
+    );
+  }
+
+  grpc.Dataset toProto() {
+    return grpc.Dataset()
+      ..type = type?.toProto() ?? grpc.EmulatorType.EMULATOR_TYPE_UNSPECIFIED
+      ..options.addAll(options)
+      ..datasetPath = datasetPath;
+  }

Review Comment:
   The same: 
https://github.com/apache/beam/blob/master/playground/frontend/playground_components/lib/src/repositories/sdk_grpc_extension.dart



##########
playground/frontend/playground_components/lib/src/repositories/models/run_code_request.dart:
##########
@@ -16,16 +16,19 @@
  * limitations under the License.
  */
 
+import '../../api/v1/api.pb.dart' show Dataset;
 import '../../models/sdk.dart';
 
 class RunCodeRequest {
   final String code;
   final Sdk sdk;
   final Map<String, String> pipelineOptions;
+  final List<Dataset> datasets;

Review Comment:
   Sort.



##########
playground/frontend/playground_components/lib/src/models/example.dart:
##########
@@ -35,6 +35,7 @@ class Example extends ExampleBase {
     this.graph,
     this.logs,
     this.outputs,
+    super.datasets = const [],

Review Comment:
   1. Sort among super.
   2. Why is it required for the super and not required here?



##########
playground/frontend/playground_components/lib/src/models/example_base.dart:
##########
@@ -61,12 +62,14 @@ class ExampleBase with Comparable<ExampleBase>, 
EquatableMixin {
   final List<String> tags;
   final ExampleType type;
   final ExampleViewOptions viewOptions;
+  final List<Dataset> datasets;

Review Comment:
   Sort.



##########
playground/frontend/playground_components/lib/src/repositories/models/run_code_request.dart:
##########
@@ -16,16 +16,19 @@
  * limitations under the License.
  */
 
+import '../../api/v1/api.pb.dart' show Dataset;
 import '../../models/sdk.dart';
 
 class RunCodeRequest {
   final String code;
   final Sdk sdk;
   final Map<String, String> pipelineOptions;
+  final List<Dataset> datasets;
 
   const RunCodeRequest({
     required this.code,
     required this.sdk,
     required this.pipelineOptions,
+    required this.datasets,

Review Comment:
   Sort.



##########
playground/frontend/pubspec.lock:
##########
@@ -793,219 +973,250 @@ packages:
     dependency: transitive
     description:
       name: source_gen
-      url: "https://pub.dartlang.org";
+      sha256: 
"2d79738b6bbf38a43920e2b8d189e9a3ce6cc201f4b8fc76be5e4fe377b1c38d"
+      url: "https://pub.dev";
     source: hosted
-    version: "1.2.2"
+    version: "1.2.6"
   source_span:
     dependency: transitive
     description:
       name: source_span
-      url: "https://pub.dartlang.org";
+      sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
+      url: "https://pub.dev";
     source: hosted
-    version: "1.9.0"
+    version: "1.9.1"
   stack_trace:
     dependency: transitive
     description:
       name: stack_trace
-      url: "https://pub.dartlang.org";
+      sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
+      url: "https://pub.dev";
     source: hosted
-    version: "1.10.0"
+    version: "1.11.0"
   stream_channel:
     dependency: transitive
     description:
       name: stream_channel
-      url: "https://pub.dartlang.org";
+      sha256: 
"83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
+      url: "https://pub.dev";
     source: hosted
-    version: "2.1.0"
+    version: "2.1.1"
   stream_transform:
     dependency: transitive
     description:
       name: stream_transform
-      url: "https://pub.dartlang.org";
+      sha256: 
"14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f"
+      url: "https://pub.dev";
     source: hosted
-    version: "2.0.0"
+    version: "2.1.0"
   string_scanner:
     dependency: transitive
     description:
       name: string_scanner
-      url: "https://pub.dartlang.org";
+      sha256: 
"556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
+      url: "https://pub.dev";
     source: hosted
-    version: "1.1.1"
+    version: "1.2.0"
   term_glyph:
     dependency: transitive
     description:
       name: term_glyph
-      url: "https://pub.dartlang.org";
+      sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
+      url: "https://pub.dev";
     source: hosted
     version: "1.2.1"
   test_api:
     dependency: transitive
     description:
       name: test_api
-      url: "https://pub.dartlang.org";
+      sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206
+      url: "https://pub.dev";
     source: hosted
-    version: "0.4.12"
+    version: "0.4.16"
   timing:
     dependency: transitive
     description:
       name: timing
-      url: "https://pub.dartlang.org";
+      sha256: c386d07d7f5efc613479a7c4d9d64b03710b03cfaa7e8ad5f2bfb295a1f0dfad
+      url: "https://pub.dev";
     source: hosted
     version: "1.0.0"
   tuple:
     dependency: transitive
     description:
       name: tuple
-      url: "https://pub.dartlang.org";
+      sha256: 
"0ea99cd2f9352b2586583ab2ce6489d1f95a5f6de6fb9492faaf97ae2060f0aa"
+      url: "https://pub.dev";
     source: hosted
     version: "2.0.1"
   typed_data:
     dependency: transitive
     description:
       name: typed_data
-      url: "https://pub.dartlang.org";
+      sha256: 
"26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5"
+      url: "https://pub.dev";
     source: hosted
     version: "1.3.1"
   universal_html:
     dependency: transitive
     description:
       name: universal_html
-      url: "https://pub.dartlang.org";
+      sha256: 
"5ff50b7c14d201421cf5230ec389a0591c4deb5c817c9d7ccca3b26fe5f31e34"
+      url: "https://pub.dev";
     source: hosted
     version: "2.0.8"
   universal_io:
     dependency: transitive
     description:
       name: universal_io
-      url: "https://pub.dartlang.org";
+      sha256: 
"79f78ddad839ee3aae3ec7c01eb4575faf0d5c860f8e5223bc9f9c17f7f03cef"
+      url: "https://pub.dev";
     source: hosted
     version: "2.0.4"
   url_launcher:
     dependency: "direct main"
     description:
       name: url_launcher
-      url: "https://pub.dartlang.org";
+      sha256: 
"3c92b0efb5e9dcb8f846aefabf9f0f739f91682ed486b991ceda51c288e60896"
+      url: "https://pub.dev";
     source: hosted
-    version: "6.1.2"
+    version: "6.1.7"
   url_launcher_android:
     dependency: transitive
     description:
       name: url_launcher_android
-      url: "https://pub.dartlang.org";
+      sha256: 
"6f91d30ce9060c204b2dbe728adb300750fa4b228e8f7ed1b961aa1ceb728799"
+      url: "https://pub.dev";
     source: hosted
-    version: "6.0.17"
+    version: "6.0.22"
   url_launcher_ios:
     dependency: transitive
     description:
       name: url_launcher_ios
-      url: "https://pub.dartlang.org";
+      sha256: 
"6ba7dddee26c9fae27c9203c424631109d73c8fa26cfa7bc3e35e751cb87f62e"
+      url: "https://pub.dev";
     source: hosted
     version: "6.0.17"
   url_launcher_linux:
     dependency: transitive
     description:
       name: url_launcher_linux
-      url: "https://pub.dartlang.org";
+      sha256: 
"360fa359ab06bcb4f7c5cd3123a2a9a4d3364d4575d27c4b33468bd4497dd094"
+      url: "https://pub.dev";
     source: hosted
     version: "3.0.1"
   url_launcher_macos:
     dependency: transitive
     description:
       name: url_launcher_macos
-      url: "https://pub.dartlang.org";
+      sha256: a9b3ea9043eabfaadfa3fb89de67a11210d85569086d22b3854484beab8b3978
+      url: "https://pub.dev";
     source: hosted
     version: "3.0.1"
   url_launcher_platform_interface:
     dependency: transitive
     description:
       name: url_launcher_platform_interface
-      url: "https://pub.dartlang.org";
+      sha256: 
"4eae912628763eb48fc214522e58e942fd16ce195407dbf45638239523c759a6"
+      url: "https://pub.dev";
     source: hosted
-    version: "2.0.5"
+    version: "2.1.1"
   url_launcher_web:
     dependency: transitive
     description:
       name: url_launcher_web
-      url: "https://pub.dartlang.org";
+      sha256: 
"5669882643b96bb6d5786637cac727c6e918a790053b09245fd4513b8a07df2a"
+      url: "https://pub.dev";
     source: hosted
-    version: "2.0.11"
+    version: "2.0.13"
   url_launcher_windows:
     dependency: transitive
     description:
       name: url_launcher_windows
-      url: "https://pub.dartlang.org";
+      sha256: e3c3b16d3104260c10eea3b0e34272aaa57921f83148b0619f74c2eced9b7ef1
+      url: "https://pub.dev";
     source: hosted
     version: "3.0.1"
   url_strategy:
     dependency: "direct main"
     description:
       name: url_strategy
-      url: "https://pub.dartlang.org";
+      sha256: 
"42b68b42a9864c4d710401add17ad06e28f1c1d5500c93b98c431f6b0ea4ab87"
+      url: "https://pub.dev";
     source: hosted
     version: "0.2.0"
   usage:
     dependency: "direct main"
     description:
       name: usage
-      url: "https://pub.dartlang.org";
+      sha256: ccc861ca619157046d961a1d7fa21a364476c574bb8f3e90219e41b9103adee0
+      url: "https://pub.dev";
     source: hosted
-    version: "4.0.2"
+    version: "4.1.0"
   vector_math:
     dependency: transitive
     description:
       name: vector_math
-      url: "https://pub.dartlang.org";
+      sha256: 
"80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
+      url: "https://pub.dev";
     source: hosted
-    version: "2.1.2"
+    version: "2.1.4"
   watcher:
     dependency: transitive
     description:
       name: watcher
-      url: "https://pub.dartlang.org";
+      sha256: 
"6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0"
+      url: "https://pub.dev";
     source: hosted
-    version: "1.0.1"
+    version: "1.0.2"
   web_browser_detect:
     dependency: transitive
     description:
       name: web_browser_detect
-      url: "https://pub.dartlang.org";
+      sha256: 
"78ba66860b61a993030788a3a4586fb21cb7d9cef966cfd24faa9ad487c3fd8b"
+      url: "https://pub.dev";
     source: hosted
     version: "2.0.3"
   web_socket_channel:
     dependency: transitive
     description:
       name: web_socket_channel
-      url: "https://pub.dartlang.org";
+      sha256: 
"3a969ddcc204a3e34e863d204b29c0752716f78b6f9cc8235083208d268a4ccd"
+      url: "https://pub.dev";
     source: hosted
     version: "2.2.0"
   win32:
     dependency: transitive
     description:
       name: win32
-      url: "https://pub.dartlang.org";
+      sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46
+      url: "https://pub.dev";
     source: hosted
-    version: "2.7.0"
+    version: "3.1.3"
   xdg_directories:
     dependency: transitive
     description:
       name: xdg_directories
-      url: "https://pub.dartlang.org";
+      sha256: 
"11541eedefbcaec9de35aa82650b695297ce668662bbd6e3911a7fabdbde589f"
+      url: "https://pub.dev";
     source: hosted
-    version: "0.2.0+1"
+    version: "0.2.0+2"
   xml:
     dependency: transitive
     description:
       name: xml
-      url: "https://pub.dartlang.org";
+      sha256: 
"979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5"
+      url: "https://pub.dev";
     source: hosted
-    version: "5.4.1"
+    version: "6.2.2"
   yaml:
     dependency: transitive
     description:
       name: yaml
-      url: "https://pub.dartlang.org";
+      sha256: 
"23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370"
+      url: "https://pub.dev";
     source: hosted
     version: "3.1.1"
 sdks:
-  dart: ">=2.18.1 <3.0.0"
+  dart: ">=2.18.1 <4.0.0"

Review Comment:
   Is this deliberate?
   Should this affect `pubspec.yaml`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to