From c750aed454c99a5cd33bd14c42fbe5f073392772 Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Fri, 6 Oct 2017 19:12:10 +0530 Subject: [PATCH 1/6] Added application management apis. --- .../publisher/src/api/applicationMgtApi.js | 13 ++++++++--- .../publisher/src/common/constants.js | 23 +++++++++++++------ 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/api/applicationMgtApi.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/api/applicationMgtApi.js index 8787f4190a..fa92d21c0d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/api/applicationMgtApi.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/api/applicationMgtApi.js @@ -61,8 +61,12 @@ export default class ApplicationMgtApi { /** * Method to handle application release process. * */ - static releaseApplication(appId) { - + static releaseApplication(appId, applicationRelease, file) { + let release = new FormData(); + release.append('applicationRelease', applicationRelease); + release.append('binaryFile', file); + const headers = AuthHandler.createAuthenticationHeaders("multipart/form-data"); + return Axios.post(Constants.appManagerEndpoints.APP_RELEASE + appId, release, {headers: headers}); } /** @@ -73,7 +77,8 @@ export default class ApplicationMgtApi { * URL Pattern : /application/1.0/ * */ static updateLifeCycleState(appId, nextState) { - + const headers = AuthHandler.createAuthenticationHeaders("application/json"); + return Axios.put(Constants.appManagerEndpoints.GET_ALL_APPS + appId + "/lifecycle?state=" + nextState, {headers: headers}); } /** @@ -81,6 +86,8 @@ export default class ApplicationMgtApi { * @param appId: The application uuid. */ static getNextLifeCycleState(appId) { + const headers = AuthHandler.createAuthenticationHeaders("application/json"); + return Axios.get(Constants.appManagerEndpoints.GET_ALL_APPS + appId + "/lifecycle", {headers: headers}); } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/common/constants.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/common/constants.js index 27091a166c..d458ada599 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/common/constants.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/common/constants.js @@ -32,20 +32,29 @@ class Constants { } load() { + let applicationApiContext = '/api/application-mgt/v1.0/applications/1.0.0/'; + let platformApiContext = '/api/application-mgt/v1.0/platforms/1.0.0'; + let apiBaseUrl = 'https://' + Configuration.serverConfig.hostname + ':' + Configuration.serverConfig.apiPort; let httpBaseUrl = 'https://' + Configuration.serverConfig.hostname + ':' + Configuration.serverConfig.httpsPort; this.appManagerEndpoints = { - GET_ALL_APPS: apiBaseUrl + '/api/application-mgt/v1.0/applications/1.0.0/', - CREATE_APP: apiBaseUrl + '/api/application-mgt/v1.0/applications/1.0.0/', - UPLOAD_IMAGE_ARTIFACTS: apiBaseUrl + '/api/application-mgt/v1.0/applications/1.0.0/upload-image-artifacts/', //+appId - GET_IMAGE_ARTIFACTS: apiBaseUrl + '/api/application-mgt/v1.0/applications/1.0.0/image-artifacts/' + GET_ALL_APPS: apiBaseUrl + applicationApiContext, + CREATE_APP: apiBaseUrl + applicationApiContext, + UPLOAD_IMAGE_ARTIFACTS: apiBaseUrl + applicationApiContext + 'upload-image-artifacts/', //+appId + GET_IMAGE_ARTIFACTS: apiBaseUrl + applicationApiContext + 'image-artifacts/', + APP_RELEASE: apiBaseUrl + applicationApiContext + "release/", //+uuid + GET_APP_RELEASE_ARTIFACTS: apiBaseUrl + applicationApiContext + "/release-artifacts/", //+AppId/version + GET_NEXT_LIFECYCLE_STATE: apiBaseUrl + applicationApiContext //+ [uuid]/lifecycle }; this.platformManagerEndpoints = { - CREATE_PLATFORM: apiBaseUrl + '/api/application-mgt/v1.0/platforms/1.0.0', - GET_ENABLED_PLATFORMS: apiBaseUrl + '/api/application-mgt/v1.0/platforms/1.0.0?status=ENABLED', - GET_PLATFORM: apiBaseUrl + '/api/application-mgt/v1.0/platforms/1.0.0/' + CREATE_PLATFORM: apiBaseUrl + platformApiContext, + GET_ENABLED_PLATFORMS: apiBaseUrl + platformApiContext + '?status=ENABLED', + GET_PLATFORM: apiBaseUrl + platformApiContext, //+platformId + GET_PLATFORMS: apiBaseUrl + platformApiContext, + UPDATE_STATUS: apiBaseUrl + platformApiContext + "update-status/", // + platformId + ?status= + EDIT_PLATFORM: apiBaseUrl + platformApiContext //+platformId }; this.userConstants = { From 34b35158fb27c1852ffe4dade00757c4d3d391d3 Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Fri, 6 Oct 2017 19:12:48 +0530 Subject: [PATCH 2/6] Added i18n definition. --- .../src/components/Application/Create/CreateSteps/Step1.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step1.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step1.jsx index 447c32780e..bd7de1e981 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step1.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step1.jsx @@ -254,7 +254,7 @@ class Step1 extends Component { Date: Fri, 6 Oct 2017 19:13:33 +0530 Subject: [PATCH 3/6] Modified application edit url pattern. --- .../src/main/resources/publisher/src/App.jsx | 2 +- .../publisher/src/components/Application/ApplicationListing.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/App.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/App.jsx index 3128bc9d23..4a3d606eff 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/App.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/App.jsx @@ -78,7 +78,7 @@ class Base extends Component { {/**/} - + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.jsx index 6ce6d1ad78..fbd74aefa3 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.jsx @@ -194,7 +194,7 @@ class ApplicationListing extends Component { } onAppEditClick(uuid) { - this.props.history.push("apps/edit/" + uuid); + this.props.history.push("apps/" + uuid + "/edit"); } closeDrawer() { From ba5c7eb66b7965a5c195567f2dba97cef8e1681e Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Fri, 6 Oct 2017 19:14:09 +0530 Subject: [PATCH 4/6] Added button styling in platform cards. --- .../publisher/src/components/Platform/Platform.jsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/Platform.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/Platform.jsx index 44479434ae..ad40ff2094 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/Platform.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/Platform.jsx @@ -58,11 +58,15 @@ class Platform extends Component {
- - : + } + + : } -