Fineract backend settings with environment variables
This commit is contained in:
committed by
Arnold Gálovics
parent
1b72136411
commit
14ceb4f3fd
@@ -1,4 +1,5 @@
|
|||||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||||
|
.env
|
||||||
|
|
||||||
# Compiled output
|
# Compiled output
|
||||||
/dist
|
/dist
|
||||||
|
|||||||
+18
-7
@@ -1,23 +1,34 @@
|
|||||||
|
###############
|
||||||
|
### STAGE 1: Build app
|
||||||
|
###############
|
||||||
FROM node:16-alpine as builder
|
FROM node:16-alpine as builder
|
||||||
|
|
||||||
|
RUN apk add --no-cache git
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
ENV PATH /usr/src/app/node_modules/.bin:$PATH
|
ENV PATH /usr/src/app/node_modules/.bin:$PATH
|
||||||
|
|
||||||
COPY package.json /usr/src/app/package.json
|
COPY ./ /usr/src/app/
|
||||||
|
|
||||||
|
RUN npm cache clear --force
|
||||||
|
|
||||||
|
RUN npm config set fetch-retry-maxtimeout 120000
|
||||||
|
|
||||||
RUN npm install --location=global @angular/cli@12.2.17
|
RUN npm install --location=global @angular/cli@12.2.17
|
||||||
|
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
COPY . .
|
RUN ng build --configuration production --output-path=/dist
|
||||||
|
|
||||||
RUN ng build --configuration production
|
###############
|
||||||
|
### STAGE 2: Serve app with nginx ###
|
||||||
|
###############
|
||||||
|
FROM nginx:alpine
|
||||||
|
|
||||||
FROM nginx:1.19.3
|
COPY --from=builder /dist /usr/share/nginx/html
|
||||||
|
|
||||||
COPY --from=builder /usr/src/app/dist/web-app /usr/share/nginx/html
|
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
# When the container starts, replace the env.js with values from environment variables
|
||||||
|
CMD ["/bin/sh", "-c", "envsubst < /usr/share/nginx/html/assets/env.template.js > /usr/share/nginx/html/assets/env.js && exec nginx -g 'daemon off;'"]
|
||||||
|
|||||||
@@ -94,6 +94,59 @@ docker run -d -p 4200:80 openmf/web-app:latest
|
|||||||
|
|
||||||
Access the webapp on http://localhost:4200 in your browser.
|
Access the webapp on http://localhost:4200 in your browser.
|
||||||
|
|
||||||
|
### Docker compose
|
||||||
|
It is possible to do a 'one-touch' installation of Mifos X Web App using containers (AKA "Docker").
|
||||||
|
Fineract now packs the mifos community-app web UI in it's docker deploy.
|
||||||
|
|
||||||
|
As Prerequisites, you must have `docker` and `docker-compose` installed on your machine; see
|
||||||
|
[Docker Install](https://docs.docker.com/install/) and
|
||||||
|
[Docker Compose Install](https://docs.docker.com/compose/install/).
|
||||||
|
|
||||||
|
Now to run a new MifosX Web App instance you can simply:
|
||||||
|
|
||||||
|
1. `git clone https://github.com/openMF/web-app.git ; cd web-app`
|
||||||
|
1. for windows, use `git clone https://github.com/openMF/web-app.git --config core.autocrlf=input ; cd web-app`
|
||||||
|
1. `docker-compose up -d`
|
||||||
|
1. Access the webapp on http://localhost:4200 in your browser.
|
||||||
|
|
||||||
|
You can also setup different confiurations for the MifosX Web App using environment variables:
|
||||||
|
|
||||||
|
1. Use environment variables (best choice if you run with Docker Compose):
|
||||||
|
|
||||||
|
Fineract backend settings
|
||||||
|
```
|
||||||
|
FINERACT_API_URLS
|
||||||
|
```
|
||||||
|
Value to set a Fineract server list (environments) to be used, Default value:
|
||||||
|
```
|
||||||
|
https://dev.mifos.io,https://demo.mifos.io,https://qa.mifos.io,https://staging.mifos.io,https://mobile.mifos.io,https://demo.fineract.dev,https://localhost:8443
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
FINERACT_API_URL
|
||||||
|
```
|
||||||
|
Default value used from the Fineract server list. Default value:
|
||||||
|
```
|
||||||
|
https://localhost:8443
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
FINERACT_PLATFORM_TENANT_IDENTIFIER
|
||||||
|
```
|
||||||
|
Fineract Tenant identifier to be used, It must be aligned with the Fineract `tenants` table. Default value:
|
||||||
|
```
|
||||||
|
default
|
||||||
|
```
|
||||||
|
|
||||||
|
Setting for Languages (i18n) still under development
|
||||||
|
```
|
||||||
|
MIFOS_DEFAULT_LANGUAGE=en-US
|
||||||
|
```
|
||||||
|
```
|
||||||
|
MIFOS_SUPPORTED_LANGUAGES=en-US,fr-FR
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information look the env.sample file in the root directory of the project
|
||||||
|
|
||||||
## Want to help? [](https://github.com/openMF/web-app/issues)
|
## Want to help? [](https://github.com/openMF/web-app/issues)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -116,7 +116,7 @@
|
|||||||
"builder": "@angular-devkit/build-angular:karma",
|
"builder": "@angular-devkit/build-angular:karma",
|
||||||
"options": {
|
"options": {
|
||||||
"main": "src/test.ts",
|
"main": "src/test.ts",
|
||||||
"karmaConfig": "src/karma.conf.js",
|
"karmaConfig": "src/karma.conf.ts",
|
||||||
"polyfills": "src/polyfills.ts",
|
"polyfills": "src/polyfills.ts",
|
||||||
"tsConfig": "src/tsconfig.spec.json",
|
"tsConfig": "src/tsconfig.spec.json",
|
||||||
"scripts": [],
|
"scripts": [],
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
version: '3.5'
|
||||||
|
|
||||||
|
services:
|
||||||
|
mifosx-web-app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- '4200:80'
|
||||||
|
environment:
|
||||||
|
- FINERACT_API_URLS=https://dev.mifos.io,https://demo.mifos.io,https://qa.mifos.io,https://staging.mifos.io,https://mobile.mifos.io,https://demo.fineract.dev,https://localhost:8443
|
||||||
|
- FINERACT_API_URL=https://localhost:8443
|
||||||
|
- FINERACT_API_PROVIDER=/fineract-provider/api
|
||||||
|
- FINERACT_API_VERSION=/v1
|
||||||
|
- FINERACT_PLATFORM_TENANT_IDENTIFIER=default
|
||||||
|
- MIFOS_DEFAULT_LANGUAGE=en-US
|
||||||
|
- MIFOS_SUPPORTED_LANGUAGES=en-US,fr-FR
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
FINERACT_API_URLS=https://dev.mifos.io,https://demo.mifos.io,https://qa.mifos.io,https://staging.mifos.io,https://mobile.mifos.io,https://demo.fineract.dev,https://localhost:8443
|
||||||
|
|
||||||
|
FINERACT_API_URL=https://localhost:8443
|
||||||
|
|
||||||
|
FINERACT_API_PROVIDER=/fineract-provider/api
|
||||||
|
|
||||||
|
FINERACT_API_VERSION=/v1
|
||||||
|
|
||||||
|
FINERACT_PLATFORM_TENANT_IDENTIFIER=default
|
||||||
|
|
||||||
|
MIFOS_DEFAULT_LANGUAGE=en-US
|
||||||
|
|
||||||
|
MIFOS_SUPPORTED_LANGUAGES=en-US,fr-FR
|
||||||
Generated
+216
-34
@@ -53,16 +53,19 @@
|
|||||||
"@types/lodash": "4.14.132",
|
"@types/lodash": "4.14.132",
|
||||||
"@types/node": "12.11.1",
|
"@types/node": "12.11.1",
|
||||||
"codelyzer": "6.0.0",
|
"codelyzer": "6.0.0",
|
||||||
|
"git-describe": "^4.1.1",
|
||||||
"hads": "^3.0.3",
|
"hads": "^3.0.3",
|
||||||
"htmlhint": "0.11.0",
|
"htmlhint": "0.11.0",
|
||||||
"https-proxy-agent": "2.2.1",
|
"https-proxy-agent": "2.2.1",
|
||||||
"jasmine-core": "~3.5.0",
|
"jasmine-core": "^4.2.0",
|
||||||
"jasmine-spec-reporter": "~5.0.0",
|
"jasmine-spec-reporter": "~5.0.0",
|
||||||
"karma": "~6.4.0",
|
"karma": "~6.4.0",
|
||||||
"karma-chrome-launcher": "~3.1.0",
|
"karma-chrome-launcher": "~3.1.0",
|
||||||
"karma-cli": "2.0.0",
|
"karma-cli": "2.0.0",
|
||||||
|
"karma-coverage": "^2.2.0",
|
||||||
"karma-coverage-istanbul-reporter": "~3.0.2",
|
"karma-coverage-istanbul-reporter": "~3.0.2",
|
||||||
"karma-jasmine": "~4.0.0",
|
"karma-jasmine": "^5.1.0",
|
||||||
|
"karma-jasmine-html-reporter": "^2.0.0",
|
||||||
"karma-junit-reporter": "1.2.0",
|
"karma-junit-reporter": "1.2.0",
|
||||||
"protractor": "~7.0.0",
|
"protractor": "~7.0.0",
|
||||||
"puppeteer": "^15.3.2",
|
"puppeteer": "^15.3.2",
|
||||||
@@ -3268,6 +3271,12 @@
|
|||||||
"integrity": "sha512-6d8Q5fqS9DWOXEhMDiF6/2FjyHdmP/jSTAUyeQR7QwrFeNmYyzmvGxD5aLIHL445HjWgibs0eAig+KPnbaesXA==",
|
"integrity": "sha512-6d8Q5fqS9DWOXEhMDiF6/2FjyHdmP/jSTAUyeQR7QwrFeNmYyzmvGxD5aLIHL445HjWgibs0eAig+KPnbaesXA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/semver": {
|
||||||
|
"version": "7.3.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.10.tgz",
|
||||||
|
"integrity": "sha512-zsv3fsC7S84NN6nPK06u79oWgrPVd0NvOyqgghV1haPaFcVxIrP4DLomRwGAXk0ui4HZA7mOcSFL98sMVW9viw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/@types/source-list-map": {
|
"node_modules/@types/source-list-map": {
|
||||||
"version": "0.1.2",
|
"version": "0.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz",
|
||||||
@@ -9191,6 +9200,32 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"node_modules/git-describe": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/git-describe/-/git-describe-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-JC8ganO5kO80G8+XE98TDDjnMXQN3Estk3qdJuG2EGRF/l6zuMTMcN+8OSfQZ5FWpqIRLB015anWX4aSRgnxAQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/semver": "^7.3.8",
|
||||||
|
"lodash": "^4.17.21"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0.0"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"semver": "^5.6.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/git-describe/node_modules/semver": {
|
||||||
|
"version": "5.7.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||||
|
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"bin": {
|
||||||
|
"semver": "bin/semver"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/glob": {
|
"node_modules/glob": {
|
||||||
"version": "7.1.7",
|
"version": "7.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
|
||||||
@@ -11258,9 +11293,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/jasmine-core": {
|
"node_modules/jasmine-core": {
|
||||||
"version": "3.5.0",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-4.2.0.tgz",
|
||||||
"integrity": "sha512-nCeAiw37MIMA9w9IXso7bRaLl+c/ef3wnxsoSAlYrzS+Ot0zTG6nU8G/cIfGkqpkjX2wNaIW9RFG0TwIFnG6bA==",
|
"integrity": "sha512-OcFpBrIhnbmb9wfI8cqPSJ50pv3Wg4/NSgoZIqHzIwO/2a9qivJWzv8hUvaREIMYYJBas6AvfXATFdVuzzCqVw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/jasmine-spec-reporter": {
|
"node_modules/jasmine-spec-reporter": {
|
||||||
@@ -11599,6 +11634,23 @@
|
|||||||
"node": ">= 6"
|
"node": ">= 6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/karma-coverage": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/karma-coverage/-/karma-coverage-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-gPVdoZBNDZ08UCzdMHHhEImKrw1+PAOQOIiffv1YsvxFhBjqvo/SVXNk4tqn1SYqX0BJZT6S/59zgxiBe+9OuA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"istanbul-lib-coverage": "^3.2.0",
|
||||||
|
"istanbul-lib-instrument": "^5.1.0",
|
||||||
|
"istanbul-lib-report": "^3.0.0",
|
||||||
|
"istanbul-lib-source-maps": "^4.0.1",
|
||||||
|
"istanbul-reports": "^3.0.5",
|
||||||
|
"minimatch": "^3.0.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/karma-coverage-istanbul-reporter": {
|
"node_modules/karma-coverage-istanbul-reporter": {
|
||||||
"version": "3.0.3",
|
"version": "3.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/karma-coverage-istanbul-reporter/-/karma-coverage-istanbul-reporter-3.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/karma-coverage-istanbul-reporter/-/karma-coverage-istanbul-reporter-3.0.3.tgz",
|
||||||
@@ -11615,26 +11667,79 @@
|
|||||||
"url": "https://github.com/sponsors/mattlewis92"
|
"url": "https://github.com/sponsors/mattlewis92"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/karma-jasmine": {
|
"node_modules/karma-coverage/node_modules/istanbul-lib-instrument": {
|
||||||
"version": "4.0.2",
|
"version": "5.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.0.tgz",
|
||||||
"integrity": "sha512-ggi84RMNQffSDmWSyyt4zxzh2CQGwsxvYYsprgyR1j8ikzIduEdOlcLvXjZGwXG/0j41KUXOWsUCBfbEHPWP9g==",
|
"integrity": "sha512-6Lthe1hqXHBNsqvgDzGO6l03XNeu3CrG4RqQ1KM9+l5+jNGpEJfIELx1NS3SEHmJQA8np/u+E4EPRKRiu6m19A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jasmine-core": "^3.6.0"
|
"@babel/core": "^7.12.3",
|
||||||
|
"@babel/parser": "^7.14.7",
|
||||||
|
"@istanbuljs/schema": "^0.1.2",
|
||||||
|
"istanbul-lib-coverage": "^3.2.0",
|
||||||
|
"semver": "^6.3.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 10"
|
"node": ">=8"
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"karma": "*"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/karma-jasmine/node_modules/jasmine-core": {
|
"node_modules/karma-coverage/node_modules/istanbul-lib-source-maps": {
|
||||||
"version": "3.99.1",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.99.1.tgz",
|
"resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz",
|
||||||
"integrity": "sha512-Hu1dmuoGcZ7AfyynN3LsfruwMbxMALMka+YtZeGoLuDEySVmVAPaonkNoBRIw/ectu8b9tVQCJNgp4a4knp+tg==",
|
"integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.1.1",
|
||||||
|
"istanbul-lib-coverage": "^3.0.0",
|
||||||
|
"source-map": "^0.6.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/karma-coverage/node_modules/semver": {
|
||||||
|
"version": "6.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||||
|
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"semver": "bin/semver.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/karma-coverage/node_modules/source-map": {
|
||||||
|
"version": "0.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||||
|
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/karma-jasmine": {
|
||||||
|
"version": "5.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-5.1.0.tgz",
|
||||||
|
"integrity": "sha512-i/zQLFrfEpRyQoJF9fsCdTMOF5c2dK7C7OmsuKg2D0YSsuZSfQDiLuaiktbuio6F2wiCsZSnSnieIQ0ant/uzQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"jasmine-core": "^4.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"karma": "^6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/karma-jasmine-html-reporter": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-SB8HNNiazAHXM1vGEzf8/tSyEhkfxuDdhYdPBX2Mwgzt0OuF2gicApQ+uvXLID/gXyJQgvrM9+1/2SxZFUUDIA==",
|
||||||
|
"dev": true,
|
||||||
|
"peerDependencies": {
|
||||||
|
"jasmine-core": "^4.0.0",
|
||||||
|
"karma": "^6.0.0",
|
||||||
|
"karma-jasmine": "^5.0.0"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"node_modules/karma-junit-reporter": {
|
"node_modules/karma-junit-reporter": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
@@ -24940,6 +25045,12 @@
|
|||||||
"integrity": "sha512-6d8Q5fqS9DWOXEhMDiF6/2FjyHdmP/jSTAUyeQR7QwrFeNmYyzmvGxD5aLIHL445HjWgibs0eAig+KPnbaesXA==",
|
"integrity": "sha512-6d8Q5fqS9DWOXEhMDiF6/2FjyHdmP/jSTAUyeQR7QwrFeNmYyzmvGxD5aLIHL445HjWgibs0eAig+KPnbaesXA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/semver": {
|
||||||
|
"version": "7.3.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.10.tgz",
|
||||||
|
"integrity": "sha512-zsv3fsC7S84NN6nPK06u79oWgrPVd0NvOyqgghV1haPaFcVxIrP4DLomRwGAXk0ui4HZA7mOcSFL98sMVW9viw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/source-list-map": {
|
"@types/source-list-map": {
|
||||||
"version": "0.1.2",
|
"version": "0.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz",
|
||||||
@@ -29572,6 +29683,26 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"git-describe": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/git-describe/-/git-describe-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-JC8ganO5kO80G8+XE98TDDjnMXQN3Estk3qdJuG2EGRF/l6zuMTMcN+8OSfQZ5FWpqIRLB015anWX4aSRgnxAQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/semver": "^7.3.8",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"semver": "^5.6.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"semver": {
|
||||||
|
"version": "5.7.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||||
|
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"glob": {
|
"glob": {
|
||||||
"version": "7.1.7",
|
"version": "7.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
|
||||||
@@ -31183,9 +31314,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jasmine-core": {
|
"jasmine-core": {
|
||||||
"version": "3.5.0",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-4.2.0.tgz",
|
||||||
"integrity": "sha512-nCeAiw37MIMA9w9IXso7bRaLl+c/ef3wnxsoSAlYrzS+Ot0zTG6nU8G/cIfGkqpkjX2wNaIW9RFG0TwIFnG6bA==",
|
"integrity": "sha512-OcFpBrIhnbmb9wfI8cqPSJ50pv3Wg4/NSgoZIqHzIwO/2a9qivJWzv8hUvaREIMYYJBas6AvfXATFdVuzzCqVw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"jasmine-spec-reporter": {
|
"jasmine-spec-reporter": {
|
||||||
@@ -31513,6 +31644,58 @@
|
|||||||
"resolve": "^1.3.3"
|
"resolve": "^1.3.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"karma-coverage": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/karma-coverage/-/karma-coverage-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-gPVdoZBNDZ08UCzdMHHhEImKrw1+PAOQOIiffv1YsvxFhBjqvo/SVXNk4tqn1SYqX0BJZT6S/59zgxiBe+9OuA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"istanbul-lib-coverage": "^3.2.0",
|
||||||
|
"istanbul-lib-instrument": "^5.1.0",
|
||||||
|
"istanbul-lib-report": "^3.0.0",
|
||||||
|
"istanbul-lib-source-maps": "^4.0.1",
|
||||||
|
"istanbul-reports": "^3.0.5",
|
||||||
|
"minimatch": "^3.0.4"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"istanbul-lib-instrument": {
|
||||||
|
"version": "5.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.0.tgz",
|
||||||
|
"integrity": "sha512-6Lthe1hqXHBNsqvgDzGO6l03XNeu3CrG4RqQ1KM9+l5+jNGpEJfIELx1NS3SEHmJQA8np/u+E4EPRKRiu6m19A==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@babel/core": "^7.12.3",
|
||||||
|
"@babel/parser": "^7.14.7",
|
||||||
|
"@istanbuljs/schema": "^0.1.2",
|
||||||
|
"istanbul-lib-coverage": "^3.2.0",
|
||||||
|
"semver": "^6.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"istanbul-lib-source-maps": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz",
|
||||||
|
"integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"debug": "^4.1.1",
|
||||||
|
"istanbul-lib-coverage": "^3.0.0",
|
||||||
|
"source-map": "^0.6.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"semver": {
|
||||||
|
"version": "6.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||||
|
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"source-map": {
|
||||||
|
"version": "0.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||||
|
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"karma-coverage-istanbul-reporter": {
|
"karma-coverage-istanbul-reporter": {
|
||||||
"version": "3.0.3",
|
"version": "3.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/karma-coverage-istanbul-reporter/-/karma-coverage-istanbul-reporter-3.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/karma-coverage-istanbul-reporter/-/karma-coverage-istanbul-reporter-3.0.3.tgz",
|
||||||
@@ -31527,22 +31710,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"karma-jasmine": {
|
"karma-jasmine": {
|
||||||
"version": "4.0.2",
|
"version": "5.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-5.1.0.tgz",
|
||||||
"integrity": "sha512-ggi84RMNQffSDmWSyyt4zxzh2CQGwsxvYYsprgyR1j8ikzIduEdOlcLvXjZGwXG/0j41KUXOWsUCBfbEHPWP9g==",
|
"integrity": "sha512-i/zQLFrfEpRyQoJF9fsCdTMOF5c2dK7C7OmsuKg2D0YSsuZSfQDiLuaiktbuio6F2wiCsZSnSnieIQ0ant/uzQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"jasmine-core": "^3.6.0"
|
"jasmine-core": "^4.1.0"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"jasmine-core": {
|
|
||||||
"version": "3.99.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.99.1.tgz",
|
|
||||||
"integrity": "sha512-Hu1dmuoGcZ7AfyynN3LsfruwMbxMALMka+YtZeGoLuDEySVmVAPaonkNoBRIw/ectu8b9tVQCJNgp4a4knp+tg==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"karma-jasmine-html-reporter": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-SB8HNNiazAHXM1vGEzf8/tSyEhkfxuDdhYdPBX2Mwgzt0OuF2gicApQ+uvXLID/gXyJQgvrM9+1/2SxZFUUDIA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {}
|
||||||
|
},
|
||||||
"karma-junit-reporter": {
|
"karma-junit-reporter": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/karma-junit-reporter/-/karma-junit-reporter-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/karma-junit-reporter/-/karma-junit-reporter-1.2.0.tgz",
|
||||||
|
|||||||
+7
-4
@@ -22,8 +22,8 @@
|
|||||||
"e2e": "npm run env -s && ng e2e",
|
"e2e": "npm run env -s && ng e2e",
|
||||||
"translations:extract": "ngx-translate-extract --input ./src --output ./src/translations/template.json --format=json --clean -sort --marker extract",
|
"translations:extract": "ngx-translate-extract --input ./src --output ./src/translations/template.json --format=json --clean -sort --marker extract",
|
||||||
"docs": "hads ./docs -o",
|
"docs": "hads ./docs -o",
|
||||||
"env": "ngx-scripts env npm_package_version",
|
"env": "node version.js",
|
||||||
"postinstall": "ngcc"
|
"postinstall": "node version.js && ngcc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular-devkit/schematics": "^14.0.4",
|
"@angular-devkit/schematics": "^14.0.4",
|
||||||
@@ -69,16 +69,19 @@
|
|||||||
"@types/lodash": "4.14.132",
|
"@types/lodash": "4.14.132",
|
||||||
"@types/node": "12.11.1",
|
"@types/node": "12.11.1",
|
||||||
"codelyzer": "6.0.0",
|
"codelyzer": "6.0.0",
|
||||||
|
"git-describe": "^4.1.1",
|
||||||
"hads": "^3.0.3",
|
"hads": "^3.0.3",
|
||||||
"htmlhint": "0.11.0",
|
"htmlhint": "0.11.0",
|
||||||
"https-proxy-agent": "2.2.1",
|
"https-proxy-agent": "2.2.1",
|
||||||
"jasmine-core": "~3.5.0",
|
"jasmine-core": "^4.2.0",
|
||||||
"jasmine-spec-reporter": "~5.0.0",
|
"jasmine-spec-reporter": "~5.0.0",
|
||||||
"karma": "~6.4.0",
|
"karma": "~6.4.0",
|
||||||
"karma-chrome-launcher": "~3.1.0",
|
"karma-chrome-launcher": "~3.1.0",
|
||||||
"karma-cli": "2.0.0",
|
"karma-cli": "2.0.0",
|
||||||
|
"karma-coverage": "^2.2.0",
|
||||||
"karma-coverage-istanbul-reporter": "~3.0.2",
|
"karma-coverage-istanbul-reporter": "~3.0.2",
|
||||||
"karma-jasmine": "~4.0.0",
|
"karma-jasmine": "^5.1.0",
|
||||||
|
"karma-jasmine-html-reporter": "^2.0.0",
|
||||||
"karma-junit-reporter": "1.2.0",
|
"karma-junit-reporter": "1.2.0",
|
||||||
"protractor": "~7.0.0",
|
"protractor": "~7.0.0",
|
||||||
"puppeteer": "^15.3.2",
|
"puppeteer": "^15.3.2",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const routes: Routes = [
|
|||||||
* Configures the fallback route.
|
* Configures the fallback route.
|
||||||
*/
|
*/
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forRoot(routes)],
|
imports: [RouterModule.forRoot(routes, { useHash: true })],
|
||||||
exports: [RouterModule],
|
exports: [RouterModule],
|
||||||
providers: []
|
providers: []
|
||||||
})
|
})
|
||||||
|
|||||||
+13
-2
@@ -2,7 +2,7 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||||
import { ServiceWorkerModule } from '@angular/service-worker';
|
import { ServiceWorkerModule } from '@angular/service-worker';
|
||||||
|
|
||||||
/** Environment Configuration */
|
/** Environment Configuration */
|
||||||
@@ -38,7 +38,9 @@ import { TasksModule } from './tasks/tasks.module';
|
|||||||
|
|
||||||
/** Main Routing Module */
|
/** Main Routing Module */
|
||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe, LocationStrategy } from '@angular/common';
|
||||||
|
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* App Module
|
* App Module
|
||||||
@@ -47,6 +49,15 @@ import { DatePipe } from '@angular/common';
|
|||||||
*/
|
*/
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
TranslateModule.forRoot({
|
||||||
|
loader: {
|
||||||
|
provide: TranslateLoader,
|
||||||
|
useFactory: (http: HttpClient, locationStrategy: LocationStrategy) => {
|
||||||
|
return new TranslateHttpLoader(http, `${ window.location.protocol }//${ window.location.host }${locationStrategy.getBaseHref()}/assets/translations/`, '.json');
|
||||||
|
},
|
||||||
|
deps: [HttpClient, LocationStrategy]
|
||||||
|
}
|
||||||
|
}),
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
BrowserAnimationsModule,
|
BrowserAnimationsModule,
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
|
|||||||
@@ -51,15 +51,7 @@ import { APP_BASE_HREF, LocationStrategy } from '@angular/common';
|
|||||||
imports: [
|
imports: [
|
||||||
SharedModule,
|
SharedModule,
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot(),
|
||||||
loader: {
|
|
||||||
provide: TranslateLoader,
|
|
||||||
useFactory: (http: HttpClient, locationStrategy: LocationStrategy) => {
|
|
||||||
return new TranslateHttpLoader(http, `${ window.location.protocol }//${ window.location.host }${locationStrategy.getBaseHref()}/assets/translations/`, '.json');
|
|
||||||
},
|
|
||||||
deps: [HttpClient, LocationStrategy]
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
RouterModule
|
RouterModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
|
|||||||
@@ -6,23 +6,27 @@ import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest } from '@angular/c
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
/** Environment Configuration */
|
/** Environment Configuration */
|
||||||
import { environment } from 'environments/environment';
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Http request interceptor to prefix a request with `environment.serverUrl`.
|
* Http request interceptor to prefix a request with `serverUrl`.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ApiPrefixInterceptor implements HttpInterceptor {
|
export class ApiPrefixInterceptor implements HttpInterceptor {
|
||||||
|
/**
|
||||||
|
* @param {SettingsService} settingsService Settings Service
|
||||||
|
*/
|
||||||
|
constructor(private settingsService: SettingsService) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Intercepts a Http request and prefixes it with `environment.serverUrl`.
|
* Intercepts a Http request and prefixes it with `serverUrl`.
|
||||||
*/
|
*/
|
||||||
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||||
/**
|
/**
|
||||||
* Ignore URLs that are complete for i18n
|
* Ignore URLs that are complete for i18n
|
||||||
*/
|
*/
|
||||||
if (!request.url.includes('http:') && !request.url.includes('https:')) {
|
if (!request.url.includes('http:') && !request.url.includes('https:')) {
|
||||||
request = request.clone({ url: environment.serverUrl + request.url });
|
request = request.clone({ url: this.settingsService.serverUrl + request.url });
|
||||||
}
|
}
|
||||||
|
|
||||||
return next.handle(request);
|
return next.handle(request);
|
||||||
|
|||||||
@@ -2,16 +2,11 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
/** Translation Imports */
|
/** Translation Imports */
|
||||||
import { TranslateService, LangChangeEvent } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
/** Custom Services */
|
/** Custom Services */
|
||||||
import { Logger } from '../logger/logger.service';
|
import { Logger } from '../logger/logger.service';
|
||||||
|
|
||||||
/** Other Imports */
|
|
||||||
import { includes } from 'lodash';
|
|
||||||
import * as enUS from '../../../translations/en-US.json';
|
|
||||||
import * as frFR from '../../../translations/fr-FR.json';
|
|
||||||
|
|
||||||
/** Initialize Logger */
|
/** Initialize Logger */
|
||||||
const log = new Logger('I18nService');
|
const log = new Logger('I18nService');
|
||||||
|
|
||||||
@@ -19,71 +14,18 @@ const log = new Logger('I18nService');
|
|||||||
* Pass-through function to mark a string for translation extraction.
|
* Pass-through function to mark a string for translation extraction.
|
||||||
* Running `npm translations:extract` will include the given string by using this.
|
* Running `npm translations:extract` will include the given string by using this.
|
||||||
* @param {string} s The string to extract for translation.
|
* @param {string} s The string to extract for translation.
|
||||||
* @return {string} The same string.
|
* @return {string} The translated string.
|
||||||
*/
|
*/
|
||||||
export function extract(s: string) {
|
export function extract(s: string) {
|
||||||
return s;
|
return I18nService.translate(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class I18nService {
|
export class I18nService {
|
||||||
|
|
||||||
/** Key to store current language of application in local storage. */
|
|
||||||
private languageStorageKey = 'mifosXLanguage';
|
|
||||||
|
|
||||||
defaultLanguage: string;
|
|
||||||
supportedLanguages: string[];
|
|
||||||
|
|
||||||
constructor(private translateService: TranslateService) { }
|
constructor(private translateService: TranslateService) { }
|
||||||
|
|
||||||
/**
|
public static translate(key: string): string {
|
||||||
* Initializes i18n for the application.
|
return key;
|
||||||
* Loads language from local storage if present, or sets default language.
|
|
||||||
* @param {!string} defaultLanguage The default language to use.
|
|
||||||
* @param {Array.<String>} supportedLanguages The list of supported languages.
|
|
||||||
*/
|
|
||||||
init(defaultLanguage: string, supportedLanguages: string[]) {
|
|
||||||
this.defaultLanguage = defaultLanguage;
|
|
||||||
this.supportedLanguages = supportedLanguages;
|
|
||||||
this.language = '';
|
|
||||||
|
|
||||||
this.translateService.onLangChange
|
|
||||||
.subscribe((event: LangChangeEvent) => { localStorage.setItem(this.languageStorageKey, event.lang); });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the current language.
|
|
||||||
* Note: The current language is saved to the local storage.
|
|
||||||
* If no parameter is specified, the language is loaded from local storage (if present).
|
|
||||||
* @param {string} language The IETF language code to set.
|
|
||||||
*/
|
|
||||||
set language(language: string) {
|
|
||||||
language = language || localStorage.getItem(this.languageStorageKey) || this.translateService.getBrowserCultureLang();
|
|
||||||
let isSupportedLanguage = includes(this.supportedLanguages, language);
|
|
||||||
|
|
||||||
// If no exact match is found, search without the region
|
|
||||||
if (language && !isSupportedLanguage) {
|
|
||||||
language = language.split('-')[0];
|
|
||||||
language = this.supportedLanguages.find(supportedLanguage => supportedLanguage.startsWith(language)) || '';
|
|
||||||
isSupportedLanguage = Boolean(language);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback if language is not supported
|
|
||||||
if (!isSupportedLanguage) {
|
|
||||||
language = this.defaultLanguage;
|
|
||||||
}
|
|
||||||
|
|
||||||
log.debug(`Language set to ${language}`);
|
|
||||||
localStorage.setItem(this.languageStorageKey, language);
|
|
||||||
this.translateService.setDefaultLang(language);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current language.
|
|
||||||
* @return {string} The current language code.
|
|
||||||
*/
|
|
||||||
get language(): string {
|
|
||||||
return this.translateService.currentLang;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { SettingsService } from 'app/settings/settings.service';
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
|
import * as moment from 'moment';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -10,13 +11,20 @@ export class Dates {
|
|||||||
constructor(private settingsService: SettingsService,
|
constructor(private settingsService: SettingsService,
|
||||||
private datePipe: DatePipe) {}
|
private datePipe: DatePipe) {}
|
||||||
|
|
||||||
public getDate(timestamp: any) {
|
public getDate(timestamp: any): string {
|
||||||
const dateFormat = this.settingsService.dateFormat;
|
const dateFormat = this.settingsService.dateFormat;
|
||||||
return this.datePipe.transform(timestamp, dateFormat);
|
return this.datePipe.transform(timestamp, dateFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public formatDate(timestamp: any, dateFormat: string) {
|
public formatDate(timestamp: any, dateFormat: string): string {
|
||||||
return this.datePipe.transform(timestamp, dateFormat);
|
return this.datePipe.transform(timestamp, dateFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public parseDate(value: any): Date {
|
||||||
|
if (value instanceof Array) {
|
||||||
|
return moment(value.join('-'), 'YYYY-MM-DD').toDate();
|
||||||
|
} else {
|
||||||
|
return moment(value).toDate();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { LoansService } from 'app/loans/loans.service';
|
|||||||
/** Dialog Components */
|
/** Dialog Components */
|
||||||
import { LoanAccountLoadDocumentsDialogComponent } from 'app/loans/custom-dialog/loan-account-load-documents-dialog/loan-account-load-documents-dialog.component';
|
import { LoanAccountLoadDocumentsDialogComponent } from 'app/loans/custom-dialog/loan-account-load-documents-dialog/loan-account-load-documents-dialog.component';
|
||||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||||
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overdue charges tab component
|
* Overdue charges tab component
|
||||||
@@ -50,6 +51,7 @@ export class LoanDocumentsTabComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private loansService: LoansService,
|
private loansService: LoansService,
|
||||||
|
private settingsService: SettingsService,
|
||||||
public dialog: MatDialog) {
|
public dialog: MatDialog) {
|
||||||
this.route.data.subscribe((data: { loanDocuments: any }) => {
|
this.route.data.subscribe((data: { loanDocuments: any }) => {
|
||||||
this.getLoanDocumentsData(data.loanDocuments);
|
this.getLoanDocumentsData(data.loanDocuments);
|
||||||
@@ -72,7 +74,7 @@ export class LoanDocumentsTabComponent implements OnInit {
|
|||||||
getLoanDocumentsData(data: any) {
|
getLoanDocumentsData(data: any) {
|
||||||
data.forEach((ele: any) => {
|
data.forEach((ele: any) => {
|
||||||
let loandocs = {};
|
let loandocs = {};
|
||||||
loandocs = environment.serverUrl + '/loans/' + ele.parentEntityId + '/documents/' + ele.id + '/attachment?tenantIdentifier=' + environment.fineractPlatformTenantId;
|
loandocs = this.settingsService.serverUrl + '/loans/' + ele.parentEntityId + '/documents/' + ele.id + '/attachment?tenantIdentifier=' + environment.fineractPlatformTenantId;
|
||||||
ele.docUrl = loandocs;
|
ele.docUrl = loandocs;
|
||||||
if (ele.fileName) {
|
if (ele.fileName) {
|
||||||
if (ele.fileName.toLowerCase().indexOf('.jpg') !== -1 || ele.fileName.toLowerCase().indexOf('.jpeg') !== -1 || ele.fileName.toLowerCase().indexOf('.png') !== -1) {
|
if (ele.fileName.toLowerCase().indexOf('.jpg') !== -1 || ele.fileName.toLowerCase().indexOf('.jpeg') !== -1 || ele.fileName.toLowerCase().indexOf('.png') !== -1) {
|
||||||
|
|||||||
@@ -1,8 +1,19 @@
|
|||||||
|
import { TestBed, waitForAsync } from '@angular/core/testing';
|
||||||
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
import { DateFormatPipe } from './date-format.pipe';
|
import { DateFormatPipe } from './date-format.pipe';
|
||||||
|
|
||||||
describe('DateFormatPipe', () => {
|
describe('DateFormatPipe', () => {
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [ SettingsService ],
|
||||||
|
declarations: [ DateFormatPipe ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
it('create an instance', () => {
|
it('create an instance', () => {
|
||||||
const pipe = new DateFormatPipe();
|
const pipe = new DateFormatPipe(new SettingsService());
|
||||||
expect(pipe).toBeTruthy();
|
expect(pipe).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+4
@@ -60,6 +60,10 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div fxFlex="100%" *ngIf="chart.value.chartSlabs.length === 0">
|
||||||
|
<h3 class="mat-h3">It's required to add at least one Slab</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
<table fxFlex="98%" class="mat-elevation-z1" mat-table [dataSource]="chart.value.chartSlabs" *ngIf="chart.value.chartSlabs.length !== 0" multiTemplateDataRows>
|
<table fxFlex="98%" class="mat-elevation-z1" mat-table [dataSource]="chart.value.chartSlabs" *ngIf="chart.value.chartSlabs.length !== 0" multiTemplateDataRows>
|
||||||
|
|
||||||
<ng-container matColumnDef="period">
|
<ng-container matColumnDef="period">
|
||||||
|
|||||||
+1
-1
@@ -228,7 +228,7 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
|||||||
'fromDate': ['', Validators.required],
|
'fromDate': ['', Validators.required],
|
||||||
'endDate': [''],
|
'endDate': [''],
|
||||||
'isPrimaryGroupingByAmount': [false],
|
'isPrimaryGroupingByAmount': [false],
|
||||||
'chartSlabs': this.formBuilder.array([])
|
'chartSlabs': this.formBuilder.array([], Validators.required)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
/** Angular Imports */
|
/** Angular Imports */
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { AlertService } from 'app/core/alert/alert.service';
|
||||||
|
import { Dates } from 'app/core/utils/dates';
|
||||||
|
|
||||||
/** Environment Imports */
|
/** Environment Imports */
|
||||||
import { environment } from '../../environments/environment';
|
import { environment } from '../../environments/environment';
|
||||||
@@ -12,7 +14,12 @@ import { environment } from '../../environments/environment';
|
|||||||
})
|
})
|
||||||
export class SettingsService {
|
export class SettingsService {
|
||||||
|
|
||||||
constructor() { }
|
public static businessDateConfigName = 'enable_business_date';
|
||||||
|
public static businessDateType = 'BUSINESS_DATE';
|
||||||
|
public static cobDateType = 'COB_DATE';
|
||||||
|
|
||||||
|
constructor(private alertService: AlertService,
|
||||||
|
private dateUtils: Dates) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets date format setting throughout the app.
|
* Sets date format setting throughout the app.
|
||||||
@@ -42,7 +49,7 @@ export class SettingsService {
|
|||||||
* @param {string} url URL
|
* @param {string} url URL
|
||||||
*/
|
*/
|
||||||
setServer(url: string) {
|
setServer(url: string) {
|
||||||
localStorage.setItem('mifosXServerURL', JSON.stringify(url));
|
localStorage.setItem('mifosXServerURL', url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,7 +88,42 @@ export class SettingsService {
|
|||||||
* Returns server setting
|
* Returns server setting
|
||||||
*/
|
*/
|
||||||
get server() {
|
get server() {
|
||||||
|
if (localStorage.getItem('mifosXServerURL')) {
|
||||||
|
return localStorage.getItem('mifosXServerURL');
|
||||||
|
}
|
||||||
return environment.baseApiUrl;
|
return environment.baseApiUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns server url with api path and version
|
||||||
|
*/
|
||||||
|
get serverUrl() {
|
||||||
|
return this.server + environment.apiProvider + environment.apiVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate If the enable_business_date configuration is enabled or disabled.
|
||||||
|
*/
|
||||||
|
validateBusinessDateStatus(configurations: any) {
|
||||||
|
configurations.some((config: any) => {
|
||||||
|
if (config.name === SettingsService.businessDateConfigName) {
|
||||||
|
return config.enabled;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Business Date or COB Date.
|
||||||
|
*/
|
||||||
|
getBusinessDates(businessDateData: any, dateType: string): void {
|
||||||
|
businessDateData.some((data: any) => {
|
||||||
|
if (data.type === dateType) {
|
||||||
|
const dateVal = new Date(data.date);
|
||||||
|
this.alertService.alert({ type: dateType + ' Set',
|
||||||
|
message: this.dateUtils.formatDate(dateVal, this.dateFormat())});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<div fxLayout="column" id="footer" class="m-b-20">
|
<div fxLayout="column" id="footer" class="m-b-20">
|
||||||
<mat-divider fxFlexAlign="center" class="divider"></mat-divider>
|
<mat-divider fxFlexAlign="center" class="divider"></mat-divider>
|
||||||
<p fxFlexAlign="center" class="footer-content">Version {{ version }}</p>
|
<p fxFlexAlign="center" class="footer-content">Version <b>{{ version }}</b> - <b>{{ hash }}</b></p>
|
||||||
<p fxFlexAlign="center" class="footer-content">Mifos X is up to date</p>
|
<p fxFlexAlign="center" class="footer-content" *ngIf="isBusinessDateDefined">Current Business Date: <b>{{ businessDate | date: 'EEEE, MMMM dd, y' }}</b></p>
|
||||||
|
<mat-divider fxFlexAlign="center" class="divider"></mat-divider>
|
||||||
|
<p fxFlexAlign="center" class="footer-content">Mifos X by Mifos</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
/** Angular Imports */
|
/** Angular Imports */
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||||
|
import { Alert } from 'app/core/alert/alert.model';
|
||||||
|
import { AlertService } from 'app/core/alert/alert.service';
|
||||||
|
import { AuthenticationService } from 'app/core/authentication/authentication.service';
|
||||||
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
|
import { SystemService } from 'app/system/system.service';
|
||||||
|
|
||||||
/** Environment Configuration */
|
/** Environment Configuration */
|
||||||
import { environment } from 'environments/environment';
|
import { environment } from 'environments/environment';
|
||||||
|
import { Subscription } from 'rxjs';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Footer component.
|
* Footer component.
|
||||||
@@ -12,14 +18,73 @@ import { environment } from 'environments/environment';
|
|||||||
templateUrl: './footer.component.html',
|
templateUrl: './footer.component.html',
|
||||||
styleUrls: ['./footer.component.scss']
|
styleUrls: ['./footer.component.scss']
|
||||||
})
|
})
|
||||||
export class FooterComponent implements OnInit {
|
export class FooterComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
/** Mifos X version. */
|
/** Mifos X version. */
|
||||||
version: string = environment.version;
|
version: string = environment.version;
|
||||||
|
/** Mifos X hash */
|
||||||
|
hash: string = environment.hash;
|
||||||
|
/** Business Date */
|
||||||
|
businessDate: Date = null;
|
||||||
|
|
||||||
constructor() { }
|
isBusinessDateEnabled = false;
|
||||||
|
isBusinessDateDefined = false;
|
||||||
|
/** Subscription to alerts. */
|
||||||
|
alert$: Subscription;
|
||||||
|
timer: any;
|
||||||
|
|
||||||
|
constructor(private systemService: SystemService,
|
||||||
|
private authenticationService: AuthenticationService,
|
||||||
|
private alertService: AlertService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.alert$ = this.alertService.alertEvent.subscribe((alertEvent: Alert) => {
|
||||||
|
const alertType = alertEvent.type;
|
||||||
|
if (alertType === SettingsService.businessDateType + ' Set Config') {
|
||||||
|
this.isBusinessDateEnabled = (alertEvent.message === 'enabled') ? true : false;
|
||||||
|
this.isBusinessDateDefined = false;
|
||||||
|
if (this.isBusinessDateEnabled) {
|
||||||
|
this.setBusinessDate();
|
||||||
|
}
|
||||||
|
} else if (alertType === SettingsService.businessDateType + ' Set') {
|
||||||
|
if (this.isBusinessDateEnabled) {
|
||||||
|
this.setBusinessDate();
|
||||||
|
}
|
||||||
|
} else if (alertType === 'Authentication Start') {
|
||||||
|
this.timer = setTimeout(() => { this.getConfigurations(); }, 60000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.getConfigurations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
clearTimeout(this.timer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Configuration for Business Date
|
||||||
|
*/
|
||||||
|
getConfigurations(): void {
|
||||||
|
if (this.authenticationService.isAuthenticated()) {
|
||||||
|
this.systemService.getConfigurationByName(SettingsService.businessDateConfigName)
|
||||||
|
.subscribe((configurationData: any) => {
|
||||||
|
this.isBusinessDateEnabled = configurationData.enabled;
|
||||||
|
if (this.isBusinessDateEnabled) {
|
||||||
|
this.setBusinessDate();
|
||||||
|
this.timer = setTimeout(() => { this.getConfigurations(); }, 60000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Business Date data
|
||||||
|
*/
|
||||||
|
setBusinessDate(): void {
|
||||||
|
this.systemService.getBusinessDate(SettingsService.businessDateType)
|
||||||
|
.subscribe((data: any) => {
|
||||||
|
this.businessDate = new Date(data.date);
|
||||||
|
this.isBusinessDateDefined = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<mat-form-field id="language-selector">
|
<mat-form-field id="language-selector">
|
||||||
<mat-label>Language</mat-label>
|
<mat-label>{{ 'Language' | translate }}</mat-label>
|
||||||
<mat-select [formControl]="languageSelector" (selectionChange)="setLanguage()" class="languageselector">
|
<mat-select [formControl]="languageSelector" (selectionChange)="setLanguage()" class="languageselector">
|
||||||
<mat-option *ngFor="let language of languages" [value]="language">
|
<mat-option *ngFor="let language of languages" [value]="language">
|
||||||
{{ language }}
|
{{ language }}
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
<mat-form-field id="server-selector">
|
<mat-form-field id="server-selector" *ngIf="existMoreThanOneServer">
|
||||||
<mat-label>Server</mat-label>
|
<mat-label>{{ 'Server' | translate }}</mat-label>
|
||||||
<mat-select [formControl]="serverSelector">
|
<mat-select [formControl]="serverSelector" (selectionChange)="setServer()">
|
||||||
<div class="sticky">
|
<div class="sticky">
|
||||||
<form [formGroup]="form" (ngSubmit)="setNewServer()">
|
<form [formGroup]="form" (ngSubmit)="addNewServer()">
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<mat-form-field class="ml" fxFlexAlign="start">
|
<mat-form-field class="ml" fxFlexAlign="start">
|
||||||
<span matPrefix><mat-icon>language</mat-icon></span>
|
<span matPrefix><mat-icon>language</mat-icon></span>
|
||||||
<mat-label>Add new server</mat-label>
|
<mat-label>{{ 'Add new server' | translate }}</mat-label>
|
||||||
<input matInput type="text" autocomplete="off" formControlName="url">
|
<input matInput type="text" autocomplete="off" formControlName="url">
|
||||||
<mat-error *ngIf="form.controls.url.hasError('required')">
|
<mat-error *ngIf="form.controls.url.hasError('required')">
|
||||||
Url <strong>is required</strong>
|
Url <strong>{{'is required' | translate }}</strong>
|
||||||
</mat-error>
|
</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<button type="submit" [disabled]="form.invalid" class="ml" mat-raised-button color="primary">Add</button>
|
<button type="submit" [disabled]="form.invalid" class="ml" mat-raised-button color="primary">{{'Add' | translate }}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -26,34 +26,42 @@ export class ServerSelectorComponent implements OnInit {
|
|||||||
/** Server Setting */
|
/** Server Setting */
|
||||||
serverSelector = new FormControl('');
|
serverSelector = new FormControl('');
|
||||||
|
|
||||||
|
/** Server list to show */
|
||||||
|
existMoreThanOneServer = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {SettingsService} settingsService Settings Service
|
* @param {SettingsService} settingsService Settings Service
|
||||||
*/
|
*/
|
||||||
constructor(private settingsService: SettingsService, public dialog: MatDialog, private formBuilder: FormBuilder) { }
|
constructor(private settingsService: SettingsService,
|
||||||
|
public dialog: MatDialog,
|
||||||
|
private formBuilder: FormBuilder) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.servers = this.settingsService.servers;
|
this.servers = this.settingsService.servers;
|
||||||
this.serverSelector.patchValue(this.settingsService.server);
|
this.existMoreThanOneServer = (this.servers && this.servers.length > 1);
|
||||||
this.buildDependencies();
|
if (!this.existMoreThanOneServer) {
|
||||||
this.form = this.formBuilder.group({
|
this.settingsService.setServer(this.servers[0]);
|
||||||
'url': ['', [Validators.required]],
|
} else {
|
||||||
});
|
this.existMoreThanOneServer = true;
|
||||||
|
this.serverSelector.patchValue(this.settingsService.server);
|
||||||
|
this.form = this.formBuilder.group({
|
||||||
|
'url': ['', [Validators.required]],
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subscribe to value changes.
|
* Set backend server from the list
|
||||||
*/
|
*/
|
||||||
buildDependencies() {
|
setServer(): void {
|
||||||
this.serverSelector.valueChanges.subscribe((url: string) => {
|
this.settingsService.setServer(this.serverSelector.value);
|
||||||
this.settingsService.setServer(url);
|
|
||||||
window.location.reload(); // refreshes the environment.ts.
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set new server.
|
* Add new server to the list.
|
||||||
*/
|
*/
|
||||||
setNewServer() {
|
addNewServer(): void {
|
||||||
let servers;
|
let servers;
|
||||||
this.settingsService.setServer(this.form.value.url);
|
this.settingsService.setServer(this.form.value.url);
|
||||||
servers = this.settingsService.servers;
|
servers = this.settingsService.servers;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import { ServerSelectorComponent } from './server-selector/server-selector.compo
|
|||||||
/** Custom Modules */
|
/** Custom Modules */
|
||||||
import { IconsModule } from './icons.module';
|
import { IconsModule } from './icons.module';
|
||||||
import { MaterialModule } from './material.module';
|
import { MaterialModule } from './material.module';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shared Module
|
* Shared Module
|
||||||
@@ -36,7 +37,8 @@ import { MaterialModule } from './material.module';
|
|||||||
CommonModule,
|
CommonModule,
|
||||||
IconsModule,
|
IconsModule,
|
||||||
MaterialModule,
|
MaterialModule,
|
||||||
ReactiveFormsModule
|
ReactiveFormsModule,
|
||||||
|
TranslateModule.forRoot(),
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
FormfieldComponent,
|
FormfieldComponent,
|
||||||
|
|||||||
@@ -3,8 +3,11 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
|
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { Alert } from 'app/core/alert/alert.model';
|
||||||
|
import { AlertService } from 'app/core/alert/alert.service';
|
||||||
import { Dates } from 'app/core/utils/dates';
|
import { Dates } from 'app/core/utils/dates';
|
||||||
import { SettingsService } from 'app/settings/settings.service';
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
|
import { Subscription } from 'rxjs';
|
||||||
|
|
||||||
/** Custom Services */
|
/** Custom Services */
|
||||||
import { SystemService } from '../../system.service';
|
import { SystemService } from '../../system.service';
|
||||||
@@ -15,10 +18,8 @@ import { SystemService } from '../../system.service';
|
|||||||
styleUrls: ['./business-date-tab.component.scss']
|
styleUrls: ['./business-date-tab.component.scss']
|
||||||
})
|
})
|
||||||
export class BusinessDateTabComponent implements OnInit {
|
export class BusinessDateTabComponent implements OnInit {
|
||||||
|
/** Subscription to alerts. */
|
||||||
configurationName = 'enable_business_date';
|
alert$: Subscription;
|
||||||
businessDateType = 'BUSINESS_DATE';
|
|
||||||
cobDateType = 'COB_DATE';
|
|
||||||
|
|
||||||
/** Minimum date allowed. */
|
/** Minimum date allowed. */
|
||||||
minDate = new Date(2000, 0, 1);
|
minDate = new Date(2000, 0, 1);
|
||||||
@@ -30,8 +31,6 @@ export class BusinessDateTabComponent implements OnInit {
|
|||||||
cobDate = new Date();
|
cobDate = new Date();
|
||||||
/** business Date form. */
|
/** business Date form. */
|
||||||
businessDateForm: FormGroup;
|
businessDateForm: FormGroup;
|
||||||
/** Configuration data. */
|
|
||||||
configurations: any;
|
|
||||||
/** Business data. */
|
/** Business data. */
|
||||||
businessDateData: any;
|
businessDateData: any;
|
||||||
|
|
||||||
@@ -42,17 +41,29 @@ export class BusinessDateTabComponent implements OnInit {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the configurations data from `resolve`.
|
* Retrieves the configurations data from `resolve`.
|
||||||
* @param {ActivatedRoute} route Activated Route.
|
|
||||||
* @param {SystemService} systemService System Service.
|
* @param {SystemService} systemService System Service.
|
||||||
* @param {Router} router Router for navigation.
|
* @param {SettingsService} settingsService Settings Service.
|
||||||
|
* @param {FormBuilder} formBuilder Form Builder.
|
||||||
|
* @param {Dates} dateUtils Date Utils.
|
||||||
*/
|
*/
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(
|
||||||
private systemService: SystemService,
|
private systemService: SystemService,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
private dateUtils: Dates) {}
|
private dateUtils: Dates,
|
||||||
|
private alertService: AlertService) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
this.alert$ = this.alertService.alertEvent.subscribe((alertEvent: Alert) => {
|
||||||
|
const alertType = alertEvent.type;
|
||||||
|
if (alertType === SettingsService.businessDateType + ' Set Config') {
|
||||||
|
this.isBusinessDateEnabled = (alertEvent.message === 'enabled') ? true : false;
|
||||||
|
if (this.isBusinessDateEnabled) {
|
||||||
|
this.setBusinessDates();
|
||||||
|
this.createBusinessDateForm();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
this.userDateFormat = this.settingsService.dateFormat;
|
this.userDateFormat = this.settingsService.dateFormat;
|
||||||
this.getConfigurations();
|
this.getConfigurations();
|
||||||
this.createBusinessDateForm();
|
this.createBusinessDateForm();
|
||||||
@@ -61,31 +72,26 @@ export class BusinessDateTabComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* Get the Configuration and the Business Date data
|
* Get the Configuration and the Business Date data
|
||||||
*/
|
*/
|
||||||
getConfigurations(): void {
|
getConfigurations(): void {
|
||||||
this.systemService.getConfigurations()
|
this.systemService.getConfigurationByName(SettingsService.businessDateConfigName)
|
||||||
.subscribe((configurationData: any) => {
|
.subscribe((configurationData: any) => {
|
||||||
this.configurations = configurationData.globalConfiguration;
|
this.isBusinessDateEnabled = configurationData.enabled;
|
||||||
this.validateBusinessDateStatus();
|
|
||||||
if (this.isBusinessDateEnabled) {
|
if (this.isBusinessDateEnabled) {
|
||||||
this.systemService.getBusinessDates()
|
this.setBusinessDates();
|
||||||
.subscribe((businessDateData: any) => {
|
|
||||||
this.businessDateData = businessDateData;
|
|
||||||
this.setBusinessDates();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
setBusinessDates(): void {
|
||||||
* Set the Business Date and COB Date.
|
this.systemService.getBusinessDates()
|
||||||
*/
|
.subscribe((businessDateData: any) => {
|
||||||
setBusinessDates() {
|
businessDateData.forEach((data: any) => {
|
||||||
this.businessDateData.forEach((data: any) => {
|
if (data.type === SettingsService.businessDateType) {
|
||||||
if (data.type === this.businessDateType) {
|
this.businessDate = new Date(data.date);
|
||||||
this.businessDate = new Date(data.date);
|
} else {
|
||||||
} else {
|
this.cobDate = new Date(data.date);
|
||||||
this.cobDate = new Date(data.date);
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,18 +105,6 @@ export class BusinessDateTabComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate If the enable_business_date configuration is enabled or disabled.
|
|
||||||
*/
|
|
||||||
validateBusinessDateStatus(): void {
|
|
||||||
this.isBusinessDateEnabled = false;
|
|
||||||
this.configurations.forEach((config: any) => {
|
|
||||||
if (config.name === this.configurationName) {
|
|
||||||
this.isBusinessDateEnabled = config.enabled;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to display or not the datepicker control to set the Business Date value
|
* Flag to display or not the datepicker control to set the Business Date value
|
||||||
*/
|
*/
|
||||||
@@ -123,9 +117,9 @@ export class BusinessDateTabComponent implements OnInit {
|
|||||||
const locale = this.settingsService.language.code;
|
const locale = this.settingsService.language.code;
|
||||||
const dateFormat = this.settingsService.dateFormat;
|
const dateFormat = this.settingsService.dateFormat;
|
||||||
const prevBusinessDate: Date = this.businessDateForm.value.businessDate;
|
const prevBusinessDate: Date = this.businessDateForm.value.businessDate;
|
||||||
let dateType = this.businessDateType;
|
let dateType = SettingsService.businessDateType;
|
||||||
if (this.dateIndex === 1) {
|
if (this.dateIndex === 1) {
|
||||||
dateType = this.cobDateType;
|
dateType = SettingsService.cobDateType;
|
||||||
}
|
}
|
||||||
const data = {
|
const data = {
|
||||||
date: this.dateUtils.formatDate(prevBusinessDate, dateFormat),
|
date: this.dateUtils.formatDate(prevBusinessDate, dateFormat),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<mat-tab label="Global Configurations">
|
<mat-tab label="Global Configurations">
|
||||||
<mifosx-global-configurations-tab></mifosx-global-configurations-tab>
|
<mifosx-global-configurations-tab></mifosx-global-configurations-tab>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
<mat-tab label="Business Date">
|
<mat-tab label="Business Date" *ngIf="isBusinessDateEnabled">
|
||||||
<mifosx-business-date-tab></mifosx-business-date-tab>
|
<mifosx-business-date-tab></mifosx-business-date-tab>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Alert } from 'app/core/alert/alert.model';
|
||||||
|
import { AlertService } from 'app/core/alert/alert.service';
|
||||||
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
|
import { Subscription } from 'rxjs';
|
||||||
|
import { SystemService } from '../system.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-configurations',
|
selector: 'mifosx-configurations',
|
||||||
@@ -6,10 +11,31 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
styleUrls: ['./configurations.component.scss']
|
styleUrls: ['./configurations.component.scss']
|
||||||
})
|
})
|
||||||
export class ConfigurationsComponent implements OnInit {
|
export class ConfigurationsComponent implements OnInit {
|
||||||
|
/** Subscription to alerts. */
|
||||||
|
alert$: Subscription;
|
||||||
|
|
||||||
constructor() { }
|
isBusinessDateEnabled = false;
|
||||||
|
|
||||||
|
constructor(private alertService: AlertService,
|
||||||
|
private systemService: SystemService) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
this.alert$ = this.alertService.alertEvent.subscribe((alertEvent: Alert) => {
|
||||||
|
const alertType = alertEvent.type;
|
||||||
|
if (alertType === SettingsService.businessDateType + ' Set Config') {
|
||||||
|
this.isBusinessDateEnabled = (alertEvent.message === 'enabled') ? true : false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.getConfigurations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Configuration and the Business Date data
|
||||||
|
*/
|
||||||
|
getConfigurations(): void {
|
||||||
|
this.systemService.getConfigurationByName(SettingsService.businessDateConfigName)
|
||||||
|
.subscribe((configurationData: any) => {
|
||||||
|
this.isBusinessDateEnabled = configurationData.enabled;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-2
@@ -3,7 +3,8 @@ import { Component, OnInit, ViewChild } from '@angular/core';
|
|||||||
import { MatPaginator } from '@angular/material/paginator';
|
import { MatPaginator } from '@angular/material/paginator';
|
||||||
import { MatSort } from '@angular/material/sort';
|
import { MatSort } from '@angular/material/sort';
|
||||||
import { MatTableDataSource } from '@angular/material/table';
|
import { MatTableDataSource } from '@angular/material/table';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { AlertService } from 'app/core/alert/alert.service';
|
||||||
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
|
|
||||||
/** Custom Services */
|
/** Custom Services */
|
||||||
import { SystemService } from '../../system.service';
|
import { SystemService } from '../../system.service';
|
||||||
@@ -33,7 +34,7 @@ export class GlobalConfigurationsTabComponent implements OnInit {
|
|||||||
* @param {SystemService} systemService System Service.
|
* @param {SystemService} systemService System Service.
|
||||||
* @param {Router} router Router for navigation.
|
* @param {Router} router Router for navigation.
|
||||||
*/
|
*/
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private alertService: AlertService,
|
||||||
private systemService: SystemService) {
|
private systemService: SystemService) {
|
||||||
this.configurationData = this.systemService.getConfigurations();
|
this.configurationData = this.systemService.getConfigurations();
|
||||||
}
|
}
|
||||||
@@ -73,6 +74,10 @@ export class GlobalConfigurationsTabComponent implements OnInit {
|
|||||||
this.systemService.updateConfiguration(configuration.id, { enabled: !configuration.enabled })
|
this.systemService.updateConfiguration(configuration.id, { enabled: !configuration.enabled })
|
||||||
.subscribe((response: any) => {
|
.subscribe((response: any) => {
|
||||||
configuration.enabled = response.changes.enabled;
|
configuration.enabled = response.changes.enabled;
|
||||||
|
if (configuration.name === SettingsService.businessDateConfigName) {
|
||||||
|
const msg = configuration.enabled ? 'enabled' : 'disabled';
|
||||||
|
this.alertService.alert({type: SettingsService.businessDateType + ' Set Config', message: msg});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -331,10 +331,17 @@ export class SystemService {
|
|||||||
/**
|
/**
|
||||||
* @returns {Observable<any>} Business Date data.
|
* @returns {Observable<any>} Business Date data.
|
||||||
*/
|
*/
|
||||||
getBusinessDates(): Observable<any> {
|
getBusinessDates(): Observable<any> {
|
||||||
return this.http.get('/businessdate');
|
return this.http.get('/businessdate');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {Observable<any>} Business Date data using a type BUSINESS_DATE / COB_DATE.
|
||||||
|
*/
|
||||||
|
getBusinessDate(dateType: string): Observable<any> {
|
||||||
|
return this.http.get(`/businessdate/${dateType}`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {any} dateData Business Date data to be updated.
|
* @param {any} dateData Business Date data to be updated.
|
||||||
* @returns {Observable<any>}
|
* @returns {Observable<any>}
|
||||||
@@ -358,6 +365,14 @@ export class SystemService {
|
|||||||
return this.http.get(`/configurations/${configurationId}`);
|
return this.http.get(`/configurations/${configurationId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} configurationId Configuration ID of configuration.
|
||||||
|
* @returns {Observable<any>} Configuration.
|
||||||
|
*/
|
||||||
|
getConfigurationByName(configurationName: string): Observable<any> {
|
||||||
|
return this.http.get(`/configurations/name/${configurationName}`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} configurationId Configuration ID of configuration to be updated.
|
* @param {string} configurationId Configuration ID of configuration to be updated.
|
||||||
* @param {any} configuration Configuration to be updated.
|
* @param {any} configuration Configuration to be updated.
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { TestBed, async } from '@angular/core/testing';
|
import { TestBed, async } from '@angular/core/testing';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
|
||||||
|
|
||||||
import { CoreModule } from './core/core.module';
|
import { CoreModule } from './core/core.module';
|
||||||
import { WebAppComponent } from './web-app.component';
|
import { WebAppComponent } from './web-app.component';
|
||||||
@@ -10,7 +9,6 @@ describe('AppComponent', () => {
|
|||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
RouterTestingModule,
|
RouterTestingModule,
|
||||||
TranslateModule.forRoot(),
|
|
||||||
CoreModule
|
CoreModule
|
||||||
],
|
],
|
||||||
declarations: [WebAppComponent],
|
declarations: [WebAppComponent],
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export class WebAppComponent implements OnInit {
|
|||||||
* @param {ThemeStorageService} themeStorageService Theme Storage Service.
|
* @param {ThemeStorageService} themeStorageService Theme Storage Service.
|
||||||
* @param {MatSnackBar} snackBar Material Snackbar for notifications.
|
* @param {MatSnackBar} snackBar Material Snackbar for notifications.
|
||||||
* @param {AlertService} alertService Alert Service.
|
* @param {AlertService} alertService Alert Service.
|
||||||
|
* @param {SettingsService} settingsService Settings Service.
|
||||||
* @param {AuthenticationService} authenticationService Authentication service.
|
* @param {AuthenticationService} authenticationService Authentication service.
|
||||||
*/
|
*/
|
||||||
constructor(private router: Router,
|
constructor(private router: Router,
|
||||||
@@ -82,7 +83,7 @@ export class WebAppComponent implements OnInit {
|
|||||||
log.debug('init');
|
log.debug('init');
|
||||||
|
|
||||||
// Setup translations
|
// Setup translations
|
||||||
this.translateService.addLangs(environment.supportedLanguages);
|
this.translateService.addLangs(environment.supportedLanguages.split(','));
|
||||||
this.translateService.use(environment.defaultLanguage);
|
this.translateService.use(environment.defaultLanguage);
|
||||||
|
|
||||||
// Change page title on navigation or language change, based on route data
|
// Change page title on navigation or language change, based on route data
|
||||||
@@ -142,17 +143,8 @@ export class WebAppComponent implements OnInit {
|
|||||||
if (!localStorage.getItem('mifosXDateFormat')) {
|
if (!localStorage.getItem('mifosXDateFormat')) {
|
||||||
this.settingsService.setDateFormat('dd MMMM yyyy');
|
this.settingsService.setDateFormat('dd MMMM yyyy');
|
||||||
}
|
}
|
||||||
if (!localStorage.getItem('mifosXServers')) {
|
// Set the server list from the env var FINERACT_API_URLS
|
||||||
this.settingsService.setServers([
|
this.settingsService.setServers(environment.baseApiUrls.split(','));
|
||||||
'https://dev.mifos.io',
|
|
||||||
'https://demo.mifos.io',
|
|
||||||
'https://qa.mifos.io',
|
|
||||||
'https://staging.mifos.io',
|
|
||||||
'https://mobile.mifos.io',
|
|
||||||
'https://demo.fineract.dev',
|
|
||||||
'https://localhost:8443'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
(function(window) {
|
||||||
|
window["env"] = window["env"] || {};
|
||||||
|
|
||||||
|
// BackEnd Environment variables
|
||||||
|
window["env"]["fineractApiUrls"] = 'https://localhost:8443';
|
||||||
|
window["env"]["fineractApiUrl"] = 'https://localhost:8443';
|
||||||
|
|
||||||
|
window["env"]["apiProvider"] = '/fineract-provider/api';
|
||||||
|
window["env"]["apiVersion"] = '/v1';
|
||||||
|
|
||||||
|
window["env"]["fineractPlatformTenantId"] = '';
|
||||||
|
|
||||||
|
// Language Environment variables
|
||||||
|
window["env"]["defaultLanguage"] = '';
|
||||||
|
window["env"]["supportedLanguages"] = '';
|
||||||
|
})(this);
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
(function(window) {
|
||||||
|
window["env"] = window["env"] || {};
|
||||||
|
|
||||||
|
// BackEnd Environment variables
|
||||||
|
window["env"]["fineractApiUrls"] = '$FINERACT_API_URLS';
|
||||||
|
window["env"]["fineractApiUrl"] = '$FINERACT_API_URL';
|
||||||
|
|
||||||
|
window["env"]["apiProvider"] = '$FINERACT_API_PROVIDER';
|
||||||
|
window["env"]["apiVersion"] = '$FINERACT_API_VERSION';
|
||||||
|
|
||||||
|
window["env"]["fineractPlatformTenantId"] = '$FINERACT_PLATFORM_TENANT_IDENTIFIER';
|
||||||
|
|
||||||
|
// Language Environment variables
|
||||||
|
window["env"]["defaultLanguage"] = '$MIFOS_DEFAULT_LANGUAGE';
|
||||||
|
window["env"]["supportedLanguages"] = '$MIFOS_SUPPORTED_LANGUAGES';
|
||||||
|
})(this);
|
||||||
@@ -27,3 +27,7 @@ textarea.noresize {
|
|||||||
.full-input [type="radio"] {
|
.full-input [type="radio"] {
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mat-tab-body-content {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,5 +16,7 @@
|
|||||||
"Reports": "Reports",
|
"Reports": "Reports",
|
||||||
"Admin": "Admin",
|
"Admin": "Admin",
|
||||||
"Self Service": "Self Service",
|
"Self Service": "Self Service",
|
||||||
"Institution": "Institution"
|
"Institution": "Institution",
|
||||||
|
"Language": "Language",
|
||||||
|
"Server": "Server"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,5 +16,7 @@
|
|||||||
"Reports": "Rapports",
|
"Reports": "Rapports",
|
||||||
"Admin": "Admin",
|
"Admin": "Admin",
|
||||||
"Self Service": "En libre service",
|
"Self Service": "En libre service",
|
||||||
"Institution": "Institution"
|
"Institution": "Institution",
|
||||||
|
"Language": "Langue",
|
||||||
|
"Server": "Serveur"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
||||||
|
/* tslint:disable */
|
||||||
export default {
|
export default {
|
||||||
'mifos_x_version': '0.0.0',
|
'mifos_x': {
|
||||||
|
'version': '0.0.0',
|
||||||
|
'hash': '79efe55'
|
||||||
|
},
|
||||||
'allow_switching_backend_instance': true
|
'allow_switching_backend_instance': true
|
||||||
};
|
};
|
||||||
|
/* tslint:enable */
|
||||||
|
|||||||
@@ -3,22 +3,25 @@ import env from './.env';
|
|||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: true,
|
production: true,
|
||||||
version: env.mifos_x_version,
|
version: env.mifos_x.version,
|
||||||
fineractPlatformTenantId: 'default', // For connecting to server running elsewhere update the tenant identifier
|
hash: env.mifos_x.hash,
|
||||||
baseApiUrl: JSON.parse(localStorage.getItem('mifosXServerURL')) || 'https://demo.fineract.dev', // For connecting to server running elsewhere update the base API URL
|
// For connecting to server running elsewhere update the tenant identifier
|
||||||
|
fineractPlatformTenantId: window['env']['fineractPlatformTenantId'] || 'default',
|
||||||
|
// For connecting to others servers running elsewhere update the base API URL
|
||||||
|
baseApiUrls: window['env']['fineractApiUrls'] ||
|
||||||
|
'https://dev.mifos.io,https://demo.mifos.io,https://qa.mifos.io,https://staging.mifos.io,https://mobile.mifos.io,https://demo.fineract.dev,https://localhost:8443',
|
||||||
|
// For connecting to server running elsewhere set the base API URL
|
||||||
|
baseApiUrl: window['env']['baseApiUrl'] || 'https://demo.fineract.dev',
|
||||||
allowServerSwitch: env.allow_switching_backend_instance,
|
allowServerSwitch: env.allow_switching_backend_instance,
|
||||||
apiProvider: '/fineract-provider/api',
|
apiProvider: window['env']['apiProvider'] || '/fineract-provider/api',
|
||||||
apiVersion: '/v1',
|
apiVersion: window['env']['apiVersion'] || '/v1',
|
||||||
serverUrl: '',
|
serverUrl: '',
|
||||||
oauth: {
|
oauth: {
|
||||||
enabled: false, // For connecting to Mifos X using OAuth2 Authentication change the value to true
|
enabled: false, // For connecting to Mifos X using OAuth2 Authentication change the value to true
|
||||||
serverUrl: ''
|
serverUrl: ''
|
||||||
},
|
},
|
||||||
defaultLanguage: 'en-US',
|
defaultLanguage: window['env']['defaultLanguage'] || 'en-US',
|
||||||
supportedLanguages: [
|
supportedLanguages: window['env']['supportedLanguages'] || 'en-US,fr-FR'
|
||||||
'en-US',
|
|
||||||
'fr-FR'
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Server URL
|
// Server URL
|
||||||
|
|||||||
@@ -8,22 +8,25 @@ import env from './.env';
|
|||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
version: env.mifos_x_version,
|
version: env.mifos_x.version,
|
||||||
fineractPlatformTenantId: 'default', // For connecting to server running elsewhere update the tenant identifier
|
hash: env.mifos_x.hash,
|
||||||
baseApiUrl: JSON.parse(localStorage.getItem('mifosXServerURL')) || 'https://dev.mifos.io', // For connecting to server running elsewhere update the base API URL
|
// For connecting to server running elsewhere update the tenant identifier
|
||||||
|
fineractPlatformTenantId: window['env']['fineractPlatformTenantId'] || 'default',
|
||||||
|
// For connecting to others servers running elsewhere update the base API URL
|
||||||
|
baseApiUrls: window['env']['fineractApiUrls'] ||
|
||||||
|
'https://dev.mifos.io,https://demo.mifos.io,https://qa.mifos.io,https://staging.mifos.io,https://mobile.mifos.io,https://demo.fineract.dev,https://localhost:8443',
|
||||||
|
// For connecting to server running elsewhere set the base API URL
|
||||||
|
baseApiUrl: window['env']['baseApiUrl'] || 'https://demo.fineract.dev',
|
||||||
allowServerSwitch: env.allow_switching_backend_instance,
|
allowServerSwitch: env.allow_switching_backend_instance,
|
||||||
apiProvider: '/fineract-provider/api',
|
apiProvider: window['env']['apiProvider'] || '/fineract-provider/api',
|
||||||
apiVersion: '/v1',
|
apiVersion: window['env']['apiVersion'] || '/v1',
|
||||||
serverUrl: '',
|
serverUrl: '',
|
||||||
oauth: {
|
oauth: {
|
||||||
enabled: false, // For connecting to Mifos X using OAuth2 Authentication change the value to true
|
enabled: false, // For connecting to Mifos X using OAuth2 Authentication change the value to true
|
||||||
serverUrl: ''
|
serverUrl: ''
|
||||||
},
|
},
|
||||||
defaultLanguage: 'en-US',
|
defaultLanguage: window['env']['defaultLanguage'] || 'en-US',
|
||||||
supportedLanguages: [
|
supportedLanguages: window['env']['supportedLanguages'] || 'en-US,fr-FR'
|
||||||
'en-US',
|
|
||||||
'fr-FR'
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Server URL
|
// Server URL
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Roboto+Mono:300" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Roboto+Mono:300" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
|
||||||
|
<!-- Load environment variables -->
|
||||||
|
<script src="assets/env.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
// Karma configuration file, see link for more information
|
|
||||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
||||||
|
|
||||||
process.env.CHROME_BIN = require('puppeteer').executablePath();
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
module.exports = function(config) {
|
|
||||||
config.set({
|
|
||||||
basePath: '..',
|
|
||||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
||||||
plugins: [
|
|
||||||
require('karma-jasmine'),
|
|
||||||
require('karma-chrome-launcher'),
|
|
||||||
require('karma-junit-reporter'),
|
|
||||||
require('karma-coverage-istanbul-reporter'),
|
|
||||||
require('@angular-devkit/build-angular/plugins/karma')
|
|
||||||
],
|
|
||||||
client: {
|
|
||||||
clearContext: false, // leave Jasmine Spec Runner output visible in browser
|
|
||||||
captureConsole: Boolean(process.env.KARMA_ENABLE_CONSOLE)
|
|
||||||
},
|
|
||||||
junitReporter: {
|
|
||||||
outputDir: path.join(__dirname, '../reports/junit/'),
|
|
||||||
outputFile: 'TESTS-xunit.xml',
|
|
||||||
useBrowserName: false,
|
|
||||||
suite: '' // Will become the package name attribute in xml testsuite element
|
|
||||||
},
|
|
||||||
coverageIstanbulReporter: {
|
|
||||||
reports: ['html', 'lcovonly', 'text-summary'],
|
|
||||||
dir: path.join(__dirname, '../reports/coverage'),
|
|
||||||
fixWebpackSourcePaths: true
|
|
||||||
},
|
|
||||||
angularCli: {
|
|
||||||
environment: 'dev'
|
|
||||||
},
|
|
||||||
reporters: ['progress', 'junit'],
|
|
||||||
port: 9876,
|
|
||||||
colors: true,
|
|
||||||
// Level of logging, can be: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
|
|
||||||
logLevel: config.LOG_INFO,
|
|
||||||
autoWatch: true,
|
|
||||||
browsers: ['ChromeHeadless'],
|
|
||||||
singleRun: false
|
|
||||||
});
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
// Karma configuration
|
||||||
|
|
||||||
|
module.exports = (config: any) => {
|
||||||
|
config.set({
|
||||||
|
|
||||||
|
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||||
|
basePath: '..',
|
||||||
|
|
||||||
|
|
||||||
|
// frameworks to use
|
||||||
|
// available frameworks: https://www.npmjs.com/search?q=keywords:karma-adapter
|
||||||
|
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||||
|
|
||||||
|
|
||||||
|
// list of files / patterns to load in the browser
|
||||||
|
files: [
|
||||||
|
'src/**/*spec.ts',
|
||||||
|
'src/**/*.ts',
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
// list of files / patterns to exclude
|
||||||
|
exclude: [
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
// preprocess matching files before serving them to the browser
|
||||||
|
// available preprocessors: https://www.npmjs.com/search?q=keywords:karma-preprocessor
|
||||||
|
preprocessors: {
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// test results reporter to use
|
||||||
|
// possible values: 'dots', 'progress'
|
||||||
|
// available reporters: https://www.npmjs.com/search?q=keywords:karma-reporter
|
||||||
|
reporters: ['progress'],
|
||||||
|
|
||||||
|
|
||||||
|
// web server port
|
||||||
|
port: 9876,
|
||||||
|
|
||||||
|
|
||||||
|
// enable / disable colors in the output (reporters and logs)
|
||||||
|
colors: true,
|
||||||
|
|
||||||
|
|
||||||
|
// level of logging
|
||||||
|
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||||
|
logLevel: config.LOG_INFO,
|
||||||
|
|
||||||
|
|
||||||
|
// enable / disable watching file and executing tests whenever any file changes
|
||||||
|
autoWatch: true,
|
||||||
|
|
||||||
|
|
||||||
|
// start these browsers
|
||||||
|
// available browser launchers: https://www.npmjs.com/search?q=keywords:karma-launcher
|
||||||
|
browsers: ['Chrome'],
|
||||||
|
customLaunchers: {
|
||||||
|
ChromeHeadlessCI: {
|
||||||
|
base: 'ChromeHeadless',
|
||||||
|
flags: ['--no-sandbox']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Continuous Integration mode
|
||||||
|
// if true, Karma captures browsers, runs the tests and exits
|
||||||
|
singleRun: true,
|
||||||
|
|
||||||
|
// Concurrency level
|
||||||
|
// how many browser instances should be started simultaneously
|
||||||
|
concurrency: Infinity,
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
require('karma-jasmine'),
|
||||||
|
require('karma-chrome-launcher'),
|
||||||
|
require('karma-jasmine-html-reporter'),
|
||||||
|
require('karma-coverage'),
|
||||||
|
require('@angular-devkit/build-angular/plugins/karma'),
|
||||||
|
],
|
||||||
|
|
||||||
|
reporter: ['progress', 'kjhtml']
|
||||||
|
})
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
const { gitDescribeSync } = require('git-describe');
|
||||||
|
const { version } = require('./package.json');
|
||||||
|
const { resolve, relative } = require('path');
|
||||||
|
const { writeFileSync } = require('fs-extra');
|
||||||
|
|
||||||
|
const gitInfo = gitDescribeSync({
|
||||||
|
dirtyMark: false,
|
||||||
|
dirtySemver: false
|
||||||
|
});
|
||||||
|
|
||||||
|
gitInfo.version = version;
|
||||||
|
|
||||||
|
const file = resolve(__dirname, '.', 'src', 'environments', '.env.ts');
|
||||||
|
writeFileSync(file,
|
||||||
|
`// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
||||||
|
/* tslint:disable */
|
||||||
|
export default {
|
||||||
|
'mifos_x': {
|
||||||
|
'version': '${gitInfo.version}',
|
||||||
|
'hash': '${gitInfo.hash}'
|
||||||
|
},
|
||||||
|
'allow_switching_backend_instance': true
|
||||||
|
};
|
||||||
|
/* tslint:enable */
|
||||||
|
`, { encoding: 'utf-8' });
|
||||||
|
|
||||||
|
console.log(`Wrote version info ${gitInfo.raw} to ${relative(resolve(__dirname, '..'), file)}`);
|
||||||
Reference in New Issue
Block a user