Better display

This commit is contained in:
Thorsten Muerell
2017-11-15 11:57:56 +01:00
parent 68740939fa
commit 1ef2f9eb96
4 changed files with 25 additions and 3 deletions

View File

@@ -7,13 +7,18 @@ export class TextDocumentContentProvider implements vscode.TextDocumentContentPr
public provideTextDocumentContent(uri: vscode.Uri): string {
if (!this._data) return this.errorSnippet();
if (this._data['rows'].length == 0) return this.errorSnippet();
const configuration = vscode.workspace.getConfiguration('frog')
const additionalStyles = configuration.get("resultSetStyles", "")
let styles = `<style>
table {
border-collapse: collapse;
}
table td, table th {
padding: 3px;
padding: 2px;
font-size: 11px;
white-space: nowrap;
}
tr:hover {
background-color: #aaaa66;
@@ -31,6 +36,9 @@ export class TextDocumentContentProvider implements vscode.TextDocumentContentPr
.vscode-dark #limitBox a {
color: white;
}
.vscode-dark table td.value-null {
background-color: #666600;
}
.vscode-light table {
border: solid 1px black;
@@ -41,6 +49,11 @@ export class TextDocumentContentProvider implements vscode.TextDocumentContentPr
.vscode-light #limitBox a {
color: black;
}
.vscode-light table td.value-null {
background-color: #cccc33;
}
${additionalStyles}
</style>`
const choosableLimits = [2,10,50]
@@ -52,7 +65,7 @@ export class TextDocumentContentProvider implements vscode.TextDocumentContentPr
text += this._data['columnDefinitions'].map((x) => `<th>${x['name']}</th>`).join('')
text += '</tr>'
text += this._data['rows'].map((r) =>
'<tr>' + r['columns'].map((c) => '<td>' + c['value'] + '</td>').join('') + '</tr>'
'<tr>' + r['columns'].map((c) => '<td class="' + (c['value'] ? 'value-value' : 'value-null') + '">' + (c['value'] ? c['value'] : 'NULL') + '</td>').join('') + '</tr>'
).join('')
text += '</table></body>'
return text;