+1 On Fri, Jan 6, 2017 at 3:23 PM, SajithAR Ariyarathna <sajit...@wso2.com> wrote:
> Hi All, > > We are hoping to do $subject. > > *UUF Component:* > > Currently a UUF component has two configuration files, 'component.yaml' > and 'config.yaml'. 'component.yaml' contains APIs entries and bindings (see > mail thread [1] for more details); 'config.yaml' contains business-logic > related configurations e.g. page size, display name (see sample [2]). What > we are hoping to do is to combine these two files into a one, > 'component.yaml' file in order to improve the developer experience. So the > new 'component.yaml' file will look like following. > > # Classes of Microservices that implements UI specific REST APIs. > # example entry: > # - className: "org.wso2.carbon.uuf.sample.pets-store.PetsStoreMicroservice" > # uri: "/pets/" > apis: > - className: "org.wso2.carbon.uuf.sample.api.HelloService" > uri: "/hello-service/" > > # Binding fragments into zones. > # Modes: > # prepend - pushes the specified fragments into the beginning of the > existing pushed fragments of the zone > # append - pushes the specified fragments into the end of the existing > pushed fragments of the zone > # overwrite - removes the existing pushed fragments of the zone and replace > with specified fragments > # Please note that the configured order of the fragments in here, will be > honored when filling the zone > bindings: > - zoneName: "org.wso2.carbon.uuf.sample.foundation.footer" > mode: "append" > fragments: > - "org.wso2.carbon.uuf.sample.foundation.footer" > - zoneName: "org.wso2.carbon.uuf.sample.foundation.menubar" > mode: "append" > fragments: > - "org.wso2.carbon.uuf.sample.foundation.secured-menubar" > - zoneName: "org.wso2.carbon.uuf.sample.foundation.usermenu" > mode: "append" > fragments: > - "org.wso2.carbon.uuf.sample.simple-auth.usermenu" > > > > > > > > > > > *# Business logic related configurations.# In Handlebars templates, these > configurations can be access using {{@config}} variable.# e.g. > {{@config.appName}} will output "Pets Store"# In server-side JS > 'onRequest(env)' function, these configurations cab access via 'env.config' > variable.# e.g. env.config['appName'] will give "Pets Store" valueconfig: # > No of items should be displayed in a page. pageSize: 10 # User will be > redirected to following URI after logging-out successfully. > loginRedirectUri: "/pets"* > > > *UUF App:* > > Currently an UUF app has two configuration files, 'component.yaml' and > 'config.yaml'. 'component.yaml' is similar to the one we have in a > component and it contains APIs entries and bindings. In the 'config.yaml', > it has some business-logic related configurations as well as some other > configurations that affects to the whole app and consumes by the UUF Core > e.g. theme name, error page URLs (see sample [3]). What we want to do is to > separate those app related configurations from business-logic related > configurations. > > Introducing 'app.yaml' helps achieve this goal. It contains app related > configurations only. Sample 'app.yaml' will look like following. > > # Default theme for this app. > theme : "org.wso2.carbon.uuf.sample.theme.default" > > # Menus in this app. > menus : > - name: "main" > items: > - text: "Home" > link: "#" > icon: "fw-home" > - text: "Pets" > link: "" > submenus: > - text: "See all our amazing pets" > link: "/pets" > - text: "Add a new pets" > link: "/pets/new" > icon: "fw fw-add" > - text: "Pet of the month" > link: "/pets/snowball" > - text: "Order new pets" > link: "/pets/order" > > # Error pages for this app. > errorPages: > 404: "/foundation/error/404" > default: "/foundation/error/default" > > # URI of the login page in this app. > loginPageUri: "/simple-auth/login" > > # Security related configurations for this app. > security: > csrfPatterns: > accept: [] > reject: [] > xssPatterns: > accept: [] > reject: [] > responseHeaders: null > > An app can have a 'component.yaml' as well (since app is the root > component). In that 'component.yaml' webapp developer can define APIs, > bindings, and business-logic related configurations for the app. Sample > 'component.yaml' of a component will look like following. > > # Classes of Microservices that implements UI specific REST APIs. > # example entry: > # - className: "org.wso2.carbon.uuf.sample.pets-store.PetsStoreMicroservice" > # uri: "/pets/" > apis: > - className: "org.wso2.carbon.uuf.sample.api.HelloService" > uri: "/hello-service/" > > # Binding fragments into zones. > # Modes: > # prepend - pushes the specified fragments into the beginning of the > existing pushed fragments of the zone > # append - pushes the specified fragments into the end of the existing > pushed fragments of the zone > # overwrite - removes the existing pushed fragments of the zone and replace > with specified fragments > # Please note that the configured order of the fragments in here, will be > honored when filling the zone > bindings: > - zoneName: "org.wso2.carbon.uuf.sample.foundation.footer" > mode: "append" > fragments: > - "org.wso2.carbon.uuf.sample.foundation.footer" > - zoneName: "org.wso2.carbon.uuf.sample.foundation.menubar" > mode: "append" > fragments: > - "org.wso2.carbon.uuf.sample.foundation.secured-menubar" > - zoneName: "org.wso2.carbon.uuf.sample.foundation.usermenu" > mode: "append" > fragments: > - "org.wso2.carbon.uuf.sample.simple-auth.usermenu" > > > > > > > > > > > > *# Business logic related configurations.# In Handlebars templates, these > configurations can be access using {{@config}} variable.# e.g. > {{@config.appName}} will output "Pets Store"# In server-side JS > 'onRequest(env)' function, these configurations cab access via 'env.config' > variable.# e.g. env.config['appName'] will give "Pets Store" valueconfig: > appName: "Pet Store" # Overrrding 'pageSize' configuration from a dependency > component. pageSize: 10 # Overriding 'loginRedirectUri' configuration from > 'simple-auth' component. loginRedirectUri: "/pets"* > > > So in summery, a component has a 'component.yaml' and an app has an > 'app.yaml' and a 'component.yaml'. WDYT? > > [1] [UUF] Changing 'bindings.yaml' to 'component.yaml' in an UUF Component > [2] https://github.com/wso2/carbon-uuf/blob/v1.0.0-m8/ > samples/components/org.wso2.carbon.uuf.sample.foundation/ > src/main/config.yaml > [3] https://github.com/wso2/carbon-uuf/blob/v1.0.0-m8/ > samples/apps/org.wso2.carbon.uuf.sample.pets-store/src/main/config.yaml > > Thanks. > -- > Sajith Janaprasad Ariyarathna > Software Engineer; WSO2, Inc.; http://wso2.com/ > <https://wso2.com/signature> > -- Regards, UdaraR
_______________________________________________ Architecture mailing list Architecture@wso2.org https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture