blob: c6de2f05668ab66ad72b4e0251ffa7b0983efe55 [file] [log] [blame]
// Copyright 2020 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import '../model/task.pb.dart';
/// Show information regarding each attempt for a luci Task.
///
/// Currently shows a button that links to each individual log
/// for a Task.
class LuciTaskAttemptSummary extends StatelessWidget {
const LuciTaskAttemptSummary({
super.key,
required this.task,
});
/// The task to show information from.
final Task task;
@visibleForTesting
static const String luciProdLogBase = 'https://ci.chromium.org/p/flutter/builders';
@override
Widget build(BuildContext context) {
final List<String> buildNumberList = task.buildNumberList.isEmpty ? <String>[] : task.buildNumberList.split(',');
return ListBody(
children: List<Widget>.generate(buildNumberList.length, (int i) {
return ElevatedButton(
child: Text('OPEN LOG FOR BUILD #${buildNumberList[i]}'),
onPressed: () {
launchUrl(_luciProdLogUrl(task.builderName, buildNumberList[i]));
},
);
}),
);
}
Uri _luciProdLogUrl(String builderName, String buildNumber) {
final String pool = task.isFlaky ? 'staging' : 'prod';
return Uri.parse('$luciProdLogBase/$pool/$builderName/$buildNumber');
}
}