Compare commits
264 Commits
Author | SHA1 | Date | |
---|---|---|---|
dc3a6ae6a1 | |||
f668b1e7f7 | |||
eb1c09d790 | |||
9bf324c74b | |||
f13e909478 | |||
6a0fe287dd | |||
5a48f2e6e3 | |||
6565834ad4 | |||
837821fd01 | |||
cff5989559 | |||
60510a4d68 | |||
2b54034973 | |||
347b0f9065 | |||
eac0104d7a | |||
1c8e4604de | |||
e9624635ed | |||
f9beda1ddb | |||
53400de110 | |||
cf37ddab22 | |||
625af199f4 | |||
56e9217f4b | |||
86f1af7926 | |||
7737f8455d | |||
b0f1677fcc | |||
4406e0d4b4 | |||
cf19381060 | |||
802d8a3b08 | |||
2a852496e9 | |||
4653097225 | |||
8afee29e02 | |||
233eca39ef | |||
1a96bb1233 | |||
93702c63dc | |||
df065562d1 | |||
802c99adf9 | |||
482c7455f5 | |||
731b96dccc | |||
9550ae4d11 | |||
2d6e747db9 | |||
fd94945466 | |||
d3b0c09332 | |||
01915a2db9 | |||
51b043b6d2 | |||
c144fd8087 | |||
12b15df78c | |||
d6ecd12cea | |||
1c3d498da6 | |||
d75e10aef5 | |||
f0f9d85558 | |||
86f3411896 | |||
6daef39268 | |||
7d1720a360 | |||
b11a4884b4 | |||
50696bb926 | |||
d67d4e2f86 | |||
2f01c4d251 | |||
9ffa30ab74 | |||
5d93346b52 | |||
39762b36c6 | |||
e40ebdff05 | |||
8d12d9e51e | |||
23708c9aae | |||
c86fba9dc7 | |||
e747e6e4e7 | |||
5aec024242 | |||
b473b198a6 | |||
516e5a2062 | |||
fb3abbe491 | |||
3e009f3037 | |||
e63d304953 | |||
3cd90c2d47 | |||
a485c3b787 | |||
2702bb3c84 | |||
56264ecc69 | |||
cc4535245c | |||
6ae31de1dd | |||
2d4d068413 | |||
271543a446 | |||
8f796aec36 | |||
6eb1aa85d2 | |||
ac59b77ad5 | |||
3efccc4cf3 | |||
8cbcd18f4b | |||
6bb2378790 | |||
e7d0ffe8c0 | |||
ab89600c73 | |||
830e3816a0 | |||
dadac4f13f | |||
1de48a49af | |||
687a1e1cb5 | |||
665a04f5c5 | |||
fdb18d242b | |||
ec173da4ce | |||
bb35cc15d2 | |||
181f52eaea | |||
fc7c8101ed | |||
a347603fe0 | |||
09022c995f | |||
3609943f30 | |||
a1d308ea07 | |||
5579db0eaf | |||
3a3e488b23 | |||
0a82ec0a70 | |||
bc1d89218e | |||
817b9adeac | |||
a7aa42a59b | |||
34f239036d | |||
91f128c2fe | |||
a00ebea692 | |||
c27cdab3fc | |||
d7da2d7890 | |||
76f0fd4232 | |||
008b45ad17 | |||
4d49263816 | |||
6a2482e5c6 | |||
b5c3fb2af4 | |||
fa2c8eb839 | |||
f3e82b4ee2 | |||
ba67248155 | |||
a6d962bfaa | |||
95cddb52d4 | |||
5a5118d775 | |||
1b1cdd7a4b | |||
a9ddf7f7dd | |||
b54b3f1778 | |||
349a63c591 | |||
293d33912f | |||
357b9849e7 | |||
0c8a9eef32 | |||
112b1d0da4 | |||
a05007416a | |||
9f7dd55583 | |||
11b06f6416 | |||
adb7eb7755 | |||
b776b80728 | |||
73a149ea7b | |||
ef8784093b | |||
b30c788e3d | |||
23899bdff3 | |||
8bd0dd22c2 | |||
c55b00c74f | |||
c895f509b0 | |||
5968915331 | |||
44ffc082f6 | |||
b716ae5675 | |||
01a0b59494 | |||
8ebc3da0bb | |||
133577a4fa | |||
a19615db41 | |||
32b212a6bf | |||
00ec4529cd | |||
102d03888f | |||
9f8247320e | |||
ef871de30e | |||
b3a15ce26b | |||
270695aec2 | |||
ad7392a326 | |||
92a50a42e2 | |||
a3a8856d8c | |||
150c19b1b0 | |||
f04c51ee4e | |||
c4338bf957 | |||
5b06f4ede8 | |||
e7ab2cc956 | |||
5ebf8a66f7 | |||
3d4e886b9b | |||
a00d31caf3 | |||
40fe707287 | |||
8296be01ba | |||
dbeb003292 | |||
f048501c48 | |||
498350b3f3 | |||
91e82c9c65 | |||
24067ea82b | |||
aa7deddba0 | |||
b2d13203d1 | |||
19c1092b5b | |||
94ab949df8 | |||
9eb2451c2f | |||
6e521bfa3e | |||
239720fe0c | |||
8571e01e44 | |||
6f482ec6d9 | |||
5e30dc0f89 | |||
3d76d12c86 | |||
93f1b81d70 | |||
e2b65ddd82 | |||
b64bbe91d4 | |||
1f2ce55f24 | |||
921157da9e | |||
413acf7d05 | |||
725f75aa74 | |||
c64ab8a577 | |||
1154c99e0a | |||
5bcdef77b8 | |||
e4a0089102 | |||
ba022d8a35 | |||
c8ac859d2e | |||
d6fd72e880 | |||
61cc360c85 | |||
08e39c4fca | |||
8c2ee441fc | |||
0a7d23c763 | |||
7b54fff26e | |||
cd3e0f614b | |||
81c0aec202 | |||
3193bdd720 | |||
b9a12454e1 | |||
01a857f7c6 | |||
2bb2eee80e | |||
c054ea500d | |||
d7f8201246 | |||
622cfcc6fe | |||
303240e4d2 | |||
a8b849aede | |||
ca281b70c9 | |||
e056ece223 | |||
0ae35214fb | |||
34ffac39cb | |||
52d4b3eefc | |||
908d2761f2 | |||
7c98ad8c5b | |||
5bb55e6484 | |||
e48e47bc63 | |||
2a3f4f755c | |||
ddfae9227c | |||
c74378423d | |||
0e020623a5 | |||
eeb4000efe | |||
2053c858ac | |||
4c2c5d5526 | |||
7ccc745eb2 | |||
e93367fb42 | |||
250fb1e8cf | |||
1c2b87940d | |||
25fed203c6 | |||
bba2a6cc9d | |||
b036cc2abe | |||
218b15918d | |||
19489a68a7 | |||
7d7061a78a | |||
1aceb297ba | |||
cdee7480c2 | |||
bb2fb235aa | |||
b2f88e203a | |||
c2f1af99ef | |||
00e9dff1d9 | |||
82d74e6fee | |||
f1e2770574 | |||
5ce1701657 | |||
2f79487aea | |||
fefdfaf17b | |||
c1e6f71430 | |||
a8310fa63f | |||
e28ac814b8 | |||
45fed59a65 | |||
310399112b | |||
01238fc8a9 | |||
365e46c568 | |||
8d336e5b46 | |||
54fe7013b1 | |||
8dc40bdd4e | |||
d88ab8bf58 | |||
67030ab033 |
@ -1,5 +1,5 @@
|
||||
name: Build
|
||||
run-name: Building and testing DC
|
||||
run-name: Running Lint Check and Licence checker on Pull Request
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
@ -18,21 +18,11 @@ jobs:
|
||||
env:
|
||||
NPMRC: ${{ secrets.NPMRC}}
|
||||
|
||||
- run: apt-get update
|
||||
- run: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||
- run: apt install -y ./google-chrome*.deb;
|
||||
- run: export CHROME_BIN=/usr/bin/google-chrome
|
||||
- run: npm run lint:check
|
||||
# Install dependencies~
|
||||
- run: npm ci --legacy-peer-deps
|
||||
# Audit should fail and stop the CI if critical vulnerability found
|
||||
- run: npm audit --audit-level=critical
|
||||
- run: |
|
||||
cd ./sas
|
||||
npm audit --audit-level=critical
|
||||
- run: |
|
||||
cd ./client
|
||||
npm audit --audit-level=critical
|
||||
npm test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
|
||||
npm run postinstall
|
||||
npm run build
|
||||
- name: Lint check
|
||||
run: npm run lint:check
|
||||
|
||||
- name: Licence checker
|
||||
run: |
|
||||
cd client
|
||||
npm ci
|
||||
npm run license-checker
|
@ -1,172 +0,0 @@
|
||||
name: Test
|
||||
run-name: Building and testing development branch
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- development
|
||||
|
||||
jobs:
|
||||
Build-and-test-development:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Write .npmrc file
|
||||
run: echo "$NPMRC" > client/.npmrc
|
||||
shell: bash
|
||||
env:
|
||||
NPMRC: ${{ secrets.NPMRC}}
|
||||
|
||||
- run: apt-get update
|
||||
- run: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||
- run: apt install -y ./google-chrome*.deb;
|
||||
- run: export CHROME_BIN=/usr/bin/google-chrome
|
||||
- run: apt-get update -y
|
||||
- run: apt-get -y install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
|
||||
- run: apt -y install jq
|
||||
# - run: 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||
# - run: eval $(ssh-agent -s)
|
||||
# - run: echo "$ssh_key" | tr -d '\r' | ssh-add -
|
||||
- name: Write cypress credentials
|
||||
run: echo "$CYPRESS_CREDS" > ./client/cypress.env.json
|
||||
shell: bash
|
||||
env:
|
||||
CYPRESS_CREDS: ${{ secrets.CYPRESS_CREDS }}
|
||||
|
||||
# - run: mkdir -p ~/.ssh
|
||||
# - run: chmod 700 ~/.ssh
|
||||
- run: npm ci --legacy-peer-deps
|
||||
# Install pm2 and prepare SASJS server
|
||||
- run: npm i -g pm2
|
||||
- run: curl -L https://github.com/sasjs/server/releases/latest/download/linux.zip > linux.zip
|
||||
- run: unzip linux.zip
|
||||
- run: touch .env
|
||||
- run: echo RUN_TIMES=js >> .env
|
||||
- run: echo NODE_PATH=node >> .env
|
||||
- run: echo CORS=enable >> .env
|
||||
- run: echo WHITELIST=http://localhost:4200 >> .env
|
||||
# - run: echo "SERVER_URL=$server_url" >> .env
|
||||
# - run: echo "SERVER_TYPE=$server_type" >> .env
|
||||
# - run: echo "CLIENT=$client_sasjs" >> .env
|
||||
# - run: echo "ACCESS_TOKEN=$access_token_sasjs" >> .env
|
||||
# - run: echo "REFRESH_TOKEN=$refresh_token_sasjs" >> .env
|
||||
# - run: cat .env
|
||||
- run: pm2 start api-linux --wait-ready
|
||||
|
||||
- name: Deploy mocked services
|
||||
run: |
|
||||
cd ./sas/mocks/sasjs
|
||||
npm install --legacy-peer-deps -g @sasjs/cli
|
||||
npm install --legacy-peer-deps -g replace-in-files-cli
|
||||
sasjs cbd -t server-ci
|
||||
# sasjs request services/admin/makedata -t server-ci -d ./deploy/makeData4GL.json -c ./deploy/requestConfig.json -o ./output.json
|
||||
|
||||
- name: Prepare frontend
|
||||
run: |
|
||||
cd ./client
|
||||
# mv ./cypress.env.example.json ./cypress.env.json
|
||||
# replace-in-files --regex='"username".*' --replacement='"username":"'$cypress_username_sasjs'",' ./cypress.env.json
|
||||
# replace-in-files --regex='"password".*' --replacement='"password":"'$cypress_pwd_sasjs'" ' ./cypress.env.json
|
||||
cat ./cypress.env.json
|
||||
npm run postinstall
|
||||
# Prepare index.html to SASJS local
|
||||
replace-in-files --regex='serverUrl=".*?"' --replacement='serverUrl="http://localhost:5000"' ./src/index.html
|
||||
replace-in-files --regex='appLoc=".*?"' --replacement='appLoc="/Public/app/devtest"' ./src/index.html
|
||||
replace-in-files --regex='serverType=".*?"' --replacement='serverType="SASJS"' ./src/index.html
|
||||
# Prepare and deploy SASJS version
|
||||
# replace-in-files --regex='serverurl=".*?"' --replacement='serverUrl="http://localhost:5000"' ./dist/index.html
|
||||
# replace-in-files --regex='apploc=".*?"' --replacement='appLoc="/30.SASApps/app/devtest"' ./dist/index.html
|
||||
# replace-in-files --regex='servertype=".*?"' --replacement='serverType="SASJS"' ./dist/index.html
|
||||
# scp -o stricthostkeychecking=no -r ./dist/* dcgitlab@sas.4gl.io:/var/www/html/dcviya/development/newadapter
|
||||
replace-in-files --regex='"hosturl".*' --replacement='hosturl:"http://localhost:4200",' ./cypress.config.ts
|
||||
# replace-in-files --regex='"appLocation".*' --replacement='appLocation:"/dcviya/development/newadapter",' ./cypress.config.ts
|
||||
cat ./cypress.config.ts
|
||||
# Start frontend and run cypress
|
||||
npm start & npx wait-on http://localhost:4200 && ./run-cypress-tests.sh
|
||||
|
||||
Build-and-test-development-latest-adapter:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Write .npmrc file
|
||||
run: echo "$NPMRC" > client/.npmrc
|
||||
shell: bash
|
||||
env:
|
||||
NPMRC: ${{ secrets.NPMRC}}
|
||||
|
||||
- run: apt-get update
|
||||
- run: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||
- run: apt install -y ./google-chrome*.deb;
|
||||
- run: export CHROME_BIN=/usr/bin/google-chrome
|
||||
- run: apt-get update -y
|
||||
- run: apt-get -y install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
|
||||
- run: apt -y install jq
|
||||
# - run: 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||
# - run: eval $(ssh-agent -s)
|
||||
# - run: echo "$ssh_key" | tr -d '\r' | ssh-add -
|
||||
- name: Write cypress credentials
|
||||
run: echo "$CYPRESS_CREDS" > ./client/cypress.env.json
|
||||
shell: bash
|
||||
env:
|
||||
CYPRESS_CREDS: ${{ secrets.CYPRESS_CREDS }}
|
||||
|
||||
# - run: mkdir -p ~/.ssh
|
||||
# - run: chmod 700 ~/.ssh
|
||||
- run: npm ci --legacy-peer-deps
|
||||
# Install pm2 and prepare SASJS server
|
||||
- run: npm i -g pm2
|
||||
- run: curl -L https://github.com/sasjs/server/releases/latest/download/linux.zip > linux.zip
|
||||
- run: unzip linux.zip
|
||||
- run: touch .env
|
||||
- run: echo RUN_TIMES=js >> .env
|
||||
- run: echo NODE_PATH=node >> .env
|
||||
- run: echo CORS=enable >> .env
|
||||
- run: echo WHITELIST=http://localhost:4200 >> .env
|
||||
# - run: echo "SERVER_URL=$server_url" >> .env
|
||||
# - run: echo "SERVER_TYPE=$server_type" >> .env
|
||||
# - run: echo "CLIENT=$client_sasjs" >> .env
|
||||
# - run: echo "ACCESS_TOKEN=$access_token_sasjs" >> .env
|
||||
# - run: echo "REFRESH_TOKEN=$refresh_token_sasjs" >> .env
|
||||
# - run: cat .env
|
||||
- run: pm2 start api-linux --wait-ready
|
||||
|
||||
- name: Deploy mocked services
|
||||
run: |
|
||||
cd ./sas/mocks/sasjs
|
||||
npm install --legacy-peer-deps -g @sasjs/cli
|
||||
npm install --legacy-peer-deps -g replace-in-files-cli
|
||||
sasjs cbd -t server-ci
|
||||
# sasjs request services/admin/makedata -t server-ci -d ./deploy/makeData4GL.json -c ./deploy/requestConfig.json -o ./output.json
|
||||
|
||||
- name: Prepare frontend
|
||||
run: |
|
||||
cd ./client
|
||||
# mv ./cypress.env.example.json ./cypress.env.json
|
||||
# replace-in-files --regex='"username".*' --replacement='"username":"'$cypress_username_sasjs'",' ./cypress.env.json
|
||||
# replace-in-files --regex='"password".*' --replacement='"password":"'$cypress_pwd_sasjs'" ' ./cypress.env.json
|
||||
cat ./cypress.env.json
|
||||
npm run postinstall
|
||||
npm install --legacy-peer-deps @sasjs/adapter@latest
|
||||
# Prepare index.html to SASJS local
|
||||
replace-in-files --regex='serverUrl=".*?"' --replacement='serverUrl="http://localhost:5000"' ./src/index.html
|
||||
replace-in-files --regex='appLoc=".*?"' --replacement='appLoc="/Public/app/devtest"' ./src/index.html
|
||||
replace-in-files --regex='serverType=".*?"' --replacement='serverType="SASJS"' ./src/index.html
|
||||
# Prepare and deploy SASJS version
|
||||
# replace-in-files --regex='serverurl=".*?"' --replacement='serverUrl="http://localhost:5000"' ./dist/index.html
|
||||
# replace-in-files --regex='apploc=".*?"' --replacement='appLoc="/30.SASApps/app/devtest"' ./dist/index.html
|
||||
# replace-in-files --regex='servertype=".*?"' --replacement='serverType="SASJS"' ./dist/index.html
|
||||
# scp -o stricthostkeychecking=no -r ./dist/* dcgitlab@sas.4gl.io:/var/www/html/dcviya/development/newadapter
|
||||
replace-in-files --regex='"hosturl".*' --replacement='hosturl:"http://localhost:4200",' ./cypress.config.ts
|
||||
# replace-in-files --regex='"appLocation".*' --replacement='appLocation:"/dcviya/development/newadapter",' ./cypress.config.ts
|
||||
cat ./cypress.config.ts
|
||||
# Start frontend and run cypress
|
||||
npm start & npx wait-on http://localhost:4200 && ./run-cypress-tests.sh
|
@ -1,19 +1,157 @@
|
||||
name: Release
|
||||
run-name: Releasing DC
|
||||
run-name: Testing and Releasing DC
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
release:
|
||||
Build-production-and-ng-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Write .npmrc file
|
||||
run: |
|
||||
touch client/.npmrc
|
||||
echo '${{ secrets.NPMRC}}' > client/.npmrc
|
||||
|
||||
- name: Install Chrome for Angular tests
|
||||
run: |
|
||||
apt-get update
|
||||
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||
apt install -y ./google-chrome*.deb;
|
||||
export CHROME_BIN=/usr/bin/google-chrome
|
||||
|
||||
- name: Write cypress credentials
|
||||
run: echo "$CYPRESS_CREDS" > ./client/cypress.env.json
|
||||
shell: bash
|
||||
env:
|
||||
CYPRESS_CREDS: ${{ secrets.CYPRESS_CREDS }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Check audit
|
||||
# Audit should fail and stop the CI if critical vulnerability found
|
||||
run: |
|
||||
npm audit --audit-level=critical --omit=dev
|
||||
cd ./sas
|
||||
npm audit --audit-level=critical --omit=dev
|
||||
cd ../client
|
||||
npm audit --audit-level=critical --omit=dev
|
||||
|
||||
- name: Angular Tests
|
||||
run: |
|
||||
cd client
|
||||
npm test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
|
||||
|
||||
- name: Angular Production Build
|
||||
run: |
|
||||
cd client
|
||||
npm run postinstall
|
||||
npm run build
|
||||
|
||||
Build-and-test-development:
|
||||
runs-on: ubuntu-latest
|
||||
needs: Build-production-and-ng-test
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Write .npmrc file
|
||||
run: |
|
||||
touch client/.npmrc
|
||||
echo '${{ secrets.NPMRC}}' > client/.npmrc
|
||||
|
||||
- run: apt-get update
|
||||
- run: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||
- run: apt install -y ./google-chrome*.deb;
|
||||
- run: export CHROME_BIN=/usr/bin/google-chrome
|
||||
- run: apt-get update -y
|
||||
- run: apt-get -y install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
|
||||
- run: apt -y install jq
|
||||
|
||||
- name: Write cypress credentials
|
||||
run: echo "$CYPRESS_CREDS" > ./client/cypress.env.json
|
||||
shell: bash
|
||||
env:
|
||||
CYPRESS_CREDS: ${{ secrets.CYPRESS_CREDS }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
# Install pm2 and prepare SASJS server
|
||||
- run: npm i -g pm2
|
||||
- run: curl -L https://github.com/sasjs/server/releases/latest/download/linux.zip > linux.zip
|
||||
- run: unzip linux.zip
|
||||
- run: touch .env
|
||||
- run: echo RUN_TIMES=js >> .env
|
||||
- run: echo NODE_PATH=node >> .env
|
||||
- run: echo CORS=enable >> .env
|
||||
- run: echo WHITELIST=http://localhost:4200 >> .env
|
||||
- run: cat .env
|
||||
- run: pm2 start api-linux --wait-ready
|
||||
|
||||
- name: Deploy mocked services
|
||||
run: |
|
||||
cd ./sas/mocks/sasjs
|
||||
npm install -g @sasjs/cli
|
||||
npm install -g replace-in-files-cli
|
||||
sasjs cbd -t server-ci
|
||||
# sasjs request services/admin/makedata -t server-ci -d ./deploy/makeData4GL.json -c ./deploy/requestConfig.json -o ./output.json
|
||||
|
||||
- name: Install ZIP
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install zip
|
||||
|
||||
- name: Prepare and run frontend and cypress
|
||||
run: |
|
||||
cd ./client
|
||||
mv ./cypress.env.example.json ./cypress.env.json
|
||||
replace-in-files --regex='"username".*' --replacement='"username":"'${{ secrets.CYPRESS_USERNAME_SASJS }}'",' ./cypress.env.json
|
||||
replace-in-files --regex='"password".*' --replacement='"password":"'${{ secrets.CYPRESS_PWD_SASJS }}'" ' ./cypress.env.json
|
||||
cat ./cypress.env.json
|
||||
npm run postinstall
|
||||
# Prepare index.html to SASJS local
|
||||
replace-in-files --regex='serverUrl=".*?"' --replacement='serverUrl="http://localhost:5000"' ./src/index.html
|
||||
replace-in-files --regex='appLoc=".*?"' --replacement='appLoc="/Public/app/devtest"' ./src/index.html
|
||||
replace-in-files --regex='serverType=".*?"' --replacement='serverType="SASJS"' ./src/index.html
|
||||
replace-in-files --regex='"hosturl".*' --replacement='hosturl:"http://localhost:4200",' ./cypress.config.ts
|
||||
cat ./cypress.config.ts
|
||||
# Start frontend and run cypress
|
||||
npm start & npx wait-on http://localhost:4200 && npx cypress run --browser chrome --spec "cypress/e2e/liveness.cy.ts,cypress/e2e/editor.cy.ts,cypress/e2e/excel.cy.ts,cypress/e2e/filtering.cy.ts,cypress/e2e/licensing.cy.ts"
|
||||
|
||||
- name: Zip Cypress videos
|
||||
if: always()
|
||||
run: |
|
||||
zip -r cypress-videos ./client/cypress/videos
|
||||
|
||||
- name: Add cypress videos artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cypress-videos.zip
|
||||
path: cypress-videos.zip
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [Build-production-and-ng-test, Build-and-test-development]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Write .npmrc file
|
||||
run: |
|
||||
echo "$NPMRC" > client/.npmrc
|
||||
@ -22,29 +160,106 @@ jobs:
|
||||
env:
|
||||
NPMRC: ${{ secrets.NPMRC}}
|
||||
|
||||
- name: Install ZIP
|
||||
- name: Install packages
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install zip
|
||||
apt-get install zip -y
|
||||
# sasjs cli is used to compile & build the SAS services
|
||||
npm i -g @sasjs/cli
|
||||
# jq is used to parse the release JSON
|
||||
apt-get install jq -y
|
||||
# doxygen is used for the SASJS docs
|
||||
apt-get update
|
||||
apt-get install doxygen -y
|
||||
|
||||
- name: release-build
|
||||
- name: Create Empty Release (assets are posted later)
|
||||
run: |
|
||||
npm i
|
||||
npm i -g semantic-release
|
||||
# We do a semantic-release DRY RUN to make the job fail if there are no changes to release
|
||||
GITEA_TOKEN=${{ secrets.RELEASE_TOKEN }} GITEA_URL=https://git.datacontroller.io semantic-release --dry-run | grep -q "There are no relevant changes, so no new version is released." && exit 1
|
||||
GITEA_TOKEN=${{ secrets.RELEASE_TOKEN }} GITEA_URL=https://git.datacontroller.io semantic-release
|
||||
|
||||
- name: Frontend Build
|
||||
description: Must be created AFTER the release as the version (git tag) is used in the interface
|
||||
run: |
|
||||
cd client
|
||||
npm ci
|
||||
npm run build
|
||||
zip -r dist.zip ./dist
|
||||
|
||||
- name: Install Semantic Release and plugins
|
||||
- name: Build SAS9 EBI Release
|
||||
description: Compile SAS 9 services, remove tests & create deployment program
|
||||
run: |
|
||||
cd sas
|
||||
npm i
|
||||
npm i -g semantic-release
|
||||
sasjs c -t sas9
|
||||
rm -rf sasjsbuild/tests
|
||||
sasjs b -t sas9
|
||||
cp sasjsbuild/mysas9deploy.sas ./demostream_sas9.sas
|
||||
#
|
||||
# remove streamed component and rebuild SAS 9 services
|
||||
#
|
||||
rm -rf sasjsbuild/services/web9
|
||||
rm sasjsbuild/services/clickme.sas
|
||||
sasjs b -t sas9
|
||||
cp sasjsbuild/mysas9deploy.sas ./sas9.sas
|
||||
|
||||
- name: Release
|
||||
- name: Build SASjs Server Release
|
||||
description: Compile Base (SASjs) services, remove tests & create deployment JSON
|
||||
run: |
|
||||
GITEA_TOKEN=${{ secrets.RELEASE_TOKEN }} GITEA_URL=https://git.datacontroller.io semantic-release
|
||||
cd sas
|
||||
cp sasjs/utils/favicon.ico ../client/dist/favicon.ico
|
||||
sasjs c -t server
|
||||
rm -rf sasjsbuild/tests
|
||||
sasjs b -t server
|
||||
cp sasjsbuild/server.json.zip ./sasjs_server.json.zip
|
||||
|
||||
- name: Build Viya Release
|
||||
description: compile Viya Streaming Deploy (without tests)
|
||||
run: |
|
||||
cd sas
|
||||
sasjs c -t viya
|
||||
rm -rf sasjsbuild/tests
|
||||
sed -i -e 's/servertype="SASJS"/servertype="SASVIYA"/g' sasjsbuild/services/clickme.html
|
||||
sasjs b -t viya
|
||||
cp sasjsbuild/viya.sas ./demostream_viya.sas
|
||||
# compile Viya Full deploy (without web)
|
||||
rm -rf sasjsbuild/services/web
|
||||
rm sasjsbuild/services/clickme.html
|
||||
sasjs b -t viya
|
||||
cp sasjsbuild/viya.sas ./viya.sas
|
||||
|
||||
- name: Zip Frontend (including viya.json for full viya deploy)
|
||||
run: |
|
||||
cd sas
|
||||
cp sasjsbuild/viya.json ../client/dist
|
||||
cd ..
|
||||
zip -r frontend.zip ./client/dist
|
||||
|
||||
- name: Release Typedoc
|
||||
run: |
|
||||
cd client
|
||||
npm run typedoc
|
||||
# deploy docs
|
||||
npm -g install cloudron-surfer
|
||||
npm run compodoc:build
|
||||
surfer put --token ${{ secrets.TSDOC_TOKEN }} --server webdoc.datacontroller.io documentation/* /
|
||||
|
||||
- name: Release code.datacontroller.io
|
||||
run: |
|
||||
cd sas
|
||||
sasjs doc
|
||||
surfer put --token ${{ secrets.CODE_DATACONTROLLER_IO }} --server code.datacontroller.io sasjsbuild/sasdocs/* /
|
||||
|
||||
- name: Upload assets to release
|
||||
run: |
|
||||
RELEASE_ID=`curl -k 'https://git.datacontroller.io/api/v1/repos/dc/dc/releases/latest?access_token=${{ secrets.RELEASE_TOKEN }}' | jq -r '.id'`
|
||||
RELEASE_BODY=`curl -k 'https://git.datacontroller.io/api/v1/repos/dc/dc/releases/latest?access_token=${{ secrets.RELEASE_TOKEN }}' | jq -r '.body'`
|
||||
# Update body
|
||||
curl --data '{"draft": false,"body":"'"$RELEASE_BODY\n\nFor installation instructions, please visit https://docs.datacontroller.io/"'"}' -X PATCH --header 'Content-Type: application/json' -k https://git.datacontroller.io/api/v1/repos/dc/dc/releases/$RELEASE_ID?access_token=${{ secrets.RELEASE_TOKEN }}
|
||||
# Upload assets
|
||||
URL="https://git.datacontroller.io/api/v1/repos/dc/dc/releases/$RELEASE_ID/assets?access_token=${{ secrets.RELEASE_TOKEN }}"
|
||||
curl -k $URL -F attachment=@frontend.zip
|
||||
curl -k $URL -F attachment=@sas/demostream_sas9.sas
|
||||
curl -k $URL -F attachment=@sas/demostream_viya.sas
|
||||
curl -k $URL -F attachment=@sas/sasjs_server.json.zip
|
||||
curl -k $URL -F attachment=@sas/sas9.sas
|
||||
curl -k $URL -F attachment=@sas/viya.sas
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,6 +10,7 @@ client/src/environments/version.ts
|
||||
client/cypress/screenshots
|
||||
client/cypress/results
|
||||
client/cypress/videos
|
||||
client/documentation
|
||||
cypress.env.json
|
||||
sasjsbuild
|
||||
sasjsresults
|
||||
|
34
.releaserc
34
.releaserc
@ -1,22 +1,46 @@
|
||||
{
|
||||
"branches": ["main"],
|
||||
"branches": [
|
||||
"main"
|
||||
],
|
||||
"plugins": [
|
||||
"@semantic-release/commit-analyzer",
|
||||
"@semantic-release/release-notes-generator",
|
||||
"@semantic-release/changelog",
|
||||
"@semantic-release/npm",
|
||||
[
|
||||
"@semantic-release/git",
|
||||
{
|
||||
"assets": [
|
||||
"CHANGELOG.md"
|
||||
"CHANGELOG.md",
|
||||
"package.json"
|
||||
]
|
||||
}
|
||||
],
|
||||
["@saithodev/semantic-release-gitea", {
|
||||
[
|
||||
"@saithodev/semantic-release-gitea",
|
||||
{
|
||||
"giteaUrl": "https://git.datacontroller.io",
|
||||
"assets": [
|
||||
{"path": "client/dist.zip"}
|
||||
{
|
||||
"path": "sas/demostream_sas9.sas"
|
||||
},
|
||||
{
|
||||
"path": "sas/demostream_viya.sas"
|
||||
},
|
||||
{
|
||||
"path": "sas/frontend.zip"
|
||||
},
|
||||
{
|
||||
"path": "sas/sasjs_server.json.zip"
|
||||
},
|
||||
{
|
||||
"path": "sas/sas9.sas"
|
||||
},
|
||||
{
|
||||
"path": "sas/viya.sas"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}]
|
||||
]
|
||||
}
|
11
.vscode/settings.json
vendored
11
.vscode/settings.json
vendored
@ -1,18 +1,19 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"Licence",
|
||||
"SYSERRORTEXT",
|
||||
"SYSWARNINGTEXT"
|
||||
],
|
||||
"editor.rulers": [
|
||||
80
|
||||
"SYSWARNINGTEXT",
|
||||
"xlmaprules",
|
||||
"xlmaps"
|
||||
],
|
||||
"editor.rulers": [80],
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"[markdown]": {
|
||||
"files.trimTrailingWhitespace": false
|
||||
},
|
||||
"workbench.colorCustomizations": {
|
||||
"titleBar.activeForeground": "#ebe8e8",
|
||||
"titleBar.activeBackground": "#95ff0053",
|
||||
"titleBar.activeBackground": "#95ff0053"
|
||||
},
|
||||
"terminal.integrated.wordSeparators": " ()[]{}',\"`─‘’"
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
pipeline:
|
||||
build:
|
||||
image: debian
|
||||
commands:
|
||||
- echo "This is the build step"
|
||||
a-test-step:
|
||||
image: debian
|
||||
commands:
|
||||
- echo "Testing.."
|
173
CHANGELOG.md
173
CHANGELOG.md
@ -1,3 +1,176 @@
|
||||
## [6.6.1](https://git.datacontroller.io/dc/dc/compare/v6.6.0...v6.6.1) (2024-02-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **client:** bumped @sasjs/adapter with fixed redirected login ([eb1c09d](https://git.datacontroller.io/dc/dc/commit/eb1c09d7909ba07faf763da261545dc1efaec1b3))
|
||||
|
||||
# [6.6.0](https://git.datacontroller.io/dc/dc/compare/v6.5.2...v6.6.0) (2024-02-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* adjust the col numbers in extracted data ([cff5989](https://git.datacontroller.io/dc/dc/commit/cff598955930d2581349e5c6e8b2dd3f9ac96b4c))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* extra table metadata for [#75](https://git.datacontroller.io/dc/dc/issues/75) ([837821f](https://git.datacontroller.io/dc/dc/commit/837821fd01477d340524dfdaf8dd3d3758cf3095))
|
||||
* show dsnote on hover title ([6565834](https://git.datacontroller.io/dc/dc/commit/6565834ad4089ecf2de39967e6ed6f217ee4a0a5))
|
||||
|
||||
## [6.5.2](https://git.datacontroller.io/dc/dc/compare/v6.5.1...v6.5.2) (2024-02-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ordering mpe_selectbox data by the data values after selectbox_order ([2b54034](https://git.datacontroller.io/dc/dc/commit/2b5403497317632a4be8a00f21455c036f1e6461))
|
||||
|
||||
## [6.5.1](https://git.datacontroller.io/dc/dc/compare/v6.5.0...v6.5.1) (2024-02-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ensuring submitter email can be pulled from mpe_emails ([eac0104](https://git.datacontroller.io/dc/dc/commit/eac0104d7aebaf98ff1d1c504c1ce3b25d4a0ce8))
|
||||
|
||||
# [6.5.0](https://git.datacontroller.io/dc/dc/compare/v6.4.0...v6.5.0) (2024-01-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* filtering by reference to Variables as well as Values ([6eb1aa8](https://git.datacontroller.io/dc/dc/commit/6eb1aa85d29294d63e6af377e622fbed7fd1fab8))
|
||||
|
||||
# [6.4.0](https://git.datacontroller.io/dc/dc/compare/v6.3.1...v6.4.0) (2024-01-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add dcLib to globals ([5d93346](https://git.datacontroller.io/dc/dc/commit/5d93346b52eda27c2829770e96686a713296d373))
|
||||
* add service to get xlmap rules and fixed interface name ([9ffa30a](https://git.datacontroller.io/dc/dc/commit/9ffa30ab747f5b62acbd452431a5e6e440afcb80))
|
||||
* increasing length of mpe_excel_map cols to ([2d4d068](https://git.datacontroller.io/dc/dc/commit/2d4d068413dcdac98581f08939e74bde65b73428))
|
||||
* providing info on mapids to FE ([fd94945](https://git.datacontroller.io/dc/dc/commit/fd94945466c1a797ddc89815258a65624a9cb0cf))
|
||||
* removing tables from EDIT menu that are in xlmaps ([9550ae4](https://git.datacontroller.io/dc/dc/commit/9550ae4d1154a0272f8a2427ac9d2afdfd699c96))
|
||||
* removing XLMAP_TARGETLIBDS from mpe_xlmaps_rules table ([93702c6](https://git.datacontroller.io/dc/dc/commit/93702c63dc280cdba1e46f0fd8fe0deaec879611))
|
||||
* renaming TABLE macvar to LOAD_REF in postdata.sas ([01915a2](https://git.datacontroller.io/dc/dc/commit/01915a2db9a4dfb94e4e8213e2c32181da36d349))
|
||||
* reverting xlmap in getdata change ([2d6e747](https://git.datacontroller.io/dc/dc/commit/2d6e747db9b84e9fb0dfcf9102a2f7dd2cb51891))
|
||||
* update edit tab to load ([516e5a2](https://git.datacontroller.io/dc/dc/commit/516e5a206216f79ab1dce9f4eab0d31115743160))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* adding ability to define the target table for excel maps ([c86fba9](https://git.datacontroller.io/dc/dc/commit/c86fba9dc75ddc6033132f469ad1c31b9131b12e))
|
||||
* adding ismap attribute to getdata response (and fixing test) ([2702bb3](https://git.datacontroller.io/dc/dc/commit/2702bb3c84c45903def1aa2b8cc20a6dd080281b))
|
||||
* Complex Excel Uploads ([cf19381](https://git.datacontroller.io/dc/dc/commit/cf193810606f287b8d6f864c4eb64d43c5ab5f3c)), closes [#69](https://git.datacontroller.io/dc/dc/issues/69)
|
||||
* Create Tables / Files dropdown under load tab ([b473b19](https://git.datacontroller.io/dc/dc/commit/b473b198a61f468dff74cd8e64692e7847084a80))
|
||||
* display list of maps in sidebar ([5aec024](https://git.datacontroller.io/dc/dc/commit/5aec0242429942f8a989b5fb79f8d3865e9de01a))
|
||||
* implemented the logic for xlmap component ([50696bb](https://git.datacontroller.io/dc/dc/commit/50696bb926dd00472db65a008771a4b6352871be))
|
||||
* model changes for [#69](https://git.datacontroller.io/dc/dc/issues/69) ([271543a](https://git.datacontroller.io/dc/dc/commit/271543a446a2116718f99f0540e3cd911f9f5fe7))
|
||||
* new getxlmaps service to return rules for a particular xlmap_id ([56264ec](https://git.datacontroller.io/dc/dc/commit/56264ecc6908bf6c8e3e666dfeba7068d6195df8))
|
||||
* validating the excel map after stage (adding load-ref) ([a485c3b](https://git.datacontroller.io/dc/dc/commit/a485c3b78724a36f7bacb264fb02140cc62d6512))
|
||||
|
||||
## [6.3.1](https://git.datacontroller.io/dc/dc/compare/v6.3.0...v6.3.1) (2024-01-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* enabling excel uploads to tables with retained keys, also adding more validation to MPE_TABLES updates ([3efccc4](https://git.datacontroller.io/dc/dc/commit/3efccc4cf3752763d049836724f2491c287f65db))
|
||||
|
||||
# [6.3.0](https://git.datacontroller.io/dc/dc/compare/v6.2.8...v6.3.0) (2023-12-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* viewer row handle ([dadac4f](https://git.datacontroller.io/dc/dc/commit/dadac4f13f85b5446198b6340cad28844defc94d))
|
||||
|
||||
## [6.2.8](https://git.datacontroller.io/dc/dc/compare/v6.2.7...v6.2.8) (2023-12-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* bumping sasjs/core to fix mp_loadformat issue ([a1d308e](https://git.datacontroller.io/dc/dc/commit/a1d308ea078786b27bf7ec940d018fc657d4c398))
|
||||
* new logic for -fc suffix. Closes [#63](https://git.datacontroller.io/dc/dc/issues/63) ([5579db0](https://git.datacontroller.io/dc/dc/commit/5579db0eafc668b1bc310099b7cc3062e0598fc4))
|
||||
|
||||
## [6.2.7](https://git.datacontroller.io/dc/dc/compare/v6.2.6...v6.2.7) (2023-11-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **audit:** updated crypto-js (hashing rows in dynamic cell validation) ([a7aa42a](https://git.datacontroller.io/dc/dc/commit/a7aa42a59b71597399924b8d2d06010c806321f3))
|
||||
* missing dependency and avoiding label length limit issue ([91f128c](https://git.datacontroller.io/dc/dc/commit/91f128c2fead1e4f72267d689e67f49ec9a2ab35))
|
||||
|
||||
## [6.2.6](https://git.datacontroller.io/dc/dc/compare/v6.2.5...v6.2.6) (2023-10-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* bumping core to address mm_assigndirectlib issue ([c27cdab](https://git.datacontroller.io/dc/dc/commit/c27cdab3fccbde814a29424d0344173a73ea816c))
|
||||
|
||||
## [6.2.5](https://git.datacontroller.io/dc/dc/compare/v6.2.4...v6.2.5) (2023-10-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* enabling AUTHDOMAIN in MM_ASSIGNDIRECTLIB ([008b45a](https://git.datacontroller.io/dc/dc/commit/008b45ad175ec0e6026f5ef3bc210470226e328f))
|
||||
|
||||
## [6.2.4](https://git.datacontroller.io/dc/dc/compare/v6.2.3...v6.2.4) (2023-10-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Enable display of metadata-only tables. Closes [#56](https://git.datacontroller.io/dc/dc/issues/56) ([f3e82b4](https://git.datacontroller.io/dc/dc/commit/f3e82b4ee2a9c1c851f812ac60e9eaf05f91a0f9))
|
||||
|
||||
## [6.2.3](https://git.datacontroller.io/dc/dc/compare/v6.2.2...v6.2.3) (2023-10-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* bumping core library to avoid non-ascii char in mp_validatecols.sas. [#50](https://git.datacontroller.io/dc/dc/issues/50) ([11b06f6](https://git.datacontroller.io/dc/dc/commit/11b06f6416300b6d70b1570c415d5a5c004976db))
|
||||
* removing copyright symbol from mpe_alerts macro. [#50](https://git.datacontroller.io/dc/dc/issues/50) ([adb7eb7](https://git.datacontroller.io/dc/dc/commit/adb7eb77550c68a2dab15a6ff358129820e9b612))
|
||||
|
||||
## [6.2.2](https://git.datacontroller.io/dc/dc/compare/v6.2.1...v6.2.2) (2023-10-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* updated SheetJS (crypto) to the latest ([8bd0dd2](https://git.datacontroller.io/dc/dc/commit/8bd0dd22c258911672303869e4df893a98e93575))
|
||||
|
||||
## [6.2.1](https://git.datacontroller.io/dc/dc/compare/v6.2.0...v6.2.1) (2023-10-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* approve, history and submit pages grouped in review module ([e056ece](https://git.datacontroller.io/dc/dc/commit/e056ece2234ef6aab050f6a5b1f8de633b163d91))
|
||||
* closes [#39](https://git.datacontroller.io/dc/dc/issues/39) upcase issue in MPE_SECURITY ([a00d31c](https://git.datacontroller.io/dc/dc/commit/a00d31caf3c5634cd61a4700fb175e76856edbb6))
|
||||
* handsontable v13 ([6f482ec](https://git.datacontroller.io/dc/dc/commit/6f482ec6d909907a304ef9975262889e2370035f))
|
||||
* latest adapter ([5e30dc0](https://git.datacontroller.io/dc/dc/commit/5e30dc0f892fab2af41f4ea56e30f27ec3b3912e))
|
||||
* sasjs/cli and sasjs/core updated to the latest ([8571e01](https://git.datacontroller.io/dc/dc/commit/8571e01e44a8cb6df9d150d271c34bb75bffdf31))
|
||||
* updating editors/stagedata to address issues in particular viya configurations as described in issue [#33](https://git.datacontroller.io/dc/dc/issues/33) ([94ab949](https://git.datacontroller.io/dc/dc/commit/94ab949df8c75072525751a2156b7a32c2e641dc))
|
||||
* updating logic for REPLACE loadtype ([1f2ce55](https://git.datacontroller.io/dc/dc/commit/1f2ce55f249f4af56f0cacdec47e69246cd47431))
|
||||
|
||||
# [6.2.0](https://git.datacontroller.io/dc/dc/compare/v6.1.0...v6.2.0) (2023-08-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* re-enabling full REPLACE uploads ([08e39c4](https://git.datacontroller.io/dc/dc/commit/08e39c4fca570406f9aad3d907cb04596421d074))
|
||||
|
||||
### Features
|
||||
|
||||
* support for European numeric formats ([e48e47b](https://git.datacontroller.io/dc/dc/commit/e48e47bc635452b59e107b235e597c26e748875e))
|
||||
|
||||
# [6.1.0](https://git.datacontroller.io/dc/dc/compare/v6.0.0...v6.1.0) (2023-07-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* missing mf_existds dependency in bitemporal_dataloader ([5ce1701](https://git.datacontroller.io/dc/dc/commit/5ce1701657136f2cf792441412230513ff52e7e8))
|
||||
* reducing audit data volumes. Closes [#4](https://git.datacontroller.io/dc/dc/issues/4) ([54fe701](https://git.datacontroller.io/dc/dc/commit/54fe7013b1a25be228eeb2aba3553f6219952de6))
|
||||
* release script, excel upload duplicate primary keys, cypress fix ([2f79487](https://git.datacontroller.io/dc/dc/commit/2f79487aeaf6268b027a8fa52fcdaae2b449de3d))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* full format deletion, closes [#2](https://git.datacontroller.io/dc/dc/issues/2) ([8dc40bd](https://git.datacontroller.io/dc/dc/commit/8dc40bdd4e3a7ad5c1e6582b4130f24bc445eb77))
|
||||
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
||||
|
@ -1,6 +1,9 @@
|
||||
# Data Controller
|
||||
# Contributing
|
||||
|
||||
## Workflow guidelines
|
||||
[Wiki Page](https://git.datacontroller.io/dc/dc/wiki/Git-Workflow)
|
||||
|
||||
## Dependencies that requires licences
|
||||
|
||||
[SheetJS Pro Version](https://www.npmjs.com/package/sheetjs)
|
||||
@ -50,6 +53,17 @@ npm run lint:fix
|
||||
Typedoc is used for generating typescript documentation based on the code.
|
||||
That part is automated and beign done as a part of CI job.
|
||||
|
||||
# Release
|
||||
Release is automated as a part of CI job. Workflow file: `.gitea/workflows/release.yaml`.
|
||||
It will run automatically when branch merged to the `main` branch.
|
||||
IMPORTANT!
|
||||
If release job fails, after it has been created empty release and a tag, we must not re-run the relase job until we removed the newly create GIT TAG and RELEASE.
|
||||
To remove the git tag run:
|
||||
```
|
||||
git push -d origin vX.X.X
|
||||
```
|
||||
To remove the release, you need to do it with repo administration over at [https://git.datacontroller.io/dc/dc](https://git.datacontroller.io/dc/dc)
|
||||
|
||||
# Troubleshooting
|
||||
|
||||
## Makedata service "could not create directory" error
|
||||
|
22
LICENCE.md
22
LICENCE.md
@ -3,25 +3,15 @@ Licence Agreement for Data Controller for SAS®
|
||||
|
||||
Copyright (c) Bowe IO Ltd
|
||||
|
||||
Data Controller is a software distributed by 4GL Apps, a brand owned by Bowe IO Ltd, a UK Limited Company headquarted in 29 Oldfield Rd, Cumbria, registered by companies house under number 08777171, VAT number: 203914240
|
||||
Data Controller software is distributed by 4GL Apps, a brand owned by Bowe IO Ltd, a UK Limited Company headquarted in 29 Oldfield Rd, Cumbria, registered at Companies House with company number 08777171, VAT number: 203914240
|
||||
|
||||
This software is protected by applicable copyright laws, including international treaties, and dual-
|
||||
licensed – depending on whether your use for commercial purposes, meaning intended for or
|
||||
resulting in commercial advantage or monetary compensation, or not.
|
||||
This software is protected by applicable copyright laws, including international treaties, and dual-licensed – depending on whether your use for commercial purposes, meaning intended for or resulting in commercial advantage or monetary compensation, or not.
|
||||
|
||||
If your use is strictly personal or solely for evaluation purposes, meaning for the purposes of testing
|
||||
the suitability, performance, and usefulness of this software outside the production environment,
|
||||
you agree to be bound by the terms included in the "licence-non-commercial-datacontroller.md" file.
|
||||
If your use is strictly personal or solely for evaluation purposes, meaning for the purposes of testing the suitability, performance, and usefulness of this software outside the production environment, you agree to be bound by the terms included in the "licence-non-commercial-datacontroller.md" file available here: https://git.datacontroller.io/dc/dc/src/branch/main/licence-non-commercial-datacontroller.md
|
||||
|
||||
Your use of this software for commercial purposes is subject to the terms included in an applicable
|
||||
license agreement.
|
||||
Your use of this software for commercial purposes is subject to the terms included in an applicable license agreement.
|
||||
|
||||
In any case, you must not make any such use of this software as to develop software which may be
|
||||
considered competitive with this software.
|
||||
In any case, you must not make any such use of this software as to develop software which may be considered competitive with this software.
|
||||
|
||||
UNLESS EXPRESSLY AGREED OTHERWISE, 4GL APPS PROVIDES THIS SOFTWARE ON AN "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, AND IN NO EVENT AND UNDER NO
|
||||
LEGAL THEORY, SHALL 4GL APPS BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,
|
||||
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
|
||||
USE OR INABILITY TO USE THIS SOFTWARE.
|
||||
UNLESS EXPRESSLY AGREED OTHERWISE, 4GL APPS PROVIDES THIS SOFTWARE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, AND IN NO EVENT AND UNDER NO LEGAL THEORY, SHALL 4GL APPS BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM USE OR INABILITY TO USE THIS SOFTWARE.
|
||||
|
||||
|
30
README.md
30
README.md
@ -0,0 +1,30 @@
|
||||
# Data Controller for SAS
|
||||
|
||||
**Control your manual data modifications!**
|
||||
|
||||
_Alternatives to Data Controller include:_
|
||||
|
||||
* 💾 Developing / testing / deploying / scheduling overnight batch jobs to load files from shared drives
|
||||
* 🔒 Opening (and locking) datasets in Enterprise Guide or SAS® Table Viewer to perform direct updates
|
||||
* ❓ Asking a #DBA to run validated code after a change management process
|
||||
* 🌐 Building & maintaining your own custom web application
|
||||
* 🏃 Running #SAS or #SQL updates in production
|
||||
|
||||
_Problems with the above include:_
|
||||
|
||||
* Legacy 'black box' solutions with little to no testing, documentation or support
|
||||
* End users requiring direct write access to critical data sources in production
|
||||
* Upload routines that must be manually modified when the data model changes
|
||||
* Breaches due to unnecessary parties having access to the data
|
||||
* Inability to trace who made a change, when, and why
|
||||
* Reliance on key individuals to perform updates
|
||||
* Building bespoke ETL for every new data source
|
||||
* High risk of manual error / data corruption
|
||||
|
||||
Data Controller for SAS® solves all these issues in a simple-to-install, user-friendly, secure, documented, battle-tested web application. Available on Viya, SAS 9 EBI, and [SASjs Server](https://server.sasjs.io).
|
||||
|
||||
For more information:
|
||||
|
||||
* Main site: https://datacontroller.io
|
||||
* Docs: https://docs.datacontroller.io
|
||||
* Code: https://code.datacontroller.io
|
@ -1,17 +1,20 @@
|
||||
import { defineConfig } from 'cypress'
|
||||
import { defineConfig } from "cypress";
|
||||
|
||||
export default defineConfig({
|
||||
reporter: 'mochawesome',
|
||||
reporter: "mochawesome",
|
||||
|
||||
reporterOptions: {
|
||||
reportDir: 'cypress/results',
|
||||
reportDir: "cypress/results",
|
||||
overwrite: false,
|
||||
html: true,
|
||||
json: false,
|
||||
},
|
||||
|
||||
chromeWebSecurity: false,
|
||||
defaultCommandTimeout: 30000,
|
||||
|
||||
env: {
|
||||
hosturl:"http://localhost:4200",
|
||||
hosturl: "http://localhost:4200",
|
||||
appLocation: "",
|
||||
site_id_SAS9: "70221618",
|
||||
site_id_SASVIYA: "70253615",
|
||||
@ -23,6 +26,12 @@ export default defineConfig({
|
||||
debug: false,
|
||||
screenshotOnRunFailure: false,
|
||||
longerCommandTimeout: 50000,
|
||||
testLicenceUserLimits: false
|
||||
}
|
||||
})
|
||||
testLicenceUserLimits: false,
|
||||
},
|
||||
|
||||
e2e: {
|
||||
setupNodeEvents(on, config) {
|
||||
// implement node event listeners here
|
||||
},
|
||||
},
|
||||
});
|
||||
|
250
client/cypress/e2e/download.cy.ts
Normal file
250
client/cypress/e2e/download.cy.ts
Normal file
@ -0,0 +1,250 @@
|
||||
const username = Cypress.env('username')
|
||||
const password = Cypress.env('password')
|
||||
const hostUrl = Cypress.env('hosturl')
|
||||
const appLocation = Cypress.env('appLocation')
|
||||
const longerCommandTimeout = Cypress.env('longerCommandTimeout')
|
||||
const serverType = Cypress.env('serverType')
|
||||
const libraryToOpenIncludes = Cypress.env(`libraryToOpenIncludes_${serverType}`)
|
||||
const downloadsFolder = Cypress.config('downloadsFolder')
|
||||
|
||||
import { deleteDownloadsFolder } from '../util/deleteDownloadFolder'
|
||||
|
||||
context('download files test: ', function () {
|
||||
this.beforeAll(() => {
|
||||
cy.visit(`${hostUrl}/SASLogon/logout`)
|
||||
cy.loginAndUpdateValidKey()
|
||||
})
|
||||
|
||||
this.beforeEach(() => {
|
||||
cy.visit(hostUrl + appLocation)
|
||||
cy.get('input.username').type(username)
|
||||
cy.get('input.password').type(password)
|
||||
cy.get('.login-group button').click()
|
||||
|
||||
visitPage('home')
|
||||
})
|
||||
|
||||
this.afterEach(() => {
|
||||
deleteDownloadsFolder()
|
||||
})
|
||||
|
||||
it('1 | downloads audit file', (done) => {
|
||||
visitPage('approve/toapprove')
|
||||
|
||||
cy.get('.app-loading', { timeout: longerCommandTimeout })
|
||||
.should('not.exist')
|
||||
.then(() => {
|
||||
cy.get('.btn.btn-success')
|
||||
.should('be.visible')
|
||||
.then((buttons) => {
|
||||
buttons[0].click()
|
||||
const id = buttons[0].id
|
||||
|
||||
checkForFileDownloaded(id, 'zip', () => done())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('2 | downloads viewer csv', (done) => {
|
||||
visitPage('view/data')
|
||||
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openDownloadModal(() => {
|
||||
cy.get('select')
|
||||
.select('CSV')
|
||||
.then(() => {
|
||||
cy.get('.btn.btn-sm.btn-success-outline').then((button) => {
|
||||
button.trigger('click')
|
||||
|
||||
const id = button[0].id
|
||||
|
||||
checkForFileDownloaded(id, 'csv', () => done())
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('3 | downloads viewer excel', (done) => {
|
||||
visitPage('view/data')
|
||||
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openDownloadModal(() => {
|
||||
cy.get('select')
|
||||
.select('Excel')
|
||||
.then(() => {
|
||||
cy.get('.btn.btn-sm.btn-success-outline').then((button) => {
|
||||
button.trigger('click')
|
||||
|
||||
const id = button[0].id
|
||||
|
||||
checkForFileDownloaded(id, 'xlsx', () => done())
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('4 | downloads viewer SAS Datalines', (done) => {
|
||||
visitPage('view/data')
|
||||
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openDownloadModal(() => {
|
||||
cy.get('select')
|
||||
.select('SAS Datalines')
|
||||
.then(() => {
|
||||
cy.get('.btn.btn-sm.btn-success-outline').then((button) => {
|
||||
button.trigger('click')
|
||||
|
||||
const id = button[0].id
|
||||
|
||||
checkForFileDownloaded(id, 'sas', () => done())
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('5 | downloads viewer SAS DDL', (done) => {
|
||||
visitPage('view/data')
|
||||
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openDownloadModal(() => {
|
||||
cy.get('select')
|
||||
.select('SAS DDL')
|
||||
.then(() => {
|
||||
cy.get('.btn.btn-sm.btn-success-outline').then((button) => {
|
||||
button.trigger('click')
|
||||
|
||||
const id = button[0].id
|
||||
|
||||
checkForFileDownloaded(id, 'ddl', () => done(), '_')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('6 | downloads viewer TSQL DDL', (done) => {
|
||||
visitPage('view/data')
|
||||
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openDownloadModal(() => {
|
||||
cy.get('select')
|
||||
.select('TSQL DDL')
|
||||
.then(() => {
|
||||
cy.get('.btn.btn-sm.btn-success-outline').then((button) => {
|
||||
button.trigger('click')
|
||||
|
||||
const id = button[0].id
|
||||
|
||||
checkForFileDownloaded(id, 'ddl', () => done(), '_')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('7 | downloads viewer PGSQL DDL', (done) => {
|
||||
visitPage('view/data')
|
||||
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openDownloadModal(() => {
|
||||
cy.get('select')
|
||||
.select('PGSQL DDL')
|
||||
.then(() => {
|
||||
cy.get('.btn.btn-sm.btn-success-outline').then((button) => {
|
||||
button.trigger('click')
|
||||
|
||||
const id = button[0].id
|
||||
|
||||
checkForFileDownloaded(id, 'ddl', () => done(), '_')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
this.afterEach(() => {
|
||||
cy.visit(`${hostUrl}/SASLogon/logout`)
|
||||
})
|
||||
})
|
||||
|
||||
const visitPage = (url: string) => {
|
||||
cy.visit(`${hostUrl}${appLocation}/#/${url}`)
|
||||
}
|
||||
|
||||
const checkForFileDownloaded = (
|
||||
id: string,
|
||||
extension: string,
|
||||
callback?: any,
|
||||
libDivider: string = '.'
|
||||
) => {
|
||||
cy.on('url:changed', (newUrl) => {
|
||||
console.log('newUrl', newUrl)
|
||||
})
|
||||
|
||||
id = id.replace('.', libDivider)
|
||||
|
||||
const filename = downloadsFolder + '/' + id + '.' + extension
|
||||
// browser might take a while to download the file,
|
||||
// so use "cy.readFile" to retry until the file exists
|
||||
// and has length - and we assume that it has finished downloading then
|
||||
cy.readFile(filename, { timeout: longerCommandTimeout })
|
||||
.should('have.length.gt', 10)
|
||||
.then((file) => {
|
||||
if (callback) callback()
|
||||
})
|
||||
}
|
||||
|
||||
const openDownloadModal = (callback?: any) => {
|
||||
cy.get('.btn.btn-sm.btn-outline.filterSide.dropdown-toggle')
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('clr-dropdown-menu button').then((buttons) => {
|
||||
for (let button of buttons) {
|
||||
if (button.innerText.toLowerCase().includes('download')) {
|
||||
button.click()
|
||||
|
||||
if (callback) callback()
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const openTableFromTree = (libNameIncludes: string, tablename: string) => {
|
||||
cy.get('.app-loading', { timeout: longerCommandTimeout })
|
||||
.should('not.exist')
|
||||
.then(() => {
|
||||
cy.get('.nav-tree clr-tree > clr-tree-node', {
|
||||
timeout: longerCommandTimeout
|
||||
}).then((treeNodes: any) => {
|
||||
let viyaLib
|
||||
|
||||
for (let node of treeNodes) {
|
||||
if (node.innerText.toLowerCase().includes(libNameIncludes)) {
|
||||
viyaLib = node
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
console.log('viyaLib', viyaLib)
|
||||
|
||||
cy.get(viyaLib).within(() => {
|
||||
cy.get(
|
||||
'.clr-tree-node-content-container .clr-treenode-content p'
|
||||
).click()
|
||||
|
||||
cy.get('.clr-treenode-link').then((innerNodes: any) => {
|
||||
for (let innerNode of innerNodes) {
|
||||
if (innerNode.innerText.toLowerCase().includes(tablename)) {
|
||||
innerNode.click()
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
257
client/cypress/e2e/editor.cy.ts
Normal file
257
client/cypress/e2e/editor.cy.ts
Normal file
@ -0,0 +1,257 @@
|
||||
const username = Cypress.env('username')
|
||||
const password = Cypress.env('password')
|
||||
const hostUrl = Cypress.env('hosturl')
|
||||
const appLocation = Cypress.env('appLocation')
|
||||
const longerCommandTimeout = Cypress.env('longerCommandTimeout')
|
||||
const serverType = Cypress.env('serverType')
|
||||
const libraryToOpenIncludes = Cypress.env(`libraryToOpenIncludes_${serverType}`)
|
||||
const fixturePath = 'excels_general/'
|
||||
|
||||
context('editor tests: ', function () {
|
||||
this.beforeAll(() => {
|
||||
cy.visit(`${hostUrl}/SASLogon/logout`)
|
||||
cy.loginAndUpdateValidKey()
|
||||
})
|
||||
|
||||
this.beforeEach(() => {
|
||||
cy.visit(hostUrl + appLocation)
|
||||
// cy.get('input.username').type(username)
|
||||
// cy.get('input.password').type(password)
|
||||
// cy.get('.login-group button').click()
|
||||
|
||||
visitPage('home')
|
||||
})
|
||||
|
||||
it('1 | Submits duplicate primary keys', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_datadictionary')
|
||||
|
||||
attachExcelFile('MPE_DATADICTIONARY_duplicate_keys.xlsx', () => {
|
||||
clickOnUploadPreview(() => {
|
||||
confirmEditPreviewFile(() => {
|
||||
submitTable(() => {
|
||||
cy.get('.modal-body').then((modalBody: any) => {
|
||||
if (modalBody[0].innerText.includes(`Duplicates found:`)) {
|
||||
done()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('2 | Submits null cells which must not be null', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
clickOnEdit(() => {
|
||||
cy.get('.btn.btn-sm.btn-icon.btn-outline-danger', {
|
||||
timeout: longerCommandTimeout
|
||||
}).then(() => {
|
||||
cy.get('.ht_master tbody tr').then((rows: any) => {
|
||||
cy.get(rows[1].childNodes[2])
|
||||
.dblclick({ force: true })
|
||||
.then(() => {
|
||||
cy.focused()
|
||||
.clear()
|
||||
.type('{enter}')
|
||||
.then(() => {
|
||||
submitTable(() => {
|
||||
cy.get('.modal-body').then((modalBody: any) => {
|
||||
if (
|
||||
modalBody[0].innerHTML
|
||||
.toLowerCase()
|
||||
.includes(`invalid values are present`)
|
||||
) {
|
||||
done()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('3 | Gets basic dynamic cell validation', () => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
clickOnEdit(() => {
|
||||
cy.get('.btn.btn-sm.btn-icon.btn-outline-danger', {
|
||||
timeout: longerCommandTimeout
|
||||
}).then(() => {
|
||||
cy.get('.ht_master tbody tr').then((rows: any) => {
|
||||
cy.get(rows[1].childNodes[5])
|
||||
.click({ force: true })
|
||||
.then(($td) => {
|
||||
cy.get('.htAutocompleteArrow', { withinSubject: $td }).should(
|
||||
'exist'
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('4 | Gets advanced dynamic cell validation', () => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_tables')
|
||||
|
||||
clickOnEdit(() => {
|
||||
cy.get('.btn.btn-sm.btn-icon.btn-outline-danger', {
|
||||
timeout: longerCommandTimeout
|
||||
}).then(() => {
|
||||
cy.get('.ht_master tbody tr').then((rows: any) => {
|
||||
cy.get(rows[1].childNodes[3])
|
||||
.click({ force: true })
|
||||
.then(($td) => {
|
||||
cy.get('.htAutocompleteArrow', { withinSubject: $td }).should(
|
||||
'exist'
|
||||
)
|
||||
cy.get('.htAutocompleteArrow', {
|
||||
withinSubject: rows[1].childNodes[7]
|
||||
}).should('exist')
|
||||
cy.get('.htAutocompleteArrow', {
|
||||
withinSubject: rows[1].childNodes[8]
|
||||
}).should('exist')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
this.afterEach(() => {
|
||||
// cy.visit(`${hostUrl}/SASLogon/logout`)
|
||||
})
|
||||
})
|
||||
|
||||
const clickOnEdit = (callback?: any) => {
|
||||
cy.get('.btnCtrl button.btn-primary', { timeout: longerCommandTimeout })
|
||||
.click()
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
}
|
||||
|
||||
const openTableFromTree = (libNameIncludes: string, tablename: string) => {
|
||||
cy.get('.app-loading', { timeout: longerCommandTimeout })
|
||||
.should('not.exist')
|
||||
.then(() => {
|
||||
cy.get('.nav-tree clr-tree > clr-tree-node', {
|
||||
timeout: longerCommandTimeout
|
||||
}).then((treeNodes: any) => {
|
||||
let viyaLib
|
||||
|
||||
for (let node of treeNodes) {
|
||||
if (node.innerText.toLowerCase().includes(libNameIncludes)) {
|
||||
viyaLib = node
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
cy.get(viyaLib).within(() => {
|
||||
cy.get('.clr-tree-node-content-container > button').click()
|
||||
|
||||
cy.get('.clr-treenode-link').then((innerNodes: any) => {
|
||||
for (let innerNode of innerNodes) {
|
||||
if (innerNode.innerText.toLowerCase().includes(tablename)) {
|
||||
innerNode.click()
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const attachExcelFile = (excelFilename: string, callback?: any) => {
|
||||
cy.get('.buttonBar button:last-child')
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('input[type="file"]#file-upload')
|
||||
.attachFile(`/${fixturePath}/${excelFilename}`)
|
||||
.then(() => {
|
||||
cy.get('.modal-footer .btn.btn-primary').then((modalBtn) => {
|
||||
modalBtn.click()
|
||||
if (callback) callback()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const clickOnUploadPreview = (callback?: any) => {
|
||||
cy.get('.buttonBar button.btn-primary.btn-upload-preview')
|
||||
.click()
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
}
|
||||
|
||||
const confirmEditPreviewFile = (callback?: any) => {
|
||||
cy.get('.modal-footer button.btn-success-outline')
|
||||
.click()
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
}
|
||||
|
||||
const submitTable = (callback?: any) => {
|
||||
cy.get('.btnCtrl button.btn-primary')
|
||||
.click()
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
}
|
||||
|
||||
const submitTableMessage = (callback?: any) => {
|
||||
cy.get('.modal-footer .btn.btn-sm.btn-success-outline')
|
||||
.click()
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
}
|
||||
|
||||
const submitExcel = (callback?: any) => {
|
||||
cy.get('.buttonBar button.preview-submit')
|
||||
.click()
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
}
|
||||
|
||||
const rejectExcel = (callback?: any) => {
|
||||
cy.get('button', { timeout: longerCommandTimeout })
|
||||
.should('contain', 'Go to approvals screen')
|
||||
.then((allButtons: any) => {
|
||||
for (let approvalButton of allButtons) {
|
||||
if (
|
||||
approvalButton.innerText
|
||||
.toLowerCase()
|
||||
.includes('go to approvals screen')
|
||||
) {
|
||||
approvalButton.click()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
cy.get('button.btn-danger')
|
||||
.should('exist')
|
||||
.should('not.be.disabled')
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('.modal-footer button.btn-success-outline')
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('app-history')
|
||||
.should('exist')
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const visitPage = (url: string) => {
|
||||
cy.visit(`${hostUrl}${appLocation}/#/${url}`)
|
||||
}
|
537
client/cypress/e2e/excel.cy.ts
Normal file
537
client/cypress/e2e/excel.cy.ts
Normal file
@ -0,0 +1,537 @@
|
||||
import { Callbacks } from 'cypress/types/jquery/index'
|
||||
|
||||
const username = Cypress.env('username')
|
||||
const password = Cypress.env('password')
|
||||
const hostUrl = Cypress.env('hosturl')
|
||||
const appLocation = Cypress.env('appLocation')
|
||||
const longerCommandTimeout = Cypress.env('longerCommandTimeout')
|
||||
const serverType = Cypress.env('serverType')
|
||||
const libraryToOpenIncludes = Cypress.env(`libraryToOpenIncludes_${serverType}`)
|
||||
const fixturePath = 'excels/'
|
||||
|
||||
context('excel tests: ', function () {
|
||||
this.beforeAll(() => {
|
||||
cy.visit(`${hostUrl}/SASLogon/logout`)
|
||||
cy.loginAndUpdateValidKey(true)
|
||||
})
|
||||
|
||||
this.beforeEach(() => {
|
||||
cy.visit(hostUrl + appLocation)
|
||||
// cy.get('input.username').type(username)
|
||||
// cy.get('input.password').type(password)
|
||||
// cy.get('.login-group button').click()
|
||||
|
||||
visitPage('home')
|
||||
|
||||
colorLog(
|
||||
`TEST START ---> ${
|
||||
Cypress.mocha.getRunner().suite.ctx.currentTest.title
|
||||
}`,
|
||||
'#3498DB'
|
||||
)
|
||||
})
|
||||
|
||||
it('1 | Uploads regular Excel file', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('regular_excel.xlsx', () => {
|
||||
submitExcel()
|
||||
rejectExcel(done)
|
||||
})
|
||||
})
|
||||
|
||||
it('2 | Uploads Excel with data on the 7th tab', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('7th_tab_excel.xlsx', () => {
|
||||
submitExcel()
|
||||
rejectExcel(done)
|
||||
})
|
||||
})
|
||||
|
||||
it('3 | Uploads Excel with missing columns (should fail)', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('missing_columns_excel.xlsx', () => {
|
||||
cy.get('.abortMsg', { timeout: longerCommandTimeout })
|
||||
.should('exist')
|
||||
.then((elements: any) => {
|
||||
if (elements[0]) {
|
||||
if (elements[0].innerText.toLowerCase().includes('missing')) done()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('4 | Uploads Excel with formulas', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_datadictionary')
|
||||
|
||||
attachExcelFile('formulas_excel.xlsx', () => {
|
||||
checkResultOfFormulaUpload(done)
|
||||
})
|
||||
})
|
||||
|
||||
it('5 | Uploads Excel with no data rows', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('nodata_rows_excel.xlsx', () => {
|
||||
cy.get('.abortMsg', { timeout: longerCommandTimeout })
|
||||
.should('exist')
|
||||
.then((elements: any) => {
|
||||
if (elements[0]) {
|
||||
if (
|
||||
elements[0].innerText
|
||||
.toLowerCase()
|
||||
.includes('no relevant data found')
|
||||
)
|
||||
done()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('6 | Uploads Excel with a table that is surrounded by other data', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('surrounded_data_excel.xlsx', () => {
|
||||
submitExcel()
|
||||
rejectExcel(done)
|
||||
})
|
||||
})
|
||||
|
||||
it('7 | Uploads Excel with a extra columns in the middle', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('extra_column_excel.xlsx', () => {
|
||||
submitExcel()
|
||||
rejectExcel(done)
|
||||
})
|
||||
})
|
||||
|
||||
it('8 | Uploads Excel with a duplicate column', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('duplicate_column_excel.xlsx', () => {
|
||||
cy.get('.abortMsg', { timeout: longerCommandTimeout })
|
||||
.should('exist')
|
||||
.then((elements: any) => {
|
||||
if (elements[0]) {
|
||||
if (elements[0].innerText.toLowerCase().includes('missing')) done()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('9 | Uploads Excel with a duplicate row', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('duplicate_row_excel.xlsx', () => {
|
||||
submitExcel(() => {
|
||||
cy.get('.duplicate-keys-modal', { timeout: longerCommandTimeout })
|
||||
.should('exist')
|
||||
.then((elements: any) => {
|
||||
if (elements[0]) {
|
||||
if (elements[0].innerText.toLowerCase().includes('duplicates'))
|
||||
done()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('10 | Uploads Excel with a mixed content', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('mixed_content_excel.xlsx', () => {
|
||||
submitExcel(() => {
|
||||
cy.get('.modal-body').then((modalBody: any) => {
|
||||
if (
|
||||
modalBody[0].innerHTML
|
||||
.toLowerCase()
|
||||
.includes(`invalid values are present`)
|
||||
) {
|
||||
done()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('11 | Uploads Excel with a blank columns', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('blank_columns_excel.xlsx', () => {
|
||||
cy.get('.abortMsg', { timeout: longerCommandTimeout })
|
||||
.should('exist')
|
||||
.then((elements: any) => {
|
||||
if (elements[0]) {
|
||||
if (elements[0].innerText.toLowerCase().includes('missing')) done()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('12 | Uploads Excel xls extension', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('regular_excel_xls.xls', () => {
|
||||
submitExcel()
|
||||
rejectExcel(done)
|
||||
})
|
||||
})
|
||||
|
||||
// For some strange reason this file breaks cypress. When uploaded manually in DC it is working.
|
||||
// it('13 | Uploads Excel xlsm extension', (done) => {
|
||||
// openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
// attachExcelFile('regular_excel_macro.xlsm', () => {
|
||||
// submitExcel()
|
||||
// rejectExcel(done)
|
||||
// })
|
||||
// })
|
||||
|
||||
it('14 | Uploads Excel with composite primary key', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_datadictionary')
|
||||
|
||||
attachExcelFile('MPE_DATADICTIONARY_composite_keys.xlsx', () => {
|
||||
submitExcel()
|
||||
rejectExcel(done)
|
||||
})
|
||||
})
|
||||
|
||||
it('15 | Uploads Excel with missing row (empty table)', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_datadictionary')
|
||||
|
||||
attachExcelFile('MPE_DATADICTIONARY_missing_row.xlsx', () => {
|
||||
cy.get('.abortMsg', { timeout: longerCommandTimeout })
|
||||
.should('exist')
|
||||
.then((elements: any) => {
|
||||
if (elements[0]) {
|
||||
if (
|
||||
elements[0].innerText
|
||||
.toLowerCase()
|
||||
.includes('no relevant data found')
|
||||
)
|
||||
done()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('16 | Uploads Excel with merged cells', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_datadictionary')
|
||||
|
||||
attachExcelFile('MPE_DATADICTIONARY_merged_cells.xlsx', () => {
|
||||
submitExcel()
|
||||
rejectExcel(done)
|
||||
})
|
||||
})
|
||||
|
||||
it('17 | Check uploaded values from excel with xls extension', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('regular_excel_xls.xls', () => {
|
||||
checkResultOfXLSUpload(done)
|
||||
})
|
||||
})
|
||||
|
||||
it('18 | Uploads Excel with missing row (empty table)', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('blank_column_with_header.xlsx', () => {
|
||||
cy.get('.btn-upload-preview', { timeout: 60000 })
|
||||
.should('be.visible')
|
||||
.then(() => {
|
||||
cy.get('#hotInstance', { timeout: 30000 })
|
||||
.find('div.ht_master.handsontable')
|
||||
.find('div.wtHolder')
|
||||
.find('div.wtHider')
|
||||
.find('div.wtSpreader')
|
||||
.find('table.htCore')
|
||||
.find('tbody')
|
||||
.then((data) => {
|
||||
let allEmpty = true
|
||||
|
||||
for (let col = 0; col < data[0].children.length; col++) {
|
||||
const cell: any = data[0].children[col].children[5]
|
||||
|
||||
if (cell.innerText !== '') {
|
||||
allEmpty = false
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (allEmpty) done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('19 | Uploads Excel with data on random sheet surrounded with all empty cells', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('surrounded_data_all_cells_empty_excel.xlsx', () => {
|
||||
checkResultOfXLSUpload(done)
|
||||
})
|
||||
})
|
||||
|
||||
it('20 | Uploads Excel with data surrounded with empty cells ', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('surrounded_data_empty_cells_excel.xlsx', () => {
|
||||
checkResultOfXLSUpload(done)
|
||||
})
|
||||
})
|
||||
|
||||
it('21 | Uploads regular Excel file with first row marked for Delete (yes)', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
attachExcelFile('regular_excel_with_delete.xlsx', () => {
|
||||
cy.get('.btn-upload-preview', { timeout: 60000 })
|
||||
.should('be.visible')
|
||||
.then(() => {
|
||||
cy.get('#hotInstance', { timeout: 30000 })
|
||||
.find('div.ht_master.handsontable')
|
||||
.find('div.wtHolder')
|
||||
.find('div.wtHider')
|
||||
.find('div.wtSpreader')
|
||||
.find('table.htCore')
|
||||
.find('tbody')
|
||||
.then((data: JQuery<HTMLTableSectionElement>) => {
|
||||
const firstRowFirstCol: Partial<HTMLElement> =
|
||||
data[0].children[0].children[1]
|
||||
|
||||
if (
|
||||
firstRowFirstCol.innerText &&
|
||||
!firstRowFirstCol.innerText.toLowerCase().includes('yes')
|
||||
) {
|
||||
done('Delete? column from file not applied')
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
submitExcel()
|
||||
rejectExcel(done)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
// Large files break Cypress
|
||||
|
||||
// it ('? | Uploads Excel with size of 5MB', (done) => {
|
||||
// attachExcelFile('5mb_excel.xlsx', () => {
|
||||
// submitExcel();
|
||||
// rejectExcel(done);
|
||||
// });
|
||||
// })
|
||||
|
||||
// it ('? | Uploads Excel with size of 15MB', (done) => {
|
||||
// attachExcelFile('15mb_excel.xlsx', () => {
|
||||
// submitExcel();
|
||||
// rejectExcel(done);
|
||||
// });
|
||||
// })
|
||||
|
||||
//Large files tests end
|
||||
|
||||
this.afterEach(() => {
|
||||
colorLog(`TEST END -------------`, '#3498DB')
|
||||
// cy.visit(`${hostUrl}/SASLogon/logout`)
|
||||
})
|
||||
})
|
||||
|
||||
const openTableFromTree = (libNameIncludes: string, tablename: string) => {
|
||||
cy.get('.app-loading', { timeout: longerCommandTimeout })
|
||||
.should('not.exist')
|
||||
.then(() => {
|
||||
cy.get('.nav-tree clr-tree > clr-tree-node', {
|
||||
timeout: longerCommandTimeout
|
||||
}).then((treeNodes: any) => {
|
||||
let viyaLib
|
||||
|
||||
for (let node of treeNodes) {
|
||||
if (node.innerText.toLowerCase().includes(libNameIncludes)) {
|
||||
viyaLib = node
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
cy.get(viyaLib).within(() => {
|
||||
cy.get('.clr-tree-node-content-container > button').click()
|
||||
|
||||
cy.get('.clr-treenode-link').then((innerNodes: any) => {
|
||||
for (let innerNode of innerNodes) {
|
||||
if (innerNode.innerText.toLowerCase().includes(tablename)) {
|
||||
innerNode.click()
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const attachExcelFile = (excelFilename: string, callback?: any) => {
|
||||
cy.get('.buttonBar button:last-child')
|
||||
.should('exist')
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('input[type="file"]#file-upload')
|
||||
.attachFile(`/${fixturePath}/${excelFilename}`)
|
||||
.then(() => {
|
||||
cy.get('.clr-abort-modal .modal-title').then((modalTitle) => {
|
||||
if (!modalTitle[0].innerHTML.includes('Abort Message')) {
|
||||
cy.get('.modal-footer .btn.btn-primary').then((modalBtn) => {
|
||||
modalBtn.click()
|
||||
if (callback) callback()
|
||||
})
|
||||
} else {
|
||||
if (callback) callback()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const submitExcel = (callback?: any) => {
|
||||
cy.get('.buttonBar button.preview-submit', { timeout: longerCommandTimeout })
|
||||
.click()
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
}
|
||||
|
||||
const rejectExcel = (callback?: any) => {
|
||||
cy.get('button', { timeout: longerCommandTimeout })
|
||||
.should('contain', 'Go to approvals screen')
|
||||
.then((allButtons: any) => {
|
||||
for (let approvalButton of allButtons) {
|
||||
if (
|
||||
approvalButton.innerText
|
||||
.toLowerCase()
|
||||
.includes('go to approvals screen')
|
||||
) {
|
||||
approvalButton.click()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
cy.get('button.btn-danger')
|
||||
.should('exist')
|
||||
.should('not.be.disabled')
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('.modal-footer button.btn-success-outline')
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('app-history')
|
||||
.should('exist')
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const acceptExcel = (callback?: any) => {
|
||||
cy.get('button', { timeout: longerCommandTimeout })
|
||||
.should('contain', 'Go to approvals screen')
|
||||
.then((allButtons: any) => {
|
||||
for (let approvalButton of allButtons) {
|
||||
if (
|
||||
approvalButton.innerText
|
||||
.toLowerCase()
|
||||
.includes('go to approvals screen')
|
||||
) {
|
||||
approvalButton.click()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
cy.get('#acceptBtn')
|
||||
.should('exist')
|
||||
.should('not.be.disabled')
|
||||
.click()
|
||||
.then(() => {
|
||||
if (callback) {
|
||||
callback()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const checkResultOfFormulaUpload = (callback?: any) => {
|
||||
cy.get('#hotInstance', { timeout: longerCommandTimeout })
|
||||
.find('div.ht_master.handsontable')
|
||||
.find('div.wtHolder')
|
||||
.find('div.wtHider')
|
||||
.find('div.wtSpreader')
|
||||
.find('table.htCore')
|
||||
.find('tbody')
|
||||
.then((data) => {
|
||||
const cell: any = data[0].children[0].children[5]
|
||||
expect(cell.innerText).to.equal('=1+1')
|
||||
if (callback) callback()
|
||||
})
|
||||
}
|
||||
|
||||
const checkResultOfXLSUpload = (callback?: any) => {
|
||||
cy.viewport(1280, 720)
|
||||
cy.get('#hotInstance', { timeout: 30000 })
|
||||
.find('div.ht_master.handsontable')
|
||||
.find('div.wtHolder')
|
||||
.find('div.wtHider')
|
||||
.find('div.wtSpreader')
|
||||
.find('table.htCore')
|
||||
.find('tbody')
|
||||
.then((data) => {
|
||||
let cell: any = data[0].children[0].children[2]
|
||||
|
||||
expect(cell.innerText).to.equal('0')
|
||||
cell = data[0].children[0].children[3]
|
||||
expect(cell.innerText).to.equal('this is dummy data changed in excel')
|
||||
cell = data[0].children[0].children[4]
|
||||
expect(cell.innerText).to.equal('▼\nOption 1')
|
||||
cell = data[0].children[0].children[5]
|
||||
expect(cell.innerText).to.equal('42')
|
||||
cell = data[0].children[0].children[6]
|
||||
expect(cell.innerText).to.equal('▼\n1960-02-12')
|
||||
// When CI detached browser screen is smaller, below cells are not visible so test fails
|
||||
// Commenting it out now until we figure out workaround
|
||||
// cell = data[0].children[0].children[7]
|
||||
// expect(cell.innerText).to.equal('▼\n1960-01-01 00:00:42')
|
||||
// cell = data[0].children[0].children[8]
|
||||
// expect(cell.innerText).to.equal('00:00:42')
|
||||
|
||||
if (callback) callback()
|
||||
})
|
||||
|
||||
cy.get('#hotInstance', { timeout: 30000 })
|
||||
.find('div.ht_master.handsontable')
|
||||
.find('div.wtHolder')
|
||||
.scrollTo('right')
|
||||
.find('div.wtHider')
|
||||
.find('div.wtSpreader')
|
||||
.find('table.htCore')
|
||||
.find('tbody')
|
||||
.then((data) => {
|
||||
let cell: any = data[0].children[0].children[1]
|
||||
|
||||
cell = data[0].children[0].children[9]
|
||||
|
||||
expect(cell.innerText).to.equal('44')
|
||||
|
||||
if (callback) callback()
|
||||
})
|
||||
}
|
||||
|
||||
const visitPage = (url: string) => {
|
||||
cy.visit(`${hostUrl}${appLocation}/#/${url}`)
|
||||
}
|
||||
|
||||
const colorLog = (msg: string, color: string) => {
|
||||
console.log('%c' + msg, 'color:' + color + ';font-weight:bold;')
|
||||
}
|
383
client/cypress/e2e/filtering.cy.ts
Normal file
383
client/cypress/e2e/filtering.cy.ts
Normal file
@ -0,0 +1,383 @@
|
||||
const username = Cypress.env('username')
|
||||
const password = Cypress.env('password')
|
||||
const hostUrl = Cypress.env('hosturl')
|
||||
const appLocation = Cypress.env('appLocation')
|
||||
const longerCommandTimeout = Cypress.env('longerCommandTimeout')
|
||||
const serverType = Cypress.env('serverType')
|
||||
const libraryToOpenIncludes = Cypress.env(`libraryToOpenIncludes_${serverType}`)
|
||||
const fixturePath = 'excels_general/'
|
||||
|
||||
context('filtering tests: ', function () {
|
||||
this.beforeAll(() => {
|
||||
cy.visit(`${hostUrl}/SASLogon/logout`, { timeout: longerCommandTimeout })
|
||||
cy.loginAndUpdateValidKey()
|
||||
})
|
||||
|
||||
this.beforeEach(() => {
|
||||
cy.visit(hostUrl + appLocation, { timeout: longerCommandTimeout })
|
||||
// cy.get('input.username').type(username)
|
||||
// cy.get('input.password').type(password)
|
||||
// cy.get('.login-group button').click()
|
||||
|
||||
visitPage('home')
|
||||
})
|
||||
|
||||
it('1 | filter char field', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openFilterPopup(() => {
|
||||
setFilterWithValue('SOME_CHAR', 'this is dummy data', 'value', () => {
|
||||
checkInfoBarIncludes(
|
||||
`AND,AND,0,SOME_CHAR,=,"'this is dummy data'"`,
|
||||
(includes: boolean) => {
|
||||
if (includes) done()
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('2 | filter number field', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openFilterPopup(() => {
|
||||
setFilterWithValue('SOME_NUM', '42', 'value', () => {
|
||||
checkInfoBarIncludes(`AND,AND,0,SOME_NUM,=,42`, (includes: boolean) => {
|
||||
if (includes) done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('3 | filter time field', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openFilterPopup(() => {
|
||||
setFilterWithValue('SOME_TIME', '00:00:42', 'time', () => {
|
||||
checkInfoBarIncludes(
|
||||
`AND,AND,0,SOME_TIME,=,42`,
|
||||
(includes: boolean) => {
|
||||
if (includes) done()
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('3.1 | Non picker - filter time field', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openFilterPopup(() => {
|
||||
setFilterWithValue('SOME_TIME', '42', 'value', () => {
|
||||
checkInfoBarIncludes(
|
||||
`AND,AND,0,SOME_TIME,=,42`,
|
||||
(includes: boolean) => {
|
||||
if (includes) done()
|
||||
}
|
||||
)
|
||||
})
|
||||
}, false)
|
||||
})
|
||||
|
||||
it('4 | filter date field', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openFilterPopup(() => {
|
||||
setFilterWithValue('SOME_DATE', '12/02/1960', 'date', () => {
|
||||
checkInfoBarIncludes(
|
||||
`AND,AND,0,SOME_DATE,=,42`,
|
||||
(includes: boolean) => {
|
||||
if (includes) done()
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('4.1 | Non picker - filter date field', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openFilterPopup(() => {
|
||||
setFilterWithValue('SOME_DATE', '42', 'value', () => {
|
||||
checkInfoBarIncludes(
|
||||
`AND,AND,0,SOME_DATE,=,42`,
|
||||
(includes: boolean) => {
|
||||
if (includes) done()
|
||||
}
|
||||
)
|
||||
})
|
||||
}, false)
|
||||
})
|
||||
|
||||
it('5 | filter datetime field', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openFilterPopup(() => {
|
||||
setFilterWithValue(
|
||||
'SOME_DATETIME',
|
||||
'01/01/1960 00:00:42',
|
||||
'datetime',
|
||||
() => {
|
||||
checkInfoBarIncludes(
|
||||
`AND,AND,0,SOME_DATETIME,=,42`,
|
||||
(includes: boolean) => {
|
||||
if (includes) done()
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
it('5.1 | Non picker - filter datetime field', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openFilterPopup(() => {
|
||||
setFilterWithValue('SOME_DATETIME', '42', 'value', () => {
|
||||
checkInfoBarIncludes(
|
||||
`AND,AND,0,SOME_DATETIME,=,42`,
|
||||
(includes: boolean) => {
|
||||
if (includes) done()
|
||||
}
|
||||
)
|
||||
})
|
||||
}, false)
|
||||
})
|
||||
|
||||
it('6 | filter date field IN', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openFilterPopup(() => {
|
||||
setFilterWithValue('SOME_DATE', '', 'in', () => {
|
||||
checkInfoBarIncludes(
|
||||
`AND,AND,0,SOME_DATE,IN,(0)`,
|
||||
(includes: boolean) => {
|
||||
if (includes) done()
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('7 | filter bestnum field BETWEEN', (done) => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
openFilterPopup(() => {
|
||||
setFilterWithValue('SOME_BESTNUM', '0-10', 'between', () => {
|
||||
checkInfoBarIncludes(
|
||||
`AND,AND,0,SOME_BESTNUM,BETWEEN,0 AND 10`,
|
||||
(includes: boolean) => {
|
||||
if (includes) done()
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
this.afterEach(() => {
|
||||
// cy.visit(`${hostUrl}/SASLogon/logout`)
|
||||
})
|
||||
})
|
||||
|
||||
const checkInfoBarIncludes = (text: string, callback: any) => {
|
||||
cy.get('.infoBar b', { timeout: longerCommandTimeout }).then((el: any) => {
|
||||
const includes = el[0].innerText.toLowerCase().includes(text.toLowerCase())
|
||||
|
||||
if (callback) callback(includes)
|
||||
})
|
||||
}
|
||||
|
||||
const openFilterPopup = (
|
||||
callback?: any,
|
||||
usePickers: boolean = true,
|
||||
isViewerFiltering: boolean = false
|
||||
) => {
|
||||
const filterButton = isViewerFiltering
|
||||
? '.btn-outline.filterSide'
|
||||
: '.btnCtrl .btnView'
|
||||
|
||||
cy.get(filterButton, { timeout: longerCommandTimeout }).then(
|
||||
(optionsButton: any) => {
|
||||
optionsButton.click()
|
||||
|
||||
if (isViewerFiltering) {
|
||||
cy.wait(300)
|
||||
|
||||
cy.get('.dropdown-menu button').then(async (dropdownButtons: any) => {
|
||||
let filterButton = null
|
||||
|
||||
for (let btn of dropdownButtons) {
|
||||
if (btn.innerText.toLowerCase().includes('filter')) {
|
||||
filterButton = btn
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (filterButton) {
|
||||
filterButton.click()
|
||||
|
||||
if (usePickers) turnOnPickers()
|
||||
|
||||
if (callback) callback()
|
||||
|
||||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (usePickers) turnOnPickers()
|
||||
if (callback) callback()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
const turnOnPickers = () => {
|
||||
cy.get('#usePickers')
|
||||
.should('exist')
|
||||
.then((picker: any) => {
|
||||
picker[0].click()
|
||||
})
|
||||
}
|
||||
|
||||
const setFilterWithValue = (
|
||||
variableValue: string,
|
||||
valueString: string,
|
||||
valueField: 'value' | 'time' | 'date' | 'datetime' | 'in' | 'between',
|
||||
callback?: any
|
||||
) => {
|
||||
cy.wait(600)
|
||||
|
||||
cy.focused().type(variableValue)
|
||||
cy.wait(100)
|
||||
// cy.focused().trigger('input')
|
||||
cy.get('.variable-col .autocomplete-wrapper', { withinSubject: null })
|
||||
.first()
|
||||
.trigger('keydown', { key: 'ArrowDown' })
|
||||
cy.get('.variable-col .autocomplete-wrapper', {
|
||||
withinSubject: null
|
||||
}).trigger('keydown', { key: 'Enter' })
|
||||
cy.focused().tab()
|
||||
cy.wait(100)
|
||||
|
||||
if (valueField === 'in') {
|
||||
cy.focused().select(valueField.toUpperCase()).trigger('change')
|
||||
} else if (valueField === 'between') {
|
||||
cy.focused().select(valueField.toUpperCase()).trigger('change')
|
||||
} else {
|
||||
cy.focused().tab()
|
||||
cy.wait(100)
|
||||
}
|
||||
|
||||
switch (valueField) {
|
||||
case 'value': {
|
||||
cy.focused().type(valueString)
|
||||
|
||||
break
|
||||
}
|
||||
case 'time': {
|
||||
cy.focused().type(valueString)
|
||||
|
||||
break
|
||||
}
|
||||
case 'date': {
|
||||
cy.focused().type(valueString)
|
||||
cy.focused().tab()
|
||||
|
||||
break
|
||||
}
|
||||
case 'datetime': {
|
||||
const date = valueString.split(' ')[0]
|
||||
const time = valueString.split(' ')[1]
|
||||
|
||||
cy.focused().type(date)
|
||||
cy.focused().tab()
|
||||
cy.focused().tab()
|
||||
cy.focused().type(time)
|
||||
|
||||
break
|
||||
}
|
||||
case 'in': {
|
||||
cy.get('.checkbox-vals').then(() => {
|
||||
cy.focused().tab()
|
||||
cy.focused().click()
|
||||
cy.get('.no-values')
|
||||
.should('not.exist')
|
||||
.then(() => {
|
||||
cy.get('.in-values-modal clr-checkbox-wrapper input').then((inputs: any) => {
|
||||
inputs[0].click()
|
||||
cy.get('.in-values-modal .modal-footer button').click()
|
||||
|
||||
cy.get('.modal-footer .btn-success-outline').click()
|
||||
|
||||
if (callback) callback()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
break
|
||||
}
|
||||
case 'between': {
|
||||
cy.focused().tab()
|
||||
|
||||
const start = valueString.split('-')[0]
|
||||
const end = valueString.split('-')[1]
|
||||
|
||||
cy.focused().type(start)
|
||||
cy.focused().tab()
|
||||
cy.focused().type(end)
|
||||
}
|
||||
default: {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
cy.wait(100)
|
||||
cy.focused().tab()
|
||||
cy.wait(100)
|
||||
cy.focused().tab()
|
||||
cy.wait(100)
|
||||
cy.focused().tab()
|
||||
cy.wait(100)
|
||||
cy.focused().tab()
|
||||
cy.wait(100)
|
||||
cy.focused().click()
|
||||
|
||||
if (callback) callback()
|
||||
}
|
||||
|
||||
const openTableFromTree = (libNameIncludes: string, tablename: string) => {
|
||||
cy.get('.app-loading', { timeout: longerCommandTimeout })
|
||||
.should('not.exist')
|
||||
.then(() => {
|
||||
cy.get('.nav-tree clr-tree > clr-tree-node', {
|
||||
timeout: longerCommandTimeout
|
||||
}).then((treeNodes: any) => {
|
||||
let viyaLib
|
||||
|
||||
for (let node of treeNodes) {
|
||||
if (new RegExp(libNameIncludes).test(node.innerText.toLowerCase())) {
|
||||
viyaLib = node
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
cy.get(viyaLib).within(() => {
|
||||
cy.get('.clr-tree-node-content-container p').click()
|
||||
|
||||
cy.get('.clr-treenode-link').then((innerNodes: any) => {
|
||||
for (let innerNode of innerNodes) {
|
||||
if (innerNode.innerText.toLowerCase().includes(tablename)) {
|
||||
innerNode.click()
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const visitPage = (url: string) => {
|
||||
cy.visit(`${hostUrl}${appLocation}/#/${url}`)
|
||||
}
|
731
client/cypress/e2e/licensing.cy.ts
Normal file
731
client/cypress/e2e/licensing.cy.ts
Normal file
@ -0,0 +1,731 @@
|
||||
import { arrayBufferToBase64 } from './../util/helper-functions'
|
||||
import * as moment from 'moment'
|
||||
|
||||
const username = Cypress.env('username')
|
||||
const password = Cypress.env('password')
|
||||
const hostUrl = Cypress.env('hosturl')
|
||||
const appLocation = Cypress.env('appLocation')
|
||||
const longerCommandTimeout = Cypress.env('longerCommandTimeout')
|
||||
const fixturePath = 'excels_general/'
|
||||
const serverType = Cypress.env('serverType')
|
||||
const site_id = Cypress.env(`site_id_${serverType}`)
|
||||
const libraryToOpenIncludes = Cypress.env(`libraryToOpenIncludes_${serverType}`)
|
||||
const testLicenceUserLimits = Cypress.env('testLicenceUserLimits')
|
||||
|
||||
/** IMPORTANT NOTICE
|
||||
* Before running tests, make sure that table `MPE_USERS` is present
|
||||
*/
|
||||
|
||||
interface EditConfigTableCells {
|
||||
varName: string
|
||||
varValue: string
|
||||
}
|
||||
|
||||
context('licensing tests: ', function () {
|
||||
this.beforeAll(() => {
|
||||
// cy.visit(`${hostUrl}/SASLogon/logout`)
|
||||
cy.loginAndUpdateValidKey()
|
||||
})
|
||||
|
||||
this.beforeEach(() => {
|
||||
cy.visit(hostUrl + appLocation)
|
||||
// cy.get('input.username').type(username)
|
||||
// cy.get('input.password').type(password)
|
||||
// cy.get('.login-group button').click()
|
||||
|
||||
visitPage('home')
|
||||
})
|
||||
|
||||
it('1 | key valid, not expired', (done) => {
|
||||
let keyData = {
|
||||
valid_until: moment().add(1, 'year').format('YYYY-MM-DD'),
|
||||
users_allowed: 4,
|
||||
hot_license_key: '',
|
||||
demo: false,
|
||||
site_id: site_id
|
||||
}
|
||||
|
||||
let keys: { licenseKey: any; activationKey: any }
|
||||
generateKeys(keyData, (keysGen: any) => {
|
||||
keys = keysGen
|
||||
|
||||
cy.wait(2000)
|
||||
|
||||
isLicensingPage((result: boolean) => {
|
||||
if (result) {
|
||||
inputLicenseKeyPage(keys.licenseKey, keys.activationKey)
|
||||
|
||||
cy.wait(2000)
|
||||
}
|
||||
|
||||
acceptTermsIfPresented((result: boolean) => {
|
||||
if (result) {
|
||||
cy.wait(10000)
|
||||
}
|
||||
|
||||
visitPage('home')
|
||||
|
||||
cy.get('.nav-tree clr-tree > clr-tree-node', {
|
||||
timeout: longerCommandTimeout
|
||||
}).then((treeNodes: any) => {
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('2 | Key will expire in less then 14 days, not free tier', (done) => {
|
||||
// make 2 separate for this one
|
||||
let keyData = {
|
||||
valid_until: moment().add(10, 'day').format('YYYY-MM-DD'),
|
||||
users_allowed: 4,
|
||||
hot_license_key: '',
|
||||
demo: false,
|
||||
site_id: site_id
|
||||
}
|
||||
|
||||
let keys: { licenseKey: any; activationKey: any }
|
||||
generateKeys(keyData, (keysGen: any) => {
|
||||
keys = keysGen
|
||||
console.log('keys', keys)
|
||||
|
||||
cy.wait(2000)
|
||||
|
||||
acceptTermsIfPresented((result: boolean) => {
|
||||
if (result) {
|
||||
cy.wait(20000)
|
||||
}
|
||||
updateLicenseKeyQuick(keysGen, () => {
|
||||
cy.wait(2000)
|
||||
acceptTermsIfPresented((result: boolean) => {
|
||||
if (result) {
|
||||
cy.wait(20000)
|
||||
}
|
||||
verifyLicensingWarning('This license key will expire in ', () => {
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('3 | key expired, free tier works', (done) => {
|
||||
let keyData = {
|
||||
valid_until: moment().subtract(1, 'day').format('YYYY-MM-DD'),
|
||||
users_allowed: 4,
|
||||
hot_license_key: '',
|
||||
demo: false,
|
||||
site_id: site_id
|
||||
}
|
||||
|
||||
let keys: { licenseKey: any; activationKey: any }
|
||||
generateKeys(keyData, (keysGen: any) => {
|
||||
keys = keysGen
|
||||
|
||||
cy.wait(2000)
|
||||
|
||||
acceptTermsIfPresented((result: boolean) => {
|
||||
if (result) {
|
||||
cy.wait(20000)
|
||||
}
|
||||
cy.wait(2000)
|
||||
updateLicenseKeyQuick(keysGen, () => {
|
||||
cy.wait(2000)
|
||||
acceptTermsIfPresented((result: boolean) => {
|
||||
if (result) {
|
||||
cy.wait(20000)
|
||||
}
|
||||
verifyLicensingPage(
|
||||
'Licence key is expired - please contact',
|
||||
(success: boolean) => {
|
||||
if (success) {
|
||||
verifyLicensingWarning(
|
||||
'(FREE Tier) - Problem with licence',
|
||||
() => {
|
||||
done()
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('4 | key invalid, free tier works', (done) => {
|
||||
let keyData = {
|
||||
valid_until: moment().subtract(1, 'day').format('YYYY-MM-DD'),
|
||||
users_allowed: 4,
|
||||
hot_license_key: '',
|
||||
demo: false,
|
||||
site_id: site_id
|
||||
}
|
||||
|
||||
let keys: { licenseKey: any; activationKey: any }
|
||||
generateKeys(keyData, (keysGen: any) => {
|
||||
keys = keysGen
|
||||
keys.activationKey = 'invalid' + keys.activationKey
|
||||
|
||||
cy.wait(2000)
|
||||
|
||||
acceptTermsIfPresented((result: boolean) => {
|
||||
if (result) {
|
||||
cy.wait(20000)
|
||||
}
|
||||
cy.wait(2000)
|
||||
updateLicenseKeyQuick(keysGen, () => {
|
||||
cy.wait(2000)
|
||||
acceptTermsIfPresented((result: boolean) => {
|
||||
if (result) {
|
||||
cy.wait(20000)
|
||||
}
|
||||
verifyLicensingPage(
|
||||
'Licence key is invalid - please contact',
|
||||
(success: boolean) => {
|
||||
if (success) {
|
||||
verifyLicensingWarning(
|
||||
'(FREE Tier) - Problem with licence',
|
||||
() => {
|
||||
done()
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('5 | key for wrong organisation, free tier works', (done) => {
|
||||
let keyData = {
|
||||
valid_until: moment().add(1, 'year').format('YYYY-MM-DD'),
|
||||
users_allowed: 4,
|
||||
hot_license_key: '',
|
||||
demo: false,
|
||||
site_id: 100
|
||||
}
|
||||
|
||||
let keys: { licenseKey: any; activationKey: any }
|
||||
generateKeys(keyData, (keysGen: any) => {
|
||||
keys = keysGen
|
||||
keys.activationKey = keys.activationKey
|
||||
|
||||
cy.wait(2000)
|
||||
|
||||
acceptTermsIfPresented((result: boolean) => {
|
||||
if (result) {
|
||||
cy.wait(20000)
|
||||
}
|
||||
cy.wait(2000)
|
||||
updateLicenseKeyQuick(keysGen, () => {
|
||||
cy.wait(2000)
|
||||
acceptTermsIfPresented((result: boolean) => {
|
||||
if (result) {
|
||||
cy.wait(20000)
|
||||
}
|
||||
verifyLicensingPage(
|
||||
'SYSSITE (below) is not found',
|
||||
(success: boolean) => {
|
||||
if (success) {
|
||||
verifyLicensingWarning(
|
||||
'(FREE Tier) - Problem with licence',
|
||||
() => {
|
||||
done()
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
if (testLicenceUserLimits) {
|
||||
it('4 | User try to register when limit is reached', (done) => {
|
||||
let keyData = {
|
||||
valid_until: moment().add(1, 'month').format('YYYY-MM-DD'),
|
||||
users_allowed: 10,
|
||||
hot_license_key: '',
|
||||
demo: false,
|
||||
site_id: site_id
|
||||
}
|
||||
let keyData2 = {
|
||||
valid_until: moment().add(1, 'month').format('YYYY-MM-DD'),
|
||||
users_allowed: 1,
|
||||
hot_license_key: '',
|
||||
demo: false,
|
||||
site_id: site_id
|
||||
}
|
||||
generateKeys(keyData, (keysGen: any) => {
|
||||
generateKeys(keyData2, (keysGen2: any) => {
|
||||
cy.wait(2000)
|
||||
|
||||
acceptTermsIfPresented((result: boolean) => {
|
||||
if (result) {
|
||||
cy.wait(20000)
|
||||
}
|
||||
updateLicenseKeyQuick(keysGen, () => {
|
||||
cy.wait(2000)
|
||||
acceptTermsIfPresented((result: boolean) => {
|
||||
if (result) {
|
||||
cy.wait(20000)
|
||||
}
|
||||
|
||||
updateLicenseKeyQuick(keysGen2, () => {
|
||||
cy.wait(2000)
|
||||
|
||||
const random = Cypress._.random(0, 1000)
|
||||
const newUser = {
|
||||
username: `randomusername${random}notregistered`,
|
||||
last_seen_at: moment().add(1, 'month').format('YYYY-MM-DD'),
|
||||
registered_at: moment().add(1, 'month').format('YYYY-MM-DD')
|
||||
}
|
||||
updateUsersTable(
|
||||
{ deleteAll: true, newUsers: [newUser] },
|
||||
() => {
|
||||
logout(() => {
|
||||
cy.visit(hostUrl + appLocation)
|
||||
// cy.get('input.username').type(username)
|
||||
// cy.get('input.password').type(password)
|
||||
// cy.get('.login-group button').click()
|
||||
|
||||
visitPage('home')
|
||||
|
||||
cy.wait(2000)
|
||||
|
||||
verifyLicensingPage(
|
||||
'The registered number of users reached the limit specified for your licence.',
|
||||
(success: boolean) => {
|
||||
if (success) done()
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('5 | Show warning banner when limit is exceeded', (done) => {
|
||||
let keyData = {
|
||||
valid_until: moment().add(1, 'month').format('YYYY-MM-DD'),
|
||||
users_allowed: 10,
|
||||
hot_license_key: '',
|
||||
demo: false,
|
||||
site_id: site_id
|
||||
}
|
||||
let keyData2 = {
|
||||
valid_until: moment().add(1, 'month').format('YYYY-MM-DD'),
|
||||
users_allowed: 1,
|
||||
hot_license_key: '',
|
||||
demo: false,
|
||||
site_id: site_id
|
||||
}
|
||||
|
||||
generateKeys(keyData, (keysGen: any) => {
|
||||
generateKeys(keyData2, (keysGen2: any) => {
|
||||
cy.wait(2000)
|
||||
acceptTermsIfPresented((result: boolean) => {
|
||||
if (result) {
|
||||
cy.wait(20000)
|
||||
}
|
||||
updateLicenseKeyQuick(keysGen, () => {
|
||||
cy.wait(2000)
|
||||
acceptTermsIfPresented((result: boolean) => {
|
||||
if (result) {
|
||||
cy.wait(20000)
|
||||
}
|
||||
const random = Cypress._.random(0, 1000)
|
||||
const newUser = {
|
||||
username: `randomusername${random}`,
|
||||
last_seen_at: moment().add(1, 'month').format('YYYY-MM-DD'),
|
||||
registered_at: moment().add(1, 'month').format('YYYY-MM-DD')
|
||||
}
|
||||
updateUsersTable(
|
||||
{ deleteAll: true, keep: username, newUsers: [newUser] },
|
||||
() => {
|
||||
updateLicenseKeyQuick(keysGen2, () => {
|
||||
cy.wait(2000)
|
||||
verifyLicensingWarning(
|
||||
'The registered number of users exceeds the limit specified for your license.',
|
||||
() => {
|
||||
done()
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.afterEach(() => {
|
||||
// cy.visit(`${hostUrl}/SASLogon/logout`)
|
||||
})
|
||||
})
|
||||
|
||||
const logout = (callback?: any) => {
|
||||
cy.get('.header-actions .dropdown-toggle')
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('.header-actions .dropdown-menu > .separator')
|
||||
.next()
|
||||
.click()
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const acceptTermsIfPresented = (callback?: any) => {
|
||||
cy.url().then((url: string) => {
|
||||
if (url.includes('licensing/register')) {
|
||||
cy.get('.card-block')
|
||||
.scrollTo('bottom')
|
||||
.then(() => {
|
||||
cy.get('#checkbox1')
|
||||
.click()
|
||||
.then(() => {
|
||||
if (callback) callback(true)
|
||||
})
|
||||
})
|
||||
} else {
|
||||
if (callback) callback(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const isLicensingPage = (callback: any) => {
|
||||
return cy.url().then((url: string) => {
|
||||
callback(
|
||||
url.includes('#/licensing/') && !url.includes('licensing/register')
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
const verifyLicensingPage = (text: string, callback: any) => {
|
||||
// visitPage('home')
|
||||
|
||||
cy.wait(1000)
|
||||
isLicensingPage((result: boolean) => {
|
||||
if (result) {
|
||||
cy.get('p.key-error')
|
||||
.should('contain', text)
|
||||
.then((treeNodes: any) => {
|
||||
callback(true)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const verifyLicensingWarning = (text: string, callback: any) => {
|
||||
visitPage('home')
|
||||
|
||||
cy.wait(1000)
|
||||
cy.get("div[role='alert'] .alert-text")
|
||||
.invoke('text')
|
||||
.should('contain', text)
|
||||
.then(() => {
|
||||
callback()
|
||||
})
|
||||
}
|
||||
|
||||
const inputLicenseKeyPage = (licenseKey: string, activationKey: string) => {
|
||||
cy.get('button').contains('Paste licence').click()
|
||||
|
||||
cy.get('.license-key-form textarea', { timeout: longerCommandTimeout })
|
||||
.invoke('val', licenseKey)
|
||||
.trigger('input')
|
||||
.should('not.be.undefined')
|
||||
cy.get('.activation-key-form textarea', { timeout: longerCommandTimeout })
|
||||
.invoke('val', activationKey)
|
||||
.trigger('input')
|
||||
.should('not.be.undefined')
|
||||
cy.get('button.apply-keys').click()
|
||||
}
|
||||
|
||||
const updateUsersTable = (options: any, callback?: any) => {
|
||||
visitPage('home')
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_users')
|
||||
|
||||
clickOnEdit(() => {
|
||||
cy.get('.ht_master tbody tr').then((rows: any) => {
|
||||
if (options.deleteAll) {
|
||||
for (let row of rows) {
|
||||
const user_id = row.childNodes[2]
|
||||
if (!options.keep || user_id.innerText !== options.keep) {
|
||||
cy.get(row.childNodes[1])
|
||||
.dblclick()
|
||||
.then(() => {
|
||||
cy.focused().type('{selectall}').type('Yes').type('{enter}')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
if (options.newUsers && options.newUsers.length) {
|
||||
for (let newUser of options.newUsers) {
|
||||
clickOnAddRow(() => {
|
||||
cy.get('#hotInstance tbody tr:last-child').then((rows: any) => {
|
||||
cy.get(rows[0].childNodes[2])
|
||||
.dblclick()
|
||||
.then(() => {
|
||||
cy.focused()
|
||||
.type('{selectall}')
|
||||
.type(newUser.username)
|
||||
.type('{enter}')
|
||||
})
|
||||
// cy.get(rows[0].childNodes[3])
|
||||
// .dblclick()
|
||||
// .then(() => {
|
||||
// cy.focused()
|
||||
// .type('{selectall}')
|
||||
// .type(newUser.last_seen_at)
|
||||
// .type('{enter}')
|
||||
// })
|
||||
// cy.get(rows[0].childNodes[4])
|
||||
// .dblclick()
|
||||
// .then(() => {
|
||||
// cy.focused()
|
||||
// .type('{selectall}')
|
||||
// .type(newUser.registered_at)
|
||||
// .type('{enter}')
|
||||
// })
|
||||
submitTable(() => {
|
||||
cy.wait(2000)
|
||||
approveTable(callback)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const changeLicenseKeyTable = (keys: any, callback?: any) => {
|
||||
visitPage('home')
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_config')
|
||||
|
||||
clickOnEdit(() => {
|
||||
editTableField(
|
||||
[
|
||||
{ varName: 'DC_ACTIVATION_KEY', varValue: keys.activationKey },
|
||||
{ varName: 'DC_LICENCE_KEY', varValue: keys.licenseKey }
|
||||
],
|
||||
() => {
|
||||
submitTable(() => {
|
||||
cy.wait(2000)
|
||||
approveTable(() => {
|
||||
cy.reload()
|
||||
if (callback) callback()
|
||||
})
|
||||
})
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
const updateLicenseKeyQuick = (keys: any, callback: any) => {
|
||||
isLicensingPage((result: boolean) => {
|
||||
if (!result) {
|
||||
visitPage('licensing/update')
|
||||
cy.wait(2000)
|
||||
}
|
||||
inputLicenseKeyPage(keys.licenseKey, keys.activationKey)
|
||||
|
||||
callback()
|
||||
})
|
||||
}
|
||||
|
||||
const generateKeys = async (licenseData: any, resultCallback?: any) => {
|
||||
let keyPair = await window.crypto.subtle.generateKey(
|
||||
{
|
||||
name: 'RSA-OAEP',
|
||||
modulusLength: 2024,
|
||||
publicExponent: new Uint8Array([1, 0, 1]),
|
||||
hash: 'SHA-256'
|
||||
},
|
||||
true,
|
||||
['encrypt', 'decrypt']
|
||||
)
|
||||
|
||||
const encoded = new TextEncoder().encode(JSON.stringify(licenseData))
|
||||
|
||||
const cipher = await window.crypto.subtle
|
||||
.encrypt(
|
||||
{
|
||||
name: 'RSA-OAEP'
|
||||
},
|
||||
keyPair.publicKey,
|
||||
encoded
|
||||
)
|
||||
.then(
|
||||
(value) => {
|
||||
return value
|
||||
},
|
||||
(err) => {
|
||||
console.log('Encrpyt error', err)
|
||||
}
|
||||
)
|
||||
|
||||
if (!cipher) {
|
||||
alert('Encryptin keys failed')
|
||||
throw new Error('Encryptin keys failed')
|
||||
}
|
||||
|
||||
const privateKeyBytes = await window.crypto.subtle.exportKey(
|
||||
'pkcs8',
|
||||
keyPair.privateKey
|
||||
)
|
||||
|
||||
const activationKey = await arrayBufferToBase64(privateKeyBytes)
|
||||
const licenseKey = await arrayBufferToBase64(cipher)
|
||||
|
||||
if (resultCallback)
|
||||
resultCallback({
|
||||
activationKey,
|
||||
licenseKey
|
||||
})
|
||||
}
|
||||
|
||||
const editTableField = (edits: EditConfigTableCells[], callback?: any) => {
|
||||
cy.get('td').then((tdNodes: any) => {
|
||||
for (let edit of edits) {
|
||||
let correctRow = false
|
||||
|
||||
for (let node of tdNodes) {
|
||||
if (correctRow) {
|
||||
cy.get(node)
|
||||
.dblclick()
|
||||
.then(() => {
|
||||
// textarea update on long keys
|
||||
cy.focused().invoke('val', edit.varValue).type('{enter}')
|
||||
})
|
||||
|
||||
correctRow = false
|
||||
break
|
||||
}
|
||||
|
||||
if (node.innerText.includes(edit.varName)) {
|
||||
correctRow = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (callback) callback()
|
||||
})
|
||||
}
|
||||
|
||||
const openTableFromTree = (
|
||||
libNameIncludes: string,
|
||||
tablename: string,
|
||||
callback?: any
|
||||
) => {
|
||||
cy.get('.app-loading', { timeout: longerCommandTimeout })
|
||||
.should('not.exist')
|
||||
.then(() => {
|
||||
cy.get('.nav-tree clr-tree > clr-tree-node', {
|
||||
timeout: longerCommandTimeout
|
||||
}).then((treeNodes: any) => {
|
||||
let viyaLib
|
||||
|
||||
for (let node of treeNodes) {
|
||||
if (node.innerText.toLowerCase().includes(libNameIncludes)) {
|
||||
viyaLib = node
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
cy.get(viyaLib).within(() => {
|
||||
cy.get('.clr-tree-node-content-container > button').click()
|
||||
|
||||
cy.get('.clr-treenode-link').then((innerNodes: any) => {
|
||||
for (let innerNode of innerNodes) {
|
||||
if (innerNode.innerText.toLowerCase().includes(tablename)) {
|
||||
innerNode.click()
|
||||
if (callback) callback()
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const clickOnAddRow = (callback?: any) => {
|
||||
cy.get('.btnCtrl button.btn-success')
|
||||
.click()
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
}
|
||||
|
||||
const clickOnEdit = (callback?: any) => {
|
||||
cy.get('.btnCtrl button.btn-primary', { timeout: longerCommandTimeout })
|
||||
.click()
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
}
|
||||
|
||||
const submitTable = (callback?: any) => {
|
||||
cy.get('.btnCtrl button.btn-primary', { timout: longerCommandTimeout })
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get(".modal.ng-star-inserted button[type='submit']")
|
||||
.click()
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const approveTable = (callback?: any) => {
|
||||
cy.get('button', { timeout: longerCommandTimeout })
|
||||
.should('contain', 'Go to approvals screen')
|
||||
.then((allButtons: any) => {
|
||||
for (let approvalButton of allButtons) {
|
||||
if (
|
||||
approvalButton.innerText
|
||||
.toLowerCase()
|
||||
.includes('go to approvals screen')
|
||||
) {
|
||||
approvalButton.click()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
cy.get('button#acceptBtn', { timeout: longerCommandTimeout })
|
||||
.should('exist')
|
||||
.should('not.be.disabled')
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('app-history', { timeout: longerCommandTimeout })
|
||||
.should('exist')
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const visitPage = (url: string) => {
|
||||
cy.visit(`${hostUrl}${appLocation}/#/${url}`)
|
||||
}
|
157
client/cypress/e2e/liveness.cy.ts
Normal file
157
client/cypress/e2e/liveness.cy.ts
Normal file
@ -0,0 +1,157 @@
|
||||
const username = Cypress.env('username')
|
||||
const password = Cypress.env('password')
|
||||
const hostUrl = Cypress.env('hosturl')
|
||||
const appLocation = Cypress.env('appLocation')
|
||||
const longerCommandTimeout = Cypress.env('longerCommandTimeout')
|
||||
const serverType = Cypress.env('serverType')
|
||||
const libraryToOpenIncludes = Cypress.env(`libraryToOpenIncludes_${serverType}`)
|
||||
const fixturePath = 'excels/'
|
||||
|
||||
context('liveness tests: ', function () {
|
||||
this.beforeAll(() => {
|
||||
if (serverType !== 'SASJS') {
|
||||
cy.visit(`${hostUrl}/SASLogon/logout`)
|
||||
}
|
||||
cy.loginAndUpdateValidKey(true)
|
||||
})
|
||||
|
||||
this.beforeEach(() => {
|
||||
cy.visit(hostUrl + appLocation)
|
||||
|
||||
// cy.get('input.username').type(username)
|
||||
// cy.get('input.password').type(password)
|
||||
// cy.get('.login-group button').click()
|
||||
|
||||
visitPage('home')
|
||||
})
|
||||
|
||||
it('1 | Login and submit test', (done) => {
|
||||
cy.get('.nav-tree clr-tree > clr-tree-node', {
|
||||
timeout: longerCommandTimeout
|
||||
}).then((treeNodes: any) => {
|
||||
libraryExistsInTree('viya', treeNodes)
|
||||
? openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
: openTableFromTree('dc', 'mpe_x_test')
|
||||
|
||||
attachExcelFile('regular_excel.xlsx', () => {
|
||||
submitExcel()
|
||||
rejectExcel(done)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
* Thist part will be needed if we add more tests in future
|
||||
*/
|
||||
// this.afterEach(() => {
|
||||
// cy.visit('https://sas.4gl.io/SASLogon/logout');
|
||||
// })
|
||||
})
|
||||
|
||||
const visitPage = (url: string) => {
|
||||
cy.visit(`${hostUrl}${appLocation}/#/${url}`)
|
||||
}
|
||||
|
||||
const libraryExistsInTree = (libName: string, nodes: any) => {
|
||||
for (let node of nodes) {
|
||||
if (node.innerText.toLowerCase().includes(libName.toLowerCase()))
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
const openTableFromTree = (
|
||||
libNameIncludes: string,
|
||||
tablename: string,
|
||||
finish: any
|
||||
) => {
|
||||
cy.get('.app-loading', { timeout: longerCommandTimeout })
|
||||
.should('not.exist')
|
||||
.then(() => {
|
||||
cy.get('.nav-tree clr-tree > clr-tree-node', {
|
||||
timeout: longerCommandTimeout
|
||||
}).then((treeNodes: any) => {
|
||||
let viyaLib
|
||||
|
||||
for (let node of treeNodes) {
|
||||
if (node.innerText.toLowerCase().includes(libNameIncludes)) {
|
||||
viyaLib = node
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (!viyaLib && finish) finish(false)
|
||||
|
||||
cy.get(viyaLib).within(() => {
|
||||
cy.get('.clr-tree-node-content-container > button').click()
|
||||
|
||||
cy.get('.clr-treenode-link').then((innerNodes: any) => {
|
||||
for (let innerNode of innerNodes) {
|
||||
if (innerNode.innerText.toLowerCase().includes(tablename)) {
|
||||
innerNode.click()
|
||||
if (finish) finish(true)
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const attachExcelFile = (excelFilename: string, callback?: any) => {
|
||||
cy.get('.buttonBar button:last-child')
|
||||
.should('exist')
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('input[type="file"]#file-upload').attachFile(
|
||||
`/${fixturePath}/${excelFilename}`
|
||||
)
|
||||
cy.get('.modal-footer .btn.btn-primary').then((modalBtn) => {
|
||||
modalBtn.click()
|
||||
if (callback) callback()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const submitExcel = (callback?: any) => {
|
||||
cy.get('.buttonBar button.preview-submit', { timeout: longerCommandTimeout })
|
||||
.click()
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
}
|
||||
|
||||
const rejectExcel = (callback?: any) => {
|
||||
cy.get('button', { timeout: longerCommandTimeout })
|
||||
.should('contain', 'Go to approvals screen')
|
||||
.then((allButtons: any) => {
|
||||
for (let approvalButton of allButtons) {
|
||||
if (
|
||||
approvalButton.innerText
|
||||
.toLowerCase()
|
||||
.includes('go to approvals screen')
|
||||
) {
|
||||
approvalButton.click()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
cy.get('button.btn-danger')
|
||||
.should('exist')
|
||||
.should('not.be.disabled')
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('.modal-footer button.btn-success-outline')
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('app-history')
|
||||
.should('exist')
|
||||
.then(() => {
|
||||
if (callback) callback()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
61
client/cypress/e2e/metanav.cy.ts
Normal file
61
client/cypress/e2e/metanav.cy.ts
Normal file
@ -0,0 +1,61 @@
|
||||
const username = Cypress.env('username')
|
||||
const password = Cypress.env('password')
|
||||
const hostUrl = Cypress.env('hosturl')
|
||||
const appLocation = Cypress.env('appLocation')
|
||||
const longerCommandTimeout = Cypress.env('longerCommandTimeout')
|
||||
const serverType = Cypress.env('serverType')
|
||||
const libraryToOpenIncludes = Cypress.env(`libraryToOpenIncludes_${serverType}`)
|
||||
const fixturePath = 'excels_general/'
|
||||
|
||||
context('metanav tests: ', function () {
|
||||
this.beforeAll(() => {
|
||||
cy.visit(`${hostUrl}/SASLogon/logout`)
|
||||
cy.loginAndUpdateValidKey()
|
||||
})
|
||||
|
||||
this.beforeEach(() => {
|
||||
cy.visit(hostUrl + appLocation)
|
||||
cy.get('input.username').type(username)
|
||||
cy.get('input.password').type(password)
|
||||
cy.get('.login-group button').click()
|
||||
|
||||
visitPage('view/metadata')
|
||||
})
|
||||
|
||||
it('1 | Opens metadata object', (done) => {
|
||||
openFirstMetadataFromTree(() => {
|
||||
// BLOCKER
|
||||
// For unkown reasons, .clr-accordion-header-button always null although it is present on the page.
|
||||
cy.get('.clr-accordion-header-button').then((panelNodes: any) => {
|
||||
panelNodes[0].querySelector('button').click()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
this.afterEach(() => {
|
||||
cy.visit(`${hostUrl}/SASLogon/logout`)
|
||||
})
|
||||
})
|
||||
|
||||
const openFirstMetadataFromTree = (callback?: any) => {
|
||||
cy.get('.app-loading', { timeout: longerCommandTimeout })
|
||||
.should('not.exist')
|
||||
.then(() => {
|
||||
cy.get('.nav-tree clr-tree > clr-tree-node', {
|
||||
timeout: longerCommandTimeout
|
||||
}).then((treeNodes: any) => {
|
||||
let firstMetaNode
|
||||
|
||||
firstMetaNode = treeNodes[1]
|
||||
|
||||
cy.get(firstMetaNode).within(() => {
|
||||
cy.get('.clr-treenode-content').click()
|
||||
callback()
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const visitPage = (url: string) => {
|
||||
cy.visit(`${hostUrl}${appLocation}/#/${url}`)
|
||||
}
|
655
client/cypress/e2e/viewbox.cy.ts
Normal file
655
client/cypress/e2e/viewbox.cy.ts
Normal file
@ -0,0 +1,655 @@
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
|
||||
const username = Cypress.env('username')
|
||||
const password = Cypress.env('password')
|
||||
const hostUrl = Cypress.env('hosturl')
|
||||
const appLocation = Cypress.env('appLocation')
|
||||
const longerCommandTimeout = Cypress.env('longerCommandTimeout')
|
||||
const serverType = Cypress.env('serverType')
|
||||
const libraryToOpenIncludes = Cypress.env(`libraryToOpenIncludes_${serverType}`)
|
||||
|
||||
context('editor tests: ', function () {
|
||||
this.beforeAll(() => {
|
||||
cy.visit(`${hostUrl}/SASLogon/logout`)
|
||||
cy.loginAndUpdateValidKey(true)
|
||||
})
|
||||
|
||||
this.beforeEach(() => {
|
||||
cy.visit(hostUrl + appLocation)
|
||||
|
||||
cy.wait(2000)
|
||||
|
||||
cy.get('body').then(($body) => {
|
||||
const usernameInput = $body.find('input.username')[0]
|
||||
|
||||
if (usernameInput && !Cypress.dom.isHidden(usernameInput)) {
|
||||
cy.get('input.username').type(username)
|
||||
cy.get('input.password').type(password)
|
||||
|
||||
cy.get('.login-group button').click()
|
||||
}
|
||||
})
|
||||
|
||||
visitPage('home')
|
||||
})
|
||||
|
||||
it('1 | Add one viewbox', (done) => {
|
||||
const viewbox_table = 'mpe_audit'
|
||||
const columns = ['LOAD_REF', 'LIBREF', 'DSN', 'KEY_HASH', 'TGTVAR_NM']
|
||||
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
cy.get('.viewbox-open').click()
|
||||
openTableFromViewboxTree(libraryToOpenIncludes, [viewbox_table])
|
||||
|
||||
cy.get('.open-viewbox').then((viewboxNodes: any) => {
|
||||
for (let viewboxNode of viewboxNodes) {
|
||||
if (!viewboxNode.innerText.toLowerCase().includes(viewbox_table)) {
|
||||
return
|
||||
}
|
||||
|
||||
checkColumns(columns, () => {
|
||||
done()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('2 | Add two viewboxes', (done) => {
|
||||
const viewboxes = [
|
||||
{
|
||||
viewbox_table: 'mpe_audit',
|
||||
columns: ['LOAD_REF', 'LIBREF', 'DSN', 'KEY_HASH', 'TGTVAR_NM']
|
||||
},
|
||||
{
|
||||
viewbox_table: 'mpe_alerts',
|
||||
columns: [
|
||||
'TX_FROM',
|
||||
'ALERT_EVENT',
|
||||
'ALERT_LIB',
|
||||
'ALERT_DS',
|
||||
'ALERT_USER'
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
cy.get('.viewbox-open').click()
|
||||
openTableFromViewboxTree(
|
||||
libraryToOpenIncludes,
|
||||
viewboxes.map((viewbox) => viewbox.viewbox_table))
|
||||
cy.get('.open-viewbox').then((viewboxNodes: any) => {
|
||||
let found = 0
|
||||
|
||||
for (let viewboxNode of viewboxNodes) {
|
||||
for (let viewbox of viewboxes) {
|
||||
if (
|
||||
viewboxNode.innerText.toLowerCase().includes(viewbox.viewbox_table)
|
||||
)
|
||||
found++
|
||||
}
|
||||
}
|
||||
|
||||
if (found < viewboxes.length) return
|
||||
|
||||
cy.get('.viewboxes-container .viewbox', { withinSubject: null }).then((viewboxNodes: any) => {
|
||||
for (let viewboxNode of viewboxNodes) {
|
||||
cy.get(viewboxNode).within(() => {
|
||||
cy.get('.table-title').then((tableTitle) => {
|
||||
const title = tableTitle[0].innerText
|
||||
const viewbox = viewboxes.find((vb) =>
|
||||
title.toLowerCase().includes(vb.viewbox_table)
|
||||
)
|
||||
|
||||
if (viewbox) {
|
||||
cy.get('.ht_master.handsontable .htCore thead tr').then(
|
||||
(viewboxColNodes: any) => {
|
||||
let allColsHtml = viewboxColNodes[0].innerHTML
|
||||
|
||||
for (let col of viewbox?.columns) {
|
||||
if (!allColsHtml.includes(col)) return
|
||||
}
|
||||
|
||||
done()
|
||||
}
|
||||
)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('3 | Add viewbox, add columns', (done) => {
|
||||
const viewbox_table = 'mpe_audit'
|
||||
const columns = ['LOAD_REF', 'LIBREF', 'DSN', 'KEY_HASH', 'TGTVAR_NM']
|
||||
const additionalColumns = ['IS_PK']
|
||||
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
cy.get('.viewbox-open').click()
|
||||
openTableFromViewboxTree(libraryToOpenIncludes, [viewbox_table])
|
||||
|
||||
cy.get('.open-viewbox').then((viewboxNodes: any) => {
|
||||
for (let viewboxNode of viewboxNodes) {
|
||||
if (!viewboxNode.innerText.toLowerCase().includes(viewbox_table)) {
|
||||
return
|
||||
}
|
||||
|
||||
openViewboxConfig(viewbox_table)
|
||||
|
||||
removeAllColumns()
|
||||
|
||||
addColumns(additionalColumns)
|
||||
|
||||
checkColumns([...columns, ...additionalColumns], () => {
|
||||
done()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('4 | Add viewbox, add columns and reorder', (done) => {
|
||||
const viewbox_table = 'mpe_audit'
|
||||
const columns = ['LOAD_REF', 'LIBREF', 'DSN', 'KEY_HASH', 'TGTVAR_NM']
|
||||
const additionalColumns = ['IS_PK', 'MOVE_TYPE']
|
||||
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
cy.get('.viewbox-open').click()
|
||||
openTableFromViewboxTree(libraryToOpenIncludes, [viewbox_table])
|
||||
|
||||
cy.get('.open-viewbox').then((viewboxNodes: any) => {
|
||||
for (let viewboxNode of viewboxNodes) {
|
||||
if (!viewboxNode.innerText.toLowerCase().includes(viewbox_table)) {
|
||||
return
|
||||
}
|
||||
|
||||
openViewboxConfig(viewbox_table)
|
||||
|
||||
removeAllColumns()
|
||||
|
||||
addColumns(additionalColumns, () => {
|
||||
cy.wait(1000)
|
||||
//reorder
|
||||
cy.get('.col-box.column-MOVE_TYPE')
|
||||
.realMouseDown({ button: 'left', position: 'center' })
|
||||
.realMouseMove(0, 10, { position: 'center' })
|
||||
cy.wait(200) // In our case, we wait 200ms cause we have animations which we are sure that take this amount of time
|
||||
cy.get('.col-box.column-IS_PK')
|
||||
.realMouseMove(0, 0, { position: 'center' })
|
||||
.realMouseUp()
|
||||
//reorder end
|
||||
|
||||
cy.wait(500)
|
||||
|
||||
checkColumns([...columns, ...additionalColumns.reverse()], () => {
|
||||
done()
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('5 | Add viewbox, add columns, reorder, remove column, add again', (done) => {
|
||||
const viewbox_table = 'mpe_audit'
|
||||
const columns = ['LOAD_REF', 'LIBREF', 'DSN', 'KEY_HASH', 'TGTVAR_NM']
|
||||
const additionalColumns = ['IS_PK', 'MOVE_TYPE']
|
||||
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
cy.get('.viewbox-open').click()
|
||||
openTableFromViewboxTree(libraryToOpenIncludes, [viewbox_table])
|
||||
|
||||
cy.get('.open-viewbox').then((viewboxNodes: any) => {
|
||||
for (let viewboxNode of viewboxNodes) {
|
||||
if (!viewboxNode.innerText.toLowerCase().includes(viewbox_table)) {
|
||||
return
|
||||
}
|
||||
|
||||
viewboxNode.click()
|
||||
|
||||
removeAllColumns()
|
||||
|
||||
addColumns(additionalColumns, () => {
|
||||
cy.wait(1000)
|
||||
//reorder
|
||||
cy.get('.col-box.column-MOVE_TYPE')
|
||||
.realMouseDown({ button: 'left', position: 'center' })
|
||||
.realMouseMove(0, 10, { position: 'center' })
|
||||
cy.wait(200) // In our case, we wait 200ms cause we have animations which we are sure that take this amount of time
|
||||
cy.get('.col-box.column-IS_PK')
|
||||
.realMouseMove(0, 0, { position: 'center' })
|
||||
.realMouseUp()
|
||||
//reorder end
|
||||
|
||||
cy.wait(500)
|
||||
|
||||
checkColumns([...columns, ...additionalColumns.reverse()], () => {
|
||||
const colToRemove = 'MOVE_TYPE'
|
||||
|
||||
removeColumn(colToRemove)
|
||||
checkColumns(
|
||||
[
|
||||
...columns,
|
||||
...additionalColumns.filter((col) => col !== colToRemove)
|
||||
],
|
||||
() => {
|
||||
addColumns([colToRemove], () => {
|
||||
checkColumns(
|
||||
[...columns, ...additionalColumns.reverse()],
|
||||
() => {
|
||||
done()
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('6 | Add viewboxes, reload and check url restored configuration', (done) => {
|
||||
const viewboxes = [
|
||||
{
|
||||
viewbox_table: 'mpe_audit',
|
||||
columns: ['LOAD_REF', 'LIBREF', 'DSN', 'KEY_HASH', 'TGTVAR_NM'],
|
||||
additionalColumns: ['IS_PK', 'MOVE_TYPE']
|
||||
},
|
||||
{
|
||||
viewbox_table: 'mpe_alerts',
|
||||
columns: [
|
||||
'TX_FROM',
|
||||
'ALERT_EVENT',
|
||||
'ALERT_LIB',
|
||||
'ALERT_DS',
|
||||
'ALERT_USER'
|
||||
],
|
||||
additionalColumns: ['TX_TO']
|
||||
}
|
||||
]
|
||||
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
cy.get('.viewbox-open').click()
|
||||
openTableFromViewboxTree(libraryToOpenIncludes, [
|
||||
viewboxes[0].viewbox_table,
|
||||
viewboxes[1].viewbox_table
|
||||
])
|
||||
|
||||
openViewboxConfig(viewboxes[0].viewbox_table)
|
||||
|
||||
cy.wait(500)
|
||||
|
||||
removeAllColumns()
|
||||
|
||||
addColumns(viewboxes[0].additionalColumns, () => {
|
||||
cy.wait(1000)
|
||||
|
||||
if (viewboxes[0].viewbox_table === 'mpe_audit') {
|
||||
cy.get('.col-box.column-MOVE_TYPE')
|
||||
.realMouseDown({ button: 'left', position: 'center' })
|
||||
.realMouseMove(0, 10, { position: 'center' })
|
||||
cy.wait(200) // In our case, we wait 200ms cause we have animations which we are sure that take this amount of time
|
||||
cy.get('.col-box.column-IS_PK')
|
||||
.realMouseMove(0, 0, { position: 'center' })
|
||||
.realMouseUp()
|
||||
}
|
||||
|
||||
cy.wait(1000)
|
||||
|
||||
openViewboxConfig(viewboxes[1].viewbox_table)
|
||||
|
||||
addColumns(viewboxes[1].additionalColumns, () => {
|
||||
cy.wait(1000).reload()
|
||||
|
||||
let result = 0
|
||||
|
||||
checkColumns(
|
||||
[
|
||||
...viewboxes[0].columns,
|
||||
...cloneDeep(viewboxes[0].additionalColumns.reverse())
|
||||
],
|
||||
() => {
|
||||
result++
|
||||
|
||||
if (result === 2) done()
|
||||
}
|
||||
)
|
||||
checkColumns(
|
||||
[...viewboxes[1].columns, ...viewboxes[1].additionalColumns],
|
||||
() => {
|
||||
result++
|
||||
|
||||
if (result === 2) done()
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
// We will enable this test when we figure out how to mock filtering
|
||||
// it('7 | Add viewboxes and filter', () => {
|
||||
// const viewboxes = ['mpe_x_test', 'mpe_validations']
|
||||
|
||||
// openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
// cy.get('.viewbox-open').click()
|
||||
// openTableFromViewboxTree(libraryToOpenIncludes, viewboxes)
|
||||
|
||||
// cy.wait(1000)
|
||||
|
||||
// closeViewboxModal()
|
||||
|
||||
// cy.get('.viewboxes-container .viewbox', { withinSubject: null }).then(
|
||||
// (viewboxNodes: any) => {
|
||||
// for (let viewboxNode of viewboxNodes) {
|
||||
// cy.get(viewboxNode).within(() => {
|
||||
// cy.get('.table-title').then((title: any) => {
|
||||
// cy.get('.hot-spinner')
|
||||
// .should('not.exist')
|
||||
// .then(() => {
|
||||
// cy.get('clr-icon[shape="filter"]').then((filterButton) => {
|
||||
// filterButton[0].click()
|
||||
// })
|
||||
|
||||
// if (title[0].innerText.includes('MPE_X_TEST')) {
|
||||
// setFilterWithValue(
|
||||
// 'SOME_CHAR',
|
||||
// 'this is dummy data',
|
||||
// 'value',
|
||||
// () => {
|
||||
// cy.get('app-query', { withinSubject: null })
|
||||
// .should('not.exist')
|
||||
// .get('.ht_master.handsontable tbody tr')
|
||||
// .then((rowNodes) => {
|
||||
// const tr = rowNodes[0]
|
||||
|
||||
// expect(rowNodes).to.have.length(1)
|
||||
// expect(tr.innerText).to.equal('0')
|
||||
// })
|
||||
// }
|
||||
// )
|
||||
// } else if (title[0].innerText.includes('MPE_VALIDATIONS')) {
|
||||
// setFilterWithValue('BASE_COL', 'ALERT_LIB', 'value', () => {
|
||||
// cy.get('app-query', { withinSubject: null })
|
||||
// .should('not.exist')
|
||||
// .get('.ht_master.handsontable tbody tr')
|
||||
// .then((rowNodes) => {
|
||||
// const tr = rowNodes[0]
|
||||
|
||||
// expect(rowNodes).to.have.length(1)
|
||||
// expect(tr.innerText).to.contain('ALERT_LIB')
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
// })
|
||||
|
||||
this.afterEach(() => {
|
||||
// cy.visit(`${hostUrl}/SASLogon/logout`)
|
||||
})
|
||||
})
|
||||
|
||||
const removeAllColumns = () => {
|
||||
cy.get('.configuration-wrapper clr-icon[shape="trash"]').then(removeNodes => {
|
||||
for (let removeNode of removeNodes) {
|
||||
removeNode.click()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const checkColumns = (columns: string[], callback: () => void) => {
|
||||
cy.get('.viewboxes-container .viewbox', { withinSubject: null }).then(
|
||||
(viewboxNodes: any) => {
|
||||
for (let viewboxNode of viewboxNodes) {
|
||||
cy.get(viewboxNode).within(() => {
|
||||
cy.get('.ht_master.handsontable thead tr th').then(
|
||||
(viewboxColNodes: any) => {
|
||||
console.log('viewboxColNode', viewboxColNodes)
|
||||
console.log('columns', columns)
|
||||
for (let i = 0; i < viewboxColNodes.length; i++) {
|
||||
const col = columns[i]|| ''
|
||||
const colNode = viewboxColNodes[i]
|
||||
|
||||
if (
|
||||
!colNode.innerHTML.toLowerCase().includes(col.toLowerCase())
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
callback()
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
const closeViewboxModal = () => {
|
||||
cy.get('app-viewboxes .close', { withinSubject: null }).click()
|
||||
}
|
||||
|
||||
const removeColumn = (column: string) => {
|
||||
cy.get(`.col-box.column-${column} clr-icon`, { withinSubject: null }).click()
|
||||
}
|
||||
|
||||
const addColumns = (columns: string[], callback?: () => void) => {
|
||||
for (let i = 0; i < columns.length; i++) {
|
||||
const column = columns[i]
|
||||
|
||||
cy.get('.cols-search input', { withinSubject: null }).type(column)
|
||||
cy.get('.cols-search .autocomplete-wrapper', { withinSubject: null })
|
||||
.first()
|
||||
.trigger('keydown', { key: 'ArrowDown' })
|
||||
cy.get('.cols-search .autocomplete-wrapper', { withinSubject: null })
|
||||
.first()
|
||||
.trigger('keydown', { key: 'Enter' })
|
||||
.then(() => {
|
||||
if (i === columns.length - 1 && callback) callback()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const openViewboxConfig = (viewbox_tablename: string) => {
|
||||
cy.get('.open-viewbox').then((viewboxes: any) => {
|
||||
for (let openViewbox of viewboxes) {
|
||||
if (openViewbox.innerText.toLowerCase().includes(viewbox_tablename))
|
||||
openViewbox.click()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const openTableFromTree = (libNameIncludes: string, tablename: string) => {
|
||||
cy.get('.app-loading', { timeout: longerCommandTimeout })
|
||||
.should('not.exist')
|
||||
.then(() => {
|
||||
cy.get('.nav-tree clr-tree > clr-tree-node', {
|
||||
timeout: longerCommandTimeout
|
||||
}).then((treeNodes: any) => {
|
||||
let viyaLib
|
||||
|
||||
for (let node of treeNodes) {
|
||||
if (new RegExp(libNameIncludes).test(node.innerText.toLowerCase())) {
|
||||
viyaLib = node
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
cy.get(viyaLib).within(() => {
|
||||
cy.get('.clr-tree-node-content-container p').click()
|
||||
|
||||
cy.get('.clr-treenode-link').then((innerNodes: any) => {
|
||||
for (let innerNode of innerNodes) {
|
||||
if (innerNode.innerText.toLowerCase().includes(tablename)) {
|
||||
innerNode.click()
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const setFilterWithValue = (
|
||||
variableValue: string,
|
||||
valueString: string,
|
||||
valueField: 'value' | 'time' | 'date' | 'datetime' | 'in' | 'between',
|
||||
callback?: any
|
||||
) => {
|
||||
cy.wait(600)
|
||||
|
||||
cy.focused().type(variableValue)
|
||||
cy.wait(100)
|
||||
// cy.focused().trigger('input')
|
||||
cy.get('.variable-col .autocomplete-wrapper', { withinSubject: null })
|
||||
.first()
|
||||
.trigger('keydown', { key: 'ArrowDown' })
|
||||
cy.get('.variable-col .autocomplete-wrapper', {
|
||||
withinSubject: null
|
||||
}).trigger('keydown', { key: 'Enter' })
|
||||
cy.focused().tab()
|
||||
cy.wait(100)
|
||||
|
||||
if (valueField === 'in') {
|
||||
cy.focused().select(valueField.toUpperCase()).trigger('change')
|
||||
} else if (valueField === 'between') {
|
||||
cy.focused().select(valueField.toUpperCase()).trigger('change')
|
||||
} else {
|
||||
cy.focused().tab()
|
||||
cy.wait(100)
|
||||
}
|
||||
|
||||
switch (valueField) {
|
||||
case 'value': {
|
||||
cy.focused().type(valueString)
|
||||
|
||||
break
|
||||
}
|
||||
case 'time': {
|
||||
cy.focused().type(valueString)
|
||||
|
||||
break
|
||||
}
|
||||
case 'date': {
|
||||
cy.focused().type(valueString)
|
||||
cy.focused().tab()
|
||||
|
||||
break
|
||||
}
|
||||
case 'datetime': {
|
||||
const date = valueString.split(' ')[0]
|
||||
const time = valueString.split(' ')[1]
|
||||
|
||||
cy.focused().type(date)
|
||||
cy.focused().tab()
|
||||
cy.focused().tab()
|
||||
cy.focused().type(time)
|
||||
|
||||
break
|
||||
}
|
||||
case 'in': {
|
||||
cy.get('.checkbox-vals').then(() => {
|
||||
cy.focused().tab()
|
||||
cy.focused().click()
|
||||
cy.get('.no-values')
|
||||
.should('not.exist')
|
||||
.then(() => {
|
||||
cy.get('clr-checkbox-wrapper input').then((inputs: any) => {
|
||||
inputs[0].click()
|
||||
cy.get('.in-values-modal .modal-footer button').click()
|
||||
|
||||
cy.get('.modal-footer .btn-success-outline').click()
|
||||
|
||||
if (callback) callback()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
break
|
||||
}
|
||||
case 'between': {
|
||||
cy.focused().tab()
|
||||
|
||||
const start = valueString.split('-')[0]
|
||||
const end = valueString.split('-')[1]
|
||||
|
||||
cy.focused().type(start)
|
||||
cy.focused().tab()
|
||||
cy.focused().type(end)
|
||||
}
|
||||
default: {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
cy.wait(100)
|
||||
cy.focused().tab()
|
||||
cy.wait(100)
|
||||
cy.focused().tab()
|
||||
cy.wait(100)
|
||||
cy.focused().tab()
|
||||
cy.wait(100)
|
||||
cy.focused().tab()
|
||||
cy.wait(100)
|
||||
cy.focused().click()
|
||||
|
||||
if (callback) callback()
|
||||
}
|
||||
|
||||
const openTableFromViewboxTree = (
|
||||
libNameIncludes: string,
|
||||
tablenames: string[]
|
||||
) => {
|
||||
cy.get('.add-new clr-tree > clr-tree-node', {
|
||||
timeout: longerCommandTimeout
|
||||
}).then((treeNodes: any) => {
|
||||
let viyaLib
|
||||
|
||||
for (let node of treeNodes) {
|
||||
if (node.innerText.toLowerCase().includes(libNameIncludes)) {
|
||||
viyaLib = node
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
cy.get(viyaLib).within(() => {
|
||||
cy.get('p')
|
||||
.click()
|
||||
.then(() => {
|
||||
cy.get('.clr-treenode-link').then(async (innerNodes: any) => {
|
||||
for (let innerNode of innerNodes) {
|
||||
for (let tablename of tablenames) {
|
||||
await pause(300)
|
||||
if (innerNode.innerText.toLowerCase().includes(tablename)) {
|
||||
innerNode.click()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const pause = (ms: number) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve(null)
|
||||
}, ms)
|
||||
})
|
||||
}
|
||||
|
||||
const visitPage = (url: string) => {
|
||||
cy.visit(`${hostUrl}${appLocation}/#/${url}`)
|
||||
}
|
23
client/cypress/support/e2e.ts
Normal file
23
client/cypress/support/e2e.ts
Normal file
@ -0,0 +1,23 @@
|
||||
// ***********************************************************
|
||||
// This example support/e2e.ts is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
|
||||
import 'cypress-plugin-tab'
|
||||
import "cypress-real-events"
|
@ -10,7 +10,7 @@ const check = (cwd) => {
|
||||
onlyAllow:
|
||||
'AFLv2.1;Apache 2.0;Apache-2.0;Apache*;Artistic-2.0;0BSD;BSD*;BSD-2-Clause;BSD-3-Clause;CC0-1.0;CC-BY-3.0;CC-BY-4.0;ISC;MIT;MPL-2.0;ODC-By-1.0;Python-2.0;Unlicense;',
|
||||
excludePackages:
|
||||
'@cds/city@1.1.0;@handsontable/angular@13.0.0;handsontable@13.0.0;hyperformula@2.5.0;jackspeak@2.2.0;path-scurry@1.7.0'
|
||||
'@cds/city@1.1.0;@handsontable/angular@13.1.0;handsontable@13.1.0;hyperformula@2.5.0;jackspeak@2.2.0;path-scurry@1.7.0'
|
||||
},
|
||||
(error, json) => {
|
||||
if (error) {
|
||||
|
8060
client/package-lock.json
generated
8060
client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dc-client",
|
||||
"description": "dc-client",
|
||||
"name": "data_controller-client",
|
||||
"description": "DataController Client",
|
||||
"angular-cli": {},
|
||||
"scripts": {
|
||||
"start": "node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng serve",
|
||||
@ -29,7 +29,9 @@
|
||||
"cy:run": "cypress run",
|
||||
"audit:prod": "npm audit --omit=dev",
|
||||
"sasdocs": "sasjs doc && ./sasjs/utils/deploydocs.sh",
|
||||
"typedoc": "typedoc --options typedoc.json && cd ../dc-devdocs"
|
||||
"compodoc:build": "compodoc -p tsconfig.doc.json --name 'Data Controller Client'",
|
||||
"compodoc:build-and-serve": "compodoc -p tsconfig.doc.json -s --name 'Data Controller Client'",
|
||||
"compodoc:serve": "compodoc -s --name 'Data Controller Client'"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
@ -46,19 +48,19 @@
|
||||
"@clr/angular": "^13.17.0",
|
||||
"@clr/icons": "^13.0.2",
|
||||
"@clr/ui": "^13.17.0",
|
||||
"@handsontable/angular": "^13.0.0",
|
||||
"@sasjs/adapter": "4.3.6",
|
||||
"@sasjs/utils": "^3.3.0",
|
||||
"@handsontable/angular": "^13.1.0",
|
||||
"@sasjs/adapter": "4.10.2",
|
||||
"@sasjs/utils": "^3.4.0",
|
||||
"@sheet/crypto": "1.20211122.1",
|
||||
"@types/d3-graphviz": "^2.6.7",
|
||||
"@types/text-encoding": "0.0.35",
|
||||
"base64-arraybuffer": "^0.2.0",
|
||||
"buffer": "^5.4.3",
|
||||
"crypto-browserify": "3.12.0",
|
||||
"crypto-js": "^3.3.0",
|
||||
"crypto-js": "^4.2.0",
|
||||
"d3-graphviz": "^5.0.2",
|
||||
"fs-extra": "^7.0.1",
|
||||
"handsontable": "^13.0.0",
|
||||
"handsontable": "^13.1.0",
|
||||
"https-browserify": "1.0.0",
|
||||
"hyperformula": "^2.5.0",
|
||||
"iconv-lite": "^0.5.0",
|
||||
@ -69,7 +71,6 @@
|
||||
"ngx-clipboard": "^16.0.0",
|
||||
"ngx-json-viewer": "file:libraries/ngx-json-viewer-3.2.1.tgz",
|
||||
"nodejs": "0.0.0",
|
||||
"numbro": "^2.1.1",
|
||||
"os-browserify": "0.3.0",
|
||||
"rxjs": "^7.8.0",
|
||||
"save-svg-as-png": "^1.4.17",
|
||||
@ -88,9 +89,11 @@
|
||||
"@angular-eslint/template-parser": "16.0.3",
|
||||
"@angular/cli": "^16.1.0",
|
||||
"@angular/compiler-cli": "^16.1.2",
|
||||
"@cypress/webpack-preprocessor": "^5.11.1",
|
||||
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
||||
"@compodoc/compodoc": "^1.1.21",
|
||||
"@cypress/webpack-preprocessor": "^5.17.1",
|
||||
"@types/core-js": "^2.5.5",
|
||||
"@types/crypto-js": "^4.0.1",
|
||||
"@types/crypto-js": "^4.2.1",
|
||||
"@types/es6-shim": "^0.31.39",
|
||||
"@types/jasmine": "~3.6.0",
|
||||
"@types/lodash-es": "^4.17.3",
|
||||
@ -99,10 +102,10 @@
|
||||
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
||||
"@typescript-eslint/parser": "^5.29.0",
|
||||
"core-js": "^2.5.4",
|
||||
"cypress": "^9.5.3",
|
||||
"cypress": "12.17.1",
|
||||
"cypress-file-upload": "^5.0.8",
|
||||
"cypress-plugin-tab": "^1.0.5",
|
||||
"cypress-real-events": "^1.7.6",
|
||||
"cypress-real-events": "^1.8.1",
|
||||
"es6-shim": "^0.35.5",
|
||||
"eslint": "^8.33.0",
|
||||
"git-describe": "^4.0.4",
|
||||
@ -120,7 +123,8 @@
|
||||
"rimraf": "3.0.2",
|
||||
"ts-loader": "^9.2.8",
|
||||
"ts-node": "^3.3.0",
|
||||
"typedoc": "^0.23.24",
|
||||
"typedoc": "^0.24.8",
|
||||
"typedoc-plugin-external-module-name": "^4.0.6",
|
||||
"typescript": "~4.9.4",
|
||||
"wait-on": "^6.0.1",
|
||||
"watch": "^1.0.2"
|
||||
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
npm run cy:run -- --browser chrome --spec "cypress/integration/liveness.tests.ts"
|
||||
npm run cy:run -- --browser chrome --spec "cypress/integration/editor.tests.ts"
|
||||
npm run cy:run -- --browser chrome --spec "cypress/integration/excel.tests.ts"
|
||||
npm run cy:run -- --browser chrome --spec "cypress/integration/filtering.tests.ts"
|
||||
npm run cy:run -- --browser chrome --spec "cypress/integration/licensing.tests.ts"
|
@ -1,5 +1,8 @@
|
||||
import { QueryClause } from './models/TableData'
|
||||
|
||||
/**
|
||||
* Filtering cache info, to be reused when filtering modal is re-open
|
||||
*/
|
||||
interface FilterCache {
|
||||
cols: any[]
|
||||
vals: any[]
|
||||
@ -10,12 +13,18 @@ interface FilterCache {
|
||||
query: QueryClause[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Filtering cache info in the open viewboxes, to be reused when filtering modal is re-open
|
||||
*/
|
||||
interface ViewboxCache {
|
||||
[key: number]: {
|
||||
filter: FilterCache
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial values when no cached values stored
|
||||
*/
|
||||
export const initFilter: { filter: FilterCache } = {
|
||||
filter: {
|
||||
cols: <any[]>[],
|
||||
@ -28,8 +37,23 @@ export const initFilter: { filter: FilterCache } = {
|
||||
}
|
||||
}
|
||||
|
||||
export interface XLMapListItem {
|
||||
id: string
|
||||
description: string
|
||||
targetDS: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Cached filtering values across whole app (editor, viewer, viewboxes)
|
||||
* Cached lineage libraries, tables
|
||||
* Cached metadata tree
|
||||
* Cached usernav tree
|
||||
* Cached viyaApi collections, search and selected endpoint
|
||||
*/
|
||||
export const globals: {
|
||||
rootParam: string
|
||||
dcLib: string
|
||||
xlmaps: XLMapListItem[]
|
||||
editor: any
|
||||
viewer: any
|
||||
viewboxes: ViewboxCache
|
||||
@ -41,11 +65,13 @@ export const globals: {
|
||||
[key: string]: any
|
||||
} = {
|
||||
rootParam: <string>'',
|
||||
dcLib: '',
|
||||
xlmaps: [],
|
||||
editor: {
|
||||
startupSet: <boolean>false,
|
||||
treeNodeLibraries: <any[] | null>[],
|
||||
libsAndTables: <any[]>[],
|
||||
libraries: <String[] | undefined>[],
|
||||
libraries: <string[] | undefined>[],
|
||||
library: <string>'',
|
||||
table: <string>'',
|
||||
filter: <FilterCache>{
|
||||
|
@ -1,40 +0,0 @@
|
||||
<div class="content-area">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex flex-column justify-content-center">
|
||||
<h3 class="text-center">
|
||||
You succesfully edited table
|
||||
<span class="color-blue font-weight-700">{{ libds }}</span>
|
||||
</h3>
|
||||
<p class="text-center">
|
||||
<b>Please choose from the following actions</b>
|
||||
</p>
|
||||
<div class="row d-flex justify-content-center mt-20">
|
||||
<button
|
||||
class="btn btn-sm btn-outline text-center"
|
||||
(click)="submittedTableScreen()"
|
||||
>
|
||||
Go to submitted table screen
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-sm btn-outline text-center"
|
||||
(click)="viewerTableScreen()"
|
||||
>
|
||||
Go to base table screen
|
||||
</button>
|
||||
<button
|
||||
id="approvalBtn"
|
||||
class="btn btn-sm btn-success-outline text-center"
|
||||
(click)="approveTableScreen()"
|
||||
>
|
||||
Go to approvals screen
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-sm btn-info-outline text-center"
|
||||
(click)="goBack()"
|
||||
>
|
||||
Go back to editor
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,50 +0,0 @@
|
||||
import { AfterViewInit, Component, OnInit } from '@angular/core'
|
||||
import { ActivatedRoute, Router } from '@angular/router'
|
||||
|
||||
@Component({
|
||||
selector: 'app-actions',
|
||||
templateUrl: './actions.component.html',
|
||||
styleUrls: ['./actions.component.scss'],
|
||||
host: {
|
||||
class: 'content-container'
|
||||
}
|
||||
})
|
||||
export class ActionsComponent implements OnInit, AfterViewInit {
|
||||
public dsid: any
|
||||
public libds: string | undefined
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
public submittedTableScreen() {
|
||||
this.router.navigateByUrl('/stage/' + this.dsid)
|
||||
}
|
||||
|
||||
public approveTableScreen() {
|
||||
this.router.navigateByUrl('/approve/approveDet/' + this.dsid)
|
||||
}
|
||||
|
||||
public viewerTableScreen() {
|
||||
this.router.navigateByUrl('/view/data/' + this.libds)
|
||||
}
|
||||
|
||||
public goBack() {
|
||||
this.router.navigateByUrl('/editor/' + this.libds)
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.dsid = this.route.snapshot.params['dsid']
|
||||
this.libds = this.route.snapshot.params['libds']
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
setTimeout(() => {
|
||||
let approvalBtn: any = window.document.getElementById('approvalBtn')
|
||||
if (!!approvalBtn) {
|
||||
approvalBtn.focus()
|
||||
}
|
||||
}, 700)
|
||||
}
|
||||
}
|
@ -168,8 +168,8 @@
|
||||
</button>
|
||||
<clr-dropdown-menu *clrIfOpen clrPosition="bottom-left">
|
||||
<a [routerLink]="['/view']" clrDropdownItem>VIEW</a>
|
||||
<a [routerLink]="['/home']" clrDropdownItem>EDIT</a>
|
||||
<a [routerLink]="['/submitted']" clrDropdownItem>REVIEW</a>
|
||||
<a [routerLink]="['/home']" clrDropdownItem>LOAD</a>
|
||||
<a [routerLink]="['/review/submitted']" clrDropdownItem>REVIEW</a>
|
||||
</clr-dropdown-menu>
|
||||
</clr-dropdown>
|
||||
</div>
|
||||
@ -189,10 +189,10 @@
|
||||
router.url.includes('edit-record') ||
|
||||
router.url.includes('home')
|
||||
"
|
||||
>EDIT</a
|
||||
>LOAD</a
|
||||
>
|
||||
<a
|
||||
[routerLink]="['/submitted']"
|
||||
[routerLink]="['/review/submitted']"
|
||||
[class.active]="
|
||||
router.url.includes('submitted') ||
|
||||
router.url.includes('approve') ||
|
||||
@ -224,7 +224,7 @@
|
||||
<ul class="nav">
|
||||
<li class="nav-item">
|
||||
<a
|
||||
[routerLink]="['/submitted']"
|
||||
[routerLink]="['/review/submitted']"
|
||||
class="nav-link nav-text"
|
||||
routerLinkActive="active"
|
||||
>SUBMIT</a
|
||||
@ -232,15 +232,16 @@
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a
|
||||
[routerLink]="['/approve']"
|
||||
[routerLink]="['/review/approve']"
|
||||
class="nav-link nav-text"
|
||||
[class.active]="router.url.includes('approve')"
|
||||
routerLinkActive="active"
|
||||
>APPROVE</a
|
||||
>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a
|
||||
[routerLink]="['/history']"
|
||||
[routerLink]="['/review/history']"
|
||||
class="nav-link nav-text"
|
||||
routerLinkActive="active"
|
||||
>HISTORY</a
|
||||
|
@ -57,24 +57,15 @@ export class AppComponent {
|
||||
private elementRef: ElementRef
|
||||
) {
|
||||
this.parseDcAdapterSettings()
|
||||
|
||||
/**
|
||||
* Prints app info in the console such as:
|
||||
* - Adapter versions
|
||||
* - App version
|
||||
* - Build timestamp
|
||||
*
|
||||
*/
|
||||
;(window as any).appinfo = () => {
|
||||
const licenseKeyData = this.licenceService.getLicenseKeyData()
|
||||
|
||||
if (licenseKeyData) {
|
||||
const expiry_date = moment(
|
||||
licenseKeyData.valid_until,
|
||||
'YYYY-MM-DD'
|
||||
).startOf('day')
|
||||
const current_date = moment().startOf('day')
|
||||
const daysToExpiry = expiry_date.diff(current_date, 'days')
|
||||
|
||||
licenseKeyData.valid_until += ` (${daysToExpiry} ${
|
||||
daysToExpiry === 1 ? 'day' : 'days'
|
||||
} remaining)`
|
||||
|
||||
if (isNaN(daysToExpiry)) licenseKeyData.valid_until = 'Unlimited'
|
||||
}
|
||||
|
||||
console.table({
|
||||
'Adapter version': VERSION.adapterVersion || 'n/a',
|
||||
'App version': (VERSION.tag || '').replace('v', ''),
|
||||
@ -87,7 +78,12 @@ export class AppComponent {
|
||||
|
||||
this.subscribeToLicenseEvents()
|
||||
|
||||
/**
|
||||
* Fetches git tag ang git hash from `version.ts` file
|
||||
* It's placed in the user drop down.
|
||||
*/
|
||||
this.commitVer = (VERSION.tag || '').replace('v', '') + '.' + VERSION.hash
|
||||
|
||||
router.events.subscribe((val) => {
|
||||
this.routeUrl = this.router.url
|
||||
|
||||
@ -127,8 +123,10 @@ export class AppComponent {
|
||||
this.subscribeToAppActive()
|
||||
this.subscribeToDemoLimitModal()
|
||||
|
||||
/* In Viya streaming apps, content is served within an iframe. This code
|
||||
makes that iframe "full screen" so it looks like a regular window. */
|
||||
/**
|
||||
* In Viya streaming apps, content is served within an iframe. This code
|
||||
* makes that iframe "full screen" so it looks like a regular window.
|
||||
*/
|
||||
if (window.frameElement) {
|
||||
window.frameElement.setAttribute(
|
||||
'style',
|
||||
@ -143,6 +141,9 @@ export class AppComponent {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses adapter settings that are found in the <sasjs> tag inside index.html
|
||||
*/
|
||||
private parseDcAdapterSettings() {
|
||||
const sasjsElement = document.querySelector('sasjs')
|
||||
|
||||
@ -180,9 +181,14 @@ export class AppComponent {
|
||||
this.appService.sasServiceInit()
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens licence page with the active licence problem
|
||||
* Problem details are encoded in the url
|
||||
*/
|
||||
public licenceProblemDetails(url: string) {
|
||||
this.router.navigateByUrl(url)
|
||||
}
|
||||
|
||||
/**
|
||||
* Based on string provided we return true, false or null
|
||||
* True -> Compute API
|
||||
@ -199,6 +205,12 @@ export class AppComponent {
|
||||
return value === 'true' || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Listens for an `demo limit` event that will show the `Feature locked modal`
|
||||
* For exmaple when in editor upload feature is not enabled
|
||||
* When user tries to upload the excel, editor component will trgger this event
|
||||
* And stop the execution of file upload code.
|
||||
*/
|
||||
public subscribeToDemoLimitModal() {
|
||||
this.eventService.onDemoLimitModalShow.subscribe((featureName: string) => {
|
||||
this.demoLimitNotice = {
|
||||
@ -208,6 +220,10 @@ export class AppComponent {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Listens for licence events so banner can be displayed.
|
||||
* App is free tier, licence will expire, is expired or is invalid
|
||||
*/
|
||||
public subscribeToLicenseEvents() {
|
||||
this.licenceService.isAppFreeTier.subscribe((isAppFreeTier: boolean) => {
|
||||
this.freeTierBanner = isAppFreeTier
|
||||
@ -227,6 +243,10 @@ export class AppComponent {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Listens for an event that will activate od deactivate full application.
|
||||
* Based on licence key prcoessing result
|
||||
*/
|
||||
public subscribeToAppActive() {
|
||||
this.licenceService.isAppActivated.subscribe((value: any) => {
|
||||
this.appActive = value
|
||||
@ -248,31 +268,51 @@ export class AppComponent {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* When startupservice request is finished with valid response, this event will
|
||||
* make sure loading screen is gone.
|
||||
*/
|
||||
public subscribeToStartupData() {
|
||||
this.eventService.onStartupDataLoaded.subscribe(() => {
|
||||
this.startupDataLoaded = true
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens requests modal when requested from event service
|
||||
*/
|
||||
public subscribeToRequestsModal() {
|
||||
this.eventService.onRequestsModalOpen.subscribe((value: boolean) => {
|
||||
this.requestsModal = true
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes abort modal with matching ID (there could be multiple abort modals open)
|
||||
*/
|
||||
public closeAbortModal(abortId: number) {
|
||||
let abortIndex = this.sasjsAborts.findIndex((abort) => abort.id === abortId)
|
||||
this.sasjsAborts.splice(abortIndex, 1)
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles sidebar when requested from event service
|
||||
*/
|
||||
public toggleSidebar() {
|
||||
this.eventService.toggleSidebar()
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not current route includes the route from param
|
||||
* @param route route to check
|
||||
*/
|
||||
public isMainRoute(route: string): boolean {
|
||||
return this.router.url.includes(route)
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a page for updating the licence.
|
||||
*/
|
||||
public openLicencingPage() {
|
||||
this.router.navigateByUrl('/licensing/update')
|
||||
}
|
||||
|
2
client/src/app/app.d.ts
vendored
2
client/src/app/app.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
declare module 'save-svg-as-png'
|
||||
|
||||
declare module 'numbro/dist/languages.min'
|
||||
declare interface Navigator {
|
||||
msSaveBlob: (blob: any, defaultName?: string) => boolean
|
||||
}
|
||||
|
@ -11,33 +11,16 @@ import { NotFoundComponent } from './not-found/not-found.component'
|
||||
|
||||
import { SasStoreService } from './services/sas-store.service'
|
||||
import { SharedModule } from './shared/shared.module'
|
||||
// import { EditorComponent } from './editor/editor.component'
|
||||
import { ActionsComponent } from './actions/actions.component'
|
||||
|
||||
import { AppSharedModule } from './app-shared.module'
|
||||
import { ApproveDetailsComponent } from './approve-details/approve-details.component'
|
||||
import { ApproveComponent } from './approve/approve.component'
|
||||
import { DeployComponent } from './deploy/deploy.component'
|
||||
import { AutomaticComponent } from './deploy/sections/automatic/automatic.component'
|
||||
import { ManualComponent } from './deploy/sections/manual/manual.component'
|
||||
import { SasjsConfiguratorComponent } from './deploy/sections/sasjs-configurator/sasjs-configurator.component'
|
||||
import { GroupComponent } from './group/group.component'
|
||||
import { HistoryComponent } from './history/history.component'
|
||||
import { LicensingComponent } from './licensing/licensing.component'
|
||||
import { LineageComponent } from './lineage/lineage.component'
|
||||
import { MetadataComponent } from './metadata/metadata.component'
|
||||
import { PipesModule } from './pipes/pipes.module'
|
||||
import { RoleComponent } from './role/role.component'
|
||||
import { ApproveRouteComponent } from './routes/approve-route/approve-route.component'
|
||||
import { HistoryRouteComponent } from './routes/history-route/history-route.component'
|
||||
import { ReviewRouteComponent } from './routes/review-route/review-route.component'
|
||||
import { LicensingGuard } from './routes/licensing.guard'
|
||||
import { UsernavRouteComponent } from './routes/usernav-route/usernav-route.component'
|
||||
import { AppService } from './services/app.service'
|
||||
import { InfoModalComponent } from './shared/abort-modal/info-modal.component'
|
||||
import { RequestsModalComponent } from './shared/requests-modal/requests-modal.component'
|
||||
import { SubmitterComponent } from './submitter/submitter.component'
|
||||
import { UserComponent } from './user/user.component'
|
||||
import { HomeModule } from './home/home.module'
|
||||
import { SystemComponent } from './system/system.component'
|
||||
import { DirectivesModule } from './directives/directives.module'
|
||||
import { ViyaApiExplorerComponent } from './viya-api-explorer/viya-api-explorer.component'
|
||||
import { NgxJsonViewerModule } from 'ngx-json-viewer'
|
||||
@ -46,27 +29,11 @@ import { NgxJsonViewerModule } from 'ngx-json-viewer'
|
||||
declarations: [
|
||||
AppComponent,
|
||||
NotFoundComponent,
|
||||
ApproveComponent,
|
||||
ApproveDetailsComponent,
|
||||
ActionsComponent,
|
||||
HistoryComponent,
|
||||
LineageComponent,
|
||||
SubmitterComponent,
|
||||
ApproveRouteComponent,
|
||||
HistoryRouteComponent,
|
||||
MetadataComponent,
|
||||
ReviewRouteComponent,
|
||||
ReviewRouteComponent,
|
||||
UsernavRouteComponent,
|
||||
UserComponent,
|
||||
GroupComponent,
|
||||
RoleComponent,
|
||||
RequestsModalComponent,
|
||||
DeployComponent,
|
||||
InfoModalComponent,
|
||||
LicensingComponent,
|
||||
ManualComponent,
|
||||
AutomaticComponent,
|
||||
SasjsConfiguratorComponent,
|
||||
SystemComponent,
|
||||
ViyaApiExplorerComponent
|
||||
],
|
||||
imports: [
|
||||
@ -84,7 +51,7 @@ import { NgxJsonViewerModule } from 'ngx-json-viewer'
|
||||
DirectivesModule,
|
||||
NgxJsonViewerModule
|
||||
],
|
||||
providers: [AppService, SasStoreService, ApproveComponent, LicensingGuard],
|
||||
providers: [AppService, SasStoreService, LicensingGuard],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule {}
|
||||
|
@ -4,25 +4,23 @@
|
||||
* The full license information can be found in LICENSE in the root directory of this project.
|
||||
*/
|
||||
import { ModuleWithProviders } from '@angular/core'
|
||||
import { Routes, RouterModule } from '@angular/router'
|
||||
import { RouterModule, Routes } from '@angular/router'
|
||||
|
||||
import { HomeComponent } from './home/home.component'
|
||||
import { ApproveComponent } from './approve/approve.component'
|
||||
import { ApproveDetailsComponent } from './approve-details/approve-details.component'
|
||||
import { ActionsComponent } from './actions/actions.component'
|
||||
import { HistoryComponent } from './history/history.component'
|
||||
import { NotFoundComponent } from './not-found/not-found.component'
|
||||
import { SubmitterComponent } from './submitter/submitter.component'
|
||||
|
||||
import { ApproveRouteComponent } from './routes/approve-route/approve-route.component'
|
||||
import { DeployComponent } from './deploy/deploy.component'
|
||||
import { LicensingComponent } from './licensing/licensing.component'
|
||||
import { LicensingGuard } from './routes/licensing.guard'
|
||||
import { StageModule } from './stage/stage.module'
|
||||
import { DeployModule } from './deploy/deploy.module'
|
||||
import { EditorModule } from './editor/editor.module'
|
||||
import { HomeModule } from './home/home.module'
|
||||
import { LicensingModule } from './licensing/licensing.module'
|
||||
import { ReviewModule } from './review/review.module'
|
||||
import { ReviewRouteComponent } from './routes/review-route/review-route.component'
|
||||
import { StageModule } from './stage/stage.module'
|
||||
import { SystemModule } from './system/system.module'
|
||||
import { ViewerModule } from './viewer/viewer.module'
|
||||
import { SystemComponent } from './system/system.component'
|
||||
|
||||
/**
|
||||
* Defining routes
|
||||
*/
|
||||
export const ROUTES: Routes = [
|
||||
{ path: '', redirectTo: 'home', pathMatch: 'full' },
|
||||
{
|
||||
@ -30,23 +28,28 @@ export const ROUTES: Routes = [
|
||||
loadChildren: () => ViewerModule
|
||||
},
|
||||
{
|
||||
path: 'approve',
|
||||
component: ApproveRouteComponent,
|
||||
/**
|
||||
* Load review module (approve, history, submitted)
|
||||
*/
|
||||
path: 'review',
|
||||
component: ReviewRouteComponent,
|
||||
children: [
|
||||
{ path: '', pathMatch: 'full', redirectTo: 'toapprove' },
|
||||
{ path: 'toapprove', component: ApproveComponent },
|
||||
{ path: 'approveDet/:tableId', component: ApproveDetailsComponent },
|
||||
{ path: 'submitted', component: SubmitterComponent }
|
||||
{
|
||||
path: '',
|
||||
loadChildren: () => ReviewModule
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'licensing/:action',
|
||||
component: LicensingComponent,
|
||||
canActivate: [LicensingGuard],
|
||||
canDeactivate: [LicensingGuard]
|
||||
path: 'licensing',
|
||||
loadChildren: () => LicensingModule
|
||||
},
|
||||
{ path: 'home', component: HomeComponent },
|
||||
{ path: 'home', loadChildren: () => HomeModule },
|
||||
{
|
||||
/**
|
||||
* Load editor module with subroutes
|
||||
*/
|
||||
path: 'editor',
|
||||
loadChildren: () => EditorModule
|
||||
},
|
||||
@ -54,16 +57,20 @@ export const ROUTES: Routes = [
|
||||
path: 'stage',
|
||||
loadChildren: () => StageModule
|
||||
},
|
||||
{ path: 'system', component: SystemComponent },
|
||||
{ path: 'actions/:libds/:dsid', component: ActionsComponent },
|
||||
{ path: 'history', component: HistoryComponent },
|
||||
{ path: 'submitted', component: SubmitterComponent },
|
||||
{ path: 'submitted/:tableId', component: SubmitterComponent },
|
||||
{ path: 'deploy', component: DeployComponent },
|
||||
{ path: 'deploy/manualdeploy', component: DeployComponent },
|
||||
{
|
||||
path: 'system',
|
||||
loadChildren: () => SystemModule
|
||||
},
|
||||
{
|
||||
path: 'deploy',
|
||||
loadChildren: () => DeployModule
|
||||
},
|
||||
{ path: '**', component: NotFoundComponent }
|
||||
]
|
||||
|
||||
/**
|
||||
* Exporting routes
|
||||
*/
|
||||
export const ROUTING: ModuleWithProviders<RouterModule> = RouterModule.forRoot(
|
||||
ROUTES,
|
||||
{ useHash: true }
|
||||
|
14
client/src/app/deploy/deploy-routing.module.ts
Normal file
14
client/src/app/deploy/deploy-routing.module.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { NgModule } from '@angular/core'
|
||||
import { RouterModule, Routes } from '@angular/router'
|
||||
import { DeployComponent } from './deploy.component'
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', component: DeployComponent },
|
||||
{ path: 'manualdeploy', component: DeployComponent }
|
||||
]
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class DeployRoutingModule {}
|
@ -78,6 +78,9 @@ export class DeployComponent implements OnInit {
|
||||
this.setDeployDefaults()
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting default values used for deploy request
|
||||
*/
|
||||
public setDeployDefaults() {
|
||||
this.dcPath = this.dcAdapterSettings?.dcPath || ''
|
||||
this.selectedAdminGroup = this.dcAdapterSettings?.adminGroup || ''
|
||||
@ -86,6 +89,9 @@ export class DeployComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Accepting terms of service shows next screen
|
||||
*/
|
||||
public termsAgreeChange() {
|
||||
if (!this.autodeploy) {
|
||||
this.getAdminGroups()
|
||||
@ -94,6 +100,9 @@ export class DeployComponent implements OnInit {
|
||||
this.step++
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches admin groups from VIYA to be selected for a backend deploy
|
||||
*/
|
||||
public getAdminGroups() {
|
||||
fetch(
|
||||
this.sasJsConfig.serverUrl + '/identities/groups?sortBy=name&limit=5000',
|
||||
|
20
client/src/app/deploy/deploy.module.ts
Normal file
20
client/src/app/deploy/deploy.module.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { NgModule } from '@angular/core'
|
||||
import { CommonModule } from '@angular/common'
|
||||
import { DeployComponent } from './deploy.component'
|
||||
import { AutomaticComponent } from './sections/automatic/automatic.component'
|
||||
import { ManualComponent } from './sections/manual/manual.component'
|
||||
import { SasjsConfiguratorComponent } from './sections/sasjs-configurator/sasjs-configurator.component'
|
||||
import { ClarityModule } from '@clr/angular'
|
||||
import { FormsModule } from '@angular/forms'
|
||||
import { DeployRoutingModule } from './deploy-routing.module'
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
DeployComponent,
|
||||
AutomaticComponent,
|
||||
ManualComponent,
|
||||
SasjsConfiguratorComponent
|
||||
],
|
||||
imports: [CommonModule, FormsModule, ClarityModule, DeployRoutingModule]
|
||||
})
|
||||
export class DeployModule {}
|
@ -55,6 +55,13 @@ export class AutomaticComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
/**
|
||||
* Executes sas.json file to deploy the backend
|
||||
* Method will first try to run the `auto deploy`
|
||||
* If that fails the rest of the code is ignored.
|
||||
* If request is successfull, method will continue to try
|
||||
* to create database if checkbox is toggled on
|
||||
*/
|
||||
public async executeJson() {
|
||||
this.autodeploying = true
|
||||
this.isSubmittingJson = true
|
||||
@ -99,6 +106,9 @@ export class AutomaticComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the `makedata` request sending the ADMIN and DCPATH values
|
||||
*/
|
||||
public createDatabase() {
|
||||
let data = {
|
||||
fromjs: [
|
||||
|
@ -52,6 +52,9 @@ export class ManualComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
/**
|
||||
* FIXME: Remove
|
||||
*/
|
||||
public async executableContext() {
|
||||
// getExecutableContexts now need AuthConfig parameter which we don't have on web
|
||||
// this.contextsLoading = true
|
||||
@ -65,10 +68,16 @@ export class ManualComponent implements OnInit {
|
||||
// this.contextsLoading = false
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes sas.json file attached to the input
|
||||
*/
|
||||
public clearUploadInput(event: Event) {
|
||||
this.deployService.clearUploadInput(event)
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads attached SAS file to be sent to sas for execution (backend deploy)
|
||||
*/
|
||||
public onSasFileChange(event: any) {
|
||||
this.preloadedFile = false
|
||||
|
||||
@ -93,12 +102,18 @@ export class ManualComponent implements OnInit {
|
||||
fileReader.readAsText(file)
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads attached JSON file to be sent to sas for execution (backend deploy)
|
||||
*/
|
||||
public async onJsonFileChange(event: any) {
|
||||
let file = event.target.files[0]
|
||||
|
||||
this.jsonFile = await this.deployService.readFile(file)
|
||||
}
|
||||
|
||||
/**
|
||||
* Appending precode lines to the attached sas or json file for backend deploy
|
||||
*/
|
||||
public addPrecodeLines() {
|
||||
let headerLines = [
|
||||
`%let context=${this.selectedContext};`,
|
||||
@ -110,6 +125,9 @@ export class ManualComponent implements OnInit {
|
||||
this.linesOfCode.unshift(...headerLines)
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloadng file with precode included
|
||||
*/
|
||||
public downloadSasPrecodeFile() {
|
||||
let linesAsText = this.linesOfCode.join('\n')
|
||||
let filename = this.fileName.split('.')[0]
|
||||
@ -117,6 +135,9 @@ export class ManualComponent implements OnInit {
|
||||
this.downloadFile(linesAsText, filename, 'sas')
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for downloading log and repsonse as a file
|
||||
*/
|
||||
public downloadFile(
|
||||
content: any,
|
||||
filename: string,
|
||||
@ -125,10 +146,17 @@ export class ManualComponent implements OnInit {
|
||||
this.deployService.downloadFile(content, filename, extension)
|
||||
}
|
||||
|
||||
/**
|
||||
* Saving dcpath to localstorage
|
||||
* FIXME: maybe it'snot necessary
|
||||
*/
|
||||
public saveDcPath() {
|
||||
localStorage.setItem('deploy_dc_loc', this.dcPath)
|
||||
}
|
||||
|
||||
/**
|
||||
* Send sas.json to be executed (deploying backend)
|
||||
*/
|
||||
public async executeJson() {
|
||||
this.isSubmittingJson = true
|
||||
|
||||
@ -162,6 +190,9 @@ export class ManualComponent implements OnInit {
|
||||
this.isSubmittingJson = false
|
||||
}
|
||||
|
||||
/**
|
||||
* Send sas file to be executed (deploying backend)
|
||||
*/
|
||||
public async executeSAS() {
|
||||
this.executingScript = true
|
||||
this.jobLog = ''
|
||||
@ -194,6 +225,10 @@ export class ManualComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Running makedata service
|
||||
* @param newTab open and run in new tab
|
||||
*/
|
||||
public createDatabase(newTab: boolean = true) {
|
||||
if (newTab) {
|
||||
let url =
|
||||
|
@ -5,7 +5,6 @@ import { ServerType } from '@sasjs/utils/types/serverType'
|
||||
import { DcAdapterSettings } from 'src/app/models/DcAdapterSettings'
|
||||
import { SASGroup } from 'src/app/models/sas/public-getgroups.model'
|
||||
import { SASjsApiServerInfo } from 'src/app/models/sasjs-api/SASjsApiServerInfo.model'
|
||||
import { HelperService } from 'src/app/services/helper.service'
|
||||
import { SasService } from 'src/app/services/sas.service'
|
||||
import { SasjsService } from 'src/app/services/sasjs.service'
|
||||
|
||||
@ -51,6 +50,9 @@ export class SasjsConfiguratorComponent implements OnInit {
|
||||
this.getServerInfo()
|
||||
}
|
||||
|
||||
/**
|
||||
* Fethes the sasjs server instance info
|
||||
*/
|
||||
getServerInfo() {
|
||||
this.sasjsService
|
||||
.getServerInfo()
|
||||
@ -59,6 +61,9 @@ export class SasjsConfiguratorComponent implements OnInit {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches user groups from the `usernav/usergroupsbymember` service
|
||||
*/
|
||||
getUserGroups() {
|
||||
this.loading = true
|
||||
|
||||
@ -99,6 +104,9 @@ export class SasjsConfiguratorComponent implements OnInit {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Creating database
|
||||
*/
|
||||
makeData() {
|
||||
// const _debug = "&_debug=131"; //debug on
|
||||
const _debug = ' ' //debug off
|
||||
|
@ -14,7 +14,9 @@ export class DragNdropDirective {
|
||||
@Output() fileDropped = new EventEmitter<any>()
|
||||
@Output() fileDraggedOver = new EventEmitter<any>()
|
||||
|
||||
// Dragover listener
|
||||
/**
|
||||
* Dragover listener
|
||||
*/
|
||||
@HostListener('dragover', ['$event'])
|
||||
onDragOver(event: any) {
|
||||
event.preventDefault()
|
||||
@ -26,7 +28,9 @@ export class DragNdropDirective {
|
||||
}
|
||||
}
|
||||
|
||||
// Dragleave listener
|
||||
/**
|
||||
* Dragleave listener
|
||||
*/
|
||||
@HostListener('dragleave', ['$event'])
|
||||
public onDragLeave(event: any) {
|
||||
event.preventDefault()
|
||||
@ -34,7 +38,9 @@ export class DragNdropDirective {
|
||||
this.fileOver = false
|
||||
}
|
||||
|
||||
// Drop listener
|
||||
/**
|
||||
* Drop listener
|
||||
*/
|
||||
@HostListener('drop', ['$event'])
|
||||
public ondrop(event: any) {
|
||||
event.preventDefault()
|
||||
@ -48,6 +54,9 @@ export class DragNdropDirective {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks wether dragging element contain files
|
||||
*/
|
||||
private containsFiles(event: any) {
|
||||
if (event && event.dataTransfer && event.dataTransfer.types) {
|
||||
for (let i = 0; i < event.dataTransfer.types.length; i++) {
|
||||
|
@ -22,6 +22,9 @@ export class FileDropDirective {
|
||||
this.element = element
|
||||
}
|
||||
|
||||
/**
|
||||
* Dragging element drop event
|
||||
*/
|
||||
@HostListener('drop', ['$event'])
|
||||
onDrop(event: DragEvent): void {
|
||||
this._preventAndStop(event)
|
||||
@ -39,6 +42,9 @@ export class FileDropDirective {
|
||||
this.fileDrop.emit(fileList)
|
||||
}
|
||||
|
||||
/**
|
||||
* Dragging element drag over event
|
||||
*/
|
||||
@HostListener('dragover', ['$event'])
|
||||
onDragOver(event: DragEvent): void {
|
||||
this._preventAndStop(event)
|
||||
@ -59,6 +65,10 @@ export class FileDropDirective {
|
||||
this.fileOver.emit(false)
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent propagation trough elements and stop default behavior
|
||||
* For particular event
|
||||
*/
|
||||
protected _preventAndStop(event: MouseEvent): void {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
@ -21,6 +21,9 @@ export class FileSelectDirective {
|
||||
this.element = element
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if files exist in the input after input change
|
||||
*/
|
||||
isEmptyAfterSelection(): boolean {
|
||||
return !!this.element.nativeElement.attributes.multiple
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
export interface RowValidation {
|
||||
valid: boolean
|
||||
invalidError: string
|
||||
rowNumber?: number
|
||||
colName?: string
|
||||
value?: string
|
||||
}
|
@ -59,6 +59,12 @@ export class EditRecordComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
/**
|
||||
* Runs native HOT validator against cell value
|
||||
* @param cellValidation column rules
|
||||
* @param cellValue value in the cell that is beign validated
|
||||
* @returns Promise boolean - wether valid or invalid
|
||||
*/
|
||||
async validateRecordCol(
|
||||
cellValidation: any,
|
||||
cellValue: any
|
||||
@ -74,6 +80,12 @@ export class EditRecordComponent implements OnInit {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when date field in the record change
|
||||
* Function will parse date and format to string
|
||||
* @param date picker value
|
||||
* @param colKey column name (key)
|
||||
*/
|
||||
recordDateChange(date: Date, colKey: string) {
|
||||
let cellValidation = this.currentRecordValidator?.getRule(colKey)
|
||||
let format = cellValidation ? cellValidation.dateFormat : ''
|
||||
@ -82,24 +94,38 @@ export class EditRecordComponent implements OnInit {
|
||||
this.currentRecord[colKey] = moment(date).format(format)
|
||||
}
|
||||
|
||||
isRecordModalInvalid(): boolean {
|
||||
return this.currentRecordInvalidCols.length > 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Close edit record modal and apply changes by emitting output event
|
||||
*/
|
||||
confirmRecordEdit() {
|
||||
if (this.currentRecordInvalidCols.length < 1) {
|
||||
this.onRecordChange.emit(this.currentRecord)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close edit record modal without applying the changes
|
||||
*/
|
||||
closeRecordEdit() {
|
||||
this.onRecordEditClose.emit()
|
||||
}
|
||||
|
||||
/**
|
||||
* Emitting output event when dropdown (autocomplete) input in any col change
|
||||
* @param colName column name (key)
|
||||
* @param col column index
|
||||
*/
|
||||
onRecordDropdownChange(colName: string, col: number) {
|
||||
this.onRecordDropdownChanged.emit({ colName, col })
|
||||
}
|
||||
|
||||
/**
|
||||
* Emitting output event when input is focused (clicked on) so we can run a `dynamic cell validation`
|
||||
* Since that bit must be run from the parent component (editor.component)
|
||||
* Result is then applied in the `cellValidation` variable and automatically updated in this component.
|
||||
* @param event input event
|
||||
* @param colName column name (key)
|
||||
*/
|
||||
onRecordInputFocus(event: any, colName: number) {
|
||||
this.onRecordInputFocused.emit({ event, colName })
|
||||
}
|
||||
|
@ -186,7 +186,9 @@
|
||||
} as libdsParsed"
|
||||
class="editor-title text-center mt-0-i"
|
||||
>
|
||||
<clr-tooltip>
|
||||
<clr-icon
|
||||
clrTooltipTrigger
|
||||
(click)="datasetInfo = true"
|
||||
shape="info-circle"
|
||||
class="is-highlight cursor-pointer"
|
||||
@ -199,11 +201,22 @@
|
||||
class="color-yellow"
|
||||
></clr-icon>
|
||||
|
||||
<span clrTooltipTrigger>
|
||||
{{ libdsParsed.libName }}.<a
|
||||
class="mr-10"
|
||||
[routerLink]="'/view/data/' + libds!"
|
||||
>{{ libdsParsed.tableName.replace('-FC', '') }}</a
|
||||
>
|
||||
</span>
|
||||
<clr-tooltip-content
|
||||
clrPosition="bottom-left"
|
||||
clrSize="lg"
|
||||
*clrIfOpen
|
||||
>
|
||||
{{ this.dsNote }}
|
||||
</clr-tooltip-content>
|
||||
</clr-tooltip>
|
||||
|
||||
<ng-container *ngIf="dataSource">
|
||||
<ng-container *ngIf="!zeroFilterRows">
|
||||
({{ dataSource.length | thousandSeparator: ',' }}
|
||||
@ -280,7 +293,7 @@
|
||||
licenceState.value.editor_rows_allowed === 1
|
||||
? 'row'
|
||||
: 'rows'
|
||||
}}, contact support@datacontroller.io</span
|
||||
}}, contact support@datacontroller.io</span
|
||||
>
|
||||
</clr-tooltip-content>
|
||||
</clr-tooltip>
|
||||
@ -385,7 +398,6 @@
|
||||
[class.hidden]="hotTable.hidden"
|
||||
[licenseKey]="hotTable.licenseKey"
|
||||
>
|
||||
<!--[licenseKey]=""-->
|
||||
</hot-table>
|
||||
</div>
|
||||
|
||||
@ -418,7 +430,7 @@
|
||||
licenceState.value.editor_rows_allowed === 1
|
||||
? 'row'
|
||||
: 'rows'
|
||||
}}, contact support@datacontroller.io</span
|
||||
}}, contact support@datacontroller.io</span
|
||||
>
|
||||
</clr-tooltip-content>
|
||||
</clr-tooltip>
|
||||
@ -468,7 +480,7 @@
|
||||
: 'rows'
|
||||
}}
|
||||
will be submitted. To remove the restriction, contact
|
||||
support@datacontroller.io</span
|
||||
support@datacontroller.io</span
|
||||
>
|
||||
<div *ngIf="tableTrue" class="clr-offset-md-2 clr-col-md-8">
|
||||
<div class="form-group">
|
||||
@ -529,7 +541,7 @@
|
||||
Due to current licence, only
|
||||
{{ licenceState.value.submit_rows_limit }} rows in a file will
|
||||
be submitted. To remove the restriction, contact
|
||||
support@datacontroller.io
|
||||
support@datacontroller.io
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@ -597,7 +609,7 @@
|
||||
</button>
|
||||
</div>
|
||||
</clr-modal>
|
||||
<clr-modal [(clrModalOpen)]="pkDups">
|
||||
<clr-modal class="duplicate-keys-modal" [(clrModalOpen)]="pkDups">
|
||||
<h3 class="modal-title">Error</h3>
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
|
@ -15,7 +15,15 @@ import { Subject, Subscription } from 'rxjs'
|
||||
import { SasStoreService } from '../services/sas-store.service'
|
||||
|
||||
import * as XLSX from '@sheet/crypto'
|
||||
|
||||
/**
|
||||
* Used in combination with buffer
|
||||
*/
|
||||
const iconv = require('iconv-lite')
|
||||
/**
|
||||
* In combination with `iconv` is used for encoding json data captured with sheet js from excel file into a file again
|
||||
* Which will be send to backend
|
||||
*/
|
||||
const Buffer = require('buffer/').Buffer
|
||||
type AOA = any[][]
|
||||
|
||||
@ -30,7 +38,7 @@ import { HotTableInterface } from '../models/HotTable.interface'
|
||||
import {
|
||||
$DataFormats,
|
||||
DSMeta,
|
||||
EditorsGetdataServiceResponse
|
||||
EditorsGetDataServiceResponse
|
||||
} from '../models/sas/editors-getdata.model'
|
||||
import { DataFormat } from '../models/sas/common/DateFormat'
|
||||
import SheetInfo from '../models/SheetInfo'
|
||||
@ -63,6 +71,8 @@ import {
|
||||
} from './utils/renderers.utils'
|
||||
import { isStringDecimal, isStringNumber } from './utils/types.utils'
|
||||
import { LicenceService } from '../services/licence.service'
|
||||
import * as numbro from 'numbro'
|
||||
import * as languages from 'numbro/dist/languages.min'
|
||||
|
||||
@Component({
|
||||
selector: 'app-editor',
|
||||
@ -111,6 +121,7 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
|
||||
datasetInfo: boolean = false
|
||||
dsmeta: DSMeta[] = []
|
||||
dsNote = ''
|
||||
|
||||
viewboxes: boolean = false
|
||||
|
||||
@ -362,12 +373,19 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
private cdf: ChangeDetectorRef,
|
||||
private hotRegisterer: HotTableRegisterer
|
||||
) {
|
||||
const lang = languages[window.navigator.language]
|
||||
if (lang)
|
||||
numbro.default.registerLanguage(languages[window.navigator.language])
|
||||
|
||||
this.hotRegisterer = new HotTableRegisterer()
|
||||
|
||||
this.parseRestrictions()
|
||||
this.setRestrictions()
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare feature restrictions based on licence key
|
||||
*/
|
||||
private parseRestrictions() {
|
||||
this.restrictions.restrictAddRecord =
|
||||
this.licenceState.value.addRecord === false
|
||||
@ -377,6 +395,10 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
this.licenceState.value.fileUpload === false
|
||||
}
|
||||
|
||||
/**
|
||||
* Applying prepared restrictions
|
||||
* @param overrideRestrictions can be used to apply and override specific restrictions
|
||||
*/
|
||||
private setRestrictions(overrideRestrictions?: EditorRestrictions) {
|
||||
if (overrideRestrictions) {
|
||||
this.restrictions = {
|
||||
@ -396,6 +418,9 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disabling add row button based on wether rows limit is present
|
||||
*/
|
||||
private checkRowLimit() {
|
||||
if (this.columnLevelSecurityFlag) return
|
||||
|
||||
@ -410,12 +435,19 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resetting filter variables
|
||||
*/
|
||||
public resetFilter() {
|
||||
if (this.queryFilterCompList.first) {
|
||||
this.queryFilterCompList.first.resetFilter()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Openning file upload modal
|
||||
* If feature is locked, `feature locked` modal will be shown
|
||||
*/
|
||||
public onShowUploadModal() {
|
||||
if (this.restrictions.restrictFileUpload) {
|
||||
this.eventService.showDemoLimitModal('File Upload')
|
||||
@ -433,6 +465,10 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
if (!this.uploadPreview) this.showUploadModal = true
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by FileDropDirective
|
||||
* @param e true if file is dragged over the drop zone
|
||||
*/
|
||||
public fileOverBase(e: boolean): void {
|
||||
this.hasBaseDropZoneOver = e
|
||||
}
|
||||
@ -614,6 +650,10 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
return returnObj
|
||||
}
|
||||
|
||||
/**
|
||||
* When excel is password protected we will display the password promppt for user to type password in.
|
||||
* @returns Password user input or undefined if discarded by user
|
||||
*/
|
||||
public promptExcelPassword(): Promise<string | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.filePasswordModal = true
|
||||
@ -639,6 +679,13 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses attached file, to be uploaded
|
||||
* If attached file is CSV it will be send to backend straight away
|
||||
* If attached file is EXCEL it will be displayed in the table, in preview mode
|
||||
* @param event file drop event
|
||||
* @param dropped whether it's dropped or added by browse button
|
||||
*/
|
||||
public getFileDesc(event: any, dropped: boolean = false) {
|
||||
this.excelUploadState = 'Loading'
|
||||
this.excelFileParsing = true
|
||||
@ -1004,6 +1051,9 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits attached excel file that is in preview mode
|
||||
*/
|
||||
public submitExcel() {
|
||||
if (this.licenceState.value.submit_rows_limit !== Infinity) {
|
||||
this.submitLimitNotice = true
|
||||
@ -1013,12 +1063,25 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
this.getFile()
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will run validations and upload all of the pending files that are in the uploader queue
|
||||
*/
|
||||
public getFile() {
|
||||
if (this.checkInvalid()) {
|
||||
this.eventService.showAbortModal(null, 'Invalid values are present.')
|
||||
return
|
||||
}
|
||||
|
||||
this.validatePrimaryKeys()
|
||||
|
||||
if (this.duplicatePkIndexes.length !== 0) {
|
||||
this.pkDups = true
|
||||
this.submit = false
|
||||
return
|
||||
} else {
|
||||
this.pkDups = false
|
||||
}
|
||||
|
||||
this.uploadLoading = true
|
||||
let filesToUpload: UploadFile[] = []
|
||||
|
||||
@ -1075,6 +1138,9 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* After excel file is attached and parsed, this function will display it's content in the HOT table in read only mode
|
||||
*/
|
||||
public getPendingExcelPreview() {
|
||||
this.queryTextSaved = this.queryText
|
||||
this.queryText = ''
|
||||
@ -1126,46 +1192,12 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
this.excelFileParsing = false
|
||||
this.excelUploadState = null
|
||||
})
|
||||
|
||||
/**
|
||||
* This is half validation feature to speed up file upload
|
||||
* Currently disabled but will leave it here in case it needs to be re-enabled
|
||||
*/
|
||||
// this.excelUploadState = 'Validating-DQ'
|
||||
|
||||
// this.validateRowsOnPendingExcel(
|
||||
// async (rowValidation: RowValidation | undefined) => {
|
||||
// if (rowValidation) {
|
||||
// this.eventService.showAbortModal(
|
||||
// 'Excel validation',
|
||||
// `Please fix the data and re-submit the file. Invalid data details: <br><br> Row: ${rowValidation.rowNumber} <br> Column: ${rowValidation.colName} <br> Reason: <strong>${rowValidation.invalidError}</strong> <br> Invalid value: ${rowValidation.value}`
|
||||
// )
|
||||
|
||||
// this.excelFileParsing = false
|
||||
// this.excelUploadState = null
|
||||
// } else {
|
||||
// this.excelUploadState = 'Validating-HOT'
|
||||
|
||||
// hot.updateSettings(
|
||||
// {
|
||||
// data: this.dataSource
|
||||
// },
|
||||
// false
|
||||
// )
|
||||
// hot.render()
|
||||
|
||||
// hot.validateCells(() => {
|
||||
// this.showUploadModal = false
|
||||
// this.uploadPreview = true
|
||||
|
||||
// this.excelFileParsing = false
|
||||
// this.excelUploadState = null
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops the attached excel file
|
||||
* @param discardData wheter to discard data parsed from the file or to keep it in the table after dropping a attached excel file
|
||||
*/
|
||||
public discardPendingExcel(discardData?: boolean) {
|
||||
this.hotInstance.updateSettings({
|
||||
maxRows: this.licenceState.value.editor_rows_allowed
|
||||
@ -1189,6 +1221,10 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops attached excel file, keeps it's data in the DC table
|
||||
* User can now edit the table and submit. Witout the file present.
|
||||
*/
|
||||
public previewTableEditConfirm() {
|
||||
this.discardPendingExcel()
|
||||
this.convertToCorrectTypes(this.dataSource)
|
||||
@ -2929,7 +2965,7 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
|
||||
await this.sasStoreService
|
||||
.callService(myParams, 'SASControlTable', 'editors/getdata', this.libds)
|
||||
.then((res: EditorsGetdataServiceResponse) => {
|
||||
.then((res: EditorsGetDataServiceResponse) => {
|
||||
this.initSetup(res)
|
||||
})
|
||||
.catch((err: any) => {
|
||||
@ -2941,7 +2977,7 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
|
||||
ngAfterViewInit() {}
|
||||
|
||||
initSetup(response: EditorsGetdataServiceResponse) {
|
||||
initSetup(response: EditorsGetDataServiceResponse) {
|
||||
this.hotInstance = this.hotRegisterer.getInstance('hotInstance')
|
||||
|
||||
if (this.getdataError) return
|
||||
@ -2951,6 +2987,20 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
this.cols = response.data.cols
|
||||
this.dsmeta = response.data.dsmeta
|
||||
|
||||
const notes = this.dsmeta.find((item) => item.NAME === 'NOTES')
|
||||
const longDesc = this.dsmeta.find((item) => item.NAME === 'DD_LONGDESC')
|
||||
const shortDesc = this.dsmeta.find((item) => item.NAME === 'DD_SHORTDESC')
|
||||
|
||||
if (notes && notes.VALUE) {
|
||||
this.dsNote = notes.VALUE
|
||||
} else if (longDesc && longDesc.VALUE) {
|
||||
this.dsNote = longDesc.VALUE
|
||||
} else if (shortDesc && shortDesc.VALUE) {
|
||||
this.dsNote = shortDesc.VALUE
|
||||
} else {
|
||||
this.dsNote = ''
|
||||
}
|
||||
|
||||
const hot: Handsontable = this.hotInstance
|
||||
|
||||
const approvers: Approver[] = response.data.approvers
|
||||
|
@ -1,5 +1,10 @@
|
||||
import { DcValidation } from 'src/app/shared/dc-validator/models/dc-validation.model'
|
||||
|
||||
/**
|
||||
* Wrapper for DC Validation because we need `noLinkOption` property
|
||||
* to be used as a flag to show/hide button that generates link for the
|
||||
* edit record modal
|
||||
*/
|
||||
export interface EditRecordModal extends DcValidation {
|
||||
noLinkOption: boolean
|
||||
[key: string]: any
|
||||
|
@ -1,19 +0,0 @@
|
||||
export interface CellValidation {
|
||||
data: string
|
||||
length: number
|
||||
type?: string
|
||||
source: string[]
|
||||
format?: number
|
||||
validator?: any
|
||||
valid?: boolean
|
||||
renderer?: any
|
||||
dateFormat?: string
|
||||
readOnly?: boolean
|
||||
desc?: string
|
||||
correctFormat?: boolean
|
||||
/**
|
||||
* Key for accessing object fields, any type because it can be
|
||||
* any of the types interface have
|
||||
*/
|
||||
[key: string]: any
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
export enum ColumnType {
|
||||
string = 'string',
|
||||
number = 'number'
|
||||
}
|
||||
|
||||
export interface ColumnInterface {
|
||||
id: number | undefined
|
||||
name: string | undefined
|
||||
type: ColumnType | undefined
|
||||
length: number | undefined
|
||||
}
|
||||
|
||||
export class Column implements ColumnInterface {
|
||||
public id: number | undefined
|
||||
public name: string | undefined
|
||||
public type: ColumnType | undefined
|
||||
public length: number | undefined
|
||||
public static fromPlainObject(obj: object) {
|
||||
return Object.assign(new Column(), obj)
|
||||
}
|
||||
|
||||
constructor(id?: number, name?: string, type?: ColumnType, length?: number) {
|
||||
this.id = id
|
||||
this.name = name
|
||||
this.type = type
|
||||
this.length = length
|
||||
}
|
||||
|
||||
get hsType() {
|
||||
return (
|
||||
(this.type === ColumnType.string && 'text') ||
|
||||
(this.type === ColumnType.number && 'numeric') ||
|
||||
null
|
||||
)
|
||||
}
|
||||
}
|
@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Model for the dynamic cell validation in the editor
|
||||
* (sending whole row to the backend service and recieving data for the cell dropdown)
|
||||
*/
|
||||
export interface DynamicExtendedCellValidation {
|
||||
DISPLAY_INDEX: number
|
||||
DISPLAY_TYPE: string
|
||||
|
@ -1,8 +1,14 @@
|
||||
/**
|
||||
* Edit record modal - input has been focused event
|
||||
*/
|
||||
export interface EditRecordInputFocusedEvent {
|
||||
event: any
|
||||
colName: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit record modal - dropdown has been changed event
|
||||
*/
|
||||
export interface EditRecordDropdownChangeEvent {
|
||||
colName: string
|
||||
col: number
|
||||
|
@ -1,3 +1,6 @@
|
||||
/**
|
||||
* Editor restrictions model (based on the licencing)
|
||||
*/
|
||||
export interface EditorRestrictions {
|
||||
restrictEditRecord?: boolean // Feature is locked but edit/add record buttons are visible so when user clicks he gets the `locked feature modal`
|
||||
restrictAddRecord?: boolean // Same as editRecord, but for addRecord
|
||||
|
@ -1,71 +0,0 @@
|
||||
import { Column, ColumnType } from './models/column'
|
||||
|
||||
export enum TableType {
|
||||
INPUT = 'In',
|
||||
OUTPUT = 'Out'
|
||||
}
|
||||
|
||||
export interface TableInterface {
|
||||
id: number | undefined
|
||||
name: string | undefined
|
||||
data: Array<Object>
|
||||
columns: Array<Column>
|
||||
type: TableType | undefined
|
||||
}
|
||||
|
||||
export class Table implements TableInterface {
|
||||
public id: number | undefined
|
||||
public name: string | undefined
|
||||
public data: Array<any>
|
||||
public columns: Array<Column> = []
|
||||
public type: TableType | undefined
|
||||
|
||||
public static fromPlainObject(obj: any) {
|
||||
obj.columns = obj.columns.map((column: object) => {
|
||||
return Column.fromPlainObject(column)
|
||||
})
|
||||
|
||||
return Object.assign(new Table(), obj)
|
||||
}
|
||||
|
||||
constructor(
|
||||
id?: number,
|
||||
name?: string,
|
||||
type?: TableType,
|
||||
data?: Array<Object>,
|
||||
columns?: Array<Column>
|
||||
) {
|
||||
this.id = id
|
||||
this.name = name
|
||||
this.type = type
|
||||
|
||||
this.data = data || [{}]
|
||||
this.columns = columns || []
|
||||
}
|
||||
|
||||
public getNextColumnId(): number {
|
||||
let highestIdColumn: any = this.columns.sort(
|
||||
(cA: any, cB: any) => cA.id - cB.id
|
||||
)[this.columns.length - 1]
|
||||
return (highestIdColumn && highestIdColumn.id + 1) || 0
|
||||
}
|
||||
|
||||
public addColumn(column: Column) {
|
||||
this.columns.push(column)
|
||||
|
||||
this.data.forEach((row: any) => {
|
||||
if (column.name) {
|
||||
row[column.name] = column.type === ColumnType.string ? '' : null
|
||||
}
|
||||
})
|
||||
|
||||
return column
|
||||
}
|
||||
|
||||
public removeColumn(colInd: any) {
|
||||
this.data.forEach((row) => {
|
||||
delete row[this.columns[colInd].name!]
|
||||
})
|
||||
this.columns.splice(colInd, 1)
|
||||
}
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
/**
|
||||
* Converting date object to the UTC time string
|
||||
*/
|
||||
export const dateToUtcTime = (date: Date) => {
|
||||
let timeStr = ('0' + date.getUTCHours()).slice(-2) + ':'
|
||||
timeStr = timeStr + ('0' + date.getUTCMinutes()).slice(-2) + ':'
|
||||
@ -5,6 +8,9 @@ export const dateToUtcTime = (date: Date) => {
|
||||
return timeStr
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts date object to the time string
|
||||
*/
|
||||
export const dateToTime = (date: Date) => {
|
||||
let timeStr = ('0' + date.getHours()).slice(-2) + ':'
|
||||
timeStr = timeStr + ('0' + date.getMinutes()).slice(-2) + ':'
|
||||
@ -12,6 +18,9 @@ export const dateToTime = (date: Date) => {
|
||||
return timeStr
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts date object to the YYYY-MM-DD
|
||||
*/
|
||||
export const dateFormat = (date: Date) => {
|
||||
return (
|
||||
date.getFullYear() +
|
||||
|
@ -1,9 +1,17 @@
|
||||
import { Col } from 'src/app/shared/dc-validator/models/col.model'
|
||||
|
||||
/**
|
||||
* Converts excel date serial number to JS date
|
||||
*/
|
||||
export const excelDateToJSDate = (serial: number) => {
|
||||
return new Date(Math.round((serial - 25569) * 86400 * 1000))
|
||||
}
|
||||
|
||||
/**
|
||||
* Parsing table columns for the HOT in editor
|
||||
* Converts array of objects into array of strings, every string is column name (key)
|
||||
* @param data array of objects (columns data)
|
||||
*/
|
||||
export const parseTableColumns = (data: Col[]): string[] => {
|
||||
const columns: string[] = []
|
||||
|
||||
@ -16,6 +24,12 @@ export const parseTableColumns = (data: Col[]): string[] => {
|
||||
return columns
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures headers that are not found in the current table but is found in the uploaded file data
|
||||
* @param data
|
||||
* @param headers
|
||||
* @returns string array of missing headers
|
||||
*/
|
||||
export const getMissingHeaders = (data: any, headers: any) => {
|
||||
const missingHeaders: string[] = []
|
||||
const remainingHeaders: string[] = []
|
||||
|
@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Custom renderer for HOT cell
|
||||
* Used to show error icon
|
||||
*/
|
||||
export const errorRenderer = (
|
||||
instance: any,
|
||||
td: any,
|
||||
@ -14,6 +18,10 @@ export const errorRenderer = (
|
||||
return td
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom renderer for HOT cell
|
||||
* Used to revert cell back to original state (no spinner, no error)
|
||||
*/
|
||||
export const noSpinnerRenderer = (
|
||||
instance: any,
|
||||
td: any,
|
||||
@ -28,7 +36,11 @@ export const noSpinnerRenderer = (
|
||||
return td
|
||||
}
|
||||
|
||||
// Spinner shown whilst waiting for SAS to respond
|
||||
/**
|
||||
* Custom renderer for HOT cell
|
||||
* Used to show loading spinner in the cell
|
||||
* (Spinner shown whilst waiting for SAS to respond)
|
||||
*/
|
||||
export const spinnerRenderer = (
|
||||
instance: any,
|
||||
td: any,
|
||||
|
23
client/src/app/home/home-routing.module.ts
Normal file
23
client/src/app/home/home-routing.module.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { NgModule } from '@angular/core'
|
||||
import { RouterModule, Routes } from '@angular/router'
|
||||
import { HomeRouteComponent } from '../routes/home-route/home-route.component'
|
||||
import { HomeComponent } from './home.component'
|
||||
import { XLMapModule } from '../xlmap/xlmap.module'
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: HomeRouteComponent,
|
||||
children: [
|
||||
{ path: '', pathMatch: 'full', redirectTo: 'tables' },
|
||||
{ path: 'tables', component: HomeComponent },
|
||||
{ path: 'files', loadChildren: () => XLMapModule }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class HomeRoutingModule {}
|
@ -100,7 +100,7 @@
|
||||
*clrIfOpen
|
||||
>
|
||||
<span *ngIf="tableLocked">
|
||||
To unlock all tables, contact support@datacontroller.io
|
||||
To unlock all tables, contact support@datacontroller.io
|
||||
</span>
|
||||
</clr-tooltip-content>
|
||||
</clr-tooltip>
|
||||
|
@ -1,15 +1,18 @@
|
||||
import { NgModule } from '@angular/core'
|
||||
import { CommonModule } from '@angular/common'
|
||||
import { HomeComponent } from './home.component'
|
||||
import { ClarityModule } from '@clr/angular'
|
||||
import { NgModule } from '@angular/core'
|
||||
import { FormsModule } from '@angular/forms'
|
||||
import { ClarityModule } from '@clr/angular'
|
||||
import { AppSharedModule } from '../app-shared.module'
|
||||
import { DcTreeModule } from '../shared/dc-tree/dc-tree.module'
|
||||
import { DirectivesModule } from '../directives/directives.module'
|
||||
import { HomeRouteComponent } from '../routes/home-route/home-route.component'
|
||||
import { DcTreeModule } from '../shared/dc-tree/dc-tree.module'
|
||||
import { HomeRoutingModule } from './home-routing.module'
|
||||
import { HomeComponent } from './home.component'
|
||||
|
||||
@NgModule({
|
||||
declarations: [HomeComponent],
|
||||
declarations: [HomeComponent, HomeRouteComponent],
|
||||
imports: [
|
||||
HomeRoutingModule,
|
||||
FormsModule,
|
||||
ClarityModule,
|
||||
AppSharedModule,
|
||||
|
19
client/src/app/licensing/licensing-routing.module.ts
Normal file
19
client/src/app/licensing/licensing-routing.module.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { NgModule } from '@angular/core'
|
||||
import { RouterModule, Routes } from '@angular/router'
|
||||
import { LicensingGuard } from '../routes/licensing.guard'
|
||||
import { LicensingComponent } from './licensing.component'
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: ':action',
|
||||
component: LicensingComponent,
|
||||
canActivate: [LicensingGuard],
|
||||
canDeactivate: [LicensingGuard]
|
||||
}
|
||||
]
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class LicensingRoutingModule {}
|
20
client/src/app/licensing/licensing.module.ts
Normal file
20
client/src/app/licensing/licensing.module.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { NgModule } from '@angular/core'
|
||||
import { CommonModule } from '@angular/common'
|
||||
|
||||
import { LicensingRoutingModule } from './licensing-routing.module'
|
||||
import { ClarityModule } from '@clr/angular'
|
||||
import { SharedModule } from '../shared/shared.module'
|
||||
import { LicensingComponent } from './licensing.component'
|
||||
import { FormsModule } from '@angular/forms'
|
||||
|
||||
@NgModule({
|
||||
declarations: [LicensingComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ClarityModule,
|
||||
LicensingRoutingModule,
|
||||
SharedModule
|
||||
]
|
||||
})
|
||||
export class LicensingModule {}
|
@ -656,8 +656,7 @@ export class LineageComponent {
|
||||
this.flatdata = res.flatdata
|
||||
|
||||
if (this.libraryList) {
|
||||
let libraryToSelect = this.libraryList.find(
|
||||
(library: any) =>
|
||||
let libraryToSelect = this.libraryList.find((library: any) =>
|
||||
res.info[0]?.LIBURI?.toUpperCase()?.includes(
|
||||
library?.LIBRARYID?.toUpperCase()
|
||||
)
|
||||
|
5
client/src/app/models/ErrorBody.ts
Normal file
5
client/src/app/models/ErrorBody.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export interface ErrorBody {
|
||||
message: string
|
||||
details: any
|
||||
raw: any
|
||||
}
|
@ -6,6 +6,7 @@ export interface FilterClause {
|
||||
operators: string[]
|
||||
type: string
|
||||
value: any
|
||||
valueVariable: boolean
|
||||
values: { formatted: string; unformatted: any }[]
|
||||
variable: string
|
||||
}
|
||||
|
@ -4,12 +4,12 @@ import { DQData, SASParam } from '../TableData'
|
||||
import { BaseSASResponse } from './common/BaseSASResponse'
|
||||
import { DataFormat } from './common/DateFormat'
|
||||
|
||||
export interface EditorsGetdataServiceResponse {
|
||||
data: EditorsGetdataSASResponse
|
||||
export interface EditorsGetDataServiceResponse {
|
||||
data: EditorsGetDataSASResponse
|
||||
libds: string
|
||||
}
|
||||
|
||||
export interface EditorsGetdataSASResponse extends BaseSASResponse {
|
||||
export interface EditorsGetDataSASResponse extends BaseSASResponse {
|
||||
$sasdata: $DataFormats
|
||||
sasdata: Sasdata[]
|
||||
sasparams: SASParam[]
|
||||
|
@ -13,6 +13,7 @@
|
||||
[(ngModel)]="usePickers"
|
||||
(change)="usePickersChange()"
|
||||
type="checkbox"
|
||||
id="usePickers"
|
||||
/>
|
||||
<label class="clr-control-label"> Use pickers </label>
|
||||
</clr-checkbox-wrapper>
|
||||
@ -412,7 +413,10 @@
|
||||
>
|
||||
<app-soft-select
|
||||
label="Value"
|
||||
[secondLabel]="'Variable'"
|
||||
[emitOnlySelected]="query.valueVariable"
|
||||
[inputId]="'vals_' + queryIndex + '_' + clauseIndex"
|
||||
(selectedLabelChange)="selectedLabelChange($event, query)"
|
||||
[(value)]="query.value"
|
||||
[enableLoadMore]="query.nobs > query.values.length"
|
||||
(onInputEvent)="
|
||||
@ -422,9 +426,19 @@
|
||||
onAutocompleteLoadingMore($event, query.variable, queryIndex, clauseIndex)
|
||||
"
|
||||
>
|
||||
<div *ngIf="!query.valueVariable">
|
||||
<option [value]="column.unformatted" *ngFor="let column of query.values">
|
||||
{{ column.formatted.trim() }}
|
||||
</option>
|
||||
</div>
|
||||
|
||||
<div *ngIf="query.valueVariable">
|
||||
<ng-container *ngFor="let column of cols">
|
||||
<option [value]="column.NAME" *ngIf="column.TYPE === query.type">
|
||||
{{ column.NAME }}
|
||||
</option>
|
||||
</ng-container>
|
||||
</div>
|
||||
</app-soft-select>
|
||||
</ng-template>
|
||||
|
||||
|
@ -95,6 +95,7 @@ export class QueryComponent
|
||||
variable: null,
|
||||
operator: null,
|
||||
value: null,
|
||||
valueVariable: false,
|
||||
startrow: 0,
|
||||
rows: 0,
|
||||
nobs: 0,
|
||||
@ -137,6 +138,11 @@ export class QueryComponent
|
||||
public whereClause: string | undefined
|
||||
public logicOperators: Array<string> = ['AND', 'OR']
|
||||
|
||||
/**
|
||||
* Temporary values array used in pickers
|
||||
* because they need particular format to work
|
||||
* before sending values to backend, values are parsed
|
||||
*/
|
||||
public queryDateTime: QueryDateTime[] = []
|
||||
|
||||
public currentClauseIndex: number = -1
|
||||
@ -158,6 +164,11 @@ export class QueryComponent
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets and sets temporary values selected with DATETIME or TIME picker
|
||||
* Those values are used for picker to work with format it lieks
|
||||
* Later before sending values to backend, values are parsed
|
||||
*/
|
||||
getQueryDateTime(clauseIndex: number, queryIndex: number): QueryDateTime {
|
||||
let existingQueryDateTime = this.queryDateTime.find(
|
||||
(x) => x.clauseIndex === clauseIndex && x.queryIndex === queryIndex
|
||||
@ -178,10 +189,30 @@ export class QueryComponent
|
||||
return existingQueryDateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* When toggling pickers feature we reset the temp picker values array
|
||||
*/
|
||||
usePickersChange() {
|
||||
this.queryDateTime = []
|
||||
if (this.usePickers) {
|
||||
this.clauses.queryObj.forEach((queryObj: any) => {
|
||||
queryObj.elements.forEach((element: any) => {
|
||||
const isDateOrTime = ['DATETIME', 'TIME', 'DATE'].includes(
|
||||
element.ddtype
|
||||
)
|
||||
|
||||
if (isDateOrTime && element.valueVariable) {
|
||||
element.value = ''
|
||||
element.valueVariable = false
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets all variables used for filtering
|
||||
*/
|
||||
public resetFilter() {
|
||||
this.whereString = undefined
|
||||
this.whereClause = undefined
|
||||
@ -210,6 +241,10 @@ export class QueryComponent
|
||||
this.whereClauseFn(true)
|
||||
}
|
||||
|
||||
/**
|
||||
* `Globals` are used to store filtering state (variables) as a caching feature
|
||||
* until browser reloads
|
||||
*/
|
||||
public setToGlobals() {
|
||||
if (!this.caching) return
|
||||
|
||||
@ -233,10 +268,12 @@ export class QueryComponent
|
||||
get(globals, objPath).filter.libds = this.libds
|
||||
}
|
||||
get(globals, objPath).filter.clauses = this.clauses
|
||||
|
||||
console.log('globals', globals)
|
||||
}
|
||||
|
||||
/**
|
||||
* `Globals` are used to store filtering state (variables) as a caching feature
|
||||
* until browser reloads
|
||||
*/
|
||||
public getFromGlobals() {
|
||||
if (!this.caching) return
|
||||
|
||||
@ -269,6 +306,11 @@ export class QueryComponent
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets filtering multiple caluses group logic (and / or)
|
||||
*
|
||||
* @param groupLogic to set
|
||||
*/
|
||||
public setGroupLogic(groupLogic: any) {
|
||||
this.groupLogic = groupLogic
|
||||
this.clauses.groupLogic = groupLogic
|
||||
@ -721,6 +763,12 @@ export class QueryComponent
|
||||
)
|
||||
}
|
||||
|
||||
public selectedLabelChange(label: string, query: any) {
|
||||
query.valueVariable = label === 'Variable'
|
||||
query.value = ''
|
||||
this.whereClauseFn()
|
||||
}
|
||||
|
||||
public variableInputChange(
|
||||
queryVariable: any,
|
||||
index: number,
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { SasStoreService } from '../services/sas-store.service'
|
||||
import { SasStoreService } from '../../services/sas-store.service'
|
||||
import { Component, AfterViewInit, OnDestroy } from '@angular/core'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { Router } from '@angular/router'
|
||||
import { EventService } from '../services/event.service'
|
||||
import { EventService } from '../../services/event.service'
|
||||
import {
|
||||
AuditorsPostdataSASResponse,
|
||||
Param
|
||||
} from '../models/sas/auditors-postdata.model'
|
||||
} from '../../models/sas/auditors-postdata.model'
|
||||
|
||||
interface ChangesObj {
|
||||
ind: any
|
||||
@ -89,7 +89,7 @@ export class ApproveDetailsComponent implements AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
public goToApprovalsList() {
|
||||
this.route.navigateByUrl('/approve')
|
||||
this.route.navigateByUrl('/review/approve')
|
||||
}
|
||||
|
||||
public getTable(tableId: any) {
|
||||
@ -136,7 +136,7 @@ export class ApproveDetailsComponent implements AfterViewInit, OnDestroy {
|
||||
await this.sasStoreService
|
||||
.rejecting(rejParams, 'BrowserParams', 'approvers/rejection')
|
||||
.then((res: any) => {
|
||||
this.route.navigateByUrl('/history')
|
||||
this.route.navigateByUrl('/review/history')
|
||||
})
|
||||
.catch((err: any) => {
|
||||
this.acceptLoading = false
|
||||
@ -156,7 +156,7 @@ export class ApproveDetailsComponent implements AfterViewInit, OnDestroy {
|
||||
await this.sasStoreService
|
||||
.approveTable(approveParams, 'SASControlTable', 'auditors/postdata')
|
||||
.then((res: any) => {
|
||||
this.route.navigateByUrl('/history')
|
||||
this.route.navigateByUrl('/review/history')
|
||||
})
|
||||
.catch((err: any) => {
|
||||
this.acceptLoading = false
|
||||
@ -164,7 +164,7 @@ export class ApproveDetailsComponent implements AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
public goToSubmitList() {
|
||||
this.route.navigateByUrl('/submitted')
|
||||
this.route.navigateByUrl('/review/submitted')
|
||||
}
|
||||
|
||||
public async callChangesInfo(tableId: any) {
|
@ -1,8 +1,8 @@
|
||||
import { Component, OnInit, ChangeDetectorRef } from '@angular/core'
|
||||
import { SasStoreService } from '../services/sas-store.service'
|
||||
import { SasStoreService } from '../../services/sas-store.service'
|
||||
import { Router } from '@angular/router'
|
||||
import { SasService } from '../services/sas.service'
|
||||
import { EventService } from '../services/event.service'
|
||||
import { SasService } from '../../services/sas.service'
|
||||
import { EventService } from '../../services/event.service'
|
||||
|
||||
interface ApproveData {
|
||||
tableId: string
|
||||
@ -45,7 +45,7 @@ export class ApproveComponent implements OnInit {
|
||||
if (this.approveList !== undefined) {
|
||||
this.tableId = this.approveList[ind].tableId
|
||||
this.route.navigateByUrl(
|
||||
'approve/approveDet/' + this.approveList[ind].tableId
|
||||
'review/approveDet/' + this.approveList[ind].tableId
|
||||
)
|
||||
}
|
||||
}
|
@ -72,7 +72,7 @@
|
||||
>
|
||||
To unlock more than
|
||||
{{ licenceState.value.history_rows_allowed }} records, contact
|
||||
support@datacontroller.io
|
||||
support@datacontroller.io
|
||||
</p>
|
||||
</div>
|
||||
|
@ -1,11 +1,13 @@
|
||||
import { Component, OnInit } from '@angular/core'
|
||||
|
||||
import { SasStoreService } from '../services/sas-store.service'
|
||||
import { Router } from '@angular/router'
|
||||
import { SasService } from '../services/sas.service'
|
||||
import { EventService } from '../services/event.service'
|
||||
import { SASjsConfig } from '@sasjs/adapter'
|
||||
import { LicenceService } from '../services/licence.service'
|
||||
import {
|
||||
LicenceService,
|
||||
SasStoreService,
|
||||
EventService,
|
||||
SasService
|
||||
} from 'src/app/services'
|
||||
|
||||
@Component({
|
||||
selector: 'app-history',
|
22
client/src/app/review/review-routing.module.ts
Normal file
22
client/src/app/review/review-routing.module.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { CommonModule } from '@angular/common'
|
||||
import { NgModule } from '@angular/core'
|
||||
import { RouterModule, Routes } from '@angular/router'
|
||||
import { ApproveDetailsComponent } from './approve-details/approve-details.component'
|
||||
import { ApproveComponent } from './approve/approve.component'
|
||||
import { SubmitterComponent } from './submitter/submitter.component'
|
||||
import { HistoryComponent } from './history/history.component'
|
||||
|
||||
const ROUTES: Routes = [
|
||||
{ path: 'approve', component: ApproveComponent },
|
||||
{ path: 'approveDet/:tableId', component: ApproveDetailsComponent },
|
||||
{ path: 'submitted', component: SubmitterComponent },
|
||||
{ path: 'submitted/:tableId', component: SubmitterComponent },
|
||||
{ path: 'history', component: HistoryComponent }
|
||||
]
|
||||
|
||||
@NgModule({
|
||||
declarations: [],
|
||||
imports: [CommonModule, RouterModule.forChild(ROUTES)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class ReviewRoutingModule {}
|
31
client/src/app/review/review.module.ts
Normal file
31
client/src/app/review/review.module.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import { CommonModule } from '@angular/common'
|
||||
import { NgModule } from '@angular/core'
|
||||
import { FormsModule } from '@angular/forms'
|
||||
import { ClarityModule } from '@clr/angular'
|
||||
import { HotTableModule } from '@handsontable/angular'
|
||||
import { DirectivesModule } from '../directives/directives.module'
|
||||
import { SharedModule } from '../shared/shared.module'
|
||||
import { ApproveDetailsComponent } from './approve-details/approve-details.component'
|
||||
import { ApproveComponent } from './approve/approve.component'
|
||||
import { ReviewRoutingModule } from './review-routing.module'
|
||||
import { SubmitterComponent } from './submitter/submitter.component'
|
||||
import { HistoryComponent } from './history/history.component'
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
ApproveComponent,
|
||||
ApproveDetailsComponent,
|
||||
SubmitterComponent,
|
||||
HistoryComponent
|
||||
],
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ReviewRoutingModule,
|
||||
ClarityModule,
|
||||
HotTableModule.forRoot(),
|
||||
DirectivesModule,
|
||||
SharedModule
|
||||
]
|
||||
})
|
||||
export class ReviewModule {}
|
@ -1,9 +1,7 @@
|
||||
import { Component, AfterViewInit, OnInit } from '@angular/core'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { SasStoreService } from '../services/sas-store.service'
|
||||
import { ActivatedRoute, Router } from '@angular/router'
|
||||
import { SasService } from '../services/sas.service'
|
||||
import { EventService } from '../services/event.service'
|
||||
import { SasStoreService, EventService, SasService } from '../../services'
|
||||
|
||||
interface SubmitterData {
|
||||
tableId: string
|
||||
@ -46,7 +44,7 @@ export class SubmitterComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
public goToDetails(table_id: any) {
|
||||
this.router.navigateByUrl('/submitted/' + table_id)
|
||||
this.router.navigateByUrl('/review/submitted/' + table_id)
|
||||
}
|
||||
|
||||
public getDetails(sub: any, index: any) {
|
@ -1,15 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core'
|
||||
|
||||
@Component({
|
||||
selector: 'app-approve-route',
|
||||
templateUrl: './approve-route.component.html',
|
||||
styleUrls: ['./approve-route.component.scss'],
|
||||
host: {
|
||||
class: 'content-container'
|
||||
}
|
||||
})
|
||||
export class ApproveRouteComponent implements OnInit {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core'
|
||||
|
||||
@Component({
|
||||
selector: 'app-edit-route',
|
||||
templateUrl: './edit-route.component.html',
|
||||
styleUrls: ['./edit-route.component.scss']
|
||||
})
|
||||
export class EditRouteComponent implements OnInit {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core'
|
||||
|
||||
@Component({
|
||||
selector: 'app-history-route',
|
||||
templateUrl: './history-route.component.html',
|
||||
styleUrls: ['./history-route.component.scss']
|
||||
})
|
||||
export class HistoryRouteComponent implements OnInit {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {}
|
||||
}
|
17
client/src/app/routes/home-route/home-route.component.ts
Normal file
17
client/src/app/routes/home-route/home-route.component.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core'
|
||||
|
||||
@Component({
|
||||
selector: 'app-home-route',
|
||||
templateUrl: './home-route.component.html',
|
||||
styleUrls: ['./home-route.component.scss'],
|
||||
host: {
|
||||
class: 'content-container'
|
||||
}
|
||||
})
|
||||
export class HomeRouteComponent implements OnInit, OnDestroy {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
ngOnDestroy() {}
|
||||
}
|
15
client/src/app/routes/review-route/review-route.component.ts
Normal file
15
client/src/app/routes/review-route/review-route.component.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core'
|
||||
|
||||
@Component({
|
||||
selector: 'app-review-route',
|
||||
templateUrl: './review-route.component.html',
|
||||
styleUrls: ['./review-route.component.scss'],
|
||||
host: {
|
||||
class: 'content-container'
|
||||
}
|
||||
})
|
||||
export class ReviewRouteComponent implements OnInit {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {}
|
||||
}
|
17
client/src/app/routes/xlmap-route/xlmap-route.component.ts
Normal file
17
client/src/app/routes/xlmap-route/xlmap-route.component.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core'
|
||||
|
||||
@Component({
|
||||
selector: 'app-xlmap-route',
|
||||
templateUrl: './xlmap-route.component.html',
|
||||
styleUrls: ['./xlmap-route.component.scss'],
|
||||
host: {
|
||||
class: 'content-container'
|
||||
}
|
||||
})
|
||||
export class XLMapRouteComponent implements OnInit, OnDestroy {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
ngOnDestroy() {}
|
||||
}
|
@ -74,6 +74,7 @@ export class AppService {
|
||||
missingProps.push('Globvars')
|
||||
if (!res.sasdatasets) missingProps.push('Sasdatasets')
|
||||
if (!res.saslibs) missingProps.push('Saslibs')
|
||||
if (!res.xlmaps) missingProps.push('XLMaps')
|
||||
|
||||
if (missingProps.length > 0) {
|
||||
startupServiceError = true
|
||||
@ -135,10 +136,17 @@ export class AppService {
|
||||
globals.editor.libsAndTables = libsAndTables
|
||||
}
|
||||
|
||||
globals.xlmaps = res.xlmaps.map((xlmap: any) => ({
|
||||
id: xlmap[0],
|
||||
description: xlmap[1],
|
||||
targetDS: xlmap[2]
|
||||
}))
|
||||
globals.editor.treeNodeLibraries = treeNodeLibraries
|
||||
globals.editor.libraries = libraries
|
||||
globals.editor.startupSet = true
|
||||
|
||||
globals.dcLib = res.globvars[0].DCLIB
|
||||
|
||||
await this.licenceService.activation(res)
|
||||
})
|
||||
.catch((err: any) => {
|
||||
|
@ -17,6 +17,17 @@ export class HelperService {
|
||||
console.log('Is IE or Edge?', this.isMicrosoft)
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a JavaScript date object to a SAS Date or Datetime, given the logic below:
|
||||
*
|
||||
* A JS Date contains the number of _milliseconds_ since 01/01/1970
|
||||
* A SAS Date contains the number of _days_ since 01/01/1960
|
||||
* A SAS Datetime contains the number of _seconds_ since 01/01/1960
|
||||
*
|
||||
* @param jsDate JS Date to be converted. The type is instance of `Date`
|
||||
* @param unit Unit in which to return the SAS Date / datetime, eg `sasdate | sasdatetime`
|
||||
* @returns SAS Date value based on `unit` param
|
||||
*/
|
||||
public convertJsDateToSasDate(
|
||||
jsDate: string | Date,
|
||||
unit: string = 'days'
|
||||
@ -63,6 +74,17 @@ export class HelperService {
|
||||
return 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a SAS Date or Datetime to a JavaScript date object, given the logic below:
|
||||
*
|
||||
* A JS Date contains the number of _milliseconds_ since 01/01/1970
|
||||
* A SAS Date contains the number of _days_ since 01/01/1960
|
||||
* A SAS Datetime contains the number of _seconds_ since 01/01/1960
|
||||
*
|
||||
* @param sasValue SAS Date or Datetime to be converted. The type could be `number` or `string.
|
||||
* @param unit Unit from which to convert the SAS Date / Datetime, eg `sasdate | sasdatetime`
|
||||
* @returns JavaScript Date object
|
||||
*/
|
||||
public convertSasDaysToJsDate(
|
||||
sasValue: number | string,
|
||||
unit: string = 'days'
|
||||
@ -87,6 +109,11 @@ export class HelperService {
|
||||
return new Date(msNegativeTenYears + sasValue * msInDay)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param array all elements in the clarity tree
|
||||
* @param arrToFilter sub array in the tree to be filtered for example `tables`
|
||||
*/
|
||||
public treeOnFilter(array: any, arrToFilter: string) {
|
||||
let search = array['searchString'] ? array['searchString'] : ''
|
||||
let arrToFilterArray = arrToFilter.split('.')[0]
|
||||
|
@ -10,8 +10,8 @@ import { globals } from '../_globals'
|
||||
import { FilterClause, FilterGroup, FilterQuery } from '../models/FilterQuery'
|
||||
import {
|
||||
$DataFormats,
|
||||
EditorsGetdataSASResponse,
|
||||
EditorsGetdataServiceResponse
|
||||
EditorsGetDataSASResponse,
|
||||
EditorsGetDataServiceResponse
|
||||
} from '../models/sas/editors-getdata.model'
|
||||
import { LoggerService } from './logger.service'
|
||||
import { isSpecialMissing } from '@sasjs/utils/input/validators'
|
||||
@ -40,6 +40,16 @@ export class SasStoreService {
|
||||
private loggerService: LoggerService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Wrapper for making request to service
|
||||
* Should be removed, as it's redundant now
|
||||
* TODO: Refactor to call editors/getdata directly
|
||||
* @param tableData
|
||||
* @param tableName
|
||||
* @param program
|
||||
* @param libds
|
||||
* @returns
|
||||
*/
|
||||
public async callService(
|
||||
tableData: Array<any>,
|
||||
tableName: string,
|
||||
@ -47,19 +57,28 @@ export class SasStoreService {
|
||||
libds: string
|
||||
) {
|
||||
this.libds = libds
|
||||
let tables: any = {}
|
||||
const tables: any = {}
|
||||
tables[tableName] = [tableData]
|
||||
let res: EditorsGetdataSASResponse = await this.sasService.request(
|
||||
const res: EditorsGetDataSASResponse = await this.sasService.request(
|
||||
program,
|
||||
tables
|
||||
)
|
||||
let response: EditorsGetdataServiceResponse = {
|
||||
const response: EditorsGetDataServiceResponse = {
|
||||
data: res,
|
||||
libds: this.libds
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
/**
|
||||
* Calling editors/stagedata - saving table data, sending request to backend
|
||||
* @param tableParams params to send to backend
|
||||
* @param tableData data to be updated
|
||||
* @param tableName name of the table to be updated
|
||||
* @param program service against which we send request
|
||||
* @param $dataFormats column data formats recieved from backend, sending it back
|
||||
* @returns adapter.request() response
|
||||
*/
|
||||
public async updateTable(
|
||||
tableParams: any,
|
||||
tableData: any,
|
||||
@ -86,6 +105,13 @@ export class SasStoreService {
|
||||
return res
|
||||
}
|
||||
|
||||
/**
|
||||
* Sending request to 'approvers/getapprovals' to fetch approvals list
|
||||
* @param tableData sending to backend table data
|
||||
* @param tableName sending to backend table name
|
||||
* @param program service to run request on
|
||||
* @returns HTTP Response
|
||||
*/
|
||||
public async getApprovals(
|
||||
tableData: any,
|
||||
tableName: string,
|
||||
@ -96,6 +122,13 @@ export class SasStoreService {
|
||||
let res: any = await this.sasService.request(program, tables)
|
||||
return res
|
||||
}
|
||||
|
||||
/**
|
||||
* Interceptor for loading of the submitted details
|
||||
* @param detail submitter
|
||||
* @param index submitter index
|
||||
* @param data submit data
|
||||
*/
|
||||
public async sendDetails(detail: any, index: any, data: any) {
|
||||
let details = Object.assign({ sub: true }, detail)
|
||||
let subData = data[index]
|
||||
@ -105,11 +138,20 @@ export class SasStoreService {
|
||||
}
|
||||
this.submittDetail.next(allData)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns All submits
|
||||
*/
|
||||
public async getSubmitts() {
|
||||
let res: any = await this.sasService.request('editors/getsubmits', null)
|
||||
return res
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns All libraries
|
||||
*/
|
||||
public async viewLibs() {
|
||||
return this.sasService.request('public/viewlibs', null)
|
||||
}
|
||||
@ -167,6 +209,14 @@ export class SasStoreService {
|
||||
return res
|
||||
}
|
||||
|
||||
public async getXLMapRules(id: string) {
|
||||
const tables = {
|
||||
getxlmaps_in: [{ XLMAP_ID: id }]
|
||||
}
|
||||
const res: any = await this.sasService.request('editors/getxlmaps', tables)
|
||||
return res
|
||||
}
|
||||
|
||||
public async getDetails(tableData: any, tableName: string, program: string) {
|
||||
let tables: any = {}
|
||||
tables[tableName] = [tableData]
|
||||
@ -366,14 +416,18 @@ export class SasStoreService {
|
||||
for (let index = 0; index < clauses.queryObj.length; index++) {
|
||||
let string = ''
|
||||
let clause = clauses.queryObj[index]
|
||||
|
||||
for (let ind = 0; ind < clause.elements.length; ind++) {
|
||||
let query = clause.elements[ind]
|
||||
|
||||
if (ind < clause.elements.length - 1) {
|
||||
opr = clause.clauseLogic
|
||||
} else {
|
||||
opr = ''
|
||||
}
|
||||
|
||||
let val: any
|
||||
|
||||
for (let k = 0; k < query.values.length; k++) {
|
||||
if (
|
||||
typeof query.value === 'string' &&
|
||||
@ -444,6 +498,8 @@ export class SasStoreService {
|
||||
}
|
||||
|
||||
let type = query.type
|
||||
//if the value is variable, omit quotes in the 'where' string
|
||||
const isValueVariable = query.valueVariable
|
||||
let variable = query.variable === null ? '' : query.variable
|
||||
let oper = query.operator === null ? '' : query.operator
|
||||
// let value = val === null ? "''" : val;
|
||||
@ -457,10 +513,14 @@ export class SasStoreService {
|
||||
if (type === 'char' && oper !== 'IN' && oper !== 'NOT IN') {
|
||||
if (typeof value === 'undefined') {
|
||||
value = ''
|
||||
value = " '" + value + "' "
|
||||
} else {
|
||||
value = " '" + value + "' "
|
||||
}
|
||||
|
||||
if (isValueVariable) {
|
||||
value = ' ' + value + ' ' //without quotes, with spaces
|
||||
} else {
|
||||
value = " '" + value + "' " //with quotes and spaces
|
||||
}
|
||||
|
||||
string = string + ' ' + variable + ' ' + oper + value + opr
|
||||
} else {
|
||||
if (type === 'num' && typeof value === 'undefined') {
|
||||
@ -554,7 +614,7 @@ export class SasStoreService {
|
||||
rawValue = '.'
|
||||
}
|
||||
} else {
|
||||
if (filterClause.type === 'char') {
|
||||
if (filterClause.type === 'char' && !filterClause.valueVariable) {
|
||||
rawValue = `'${filterClause.value.replace(/'/g, "''")}'`
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import { DcAdapterSettings } from '../models/DcAdapterSettings'
|
||||
import { AppStoreService } from './app-store.service'
|
||||
import { LoggerService } from './logger.service'
|
||||
import { RequestWrapperOptions } from '../models/RequestWrapperOptions'
|
||||
import { ErrorBody } from '../models/ErrorBody'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@ -39,6 +40,11 @@ export class SasService {
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Same as `setup` function in the sasjs.service, this is the constructor replacement.
|
||||
* This function is being called by `app.service`.
|
||||
* Because of timing and dependency issues
|
||||
*/
|
||||
public sasServiceInit() {
|
||||
this.dcAdapterSettings = this.appStoreService.getDcAdapterSettings()
|
||||
|
||||
@ -80,6 +86,16 @@ export class SasService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Runing a backend request against a service.
|
||||
* Function also handles the displaying of success or error modals.
|
||||
*
|
||||
* @param url service to run reuqest against
|
||||
* @param data to be sent to backend service
|
||||
* @param config additional parameters to force eg. { debug: false }
|
||||
* @param wrapperOptions used to suppress error or success abort modals after request is finished
|
||||
* @returns
|
||||
*/
|
||||
public request(
|
||||
url: string,
|
||||
data: any,
|
||||
@ -197,6 +213,14 @@ export class SasService {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploads a file to the backend, using the adapter upload function.
|
||||
*
|
||||
* @param sasService Service to which the file will be sent
|
||||
* @param files Files to be sent
|
||||
* @param params Aditional parameters eg. { debug: false }
|
||||
* @returns HTTP Response
|
||||
*/
|
||||
public uploadFile(sasService: string, files: UploadFile[], params: any) {
|
||||
return this.sasjsAdapter.uploadFile(sasService, files, params)
|
||||
}
|
||||
@ -487,9 +511,3 @@ export class SasService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface ErrorBody {
|
||||
message: string
|
||||
details: any
|
||||
raw: any
|
||||
}
|
||||
|
@ -25,6 +25,12 @@ export class SasjsService {
|
||||
private appStoreService: AppStoreService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* This function is replacing the constructor.
|
||||
* The reason for this is timing issues, other services eg. sas.service, app-store.service
|
||||
* must be initialized before this bit of code is executed.
|
||||
* This function is being called by `sas.service`
|
||||
*/
|
||||
setup() {
|
||||
const adapterConfig = this.appStoreService.getDcAdapterSettings()
|
||||
|
||||
@ -32,10 +38,18 @@ export class SasjsService {
|
||||
this.driveUrl = `${this.url}/drive`
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns Sasjs/server information
|
||||
*/
|
||||
getServerInfo(): Observable<SASjsApiServerInfo> {
|
||||
return this.http.get<SASjsApiServerInfo>(`${this.url}/info`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets file contents on a given path
|
||||
* @param filePath path to the file
|
||||
*/
|
||||
getFileFromDrive(filePath: string) {
|
||||
return this.http.get(
|
||||
`${this.driveUrl}/file/?_filePath=${filePath}`,
|
||||
@ -43,6 +57,11 @@ export class SasjsService {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets folder contents on a given path
|
||||
* @param folderPath path to the folder
|
||||
* @returns
|
||||
*/
|
||||
getFolderContentsFromDrive(
|
||||
folderPath: string
|
||||
): Observable<SASjsApiDriveFolderContents> {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user