|
|
|
@ -16,32 +16,53 @@
|
|
|
|
|
* under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
import axios from 'axios';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: Replace the server address with response from auth endpoint and remove hardcoded ids etc.
|
|
|
|
|
export default class Constants {
|
|
|
|
|
class Constants {
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
this.contentTypeHeaderName = 'Content-Type';
|
|
|
|
|
this.contentType = 'application/json';
|
|
|
|
|
this.https = 'https://';
|
|
|
|
|
console.log('server config called');
|
|
|
|
|
this.serverConfig = {};
|
|
|
|
|
this.getServerConfig();
|
|
|
|
|
|
|
|
|
|
static scopes = 'perm:application:get perm:application:create perm:application:update perm:application-mgt:login' +
|
|
|
|
|
this.scopes = 'perm:application:get perm:application:create perm:application:update perm:application-mgt:login' +
|
|
|
|
|
' perm:application:delete perm:platform:add perm:platform:remove perm:roles:view perm:devices:view';
|
|
|
|
|
|
|
|
|
|
static appManagerEndpoints = {
|
|
|
|
|
GET_ALL_APPS: 'https://localhost:8243/api/application-mgt/v1.0/applications/1.0.0/',
|
|
|
|
|
this.appManagerEndpoints = {
|
|
|
|
|
GET_ALL_APPS: this.https + this.serverConfig.hostname + ':' + this.serverConfig.httpsPort + '/api/application-mgt/v1.0/applications/1.0.0/',
|
|
|
|
|
CREATE_APP: 'https://localhost:8243/api/application-mgt/v1.0/applications/1.0.0/',
|
|
|
|
|
UPLOAD_IMAGE_ARTIFACTS: 'https://localhost:8243/api/application-mgt/v1.0/applications/1.0.0/upload-image-artifacts/', //+appId
|
|
|
|
|
GET_IMAGE_ARTIFACTS: "https://localhost:8243/api/application-mgt/v1.0/applications/1.0.0/image-artifacts/"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static platformManagerEndpoints = {
|
|
|
|
|
this.platformManagerEndpoints = {
|
|
|
|
|
CREATE_PLATFORM: 'https://localhost:8243/api/application-mgt/v1.0/platforms/1.0.0',
|
|
|
|
|
GET_ENABLED_PLATFORMS: 'https://localhost:8243/api/application-mgt/v1.0/platforms/1.0.0?status=ENABLED',
|
|
|
|
|
GET_PLATFORM: 'https://localhost:8243/api/application-mgt/v1.0/platforms/1.0.0/'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static userConstants = {
|
|
|
|
|
LOGIN_URL:"https://localhost:9443/auth/application-mgt/v1.0/auth/login",
|
|
|
|
|
this.userConstants = {
|
|
|
|
|
LOGIN_URL: "https://localhost:9443/auth/application-mgt/v1.0/auth/login",
|
|
|
|
|
LOGOUT_URL: "https://localhost:9443/auth/application-mgt/v1.0/auth/logout",
|
|
|
|
|
REFRESH_TOKEN_URL: "",
|
|
|
|
|
WSO2_USER: 'wso2_user',
|
|
|
|
|
PARTIAL_TOKEN: 'WSO2_IOT_TOKEN'
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getServerConfig(callback) {
|
|
|
|
|
let baseURL = window.location.origin;
|
|
|
|
|
let appContext = window.location.pathname.split("/")[1];
|
|
|
|
|
let configFileName = 'config.json';
|
|
|
|
|
return axios.get(baseURL + "/" + configFileName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default (new Constants);
|
|
|
|
|