-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from OpenLMIS/SELV3-784
SELV-784: Login to superset on login to app
- Loading branch information
Showing
16 changed files
with
1,159 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,8 @@ | |
'openlmis-offline', | ||
'openlmis-locale', | ||
'openlmis-modal', | ||
'ui.router' | ||
'ui.router', | ||
'openlmis-superset' | ||
]); | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"superset.auth.pageRequiresAuthorization": "This page requires authorization in the reporting stack. If nothing shows up, you still can authorize manually by", | ||
"superset.auth.clickingHere": "clicking here", | ||
"superset.oAuthLogin.header": "Allow Superset to get access to OpenLMIS", | ||
"superset.oAuthLogin.authorize": "Authorize", | ||
"superset.oAuthLogin.cancel": "Cancel", | ||
"superset.oAuthLogin.username": "Username", | ||
"superset.oAuthLogin.password": "Password", | ||
"superset.oAuthLogin.invalidCredentialsOrOAuthRequest": "Invalid credentials or unsuccessful OAuth request", | ||
"superset.oAuthLogin.unsuccessfulApprovingPermissions": "Unsuccessful approving permissions for Superset" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* This program is part of the OpenLMIS logistics management information system platform software. | ||
* Copyright © 2017 VillageReach | ||
* | ||
* This program is free software: you can redistribute it and/or modify it under the terms | ||
* of the GNU Affero General Public License as published by the Free Software Foundation, either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Affero General Public License for more details. You should have received a copy of | ||
* the GNU Affero General Public License along with this program. If not, see | ||
* http://www.gnu.org/licenses. For additional information contact info@OpenLMIS.org. | ||
*/ | ||
|
||
(function() { | ||
'use strict'; | ||
|
||
/** | ||
* @ngdoc object | ||
* @name openlmis-superset.MODAL_CANCELLED | ||
* | ||
* @description | ||
* This is the constant describing the rejection of promise in case of cancellation of a modal. | ||
*/ | ||
angular | ||
.module('openlmis-superset') | ||
.constant('MODAL_CANCELLED', 'MODAL_CANCELLED'); | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* This program is part of the OpenLMIS logistics management information system platform software. | ||
* Copyright © 2017 VillageReach | ||
* | ||
* This program is free software: you can redistribute it and/or modify it under the terms | ||
* of the GNU Affero General Public License as published by the Free Software Foundation, either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Affero General Public License for more details. You should have received a copy of | ||
* the GNU Affero General Public License along with this program. If not, see | ||
* http://www.gnu.org/licenses. For additional information contact info@OpenLMIS.org. | ||
*/ | ||
|
||
(function() { | ||
'use strict'; | ||
|
||
/** | ||
* @ngdoc service | ||
* @name superset:supersetLocaleService | ||
* @description | ||
* The service that allows modifing Superset locales. | ||
*/ | ||
angular | ||
.module('openlmis-superset') | ||
.service('supersetLocaleService', supersetLocaleService); | ||
|
||
supersetLocaleService.$inject = ['SUPERSET_URL', 'SUPERSET_LOCALES', 'DEFAULT_LANGUAGE', '$http']; | ||
|
||
function supersetLocaleService(SUPERSET_URL, SUPERSET_LOCALES, DEFAULT_LANGUAGE, $http) { | ||
|
||
this.changeLocale = changeLocale; | ||
|
||
/** | ||
* @ngdoc method | ||
* @methodOf superset:supersetLocaleService | ||
* @name changeLocale | ||
* | ||
* @description | ||
* The method that changes Superset locales. | ||
* | ||
* @param {String} locale (optional) locale to populate | ||
* @return {Promise} The promise of Superset locale change request. | ||
*/ | ||
function changeLocale(locale) { | ||
return $http({ | ||
method: 'GET', | ||
url: SUPERSET_URL + '/lang/change/' + getValidLocale(locale), | ||
withCredentials: true | ||
}); | ||
} | ||
|
||
function getValidLocale(locale) { | ||
if (SUPERSET_LOCALES.indexOf(locale) === -1) { | ||
locale = DEFAULT_LANGUAGE; | ||
} | ||
return locale; | ||
} | ||
} | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* This program is part of the OpenLMIS logistics management information system platform software. | ||
* Copyright © 2017 VillageReach | ||
* | ||
* This program is free software: you can redistribute it and/or modify it under the terms | ||
* of the GNU Affero General Public License as published by the Free Software Foundation, either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Affero General Public License for more details. You should have received a copy of | ||
* the GNU Affero General Public License along with this program. If not, see | ||
* http://www.gnu.org/licenses. For additional information contact info@OpenLMIS.org. | ||
*/ | ||
|
||
describe('supersetLocaleService', function() { | ||
|
||
var that = this; | ||
|
||
beforeEach(function() { | ||
that.SUPERSET_URL = 'http://localhost/superset'; | ||
that.DEFAULT_LANGUAGE = 'en'; | ||
|
||
module('openlmis-superset', function($provide) { | ||
$provide.constant('SUPERSET_URL', that.SUPERSET_URL); | ||
$provide.constant('DEFAULT_LANGUAGE', that.DEFAULT_LANGUAGE); | ||
}); | ||
|
||
inject(function($injector) { | ||
that.supersetLocaleService = $injector.get('supersetLocaleService'); | ||
that.$httpBackend = $injector.get('$httpBackend'); | ||
}); | ||
|
||
}); | ||
|
||
describe('changeLocale', function() { | ||
|
||
// eslint-disable-next-line jasmine/missing-expect | ||
it('should send change language request', function() { | ||
that.$httpBackend.expectGET(that.SUPERSET_URL + '/lang/change/' + that.DEFAULT_LANGUAGE); | ||
|
||
that.supersetLocaleService.changeLocale(that.DEFAULT_LANGUAGE); | ||
}); | ||
|
||
// eslint-disable-next-line jasmine/missing-expect | ||
it('should change the language to default if a not known locale provided', function() { | ||
that.$httpBackend.expectGET(that.SUPERSET_URL + '/lang/change/' + that.DEFAULT_LANGUAGE); | ||
|
||
that.supersetLocaleService.changeLocale('not_known_locale'); | ||
}); | ||
|
||
afterEach(function() { | ||
that.$httpBackend.verifyNoOutstandingExpectation(); | ||
that.$httpBackend.verifyNoOutstandingRequest(); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* This program is part of the OpenLMIS logistics management information system platform software. | ||
* Copyright © 2017 VillageReach | ||
* | ||
* This program is free software: you can redistribute it and/or modify it under the terms | ||
* of the GNU Affero General Public License as published by the Free Software Foundation, either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Affero General Public License for more details. You should have received a copy of | ||
* the GNU Affero General Public License along with this program. If not, see | ||
* http://www.gnu.org/licenses. For additional information contact info@OpenLMIS.org. | ||
*/ | ||
|
||
(function() { | ||
'use strict'; | ||
|
||
/** | ||
* @ngdoc object | ||
* @name superset.SUPERSET_LOCALES | ||
* | ||
* @description | ||
* This is the constant defining a list of locales available in Superset. | ||
*/ | ||
angular | ||
.module('openlmis-superset') | ||
.constant('SUPERSET_LOCALES', locales()); | ||
|
||
function locales() { | ||
return ['en', 'fr', 'pt']; | ||
} | ||
})(); |
Oops, something went wrong.