Skip to content

Commit 7288468

Browse files
committed
Change view to use generateFields
1 parent aa04470 commit 7288468

File tree

2 files changed

+39
-32
lines changed

2 files changed

+39
-32
lines changed

src/panels/tools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ module.exports = class {
9595
fields.forEach(field => {
9696
html += /*html*/`
9797
<section class="component">
98-
<vscode-text-field readonly value="${field.value.replace(new RegExp(`"`, `g`), `&quot;`)}" ${field.size ? `size="${field.size}"` : ``}>${field.label || ``}</vscode-text-field>
98+
<vscode-text-field readonly value="${field.value ? field.value.replace(new RegExp(`"`, `g`), `&quot;`) : ``}" ${field.size ? `size="${field.size}"` : ``}>${field.label || ``}</vscode-text-field>
9999
</section>
100100
`;
101101
});

src/panels/view/index.js

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -94,37 +94,44 @@ module.exports = class ViewPanel {
9494
${Tools.generateTabs([
9595
{
9696
title: `View`,
97-
content: `
98-
<section class="component-container">
99-
<section class="component">
100-
<vscode-text-field readonly value="${info.TABLE_NAME}">Name</vscode-text-field>
101-
</section>
102-
<section class="component">
103-
<vscode-text-field readonly value="${info.TABLE_SCHEMA}">Schema</vscode-text-field>
104-
</section>
105-
<!-- <section class="component">
106-
<vscode-text-field readonly value="${info.SYSTEM_TABLE_NAME}">System name</vscode-text-field>
107-
</section> -->
108-
<section class="component">
109-
<vscode-text-field readonly value="${checkValues[info.CHECK_OPTION] || `None`}">Check option</vscode-text-field>
110-
</section>
111-
<section class="component">
112-
<vscode-text-field readonly value="${info.IS_INSERTABLE_INTO === `YES` ? `Yes` : `No`}">Insert allowed</vscode-text-field>
113-
</section>
114-
<section class="component">
115-
<vscode-text-field readonly value="${info.IS_UPDATABLE === `Y` ? `Yes` : `No`}">Update allowed</vscode-text-field>
116-
</section>
117-
<section class="component">
118-
<vscode-text-field readonly value="${info.IS_DELETABLE === `Y` ? `Yes` : `No`}">Delete allowed</vscode-text-field>
119-
</section>
120-
<!-- <section class="component">
121-
<vscode-text-field readonly value="${info.TABLE_TEXT}" size="50">Text</vscode-text-field>
122-
</section>
123-
<section class="component">
124-
<vscode-text-field readonly value="${info.LONG_COMMENT || ``}" size="50">Comment</vscode-text-field>
125-
</section> -->
126-
</section>
127-
`
97+
content: Tools.generateFields([
98+
{
99+
label: `Name`,
100+
value: info.TABLE_NAME
101+
},
102+
{
103+
label: `Schema`,
104+
value: info.TABLE_SCHEMA
105+
},
106+
{
107+
label: `System name`,
108+
value: info.SYSTEM_TABLE_NAME
109+
},
110+
{
111+
label: `Check option`,
112+
value: checkValues[info.CHECK_OPTION] || `None`
113+
},
114+
{
115+
label: `Insert allowed`,
116+
value: info.IS_INSERTABLE_INTO === `YES` ? `Yes` : `No`
117+
},
118+
{
119+
label: `Update allowed`,
120+
value: info.IS_UPDATABLE === `Y` ? `Yes` : `No`
121+
},
122+
{
123+
label: `Delete allowed`,
124+
value: info.IS_DELETABLE === `Y` ? `Yes` : `No`
125+
},
126+
{
127+
label: `Text`,
128+
value: info.TABLE_TEXT
129+
},
130+
{
131+
label: `Comment`,
132+
value: info.LONG_COMMENT || ``
133+
}
134+
]),
128135
},
129136
{
130137
title: `Columns`,

0 commit comments

Comments
 (0)