mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-29 02:01:43 +00:00
Move truncation of docker ids to FE to allow full value in tooltips
- Reveals full id if you search for it. - Difficult to copy and paste the full id if you want it for some reason
This commit is contained in:
@@ -64,7 +64,7 @@ function matchPrefix(label, prefix) {
|
||||
* no match).
|
||||
* Returns a new instance of nodeMatches.
|
||||
*/
|
||||
function findNodeMatch(nodeMatches, keyPath, text, query, prefix, label) {
|
||||
function findNodeMatch(nodeMatches, keyPath, text, query, prefix, label, truncate) {
|
||||
if (!prefix || matchPrefix(label, prefix)) {
|
||||
const queryRe = makeRegExp(query);
|
||||
const matches = text.match(queryRe);
|
||||
@@ -72,7 +72,7 @@ function findNodeMatch(nodeMatches, keyPath, text, query, prefix, label) {
|
||||
const firstMatch = matches[0];
|
||||
const index = text.search(queryRe);
|
||||
nodeMatches = nodeMatches.setIn(keyPath,
|
||||
{text, label, start: index, length: firstMatch.length});
|
||||
{text, label, start: index, length: firstMatch.length, truncate});
|
||||
}
|
||||
}
|
||||
return nodeMatches;
|
||||
@@ -135,7 +135,7 @@ export function searchTopology(nodes, { prefix, query, metric, comp, value }) {
|
||||
node.get('metadata').forEach(field => {
|
||||
const keyPath = [nodeId, 'metadata', field.get('id')];
|
||||
nodeMatches = findNodeMatch(nodeMatches, keyPath, field.get('value'),
|
||||
query, prefix, field.get('label'));
|
||||
query, prefix, field.get('label'), field.get('truncate'));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user