Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: pkg/analysis_server/lib/src/status/get_handler.dart

Issue 1416603008: Tweaks for the status page. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analysis_server.src.status.get_handler; 5 library analysis_server.src.status.get_handler;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 } 1547 }
1548 1548
1549 if (handler != null) { 1549 if (handler != null) {
1550 buffer.write('<h3>Execution Domain</h3>'); 1550 buffer.write('<h3>Execution Domain</h3>');
1551 _writeTwoColumns(buffer, (StringBuffer buffer) { 1551 _writeTwoColumns(buffer, (StringBuffer buffer) {
1552 _writeSubscriptionList(buffer, ExecutionService.VALUES, services); 1552 _writeSubscriptionList(buffer, ExecutionService.VALUES, services);
1553 }, (StringBuffer buffer) {}); 1553 }, (StringBuffer buffer) {});
1554 } 1554 }
1555 } 1555 }
1556 1556
1557 void _writeListItem(StringBuffer buffer, writer()) {
1558 buffer.write('<li>');
1559 writer();
1560 buffer.write('</li>');
1561 }
1562
1557 void _writeListOfStrings( 1563 void _writeListOfStrings(
1558 StringBuffer buffer, String listName, Iterable<String> items) { 1564 StringBuffer buffer, String listName, Iterable<String> items) {
1559 List<String> itemList = items.toList(); 1565 List<String> itemList = items.toList();
1560 itemList.sort((String a, String b) { 1566 itemList.sort((String a, String b) {
1561 a = a.toLowerCase(); 1567 a = a.toLowerCase();
1562 b = b.toLowerCase(); 1568 b = b.toLowerCase();
1563 return a.compareTo(b); 1569 return a.compareTo(b);
1564 }); 1570 });
1565 buffer.write('List "listName" containing ${itemList.length} entries:'); 1571 buffer.write('List "$listName" containing ${itemList.length} entries:');
1566 buffer.write('<ul>'); 1572 buffer.write('<ul>');
1567 for (String member in itemList) { 1573 for (String member in itemList) {
1568 buffer.write('<li>'); 1574 _writeListItem(buffer, () {
1569 buffer.write(member); 1575 buffer.write(member);
1570 buffer.write('</li>'); 1576 });
1571 } 1577 }
1572 buffer.write('</ul>'); 1578 buffer.write('</ul>');
1573 } 1579 }
1574 1580
1575 /** 1581 /**
1576 * Write a representation of an analysis option with the given [name] and 1582 * Write a representation of an analysis option with the given [name] and
1577 * [value] to the given [buffer]. The option should be separated from other 1583 * [value] to the given [buffer]. The option should be separated from other
1578 * options unless the [last] flag is true, indicating that this is the last 1584 * options unless the [last] flag is true, indicating that this is the last
1579 * option in the list of options. 1585 * option in the list of options.
1580 */ 1586 */
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 void _writeValueAsHtml( 1927 void _writeValueAsHtml(
1922 StringBuffer buffer, Object value, Map<String, String> linkParameters) { 1928 StringBuffer buffer, Object value, Map<String, String> linkParameters) {
1923 if (value == null) { 1929 if (value == null) {
1924 buffer.write('<i>null</i>'); 1930 buffer.write('<i>null</i>');
1925 } else if (value is String) { 1931 } else if (value is String) {
1926 buffer.write('<pre>${HTML_ESCAPE.convert(value)}</pre>'); 1932 buffer.write('<pre>${HTML_ESCAPE.convert(value)}</pre>');
1927 } else if (value is List) { 1933 } else if (value is List) {
1928 buffer.write('List containing ${value.length} entries'); 1934 buffer.write('List containing ${value.length} entries');
1929 buffer.write('<ul>'); 1935 buffer.write('<ul>');
1930 for (var entry in value) { 1936 for (var entry in value) {
1931 buffer.write('<li>'); 1937 _writeListItem(buffer, () {
1932 _writeValueAsHtml(buffer, entry, linkParameters); 1938 _writeValueAsHtml(buffer, entry, linkParameters);
1933 buffer.write('</li>'); 1939 });
1934 } 1940 }
1935 buffer.write('</ul>'); 1941 buffer.write('</ul>');
1936 } else if (value is AstNode) { 1942 } else if (value is AstNode) {
1937 String link = 1943 String link =
1938 makeLink(AST_PATH, linkParameters, value.runtimeType.toString()); 1944 makeLink(AST_PATH, linkParameters, value.runtimeType.toString());
1939 buffer.write('<i>$link</i>'); 1945 buffer.write('<i>$link</i>');
1940 } else if (value is Element) { 1946 } else if (value is Element) {
1941 String link = 1947 String link =
1942 makeLink(ELEMENT_PATH, linkParameters, value.runtimeType.toString()); 1948 makeLink(ELEMENT_PATH, linkParameters, value.runtimeType.toString());
1943 buffer.write('<i>$link</i>'); 1949 buffer.write('<i>$link</i>');
1944 } else if (value is UsedLocalElements) { 1950 } else if (value is UsedLocalElements) {
1945 buffer.write('<ul>'); 1951 buffer.write('<ul>');
1946 { 1952 _writeListItem(buffer, () {
1947 HashSet<Element> elements = value.elements; 1953 HashSet<Element> elements = value.elements;
1948 buffer.write('List "elements" containing ${elements.length} entries'); 1954 buffer.write('List "elements" containing ${elements.length} entries');
1949 buffer.write('<ul>'); 1955 buffer.write('<ul>');
1950 for (Element element in elements) { 1956 for (Element element in elements) {
1951 buffer.write('<li>'); 1957 _writeListItem(buffer, () {
1952 buffer.write('<i>${element.runtimeType}</i> $element'); 1958 String elementStr = HTML_ESCAPE.convert(element.toString());
1953 buffer.write('</li>'); 1959 buffer.write('<i>${element.runtimeType}</i> $elementStr');
1960 });
1954 } 1961 }
1955 buffer.write('</ul>'); 1962 buffer.write('</ul>');
1956 } 1963 });
1957 _writeListOfStrings(buffer, 'members', value.members); 1964 _writeListItem(buffer, () {
1958 _writeListOfStrings(buffer, 'readMembers', value.readMembers); 1965 _writeListOfStrings(buffer, 'members', value.members);
1966 });
1967 _writeListItem(buffer, () {
1968 _writeListOfStrings(buffer, 'readMembers', value.readMembers);
1969 });
1959 buffer.write('</ul>'); 1970 buffer.write('</ul>');
1960 } else { 1971 } else {
1961 buffer.write(HTML_ESCAPE.convert(value.toString())); 1972 buffer.write(HTML_ESCAPE.convert(value.toString()));
1962 buffer.write(' <i>(${value.runtimeType.toString()})</i>'); 1973 buffer.write(' <i>(${value.runtimeType.toString()})</i>');
1963 } 1974 }
1964 } 1975 }
1965 1976
1966 /** 1977 /**
1967 * Create a link to [path] with query parameters [params], with inner HTML 1978 * Create a link to [path] with query parameters [params], with inner HTML
1968 * [innerHtml]. If [hasError] is `true`, then the link will have the class 1979 * [innerHtml]. If [hasError] is `true`, then the link will have the class
1969 * 'error'. 1980 * 'error'.
1970 */ 1981 */
1971 static String makeLink( 1982 static String makeLink(
1972 String path, Map<String, String> params, String innerHtml, 1983 String path, Map<String, String> params, String innerHtml,
1973 [bool hasError = false]) { 1984 [bool hasError = false]) {
1974 Uri uri = new Uri(path: path, queryParameters: params); 1985 Uri uri = new Uri(path: path, queryParameters: params);
1975 String href = HTML_ESCAPE.convert(uri.toString()); 1986 String href = HTML_ESCAPE.convert(uri.toString());
1976 String classAttribute = hasError ? ' class="error"' : ''; 1987 String classAttribute = hasError ? ' class="error"' : '';
1977 return '<a href="$href"$classAttribute>$innerHtml</a>'; 1988 return '<a href="$href"$classAttribute>$innerHtml</a>';
1978 } 1989 }
1979 } 1990 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698