Skip to content

Commit fcd4f53

Browse files
authored
Merge pull request #103 from SAP-samples/massConvert_views
Mass convert views and UI upgrades
2 parents 00177e7 + ddf9889 commit fcd4f53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2156
-1198
lines changed

CHANGELOG.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
[
2+
{
3+
"date": "2023-02-17",
4+
"version": "3.202302.5",
5+
"Changed": [
6+
"Complete Feature Request [Issue 100](https://github.com/SAP-samples/hana-developer-cli-tool-example/issues/100) Add Views to massConvert",
7+
"Equalize the interface and parameters between inspectTable and inspectView",
8+
"Add new parameters to massConvert to allow logging errors and continue processing rather than stopping on error",
9+
"Add list Views to the Web UI",
10+
"Add inspectView to the Web UI",
11+
"Add link between Views and inspectView in the Web UI",
12+
"External Dependency Updates - CDS-DK to 6.5.2 and SAPUI5 to 1.110.1",
13+
"Add progress bar to the massConvert command in the terminal",
14+
"Add new fancy table output based upon terminal-kit"
15+
16+
]
17+
},
218
{
319
"date": "2023-02-14",
420
"version": "3.202302.4",

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/).
66

7+
## [3.202302.5] - 2023-02-17
8+
9+
**Changed**
10+
11+
- Complete Feature Request [Issue 100](https://github.com/SAP-samples/hana-developer-cli-tool-example/issues/100) Add Views to massConvert
12+
- Equalize the interface and parameters between inspectTable and inspectView
13+
- Add new parameters to massConvert to allow logging errors and continue processing rather than stopping on error
14+
- Add list Views to the Web UI
15+
- Add inspectView to the Web UI
16+
- Add link between Views and inspectView in the Web UI
17+
- External Dependency Updates - CDS-DK to 6.5.2 and SAPUI5 to 1.110.1
18+
- Add progress bar to the massConvert command in the terminal
19+
- Add new fancy table output based upon terminal-kit
20+
721
## [3.202302.4] - 2023-02-14
822

923
**Changed**

_i18n/messages.properties

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ created=Created
182182
errDefaultEnv=default-env.json saving problem
183183
unsupportedFormat=Unsupported Format
184184
contentWritten=Content written to
185+
logWritten=Log written to
185186
errDBX=Sorry unable to determine Database Explorer URL from your HANA hostname
186187
errGUID=Invalid Error GUID
187188
errNoResults=No Query Results
@@ -241,11 +242,15 @@ warning=Warning!
241242
cds-dk=To use the openAPI feature you must install @sap/cds-dk as a separate global module
242243
cds-dk2=To use the cds bind feature for connections, you must install @sap/cds-dk as a separate global module
243244
gui.tableType=Table Type
245+
gui.viewType=View Type
244246
gui.fields=Fields
245247
gui.constraints=Constraints
246248
gui.sql=SQL
247249
gui.tableOID=OID
248250
gui.hasPrimaryKey=Has Primary Key?
251+
gui.hasParameters=Has Parameters?
252+
gui.hasCheck=Has Structured Privilege Check?
253+
gui.hasCache=Has Cache?
249254
gui.isPreload=Is Preload?
250255
gui.unloadPriority=Unload Priority
251256
gui.created=Created At
@@ -288,4 +293,7 @@ btp.globalaccount=🗺️Global Account
288293
btp.folder=📂Folder
289294
btp.subaccount=🧾Sub Account
290295
btp.version=btp CLI version
291-
issue=Report an Issue with the hana-cli
296+
issue=Report an Issue with the hana-cli
297+
mass.log=Write progress log to file rather than stop on error
298+
mass.tblupd=Converting Tables to {0}:
299+
mass.viewupd=Converting Views to {0}:

app/appconfig/fioriSandboxConfig.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,38 @@
192192
"icon": "sap-icon://table-view",
193193
"navigationMode": "embedded"
194194
}
195+
},
196+
{
197+
"id": "views-ui",
198+
"title": "List Views",
199+
"size": "1x1",
200+
"tileType": "sap.ushell.ui.tile.StaticTile",
201+
"properties": {
202+
"info": "Get a list of all views",
203+
"title": "List Views",
204+
"additionalInformation": "SAPUI5.Component=sap.hanacli.tables",
205+
"applicationType": "URL",
206+
"targetURL": "#views-ui",
207+
"url": "./tables",
208+
"icon": "sap-icon://table-view",
209+
"navigationMode": "embedded"
210+
}
211+
},
212+
{
213+
"id": "inspectView-ui",
214+
"title": "Inspect Viw",
215+
"size": "1x1",
216+
"tileType": "sap.ushell.ui.tile.StaticTile",
217+
"properties": {
218+
"info": "Get details of a single View",
219+
"title": "Inspect View",
220+
"additionalInformation": "SAPUI5.Component=sap.hanacli.inspect",
221+
"applicationType": "URL",
222+
"targetURL": "#inspectView-ui",
223+
"url": "./inspect",
224+
"icon": "sap-icon://table-view",
225+
"navigationMode": "embedded"
226+
}
195227
}
196228
]
197229
},
@@ -492,6 +524,22 @@
492524
"url": "./inspect",
493525
"navigationMode": "embedded"
494526
},
527+
"views-ui": {
528+
"title": "List Views",
529+
"description": "Get a list of all views",
530+
"additionalInformation": "SAPUI5.Component=sap.hanacli.tables",
531+
"applicationType": "URL",
532+
"url": "./tables",
533+
"navigationMode": "embedded"
534+
},
535+
"inspectView-ui": {
536+
"title": "Inspect View",
537+
"description": "Get details of a single View",
538+
"additionalInformation": "SAPUI5.Component=sap.hanacli.inspect",
539+
"applicationType": "URL",
540+
"url": "./inspect",
541+
"navigationMode": "embedded"
542+
},
495543
"ups-ui": {
496544
"title": "List UPS service instances",
497545
"description": "List all Cloud Foundry user provided service instances in your target Space",

app/resources/common/controller/BaseController.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,35 @@ sap.ui.define([
197197
}
198198
},
199199

200+
loadViewFilter: function () {
201+
this.updatePrompts()
202+
let oController = this
203+
let aUrl = "/hana/views/"
204+
jQuery.ajax({
205+
url: aUrl,
206+
method: "GET",
207+
dataType: "json",
208+
success: function (myJSON) {
209+
oController.onLoadViewFilter(myJSON, oController)
210+
},
211+
error: function (error) {
212+
oController.onErrorCall(error, oController)
213+
}
214+
})
215+
216+
},
217+
218+
onLoadViewFilter: function (myJSON, oController) {
219+
220+
let oSearchControl = oController.getView().byId("View")
221+
oSearchControl.destroySuggestionItems()
222+
for (let i = 0; i < myJSON.length; i++) {
223+
oSearchControl.addSuggestionItem(new sap.ui.core.Item({
224+
text: myJSON[i].VIEW_NAME
225+
}))
226+
}
227+
},
228+
200229
loadFunctionFilter: function () {
201230
this.updatePrompts()
202231
let oController = this

app/resources/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
88
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
99
<title>hana-cli LaunchPad</title>
10-
<script src="https://ui5.sap.com/1.109.3/test-resources/sap/ushell/bootstrap/sandbox.js"></script>
11-
<script src="https://ui5.sap.com/1.109.3/resources/sap-ui-core.js"
10+
<script src="https://ui5.sap.com/1.110.1/test-resources/sap/ushell/bootstrap/sandbox.js"></script>
11+
<script src="https://ui5.sap.com/1.110.1/resources/sap-ui-core.js"
1212
data-sap-ui-libs="sap.m, sap.ushell, sap.collaboration, sap.ui.layout, sap.ui.rta, sap.dfa.help,sap.uxap"
1313
data-sap-ui-compatVersion="edge" data-sap-ui-theme="sap_horizon" data-sap-ui-async="true"
1414
data-sap-ui-frameOptions="trusted" data-sap-ui-bindingSyntax="complex" data-sap-ui-xx-bindingSyntax="complex"

app/resources/inspect/Component.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ sap.ui.define([
3333
let model = this.getModel("config")
3434
let cmd = UriParameters.fromQuery(window.location.search).get("cmd")
3535
let tbl = UriParameters.fromQuery(window.location.search).get("tbl")
36+
let viewInput = UriParameters.fromQuery(window.location.search).get("viewInput")
3637

3738
if (!cmd) {
3839
cmd = window.location.hash.substr(1)
3940
}
40-
model.setData({cmd: cmd, tbl: tbl})
41+
model.setData({cmd: cmd, tbl: tbl, viewInput: viewInput})
4142
this.superInit()
4243
}
4344

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/* eslint-disable no-undef */
2+
/*eslint-env es6 */
3+
"use strict";
4+
sap.ui.define([
5+
"sap/hanacli/inspect/controller/App.controller",
6+
"sap/m/Text",
7+
"sap/ui/table/Column"
8+
],
9+
function (AppController, Text, Column) {
10+
11+
return AppController.extend("sap.hanacli.inspect.controller.inspectView-ui", {
12+
13+
onInit: function () {
14+
15+
this.onAppInit()
16+
this.setFilterAsContains("Schema")
17+
this.setFilterAsContains("View")
18+
let viewInput = this.getModel("config").getProperty("/viewInput")
19+
if(viewInput){
20+
this.getModel("promptsModel").setProperty("/view", viewInput)
21+
}
22+
//let editor = this.getView().byId("aCodeEditor")
23+
// editor.session.setMode("/ace/hanasql1")
24+
this.executeCmd()
25+
26+
},
27+
28+
executeCmd: async function () {
29+
this.startBusy()
30+
this.updatePrompts().then(() => {
31+
let aUrl = `/hana/${this.getModel("config").getProperty("/cmd")}/`
32+
let oController = this
33+
jQuery.ajax({
34+
url: aUrl,
35+
method: "GET",
36+
dataType: "json",
37+
success: function (myJSON) {
38+
oController.endBusy(oController)
39+
let model = oController.getModel("resultsModel")
40+
let fieldsMetaData = []
41+
if (myJSON.fields[0]) {
42+
for (const key of Object.keys(myJSON.fields[0])) {
43+
fieldsMetaData.push({ property: key })
44+
}
45+
}
46+
47+
let data = { rows: myJSON, fieldsColumns: fieldsMetaData}
48+
model.setData(data)
49+
50+
let oTable = oController.getView().byId("fieldsTable")
51+
52+
oTable.bindColumns('resultsModel>/fieldsColumns', function (sId, oContext) {
53+
var sColumnId = oContext.getObject().property
54+
55+
return new Column({
56+
//id: sColumnId,
57+
label: sColumnId,
58+
template: new Text({ "text": { path: "resultsModel>" + sColumnId } }),
59+
sortProperty: sColumnId,
60+
filterProperty: sColumnId
61+
})
62+
})
63+
},
64+
error: function (error) {
65+
oController.onErrorCall(error, oController)
66+
}
67+
})
68+
})
69+
}
70+
})
71+
}
72+
)
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<mvc:View controllerName="sap.hanacli.inspect.controller.inspectView-ui" height="100%" width="100%"
2+
xmlns:l="sap.ui.layout"
3+
xmlns:f="sap.ui.layout.form"
4+
xmlns:mvc="sap.ui.core.mvc"
5+
xmlns:core="sap.ui.core"
6+
xmlns:table="sap.ui.table"
7+
xmlns:ce="sap.ui.codeeditor"
8+
xmlns="sap.m">
9+
<ScrollContainer height="100%" width="100%" vertical="true" focusable="true">
10+
<f:SimpleForm id="SimpleFormToolbar" editable="true" layout="ResponsiveGridLayout" adjustLabelSpan="true" singleContainerFullSize="false" ariaLabelledBy="Title1">
11+
<f:toolbar>
12+
<core:Fragment fragmentName="sap.hanacli.tables.view.reuse.toolbar" type="XML"/>
13+
</f:toolbar>
14+
<f:content>
15+
16+
<Toolbar ariaLabelledBy="Title2">
17+
<Title id="Title2" text="{i18nReuse>gui.target}"/>
18+
<ToolbarSpacer />
19+
<Button icon="sap-icon://settings" tooltip="{i18nReuse>gui.targetDetails}" press=".openUrl('/ui/#systeminfo-ui', true)" />
20+
</Toolbar>
21+
22+
<core:Fragment fragmentName="sap.hanacli.tables.view.reuse.schema" type="XML"/>
23+
24+
<Label text="{i18nReuse>view}" required="true"/>
25+
<Input id="View" value="{/view}" showSuggestion="true" suggest="loadViewFilter">
26+
</Input>
27+
28+
<core:Fragment fragmentName="sap.hanacli.common.view.Connection" type="XML"/>
29+
<core:Fragment fragmentName="sap.hanacli.common.view.Debug" type="XML"/>
30+
31+
</f:content>
32+
</f:SimpleForm>
33+
34+
<IconTabBar id="idIconTabBarNoIcons" expanded="{device>/isNoPhone}" class="sapUiResponsiveContentPadding">
35+
<items>
36+
<IconTabFilter text="Basic Info" key="info">
37+
<f:SimpleForm id="infoForm" editable="false" layout="ResponsiveGridLayout" adjustLabelSpan="true" singleContainerFullSize="false" ariaLabelledBy="Title1">
38+
<f:content>
39+
<Label text="{i18nReuse>scheam}" />
40+
<Input value="{resultsModel>/rows/basic/SCHEMA_NAME}" editable="false" />
41+
42+
<Label text="{i18nReuse>view}" />
43+
<Input value="{resultsModel>/rows/basic/VIEW_NAME}" editable="false" />
44+
45+
<Label text="{i18nReuse>gui.viewType}" />
46+
<Input value="{resultsModel>/rows/basic/VIEW_TYPE}" editable="false" />
47+
48+
<Label text="{i18nReuse>gui.tableOID}" />
49+
<Input value="{resultsModel>/rows/basic/VIEW_OID}" editable="false" />
50+
51+
<Label text="{i18nReuse>gui.hasParameters}" />
52+
<Input value="{resultsModel>/rows/basic/HAS_PARAMETERS}" editable="false" />
53+
54+
<Label text="{i18nReuse>gui.hasCheck}" />
55+
<Input value="{resultsModel>/rows/basic/HAS_STRUCTURED_PRIVILEGE_CHECK}" editable="false" />
56+
57+
<Label text="{i18nReuse>gui.hasCache}" />
58+
<Input value="{resultsModel>/rows/basic/HAS_CACHE}" editable="false" />
59+
60+
<Label text="{i18nReuse>gui.created}" />
61+
<Input value="{resultsModel>/rows/basic/CREATE_TIME}" editable="false" />
62+
63+
64+
</f:content>
65+
</f:SimpleForm>
66+
67+
</IconTabFilter>
68+
<IconTabFilter text="{i18nReuse>gui.fields}" key="fields">
69+
<table:Table id="fieldsTable" selectionMode="MultiToggle" visibleRowCount="10" enableSelectAll="false" rows="{resultsModel>/rows/fields}" threshold="15" enableBusyIndicator="true">
70+
<table:noData>
71+
<BusyIndicator class="sapUiMediumMargin"/>
72+
</table:noData>
73+
</table:Table>
74+
</IconTabFilter>
75+
76+
<IconTabFilter text="{i18nReuse>gui.sql}" key="sql">
77+
<ce:CodeEditor id="aCodeEditorSQL" type="sql" value="{resultsModel>/rows/sql}" editable="false" height="auto" maxLines="25" />
78+
</IconTabFilter>
79+
80+
<IconTabFilter text="{i18nReuse>gui.cds}" key="cds">
81+
<ce:CodeEditor id="aCodeEditorCDS" type="javascript" value="{resultsModel>/rows/cds}" syntaxHints="false" editable="false" height="auto" maxLines="25" />
82+
</IconTabFilter>
83+
84+
<IconTabFilter text="{i18nReuse>gui.hdbtable}" key="hdbtable">
85+
<ce:CodeEditor id="aCodeEditorHDBTable" type="sql" value="{resultsModel>/rows/hdbtable}" editable="false" height="auto" maxLines="25" />
86+
87+
</IconTabFilter>
88+
</items>
89+
</IconTabBar>
90+
91+
</ScrollContainer>
92+
</mvc:View>

app/resources/massConvert/controller/App.controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ sap.ui.define([
2626

2727
this.setFilterAsContains("Schema")
2828
this.setFilterAsContains("Table")
29+
this.setFilterAsContains("View")
2930

3031
// webSocket connection opened
3132
connection.attachOpen(() => {

0 commit comments

Comments
 (0)