mirror of
https://github.com/nasa/openmct.git
synced 2025-06-27 11:32:13 +00:00
Compare commits
18 Commits
code-cover
...
v1.4.0-rc6
Author | SHA1 | Date | |
---|---|---|---|
cb8e906f93 | |||
be746db774 | |||
de9d972cf6 | |||
5ac43ccf6a | |||
d29b4d3b83 | |||
541e96a20a | |||
1554823416 | |||
674a888d80 | |||
ec9dbabc46 | |||
c148160fa8 | |||
8b45dae1f1 | |||
1ec0274984 | |||
9de1927834 | |||
df3991cbd5 | |||
528a2aad8c | |||
c9a29d0854 | |||
d28c4e8711 | |||
ac04983c5b |
@ -46,6 +46,7 @@ define(
|
|||||||
filter = filter.trim().toLowerCase();
|
filter = filter.trim().toLowerCase();
|
||||||
|
|
||||||
let rowsToFilter = this.getRowsToFilter(columnKey, filter);
|
let rowsToFilter = this.getRowsToFilter(columnKey, filter);
|
||||||
|
|
||||||
if (filter.length === 0) {
|
if (filter.length === 0) {
|
||||||
delete this.columnFilters[columnKey];
|
delete this.columnFilters[columnKey];
|
||||||
} else {
|
} else {
|
||||||
@ -56,6 +57,16 @@ define(
|
|||||||
this.emit('filter');
|
this.emit('filter');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setColumnRegexFilter(columnKey, filter) {
|
||||||
|
filter = filter.trim();
|
||||||
|
|
||||||
|
let rowsToFilter = this.masterCollection.getRows();
|
||||||
|
|
||||||
|
this.columnFilters[columnKey] = new RegExp(filter);
|
||||||
|
this.rows = rowsToFilter.filter(this.matchesFilters, this);
|
||||||
|
this.emit('filter');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@ -71,6 +82,10 @@ define(
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
isSubsetOfCurrentFilter(columnKey, filter) {
|
isSubsetOfCurrentFilter(columnKey, filter) {
|
||||||
|
if (this.columnFilters[columnKey] instanceof RegExp) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return this.columnFilters[columnKey]
|
return this.columnFilters[columnKey]
|
||||||
&& filter.startsWith(this.columnFilters[columnKey])
|
&& filter.startsWith(this.columnFilters[columnKey])
|
||||||
// startsWith check will otherwise fail when filter cleared
|
// startsWith check will otherwise fail when filter cleared
|
||||||
@ -97,7 +112,11 @@ define(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
doesMatchFilters = formattedValue.toLowerCase().indexOf(this.columnFilters[key]) !== -1;
|
if (this.columnFilters[key] instanceof RegExp) {
|
||||||
|
doesMatchFilters = this.columnFilters[key].test(formattedValue);
|
||||||
|
} else {
|
||||||
|
doesMatchFilters = formattedValue.toLowerCase().indexOf(this.columnFilters[key]) !== -1;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return doesMatchFilters;
|
return doesMatchFilters;
|
||||||
|
@ -188,7 +188,17 @@
|
|||||||
class="c-table__search"
|
class="c-table__search"
|
||||||
@input="filterChanged(key)"
|
@input="filterChanged(key)"
|
||||||
@clear="clearFilter(key)"
|
@clear="clearFilter(key)"
|
||||||
/>
|
>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="c-search__use-regex"
|
||||||
|
:class="{ 'is-active': enableRegexSearch[key] }"
|
||||||
|
title="Click to enable regex: enter a string with slashes, like this: /regex_exp/"
|
||||||
|
@click="toggleRegex(key)"
|
||||||
|
>
|
||||||
|
/R/
|
||||||
|
</button>
|
||||||
|
</search>
|
||||||
</table-column-header>
|
</table-column-header>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -361,6 +371,7 @@ export default {
|
|||||||
paused: false,
|
paused: false,
|
||||||
markedRows: [],
|
markedRows: [],
|
||||||
isShowingMarkedRowsOnly: false,
|
isShowingMarkedRowsOnly: false,
|
||||||
|
enableRegexSearch: {},
|
||||||
hideHeaders: configuration.hideHeaders,
|
hideHeaders: configuration.hideHeaders,
|
||||||
totalNumberOfRows: 0
|
totalNumberOfRows: 0
|
||||||
};
|
};
|
||||||
@ -618,7 +629,16 @@ export default {
|
|||||||
this.headersHolderEl.scrollLeft = this.scrollable.scrollLeft;
|
this.headersHolderEl.scrollLeft = this.scrollable.scrollLeft;
|
||||||
},
|
},
|
||||||
filterChanged(columnKey) {
|
filterChanged(columnKey) {
|
||||||
this.table.filteredRows.setColumnFilter(columnKey, this.filters[columnKey]);
|
if (this.enableRegexSearch[columnKey]) {
|
||||||
|
if (this.isCompleteRegex(this.filters[columnKey])) {
|
||||||
|
this.table.filteredRows.setColumnRegexFilter(columnKey, this.filters[columnKey].slice(1, -1));
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.table.filteredRows.setColumnFilter(columnKey, this.filters[columnKey]);
|
||||||
|
}
|
||||||
|
|
||||||
this.setHeight();
|
this.setHeight();
|
||||||
},
|
},
|
||||||
clearFilter(columnKey) {
|
clearFilter(columnKey) {
|
||||||
@ -956,6 +976,18 @@ export default {
|
|||||||
|
|
||||||
this.$nextTick().then(this.calculateColumnWidths);
|
this.$nextTick().then(this.calculateColumnWidths);
|
||||||
},
|
},
|
||||||
|
toggleRegex(key) {
|
||||||
|
this.$set(this.filters, key, '');
|
||||||
|
|
||||||
|
if (this.enableRegexSearch[key] === undefined) {
|
||||||
|
this.$set(this.enableRegexSearch, key, true);
|
||||||
|
} else {
|
||||||
|
this.$set(this.enableRegexSearch, key, !this.enableRegexSearch[key]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isCompleteRegex(string) {
|
||||||
|
return (string.length > 2 && string[0] === '/' && string[string.length - 1] === '/');
|
||||||
|
},
|
||||||
getViewContext() {
|
getViewContext() {
|
||||||
return {
|
return {
|
||||||
type: 'telemetry-table',
|
type: 'telemetry-table',
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
|
@mixin visibleRegexButton {
|
||||||
|
opacity: 1;
|
||||||
|
padding: 1px 3px;
|
||||||
|
width: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
.c-search {
|
.c-search {
|
||||||
@include wrappedInput();
|
@include wrappedInput();
|
||||||
|
|
||||||
padding-top: 2px;
|
padding-top: 2px;
|
||||||
padding-bottom: 2px;
|
padding-bottom: 2px;
|
||||||
|
|
||||||
@ -9,11 +14,46 @@
|
|||||||
content: $glyph-icon-magnify;
|
content: $glyph-icon-magnify;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__use-regex {
|
||||||
|
// Button
|
||||||
|
$c: $colorBodyFg;
|
||||||
|
background: rgba($c, 0.2);
|
||||||
|
border: 1px solid rgba($c, 0.3);
|
||||||
|
color: $c;
|
||||||
|
border-radius: $controlCr;
|
||||||
|
font-weight: bold;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
font-size: 0.8em;
|
||||||
|
margin-left: $interiorMarginSm;
|
||||||
|
min-width: 0;
|
||||||
|
opacity: 0;
|
||||||
|
order: 2;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 1px 0;
|
||||||
|
transform-origin: left;
|
||||||
|
transition: $transOut;
|
||||||
|
width: 0;
|
||||||
|
|
||||||
|
&.is-active {
|
||||||
|
$c: $colorBtnActiveBg;
|
||||||
|
@include visibleRegexButton();
|
||||||
|
background: rgba($c, 0.3);
|
||||||
|
border-color: $c;
|
||||||
|
color: $c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&__clear-input {
|
&__clear-input {
|
||||||
display: none;
|
display: none;
|
||||||
|
order: 99;
|
||||||
|
padding: 1px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.is-active {
|
&.is-active {
|
||||||
|
.c-search__use-regex {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.c-search__clear-input {
|
.c-search__clear-input {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
@ -21,6 +61,15 @@
|
|||||||
|
|
||||||
input[type='text'],
|
input[type='text'],
|
||||||
input[type='search'] {
|
input[type='search'] {
|
||||||
|
margin-left: $interiorMargin;
|
||||||
|
order: 3;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
.c-search__use-regex {
|
||||||
|
@include visibleRegexButton();
|
||||||
|
transition: $transIn;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
class="c-search__clear-input icon-x-in-circle"
|
class="c-search__clear-input icon-x-in-circle"
|
||||||
@click="clearInput"
|
@click="clearInput"
|
||||||
></a>
|
></a>
|
||||||
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user