Skip to content

Commit acc48d6

Browse files
Add firebase login (#170)
Adds a firebase login/logout button to the page. This will be used to migrate results feed UIs to Flutter Web. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent 44c63c1 commit acc48d6

File tree

16 files changed

+1109
-208
lines changed

16 files changed

+1109
-208
lines changed

.github/workflows/current_results_ui.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ jobs:
4444

4545
- run: flutter pub get
4646

47+
- name: Generate files
48+
run: flutter pub run build_runner build --delete-conflicting-outputs
49+
4750
- run: flutter analyze --fatal-infos
4851

4952
- run: dart format --output=none --set-exit-if-changed .
5053

51-
# TODO: Write tests
52-
# - run: flutter test
54+
- run: flutter test

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
current_results/lib/src/generated/google
1111
functions/node_modules
1212
github-label-notifier/functions/node_modules
13-
13+
**/test/**.mocks.dart

current_results_ui/.metadata

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,27 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 7c6f9dd2396dfe7deb6fd11edc12c10786490083
8-
channel: dev
7+
revision: "edada7c56edf4a183c1735310e123c7f923584f1"
8+
channel: "stable"
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: edada7c56edf4a183c1735310e123c7f923584f1
17+
base_revision: edada7c56edf4a183c1735310e123c7f923584f1
18+
- platform: macos
19+
create_revision: edada7c56edf4a183c1735310e123c7f923584f1
20+
base_revision: edada7c56edf4a183c1735310e123c7f923584f1
21+
22+
# User provided section
23+
24+
# List of Local paths (relative to this file) that should be
25+
# ignored by the migrate tool.
26+
#
27+
# Files that are not part of the templates will be ignored by default.
28+
unmanaged_files:
29+
- 'lib/main.dart'
30+
- 'ios/Runner.xcodeproj/project.pbxproj'

current_results_ui/firebase.json

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,36 @@
11
{
2-
"hosting": {
3-
"target": "current-results",
4-
"public": "build/web",
5-
"rewrites": [
6-
{
7-
"source": "**",
8-
"destination": "/index.html"
9-
}]
10-
}
11-
}
2+
"emulators": {
3+
"auth": {
4+
"port": 9099
5+
},
6+
"firestore": {
7+
"port": 8080
8+
},
9+
"ui": {
10+
"enabled": true,
11+
"port": 4000
12+
}
13+
},
14+
"hosting": {
15+
"target": "current-results",
16+
"public": "build/web",
17+
"rewrites": [
18+
{
19+
"source": "**",
20+
"destination": "/index.html"
21+
}
22+
]
23+
},
24+
"flutter": {
25+
"platforms": {
26+
"dart": {
27+
"lib/firebase_options.dart": {
28+
"projectId": "dart-ci",
29+
"configurations": {
30+
"web": "1:410721018617:web:4fd4f4d82de23478f53828"
31+
}
32+
}
33+
}
34+
}
35+
}
36+
}

current_results_ui/lib/filter.dart

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,17 @@ class _FilterUIState extends State<FilterUI> {
6060
children: [
6161
for (final term in filter.terms)
6262
InputChip(
63-
label: Text(term),
64-
onDeleted: () {
65-
pushRoute(context,
66-
terms:
67-
filter.terms.where((t) => t != term));
68-
},
69-
onPressed: () {
70-
controller.text = term;
71-
}),
63+
label: Text(term),
64+
onDeleted: () {
65+
pushRoute(
66+
context,
67+
terms: filter.terms.where((t) => t != term),
68+
);
69+
},
70+
onPressed: () {
71+
controller.text = term;
72+
},
73+
),
7274
],
7375
),
7476
),
@@ -80,18 +82,22 @@ class _FilterUIState extends State<FilterUI> {
8082
child: TextField(
8183
controller: controller,
8284
decoration: const InputDecoration(
83-
hintText: 'Test, configuration or experiment prefix'),
85+
hintText: 'Test, configuration or experiment prefix',
86+
),
8487
onSubmitted: (value) {
8588
if (value.trim().isEmpty) return;
8689
final newTerms = value.split(',').map((s) => s.trim());
87-
bool isNotReplacedByNewTerm(String term) =>
88-
!newTerms.any((newTerm) =>
89-
term.startsWith(newTerm) || newTerm.startsWith(term));
90+
bool isNotReplacedByNewTerm(String term) => !newTerms.any(
91+
(newTerm) =>
92+
term.startsWith(newTerm) || newTerm.startsWith(term),
93+
);
9094
controller.text = '';
91-
pushRoute(context,
92-
terms: filter.terms
93-
.where(isNotReplacedByNewTerm)
94-
.followedBy(newTerms));
95+
pushRoute(
96+
context,
97+
terms: filter.terms
98+
.where(isNotReplacedByNewTerm)
99+
.followedBy(newTerms),
100+
);
95101
},
96102
),
97103
),
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// File generated by FlutterFire CLI.
6+
// ignore_for_file: type=lint
7+
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
8+
import 'package:flutter/foundation.dart'
9+
show defaultTargetPlatform, kIsWeb, TargetPlatform;
10+
11+
/// Default [FirebaseOptions] for use with your Firebase apps.
12+
///
13+
/// Example:
14+
/// ```dart
15+
/// import 'firebase_options.dart';
16+
/// // ...
17+
/// await Firebase.initializeApp(
18+
/// options: DefaultFirebaseOptions.currentPlatform,
19+
/// );
20+
/// ```
21+
class DefaultFirebaseOptions {
22+
static FirebaseOptions get currentPlatform {
23+
if (kIsWeb) {
24+
return web;
25+
}
26+
switch (defaultTargetPlatform) {
27+
case TargetPlatform.android:
28+
throw UnsupportedError(
29+
'DefaultFirebaseOptions have not been configured for android - '
30+
'you can reconfigure this by running the FlutterFire CLI again.',
31+
);
32+
case TargetPlatform.iOS:
33+
throw UnsupportedError(
34+
'DefaultFirebaseOptions have not been configured for ios - '
35+
'you can reconfigure this by running the FlutterFire CLI again.',
36+
);
37+
case TargetPlatform.macOS:
38+
throw UnsupportedError(
39+
'DefaultFirebaseOptions have not been configured for macos - '
40+
'you can reconfigure this by running the FlutterFire CLI again.',
41+
);
42+
case TargetPlatform.windows:
43+
throw UnsupportedError(
44+
'DefaultFirebaseOptions have not been configured for windows - '
45+
'you can reconfigure this by running the FlutterFire CLI again.',
46+
);
47+
case TargetPlatform.linux:
48+
throw UnsupportedError(
49+
'DefaultFirebaseOptions have not been configured for linux - '
50+
'you can reconfigure this by running the FlutterFire CLI again.',
51+
);
52+
default:
53+
throw UnsupportedError(
54+
'DefaultFirebaseOptions are not supported for this platform.',
55+
);
56+
}
57+
}
58+
59+
static const FirebaseOptions web = FirebaseOptions(
60+
apiKey: 'AIzaSyCOWP8dDmOzMdU3evqU-77HhvDAHD0kFU8',
61+
appId: '1:410721018617:web:4fd4f4d82de23478f53828',
62+
messagingSenderId: '410721018617',
63+
projectId: 'dart-ci',
64+
authDomain: 'dart-ci.firebaseapp.com',
65+
databaseURL: 'https://dart-ci.firebaseio.com',
66+
storageBucket: 'dart-ci.appspot.com',
67+
);
68+
}

current_results_ui/lib/instructions.dart

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,38 @@ class Instructions extends StatelessWidget {
1616
'Enter a query to see current test results',
1717
style: TextStyle(fontSize: 24.0),
1818
),
19-
paragraph('Enter query terms that are prefixes of configuration, '
20-
'experiment or test names.'
21-
' Multiple terms can be entered at once, separated by commas.'),
19+
paragraph(
20+
'Enter query terms that are prefixes of configuration, '
21+
'experiment or test names.'
22+
' Multiple terms can be entered at once, separated by commas.',
23+
),
2224
paragraph('Some example queries are:'),
2325
for (final example in [
2426
{
2527
'description': 'language_2/ tests on analyzer configurations',
26-
'terms': 'language_2/,analyzer'
28+
'terms': 'language_2/,analyzer',
2729
},
2830
{
2931
'description': 'service/de* tests on dartk- configurations',
30-
'terms': 'dartk-,service/de'
32+
'terms': 'dartk-,service/de',
3133
},
3234
{'description': 'analyzer unit tests', 'terms': 'pkg/analyzer/'},
3335
{
3436
'description':
3537
'all tests on dart2js strong null-safe configuration',
36-
'terms': 'dart2js-hostasserts-strong'
38+
'terms': 'dart2js-hostasserts-strong',
3739
},
3840
{
3941
'description':
4042
'all tests that were run with experiment "test-experiment"',
41-
'terms': 'test-experiment'
43+
'terms': 'test-experiment',
4244
},
4345
{'description': 'null-safe language tests', 'terms': 'language/'},
4446
]) ...[
4547
const SizedBox(height: 12),
4648
InkWell(
4749
onTap: () {
48-
Navigator.pushNamed(
49-
context,
50-
'/filter=${example['terms']}',
51-
);
50+
Navigator.pushNamed(context, '/filter=${example['terms']}');
5251
},
5352
child: Text.rich(
5453
TextSpan(
@@ -60,26 +59,29 @@ class Instructions extends StatelessWidget {
6059
color: Colors.blue[900],
6160
decoration: TextDecoration.underline,
6261
),
63-
)
62+
),
6463
],
6564
),
6665
),
6766
),
6867
],
6968
const SizedBox(height: 24.0),
70-
const Text(
71-
'About Current Results',
72-
style: TextStyle(fontSize: 24.0),
69+
const Text('About Current Results', style: TextStyle(fontSize: 24.0)),
70+
paragraph(
71+
'For each test, the results show how many '
72+
'of the selected configurations are passing, failing, and flaky. '
73+
'The item can be expanded to show which configurations are failing,'
74+
' and the configuration names are links to the failure logs.',
75+
),
76+
paragraph(
77+
'The clock icon after each test name is a link to the '
78+
'results feed, filtered to show just the history of that test.',
79+
),
80+
paragraph(
81+
'Results can be downloaded from the server using the '
82+
'JSON link at the bottom of the page, or as comma-separated '
83+
'text using the text link.',
7384
),
74-
paragraph('For each test, the results show how many '
75-
'of the selected configurations are passing, failing, and flaky. '
76-
'The item can be expanded to show which configurations are failing,'
77-
' and the configuration names are links to the failure logs.'),
78-
paragraph('The clock icon after each test name is a link to the '
79-
'results feed, filtered to show just the history of that test.'),
80-
paragraph('Results can be downloaded from the server using the '
81-
'JSON link at the bottom of the page, or as comma-separated '
82-
'text using the text link.'),
8385
],
8486
),
8587
);

0 commit comments

Comments
 (0)