Skip to content

Commit 30ca3e0

Browse files
auto bsp update
1 parent dc9bc9e commit 30ca3e0

21 files changed

+2659
-101
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_SMIM" serializer_version="v1.0.0">
3+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
4+
<asx:values>
5+
<URL>/SAP/BC/BSP/SAP/Z2UI5</URL>
6+
<FOLDER>X</FOLDER>
7+
</asx:values>
8+
</asx:abap>
9+
</abapGit>

src/02/package.devc.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
44
<asx:values>
55
<DEVC>
6-
<CTEXT>abap2UI5 - app</CTEXT>
6+
<CTEXT>abap2UI5</CTEXT>
77
</DEVC>
88
</asx:values>
99
</asx:abap>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_SICF" serializer_version="v1.0.0">
3+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
4+
<asx:values>
5+
<URL>/sap/bc/ui5_ui5/sap/z2ui5/</URL>
6+
<ICFSERVICE>
7+
<ICF_NAME>Z2UI5</ICF_NAME>
8+
<ORIG_NAME>z2ui5</ORIG_NAME>
9+
</ICFSERVICE>
10+
<ICFDOCU>
11+
<ICF_NAME>Z2UI5</ICF_NAME>
12+
<ICF_LANGU>E</ICF_LANGU>
13+
<ICF_DOCU>test</ICF_DOCU>
14+
</ICFDOCU>
15+
</asx:values>
16+
</asx:abap>
17+
</abapGit>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_SICF" serializer_version="v1.0.0">
3+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
4+
<asx:values>
5+
<URL>/sap/bc/bsp/sap/z2ui5/</URL>
6+
<ICFSERVICE>
7+
<ICF_NAME>Z2UI5</ICF_NAME>
8+
<ORIG_NAME>z2ui5</ORIG_NAME>
9+
</ICFSERVICE>
10+
<ICFDOCU>
11+
<ICF_NAME>Z2UI5</ICF_NAME>
12+
<ICF_LANGU>E</ICF_LANGU>
13+
<ICF_DOCU>test</ICF_DOCU>
14+
</ICFDOCU>
15+
</asx:values>
16+
</asx:abap>
17+
</abapGit>
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<core:FragmentDefinition
2+
xmlns="sap.m"
3+
xmlns:mvc="sap.ui.core.mvc"
4+
xmlns:core="sap.ui.core"
5+
xmlns:html="http://www.w3.org/1999/xhtml"
6+
xmlns:ce="sap.ui.codeeditor"
7+
>
8+
<Dialog
9+
title="abap2UI5 - DebugTool"
10+
stretch="true"
11+
>
12+
<IconTabHeader
13+
selectedKey="PLAIN"
14+
select="onItemSelect"
15+
>
16+
<items>
17+
<IconTabFilter
18+
text="Config"
19+
key="CONFIG"
20+
enabled="true"
21+
/>
22+
<IconTabFilter
23+
text="Previous Request"
24+
key="REQUEST"
25+
enabled="true"
26+
/>
27+
<IconTabFilter
28+
text="Response"
29+
key="PLAIN"
30+
/>
31+
<IconTabFilter
32+
text="Source Code"
33+
key="SOURCE"
34+
/>
35+
<IconTabFilter
36+
text="View"
37+
key="VIEW"
38+
/>
39+
<IconTabFilter
40+
text="View Model"
41+
key="MODEL"
42+
/>
43+
<IconTabFilter
44+
text="Popup"
45+
key="POPUP"
46+
enabled="{/activePopup}"
47+
/>
48+
<IconTabFilter
49+
text="Popup Model"
50+
key="POPUP_MODEL"
51+
enabled="{/activePopup}"
52+
/>
53+
<IconTabFilter
54+
text="Popover"
55+
key="POPOVER"
56+
enabled="{/activePopover}"
57+
/>
58+
<IconTabFilter
59+
text="Popover Model"
60+
key="POPOVER_MODEL"
61+
enabled="{/activePopover}"
62+
/>
63+
<IconTabFilter
64+
text="Nest1"
65+
key="NEST1"
66+
enabled="{/activeNest1}"
67+
/>
68+
<IconTabFilter
69+
text="Nest1 Model"
70+
key="NEST1_MODEL"
71+
enabled="{/activeNest1}"
72+
/>
73+
<IconTabFilter
74+
text="Nest2"
75+
key="NEST2"
76+
enabled="{/activeNest2}"
77+
/>
78+
<IconTabFilter
79+
text="Nest2 Model"
80+
key="NEST2_MODEL"
81+
enabled="{/activeNest2}"
82+
/>
83+
</items>
84+
</IconTabHeader>
85+
<VBox>
86+
<ToggleButton text="Source XML after Templating" visible="{/isTemplating}" pressed="{/templatingSource}" press="onTemplatingPress" />
87+
<ce:CodeEditor
88+
type="{/type}"
89+
value="{/value}"
90+
height="2000px"
91+
width="10000px"
92+
visible="{/editor_visible}"
93+
/></VBox>
94+
<VBox visible="{/source_visible}">
95+
<core:HTML/>
96+
</VBox>
97+
<endButton>
98+
<Button
99+
text="Close"
100+
press="onClose"
101+
/>
102+
</endButton>
103+
</Dialog>
104+
</core:FragmentDefinition>

src/02/z2ui5.wapa.cc_-debugtool.js

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
sap.ui.define(["sap/ui/core/Control", "sap/ui/core/Fragment", "sap/ui/model/json/JSONModel"], (Control, Fragment, JSONModel) => {
2+
"use strict";
3+
4+
return Control.extend("z2ui5.cc.DebugTool", {
5+
6+
//printer XML
7+
prettifyXml: function (sourceXml) {
8+
const xmlDoc = new DOMParser().parseFromString(sourceXml, 'application/xml');
9+
var sParse = `&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
10+
&lt;xsl:strip-space elements="*" /&gt;
11+
&lt;xsl:template match="para[content-style][not(text())]"&gt;
12+
&lt;xsl:value-of select="normalize-space(.)" /&gt;
13+
&lt;/xsl:template&gt;
14+
&lt;xsl:template match="node()|@*"&gt;
15+
&lt;xsl:copy&gt;
16+
&lt;xsl:apply-templates select="node()|@*" /&gt;
17+
&lt;/xsl:copy&gt;
18+
&lt;/xsl:template&gt;
19+
&lt;xsl:output indent="yes" /&gt;
20+
&lt;/xsl:stylesheet&gt;`;
21+
sParse = sParse.replace(/&gt;/g, unescape("%3E")).replace(/&lt;/g, unescape("%3C"));
22+
const xsltDoc = new DOMParser().parseFromString(sParse, 'application/xml');
23+
24+
const xsltProcessor = new XSLTProcessor();
25+
xsltProcessor.importStylesheet(xsltDoc);
26+
const resultDoc = xsltProcessor.transformToDocument(xmlDoc);
27+
const resultXml = new XMLSerializer().serializeToString(resultDoc);
28+
return resultXml.replace(/&gt;/g, ">").replace(/&lt;/g, "<");
29+
}, onItemSelect: function (oEvent) {
30+
const selItem = oEvent.getSource().getSelectedKey();
31+
const oView = z2ui5?.oView;
32+
const oResponse = z2ui5?.oResponse;
33+
const displayEditor = this.displayEditor.bind(this);
34+
35+
switch (selItem) {
36+
case 'CONFIG':
37+
displayEditor(oEvent, JSON.stringify(z2ui5.oConfig, null, 3), 'json');
38+
break;
39+
case 'MODEL':
40+
displayEditor(oEvent, JSON.stringify(oView?.getModel()?.getData(), null, 3), 'json');
41+
break;
42+
case 'VIEW':
43+
const viewContent = oView?.mProperties?.viewContent || z2ui5.responseData.S_FRONT.PARAMS.S_VIEW.XML;
44+
displayEditor(oEvent, this.prettifyXml(viewContent), 'xml', this.prettifyXml(oView?._xContent.outerHTML));
45+
break;
46+
case 'PLAIN':
47+
displayEditor(oEvent, JSON.stringify(z2ui5.responseData, null, 3), 'json');
48+
break;
49+
case 'REQUEST':
50+
displayEditor(oEvent, JSON.stringify(z2ui5.oBody, null, 3), 'json');
51+
break;
52+
case 'POPUP':
53+
displayEditor(oEvent, this.prettifyXml(oResponse?.PARAMS?.S_POPUP?.XML), 'xml');
54+
break;
55+
case 'POPUP_MODEL':
56+
displayEditor(oEvent, JSON.stringify(z2ui5.oViewPopup.getModel().getData(), null, 3), 'json');
57+
break;
58+
case 'POPOVER':
59+
displayEditor(oEvent, this.prettifyXml(oResponse?.PARAMS?.S_POPOVER?.XML), 'xml');
60+
break;
61+
case 'POPOVER_MODEL':
62+
displayEditor(oEvent, JSON.stringify(z2ui5?.oViewPopover?.getModel()?.getData(), null, 3), 'json');
63+
break;
64+
case 'NEST1':
65+
displayEditor(oEvent, this.prettifyXml(z2ui5?.oViewNest?.mProperties?.viewContent), 'xml', this.prettifyXml(z2ui5?.oViewNest?._xContent.outerHTML));
66+
break;
67+
case 'NEST1_MODEL':
68+
displayEditor(oEvent, JSON.stringify(z2ui5?.oViewNest?.getModel()?.getData(), null, 3), 'json');
69+
break;
70+
case 'NEST2':
71+
displayEditor(oEvent, this.prettifyXml(z2ui5?.oViewNest2?.mProperties?.viewContent), 'xml', this.prettifyXml(z2ui5?.oViewNest2?._xContent.outerHTML));
72+
break;
73+
case 'NEST2_MODEL':
74+
displayEditor(oEvent, JSON.stringify(z2ui5?.oViewNest2?.getModel()?.getData(), null, 3), 'json');
75+
break;
76+
case 'SOURCE':
77+
const parent = oEvent.getSource().getParent();
78+
const contentControl = parent.getContent()[2].getItems()[0];
79+
const url = `${window.location.origin}/sap/bc/adt/oo/classes/${z2ui5.responseData.S_FRONT.APP}/source/main`;
80+
const content = atob('PGlmcmFtZSBpZD0idGVzdCIgc3JjPSInICsgdXJsICsgJyIgaGVpZ2h0PSI4MDBweCIgd2lkdGg9IjEyMDBweCIgLz4=').replace("' + url + '", url);
81+
contentControl.setProperty("content", content);
82+
const modelData = oEvent.getSource().getModel().oData;
83+
modelData.editor_visible = false;
84+
modelData.source_visible = true;
85+
oEvent.getSource().getModel().refresh();
86+
break;
87+
}
88+
},
89+
90+
displayEditor: function (oEvent, content, type, xcontent = "") {
91+
const modelData = oEvent.getSource().getModel().oData;
92+
modelData.editor_visible = true;
93+
modelData.source_visible = false;
94+
modelData.isTemplating = content.includes("xmlns:template");
95+
modelData.value = content;
96+
modelData.previousValue = content;
97+
modelData.xContent = xcontent;
98+
modelData.type = type;
99+
oEvent.getSource().getModel().refresh();
100+
},
101+
102+
onTemplatingPress: function (oEvent) {
103+
const modelData = oEvent.getSource().getModel().oData;
104+
modelData.value = oEvent.getSource().getPressed() ? modelData.xContent : modelData.previousValue;
105+
oEvent.getSource().getModel().refresh();
106+
},
107+
108+
onClose: function () {
109+
this.close();
110+
},
111+
112+
async show() {
113+
if (!this.oDialog) {
114+
this.oDialog = await Fragment.load({
115+
name: "z2ui5.cc.DebugTool",
116+
controller: this,
117+
});
118+
}
119+
120+
const value = JSON.stringify(z2ui5.responseData, null, 3);
121+
const oData = {
122+
type: 'json',
123+
source_visible: false,
124+
editor_visible: true,
125+
value: value,
126+
xContent: '',
127+
previousValue: value,
128+
isTemplating: false,
129+
templatingSource: false,
130+
activeNest1: z2ui5?.oViewNest?.mProperties?.viewContent !== undefined,
131+
activeNest2: z2ui5?.oViewNest2?.mProperties?.viewContent !== undefined,
132+
activePopup: z2ui5?.oResponse?.PARAMS?.S_POPUP?.XML !== undefined,
133+
activePopover: z2ui5?.oResponse?.PARAMS?.S_POPOVER?.XML !== undefined,
134+
};
135+
const oModel = new JSONModel(oData);
136+
137+
this.oDialog.addStyleClass('dbg-ltr');
138+
this.oDialog.setModel(oModel);
139+
this.oDialog.open();
140+
},
141+
142+
async close(){
143+
if (this.oDialog){
144+
this.oDialog.close();
145+
this.oDialog.destroy();
146+
this.oDialog = null;
147+
}
148+
},
149+
150+
async toggle(){
151+
if (this.oDialog){
152+
this.close()
153+
} else {
154+
this.show()
155+
}
156+
},
157+
158+
renderer(){
159+
}
160+
});
161+
});

0 commit comments

Comments
 (0)