Skip to content

Commit

Permalink
Merge pull request #103 from SAP-samples/massConvert_views
Browse files Browse the repository at this point in the history
Mass convert views and UI upgrades
  • Loading branch information
jung-thomas authored Feb 17, 2023
2 parents 00177e7 + ddf9889 commit fcd4f53
Show file tree
Hide file tree
Showing 69 changed files with 2,156 additions and 1,198 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
[
{
"date": "2023-02-17",
"version": "3.202302.5",
"Changed": [
"Complete Feature Request [Issue 100](https://github.com/SAP-samples/hana-developer-cli-tool-example/issues/100) Add Views to massConvert",
"Equalize the interface and parameters between inspectTable and inspectView",
"Add new parameters to massConvert to allow logging errors and continue processing rather than stopping on error",
"Add list Views to the Web UI",
"Add inspectView to the Web UI",
"Add link between Views and inspectView in the Web UI",
"External Dependency Updates - CDS-DK to 6.5.2 and SAPUI5 to 1.110.1",
"Add progress bar to the massConvert command in the terminal",
"Add new fancy table output based upon terminal-kit"

]
},
{
"date": "2023-02-14",
"version": "3.202302.4",
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.

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

## [3.202302.5] - 2023-02-17

**Changed**

- Complete Feature Request [Issue 100](https://github.com/SAP-samples/hana-developer-cli-tool-example/issues/100) Add Views to massConvert
- Equalize the interface and parameters between inspectTable and inspectView
- Add new parameters to massConvert to allow logging errors and continue processing rather than stopping on error
- Add list Views to the Web UI
- Add inspectView to the Web UI
- Add link between Views and inspectView in the Web UI
- External Dependency Updates - CDS-DK to 6.5.2 and SAPUI5 to 1.110.1
- Add progress bar to the massConvert command in the terminal
- Add new fancy table output based upon terminal-kit

## [3.202302.4] - 2023-02-14

**Changed**
Expand Down
10 changes: 9 additions & 1 deletion _i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ created=Created
errDefaultEnv=default-env.json saving problem
unsupportedFormat=Unsupported Format
contentWritten=Content written to
logWritten=Log written to
errDBX=Sorry unable to determine Database Explorer URL from your HANA hostname
errGUID=Invalid Error GUID
errNoResults=No Query Results
Expand Down Expand Up @@ -241,11 +242,15 @@ warning=Warning!
cds-dk=To use the openAPI feature you must install @sap/cds-dk as a separate global module
cds-dk2=To use the cds bind feature for connections, you must install @sap/cds-dk as a separate global module
gui.tableType=Table Type
gui.viewType=View Type
gui.fields=Fields
gui.constraints=Constraints
gui.sql=SQL
gui.tableOID=OID
gui.hasPrimaryKey=Has Primary Key?
gui.hasParameters=Has Parameters?
gui.hasCheck=Has Structured Privilege Check?
gui.hasCache=Has Cache?
gui.isPreload=Is Preload?
gui.unloadPriority=Unload Priority
gui.created=Created At
Expand Down Expand Up @@ -288,4 +293,7 @@ btp.globalaccount=🗺️Global Account
btp.folder=📂Folder
btp.subaccount=🧾Sub Account
btp.version=btp CLI version
issue=Report an Issue with the hana-cli
issue=Report an Issue with the hana-cli
mass.log=Write progress log to file rather than stop on error
mass.tblupd=Converting Tables to {0}:
mass.viewupd=Converting Views to {0}:
48 changes: 48 additions & 0 deletions app/appconfig/fioriSandboxConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,38 @@
"icon": "sap-icon://table-view",
"navigationMode": "embedded"
}
},
{
"id": "views-ui",
"title": "List Views",
"size": "1x1",
"tileType": "sap.ushell.ui.tile.StaticTile",
"properties": {
"info": "Get a list of all views",
"title": "List Views",
"additionalInformation": "SAPUI5.Component=sap.hanacli.tables",
"applicationType": "URL",
"targetURL": "#views-ui",
"url": "./tables",
"icon": "sap-icon://table-view",
"navigationMode": "embedded"
}
},
{
"id": "inspectView-ui",
"title": "Inspect Viw",
"size": "1x1",
"tileType": "sap.ushell.ui.tile.StaticTile",
"properties": {
"info": "Get details of a single View",
"title": "Inspect View",
"additionalInformation": "SAPUI5.Component=sap.hanacli.inspect",
"applicationType": "URL",
"targetURL": "#inspectView-ui",
"url": "./inspect",
"icon": "sap-icon://table-view",
"navigationMode": "embedded"
}
}
]
},
Expand Down Expand Up @@ -492,6 +524,22 @@
"url": "./inspect",
"navigationMode": "embedded"
},
"views-ui": {
"title": "List Views",
"description": "Get a list of all views",
"additionalInformation": "SAPUI5.Component=sap.hanacli.tables",
"applicationType": "URL",
"url": "./tables",
"navigationMode": "embedded"
},
"inspectView-ui": {
"title": "Inspect View",
"description": "Get details of a single View",
"additionalInformation": "SAPUI5.Component=sap.hanacli.inspect",
"applicationType": "URL",
"url": "./inspect",
"navigationMode": "embedded"
},
"ups-ui": {
"title": "List UPS service instances",
"description": "List all Cloud Foundry user provided service instances in your target Space",
Expand Down
29 changes: 29 additions & 0 deletions app/resources/common/controller/BaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,35 @@ sap.ui.define([
}
},

loadViewFilter: function () {
this.updatePrompts()
let oController = this
let aUrl = "/hana/views/"
jQuery.ajax({
url: aUrl,
method: "GET",
dataType: "json",
success: function (myJSON) {
oController.onLoadViewFilter(myJSON, oController)
},
error: function (error) {
oController.onErrorCall(error, oController)
}
})

},

onLoadViewFilter: function (myJSON, oController) {

let oSearchControl = oController.getView().byId("View")
oSearchControl.destroySuggestionItems()
for (let i = 0; i < myJSON.length; i++) {
oSearchControl.addSuggestionItem(new sap.ui.core.Item({
text: myJSON[i].VIEW_NAME
}))
}
},

loadFunctionFilter: function () {
this.updatePrompts()
let oController = this
Expand Down
4 changes: 2 additions & 2 deletions app/resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>hana-cli LaunchPad</title>
<script src="https://ui5.sap.com/1.109.3/test-resources/sap/ushell/bootstrap/sandbox.js"></script>
<script src="https://ui5.sap.com/1.109.3/resources/sap-ui-core.js"
<script src="https://ui5.sap.com/1.110.1/test-resources/sap/ushell/bootstrap/sandbox.js"></script>
<script src="https://ui5.sap.com/1.110.1/resources/sap-ui-core.js"
data-sap-ui-libs="sap.m, sap.ushell, sap.collaboration, sap.ui.layout, sap.ui.rta, sap.dfa.help,sap.uxap"
data-sap-ui-compatVersion="edge" data-sap-ui-theme="sap_horizon" data-sap-ui-async="true"
data-sap-ui-frameOptions="trusted" data-sap-ui-bindingSyntax="complex" data-sap-ui-xx-bindingSyntax="complex"
Expand Down
3 changes: 2 additions & 1 deletion app/resources/inspect/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ sap.ui.define([
let model = this.getModel("config")
let cmd = UriParameters.fromQuery(window.location.search).get("cmd")
let tbl = UriParameters.fromQuery(window.location.search).get("tbl")
let viewInput = UriParameters.fromQuery(window.location.search).get("viewInput")

if (!cmd) {
cmd = window.location.hash.substr(1)
}
model.setData({cmd: cmd, tbl: tbl})
model.setData({cmd: cmd, tbl: tbl, viewInput: viewInput})
this.superInit()
}

Expand Down
72 changes: 72 additions & 0 deletions app/resources/inspect/controller/inspectView-ui.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/* eslint-disable no-undef */
/*eslint-env es6 */
"use strict";
sap.ui.define([
"sap/hanacli/inspect/controller/App.controller",
"sap/m/Text",
"sap/ui/table/Column"
],
function (AppController, Text, Column) {

return AppController.extend("sap.hanacli.inspect.controller.inspectView-ui", {

onInit: function () {

this.onAppInit()
this.setFilterAsContains("Schema")
this.setFilterAsContains("View")
let viewInput = this.getModel("config").getProperty("/viewInput")
if(viewInput){
this.getModel("promptsModel").setProperty("/view", viewInput)
}
//let editor = this.getView().byId("aCodeEditor")
// editor.session.setMode("/ace/hanasql1")
this.executeCmd()

},

executeCmd: async function () {
this.startBusy()
this.updatePrompts().then(() => {
let aUrl = `/hana/${this.getModel("config").getProperty("/cmd")}/`
let oController = this
jQuery.ajax({
url: aUrl,
method: "GET",
dataType: "json",
success: function (myJSON) {
oController.endBusy(oController)
let model = oController.getModel("resultsModel")
let fieldsMetaData = []
if (myJSON.fields[0]) {
for (const key of Object.keys(myJSON.fields[0])) {
fieldsMetaData.push({ property: key })
}
}

let data = { rows: myJSON, fieldsColumns: fieldsMetaData}
model.setData(data)

let oTable = oController.getView().byId("fieldsTable")

oTable.bindColumns('resultsModel>/fieldsColumns', function (sId, oContext) {
var sColumnId = oContext.getObject().property

return new Column({
//id: sColumnId,
label: sColumnId,
template: new Text({ "text": { path: "resultsModel>" + sColumnId } }),
sortProperty: sColumnId,
filterProperty: sColumnId
})
})
},
error: function (error) {
oController.onErrorCall(error, oController)
}
})
})
}
})
}
)
92 changes: 92 additions & 0 deletions app/resources/inspect/view/inspectView-ui.view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<mvc:View controllerName="sap.hanacli.inspect.controller.inspectView-ui" height="100%" width="100%"
xmlns:l="sap.ui.layout"
xmlns:f="sap.ui.layout.form"
xmlns:mvc="sap.ui.core.mvc"
xmlns:core="sap.ui.core"
xmlns:table="sap.ui.table"
xmlns:ce="sap.ui.codeeditor"
xmlns="sap.m">
<ScrollContainer height="100%" width="100%" vertical="true" focusable="true">
<f:SimpleForm id="SimpleFormToolbar" editable="true" layout="ResponsiveGridLayout" adjustLabelSpan="true" singleContainerFullSize="false" ariaLabelledBy="Title1">
<f:toolbar>
<core:Fragment fragmentName="sap.hanacli.tables.view.reuse.toolbar" type="XML"/>
</f:toolbar>
<f:content>

<Toolbar ariaLabelledBy="Title2">
<Title id="Title2" text="{i18nReuse>gui.target}"/>
<ToolbarSpacer />
<Button icon="sap-icon://settings" tooltip="{i18nReuse>gui.targetDetails}" press=".openUrl('/ui/#systeminfo-ui', true)" />
</Toolbar>

<core:Fragment fragmentName="sap.hanacli.tables.view.reuse.schema" type="XML"/>

<Label text="{i18nReuse>view}" required="true"/>
<Input id="View" value="{/view}" showSuggestion="true" suggest="loadViewFilter">
</Input>

<core:Fragment fragmentName="sap.hanacli.common.view.Connection" type="XML"/>
<core:Fragment fragmentName="sap.hanacli.common.view.Debug" type="XML"/>

</f:content>
</f:SimpleForm>

<IconTabBar id="idIconTabBarNoIcons" expanded="{device>/isNoPhone}" class="sapUiResponsiveContentPadding">
<items>
<IconTabFilter text="Basic Info" key="info">
<f:SimpleForm id="infoForm" editable="false" layout="ResponsiveGridLayout" adjustLabelSpan="true" singleContainerFullSize="false" ariaLabelledBy="Title1">
<f:content>
<Label text="{i18nReuse>scheam}" />
<Input value="{resultsModel>/rows/basic/SCHEMA_NAME}" editable="false" />

<Label text="{i18nReuse>view}" />
<Input value="{resultsModel>/rows/basic/VIEW_NAME}" editable="false" />

<Label text="{i18nReuse>gui.viewType}" />
<Input value="{resultsModel>/rows/basic/VIEW_TYPE}" editable="false" />

<Label text="{i18nReuse>gui.tableOID}" />
<Input value="{resultsModel>/rows/basic/VIEW_OID}" editable="false" />

<Label text="{i18nReuse>gui.hasParameters}" />
<Input value="{resultsModel>/rows/basic/HAS_PARAMETERS}" editable="false" />

<Label text="{i18nReuse>gui.hasCheck}" />
<Input value="{resultsModel>/rows/basic/HAS_STRUCTURED_PRIVILEGE_CHECK}" editable="false" />

<Label text="{i18nReuse>gui.hasCache}" />
<Input value="{resultsModel>/rows/basic/HAS_CACHE}" editable="false" />

<Label text="{i18nReuse>gui.created}" />
<Input value="{resultsModel>/rows/basic/CREATE_TIME}" editable="false" />


</f:content>
</f:SimpleForm>

</IconTabFilter>
<IconTabFilter text="{i18nReuse>gui.fields}" key="fields">
<table:Table id="fieldsTable" selectionMode="MultiToggle" visibleRowCount="10" enableSelectAll="false" rows="{resultsModel>/rows/fields}" threshold="15" enableBusyIndicator="true">
<table:noData>
<BusyIndicator class="sapUiMediumMargin"/>
</table:noData>
</table:Table>
</IconTabFilter>

<IconTabFilter text="{i18nReuse>gui.sql}" key="sql">
<ce:CodeEditor id="aCodeEditorSQL" type="sql" value="{resultsModel>/rows/sql}" editable="false" height="auto" maxLines="25" />
</IconTabFilter>

<IconTabFilter text="{i18nReuse>gui.cds}" key="cds">
<ce:CodeEditor id="aCodeEditorCDS" type="javascript" value="{resultsModel>/rows/cds}" syntaxHints="false" editable="false" height="auto" maxLines="25" />
</IconTabFilter>

<IconTabFilter text="{i18nReuse>gui.hdbtable}" key="hdbtable">
<ce:CodeEditor id="aCodeEditorHDBTable" type="sql" value="{resultsModel>/rows/hdbtable}" editable="false" height="auto" maxLines="25" />

</IconTabFilter>
</items>
</IconTabBar>

</ScrollContainer>
</mvc:View>
1 change: 1 addition & 0 deletions app/resources/massConvert/controller/App.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ sap.ui.define([

this.setFilterAsContains("Schema")
this.setFilterAsContains("Table")
this.setFilterAsContains("View")

// webSocket connection opened
connection.attachOpen(() => {
Expand Down
Loading

0 comments on commit fcd4f53

Please sign in to comment.