diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.js index d81c32a7905..29e51ae5127 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.js @@ -18,13 +18,151 @@ import React, {Component} from 'react'; import {withRouter} from 'react-router-dom'; - +import TextField from 'material-ui/TextField'; +import DataTable from '../UIComponents/DataTable'; +import {Card, CardActions, CardTitle} from 'material-ui/Card'; /** - * Application List Component. + * The App Create Component. + * + * Application creation is handled through a Wizard. (We use Material UI Stepper.) + * + * In each step, data will be set to the state separately. + * When the wizard is completed, data will be arranged and sent to the api. * */ -class ApplicationListing extends Component{ +class ApplicationListing extends Component { + constructor() { + super(); + this.state = { + data: [], + asc: true + } + } + + // data = [ + // { + // id: Math.random(), + // applicationName:"Cne", + // platform:'Android', + // category:"Public", + // status: "Created" + // }, + // { + // id: Math.random(), + // applicationName:"Gone", + // platform:'IOS', + // category:"Public", + // status: "Created" + // }, + // { + // id: Math.random(), + // applicationName:"Ane", + // platform:'Android', + // category:"Public", + // status: "Created" + // }, + // { + // id: Math.random(), + // applicationName:"one", + // platform:'Android', + // category:"Public", + // status: "Created" + // }, + // { + // id: Math.random(), + // applicationName:"one", + // platform:'Android', + // category:"Public", + // status: "Created" + // }, + // ]; + + headers = [ + { + data_id: "image", + data_type: "image", + sortable: false, + label: ""}, + { + data_id: "applicationName", + data_type: "string", + sortable: true, + label: "Application Name", + sort: this._sortData.bind(this) + }, + { + data_id: "platform", + data_type: "image_array", + sortable: false, + label: "Platform"}, + { + data_id: "category", + data_type: "string", + sortable: false, + label: "Category" + }, + { + data_id: "status", + data_type: "string", + sortable: false, + label: "Status" + } + ]; + + componentWillMount() { + //Fetch all the applications from backend and create application objects. + } + + /** + * Handles the search action. + * When typing in the search bar, this method will be invoked. + * */ + _searchApplications(word) { + let searchedData = []; + } + /** + * Handles sort data function and toggles the asc state. + * asc: true : sort in ascending order. + * */ + _sortData() { + let isAsc = this.state.asc; + let datas = isAsc?this.data.sort(this._compare):this.data.reverse(); + this.setState({data: datas, asc: !isAsc}); + } + + _compare(a, b) { + if (a.applicationName < b.applicationName) + return -1; + if (a.applicationName > b.applicationName) + return 1; + return 0; + } + + _onRowClick(id) { + console.log(id) + } + + render() { + return ( +