Compare commits

...

21 Commits

Author SHA1 Message Date
Deep Tailor
cb8e906f93 Merge branch 'master' of https://github.com/nasa/openmct into regex-search-tables 2020-12-01 14:42:35 -08:00
Nikhil
1c2b0678be [Notebook] snapshots on plots are empty #3566 (#3567) 2020-12-01 14:14:59 -08:00
Deep Tailor
6f810add43 replace dots with underscores in save as filenames (#3565) 2020-12-01 11:18:13 -08:00
Deep Tailor
12727adb16 fix export marked data as csv (#3563) 2020-12-01 09:44:17 -08:00
Deep Tailor
be746db774 fix lint errors 2020-11-25 09:15:31 -08:00
Deep Tailor
de9d972cf6 merge with master 2020-11-25 09:10:32 -08:00
Deep Tailor
5ac43ccf6a Merge branch 'master' into regex-search-tables 2020-07-20 11:16:10 -07:00
Deep Tailor
d29b4d3b83 Merge branch 'master' into regex-search-tables 2020-07-13 12:44:36 -07:00
Deep Tailor
541e96a20a Merge branch 'master' into regex-search-tables 2020-05-26 11:13:27 -07:00
Andrew Henry
1554823416 Merge branch 'master' into regex-search-tables 2020-05-11 14:37:15 -07:00
Deep Tailor
674a888d80 Merge branch 'master' into regex-search-tables 2020-05-08 10:52:00 -07:00
Deep Tailor
ec9dbabc46 fixes regression when search string is modified 2020-05-08 10:50:36 -07:00
Deep Tailor
c148160fa8 Merge branch 'master' into regex-search-tables 2020-05-05 12:14:00 -07:00
Deep Tailor
8b45dae1f1 use to trigger dom update when clearing input 2020-04-21 21:08:32 -07:00
charlesh88
1ec0274984 Styling for table search regex button
- Polish size of button;
2020-04-21 17:29:56 -07:00
Deep Tailor
9de1927834 remove unused variable 2020-04-21 16:18:56 -07:00
Deep Tailor
df3991cbd5 Merge branch 'master' into regex-search-tables 2020-04-21 16:16:11 -07:00
Deep Tailor
528a2aad8c change title and clear out input on toggle regex 2020-04-21 16:01:43 -07:00
charlesh88
c9a29d0854 Styling for table search regex button
- Allow user input to be retained when toggling regex on/off;
2020-04-20 17:24:14 -07:00
charlesh88
d28c4e8711 Styling for table search regex button
- Hover display/hide and styling for regex button;
2020-04-20 17:23:29 -07:00
Deep Tailor
ac04983c5b working prototype ready for styling 2020-04-18 14:05:17 -07:00
7 changed files with 122 additions and 11 deletions

View File

@@ -117,8 +117,10 @@ define(
* @returns {promise}
*/
ExportImageService.prototype.exportJPG = function (element, filename, className) {
const processedFilename = replaceDotsWithUnderscores(filename);
return this.renderElement(element, "jpg", className).then(function (img) {
saveAs(img, filename);
saveAs(img, processedFilename);
});
};
@@ -130,8 +132,10 @@ define(
* @returns {promise}
*/
ExportImageService.prototype.exportPNG = function (element, filename, className) {
const processedFilename = replaceDotsWithUnderscores(filename);
return this.renderElement(element, "png", className).then(function (img) {
saveAs(img, filename);
saveAs(img, processedFilename);
});
};
@@ -146,6 +150,12 @@ define(
return this.renderElement(element, "png", className);
};
function replaceDotsWithUnderscores(filename) {
const regex = /\./gi;
return filename.replace(regex, '_');
}
/**
* canvas.toBlob() not supported in IE < 10, Opera, and Safari. This polyfill
* implements the method in browsers that would not otherwise support it.

View File

@@ -30,13 +30,13 @@ let exportCSV = {
},
group: 'view'
};
let exportMarkedRows = {
let exportMarkedDataAsCSV = {
name: 'Export Marked Rows',
key: 'export-csv-marked',
description: "Export marked rows as CSV",
cssClass: 'icon-download labeled',
invoke: (objectPath, viewProvider) => {
viewProvider.getViewContext().exportMarkedRows();
viewProvider.getViewContext().exportMarkedDataAsCSV();
},
group: 'view'
};
@@ -98,7 +98,7 @@ let autosizeColumns = {
let viewActions = [
exportCSV,
exportMarkedRows,
exportMarkedDataAsCSV,
unmarkAllRows,
pause,
play,

View File

@@ -46,6 +46,7 @@ define(
filter = filter.trim().toLowerCase();
let rowsToFilter = this.getRowsToFilter(columnKey, filter);
if (filter.length === 0) {
delete this.columnFilters[columnKey];
} else {
@@ -56,6 +57,16 @@ define(
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
*/
@@ -71,6 +82,10 @@ define(
* @private
*/
isSubsetOfCurrentFilter(columnKey, filter) {
if (this.columnFilters[columnKey] instanceof RegExp) {
return false;
}
return this.columnFilters[columnKey]
&& filter.startsWith(this.columnFilters[columnKey])
// startsWith check will otherwise fail when filter cleared
@@ -97,7 +112,11 @@ define(
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;

View File

@@ -188,7 +188,17 @@
class="c-table__search"
@input="filterChanged(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>
</tr>
</thead>
@@ -361,6 +371,7 @@ export default {
paused: false,
markedRows: [],
isShowingMarkedRowsOnly: false,
enableRegexSearch: {},
hideHeaders: configuration.hideHeaders,
totalNumberOfRows: 0
};
@@ -618,7 +629,16 @@ export default {
this.headersHolderEl.scrollLeft = this.scrollable.scrollLeft;
},
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();
},
clearFilter(columnKey) {
@@ -956,11 +976,23 @@ export default {
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() {
return {
type: 'telemetry-table',
exportAllDataAsCSV: this.exportAllDataAsCSV,
exportMarkedRows: this.exportMarkedRows,
exportMarkedDataAsCSV: this.exportMarkedDataAsCSV,
unmarkAllRows: this.unmarkAllRows,
togglePauseByButton: this.togglePauseByButton,
expandColumns: this.recalculateColumnWidths,

View File

@@ -162,5 +162,5 @@
// This element is the recipient for object styling; cannot be display: contents
flex: 1 1 auto;
overflow: hidden;
display: contents;
display: block;
}

View File

@@ -1,6 +1,11 @@
@mixin visibleRegexButton {
opacity: 1;
padding: 1px 3px;
width: 24px;
}
.c-search {
@include wrappedInput();
padding-top: 2px;
padding-bottom: 2px;
@@ -9,11 +14,46 @@
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 {
display: none;
order: 99;
padding: 1px 0;
}
&.is-active {
.c-search__use-regex {
margin-left: 0;
}
.c-search__clear-input {
display: block;
}
@@ -21,6 +61,15 @@
input[type='text'],
input[type='search'] {
margin-left: $interiorMargin;
order: 3;
text-align: left;
}
&:hover {
.c-search__use-regex {
@include visibleRegexButton();
transition: $transIn;
}
}
}

View File

@@ -15,6 +15,7 @@
class="c-search__clear-input icon-x-in-circle"
@click="clearInput"
></a>
<slot></slot>
</div>
</template>