Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I would like to add one login page and after the user has logged in a Master-Detail application should be loaded. I have taken this template for the Master Detail application: https://github.com/SAP/openui5-masterdetail-app. How can I achive that?

With App.xml as root view it's loading the login page but it's also telling the App that to search ID "layout", wich is not anymore in App.xml but in Main.xml

"controlId": "layout", "controlAggregation": "beginColumnPages",

I have exchanged the pages of the original template

App.xml (is now the login page):

<mvc:View controllerName="sap.ui.demo.masterdetail.controller.App"
    xmlns:html="http://www.w3.org/1999/xhtml" xmlns:smartFilterBar="sap.ui.comp.smartfilterbar"
    xmlns:smartTable="sap.ui.comp.smarttable" xmlns:mvc="sap.ui.core.mvc"
    xmlns="sap.m">
    <App id="app">
        <pages>
            <Page title="{i18n>title}">

                <content>
                    <VBox fitContainer="true" justifyContent="Center" alignItems="Center"
                        alignContent="Center">
                        <items>
                            <Label id="lblLoginUser" text="User" labelFor="inputLoginUser"/>
                            <Input id="inputLoginUser" placeholder="User ID" value="{loginBody>/email}"/>
                            <Label id="lblLoginPassword" text="Password" labelFor="inputLoginPassword"/>
                            <Input id="inputLoginPassword" placeholder="Password" type="Password" value = "{loginBody>/password}"/>                         
                            <Button width="12rem" text="Login" type="Emphasized"
                                press="onLoginTap"></Button>
                            <Link id="linkRegister" text="{i18n>register}"
                            href="{loginUI>/linkRegister}"></Link>
                            <Link id="linkResetPassword" text="{i18n>resetPassword}" visible="{loginUI>/showLinkResetPassword}" 
                            href="{loginUI>/linkResetPassword}"></Link>
                        </items>
                    </VBox>
                </content>          
            </Page>
        </pages>
    </App>
</mvc:View>

Main.xml (is the original App.xml)

<mvc:View
    controllerName="sap.ui.demo.masterdetail.controller.Main"
    displayBlock="true"
    height="100%"
    xmlns="sap.m"
    xmlns:f="sap.f"
    xmlns:mvc="sap.ui.core.mvc">
    <App
        id="main"
        busy="{appView>/busy}"
        busyIndicatorDelay="{appView>/delay}">
        <f:FlexibleColumnLayout
            id="layout"
            layout="{appView>/layout}"
            backgroundDesign="Translucent">
        </f:FlexibleColumnLayout>
    </App>
</mvc:View>

My manifest.json:

{
    "_version": "1.12.0",
    "sap.app": {
        "id": "sap.ui.demo.masterdetail",
        "type": "application",
        "i18n": "i18n/i18n.properties",
        "title": "{{appTitle}}",
        "description": "{{appDescription}}",
        "applicationVersion": {
            "version": "1.0.0"
        },
        "resources": "resources.json",
        "dataSources": {
            "mainService": {
                "uri": "/here/goes/your/serviceUrl/",
                "type": "OData",
                "settings": {
                    "odataVersion": "2.0",
                    "localUri": "localService/metadata.xml"
                }
            }
        }
    },
    "sap.ui": {
        "technology": "UI5",
        "icons": {
            "icon": "sap-icon://detail-view",
            "favIcon": "",
            "phone": "",
            "phone@2": "",
            "tablet": "",
            "tablet@2": ""
        },
        "deviceTypes": {
            "desktop": true,
            "tablet": true,
            "phone": true
        }
    },
    "sap.ui5": {
        "rootView": {
            "viewName": "sap.ui.demo.masterdetail.view.Main",
            "type": "XML",
            "async": true,
            "id": "main"
        },
        "dependencies": {
            "minUI5Version": "1.60.0",
            "libs": {
                "sap.ui.core": {
                    
                },
                "sap.m": {
                    
                },
                "sap.f": {
                    
                }
            }
        },
        "contentDensities": {
            "compact": true,
            "cozy": true
        },
        "models": {
            "i18n": {
                "type": "sap.ui.model.resource.ResourceModel",
                "settings": {
                    "bundleName": "sap.ui.demo.masterdetail.i18n.i18n"
                }
            },
            "": {
                "dataSource": "mainService",
                "preload": true
            }
        },
        "routing": {
            "config": {
                "routerClass": "sap.f.routing.Router",
                "viewType": "XML",
                "viewPath": "sap.ui.demo.masterdetail.view",
                "controlId": "layout",
                "controlAggregation": "beginColumnPages",
                "bypassed": {
                    "target": "notFound"
                },
                "async": true
            },
            "routes": [
                
                {
                    "pattern": "",
                    "name": "master",
                    "target": "master"
                },
                {
                    "pattern": "Objects/{objectId}",
                    "name": "object",
                    "target": [
                        
                        "master",
                        "object"
                    ]
                }
            ],
            "targets": {
                
                "master": {
                    "viewName": "Master",
                    "viewLevel": 1,
                    "viewId": "master"
                },
                "object": {
                    "viewName": "Detail",
                    "viewId": "detail",
                    "viewLevel": 1,
                    "controlAggregation": "midColumnPages"
                },
                "detailObjectNotFound": {
                    "viewName": "DetailObjectNotFound",
                    "viewId": "detailObjectNotFound",
                    "controlAggregation": "midColumnPages"
                },
                "notFound": {
                    "viewName": "NotFound",
                    "viewId": "notFound"
                }
            }
        }
    }
}
question from:https://stackoverflow.com/questions/65865499/ui5-routing-show-page-before-routing

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
742 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...