Migrator: Fix 'Report a Problem' link

Fixes https://github.com/dart-lang/sdk/issues/41485

Change-Id: I514cc299f7a821f8cd8d623a8d9702e694178379
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146461
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
This commit is contained in:
Sam Rawlins 2020-05-05 04:04:03 +00:00 committed by commit-bot@chromium.org
parent bbe133eac7
commit 9c94f08410
3 changed files with 3542 additions and 3566 deletions

View file

@ -71,7 +71,7 @@
href="https://goo.gle/dart-null-safety-migration-tool">Null safety
migration help</a>
<span class="wide"> </span>
<div>Based on {{ sdkVersion }}</div>
<div>Based on <span id="sdk-version">{{ sdkVersion }}</span></div>
<button class="report-problem">Report a Problem</button>
</footer>
</body>

File diff suppressed because it is too large Load diff

View file

@ -61,8 +61,7 @@ void main() {
final reportProblemButton = document.querySelector('.report-problem');
reportProblemButton.onClick.listen((_) {
window.open('https://goo.gle/dart-null-safety-migration-tool-issue',
'report-problem');
window.open(getGitHubProblemUri().toString(), 'report-problem');
});
document.querySelector('.popup-pane .close').onClick.listen(
@ -106,6 +105,8 @@ final Element unitName = document.querySelector('#unit-name');
String get rootPath => querySelector('.root').text.trim();
String get sdkVersion => document.getElementById('sdk-version').text;
void addArrowClickHandler(Element arrow) {
var childList = (arrow.parentNode as Element).querySelector(':scope > ul');
// Animating height from "auto" to "0" is not supported by CSS [1], so all we
@ -187,7 +188,11 @@ Future<Map<String, Object>> doPost(String path) async {
}
}
Uri getGithubUri(String description, Object exception, Object stackTrace) =>
/// Returns the URL of the "new issue" form for the SDK repository,
/// pre-populating the title, some labels, using [description], [exception], and
/// [stackTrace] in the body.
Uri getGitHubErrorUri(
String description, Object exception, Object stackTrace) =>
Uri.https('github.com', 'dart-lang/sdk/issues/new', {
'title': 'Issue with NNBD migration tool: $description',
'labels': 'area-analyzer,analyzer-nnbd-migration,type-bug',
@ -202,7 +207,7 @@ Please fill in the following:
**What I was doing when this issue occurred**:
**Is it possible to work around this issue**:
**Has this issue happened before, and if so, how often**:
**Dart SDK version**: (visible in lower left of migration preview)
**Dart SDK version**: $sdkVersion
**Additional details**:
Thanks for filing!
@ -215,6 +220,26 @@ $stackTrace
''',
});
/// Returns the URL of the "new issue" form for the SDK repository,
/// pre-populating some labels and a body template.
Uri getGitHubProblemUri() =>
Uri.https('github.com', 'dart-lang/sdk/issues/new', {
'labels': 'area-analyzer,analyzer-nnbd-migration,type-bug',
'body': '''
#### Steps to reproduce
#### What did you expect to happen?
#### What actually happened?
_Screenshots are appreciated_
**Dart SDK version**: $sdkVersion
Thanks for filing!
''',
});
int getLine(String location) {
var str = Uri.parse(location).queryParameters['line'];
return str == null ? null : int.tryParse(str);
@ -258,7 +283,7 @@ void handleError(String header, Object exception, Object stackTrace) {
popupPane.querySelector('p').innerText = subheader;
popupPane.querySelector('pre').innerText = stackTrace.toString();
(popupPane.querySelector('a.bottom') as AnchorElement).href =
getGithubUri(header, subheader, stackTrace).toString();
getGitHubErrorUri(header, subheader, stackTrace).toString();
popupPane..style.display = 'initial';
logError('$header: $exception', stackTrace);
}