From a9353fad00a64c6ef928561de1b9531bc0779e54 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Tue, 15 Sep 2020 15:52:30 +0100 Subject: [PATCH] Merge upstream (#468) * Ensure filename/no filename text in connect by file dialog is aligned (#4474) - needs porting back * Add typed entity access and `custom-src` removal to change log (#4496) * Fixes #4335: Create Stratos static web site with better documentation (#4446) * Fixes #4335: Create Stratos static web site with better documentation structure using docusaurus. Initial commit. * 1) Re-organize some more existing doc files. 2) Re-organize links in the doc file to refer to the new document hierarchy. * Landing Page WIP * Documentation tweaks * Use better action names * More visual improvements to landing page * More doc and landing page improvements * Remove publish workflow for now * Typo fix * Moer documentation improvements * Remove extra title from helm doc * Fix script when used from npm * Improve layout on mobile devices * More documentation improvements * Fix typo * Merge downstream (#4441) * Merge src/frontend from downstream * Merge src/jetstream from jetstream * Remove examples/custom-src * Merge deploy from downstream Does not include changes to - deploy/all-in-one/* - deploy/aio-entrypoint.sh - deploy/Dockerfile.all-in-one * Merge build from downstream * Add missing merge items from deploy * Updates to package-lock * Remove fdescribe * Fix e2e core tests * Remove favicon from packages/core/src * Changes following review * Show all favorites for an endpoint favorite if there is only one (#4440) * Show all favorites for the endpoint favorite if there is only one * Missing changes * Merge downstream - JSON Viewer with dark mode & Header Fixes (#4444) * Fix json-viewer dark mode * Fix profile page and side nav top position following header diet - Fix side nav top position - Update fix for profile page to also work in non-desktop mode * Fix issues with tests not running if build upload fails (#4453) * Fix issues with tests not running if build upload fails * Fix script * One more fix for script * Fix white space at start of file * Improve autoscaler e2e logging (#4456) * Improve autoscaler e2e logging - it looks like the AS returns scaling events 1-2 mins after they occur, which is too late for the test - add additional logging to print out event table data in case of alternative events being raised - fix logging if wait for events times out - add hint in later test that depends on AS scaling event * Ensure only the schedule rule results in scaling events * Fix check-e2e-pr.sh for pr's from other repos (#4459) - switch from TRAVIS_PULL_REQUEST_SLUG to TRAVIS_REPO_SLUG * Convert Client Secret Input Fields to `password` (#4455) * Insecure tlsv10 and tlsv11 ciphers in Stratos UI, bsc#1173295 (#411) (#4460) Co-authored-by: Michal Jura * [Security] Bump codecov from 3.7.0 to 3.7.1 (#4457) Bumps [codecov](https://github.com/codecov/codecov-node) from 3.7.0 to 3.7.1. **This update includes a security fix.** - [Release notes](https://github.com/codecov/codecov-node/releases) - [Commits](https://github.com/codecov/codecov-node/compare/v3.7.0...v3.7.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> * Bump lodash from 4.17.15 to 4.17.19 (#4452) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Website update: Wed 22 Jul 2020 21:55:00 BST * Website update: Wed 22 Jul 2020 21:56:45 BST * Website update: Wed 22 Jul 2020 21:58:22 BST * Remove dist * FIx deploy script to remove old files * Moer tidy ups * Add CNAME file when publishing * Add talks doc * * Fix broken links due to reorganization of documents * Move Troubleshooting content from cloud-foundry deployment doc to cf-troubleshooting * * Fix Getting Started broken link in page footer * Only publish if there are website changes * Remove old doc * Publish website on merge * * Review comments fix * Fix broken link to an image in frontend extensions doc * Final tweaks Co-authored-by: Neil MacDougall Co-authored-by: Neil MacDougall Co-authored-by: Richard Cox Co-authored-by: Neil MacDougall Co-authored-by: Michal Jura Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Richard Cox * Fix and update customization docs (#4478) * Fixes #4335: Create Stratos static web site with better documentation structure using docusaurus. Initial commit. * 1) Re-organize some more existing doc files. 2) Re-organize links in the doc file to refer to the new document hierarchy. * Landing Page WIP * Documentation tweaks * Use better action names * More visual improvements to landing page * More doc and landing page improvements * Remove publish workflow for now * Typo fix * Moer documentation improvements * Remove extra title from helm doc * Fix script when used from npm * Improve layout on mobile devices * More documentation improvements * Fix typo * Merge downstream (#4441) * Merge src/frontend from downstream * Merge src/jetstream from jetstream * Remove examples/custom-src * Merge deploy from downstream Does not include changes to - deploy/all-in-one/* - deploy/aio-entrypoint.sh - deploy/Dockerfile.all-in-one * Merge build from downstream * Add missing merge items from deploy * Updates to package-lock * Remove fdescribe * Fix e2e core tests * Remove favicon from packages/core/src * Changes following review * Show all favorites for an endpoint favorite if there is only one (#4440) * Show all favorites for the endpoint favorite if there is only one * Missing changes * Merge downstream - JSON Viewer with dark mode & Header Fixes (#4444) * Fix json-viewer dark mode * Fix profile page and side nav top position following header diet - Fix side nav top position - Update fix for profile page to also work in non-desktop mode * Fix issues with tests not running if build upload fails (#4453) * Fix issues with tests not running if build upload fails * Fix script * One more fix for script * Fix white space at start of file * Improve autoscaler e2e logging (#4456) * Improve autoscaler e2e logging - it looks like the AS returns scaling events 1-2 mins after they occur, which is too late for the test - add additional logging to print out event table data in case of alternative events being raised - fix logging if wait for events times out - add hint in later test that depends on AS scaling event * Ensure only the schedule rule results in scaling events * Fix check-e2e-pr.sh for pr's from other repos (#4459) - switch from TRAVIS_PULL_REQUEST_SLUG to TRAVIS_REPO_SLUG * Convert Client Secret Input Fields to `password` (#4455) * Insecure tlsv10 and tlsv11 ciphers in Stratos UI, bsc#1173295 (#411) (#4460) Co-authored-by: Michal Jura * [Security] Bump codecov from 3.7.0 to 3.7.1 (#4457) Bumps [codecov](https://github.com/codecov/codecov-node) from 3.7.0 to 3.7.1. **This update includes a security fix.** - [Release notes](https://github.com/codecov/codecov-node/releases) - [Commits](https://github.com/codecov/codecov-node/compare/v3.7.0...v3.7.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> * Bump lodash from 4.17.15 to 4.17.19 (#4452) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Website update: Wed 22 Jul 2020 21:55:00 BST * Website update: Wed 22 Jul 2020 21:56:45 BST * Website update: Wed 22 Jul 2020 21:58:22 BST * Remove dist * FIx deploy script to remove old files * Moer tidy ups * Add CNAME file when publishing * Add talks doc * * Fix broken links due to reorganization of documents * Move Troubleshooting content from cloud-foundry deployment doc to cf-troubleshooting * * Fix Getting Started broken link in page footer * Only publish if there are website changes * Remove old doc * Publish website on merge * Apply new theming process to acme example * First pass at customization docs, most of themeing done * Final pass at customization docs * Merge fixes Co-authored-by: Veerapuram Varadhan Co-authored-by: Neil MacDougall Co-authored-by: Neil MacDougall Co-authored-by: Neil MacDougall Co-authored-by: Michal Jura Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update base README, point to website (#4488) * Fixes #4335: Create Stratos static web site with better documentation structure using docusaurus. Initial commit. * 1) Re-organize some more existing doc files. 2) Re-organize links in the doc file to refer to the new document hierarchy. * Landing Page WIP * Documentation tweaks * Use better action names * More visual improvements to landing page * More doc and landing page improvements * Remove publish workflow for now * Typo fix * Moer documentation improvements * Remove extra title from helm doc * Fix script when used from npm * Improve layout on mobile devices * More documentation improvements * Fix typo * Merge downstream (#4441) * Merge src/frontend from downstream * Merge src/jetstream from jetstream * Remove examples/custom-src * Merge deploy from downstream Does not include changes to - deploy/all-in-one/* - deploy/aio-entrypoint.sh - deploy/Dockerfile.all-in-one * Merge build from downstream * Add missing merge items from deploy * Updates to package-lock * Remove fdescribe * Fix e2e core tests * Remove favicon from packages/core/src * Changes following review * Show all favorites for an endpoint favorite if there is only one (#4440) * Show all favorites for the endpoint favorite if there is only one * Missing changes * Merge downstream - JSON Viewer with dark mode & Header Fixes (#4444) * Fix json-viewer dark mode * Fix profile page and side nav top position following header diet - Fix side nav top position - Update fix for profile page to also work in non-desktop mode * Fix issues with tests not running if build upload fails (#4453) * Fix issues with tests not running if build upload fails * Fix script * One more fix for script * Fix white space at start of file * Improve autoscaler e2e logging (#4456) * Improve autoscaler e2e logging - it looks like the AS returns scaling events 1-2 mins after they occur, which is too late for the test - add additional logging to print out event table data in case of alternative events being raised - fix logging if wait for events times out - add hint in later test that depends on AS scaling event * Ensure only the schedule rule results in scaling events * Fix check-e2e-pr.sh for pr's from other repos (#4459) - switch from TRAVIS_PULL_REQUEST_SLUG to TRAVIS_REPO_SLUG * Convert Client Secret Input Fields to `password` (#4455) * Insecure tlsv10 and tlsv11 ciphers in Stratos UI, bsc#1173295 (#411) (#4460) Co-authored-by: Michal Jura * [Security] Bump codecov from 3.7.0 to 3.7.1 (#4457) Bumps [codecov](https://github.com/codecov/codecov-node) from 3.7.0 to 3.7.1. **This update includes a security fix.** - [Release notes](https://github.com/codecov/codecov-node/releases) - [Commits](https://github.com/codecov/codecov-node/compare/v3.7.0...v3.7.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> * Bump lodash from 4.17.15 to 4.17.19 (#4452) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Website update: Wed 22 Jul 2020 21:55:00 BST * Website update: Wed 22 Jul 2020 21:56:45 BST * Website update: Wed 22 Jul 2020 21:58:22 BST * Remove dist * FIx deploy script to remove old files * Moer tidy ups * Add CNAME file when publishing * Add talks doc * * Fix broken links due to reorganization of documents * Move Troubleshooting content from cloud-foundry deployment doc to cf-troubleshooting * * Fix Getting Started broken link in page footer * Only publish if there are website changes * Remove old doc * Publish website on merge * Apply new theming process to acme example * First pass at customization docs, most of themeing done * Final pass at customization docs * Update base README, point to website Co-authored-by: Veerapuram Varadhan Co-authored-by: Neil MacDougall Co-authored-by: Neil MacDougall Co-authored-by: Neil MacDougall Co-authored-by: Michal Jura Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update developer docs (#4489) * Fixes #4335: Create Stratos static web site with better documentation structure using docusaurus. Initial commit. * 1) Re-organize some more existing doc files. 2) Re-organize links in the doc file to refer to the new document hierarchy. * Landing Page WIP * Documentation tweaks * Use better action names * More visual improvements to landing page * More doc and landing page improvements * Remove publish workflow for now * Typo fix * Moer documentation improvements * Remove extra title from helm doc * Fix script when used from npm * Improve layout on mobile devices * More documentation improvements * Fix typo * Merge downstream (#4441) * Merge src/frontend from downstream * Merge src/jetstream from jetstream * Remove examples/custom-src * Merge deploy from downstream Does not include changes to - deploy/all-in-one/* - deploy/aio-entrypoint.sh - deploy/Dockerfile.all-in-one * Merge build from downstream * Add missing merge items from deploy * Updates to package-lock * Remove fdescribe * Fix e2e core tests * Remove favicon from packages/core/src * Changes following review * Show all favorites for an endpoint favorite if there is only one (#4440) * Show all favorites for the endpoint favorite if there is only one * Missing changes * Merge downstream - JSON Viewer with dark mode & Header Fixes (#4444) * Fix json-viewer dark mode * Fix profile page and side nav top position following header diet - Fix side nav top position - Update fix for profile page to also work in non-desktop mode * Fix issues with tests not running if build upload fails (#4453) * Fix issues with tests not running if build upload fails * Fix script * One more fix for script * Fix white space at start of file * Improve autoscaler e2e logging (#4456) * Improve autoscaler e2e logging - it looks like the AS returns scaling events 1-2 mins after they occur, which is too late for the test - add additional logging to print out event table data in case of alternative events being raised - fix logging if wait for events times out - add hint in later test that depends on AS scaling event * Ensure only the schedule rule results in scaling events * Fix check-e2e-pr.sh for pr's from other repos (#4459) - switch from TRAVIS_PULL_REQUEST_SLUG to TRAVIS_REPO_SLUG * Convert Client Secret Input Fields to `password` (#4455) * Insecure tlsv10 and tlsv11 ciphers in Stratos UI, bsc#1173295 (#411) (#4460) Co-authored-by: Michal Jura * [Security] Bump codecov from 3.7.0 to 3.7.1 (#4457) Bumps [codecov](https://github.com/codecov/codecov-node) from 3.7.0 to 3.7.1. **This update includes a security fix.** - [Release notes](https://github.com/codecov/codecov-node/releases) - [Commits](https://github.com/codecov/codecov-node/compare/v3.7.0...v3.7.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> * Bump lodash from 4.17.15 to 4.17.19 (#4452) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Website update: Wed 22 Jul 2020 21:55:00 BST * Website update: Wed 22 Jul 2020 21:56:45 BST * Website update: Wed 22 Jul 2020 21:58:22 BST * Remove dist * FIx deploy script to remove old files * Moer tidy ups * Add CNAME file when publishing * Add talks doc * * Fix broken links due to reorganization of documents * Move Troubleshooting content from cloud-foundry deployment doc to cf-troubleshooting * * Fix Getting Started broken link in page footer * Only publish if there are website changes * Remove old doc * Publish website on merge * Apply new theming process to acme example * First pass at customization docs, most of themeing done * Final pass at customization docs * Update base README, point to website * Update developer docs Still need an overhall, but updated to remove incorrect data and apply website context Co-authored-by: Veerapuram Varadhan Co-authored-by: Neil MacDougall Co-authored-by: Neil MacDougall Co-authored-by: Neil MacDougall Co-authored-by: Michal Jura Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix docs (#4497) * Fixes #4335: Create Stratos static web site with better documentation structure using docusaurus. Initial commit. * 1) Re-organize some more existing doc files. 2) Re-organize links in the doc file to refer to the new document hierarchy. * Landing Page WIP * Documentation tweaks * Use better action names * More visual improvements to landing page * More doc and landing page improvements * Remove publish workflow for now * Typo fix * Moer documentation improvements * Remove extra title from helm doc * Fix script when used from npm * Improve layout on mobile devices * More documentation improvements * Fix typo * Merge downstream (#4441) * Merge src/frontend from downstream * Merge src/jetstream from jetstream * Remove examples/custom-src * Merge deploy from downstream Does not include changes to - deploy/all-in-one/* - deploy/aio-entrypoint.sh - deploy/Dockerfile.all-in-one * Merge build from downstream * Add missing merge items from deploy * Updates to package-lock * Remove fdescribe * Fix e2e core tests * Remove favicon from packages/core/src * Changes following review * Show all favorites for an endpoint favorite if there is only one (#4440) * Show all favorites for the endpoint favorite if there is only one * Missing changes * Merge downstream - JSON Viewer with dark mode & Header Fixes (#4444) * Fix json-viewer dark mode * Fix profile page and side nav top position following header diet - Fix side nav top position - Update fix for profile page to also work in non-desktop mode * Fix issues with tests not running if build upload fails (#4453) * Fix issues with tests not running if build upload fails * Fix script * One more fix for script * Fix white space at start of file * Improve autoscaler e2e logging (#4456) * Improve autoscaler e2e logging - it looks like the AS returns scaling events 1-2 mins after they occur, which is too late for the test - add additional logging to print out event table data in case of alternative events being raised - fix logging if wait for events times out - add hint in later test that depends on AS scaling event * Ensure only the schedule rule results in scaling events * Fix check-e2e-pr.sh for pr's from other repos (#4459) - switch from TRAVIS_PULL_REQUEST_SLUG to TRAVIS_REPO_SLUG * Convert Client Secret Input Fields to `password` (#4455) * Insecure tlsv10 and tlsv11 ciphers in Stratos UI, bsc#1173295 (#411) (#4460) Co-authored-by: Michal Jura * [Security] Bump codecov from 3.7.0 to 3.7.1 (#4457) Bumps [codecov](https://github.com/codecov/codecov-node) from 3.7.0 to 3.7.1. **This update includes a security fix.** - [Release notes](https://github.com/codecov/codecov-node/releases) - [Commits](https://github.com/codecov/codecov-node/compare/v3.7.0...v3.7.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> * Bump lodash from 4.17.15 to 4.17.19 (#4452) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Website update: Wed 22 Jul 2020 21:55:00 BST * Website update: Wed 22 Jul 2020 21:56:45 BST * Website update: Wed 22 Jul 2020 21:58:22 BST * Remove dist * FIx deploy script to remove old files * Moer tidy ups * Add CNAME file when publishing * Add talks doc * * Fix broken links due to reorganization of documents * Move Troubleshooting content from cloud-foundry deployment doc to cf-troubleshooting * * Fix Getting Started broken link in page footer * Only publish if there are website changes * Remove old doc * Publish website on merge * Apply new theming process to acme example * First pass at customization docs, most of themeing done * Final pass at customization docs * Update base README, point to website * Update developer docs Still need an overhall, but updated to remove incorrect data and apply website context * Fix PR template Co-authored-by: Veerapuram Varadhan Co-authored-by: Neil MacDougall Co-authored-by: Neil MacDougall Co-authored-by: Neil MacDougall Co-authored-by: Michal Jura Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Ensure images dependent on techPreview flag are included in imagelist.txt (#4500) * Improve clean-symlinks script (#4509) * Add support for including breaking changes in the changelog * Improve clean-symlinks script * Update changelog.sh * Update changelog.sh * Remove trailing line * Remove tailing line * Change nginx ciphers and make configurable via helm chart values (#4507) * Change nginx ciphers and make configurable via helm chart values * Add support for including breaking changes in the changelog * Improve clean-symlinks script * Update changelog.sh * Update changelog.sh * Remove trailing line * Remove tailing line * Fix bug with cert path patching * Fig bug where protocols not patched * Update version to 4.0.1, add change log (#4514) * Update version to 4.0.1, add change log * Update package-lock * Fix deploy from gitlab using a group's repo (#4479) - only supported user based repos - fixes #4153 * Add additional time ranges to base metrics range selector (#4480) - fixes https://github.com/SUSE/stratos/issues/415 * Add some time saving comments to cf permissions checker (#4508) * Move tab-nav and xsrf module source files to the src folder (#4518) * Move tab-nav files * Move xsrf module * Fix GitHub branch limit (#4510) * Ensure we fetch all repo's and branches when deploying github apps * Ensure we only fetch branches once - SUSE/stratos vs suse/stratos - ensure branches are treated as 'local' lists * Increate page size for github commits and gitlab requests * Remove use of nodejs util module (#4521) * Remove use of nodejs util module * Fix comment typo * Remove dependencies between store and core that have crept in (#4517) * Remove dependencies between store and core that have crept in * Fix issue with unit tests * Import fixes and unit test fix * Fix store testing package (#4520) * Fix store testing package * Update public-api.ts Co-authored-by: Richard Cox Co-authored-by: Richard Cox * Fix the position of the header guide array (#4524) - shown when there are no registered endpoints (and some incoming scenarios) - position is determined by location of associated button in header - position of button can change given visibility of other buttons (notification bell, endpoint backup, etc) - now check positiion after a delay, add fade in to mask delay * Metrics: Ensure trailing slashes are ignored when comparing URLs (#4527) * Remove imports of the form 'frontend/....' (#4519) * Move tab-nav files * Move xsrf module * Remove imports of the form 'frontend/...' * Move endpopints-health-check.ts (#4530) * Add UMD Ids to external modules in store package (#4522) * Add UMB Ids to external modules in store package * Add moment * Address PR feedback * Improvements & more checks to autoscaler scheduled date tests (#4535) - allow more time to skip between date and time values in date fields - add a check to - add checks to ensure we have the correct number of scheduled date rules * Remove api driven views (#4537) * Remove logger service and action history (#4538) * Remove logger service * Missed a few and removed action history as it was not being used * Remove action history * A few more * Fix for removed method * Add support for API keys (#4515) * Add backend support for API keys * Add last_used field to API keys * Use secure random value as key secret * Add tests for ListAPIKeys and AddAPIKey * Cover the rest of psql_apikeys.go with tests * Refactor the code a bit * Storing SQL queries in a struct should ensure that `datastore.ModifySQLStatement` gets called on all of them. * A wrapper func around `db.Exec` reduces copypasta. * Actually call `InitRepositoryProvider` for API keys package * Add route handler tests using gomock * Actually use skipper in xsrfMiddleware; minor clean-up * Update moment imports to remove warning when building library (#4534) * Update moment imports to remove warning when building library * Fix references to moment-timezone and markdown - contains some changes to e2e tests as well, might need to be reverted * Fix unit test * Fix `import *` in e2e tests Co-authored-by: Richard Cox * Fix Helm upgrade bug (#4544) * Fix Helm upgrade bug * Fix unit tests * Store api_keys.last_used in UTC (#4541) * Add UI for Stratos API Keys (#4523) * Add backend support for API keys * Add last_used field to API keys * Add base api keys page * Add basic api key entity framework (untested) * Add a basic api keys list (untested, need to wire in properties/columns + actions) * Fix entity type related issues * Add basic way to create api key * Wire in delete to list * Improve 'no api keys' ux * Final tidy up * Other fixes * Fix unit tests * Add 'Last Used' column to API keys list * Don't flash up 'no entries' when we haven't loaded api keys yet * Fix last used sorting - takes into account timezone - use cacheing to cater for often called sort * Fix unit test after changes in master * Fix after moment change * Remove now unrequired sorting of api key last used date via moment Co-authored-by: Ivan Kapelyukhin * Add basic e2e tests for API Keys (#4536) * Add backend support for API keys * Add last_used field to API keys * Add base api keys page * Add basic api key entity framework (untested) * Add a basic api keys list (untested, need to wire in properties/columns + actions) * Fix entity type related issues * Add basic way to create api key * Wire in delete to list * Improve 'no api keys' ux * Final tidy up * Other fixes * Fix unit tests * Add basic e2e tests for api keys * Add 'Last Used' column to API keys list * Don't flash up 'no entries' when we haven't loaded api keys yet * Fix last used sorting - takes into account timezone - use cacheing to cater for often called sort * Fix unit test after changes in master * Fix after moment change * Beef up test, fix for initial empty state * Remove now unrequired sorting of api key last used date via moment Co-authored-by: Ivan Kapelyukhin * Bump docusaurus version and add support for versioning (#4506) * Bump docusaurus version and versioning - Bump docusaurus to latest 2.0 version - Fix errors thrown up by new linting process - Add version support, setup 4.0.0 - Enable dark mode and fix in home screen * Move status_updates back into root project docs folder * Fix links - fix dead links - ensure all links are relative (so work when versioned) * Remove version 4.0.0 * WIP * WIP * Completed * Temporarily remove docsVersionDropdown until first version added to internal-versions * Update website docs * Build fix for temp situation where there's no versions * Add custom version of 'not latest released docs' message * Improve versioning and dark mode toggle - Add `All Versions page` - Conditionally include versions in drop down - Improve dark mode toggle icons * Temporarily remove dependent on versions - will be added back in when 4.0 sha is known * Update Versions Process * Add 4.0.0 * Fix in `build`/`serve` world - worked fine in `start` world... * Update 4.0.0 with temp version * Multiple improvements - Fix clean git repo before run - Swizzle docs version drop down nav bar item, move in custom code - Improve docs (latest version must appear in drop down) * Changes following review * Reduce font in version warning * API Keys: Make feature configurable for different user types (#4540) * Add a special type and parsing for the new config option * Add APIKeysEnabled to /info, check it in the middleware * Add test coverage for apiKeyMiddleware * Block API keys endpoints if disabled in the config; add tests * Fix failing test * Add API_KEYS_ENABLED to the Helm chart * Add JSON schema to the Helm chart * Add docs for UAA SSO user permissions management (#4554) * Bump docusaurus version and versioning - Bump docusaurus to latest 2.0 version - Fix errors thrown up by new linting process - Add version support, setup 4.0.0 - Enable dark mode and fix in home screen * Move status_updates back into root project docs folder * Fix links - fix dead links - ensure all links are relative (so work when versioned) * Remove version 4.0.0 * WIP * WIP * Completed * Temporarily remove docsVersionDropdown until first version added to internal-versions * Update website docs * Build fix for temp situation where there's no versions * Add custom version of 'not latest released docs' message * Improve versioning and dark mode toggle - Add `All Versions page` - Conditionally include versions in drop down - Improve dark mode toggle icons * Temporarily remove dependent on versions - will be added back in when 4.0 sha is known * Update Versions Process * Add 4.0.0 * Fix in `build`/`serve` world - worked fine in `start` world... * Update 4.0.0 with temp version * Add troubleshooting section for SSO * Update SSO auth troubleshooting section * Add basic developers guide for working with helm (#4511) * Bump docusaurus version and versioning - Bump docusaurus to latest 2.0 version - Fix errors thrown up by new linting process - Add version support, setup 4.0.0 - Enable dark mode and fix in home screen * Move status_updates back into root project docs folder * Fix links - fix dead links - ensure all links are relative (so work when versioned) * Add basic developers guide for working with helm * Fix post merge issue * Enable/disable API keys UI given API keys config setting (#4559) * Add a special type and parsing for the new config option * Add APIKeysEnabled to /info, check it in the middleware * Add test coverage for apiKeyMiddleware * Block API keys endpoints if disabled in the config; add tests * Fix failing test * Add API_KEYS_ENABLED to the Helm chart * Add JSON schema to the Helm chart * Enable/disable API keys UI given API keys config setting * Changes following review * Fix unit tests Co-authored-by: Ivan Kapelyukhin * Enable linting for all packages (#4561) * Enable linting for all packages - lots to solve! - we may wish to exclude some files * Fix linting * Bump angular json schema form (#4564) * Bump angular json schema form * Handle bug where mat-error maring is too big - We may want to consider moving this upstream Co-authored-by: Richard Cox * Docs: Update internal versions & Automate future updates (#4558) * Docs: Update where 4.0.0 is built from, add 4.0.1 - means we can delete the old `docs-versioning` branch - both versions point to the same commit (when branch merged to master), but reduces user confusion when they can't find the docs for the latest released version. Going forward this will point directly to the release label * Automatically update website's internal-versions.json on new releases - Add new github action - Action will trigger on a release being published - Action looks at github `release` object associated with event and extracts a version label and git label - Use extracted values adds new value to internal-versions.json - Creates a PR with the change * Fix checkout issue * Update documentation-versioning.yml * Merge fixes, remove fdescribe already in master * Fix linting * Fix unit tests Co-authored-by: Veerapuram Varadhan Co-authored-by: Neil MacDougall Co-authored-by: Neil MacDougall Co-authored-by: Neil MacDougall Co-authored-by: Michal Jura Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Veerapuram Varadhan Co-authored-by: Ivan Kapelyukhin --- .../workflows/documentation-versioning.yml | 40 + .github/workflows/documentation.yml | 2 +- .gitignore | 4 + README.md | 2 +- angular.json | 15 +- deploy/kubernetes/console/README.md | 1 + .../console/templates/deployment.yaml | 2 + deploy/kubernetes/console/values.schema.json | 373 +++ deploy/kubernetes/console/values.yaml | 3 + package-lock.json | 96 +- .../cf-autoscaler/src/cf-autoscaler.module.ts | 2 +- .../autoscaler-transform-metric.ts | 4 +- .../autoscaler-transform-policy.ts | 2 +- .../autoscaler-helpers/autoscaler-util.ts | 2 +- .../autoscaler-validation.ts | 4 +- .../autoscaler-base.component.spec.ts | 2 +- .../autoscaler-metric-page.component.spec.ts | 6 +- ...caler-scale-history-page.component.spec.ts | 6 +- ...autoscaler-tab-extension.component.spec.ts | 2 +- .../autoscaler-tab-extension.component.ts | 14 +- ...it-autoscaler-credential.component.spec.ts | 4 +- .../edit-autoscaler-policy-service.ts | 2 +- ...-autoscaler-policy-step1.component.spec.ts | 2 +- .../edit-autoscaler-policy-step1.component.ts | 2 +- ...-autoscaler-policy-step2.component.spec.ts | 2 +- ...-autoscaler-policy-step3.component.spec.ts | 2 +- .../edit-autoscaler-policy-step3.component.ts | 8 +- ...-autoscaler-policy-step4.component.spec.ts | 2 +- .../edit-autoscaler-policy-step4.component.ts | 6 +- .../edit-autoscaler-policy.component.spec.ts | 4 +- ...cf-app-autoscaler-events-config.service.ts | 2 +- .../combo-series-vertical.component.spec.ts | 2 +- ...scaler-metric-chart-list-config.service.ts | 2 +- .../src/actions/app-variables.actions.ts | 4 +- .../actions/deploy-applications.actions.ts | 1 + .../cloud-foundry/src/cf-entity-generator.ts | 14 +- .../src/cloud-foundry-test.module.ts | 2 - .../application-delete.component.spec.ts | 2 +- .../application-wall.component.spec.ts | 2 +- .../application-tabs-base.component.spec.ts | 2 +- .../build-tab/build-tab.component.spec.ts | 2 +- .../tabs/gitscm-tab/gitscm-tab.component.ts | 6 +- .../log-stream-tab.component.ts | 10 +- .../variables-tab/variables-tab.component.ts | 8 +- .../cli-info-application.component.spec.ts | 2 +- .../create-application.component.spec.ts | 2 +- .../deploy-application-step2.component.ts | 2 +- .../deploy-application.component.spec.ts | 2 +- .../github-project-exists.directive.ts | 2 - .../edit-application.component.spec.ts | 2 +- ...ew-application-base-step.component.spec.ts | 2 +- .../add-route-stepper.component.spec.ts | 2 +- .../ssh-application.component.spec.ts | 2 +- .../add-organization.component.spec.ts | 2 +- .../cf/add-quota/add-quota.component.spec.ts | 2 +- .../add-space-quota.component.spec.ts | 2 +- .../cf/add-space/add-space.component.spec.ts | 5 +- .../src/features/cf/cf.helpers.ts | 2 +- .../cli-info-cloud-foundry.component.spec.ts | 2 +- .../cf/cloud-foundry-section.module.ts | 2 - .../cf/cloud-foundry-section.routing.ts | 5 - .../cloud-foundry-tabs-base.component.spec.ts | 2 +- .../cloud-foundry.component.spec.ts | 2 +- .../edit-organization.component.spec.ts | 2 +- .../edit-quota/edit-quota.component.spec.ts | 2 +- .../edit-space-quota-step.component.ts | 6 +- .../edit-space-quota.component.spec.ts | 2 +- .../edit-space/edit-space.component.spec.ts | 2 +- .../quota-definition.component.spec.ts | 2 +- .../space-quota-definition.component.spec.ts | 2 +- .../cloud-foundry-cell-base.component.spec.ts | 2 +- .../cloud-foundry-firehose-formatter.ts | 13 +- .../cloud-foundry-firehose.component.ts | 6 +- ...rganization-space-quotas.component.spec.ts | 2 +- ...oundry-organization-base.component.spec.ts | 2 +- ...ndry-organization-events.component.spec.ts | 4 +- ...ndry-organization-spaces.component.spec.ts | 2 +- ...cloud-foundry-space-base.component.spec.ts | 2 +- ...oud-foundry-space-events.component.spec.ts | 6 +- ...-space-service-instances.component.spec.ts | 3 - ...ud-foundry-space-summary.component.spec.ts | 2 +- ...loud-foundry-space-users.component.spec.ts | 2 +- .../cloud-foundry-space-users.component.ts | 6 +- ...dry-organization-summary.component.spec.ts | 2 +- ...undry-organization-users.component.spec.ts | 2 +- ...ud-foundry-organizations.component.spec.ts | 2 +- .../cloud-foundry-quotas.component.spec.ts | 2 +- ...loud-foundry-summary-tab.component.spec.ts | 2 +- .../invite-users.component.spec.ts | 2 +- .../manage-users-confirm.component.ts | 16 +- .../manage-users-modify.component.ts | 14 +- .../manage-users.component.spec.ts | 2 +- .../remove-user/remove-user.component.spec.ts | 2 +- .../remove-user/remove-user.component.ts | 4 +- .../service-catalog-page.component.spec.ts | 2 +- .../service-tabs-base.component.spec.ts | 2 +- .../detach-service-instance.component.spec.ts | 2 +- .../services-wall.component.spec.ts | 2 +- ...rvice-instance-base-step.component.spec.ts | 2 +- .../add-service-instance.component.spec.ts | 2 +- .../create-service-instance-helper.service.ts | 16 +- .../card-cf-info/card-cf-info.component.ts | 2 +- .../list-types/app/cf-apps-data-source.ts | 9 +- .../cf-cell-health-list-config.service.ts | 5 +- .../cf-cells/cf-cells-list-config.service.ts | 2 +- ...cell-feature-flag-description.component.ts | 2 +- .../table-cell-service-broker.component.ts | 25 +- .../cf-org-permission-cell.component.ts | 6 +- .../list-types/cf-users/cf-permission-cell.ts | 2 +- .../cf-space-permission-cell.component.ts | 8 +- ...hub-commits-list-config-app-tab.service.ts | 2 +- .../scm/github-pagination.helper.ts | 153 + .../shared/data-services/scm/github-scm.ts | 39 +- .../shared/data-services/scm/gitlab-scm.ts | 61 +- .../app-name-unique.directive.ts | 4 +- .../src/store/effects/deploy-app.effects.ts | 24 +- .../src/store/effects/github.effects.ts | 4 +- .../src/store/effects/request.effects.ts | 4 +- .../src/store/effects/users-roles.effects.ts | 6 +- .../cf-user-permissions-checkers.ts | 28 +- .../user-permissions/cf-user-roles-fetch.ts | 19 +- .../sass/components/json-schema-form.scss | 5 + .../api-driven-views/api-drive-views.types.ts | 7 - .../api-driven-views-routing.module.ts | 45 - .../api-driven-views.module.ts | 28 - .../api-entity-list.component.html | 1 - .../api-entity-list.component.scss | 0 .../api-entity-list.component.spec.ts | 25 - .../api-entity-list.component.ts | 15 - .../api-entity-type-selector.component.html | 2 - .../api-entity-type-selector.component.scss | 0 ...api-entity-type-selector.component.spec.ts | 59 - .../api-entity-type-selector.component.ts | 40 - .../api-endpoint-select-page.component.html | 6 - .../api-endpoint-select-page.component.scss | 0 ...api-endpoint-select-page.component.spec.ts | 40 - .../api-endpoint-select-page.component.ts | 39 - ...i-endpoint-type-select-page.component.html | 6 - ...i-endpoint-type-select-page.component.scss | 0 ...ndpoint-type-select-page.component.spec.ts | 38 - ...api-endpoint-type-select-page.component.ts | 47 - .../api-entity-list-page.component.html | 1 - .../api-entity-list-page.component.scss | 0 .../api-entity-list-page.component.spec.ts | 36 - .../api-entity-list-page.component.ts | 26 - ...api-entity-type-select-page.component.html | 4 - ...api-entity-type-select-page.component.scss | 0 ...-entity-type-select-page.component.spec.ts | 38 - .../api-entity-type-select-page.component.ts | 52 - src/frontend/packages/core/src/app.module.ts | 4 +- src/frontend/packages/core/src/app.routing.ts | 7 +- .../src/core/apiKey-auth-guard.service.ts | 30 + .../packages/core/src/core/core.module.ts | 4 +- .../{ => src/core}/endpoints-health-checks.ts | 6 +- .../core/src/core/endpoints.service.ts | 2 +- .../src/core/extension/extension-service.ts | 14 +- .../core/src/core/logger.service.spec.ts | 24 - .../packages/core/src/core/logger.service.ts | 77 - .../current-user-permissions.service.ts | 16 +- .../stratos-user-permissions.checker.ts | 43 +- .../packages/core/src/core/utils.service.ts | 9 +- .../core/src/environments/environment.prod.ts | 4 - .../core/src/environments/environment.ts | 4 - .../about-page/about-page.component.spec.ts | 8 +- .../diagnostics-page.component.spec.ts | 8 +- .../eula-page/eula-page.component.spec.ts | 8 +- .../add-api-key-dialog.component.html | 28 + .../add-api-key-dialog.component.scss | 28 + .../add-api-key-dialog.component.spec.ts | 40 + .../add-api-key-dialog.component.ts | 66 + .../api-keys-page.component.html | 33 + .../api-keys-page.component.scss | 15 + .../api-keys-page.component.spec.ts | 42 + .../api-keys-page/api-keys-page.component.ts | 63 + .../src/features/api-keys/api-keys.module.ts | 22 + .../src/features/api-keys/api-keys.routing.ts | 18 + .../dashboard-base.component.spec.ts | 2 +- .../dashboard-base.component.ts | 6 +- .../page-side-nav.component.spec.ts | 4 +- .../page-side-nav/page-side-nav.component.ts | 4 +- .../side-nav/side-nav.component.html | 2 +- .../dashboard/side-nav/side-nav.component.ts | 23 +- .../backup-endpoints.component.spec.ts | 2 +- .../backup-endpoints.component.ts | 2 +- ...backup-restore-endpoints.component.spec.ts | 2 +- .../restore-endpoints.service.ts | 4 +- .../restore-endpoints.component.spec.ts | 2 +- .../connect-endpoint-dialog.component.spec.ts | 4 +- ...reate-endpoint-base-step.component.spec.ts | 23 +- .../create-endpoint.component.spec.ts | 7 +- .../edit-endpoint.component.spec.ts | 6 +- .../endpoints-page.component.html | 2 +- .../endpoints-page.component.spec.ts | 2 +- .../error-page/error-page.component.spec.ts | 2 +- .../events-page/events-page.component.spec.ts | 8 +- .../home/home/home-page.component.spec.ts | 8 +- .../features/home/home/home-page.component.ts | 2 - .../src/features/metrics/metrics.helpers.ts | 15 +- .../src/features/metrics/metrics.module.ts | 13 +- .../metrics/metrics/metrics.component.spec.ts | 9 +- .../no-endpoints-non-admin.component.spec.ts | 8 +- .../local-account-wizard.component.spec.ts | 8 +- .../setup-welcome.component.spec.ts | 2 +- .../console-uaa-wizard.component.spec.ts | 10 +- .../edit-profile-info.component.spec.ts | 2 +- .../profile-info.component.spec.ts | 9 +- .../packages/core/src/route-reuse-stragegy.ts | 2 +- .../app-action-monitor.component.ts | 4 +- .../boolean-indicator.component.ts | 44 +- .../copy-to-clipboard.component.ts | 5 +- .../date-time/date-time.component.ts | 9 +- .../favorites-meta-card.component.ts | 9 +- .../table-cell/table-cell.component.spec.ts | 4 - .../list/list-table/table.component.ts | 2 +- .../list-types/apiKeys/apiKey-data-source.ts | 32 + .../apiKeys/apiKey-list-config.service.ts | 103 + .../endpoint-card/endpoint-card.component.ts | 2 +- .../endpoint/endpoint-list.helpers.ts | 4 +- .../shared/components/list/list.component.ts | 2 +- .../components/list/list.component.types.ts | 4 +- .../markdown-preview.component.spec.ts | 3 +- .../markdown-preview.component.ts | 6 +- .../metrics-range-selector.component.ts | 2 +- .../nested-tabs/nested-tabs.component.ts | 3 +- .../no-content-message.component.html | 2 +- .../no-content-message.component.scss | 5 + .../no-content-message.component.ts | 19 +- .../page-header/page-header.component.html | 107 +- .../page-header/page-header.component.spec.ts | 8 +- .../page-header/page-header.component.ts | 10 +- .../show-page-header.component.spec.ts | 2 +- .../show-page-header.component.ts | 2 +- .../page-sub-nav.component.spec.ts | 2 +- .../page-sub-nav/page-sub-nav.component.ts | 4 +- .../recent-entities.component.ts | 10 +- .../sidepanel-preview.component.spec.ts | 3 +- .../start-end-date.component.spec.ts | 2 +- .../start-end-date.component.ts | 2 +- .../stepper/steppers/steppers.component.ts | 4 +- .../src/shared/components/user-avatar/md5.ts | 3 +- .../user-avatar/user-avatar.component.ts | 3 +- .../user-profile-banner.component.ts | 3 +- .../metrics-range-selector-manager.service.ts | 2 +- .../metrics-range-selector.service.ts | 12 +- .../services/metrics-range-selector.types.ts | 2 +- .../packages/core/src/shared/shared.module.ts | 2 + src/frontend/packages/core/src/styles.scss | 1 + .../core/{ => src}/tab-nav.service.ts | 6 +- .../packages/core/{ => src}/tab-nav.types.ts | 0 .../packages/core/{ => src}/xsrf.module.ts | 0 src/frontend/packages/core/tslint.json | 2 +- src/frontend/packages/store/ng-package.json | 16 +- .../src/actions/action-history.actions.ts | 9 - .../store/src/actions/apiKey.actions.ts | 44 + .../src/actions/internal-events.actions.ts | 2 +- .../packages/store/src/actions/log.actions.ts | 60 - .../store/src/actions/router.actions.ts | 4 +- .../store/src/actions/system.actions.ts | 12 +- .../src/actions/user-favourites.actions.ts | 12 +- .../packages/store/src/apiKey.types.ts | 7 + src/frontend/packages/store/src/app-state.ts | 2 - .../src/effects/action-history.effects.ts | 26 - .../store/src/effects/apiKey.effects.ts | 132 + .../store/src/effects/endpoint.effects.ts | 4 +- .../action-dispatcher.spec.ts | 54 +- .../entity-catalog-entity.ts | 16 + .../entity-catalog-entity.types.ts | 29 +- .../entity-catalog/entity-catalog.helper.ts | 5 +- .../src/entity-catalog/entity-catalog.spec.ts | 9 +- .../src/entity-catalog/entity-catalog.ts | 1 - .../entity-pagination-request-pipeline.ts | 2 - .../packages/store/src/entity-service.ts | 10 +- .../src/helpers/paginated-request-helpers.ts | 49 +- .../src/helpers/stratos-entity-factory.ts | 4 + .../internal-event-monitor.factory.spec.ts | 7 +- .../src/monitors/internal-event.monitor.ts | 4 +- src/frontend/packages/store/src/public-api.ts | 25 +- .../packages/store/src/reducers.module.ts | 2 - .../src/reducers/action-history-reducer.ts | 23 - .../api-request-reducer/fail-request.ts | 3 +- .../api-request-reducer/start-request.ts | 3 +- .../api-request-reducer/succeed-request.ts | 3 +- .../api-request-reducer/update-request.ts | 5 +- .../current-user-roles.reducer.ts | 7 +- .../packages/store/src/store.module.ts | 6 +- .../store/src/stratos-action-builders.ts | 49 +- .../store/src/stratos-entity-catalog.ts | 8 + .../store/src/stratos-entity-generator.ts | 52 +- .../packages/store/src/types/auth.types.ts | 8 +- src/frontend/packages/store/src/utils.ts | 6 + .../packages/store/testing/ng-package.json | 5 +- .../store/testing/src/store-test-helper.ts | 33 +- .../store/testing/src/store-test.module.ts | 4 +- .../packages/store/testing/tslint.json | 2 +- .../demo-helper/demo-helper.component.spec.ts | 2 +- .../monocular-tab-base.component.spec.ts | 2 +- .../chart-details-readme.component.ts | 2 +- .../chart-item/chart-item.component.spec.ts | 2 - .../monocular/charts/charts.component.spec.ts | 2 - .../shared/services/charts.service.ts | 6 +- .../shared/services/repos.service.ts | 6 +- .../analysis-report-selector.component.ts | 8 +- .../kube-console.component.spec.ts | 6 +- .../kubedash-configuration.component.spec.ts | 6 +- .../kubernetes-dashboard.component.spec.ts | 2 +- .../kubernetes/kubernetes-metrics.helpers.ts | 3 +- ...amespace-analysis-report.component.spec.ts | 6 +- ...netes-namespace-services.component.spec.ts | 2 +- .../kubernetes-node.component.spec.ts | 2 +- .../kubernetes-resource-viewer.component.ts | 2 +- .../kubernetes-tab-base.component.spec.ts | 2 +- .../kubernetes/kubernetes.testing.module.ts | 2 +- .../kubernetes/kubernetes.component.spec.ts | 2 +- .../analysis-reports-list-config.service.ts | 2 +- .../kubernetes/list-types/kube-list.helper.ts | 2 +- .../kubernetes-pod-containers.component.ts | 2 +- .../pod-metrics/pod-metrics.component.spec.ts | 2 +- .../analysis-info-card.component.ts | 2 +- ...bernetes-analysis-report.component.spec.ts | 6 +- .../kubernetes-analysis-tab.component.spec.ts | 6 +- .../kubernetes-summary.component.spec.ts | 2 +- .../create-release.component.spec.ts | 4 +- .../helm-release-socket-service.ts | 4 +- .../helm-release-tab-base.component.spec.ts | 8 +- ...elm-release-analysis-tab.component.spec.ts | 19 +- .../helm-release-history-tab.component.ts | 2 +- ...m-release-resource-graph.component.spec.ts | 10 +- ...helm-release-summary-tab.component.spec.ts | 2 +- .../helm-release-summary-tab.component.ts | 4 +- .../helm-release-values-tab.component.spec.ts | 2 +- .../releases-tab.component.spec.ts | 2 +- .../release-version-list-config.ts | 2 +- src/jetstream/apikeys.go | 92 + src/jetstream/apikeys_test.go | 389 +++ src/jetstream/auth_test.go | 4 +- src/jetstream/config.dev | 3 + .../datastore/20200814140918_ApiKeys.go | 22 + src/jetstream/go.mod | 1 + src/jetstream/go.sum | 7 + src/jetstream/info.go | 1 + src/jetstream/main.go | 33 +- src/jetstream/middleware.go | 240 +- src/jetstream/middleware_test.go | 378 +++ src/jetstream/plugins/metrics/main.go | 13 +- src/jetstream/plugins/metrics/main_test.go | 3 + src/jetstream/portal_proxy.go | 2 + src/jetstream/repository/apikeys/apikeys.go | 12 + .../repository/apikeys/mock_apikeys.go | 107 + .../repository/apikeys/psql_apikeys.go | 184 ++ .../repository/apikeys/psql_apikeys_test.go | 339 +++ .../repository/interfaces/apikeys.go | 12 + .../repository/interfaces/config/config.go | 40 +- .../repository/interfaces/structs.go | 9 +- .../repository/mock_interfaces/mock_auth.go | 107 + src/test-e2e/apikeys/apikey-e2e-helper.ts | 29 + src/test-e2e/apikeys/apikeys-e2e.spec.ts | 119 + .../apikeys/po/apikey-add-dialog.po.ts | 35 + .../apikeys/po/apikeys-list-page.po.ts | 34 + .../application-autoscaler-e2e.spec.ts | 30 +- .../application-deploy-local-e2e.spec.ts | 2 +- .../po/application-page-autoscaler.po.ts | 10 +- .../po/create-autoscaler-policy-step.po.ts | 2 +- .../po/message-no-autoscaler-policy.ts | 2 +- .../endpoints/endpoints-register-e2e.spec.ts | 1 - src/test-e2e/helpers/request-helpers.ts | 6 +- src/test-e2e/helpers/uaa-request-helpers.ts | 2 +- src/test-e2e/locale.helper.ts | 2 +- src/test-e2e/po/form.po.ts | 1 + src/test-e2e/po/page-header.po.ts | 12 +- src/tsconfig.json | 2 + website/README.md | 50 +- website/add-version.sh | 27 + website/build-versions.sh | 151 + website/docs/advanced/sso.md | 17 +- .../deploy/cloud-foundry/cloud-foundry.md | 6 +- website/docs/developer/deploy.md | 8 + .../docs/developer/developers-guide-helm.md | 59 + website/docs/developer/frontend.md | 6 +- website/docs/developer/introduction.md | 4 +- website/docs/extensions/frontend.md | 32 +- website/docs/extensions/introduction.md | 14 +- website/docs/extensions/v4-migration.md | 12 +- website/docs/introduction.md | 2 +- website/docs/overview.md | 2 +- website/docs/status_updates.md | 721 ----- website/docusaurus.config.js | 107 +- website/internal-versions.json | 4 + website/package-lock.json | 2595 ++++++++++------- website/package.json | 13 +- website/sidebars.js | 6 + website/src/css/custom.css | 28 +- website/src/pages/index.js | 24 +- website/src/pages/versions.js | 95 + .../src/theme/DocVersionSuggestions/index.js | 64 + .../DocVersionSuggestions/styles.module.css | 3 + website/src/theme/Navbar/index.js | 209 ++ website/src/theme/Navbar/styles.module.css | 26 + .../DocsVersionDropdownNavbarItem.js | 81 + 398 files changed, 7091 insertions(+), 3580 deletions(-) create mode 100644 .github/workflows/documentation-versioning.yml create mode 100644 deploy/kubernetes/console/values.schema.json create mode 100644 src/frontend/packages/cloud-foundry/src/shared/data-services/scm/github-pagination.helper.ts create mode 100644 src/frontend/packages/core/sass/components/json-schema-form.scss delete mode 100644 src/frontend/packages/core/src/api-driven-views/api-drive-views.types.ts delete mode 100644 src/frontend/packages/core/src/api-driven-views/api-driven-views-routing.module.ts delete mode 100644 src/frontend/packages/core/src/api-driven-views/api-driven-views.module.ts delete mode 100644 src/frontend/packages/core/src/api-driven-views/components/api-entity-list/api-entity-list.component.html delete mode 100644 src/frontend/packages/core/src/api-driven-views/components/api-entity-list/api-entity-list.component.scss delete mode 100644 src/frontend/packages/core/src/api-driven-views/components/api-entity-list/api-entity-list.component.spec.ts delete mode 100644 src/frontend/packages/core/src/api-driven-views/components/api-entity-list/api-entity-list.component.ts delete mode 100644 src/frontend/packages/core/src/api-driven-views/components/api-type-selector/api-entity-type-selector.component.html delete mode 100644 src/frontend/packages/core/src/api-driven-views/components/api-type-selector/api-entity-type-selector.component.scss delete mode 100644 src/frontend/packages/core/src/api-driven-views/components/api-type-selector/api-entity-type-selector.component.spec.ts delete mode 100644 src/frontend/packages/core/src/api-driven-views/components/api-type-selector/api-entity-type-selector.component.ts delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-endpoint-select-page/api-endpoint-select-page.component.html delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-endpoint-select-page/api-endpoint-select-page.component.scss delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-endpoint-select-page/api-endpoint-select-page.component.spec.ts delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-endpoint-select-page/api-endpoint-select-page.component.ts delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-endpoint-type-select-page/api-endpoint-type-select-page.component.html delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-endpoint-type-select-page/api-endpoint-type-select-page.component.scss delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-endpoint-type-select-page/api-endpoint-type-select-page.component.spec.ts delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-endpoint-type-select-page/api-endpoint-type-select-page.component.ts delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-entity-list-page/api-entity-list-page.component.html delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-entity-list-page/api-entity-list-page.component.scss delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-entity-list-page/api-entity-list-page.component.spec.ts delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-entity-list-page/api-entity-list-page.component.ts delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-entity-type-select-page/api-entity-type-select-page.component.html delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-entity-type-select-page/api-entity-type-select-page.component.scss delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-entity-type-select-page/api-entity-type-select-page.component.spec.ts delete mode 100644 src/frontend/packages/core/src/api-driven-views/features/api-entity-type-select-page/api-entity-type-select-page.component.ts create mode 100644 src/frontend/packages/core/src/core/apiKey-auth-guard.service.ts rename src/frontend/packages/core/{ => src/core}/endpoints-health-checks.ts (74%) delete mode 100644 src/frontend/packages/core/src/core/logger.service.spec.ts delete mode 100644 src/frontend/packages/core/src/core/logger.service.ts create mode 100644 src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.html create mode 100644 src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.scss create mode 100644 src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.spec.ts create mode 100644 src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.ts create mode 100644 src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.html create mode 100644 src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.scss create mode 100644 src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.spec.ts create mode 100644 src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.ts create mode 100644 src/frontend/packages/core/src/features/api-keys/api-keys.module.ts create mode 100644 src/frontend/packages/core/src/features/api-keys/api-keys.routing.ts create mode 100644 src/frontend/packages/core/src/shared/components/list/list-types/apiKeys/apiKey-data-source.ts create mode 100644 src/frontend/packages/core/src/shared/components/list/list-types/apiKeys/apiKey-list-config.service.ts rename src/frontend/packages/core/{ => src}/tab-nav.service.ts (94%) rename src/frontend/packages/core/{ => src}/tab-nav.types.ts (100%) rename src/frontend/packages/core/{ => src}/xsrf.module.ts (100%) delete mode 100644 src/frontend/packages/store/src/actions/action-history.actions.ts create mode 100644 src/frontend/packages/store/src/actions/apiKey.actions.ts delete mode 100644 src/frontend/packages/store/src/actions/log.actions.ts create mode 100644 src/frontend/packages/store/src/apiKey.types.ts delete mode 100644 src/frontend/packages/store/src/effects/action-history.effects.ts create mode 100644 src/frontend/packages/store/src/effects/apiKey.effects.ts delete mode 100644 src/frontend/packages/store/src/reducers/action-history-reducer.ts create mode 100644 src/frontend/packages/store/src/utils.ts create mode 100644 src/jetstream/apikeys.go create mode 100644 src/jetstream/apikeys_test.go create mode 100644 src/jetstream/datastore/20200814140918_ApiKeys.go create mode 100644 src/jetstream/middleware_test.go create mode 100644 src/jetstream/repository/apikeys/apikeys.go create mode 100644 src/jetstream/repository/apikeys/mock_apikeys.go create mode 100644 src/jetstream/repository/apikeys/psql_apikeys.go create mode 100644 src/jetstream/repository/apikeys/psql_apikeys_test.go create mode 100644 src/jetstream/repository/interfaces/apikeys.go create mode 100644 src/jetstream/repository/mock_interfaces/mock_auth.go create mode 100644 src/test-e2e/apikeys/apikey-e2e-helper.ts create mode 100644 src/test-e2e/apikeys/apikeys-e2e.spec.ts create mode 100644 src/test-e2e/apikeys/po/apikey-add-dialog.po.ts create mode 100644 src/test-e2e/apikeys/po/apikeys-list-page.po.ts create mode 100755 website/add-version.sh create mode 100755 website/build-versions.sh create mode 100644 website/docs/developer/deploy.md create mode 100644 website/docs/developer/developers-guide-helm.md delete mode 100644 website/docs/status_updates.md create mode 100644 website/internal-versions.json create mode 100644 website/src/pages/versions.js create mode 100644 website/src/theme/DocVersionSuggestions/index.js create mode 100644 website/src/theme/DocVersionSuggestions/styles.module.css create mode 100644 website/src/theme/Navbar/index.js create mode 100644 website/src/theme/Navbar/styles.module.css create mode 100644 website/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.js diff --git a/.github/workflows/documentation-versioning.yml b/.github/workflows/documentation-versioning.yml new file mode 100644 index 0000000000..76eab9369b --- /dev/null +++ b/.github/workflows/documentation-versioning.yml @@ -0,0 +1,40 @@ +name: documentation-versions + +on: + release: + types: [published] + +jobs: + update-docs-internal-versions: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: '12.x' + - name: Update internal-versions.json + run: | + cd website + if [ -e yarn.lock ]; then + yarn install --frozen-lockfile + elif [ -e package-lock.json ]; then + npm ci + else + npm i + fi + npm run add-version + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v3.3.0 + with: + commit-message: Update Docs Versions + delete-branch: true + title: Update website docs version following release + body: | + - Auto-generated + labels: | + ready for review + draft: false + - name: Check output + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 4b78eefdc3..a705479e7a 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -25,4 +25,4 @@ jobs: else npm i fi - npm run build \ No newline at end of file + npm run build diff --git a/.gitignore b/.gitignore index ac5cbdb218..eb452d4518 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,7 @@ go-vendor-*.tgz website/build website/site-dist website/.docusaurus +website/versioned_docs +website/versioned_sidebars +website/versions.json +website/versions-repo diff --git a/README.md b/README.md index 528627e08f..2c4ca4c6b3 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Please visit our new [documentation site](https://stratos.app/). There you can d 1. Guides for [developers](https://stratos.app/docs/developer/introduction). 1. How to [extend](https://stratos.app/docs/extensions/introduction) Stratos [functionality](https://stratos.app/docs/extensions/frontend) and apply a custom [theme](https://stratos.app/docs/extensions/theming). -> For more SUSE specific information, specifically regarding Stratos Kubernetes and Helm functionality, please see our `/docs` folder. +> For more SUSE specific information, for example regarding Stratos Kubernetes and Helm functionality, please see our `/docs` folder. ## Acknowledgements diff --git a/angular.json b/angular.json index 79b33bcd31..18d9daa972 100644 --- a/angular.json +++ b/angular.json @@ -192,11 +192,7 @@ ], "tslintConfig": "src/frontend/packages/core/tslint.json", "files": [ - "src/frontend/packages/core/src/**/*.ts", - "src/frontend/packages/core/src/custom/**/*.ts" - ], - "exclude": [ - "!src/frontend/packages/core/**" + "src/frontend/packages/core/src/**/*.ts" ] } } @@ -237,9 +233,6 @@ "tslintConfig": "src/frontend/packages/store/tslint.json", "files": [ "src/frontend/packages/store/src/**/*.ts" - ], - "exclude": [ - "!src/frontend/packages/store/**" ] } } @@ -311,9 +304,6 @@ "tslintConfig": "src/frontend/packages/cloud-foundry/tslint.json", "files": [ "src/frontend/packages/cloud-foundry/src/**/*.ts" - ], - "exclude": [ - "!src/frontend/packages/cloud-foundry/**" ] } } @@ -354,9 +344,6 @@ "tslintConfig": "src/frontend/packages/cf-autoscaler/tslint.json", "files": [ "src/frontend/packages/cf-autoscaler/src/**/*.ts" - ], - "exclude": [ - "!src/frontend/packages/cf-autoscaler/**" ] } } diff --git a/deploy/kubernetes/console/README.md b/deploy/kubernetes/console/README.md index ef228ed1d7..ee238aa880 100644 --- a/deploy/kubernetes/console/README.md +++ b/deploy/kubernetes/console/README.md @@ -75,6 +75,7 @@ The following table lists the configurable parameters of the Stratos Helm chart |console.templatesConfigMapName|Name of config map that provides the template files for user invitation emails|| |console.userInviteSubject|Email subject of the user invitation message|| |console.techPreview|Enable/disable Tech Preview features|false| +|console.apiKeysEnabled|Enable/disable API key-based access to Stratos API (disabled, admin_only, all_users)|admin_only| |console.ui.listMaxSize|Override the default maximum number of entities that a configured list can fetch. When a list meets this amount additional pages are not fetched|| |console.ui.listAllowLoadMaxed|If the maximum list size is met give the user the option to fetch all results|false| |console.localAdminPassword|Use local admin user instead of UAA - set to a password to enable|| diff --git a/deploy/kubernetes/console/templates/deployment.yaml b/deploy/kubernetes/console/templates/deployment.yaml index 50d94a2c5d..40280e1ba8 100644 --- a/deploy/kubernetes/console/templates/deployment.yaml +++ b/deploy/kubernetes/console/templates/deployment.yaml @@ -282,6 +282,8 @@ spec: value: {{ default "" .Values.console.userInviteSubject | quote }} - name: ENABLE_TECH_PREVIEW value: {{ default "false" .Values.console.techPreview | quote }} + - name: API_KEYS_ENABLED + value: {{ default "admin_only" .Values.console.apiKeysEnabled | quote }} - name: HELM_CACHE_FOLDER value: /helm-cache {{- if .Values.console.ui }} diff --git a/deploy/kubernetes/console/values.schema.json b/deploy/kubernetes/console/values.schema.json new file mode 100644 index 0000000000..34651e77ae --- /dev/null +++ b/deploy/kubernetes/console/values.schema.json @@ -0,0 +1,373 @@ +{ + "$schema": "http://json-schema.org/schema#", + "type": "object", + "properties": { + "autoCleanup": { + "type": "boolean" + }, + "configInit": { + "type": "object", + "properties": { + "nodeSelector": { + "type": "object" + } + } + }, + "console": { + "type": "object", + "properties": { + "apiKeysEnabled": { + "type": "string", + "enum": ["disabled", "admin_only", "all_users"] + }, + "autoRegisterCF": { + "type": ["string", "null"] + }, + "backendLogLevel": { + "type": "string" + }, + "cookieDomain": { + "type": ["string", "null"] + }, + "deploymentAnnotations": { + "type": "object" + }, + "deploymentExtraLabels": { + "type": "object" + }, + "jobAnnotations": { + "type": "object" + }, + "jobExtraLabels": { + "type": "object" + }, + "localAdminPassword": { + "type": ["string", "null"] + }, + "nodeSelector": { + "type": "object" + }, + "podAnnotations": { + "type": "object" + }, + "podExtraLabels": { + "type": "object" + }, + "service": { + "type": "object", + "properties": { + "annotations": { + "type": "object" + }, + "externalIPs": { + "type": "array" + }, + "externalName": { + "type": ["string", "null"] + }, + "extraLabels": { + "type": "object" + }, + "http": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "servicePort": { + "type": "integer" + } + } + }, + "ingress": { + "type": "object", + "properties": { + "annotations": { + "type": "object" + }, + "enabled": { + "type": "boolean" + }, + "extraLabels": { + "type": "object" + }, + "host": { + "type": ["string", "null"] + }, + "secretName": { + "type": ["string", "null"] + }, + "tls": { + "type": "object", + "properties": { + "crt": { + "type": ["string", "null"] + }, + "key": { + "type": ["string", "null"] + } + } + } + } + }, + "loadBalancerIP": { + "type": ["string", "null"] + }, + "loadBalancerSourceRanges": { + "type": "array" + }, + "servicePort": { + "type": "integer" + }, + "type": { + "type": "string" + } + } + }, + "sessionStoreSecret": { + "type": ["string", "null"] + }, + "sslCiphers": { + "type": ["string", "null"] + }, + "sslProtocols": { + "type": ["string", "null"] + }, + "ssoLogin": { + "type": "boolean" + }, + "ssoOptions": { + "type": ["string", "null"] + }, + "statefulSetAnnotations": { + "type": "object" + }, + "statefulSetExtraLabels": { + "type": "object" + }, + "techPreview": { + "type": "boolean" + }, + "templatesConfigMapName": { + "type": ["string", "null"] + }, + "tlsSecretName": { + "type": ["string", "null"] + }, + "ui": { + "type": "object", + "properties": { + "listAllowLoadMaxed": { + "type": "boolean" + }, + "listMaxSize": { + "type": ["integer", "null"] + } + } + }, + "userInviteSubject": { + "type": ["string", "null"] + } + } + }, + "consoleVersion": { + "type": "string" + }, + "dockerRegistrySecret": { + "type": "string" + }, + "env": { + "type": "object", + "properties": { + "DOMAIN": { + "type": ["string", "null"] + }, + "SMTP_AUTH": { + "type": "string" + }, + "SMTP_FROM_ADDRESS": { + "type": ["string", "null"] + }, + "SMTP_HOST": { + "type": ["string", "null"] + }, + "SMTP_PASSWORD": { + "type": ["string", "null"] + }, + "SMTP_PORT": { + "type": "string" + }, + "SMTP_USER": { + "type": ["string", "null"] + }, + "UAA_HOST": { + "type": ["string", "null"] + }, + "UAA_PORT": { + "type": "integer" + }, + "UAA_ZONE": { + "type": "string" + } + } + }, + "imagePullPolicy": { + "type": "string" + }, + "images": { + "type": "object", + "properties": { + "configInit": { + "type": "string" + }, + "console": { + "type": "string" + }, + "mariadb": { + "type": "string" + }, + "proxy": { + "type": "string" + } + } + }, + "kube": { + "type": "object", + "properties": { + "auth": { + "type": "string" + }, + "external_console_https_port": { + "type": "integer" + }, + "organization": { + "type": "string" + }, + "registry": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "hostname": { + "type": ["string", "null"] + }, + "password": { + "type": ["string", "null"] + }, + "username": { + "type": ["string", "null"] + } + } + }, + "storage_class": { + "type": "object", + "properties": { + "persistent": { + "type": ["string", "null"] + } + } + } + } + }, + "mariadb": { + "type": "object", + "properties": { + "database": { + "type": "string" + }, + "external": { + "type": "boolean" + }, + "host": { + "type": ["string", "null"] + }, + "nodeSelector": { + "type": "object" + }, + "persistence": { + "type": "object", + "properties": { + "accessMode": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "size": { + "type": "string" + }, + "storageClass": { + "type": ["string", "null"] + } + } + }, + "port": { + "type": "null" + }, + "resources": { + "type": "object", + "properties": { + "requests": { + "type": "object", + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + } + } + } + }, + "rootPassword": { + "type": ["string", "null"] + }, + "tls": { + "type": ["string", "null"] + }, + "type": { + "type": ["string", "null"] + }, + "user": { + "type": "string" + }, + "userPassword": { + "type": ["string", "null"] + } + } + }, + "services": { + "type": "object", + "properties": { + "loadbalanced": { + "type": "boolean" + } + } + }, + "uaa": { + "type": "object", + "properties": { + "consoleAdminIdentifier": { + "type": ["string", "null"] + }, + "consoleClient": { + "type": ["string", "null"] + }, + "consoleClientSecret": { + "type": ["string", "null"] + }, + "endpoint": { + "type": ["string", "null"] + }, + "skipSSLValidation": { + "type": "boolean" + } + } + }, + "useLb": { + "type": "boolean" + } + } +} diff --git a/deploy/kubernetes/console/values.yaml b/deploy/kubernetes/console/values.yaml index 3e72d57812..e9999e9d35 100644 --- a/deploy/kubernetes/console/values.yaml +++ b/deploy/kubernetes/console/values.yaml @@ -67,6 +67,9 @@ console: # Enable/disable Tech Preview techPreview: false + # Enable/disable API key-based access to Stratos API + apiKeysEnabled: admin_only + ui: # Override the default maximum number of entities that a configured list can fetch. When a list meets this amount additional pages are not fetched listMaxSize: diff --git a/package-lock.json b/package-lock.json index 77791d470f..6ae8d5b767 100644 --- a/package-lock.json +++ b/package-lock.json @@ -986,6 +986,12 @@ "@babel/types": "^7.10.4" }, "dependencies": { + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/types": { "version": "7.11.5", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.5.tgz", @@ -1009,6 +1015,12 @@ "@babel/types": "^7.10.4" }, "dependencies": { + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/types": { "version": "7.11.5", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.5.tgz", @@ -1086,6 +1098,12 @@ "@babel/types": "^7.10.4" } }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/highlight": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", @@ -1136,6 +1154,12 @@ "@babel/types": "^7.10.4" }, "dependencies": { + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/types": { "version": "7.11.5", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.5.tgz", @@ -1178,6 +1202,12 @@ "@babel/types": "^7.10.4" }, "dependencies": { + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/types": { "version": "7.11.5", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.5.tgz", @@ -1391,6 +1421,12 @@ "@babel/highlight": "^7.10.4" } }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/highlight": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", @@ -1648,6 +1684,12 @@ "@babel/types": "^7.11.0" }, "dependencies": { + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/types": { "version": "7.11.5", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.5.tgz", @@ -1737,6 +1779,12 @@ "@babel/types": "^7.11.0" } }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/highlight": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", @@ -2178,6 +2226,12 @@ "@babel/types": "^7.10.4" } }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/types": { "version": "7.11.5", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.11.5.tgz", @@ -2304,6 +2358,12 @@ "@babel/types": "^7.11.0" } }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/highlight": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", @@ -2472,6 +2532,12 @@ "@babel/types": "^7.10.4" } }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/highlight": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", @@ -2655,6 +2721,12 @@ "@babel/types": "^7.11.0" } }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/highlight": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", @@ -2853,6 +2925,12 @@ "@babel/types": "^7.11.0" } }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/highlight": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", @@ -3051,6 +3129,12 @@ "@babel/types": "^7.11.0" } }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, "@babel/highlight": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", @@ -3820,18 +3904,18 @@ } }, "@cfstratos/ajsf-core": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@cfstratos/ajsf-core/-/ajsf-core-0.1.5.tgz", - "integrity": "sha512-IMLZJW8I173XovjV7k4hQBXWwr3dPsUa8mLvdVNVUY1RUIv6fY6+QsJXggMb+VMxTSqn+HOq7S1WfEH/Xrt1Dg==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@cfstratos/ajsf-core/-/ajsf-core-0.1.6.tgz", + "integrity": "sha512-G47ZAvn7ynuUkB2XzeewxhDB9yB5EYcBWfmBYB6FeEkFzX9PpcaCm8QK72IO6Kis+HjAvO5kwqiud9TXUPhMNw==", "requires": { "ajv": "^6.10.0", "lodash-es": "^4.17.15" } }, "@cfstratos/ajsf-material": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@cfstratos/ajsf-material/-/ajsf-material-0.1.5.tgz", - "integrity": "sha512-e0BSgFho4D4H76YhRBt9xg5zGuoJlcuMs7eWdSABZhW7LKHKKpLWqoGHo6qX4Q3rFTADxXiljKk86FjrMaYfrQ==", + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@cfstratos/ajsf-material/-/ajsf-material-0.1.6.tgz", + "integrity": "sha512-dUV2aqwQoRCaedNh31ZVZUgDhWqdiJnikag/Nws5h4fFs6sdmL2sS8A18e6onLA8t9t4n0y8PEib6qgxqr3ezw==", "requires": { "@cfstratos/ajsf-core": "~0.1.5", "lodash-es": "^4.17.15" diff --git a/src/frontend/packages/cf-autoscaler/src/cf-autoscaler.module.ts b/src/frontend/packages/cf-autoscaler/src/cf-autoscaler.module.ts index 95b411929b..6474fd5e56 100644 --- a/src/frontend/packages/cf-autoscaler/src/cf-autoscaler.module.ts +++ b/src/frontend/packages/cf-autoscaler/src/cf-autoscaler.module.ts @@ -1,10 +1,10 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { NgxChartsModule } from '@swimlane/ngx-charts'; -import { ExtensionService } from 'frontend/packages/core/src/core/extension/extension-service'; import { CloudFoundrySharedModule } from '../../cloud-foundry/src/shared/cf-shared.module'; import { CoreModule } from '../../core/src/core/core.module'; +import { ExtensionService } from '../../core/src/core/extension/extension-service'; import { MDAppModule } from '../../core/src/core/md.module'; import { SharedModule } from '../../core/src/shared/shared.module'; import { AutoscalerTabExtensionComponent } from './features/autoscaler-tab-extension/autoscaler-tab-extension.component'; diff --git a/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-transform-metric.ts b/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-transform-metric.ts index 899e687833..3e535655bb 100644 --- a/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-transform-metric.ts +++ b/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-transform-metric.ts @@ -1,5 +1,6 @@ -import * as moment from 'moment-timezone'; +import moment from 'moment-timezone'; +import { PaginationResponse } from '../../../../cloud-foundry/src/store/types/cf-api.types'; import { AppAutoscalerMetricBasicInfo, AppAutoscalerMetricData, @@ -10,7 +11,6 @@ import { AppScalingTrigger, } from '../../store/app-autoscaler.types'; import { AutoscalerConstants, getScaleType } from './autoscaler-util'; -import { PaginationResponse } from '../../../../cloud-foundry/src/store/types/cf-api.types'; function initMetricData(metricName: string): AppAutoscalerMetricDataLocal { return { diff --git a/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-transform-policy.ts b/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-transform-policy.ts index 5e11d7642b..b00b5ce017 100644 --- a/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-transform-policy.ts +++ b/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-transform-policy.ts @@ -1,4 +1,4 @@ -import * as moment from 'moment-timezone'; +import moment from 'moment-timezone'; import { AppAutoscalerPolicy, diff --git a/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-util.ts b/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-util.ts index 9e73dfed78..cff3e9856b 100644 --- a/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-util.ts +++ b/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-util.ts @@ -1,4 +1,4 @@ -import * as moment from 'moment-timezone'; +import moment from 'moment-timezone'; import { AppAutoscalerMetricDataPoint, diff --git a/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-validation.ts b/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-validation.ts index 22410741c5..b9300612c4 100644 --- a/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-validation.ts +++ b/src/frontend/packages/cf-autoscaler/src/core/autoscaler-helpers/autoscaler-validation.ts @@ -1,5 +1,5 @@ -import * as intersect from 'intersect'; -import * as moment from 'moment-timezone'; +import intersect from 'intersect'; +import moment from 'moment-timezone'; import { AppRecurringSchedule, AppScalingRule, AppSpecificDate } from '../../store/app-autoscaler.types'; import { AutoscalerConstants } from './autoscaler-util'; diff --git a/src/frontend/packages/cf-autoscaler/src/features/autoscaler-base.component.spec.ts b/src/frontend/packages/cf-autoscaler/src/features/autoscaler-base.component.spec.ts index 5afb7cda0e..29293ef982 100644 --- a/src/frontend/packages/cf-autoscaler/src/features/autoscaler-base.component.spec.ts +++ b/src/frontend/packages/cf-autoscaler/src/features/autoscaler-base.component.spec.ts @@ -8,7 +8,7 @@ import { ApplicationService } from '../../../cloud-foundry/src/features/applicat import { ApplicationServiceMock } from '../../../cloud-foundry/test-framework/application-service-helper'; import { CoreModule } from '../../../core/src/core/core.module'; import { SharedModule } from '../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../core/tab-nav.service'; +import { TabNavService } from '../../../core/src/tab-nav.service'; import { CfAutoscalerTestingModule } from '../cf-autoscaler-testing.module'; import { AutoscalerBaseComponent } from './autoscaler-base.component'; diff --git a/src/frontend/packages/cf-autoscaler/src/features/autoscaler-metric-page/autoscaler-metric-page.component.spec.ts b/src/frontend/packages/cf-autoscaler/src/features/autoscaler-metric-page/autoscaler-metric-page.component.spec.ts index 22140a5cdf..a6b358f4d1 100644 --- a/src/frontend/packages/cf-autoscaler/src/features/autoscaler-metric-page/autoscaler-metric-page.component.spec.ts +++ b/src/frontend/packages/cf-autoscaler/src/features/autoscaler-metric-page/autoscaler-metric-page.component.spec.ts @@ -7,8 +7,9 @@ import { createEmptyStoreModule } from '@stratosui/store/testing'; import { ApplicationService } from '../../../../cloud-foundry/src/features/applications/application.service'; import { ApplicationServiceMock } from '../../../../cloud-foundry/test-framework/application-service-helper'; import { CoreModule } from '../../../../core/src/core/core.module'; +import { CurrentUserPermissionsService } from '../../../../core/src/core/permissions/current-user-permissions.service'; import { SharedModule } from '../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../core/src/tab-nav.service'; import { CfAutoscalerTestingModule } from '../../cf-autoscaler-testing.module'; import { AutoscalerMetricPageComponent } from './autoscaler-metric-page.component'; @@ -30,7 +31,8 @@ describe('AutoscalerMetricPageComponent', () => { providers: [ DatePipe, { provide: ApplicationService, useClass: ApplicationServiceMock }, - TabNavService + TabNavService, + CurrentUserPermissionsService ] }) .compileComponents(); diff --git a/src/frontend/packages/cf-autoscaler/src/features/autoscaler-scale-history-page/autoscaler-scale-history-page.component.spec.ts b/src/frontend/packages/cf-autoscaler/src/features/autoscaler-scale-history-page/autoscaler-scale-history-page.component.spec.ts index 78e8a572a4..477a22f4fa 100644 --- a/src/frontend/packages/cf-autoscaler/src/features/autoscaler-scale-history-page/autoscaler-scale-history-page.component.spec.ts +++ b/src/frontend/packages/cf-autoscaler/src/features/autoscaler-scale-history-page/autoscaler-scale-history-page.component.spec.ts @@ -7,8 +7,9 @@ import { createEmptyStoreModule } from '@stratosui/store/testing'; import { ApplicationService } from '../../../../cloud-foundry/src/features/applications/application.service'; import { ApplicationServiceMock } from '../../../../cloud-foundry/test-framework/application-service-helper'; import { CoreModule } from '../../../../core/src/core/core.module'; +import { CurrentUserPermissionsService } from '../../../../core/src/core/permissions/current-user-permissions.service'; import { SharedModule } from '../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../core/src/tab-nav.service'; import { CfAutoscalerTestingModule } from '../../cf-autoscaler-testing.module'; import { AutoscalerScaleHistoryPageComponent } from './autoscaler-scale-history-page.component'; @@ -30,7 +31,8 @@ describe('AutoscalerScaleHistoryPageComponent', () => { providers: [ DatePipe, { provide: ApplicationService, useClass: ApplicationServiceMock }, - TabNavService + TabNavService, + CurrentUserPermissionsService ] }) .compileComponents(); diff --git a/src/frontend/packages/cf-autoscaler/src/features/autoscaler-tab-extension/autoscaler-tab-extension.component.spec.ts b/src/frontend/packages/cf-autoscaler/src/features/autoscaler-tab-extension/autoscaler-tab-extension.component.spec.ts index b96d66bdb5..43f27e5b57 100644 --- a/src/frontend/packages/cf-autoscaler/src/features/autoscaler-tab-extension/autoscaler-tab-extension.component.spec.ts +++ b/src/frontend/packages/cf-autoscaler/src/features/autoscaler-tab-extension/autoscaler-tab-extension.component.spec.ts @@ -21,7 +21,7 @@ import { import { ApplicationServiceMock } from '../../../../cloud-foundry/test-framework/application-service-helper'; import { CoreModule } from '../../../../core/src/core/core.module'; import { SharedModule } from '../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../core/src/tab-nav.service'; import { CfAutoscalerTestingModule } from '../../cf-autoscaler-testing.module'; import { CardAutoscalerDefaultComponent } from '../../shared/card-autoscaler-default/card-autoscaler-default.component'; import { AutoscalerTabExtensionComponent } from './autoscaler-tab-extension.component'; diff --git a/src/frontend/packages/cf-autoscaler/src/features/autoscaler-tab-extension/autoscaler-tab-extension.component.ts b/src/frontend/packages/cf-autoscaler/src/features/autoscaler-tab-extension/autoscaler-tab-extension.component.ts index 9b3b56c9b2..a71a1e76e1 100644 --- a/src/frontend/packages/cf-autoscaler/src/features/autoscaler-tab-extension/autoscaler-tab-extension.component.ts +++ b/src/frontend/packages/cf-autoscaler/src/features/autoscaler-tab-extension/autoscaler-tab-extension.component.ts @@ -71,7 +71,7 @@ import { appAutoscalerAppMetricEntityType, autoscalerEntityFactory } from '../.. createEntityRelationKey(spaceEntityType, organizationEntityType), ], populateMissing: true - }) + }); const canEditApp$ = appEntService.waitForEntity$.pipe( switchMap(app => cups.can( @@ -80,14 +80,14 @@ import { appAutoscalerAppMetricEntityType, autoscalerEntityFactory } from '../.. app.entity.entity.space.entity.organization_guid, app.entity.entity.space.metadata.guid )), - ) + ); const autoscalerEnabled = isAutoscalerEnabled(endpointGuid, esf); return canEditApp$.pipe( switchMap(canEditSpace => canEditSpace ? autoscalerEnabled : of(false)), map(can => !can) - ) + ); } }) @Component({ @@ -179,9 +179,9 @@ export class AutoscalerTabExtensionComponent implements OnInit, OnDestroy { if (buildParts.length < 0) { return false; } - return Number.parseInt(buildParts[0]) >= 3 + return Number.parseInt(buildParts[0], 10) >= 3; }) - ) + ); this.appAutoscalerPolicyService = this.entityServiceFactory.create( this.applicationService.appGuid, @@ -360,7 +360,7 @@ export class AutoscalerTabExtensionComponent implements OnInit, OnDestroy { ], query })); - } + }; metricChartPage() { this.store.dispatch(new RouterNav({ @@ -402,6 +402,6 @@ export class AutoscalerTabExtensionComponent implements OnInit, OnDestroy { 'edit-autoscaler-credential' ] })); - } + }; } diff --git a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-credential/edit-autoscaler-credential.component.spec.ts b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-credential/edit-autoscaler-credential.component.spec.ts index 131139620e..847513f52e 100644 --- a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-credential/edit-autoscaler-credential.component.spec.ts +++ b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-credential/edit-autoscaler-credential.component.spec.ts @@ -6,8 +6,9 @@ import { RouterTestingModule } from '@angular/router/testing'; import { ApplicationService } from '../../../../cloud-foundry/src/features/applications/application.service'; import { ApplicationServiceMock } from '../../../../cloud-foundry/test-framework/application-service-helper'; import { CoreModule } from '../../../../core/src/core/core.module'; +import { CurrentUserPermissionsService } from '../../../../core/src/core/permissions/current-user-permissions.service'; import { SharedModule } from '../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../core/src/tab-nav.service'; import { createBasicStoreModule } from '../../../../store/testing/public-api'; import { CfAutoscalerTestingModule } from '../../cf-autoscaler-testing.module'; import { EditAutoscalerCredentialComponent } from './edit-autoscaler-credential.component'; @@ -33,6 +34,7 @@ describe('EditAutoscalerCredentialComponent', () => { DatePipe, { provide: ApplicationService, useClass: ApplicationServiceMock }, TabNavService, + CurrentUserPermissionsService ] }) .compileComponents(); diff --git a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-service.ts b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-service.ts index fc6f92c265..a49603e247 100644 --- a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-service.ts +++ b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import * as moment from 'moment-timezone'; +import moment from 'moment-timezone'; import { BehaviorSubject, Observable } from 'rxjs'; import { filter, first } from 'rxjs/operators'; diff --git a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step1/edit-autoscaler-policy-step1.component.spec.ts b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step1/edit-autoscaler-policy-step1.component.spec.ts index 02095792e5..5dd121d938 100644 --- a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step1/edit-autoscaler-policy-step1.component.spec.ts +++ b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step1/edit-autoscaler-policy-step1.component.spec.ts @@ -8,7 +8,7 @@ import { ApplicationService } from '../../../../../cloud-foundry/src/features/ap import { ApplicationServiceMock } from '../../../../../cloud-foundry/test-framework/application-service-helper'; import { CoreModule } from '../../../../../core/src/core/core.module'; import { SharedModule } from '../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { CfAutoscalerTestingModule } from '../../../cf-autoscaler-testing.module'; import { EditAutoscalerPolicyService } from '../edit-autoscaler-policy-service'; import { EditAutoscalerPolicyStep1Component } from './edit-autoscaler-policy-step1.component'; diff --git a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step1/edit-autoscaler-policy-step1.component.ts b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step1/edit-autoscaler-policy-step1.component.ts index dc3be58839..1ff96089b9 100644 --- a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step1/edit-autoscaler-policy-step1.component.ts +++ b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step1/edit-autoscaler-policy-step1.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { AbstractControl, FormBuilder, FormGroup, ValidatorFn, Validators } from '@angular/forms'; import { ErrorStateMatcher, ShowOnDirtyErrorStateMatcher } from '@angular/material/core'; import { ActivatedRoute } from '@angular/router'; -import * as moment from 'moment-timezone'; +import moment from 'moment-timezone'; import { of as observableOf } from 'rxjs'; import { map } from 'rxjs/operators'; diff --git a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step2/edit-autoscaler-policy-step2.component.spec.ts b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step2/edit-autoscaler-policy-step2.component.spec.ts index 05552c2692..809b56d90d 100644 --- a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step2/edit-autoscaler-policy-step2.component.spec.ts +++ b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step2/edit-autoscaler-policy-step2.component.spec.ts @@ -8,7 +8,7 @@ import { ApplicationService } from '../../../../../cloud-foundry/src/features/ap import { ApplicationServiceMock } from '../../../../../cloud-foundry/test-framework/application-service-helper'; import { CoreModule } from '../../../../../core/src/core/core.module'; import { SharedModule } from '../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { EditAutoscalerPolicyService } from '../edit-autoscaler-policy-service'; import { EditAutoscalerPolicyStep2Component } from './edit-autoscaler-policy-step2.component'; diff --git a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step3/edit-autoscaler-policy-step3.component.spec.ts b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step3/edit-autoscaler-policy-step3.component.spec.ts index 01d38f4030..c154204509 100644 --- a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step3/edit-autoscaler-policy-step3.component.spec.ts +++ b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step3/edit-autoscaler-policy-step3.component.spec.ts @@ -8,7 +8,7 @@ import { ApplicationService } from '../../../../../cloud-foundry/src/features/ap import { ApplicationServiceMock } from '../../../../../cloud-foundry/test-framework/application-service-helper'; import { CoreModule } from '../../../../../core/src/core/core.module'; import { SharedModule } from '../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { EditAutoscalerPolicyService } from '../edit-autoscaler-policy-service'; import { EditAutoscalerPolicyStep3Component } from './edit-autoscaler-policy-step3.component'; diff --git a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step3/edit-autoscaler-policy-step3.component.ts b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step3/edit-autoscaler-policy-step3.component.ts index 542688df0a..a8d47f628b 100644 --- a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step3/edit-autoscaler-policy-step3.component.ts +++ b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step3/edit-autoscaler-policy-step3.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { AbstractControl, FormBuilder, FormGroup, ValidatorFn, Validators } from '@angular/forms'; import { ErrorStateMatcher, ShowOnDirtyErrorStateMatcher } from '@angular/material/core'; import { ActivatedRoute } from '@angular/router'; -import * as moment from 'moment-timezone'; +import moment from 'moment-timezone'; import { ApplicationService } from '../../../../../cloud-foundry/src/features/applications/application.service'; import { AutoscalerConstants, PolicyAlert, shiftArray } from '../../../core/autoscaler-helpers/autoscaler-util'; @@ -12,11 +12,7 @@ import { recurringSchedulesOverlapping, timeIsSameOrAfter, } from '../../../core/autoscaler-helpers/autoscaler-validation'; -import { - AppAutoscalerInvalidPolicyError, - AppAutoscalerPolicy, - AppAutoscalerPolicyLocal, -} from '../../../store/app-autoscaler.types'; +import { AppAutoscalerInvalidPolicyError, AppAutoscalerPolicyLocal } from '../../../store/app-autoscaler.types'; import { EditAutoscalerPolicy } from '../edit-autoscaler-policy-base-step'; import { EditAutoscalerPolicyService } from '../edit-autoscaler-policy-service'; import { diff --git a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step4/edit-autoscaler-policy-step4.component.spec.ts b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step4/edit-autoscaler-policy-step4.component.spec.ts index a2f2dab563..4c5e3f48fc 100644 --- a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step4/edit-autoscaler-policy-step4.component.spec.ts +++ b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step4/edit-autoscaler-policy-step4.component.spec.ts @@ -8,7 +8,7 @@ import { ApplicationService } from '../../../../../cloud-foundry/src/features/ap import { ApplicationServiceMock } from '../../../../../cloud-foundry/test-framework/application-service-helper'; import { CoreModule } from '../../../../../core/src/core/core.module'; import { SharedModule } from '../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { CfAutoscalerTestingModule } from '../../../cf-autoscaler-testing.module'; import { EditAutoscalerPolicyService } from '../edit-autoscaler-policy-service'; import { EditAutoscalerPolicyStep4Component } from './edit-autoscaler-policy-step4.component'; diff --git a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step4/edit-autoscaler-policy-step4.component.ts b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step4/edit-autoscaler-policy-step4.component.ts index 78198371b8..3050f2caad 100644 --- a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step4/edit-autoscaler-policy-step4.component.ts +++ b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy-step4/edit-autoscaler-policy-step4.component.ts @@ -3,15 +3,15 @@ import { AbstractControl, FormBuilder, FormGroup, ValidatorFn, Validators } from import { ErrorStateMatcher, ShowOnDirtyErrorStateMatcher } from '@angular/material/core'; import { ActivatedRoute } from '@angular/router'; import { Store } from '@ngrx/store'; -import * as moment from 'moment-timezone'; +import moment from 'moment-timezone'; import { of as observableOf } from 'rxjs'; import { filter, first, map, pairwise } from 'rxjs/operators'; import { ApplicationService } from '../../../../../cloud-foundry/src/features/applications/application.service'; -import { EntityService } from '../../../../../store/src/entity-service'; -import { EntityServiceFactory } from '../../../../../store/src/entity-service-factory.service'; import { StepOnNextFunction } from '../../../../../core/src/shared/components/stepper/step/step.component'; import { AppState } from '../../../../../store/src/app-state'; +import { EntityService } from '../../../../../store/src/entity-service'; +import { EntityServiceFactory } from '../../../../../store/src/entity-service-factory.service'; import { RequestInfoState } from '../../../../../store/src/reducers/api-request-reducer/types'; import { AutoscalerConstants, PolicyAlert } from '../../../core/autoscaler-helpers/autoscaler-util'; import { diff --git a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy.component.spec.ts b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy.component.spec.ts index 9be13c7f96..bfab3dab44 100644 --- a/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy.component.spec.ts +++ b/src/frontend/packages/cf-autoscaler/src/features/edit-autoscaler-policy/edit-autoscaler-policy.component.spec.ts @@ -7,8 +7,9 @@ import { createEmptyStoreModule } from '@stratosui/store/testing'; import { ApplicationService } from '../../../../cloud-foundry/src/features/applications/application.service'; import { ApplicationServiceMock } from '../../../../cloud-foundry/test-framework/application-service-helper'; import { CoreModule } from '../../../../core/src/core/core.module'; +import { CurrentUserPermissionsService } from '../../../../core/src/core/permissions/current-user-permissions.service'; import { SharedModule } from '../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../core/src/tab-nav.service'; import { CfAutoscalerTestingModule } from '../../cf-autoscaler-testing.module'; import { EditAutoscalerPolicyService } from './edit-autoscaler-policy-service'; import { EditAutoscalerPolicyStep1Component } from './edit-autoscaler-policy-step1/edit-autoscaler-policy-step1.component'; @@ -43,6 +44,7 @@ describe('EditAutoscalerPolicyComponent', () => { { provide: ApplicationService, useClass: ApplicationServiceMock }, TabNavService, EditAutoscalerPolicyService, + CurrentUserPermissionsService ] }) .compileComponents(); diff --git a/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-event/cf-app-autoscaler-events-config.service.ts b/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-event/cf-app-autoscaler-events-config.service.ts index 8732d20bfb..80a55eeb41 100644 --- a/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-event/cf-app-autoscaler-events-config.service.ts +++ b/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-event/cf-app-autoscaler-events-config.service.ts @@ -1,7 +1,7 @@ import { DatePipe } from '@angular/common'; import { Injectable } from '@angular/core'; import { Store } from '@ngrx/store'; -import * as moment from 'moment'; +import moment from 'moment'; import { CFAppState } from '../../../../../cloud-foundry/src/cf-app-state'; import { ApplicationService } from '../../../../../cloud-foundry/src/features/applications/application.service'; diff --git a/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-card/combo-chart/combo-series-vertical.component.spec.ts b/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-card/combo-chart/combo-series-vertical.component.spec.ts index 367ee3f0d1..4c3f7879ac 100644 --- a/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-card/combo-chart/combo-series-vertical.component.spec.ts +++ b/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-card/combo-chart/combo-series-vertical.component.spec.ts @@ -9,7 +9,7 @@ import { ApplicationService } from '../../../../../../../cloud-foundry/src/featu import { ApplicationServiceMock } from '../../../../../../../cloud-foundry/test-framework/application-service-helper'; import { CoreModule } from '../../../../../../../core/src/core/core.module'; import { SharedModule } from '../../../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../../core/src/tab-nav.service'; import { AppAutoscalerComboSeriesVerticalComponent } from './combo-series-vertical.component'; describe('AppAutoscalerComboSeriesVerticalComponent', () => { diff --git a/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-list-config.service.ts b/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-list-config.service.ts index a5c3fd8aef..7d425f7bbe 100644 --- a/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-list-config.service.ts +++ b/src/frontend/packages/cf-autoscaler/src/shared/list-types/app-autoscaler-metric-chart/app-autoscaler-metric-chart-list-config.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { Store } from '@ngrx/store'; -import * as moment from 'moment'; +import moment from 'moment'; import { CFAppState } from '../../../../../cloud-foundry/src/cf-app-state'; import { ApplicationService } from '../../../../../cloud-foundry/src/features/applications/application.service'; diff --git a/src/frontend/packages/cloud-foundry/src/actions/app-variables.actions.ts b/src/frontend/packages/cloud-foundry/src/actions/app-variables.actions.ts index 8a9f974710..fc38618e9a 100644 --- a/src/frontend/packages/cloud-foundry/src/actions/app-variables.actions.ts +++ b/src/frontend/packages/cloud-foundry/src/actions/app-variables.actions.ts @@ -11,9 +11,10 @@ export class AppVariablesUpdate implements Action { type = AppVariables.UPDATE; updatedApplication: UpdateApplication; + guid: string; constructor(public cfGuid: string, public appGuid: string) { - this.guid = 'n/a' // No such thing as an individual app variable guid + this.guid = 'n/a'; // No such thing as an individual app variable guid } protected createUpdateApplication(allEnvVars: ListAppEnvVar[], selectedItems: ListAppEnvVar[]): UpdateApplication { @@ -28,7 +29,6 @@ export class AppVariablesUpdate implements Action { } return updateApp; } - guid: string; } export class AppVariablesDelete extends AppVariablesUpdate { diff --git a/src/frontend/packages/cloud-foundry/src/actions/deploy-applications.actions.ts b/src/frontend/packages/cloud-foundry/src/actions/deploy-applications.actions.ts index 9604b767da..17c35c2e7f 100644 --- a/src/frontend/packages/cloud-foundry/src/actions/deploy-applications.actions.ts +++ b/src/frontend/packages/cloud-foundry/src/actions/deploy-applications.actions.ts @@ -86,6 +86,7 @@ export class FetchBranchesForProject implements PaginatedAction { type = FETCH_BRANCHES_FOR_PROJECT; entityType = gitBranchesEntityType; paginationKey: string; + flattenPagination = true; static createPaginationKey = (scm: GitSCM, projectName: string) => scm.getType() + ':' + projectName; } diff --git a/src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts b/src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts index 07b5489a05..20e226cbd5 100644 --- a/src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts +++ b/src/frontend/packages/cloud-foundry/src/cf-entity-generator.ts @@ -1,5 +1,5 @@ import { Action, Store } from '@ngrx/store'; -import * as moment from 'moment'; +import moment from 'moment'; import { combineLatest, Observable, of } from 'rxjs'; import { first, map } from 'rxjs/operators'; @@ -299,14 +299,14 @@ export function generateCFEntities(): StratosBaseCatalogEntity[] { }, entitiesEmitHandler: (action: PaginatedAction | PaginatedAction[], dispatcher: ActionDispatcher) => { let lastValidationFootprint: string; - const arrayAction = Array.isArray(action) ? action : [action]; + const actionsArray = Array.isArray(action) ? action : [action]; return (state: PaginationEntityState) => { const newValidationFootprint = getPaginationCompareString(state); if (lastValidationFootprint !== newValidationFootprint) { lastValidationFootprint = newValidationFootprint; - arrayAction.forEach(action => dispatcher(new CfValidateEntitiesStart( - action, - state.ids[action.__forcedPageNumber__ || state.currentPage] + actionsArray.forEach(actionFromArray => dispatcher(new CfValidateEntitiesStart( + actionFromArray, + state.ids[actionFromArray.__forcedPageNumber__ || state.currentPage] ))); } }; @@ -314,7 +314,7 @@ export function generateCFEntities(): StratosBaseCatalogEntity[] { entitiesFetchHandler: (store: Store, actions: PaginatedAction[]) => () => { combineLatest(actions.map(action => safePopulatePaginationFromParent(store, action))).pipe( first(), - ).subscribe(actions => actions.forEach(action => store.dispatch(action))); + ).subscribe(newActions => newActions.forEach(newAction => store.dispatch(newAction))); }, paginationConfig: { getEntitiesFromResponse: (response: CFResponse) => response.resources, @@ -1231,7 +1231,7 @@ function generateCfOrgEntity(endpointDefinition: StratosEndpointExtensionDefinit labelPlural: 'Organizations', endpoint: endpointDefinition, icon: 'organization', - iconFont: 'stratos-icons' + iconFont: 'stratos-icons' }; cfEntityCatalog.org = new StratosCatalogEntity< IOrgFavMetadata, diff --git a/src/frontend/packages/cloud-foundry/src/cloud-foundry-test.module.ts b/src/frontend/packages/cloud-foundry/src/cloud-foundry-test.module.ts index 2bc284c36c..3df3235a19 100644 --- a/src/frontend/packages/cloud-foundry/src/cloud-foundry-test.module.ts +++ b/src/frontend/packages/cloud-foundry/src/cloud-foundry-test.module.ts @@ -4,7 +4,6 @@ import { EffectsModule } from '@ngrx/effects'; import { generateASEntities } from '../../cf-autoscaler/src/store/autoscaler-entity-generator'; import { getGitHubAPIURL, GITHUB_API_URL } from '../../core/src/core/github.helpers'; -import { LoggerService } from '../../core/src/core/logger.service'; import { CATALOGUE_ENTITIES, EntityCatalogFeatureModule } from '../../store/src/entity-catalog.module'; import { entityCatalog, TestEntityCatalog } from '../../store/src/entity-catalog/entity-catalog'; import { generateStratosEntities } from '../../store/src/stratos-entity-generator'; @@ -42,7 +41,6 @@ import { CloudFoundryStoreModule } from './store/cloud-foundry.store.module'; providers: [ { provide: GITHUB_API_URL, useFactory: getGitHubAPIURL }, GitSCMService, - LoggerService, LongRunningCfOperationsService, CfUserService, { diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/application-delete/application-delete.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/applications/application-delete/application-delete.component.spec.ts index 52aa6ff434..8137d582fc 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/application-delete/application-delete.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/application-delete/application-delete.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateTestApplicationServiceProvider } from '../../../../test-framework/application-service-helper'; import { generateCfBaseTestModules } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { ApplicationsModule } from '../applications.module'; diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/application-wall/application-wall.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/applications/application-wall/application-wall.component.spec.ts index e92a929b87..e7060da064 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/application-wall/application-wall.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/application-wall/application-wall.component.spec.ts @@ -1,7 +1,7 @@ import { DatePipe } from '@angular/common'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { CfEndpointsMissingComponent } from '../../../shared/components/cf-endpoints-missing/cf-endpoints-missing.component'; import { CloudFoundryService } from '../../../shared/data-services/cloud-foundry.service'; diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/application-tabs-base.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/application-tabs-base.component.spec.ts index 19c49370d4..db27792fcc 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/application-tabs-base.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/application-tabs-base.component.spec.ts @@ -9,7 +9,7 @@ import { CoreModule } from '../../../../../../core/src/core/core.module'; import { getGitHubAPIURL, GITHUB_API_URL } from '../../../../../../core/src/core/github.helpers'; import { MDAppModule } from '../../../../../../core/src/core/md.module'; import { SharedModule } from '../../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../core/src/tab-nav.service'; import { generateTestApplicationServiceProvider } from '../../../../../test-framework/application-service-helper'; import { generateCfStoreModules } from '../../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { ApplicationStateService } from '../../../../shared/services/application-state.service'; diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/build-tab/build-tab.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/build-tab/build-tab.component.spec.ts index 58a38edbe5..6f3aa1d408 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/build-tab/build-tab.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/build-tab/build-tab.component.spec.ts @@ -8,7 +8,7 @@ import { CoreModule } from '../../../../../../../../core/src/core/core.module'; import { GITHUB_API_URL } from '../../../../../../../../core/src/core/github.helpers'; import { APP_GUID, CF_GUID } from '../../../../../../../../core/src/shared/entity.tokens'; import { SharedModule } from '../../../../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../../../core/src/tab-nav.service'; import { AppStoreModule } from '../../../../../../../../store/src/store.module'; import { ApplicationServiceMock } from '../../../../../../../test-framework/application-service-helper'; import { generateCfStoreModules } from '../../../../../../../test-framework/cloud-foundry-endpoint-service.helper'; diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/gitscm-tab/gitscm-tab.component.ts b/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/gitscm-tab/gitscm-tab.component.ts index 528965f3c9..32d2c03c3e 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/gitscm-tab/gitscm-tab.component.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/gitscm-tab/gitscm-tab.component.ts @@ -81,16 +81,16 @@ export class GitSCMTabComponent implements OnInit, OnDestroy { const scm = this.scmService.getSCM(scmType as GitSCMType); const gitRepInfoMeta: GitMeta = { projectName: stProject.deploySource.project, scm }; - this.gitSCMRepoEntityService = cfEntityCatalog.gitRepo.store.getRepoInfo.getEntityService(gitRepInfoMeta) + this.gitSCMRepoEntityService = cfEntityCatalog.gitRepo.store.getRepoInfo.getEntityService(gitRepInfoMeta); const gitMeta: GitMeta = { projectName: stProject.deploySource.project, scm, commitSha }; const repoEntityID = `${scmType}-${projectName}`; const commitEntityID = `${repoEntityID}-${commitSha}`; // FIXME: Should come from action #4245 - this.gitCommitEntityService = cfEntityCatalog.gitCommit.store.getEntityService(commitEntityID, null, gitMeta) + this.gitCommitEntityService = cfEntityCatalog.gitCommit.store.getEntityService(commitEntityID, null, gitMeta); this.gitBranchEntityService = cfEntityCatalog.gitBranch.store.getEntityService(undefined, undefined, { scm, - projectName: projectName, + projectName, branchName: stProject.deploySource.branch }); diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/log-stream-tab/log-stream-tab.component.ts b/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/log-stream-tab/log-stream-tab.component.ts index e4226d87c0..cc4a4f4bd7 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/log-stream-tab/log-stream-tab.component.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/log-stream-tab/log-stream-tab.component.ts @@ -1,13 +1,12 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { NgModel } from '@angular/forms'; import { Store } from '@ngrx/store'; -import * as moment from 'moment'; +import moment from 'moment'; import { NEVER, Observable, Subject } from 'rxjs'; import makeWebSocketObservable, { GetWebSocketResponses } from 'rxjs-websockets'; -import { catchError, share, switchMap, map, first, startWith, debounceTime } from 'rxjs/operators'; +import { catchError, debounceTime, first, map, share, startWith, switchMap } from 'rxjs/operators'; import { CFAppState } from '../../../../../../../../cloud-foundry/src/cf-app-state'; -import { LoggerService } from '../../../../../../../../core/src/core/logger.service'; import { AnsiColorizer } from '../../../../../../../../core/src/shared/components/log-viewer/ansi-colorizer'; import { ApplicationService } from '../../../../application.service'; @@ -39,7 +38,6 @@ export class LogStreamTabComponent implements OnInit { constructor( private applicationService: ApplicationService, private store: Store, - private logService: LoggerService ) { this.filter = this.jsonFilter.bind(this); } @@ -55,7 +53,7 @@ export class LogStreamTabComponent implements OnInit { }/apps/${this.applicationService.appGuid}/stream`; const socket$ = makeWebSocketObservable(streamUrl).pipe(catchError(e => { - this.logService.error( + console.error( 'Error while connecting to socket: ' + JSON.stringify(e) ); return []; @@ -110,7 +108,7 @@ export class LogStreamTabComponent implements OnInit { const messageString = this.colorizer.colorize(atob(messageObj.message), msgColour, bold) + '\n'; return timeStamp + ': ' + messageSource + ' ' + messageString; } catch (error) { - this.logService.error('Failed to filter jsonMessage from WebSocket: ' + JSON.stringify(error)); + console.error('Failed to filter jsonMessage from WebSocket: ' + JSON.stringify(error)); return jsonString; } } diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/variables-tab/variables-tab.component.ts b/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/variables-tab/variables-tab.component.ts index cec72a0142..ff7c2f0fe3 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/variables-tab/variables-tab.component.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/application/application-tabs-base/tabs/variables-tab/variables-tab.component.ts @@ -4,19 +4,18 @@ import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { CFAppState } from '../../../../../../../../cloud-foundry/src/cf-app-state'; -import { LoggerService } from '../../../../../../../../core/src/core/logger.service'; import { ListDataSource, } from '../../../../../../../../core/src/shared/components/list/data-sources-controllers/list-data-source'; +import { ListConfig } from '../../../../../../../../core/src/shared/components/list/list.component.types'; +import { stratosEndpointGuidKey } from '../../../../../../../../store/src/entity-request-pipeline/pipeline.types'; import { ListAppEnvVar, } from '../../../../../../shared/components/list/list-types/app-variables/cf-app-variables-data-source'; import { CfAppVariablesListConfigService, } from '../../../../../../shared/components/list/list-types/app-variables/cf-app-variables-list-config.service'; -import { ListConfig } from '../../../../../../../../core/src/shared/components/list/list.component.types'; import { ApplicationService } from '../../../../application.service'; -import { stratosEndpointGuidKey } from '../../../../../../../../store/src/entity-request-pipeline/pipeline.types'; export interface VariableTabAllEnvVarType { name: string; @@ -39,7 +38,6 @@ export class VariablesTabComponent implements OnInit { private store: Store, private appService: ApplicationService, private listConfig: ListConfig, - private loggerService: LoggerService ) { this.envVarsDataSource = listConfig.getDataSource(); } @@ -96,7 +94,7 @@ export class VariablesTabComponent implements OnInit { try { return JSON.parse(value); } catch (err) { - this.loggerService.debug('Failed to parse STRATOS_PROJECT env var', err); + console.warn('Failed to parse STRATOS_PROJECT env var', err); } return ''; } diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/cli-info-application/cli-info-application.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/applications/cli-info-application/cli-info-application.component.spec.ts index ff36e161d2..7c10059edc 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/cli-info-application/cli-info-application.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/cli-info-application/cli-info-application.component.spec.ts @@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { CoreModule } from '../../../../../core/src/core/core.module'; import { MDAppModule } from '../../../../../core/src/core/md.module'; import { SharedModule } from '../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateTestApplicationServiceProvider } from '../../../../test-framework/application-service-helper'; import { generateCfStoreModules } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { CloudFoundrySharedModule } from '../../../shared/cf-shared.module'; diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/create-application/create-application.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/applications/create-application/create-application.component.spec.ts index 0d161c70ff..482334781b 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/create-application/create-application.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/create-application/create-application.component.spec.ts @@ -7,7 +7,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { CoreModule } from '../../../../../core/src/core/core.module'; import { SharedModule } from '../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { EntityMonitorFactory } from '../../../../../store/src/monitors/entity-monitor.factory.service'; import { InternalEventMonitorFactory } from '../../../../../store/src/monitors/internal-event-monitor.factory'; import { PaginationMonitorFactory } from '../../../../../store/src/monitors/pagination-monitor.factory'; diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/deploy-application/deploy-application-step2/deploy-application-step2.component.ts b/src/frontend/packages/cloud-foundry/src/features/applications/deploy-application/deploy-application-step2/deploy-application-step2.component.ts index da3babd5ca..59f9703e0a 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/deploy-application/deploy-application-step2/deploy-application-step2.component.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/deploy-application/deploy-application-step2/deploy-application-step2.component.ts @@ -247,7 +247,7 @@ export class DeployApplicationStep2Component .pipe( // Wait for a new project name change filter(state => state && !state.checking && !state.error && state.exists), - distinctUntilChanged((x, y) => x.name === y.name), + distinctUntilChanged((x, y) => x.name.toLowerCase() === y.name.toLowerCase()), // Convert project name into branches pagination observable switchMap(state => cfEntityCatalog.gitBranch.store.getPaginationService(null, null, { diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/deploy-application/deploy-application.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/applications/deploy-application/deploy-application.component.spec.ts index 109a98e22f..2124a1e765 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/deploy-application/deploy-application.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/deploy-application/deploy-application.component.spec.ts @@ -7,7 +7,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { CoreModule } from '../../../../../core/src/core/core.module'; import { getGitHubAPIURL, GITHUB_API_URL } from '../../../../../core/src/core/github.helpers'; import { SharedModule } from '../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateCfStoreModules } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { CloudFoundrySharedModule } from '../../../shared/cf-shared.module'; import { CfOrgSpaceDataService } from '../../../shared/data-services/cf-org-space-service.service'; diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/deploy-application/github-project-exists.directive.ts b/src/frontend/packages/cloud-foundry/src/features/applications/deploy-application/github-project-exists.directive.ts index ac555207ef..a053f51d2c 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/deploy-application/github-project-exists.directive.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/deploy-application/github-project-exists.directive.ts @@ -14,11 +14,9 @@ interface GithubProjectExistsResponse { githubProjectError: string; } -/* tslint:disable:no-use-before-declare */ const GITHUB_PROJECT_EXISTS = { provide: NG_ASYNC_VALIDATORS, useExisting: forwardRef(() => GithubProjectExistsDirective), multi: true }; -/* tslint:enable */ @Directive({ selector: '[appGithubProjectExists][ngModel]', diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/edit-application/edit-application.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/applications/edit-application/edit-application.component.spec.ts index e5de781a2a..a7ec509698 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/edit-application/edit-application.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/edit-application/edit-application.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { CoreModule } from '../../../../../core/src/core/core.module'; import { SharedModule } from '../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { ApplicationServiceMock, generateTestApplicationServiceProvider, diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/new-application-base-step/new-application-base-step.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/applications/new-application-base-step/new-application-base-step.component.spec.ts index 7ad81b99f5..3b84e92f6c 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/new-application-base-step/new-application-base-step.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/new-application-base-step/new-application-base-step.component.spec.ts @@ -3,7 +3,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { CoreModule } from '../../../../../core/src/core/core.module'; import { SharedModule } from '../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateCfStoreModules } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { ApplicationDeploySourceTypes } from '../deploy-application/deploy-application-steps.types'; import { NewApplicationBaseStepComponent } from './new-application-base-step.component'; diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/routes/add-route-stepper/add-route-stepper.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/applications/routes/add-route-stepper/add-route-stepper.component.spec.ts index f06e6bbbd2..4c544e020f 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/routes/add-route-stepper/add-route-stepper.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/routes/add-route-stepper/add-route-stepper.component.spec.ts @@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { CoreModule } from '../../../../../../core/src/core/core.module'; import { SteppersModule } from '../../../../../../core/src/shared/components/stepper/steppers.module'; import { SharedModule } from '../../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../core/src/tab-nav.service'; import { ApplicationServiceMock } from '../../../../../test-framework/application-service-helper'; import { generateCfStoreModules } from '../../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { ApplicationService } from '../../application.service'; diff --git a/src/frontend/packages/cloud-foundry/src/features/applications/ssh-application/ssh-application.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/applications/ssh-application/ssh-application.component.spec.ts index 3454569951..ea7a43c9c2 100644 --- a/src/frontend/packages/cloud-foundry/src/features/applications/ssh-application/ssh-application.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/applications/ssh-application/ssh-application.component.spec.ts @@ -3,7 +3,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { CoreModule } from '../../../../../core/src/core/core.module'; import { SharedModule } from '../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { ApplicationServiceMock } from '../../../../test-framework/application-service-helper'; import { generateCfStoreModules } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { ApplicationService } from '../application.service'; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/add-organization/add-organization.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/add-organization/add-organization.component.spec.ts index 7af9fd0150..0db36dc5a0 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/add-organization/add-organization.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/add-organization/add-organization.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { AddOrganizationComponent } from './add-organization.component'; import { CreateOrganizationStepComponent } from './create-organization-step/create-organization-step.component'; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/add-quota/add-quota.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/add-quota/add-quota.component.spec.ts index 80bc70ebd1..ef3767615e 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/add-quota/add-quota.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/add-quota/add-quota.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { LongRunningCfOperationsService } from '../../../shared/data-services/long-running-cf-op.service'; import { QuotaDefinitionFormComponent } from '../quota-definition-form/quota-definition-form.component'; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/add-space-quota/add-space-quota.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/add-space-quota/add-space-quota.component.spec.ts index a9f62d776d..dd5ecaaa40 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/add-space-quota/add-space-quota.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/add-space-quota/add-space-quota.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { CFBaseTestModules } from '../../../../test-framework/cf-test-helper'; import { SpaceQuotaDefinitionFormComponent } from '../space-quota-definition-form/space-quota-definition-form.component'; import { AddSpaceQuotaComponent } from './add-space-quota.component'; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/add-space/add-space.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/add-space/add-space.component.spec.ts index 0684912834..ff17123de0 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/add-space/add-space.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/add-space/add-space.component.spec.ts @@ -1,10 +1,9 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../core/tab-nav.service'; -import { generateCfBaseTestModules } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; +import { CFBaseTestModules } from '../../../../test-framework/cf-test-helper'; import { AddSpaceComponent } from './add-space.component'; import { CreateSpaceStepComponent } from './create-space-step/create-space-step.component'; -import { CFBaseTestModules } from '../../../../test-framework/cf-test-helper'; describe('AddSpaceComponent', () => { let component: AddSpaceComponent; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/cf.helpers.ts b/src/frontend/packages/cloud-foundry/src/features/cf/cf.helpers.ts index a4ddeb40cf..fb946f7108 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/cf.helpers.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/cf.helpers.ts @@ -358,7 +358,7 @@ export const cfOrgSpaceFilter = (entities: APIResource[], paginationState: Pagin const fetchOrgGuid = (e: APIResource): string => { return e.entity.space ? e.entity.space.entity.organization_guid : null; - } + }; // Filter by cf/org/space const cfGuid = paginationState.clientPagination.filter.items.cf; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/cli-info-cloud-foundry/cli-info-cloud-foundry.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/cli-info-cloud-foundry/cli-info-cloud-foundry.component.spec.ts index 25e3004052..9f5b515cad 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/cli-info-cloud-foundry/cli-info-cloud-foundry.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/cli-info-cloud-foundry/cli-info-cloud-foundry.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules, generateTestCfEndpointServiceProvider, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry-section.module.ts b/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry-section.module.ts index aa22c90c69..688e900238 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry-section.module.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry-section.module.ts @@ -129,8 +129,6 @@ import { import { UsersRolesComponent } from './users/manage-users/manage-users.component'; import { RemoveUserComponent } from './users/remove-user/remove-user.component'; -/* tslint:disable:max-line-length */ - @NgModule({ imports: [ CommonModule, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry-section.routing.ts b/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry-section.routing.ts index b8b6a008f3..53f11cea56 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry-section.routing.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry-section.routing.ts @@ -90,11 +90,6 @@ import { InviteUsersComponent } from './users/invite-users/invite-users.componen import { UsersRolesComponent } from './users/manage-users/manage-users.component'; import { RemoveUserComponent } from './users/remove-user/remove-user.component'; -/* tslint:disable:max-line-length */ - - -/* tslint:enable:max-line-length */ - const usersRoles = [ { path: 'users/manage', diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry-tabs-base/cloud-foundry-tabs-base.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry-tabs-base/cloud-foundry-tabs-base.component.spec.ts index 726f61014c..27d8cdfc0c 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry-tabs-base/cloud-foundry-tabs-base.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry-tabs-base/cloud-foundry-tabs-base.component.spec.ts @@ -1,7 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { populateStoreWithTestEndpoint, testSCFEndpointGuid } from '@stratosui/store/testing'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules, generateTestCfEndpointServiceProvider, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry/cloud-foundry.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry/cloud-foundry.component.spec.ts index 4b8d81f2a0..6067c9a0e9 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry/cloud-foundry.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/cloud-foundry/cloud-foundry.component.spec.ts @@ -1,7 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { populateStoreWithTestEndpoint } from '@stratosui/store/testing'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { PaginationMonitorFactory } from '../../../../../store/src/monitors/pagination-monitor.factory'; import { generateCfBaseTestModules, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/edit-organization/edit-organization.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/edit-organization/edit-organization.component.spec.ts index e176d3137a..c93308ee77 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/edit-organization/edit-organization.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/edit-organization/edit-organization.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules, generateTestCfEndpointServiceProvider, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/edit-quota/edit-quota.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/edit-quota/edit-quota.component.spec.ts index 71fd777494..ae177c3fa5 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/edit-quota/edit-quota.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/edit-quota/edit-quota.component.spec.ts @@ -1,7 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { CFBaseTestModules } from '../../../../test-framework/cf-test-helper'; import { QuotaDefinitionFormComponent } from '../quota-definition-form/quota-definition-form.component'; import { EditQuotaStepComponent } from './edit-quota-step/edit-quota-step.component'; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/edit-space-quota/edit-space-quota-step/edit-space-quota-step.component.ts b/src/frontend/packages/cloud-foundry/src/features/cf/edit-space-quota/edit-space-quota-step/edit-space-quota-step.component.ts index 8c0123ad3d..da83e79b84 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/edit-space-quota/edit-space-quota-step/edit-space-quota-step.component.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/edit-space-quota/edit-space-quota-step/edit-space-quota-step.component.ts @@ -49,7 +49,11 @@ export class EditSpaceQuotaStepComponent implements OnDestroy { } fetchQuotaDefinition() { - this.spaceQuotaDefinition$ = cfEntityCatalog.spaceQuota.store.getEntityService(this.spaceQuotaGuid, this.cfGuid, {}).waitForEntity$.pipe( + this.spaceQuotaDefinition$ = cfEntityCatalog.spaceQuota.store.getEntityService( + this.spaceQuotaGuid, + this.cfGuid, + {} + ).waitForEntity$.pipe( map(data => data.entity), tap((resource) => this.quota = resource.entity) ); diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/edit-space-quota/edit-space-quota.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/edit-space-quota/edit-space-quota.component.spec.ts index a17eee1dee..787c24d760 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/edit-space-quota/edit-space-quota.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/edit-space-quota/edit-space-quota.component.spec.ts @@ -1,7 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { CFBaseTestModules } from '../../../../test-framework/cf-test-helper'; import { SpaceQuotaDefinitionFormComponent } from '../space-quota-definition-form/space-quota-definition-form.component'; import { EditSpaceQuotaStepComponent } from './edit-space-quota-step/edit-space-quota-step.component'; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/edit-space/edit-space.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/edit-space/edit-space.component.spec.ts index 7c09107d9c..4c99880fe0 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/edit-space/edit-space.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/edit-space/edit-space.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules, generateTestCfEndpointServiceProvider, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/quota-definition/quota-definition.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/quota-definition/quota-definition.component.spec.ts index 4fb96c3435..ffb1b72d3e 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/quota-definition/quota-definition.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/quota-definition/quota-definition.component.spec.ts @@ -2,7 +2,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; import { populateStoreWithTestEndpoint, testSCFEndpointGuid } from '@stratosui/store/testing'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules, generateTestCfEndpointServiceProvider, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/space-quota-definition/space-quota-definition.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/space-quota-definition/space-quota-definition.component.spec.ts index ee79e073f2..7bde1d12ae 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/space-quota-definition/space-quota-definition.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/space-quota-definition/space-quota-definition.component.spec.ts @@ -3,7 +3,7 @@ import { ActivatedRoute } from '@angular/router'; import { Store } from '@ngrx/store'; import { testSCFEndpoint, testSCFEndpointGuid } from '@stratosui/store/testing'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { EntityCatalogHelpers } from '../../../../../store/src/entity-catalog/entity-catalog.helper'; import { EntityCatalogEntityConfig } from '../../../../../store/src/entity-catalog/entity-catalog.types'; import { endpointEntityType, stratosEntityFactory } from '../../../../../store/src/helpers/stratos-entity-factory'; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-cells/cloud-foundry-cell/cloud-foundry-cell-base/cloud-foundry-cell-base.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-cells/cloud-foundry-cell/cloud-foundry-cell-base/cloud-foundry-cell-base.component.spec.ts index ee7518e8c1..760cdc4695 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-cells/cloud-foundry-cell/cloud-foundry-cell-base/cloud-foundry-cell-base.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-cells/cloud-foundry-cell/cloud-foundry-cell-base/cloud-foundry-cell-base.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules } from '../../../../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { CfUserService } from '../../../../../../shared/data-services/cf-user.service'; import { ActiveRouteCfOrgSpace } from '../../../../cf-page.types'; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-firehose/cloud-foundry-firehose-formatter.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-firehose/cloud-foundry-firehose-formatter.ts index 51062be14d..2a8615929c 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-firehose/cloud-foundry-firehose-formatter.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-firehose/cloud-foundry-firehose-formatter.ts @@ -1,13 +1,12 @@ -/** - * Formats log messages from the Cloud Foundry firehose - */ -import * as moment from 'moment'; +import moment from 'moment'; -import { LoggerService } from '../../../../../../core/src/core/logger.service'; import { UtilsService } from '../../../../../../core/src/core/utils.service'; import { AnsiColorizer } from '../../../../../../core/src/shared/components/log-viewer/ansi-colorizer'; import { FireHoseItem, HTTP_METHODS } from './cloud-foundry-firehose.types'; +/** + * Formats log messages from the Cloud Foundry firehose + */ /* eslint-disable no-control-regex */ const ANSI_ESCAPE_MATCHER = new RegExp('\x1B\\[([0-9;]*)m', 'g'); @@ -29,7 +28,7 @@ export class CloudFoundryFirehoseFormatter { private colorizer = new AnsiColorizer(); - constructor(private logService: LoggerService, private utils: UtilsService) { } + constructor(private utils: UtilsService) { } // Enable or disable all filters public showAll(all: boolean) { @@ -66,7 +65,7 @@ export class CloudFoundryFirehoseFormatter { filtered = this.handleOtherEvent(cfEvent); } } catch (error) { - this.logService.error('Failed to filter jsonMessage from WebSocket: ' + jsonString); + console.error('Failed to filter jsonMessage from WebSocket: ' + jsonString); filtered = jsonString; } diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-firehose/cloud-foundry-firehose.component.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-firehose/cloud-foundry-firehose.component.ts index b2bbddcf69..e5bed949b7 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-firehose/cloud-foundry-firehose.component.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-firehose/cloud-foundry-firehose.component.ts @@ -1,9 +1,8 @@ import { Component, OnInit } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import websocketConnect from 'rxjs-websockets'; -import { catchError, filter, share, map, switchMap } from 'rxjs/operators'; +import { catchError, filter, map, share, switchMap } from 'rxjs/operators'; -import { LoggerService } from '../../../../../../core/src/core/logger.service'; import { UtilsService } from '../../../../../../core/src/core/utils.service'; import { environment } from '../../../../../../core/src/environments/environment.prod'; import { CloudFoundryEndpointService } from '../../services/cloud-foundry-endpoint.service'; @@ -25,7 +24,6 @@ export class CloudFoundryFirehoseComponent implements OnInit { constructor( private cfEndpointService: CloudFoundryEndpointService, - private logService: LoggerService, private utilsService: UtilsService ) { } @@ -36,7 +34,7 @@ export class CloudFoundryFirehoseComponent implements OnInit { }/firehose`; this.setupFirehoseStream(streamUrl); - this.formatter = new CloudFoundryFirehoseFormatter(this.logService, this.utilsService); + this.formatter = new CloudFoundryFirehoseFormatter(this.utilsService); this.filter = this.formatter.jsonFilter.bind(this.formatter); } diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organization-space-quotas/cloud-foundry-organization-space-quotas.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organization-space-quotas/cloud-foundry-organization-space-quotas.component.spec.ts index 3cda3f2573..84998577c1 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organization-space-quotas/cloud-foundry-organization-space-quotas.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organization-space-quotas/cloud-foundry-organization-space-quotas.component.spec.ts @@ -1,7 +1,7 @@ import { DatePipe } from '@angular/common'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../core/src/tab-nav.service'; import { CFBaseTestModules } from '../../../../../test-framework/cf-test-helper'; import { generateTestCfEndpointServiceProvider } from '../../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-base/cloud-foundry-organization-base.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-base/cloud-foundry-organization-base.component.spec.ts index 2270c81012..5ec7cc6be9 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-base/cloud-foundry-organization-base.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-base/cloud-foundry-organization-base.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules, generateTestCfEndpointServiceProvider, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-events/cloud-foundry-organization-events.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-events/cloud-foundry-organization-events.component.spec.ts index ef58df42ab..c5bcdfd914 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-events/cloud-foundry-organization-events.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-events/cloud-foundry-organization-events.component.spec.ts @@ -1,10 +1,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { - generateActiveRouteCfOrgSpaceMock, -} from 'frontend/packages/cloud-foundry/test-framework/cloud-foundry-endpoint-service.helper'; import { ListConfig } from '../../../../../../../core/src/shared/components/list/list.component.types'; import { CFBaseTestModules } from '../../../../../../test-framework/cf-test-helper'; +import { generateActiveRouteCfOrgSpaceMock } from '../../../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { CloudFoundryEventsListComponent, } from '../../../../../shared/components/cloud-foundry-events-list/cloud-foundry-events-list.component'; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/cloud-foundry-organization-spaces.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/cloud-foundry-organization-spaces.component.spec.ts index 47b0e37828..3e716a9838 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/cloud-foundry-organization-spaces.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/cloud-foundry-organization-spaces.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules, generateTestCfEndpointServiceProvider, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/cloud-foundry-space-base/cloud-foundry-space-base.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/cloud-foundry-space-base/cloud-foundry-space-base.component.spec.ts index b525621558..9e8cb485d2 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/cloud-foundry-space-base/cloud-foundry-space-base.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/cloud-foundry-space-base/cloud-foundry-space-base.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules, generateTestCfEndpointServiceProvider, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-events/cloud-foundry-space-events.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-events/cloud-foundry-space-events.component.spec.ts index 542fe41631..a09f80521e 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-events/cloud-foundry-space-events.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-events/cloud-foundry-space-events.component.spec.ts @@ -1,10 +1,10 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { - generateActiveRouteCfOrgSpaceMock, -} from 'frontend/packages/cloud-foundry/test-framework/cloud-foundry-endpoint-service.helper'; import { ListConfig } from '../../../../../../../../../core/src/shared/components/list/list.component.types'; import { CFBaseTestModules } from '../../../../../../../../test-framework/cf-test-helper'; +import { + generateActiveRouteCfOrgSpaceMock, +} from '../../../../../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { CloudFoundryEventsListComponent, } from '../../../../../../../shared/components/cloud-foundry-events-list/cloud-foundry-events-list.component'; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-service-instances/cloud-foundry-space-service-instances.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-service-instances/cloud-foundry-space-service-instances.component.spec.ts index d1598bc08b..d26fba5719 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-service-instances/cloud-foundry-space-service-instances.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-service-instances/cloud-foundry-space-service-instances.component.spec.ts @@ -10,9 +10,6 @@ import { import { ServiceActionHelperService } from '../../../../../../../shared/data-services/service-action-helper.service'; import { CloudFoundrySpaceServiceInstancesComponent } from './cloud-foundry-space-service-instances.component'; -/* tslint:disable:max-line-length */ -/* tslint:enable:max-line-length */ - @NgModule({ declarations: [TableCellAppCfOrgSpaceHeaderComponent], imports: [CommonModule], diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-summary/cloud-foundry-space-summary.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-summary/cloud-foundry-space-summary.component.spec.ts index e6e27e1e5b..9b1935631e 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-summary/cloud-foundry-space-summary.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-summary/cloud-foundry-space-summary.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../../../../core/src/tab-nav.service'; import { generateActiveRouteCfOrgSpaceMock, generateCfBaseTestModules, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-users/cloud-foundry-space-users.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-users/cloud-foundry-space-users.component.spec.ts index 0df268c9e1..48dec0b9e8 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-users/cloud-foundry-space-users.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-users/cloud-foundry-space-users.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules, generateTestCfEndpointServiceProvider, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-users/cloud-foundry-space-users.component.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-users/cloud-foundry-space-users.component.ts index 3b82a9e0e0..90c173f4f8 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-users/cloud-foundry-space-users.component.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-spaces/tabs/cloud-foundry-space-users/cloud-foundry-space-users.component.ts @@ -1,12 +1,14 @@ import { Component } from '@angular/core'; import { Store } from '@ngrx/store'; -import { CFAppState } from 'frontend/packages/cloud-foundry/src/cf-app-state'; -import { CurrentUserPermissionsService } from 'frontend/packages/core/src/core/permissions/current-user-permissions.service'; import { combineLatest, Observable } from 'rxjs'; import { map, switchMap } from 'rxjs/operators'; +import { + CurrentUserPermissionsService, +} from '../../../../../../../../../core/src/core/permissions/current-user-permissions.service'; import { ListConfig } from '../../../../../../../../../core/src/shared/components/list/list.component.types'; import { CFFeatureFlagTypes } from '../../../../../../../cf-api.types'; +import { CFAppState } from '../../../../../../../cf-app-state'; import { CfSpaceUsersListConfigService, } from '../../../../../../../shared/components/list/list-types/cf-space-users/cf-space-users-list-config.service'; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-summary/cloud-foundry-organization-summary.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-summary/cloud-foundry-organization-summary.component.spec.ts index 933c783b42..639ae6ff62 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-summary/cloud-foundry-organization-summary.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-summary/cloud-foundry-organization-summary.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules, generateTestCfEndpointServiceProvider, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-users/cloud-foundry-organization-users.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-users/cloud-foundry-organization-users.component.spec.ts index 8c989eab9b..1430a0c2e9 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-users/cloud-foundry-organization-users.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cf-organization-users/cloud-foundry-organization-users.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules, generateTestCfEndpointServiceProvider, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cloud-foundry-organizations.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cloud-foundry-organizations.component.spec.ts index 2c1572821d..ec94265165 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cloud-foundry-organizations.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-organizations/cloud-foundry-organizations.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules, generateTestCfEndpointServiceProvider, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-quotas/cloud-foundry-quotas.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-quotas/cloud-foundry-quotas.component.spec.ts index 75913ddedf..8e5c68629e 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-quotas/cloud-foundry-quotas.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-quotas/cloud-foundry-quotas.component.spec.ts @@ -1,7 +1,7 @@ import { DatePipe } from '@angular/common'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../core/src/tab-nav.service'; import { CFBaseTestModules } from '../../../../../test-framework/cf-test-helper'; import { generateTestCfEndpointServiceProvider } from '../../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { CfOrgsListConfigService } from '../../../../shared/components/list/list-types/cf-orgs/cf-orgs-list-config.service'; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-summary-tab/cloud-foundry-summary-tab.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-summary-tab/cloud-foundry-summary-tab.component.spec.ts index 25dec485d3..9c459b2db9 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-summary-tab/cloud-foundry-summary-tab.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/tabs/cf-summary-tab/cloud-foundry-summary-tab.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules, generateTestCfEndpointServiceProvider, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/users/invite-users/invite-users.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/users/invite-users/invite-users.component.spec.ts index 92b37bb6b0..e6586ecd83 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/users/invite-users/invite-users.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/users/invite-users/invite-users.component.spec.ts @@ -1,7 +1,7 @@ import { HttpClient, HttpHandler } from '@angular/common/http'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../core/src/tab-nav.service'; import { generateCfActiveRouteMock, generateCfBaseTestModules, diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/users/manage-users/manage-users-confirm/manage-users-confirm.component.ts b/src/frontend/packages/cloud-foundry/src/features/cf/users/manage-users/manage-users-confirm/manage-users-confirm.component.ts index 969da7b695..206a633c2f 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/users/manage-users/manage-users-confirm/manage-users-confirm.component.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/users/manage-users/manage-users-confirm/manage-users-confirm.component.ts @@ -30,12 +30,6 @@ import { CfUser, OrgUserRoleNames, SpaceUserRoleNames } from '../../../../../sto import { CfRoleChangeWithNames, UserRoleLabels } from '../../../../../store/types/users-roles.types'; import { ManageUsersSetUsernamesHelper } from '../manage-users-set-usernames/manage-users-set-usernames.component'; -/* tslint:disable:max-line-length */ - - - -/* tslint:enable:max-line-length */ - @Component({ selector: 'app-manage-users-confirm', templateUrl: './manage-users-confirm.component.html', @@ -84,8 +78,8 @@ export class UsersRolesConfirmComponent implements OnInit, AfterContentInit { private updateChanges = new Subject(); private nameCache: { - user: { [guid: string]: string }, - role: { [guid: string]: string }, + user: { [guid: string]: string, }, + role: { [guid: string]: string, }, } = { user: {}, role: {} @@ -129,7 +123,7 @@ export class UsersRolesConfirmComponent implements OnInit, AfterContentInit { this.store.select(selectCfUsersRoles).pipe( first(), ).subscribe(usersRoles => this.store.dispatch(new UsersRolesClearUpdateState(usersRoles.changedRoles))); - } + }; fetchUsername = (userGuid: string, users: APIResource[]): string => { let res = this.nameCache.user[userGuid]; @@ -139,11 +133,11 @@ export class UsersRolesConfirmComponent implements OnInit, AfterContentInit { res = users.find(user => user.metadata.guid === userGuid).entity.username; this.nameCache.user[userGuid] = res; return res; - } + }; fetchRoleName = (roleName: OrgUserRoleNames | SpaceUserRoleNames, isOrg: boolean): string => { return isOrg ? UserRoleLabels.org.short[roleName] : UserRoleLabels.space.short[roleName]; - } + }; private createCfObs() { this.cfGuid$ = this.store.select(selectCfUsersRoles).pipe( diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/users/manage-users/manage-users-modify/manage-users-modify.component.ts b/src/frontend/packages/cloud-foundry/src/features/cf/users/manage-users/manage-users-modify/manage-users-modify.component.ts index 7782611d97..aec13ada83 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/users/manage-users/manage-users-modify/manage-users-modify.component.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/users/manage-users/manage-users-modify/manage-users-modify.component.ts @@ -54,11 +54,7 @@ import { ActiveRouteCfOrgSpace } from '../../../cf-page.types'; import { CfRolesService } from '../cf-roles.service'; import { SpaceRolesListWrapperComponent } from './space-roles-list-wrapper/space-roles-list-wrapper.component'; -/* tslint:disable:max-line-length */ - -/* tslint:enable:max-line-length */ - -interface Org { metadata: { guid: string }; } +interface Org { metadata: { guid: string, }; } interface CfUserWithWarning extends CfUser { showWarning: boolean; } @@ -294,21 +290,21 @@ export class UsersRolesModifyComponent implements OnInit, OnDestroy { this.store.dispatch(new UsersRolesFlipSetRoles()); } }); - } + }; onLeave = (isNext: boolean) => { if (!isNext && this.snackBarRef) { this.snackBarRef.dismiss(); this.snackBarRef = null; } - } + }; onNext = () => { return combineLatest([ this.store.select(selectCfUsersIsRemove).pipe(first()), this.cfRolesService.createRolesDiff(this.selectedOrgGuid) ]).pipe( - map(([isRemove, ]) => { + map(([isRemove,]) => { if (isRemove) { // If we're going to eventually remove the roles flip the add to remove this.store.dispatch(new UsersRolesFlipSetRoles()); @@ -318,6 +314,6 @@ export class UsersRolesModifyComponent implements OnInit, OnDestroy { ).pipe(catchError(err => { return observableOf({ success: false }); })); - } + }; } diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/users/manage-users/manage-users.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/users/manage-users/manage-users.component.spec.ts index 49c4be9fc8..3c67f45536 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/users/manage-users/manage-users.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/users/manage-users/manage-users.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { CoreModule } from '../../../../../../core/src/core/core.module'; import { SharedModule } from '../../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../core/src/tab-nav.service'; import { generateCfStoreModules } from '../../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { CfUserServiceTestProvider } from '../../../../../test-framework/user-service-helper'; import { ActiveRouteCfOrgSpace } from '../../cf-page.types'; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/users/remove-user/remove-user.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/cf/users/remove-user/remove-user.component.spec.ts index dc025ef094..bd5d2a63f2 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/users/remove-user/remove-user.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/users/remove-user/remove-user.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { CoreModule } from '../../../../../../core/src/core/core.module'; import { SharedModule } from '../../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../core/src/tab-nav.service'; import { generateCfStoreModules } from '../../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { CfUserServiceTestProvider } from '../../../../../test-framework/user-service-helper'; import { ActiveRouteCfOrgSpace } from '../../cf-page.types'; diff --git a/src/frontend/packages/cloud-foundry/src/features/cf/users/remove-user/remove-user.component.ts b/src/frontend/packages/cloud-foundry/src/features/cf/users/remove-user/remove-user.component.ts index 7c4a435f3d..9a9642fe87 100644 --- a/src/frontend/packages/cloud-foundry/src/features/cf/users/remove-user/remove-user.component.ts +++ b/src/frontend/packages/cloud-foundry/src/features/cf/users/remove-user/remove-user.component.ts @@ -4,7 +4,6 @@ import { Store } from '@ngrx/store'; import { combineLatest as obsCombineLatest, Observable, of as observableOf } from 'rxjs'; import { combineLatest, filter, first, map, startWith } from 'rxjs/operators'; -import { LoggerService } from '../../../../../../core/src/core/logger.service'; import { CurrentUserPermissionsService } from '../../../../../../core/src/core/permissions/current-user-permissions.service'; import { StepOnNextFunction } from '../../../../../../core/src/shared/components/stepper/step/step.component'; import { AppState } from '../../../../../../store/src/app-state'; @@ -49,7 +48,6 @@ export class RemoveUserComponent implements OnDestroy { private activeRouteCfOrgSpace: ActiveRouteCfOrgSpace, private cfUserService: CfUserService, private cfRolesService: CfRolesService, - private logService: LoggerService, private route: ActivatedRoute, private userPerms: CurrentUserPermissionsService ) { @@ -67,7 +65,7 @@ export class RemoveUserComponent implements OnDestroy { first() ); } else { - this.logService.error('User param not defined'); + console.error('User param not defined'); return; } diff --git a/src/frontend/packages/cloud-foundry/src/features/service-catalog/service-catalog-page/service-catalog-page.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/service-catalog/service-catalog-page/service-catalog-page.component.spec.ts index 57528a599c..90f7083f13 100644 --- a/src/frontend/packages/cloud-foundry/src/features/service-catalog/service-catalog-page/service-catalog-page.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/service-catalog/service-catalog-page/service-catalog-page.component.spec.ts @@ -5,7 +5,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { CoreModule } from '../../../../../core/src/core/core.module'; import { SharedModule } from '../../../../../core/src/shared/shared.module'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateCfStoreModules } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { CfEndpointsMissingComponent } from '../../../shared/components/cf-endpoints-missing/cf-endpoints-missing.component'; import { CloudFoundryService } from '../../../shared/data-services/cloud-foundry.service'; diff --git a/src/frontend/packages/cloud-foundry/src/features/service-catalog/service-tabs-base/service-tabs-base.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/service-catalog/service-tabs-base/service-tabs-base.component.spec.ts index e25c5c6f2e..f8dc7a2755 100644 --- a/src/frontend/packages/cloud-foundry/src/features/service-catalog/service-tabs-base/service-tabs-base.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/service-catalog/service-tabs-base/service-tabs-base.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { CfUserPermissionDirective } from '../../../shared/directives/cf-user-permission/cf-user-permission.directive'; import { ServicesService } from '../services.service'; diff --git a/src/frontend/packages/cloud-foundry/src/features/services/detach-service-instance/detach-service-instance.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/services/detach-service-instance/detach-service-instance.component.spec.ts index 32ecc4e292..623415cc93 100644 --- a/src/frontend/packages/cloud-foundry/src/features/services/detach-service-instance/detach-service-instance.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/services/detach-service-instance/detach-service-instance.component.spec.ts @@ -2,7 +2,7 @@ import { DatePipe } from '@angular/common'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ActivatedRoute } from '@angular/router'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { ServiceActionHelperService } from '../../../shared/data-services/service-action-helper.service'; import { DetachAppsComponent } from './detach-apps/detach-apps.component'; diff --git a/src/frontend/packages/cloud-foundry/src/features/services/services-wall/services-wall.component.spec.ts b/src/frontend/packages/cloud-foundry/src/features/services/services-wall/services-wall.component.spec.ts index 7d20df5522..7cf738ff7f 100644 --- a/src/frontend/packages/cloud-foundry/src/features/services/services-wall/services-wall.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/features/services/services-wall/services-wall.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules } from '../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { CfEndpointsMissingComponent } from '../../../shared/components/cf-endpoints-missing/cf-endpoints-missing.component'; import { CfOrgSpaceDataService } from '../../../shared/data-services/cf-org-space-service.service'; diff --git a/src/frontend/packages/cloud-foundry/src/shared/components/add-service-instance/add-service-instance-base-step/add-service-instance-base-step.component.spec.ts b/src/frontend/packages/cloud-foundry/src/shared/components/add-service-instance/add-service-instance-base-step/add-service-instance-base-step.component.spec.ts index f104e8d150..ef280c7cbd 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/components/add-service-instance/add-service-instance-base-step/add-service-instance-base-step.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/components/add-service-instance/add-service-instance-base-step/add-service-instance-base-step.component.spec.ts @@ -1,6 +1,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../core/src/tab-nav.service'; import { generateCfBaseTestModules } from '../../../../../test-framework/cloud-foundry-endpoint-service.helper'; import { AddServiceInstanceBaseStepComponent } from './add-service-instance-base-step.component'; diff --git a/src/frontend/packages/cloud-foundry/src/shared/components/add-service-instance/add-service-instance/add-service-instance.component.spec.ts b/src/frontend/packages/cloud-foundry/src/shared/components/add-service-instance/add-service-instance/add-service-instance.component.spec.ts index daa030668e..f79e72c929 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/components/add-service-instance/add-service-instance/add-service-instance.component.spec.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/components/add-service-instance/add-service-instance/add-service-instance.component.spec.ts @@ -37,7 +37,7 @@ import { } from '../../../../../../core/src/shared/components/multiline-title/multiline-title.component'; import { PageHeaderModule } from '../../../../../../core/src/shared/components/page-header/page-header.module'; import { SteppersModule } from '../../../../../../core/src/shared/components/stepper/steppers.module'; -import { TabNavService } from '../../../../../../core/tab-nav.service'; +import { TabNavService } from '../../../../../../core/src/tab-nav.service'; import { EntityMonitorFactory } from '../../../../../../store/src/monitors/entity-monitor.factory.service'; import { InternalEventMonitorFactory } from '../../../../../../store/src/monitors/internal-event-monitor.factory'; import { PaginationMonitorFactory } from '../../../../../../store/src/monitors/pagination-monitor.factory'; diff --git a/src/frontend/packages/cloud-foundry/src/shared/components/add-service-instance/create-service-instance-helper.service.ts b/src/frontend/packages/cloud-foundry/src/shared/components/add-service-instance/create-service-instance-helper.service.ts index f79ffc547c..cc96c5fc5d 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/components/add-service-instance/create-service-instance-helper.service.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/components/add-service-instance/create-service-instance-helper.service.ts @@ -52,11 +52,15 @@ export class CreateServiceInstanceHelper { ); const paginationKey = createEntityRelationPaginationKey(servicePlanVisibilityEntityType, this.cfGuid); - this.servicePlanVisibilities$ = cfEntityCatalog.servicePlanVisibility.store.getPaginationService(this.cfGuid, paginationKey, {}).entities$ - } + this.servicePlanVisibilities$ = cfEntityCatalog.servicePlanVisibility.store.getPaginationService( + this.cfGuid, + paginationKey, + {} + ).entities$; + }; getServicePlanVisibilities = (): Observable[]> => - this.servicePlanVisibilities$.pipe(filter(p => !!p)) + this.servicePlanVisibilities$.pipe(filter(p => !!p)); getServicePlans(): Observable[]> { @@ -69,7 +73,7 @@ export class CreateServiceInstanceHelper { filter(p => !!p), map(getServiceName) ); - } + }; getServiceInstancesForService = (servicePlanGuid: string = null, spaceGuid: string = null, cfGuid: string = null) => { let action; @@ -77,7 +81,7 @@ export class CreateServiceInstanceHelper { if (spaceGuid) { paginationKey = createEntityRelationPaginationKey(serviceInstancesEntityType, `${spaceGuid}-${servicePlanGuid}`); const q = [new QParam('service_plan_guid', servicePlanGuid, QParamJoiners.colon).toString()]; - action = cfEntityCatalog.serviceInstance.actions.getAllInSpace(spaceGuid, cfGuid, paginationKey, q) + action = cfEntityCatalog.serviceInstance.actions.getAllInSpace(spaceGuid, cfGuid, paginationKey, q); } else if (servicePlanGuid) { paginationKey = createEntityRelationPaginationKey(serviceInstancesEntityType, servicePlanGuid); action = cfEntityCatalog.serviceInstance.actions.getAllInServicePlan(servicePlanGuid, cfGuid, paginationKey); @@ -98,5 +102,5 @@ export class CreateServiceInstanceHelper { publishReplay(1), refCount() ); - } + }; } diff --git a/src/frontend/packages/cloud-foundry/src/shared/components/cards/card-cf-info/card-cf-info.component.ts b/src/frontend/packages/cloud-foundry/src/shared/components/cards/card-cf-info/card-cf-info.component.ts index 8be8e3f5cb..49df7b2862 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/components/cards/card-cf-info/card-cf-info.component.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/components/cards/card-cf-info/card-cf-info.component.ts @@ -1,11 +1,11 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { fetchAutoscalerInfo } from '@stratosui/cf-autoscaler'; -import { APIResource, EntityInfo } from 'frontend/packages/store/src/types/api.types'; import { Observable, Subscription } from 'rxjs'; import { map, tap } from 'rxjs/operators'; import { EntityServiceFactory } from '../../../../../../store/src/entity-service-factory.service'; +import { APIResource, EntityInfo } from '../../../../../../store/src/types/api.types'; import { ICfV2Info } from '../../../../cf-api.types'; import { CloudFoundryEndpointService } from '../../../../features/cf/services/cloud-foundry-endpoint.service'; import { diff --git a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/app/cf-apps-data-source.ts b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/app/cf-apps-data-source.ts index 137f9073dd..77cbca9094 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/app/cf-apps-data-source.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/app/cf-apps-data-source.ts @@ -102,13 +102,10 @@ export class CfAppsDataSource extends CFListDataSource { if (app instanceof MultiActionListEntity) { app = app.entity; } - const appState = app.entity.state; - const appGuid = app.metadata.guid; - const cfGuid = app.entity.cfGuid; - if (appState === 'STARTED') { + if (app.entity.state === 'STARTED') { actions.push({ - id: appGuid, - action: cfEntityCatalog.appStats.actions.getMultiple(appGuid, cfGuid) + id: app.metadata.guid, + action: cfEntityCatalog.appStats.actions.getMultiple(app.metadata.guid, app.entity.cfGuid) }); } }); diff --git a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-cell-health/cf-cell-health-list-config.service.ts b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-cell-health/cf-cell-health-list-config.service.ts index 51e4e54f65..055d15a4e3 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-cell-health/cf-cell-health-list-config.service.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-cell-health/cf-cell-health-list-config.service.ts @@ -1,3 +1,4 @@ +/* tslint:disable:max-line-length */ import { DatePipe } from '@angular/common'; import { Injectable } from '@angular/core'; import { Store } from '@ngrx/store'; @@ -24,6 +25,8 @@ import { import { BaseCfListConfig } from '../base-cf/base-cf-list-config'; import { CfCellHealthDataSource, CfCellHealthEntry, CfCellHealthState } from './cf-cell-health-source'; +// tslint:enable:max-line-length + @Injectable() export class CfCellHealthListConfigService extends BaseCfListConfig { @@ -93,6 +96,6 @@ export class CfCellHealthListConfigService extends BaseCfListConfig this.dataSource; } diff --git a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-cells/cf-cells-list-config.service.ts b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-cells/cf-cells-list-config.service.ts index 783f2b148f..859b7a7c16 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-cells/cf-cells-list-config.service.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-cells/cf-cells-list-config.service.ts @@ -1,3 +1,4 @@ +// tslint:disable:max-line-length import { Injectable } from '@angular/core'; import { Store } from '@ngrx/store'; import { Observable } from 'rxjs'; @@ -22,7 +23,6 @@ import { ActiveRouteCfCell } from '../../../../../features/cf/cf-page.types'; import { BaseCfListConfig } from '../base-cf/base-cf-list-config'; import { CfCellsDataSource } from './cf-cells-data-source'; -// tslint:disable:max-line-length // tslint:enable:max-line-length diff --git a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-feature-flags/table-cell-feature-flag-description/table-cell-feature-flag-description.component.ts b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-feature-flags/table-cell-feature-flag-description/table-cell-feature-flag-description.component.ts index de671fa58f..324c695ac2 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-feature-flags/table-cell-feature-flag-description/table-cell-feature-flag-description.component.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-feature-flags/table-cell-feature-flag-description/table-cell-feature-flag-description.component.ts @@ -1,6 +1,6 @@ import { Component, Input } from '@angular/core'; -import { TableCellCustom } from 'frontend/packages/core/src/shared/components/list/list.types'; +import { TableCellCustom } from '../../../../../../../../core/src/shared/components/list/list.types'; import { IFeatureFlag } from '../../../../../../cf-api.types'; import { FeatureFlagDescriptions } from '../cf-feature-flags-data-source'; diff --git a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-services/table-cell-service-broker/table-cell-service-broker.component.ts b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-services/table-cell-service-broker/table-cell-service-broker.component.ts index eea29808c6..1f61b851d9 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-services/table-cell-service-broker/table-cell-service-broker.component.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-services/table-cell-service-broker/table-cell-service-broker.component.ts @@ -33,13 +33,20 @@ export class TableCellServiceBrokerComponent extends TableCellCustom) { this.pRow = row; if (row && !this.spaceLink$) { - this.broker$ = cfEntityCatalog.serviceBroker.store.getEntityService(this.row.entity.service_broker_guid, this.row.entity.cfGuid, {}).waitForEntity$ - .pipe( - map(e => e.entity) - ) + this.broker$ = cfEntityCatalog.serviceBroker.store.getEntityService( + this.row.entity.service_broker_guid, + this.row.entity.cfGuid, + {} + ).waitForEntity$.pipe( + map(e => e.entity) + ); this.spaceLink$ = this.broker$.pipe( filter(broker => !!broker.entity.space_guid), - switchMap(broker => cfEntityCatalog.space.store.getWithOrganization.getEntityService(broker.entity.space_guid, broker.entity.cfGuid).waitForEntity$), + switchMap(broker => cfEntityCatalog.space.store.getWithOrganization.getEntityService( + broker.entity.space_guid, + broker.entity.cfGuid + ).waitForEntity$ + ), map(e => e.entity), map(space => ({ name: space.entity.name, @@ -53,7 +60,7 @@ export class TableCellServiceBrokerComponent extends TableCellCustom { @@ -62,12 +69,12 @@ export class TableCellServiceBrokerComponent extends TableCellCustom; - public broker$: Observable> + public broker$: Observable>; constructor() { - super() + super(); } } diff --git a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-users/cf-org-permission-cell/cf-org-permission-cell.component.ts b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-users/cf-org-permission-cell/cf-org-permission-cell.component.ts index 05653c251e..b69318d2be 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-users/cf-org-permission-cell/cf-org-permission-cell.component.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-users/cf-org-permission-cell/cf-org-permission-cell.component.ts @@ -20,7 +20,7 @@ import { getOrgRoles } from '../../../../../../features/cf/cf.helpers'; import { CfUser, IUserPermissionInOrg, OrgUserRoleNames } from '../../../../../../store/types/cf-user.types'; import { CfCurrentUserPermissions } from '../../../../../../user-permissions/cf-user-permissions-checkers'; import { CfUserService } from '../../../../../data-services/cf-user.service'; -import { CfPermissionCell, ICellPermissionList } from '../cf-permission-cell'; +import { CfPermissionCellDirective, ICellPermissionList } from '../cf-permission-cell'; @Component({ selector: 'app-org-user-permission-cell', @@ -28,7 +28,7 @@ import { CfPermissionCell, ICellPermissionList } from '../cf-permission-cell'; styleUrls: ['./cf-org-permission-cell.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) -export class CfOrgPermissionCellComponent extends CfPermissionCell { +export class CfOrgPermissionCellComponent extends CfPermissionCellDirective { constructor( public store: Store, @@ -96,6 +96,6 @@ export class CfOrgPermissionCellComponent extends CfPermissionCell - this.userPerms.can(CfCurrentUserPermissions.ORGANIZATION_CHANGE_ROLES, cfGuid, orgGuid) + this.userPerms.can(CfCurrentUserPermissions.ORGANIZATION_CHANGE_ROLES, cfGuid, orgGuid); } diff --git a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-users/cf-permission-cell.ts b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-users/cf-permission-cell.ts index 458162a84b..4f79ca2521 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-users/cf-permission-cell.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-users/cf-permission-cell.ts @@ -28,7 +28,7 @@ export interface ICellPermissionList extends IUserRole { } @Directive() -export abstract class CfPermissionCell extends TableCellCustom> { +export abstract class CfPermissionCellDirective extends TableCellCustom> { userEntity: BehaviorSubject = new BehaviorSubject(null); @Input('row') diff --git a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-users/cf-space-permission-cell/cf-space-permission-cell.component.ts b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-users/cf-space-permission-cell/cf-space-permission-cell.component.ts index ba82dc8bb6..d5ac10914d 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-users/cf-space-permission-cell/cf-space-permission-cell.component.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/cf-users/cf-space-permission-cell/cf-space-permission-cell.component.ts @@ -20,7 +20,7 @@ import { getSpaceRoles } from '../../../../../../features/cf/cf.helpers'; import { CfUser, IUserPermissionInSpace, SpaceUserRoleNames } from '../../../../../../store/types/cf-user.types'; import { CfCurrentUserPermissions } from '../../../../../../user-permissions/cf-user-permissions-checkers'; import { CfUserService } from '../../../../../data-services/cf-user.service'; -import { CfPermissionCell, ICellPermissionList } from '../cf-permission-cell'; +import { CfPermissionCellDirective, ICellPermissionList } from '../cf-permission-cell'; @Component({ selector: 'app-cf-space-permission-cell', @@ -28,7 +28,7 @@ import { CfPermissionCell, ICellPermissionList } from '../cf-permission-cell'; styleUrls: ['./cf-space-permission-cell.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) -export class CfSpacePermissionCellComponent extends CfPermissionCell { +export class CfSpacePermissionCellComponent extends CfPermissionCellDirective { missingRoles$: Observable; @@ -83,7 +83,7 @@ export class CfSpacePermissionCellComponent extends CfPermissionCell !!org), first(), map((orgs: APIResource[]) => { - const orgNames: { [orgGuid: string]: string } = {}; + const orgNames: { [orgGuid: string]: string; } = {}; orgs.forEach(org => { orgNames[org.metadata.guid] = org.entity.name; }); @@ -154,5 +154,5 @@ export class CfSpacePermissionCellComponent extends CfPermissionCell - this.userPerms.can(CfCurrentUserPermissions.SPACE_CHANGE_ROLES, cfGuid, orgGuid, spaceGuid) + this.userPerms.can(CfCurrentUserPermissions.SPACE_CHANGE_ROLES, cfGuid, orgGuid, spaceGuid); } diff --git a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/github-commits/github-commits-list-config-app-tab.service.ts b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/github-commits/github-commits-list-config-app-tab.service.ts index fbca27d4a5..3315917aa2 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/github-commits/github-commits-list-config-app-tab.service.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/components/list/list-types/github-commits/github-commits-list-config-app-tab.service.ts @@ -1,7 +1,7 @@ import { DatePipe } from '@angular/common'; import { Injectable } from '@angular/core'; import { Store } from '@ngrx/store'; -import * as moment from 'moment'; +import moment from 'moment'; import { Observable } from 'rxjs'; import { combineLatest, filter, first, map } from 'rxjs/operators'; diff --git a/src/frontend/packages/cloud-foundry/src/shared/data-services/scm/github-pagination.helper.ts b/src/frontend/packages/cloud-foundry/src/shared/data-services/scm/github-pagination.helper.ts new file mode 100644 index 0000000000..59aaccfdf5 --- /dev/null +++ b/src/frontend/packages/cloud-foundry/src/shared/data-services/scm/github-pagination.helper.ts @@ -0,0 +1,153 @@ +import { HttpClient, HttpResponse } from '@angular/common/http'; +import { PaginationFlattener } from '@stratosui/store'; +import { Observable } from 'rxjs'; + +// --------------- Note ---------------- +// There are two types of pagination github uses +// 1) Pagination info is in the body of the response (GithubPaginationResponse / GithubFlattenerPaginationConfig) +// - Array is in the body of the response +// - Things like total number of results in the body of the response +// 2) Pagination info is in the response header (GithubPaginationArrayResponse / GithubFlattenerForArrayPaginationConfig) +// - Array is the body of the response +// - Thinks like total number of results are in a `link` property in the response header + + +/** + * Body of a github pagination response (pagination info inside body) + */ +type GithubPaginationResponse = { + incomplete_results: boolean, + items: T[], + total_count: number, +}; + +/** + * Body of a github pagination response (pagination info is in header) + */ +type GithubPaginationArrayResponse = T[]; + +export const GITHUB_PER_PAGE_PARAM = 'per_page'; +export const GITHUB_PER_PAGE_PARAM_VALUE = 100; +const GITHUB_MAX_PAGES = 5; +const GITHUB_PAGE_PARAM = 'page'; +const GITHUB_LINK_PAGE_REGEX = /page=([\d]*)/; + +/** + * Config used with `flattenPagination`. To use when the pagination info is in the body + */ +export class GithubFlattenerPaginationConfig implements PaginationFlattener> { + constructor( + private httpClient: HttpClient, + public url: string, + ) { } + + getTotalPages = (res: GithubPaginationResponse): number => { + const total = Math.floor(this.getTotalResults(res) / GITHUB_PER_PAGE_PARAM_VALUE) + 1; + if (total > GITHUB_MAX_PAGES) { + console.warn(`Not fetching all github entities (too many pages: ${total})`); + return GITHUB_MAX_PAGES; + } + return total; + }; + getTotalResults = (res: GithubPaginationResponse): number => { + return res.total_count; + }; + mergePages = (response: any[]): T[] => { + return response.reduce((all, res) => { + return all.concat(...res.items); + }, [] as T[]); + }; + fetch = (...args: any[]): Observable> => { + return this.httpClient.get>( + this.url, + { + params: { + ...args[0] + }, + } + ); + }; + buildFetchParams = (i: number): any[] => { + const requestOption = { + [GITHUB_PAGE_PARAM]: i.toString(), + [GITHUB_PER_PAGE_PARAM]: GITHUB_PER_PAGE_PARAM_VALUE.toString() + }; + return [requestOption]; + }; + clearResults = (res: GithubPaginationResponse, allResults: number) => { + throw new Error('Not Implemented'); + }; +} + +/** + * Config used with `flattenPagination`. To use when the pagination info in the response header + */ +export class GithubFlattenerForArrayPaginationConfig + implements PaginationFlattener, HttpResponse>> { + constructor( + private httpClient: HttpClient, + public url: string, + ) { } + + getTotalPages = (res: HttpResponse>): number => { + // Link: ; rel="next", + // ; rel="last" + + const link = res.headers.get('link'); + if (!link) { + // There's no `link` if there's only one page..... + return 1; + } + const parts = link.split(','); + if (!parts.length) { + throw new Error('Unable to depagination github request (no commas in `link`)'); + } + const last = parts.find(part => part.endsWith('rel="last"')); + if (!last) { + throw new Error('Unable to depagination github request (no `last` in `link`)'); + } + const trimmedLast = last.trim(); + const lastUrl = trimmedLast.slice(1, trimmedLast.indexOf('>')); + const lastPageNumber = GITHUB_LINK_PAGE_REGEX.exec(lastUrl); + if (lastPageNumber.length < 2) { + throw new Error(`Unable to depagination github request (could not find page number in ${lastUrl})`); + } + + const total = parseInt(lastPageNumber[1], 10); + if (total > GITHUB_MAX_PAGES) { + console.warn(`Not fetching all github entities (too many pages: ${total})`); + return GITHUB_MAX_PAGES; + } + return total; + }; + getTotalResults = (res: HttpResponse>): number => { + return this.getTotalPages(res) * GITHUB_PER_PAGE_PARAM_VALUE; + }; + mergePages = (response: any[]): GithubPaginationArrayResponse => { + return response.reduce((all, res) => { + return all.concat(...res.body); + }, [] as GithubPaginationArrayResponse); + }; + fetch = (...args: any[]): Observable>> => { + return this.httpClient.get>( + this.url, + { + params: { + ...args[0] + }, + // Required to ensure we can access the https response header + observe: 'response' + } + ); + }; + buildFetchParams = (i: number): any[] => { + const requestOption = { + [GITHUB_PAGE_PARAM]: i.toString(), + [GITHUB_PER_PAGE_PARAM]: GITHUB_PER_PAGE_PARAM_VALUE.toString() + }; + return [requestOption]; + }; + clearResults = (res: HttpResponse>, allResults: number) => { + throw new Error('Not Implemented'); + }; +} \ No newline at end of file diff --git a/src/frontend/packages/cloud-foundry/src/shared/data-services/scm/github-scm.ts b/src/frontend/packages/cloud-foundry/src/shared/data-services/scm/github-scm.ts index 5c6180fb38..915eae9576 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/data-services/scm/github-scm.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/data-services/scm/github-scm.ts @@ -1,9 +1,16 @@ import { HttpClient } from '@angular/common/http'; +import { flattenPagination } from '@stratosui/store'; import { Observable } from 'rxjs'; -import { filter, map } from 'rxjs/operators'; +import { map } from 'rxjs/operators'; import { getGitHubAPIURL } from '../../../../../core/src/core/github.helpers'; import { GitBranch, GitCommit, GitRepo } from '../../../store/types/git.types'; +import { + GITHUB_PER_PAGE_PARAM, + GITHUB_PER_PAGE_PARAM_VALUE, + GithubFlattenerForArrayPaginationConfig, + GithubFlattenerPaginationConfig, +} from './github-pagination.helper'; import { GitSCM, SCMIcon } from './scm'; import { GitSCMType } from './scm.service'; @@ -37,7 +44,14 @@ export class GitHubSCM implements GitSCM { } getBranches(httpClient: HttpClient, projectName: string): Observable { - return httpClient.get(`${this.gitHubURL}/repos/${projectName}/branches`) as Observable; + const url = `${this.gitHubURL}/repos/${projectName}/branches`; + const config = new GithubFlattenerForArrayPaginationConfig(httpClient, url) + const firstRequest = config.fetch(...config.buildFetchParams(1)) + return flattenPagination( + null, + firstRequest, + config + ) } getCommit(httpClient: HttpClient, projectName: string, commitSha: string): Observable { @@ -49,7 +63,12 @@ export class GitHubSCM implements GitSCM { } getCommits(httpClient: HttpClient, projectName: string, ref: string): Observable { - return httpClient.get(`${this.gitHubURL}/repos/${projectName}/commits?sha=${ref}`) as Observable; + return httpClient.get( + `${this.gitHubURL}/repos/${projectName}/commits?sha=${ref}`, { + params: { + [GITHUB_PER_PAGE_PARAM]: GITHUB_PER_PAGE_PARAM_VALUE.toString() + } + }); } getCloneURL(projectName: string): string { @@ -70,12 +89,18 @@ export class GitHubSCM implements GitSCM { if (prjParts.length > 1) { url = `${this.gitHubURL}/search/repositories?q=${prjParts[1]}+in:name+fork:true+user:${prjParts[0]}`; } - return httpClient.get(url).pipe( - filter((repos: any) => !!repos.items), + + const config = new GithubFlattenerPaginationConfig(httpClient, url) + const firstRequest = config.fetch(...config.buildFetchParams(1)) + return flattenPagination( + null, + firstRequest, + config + ).pipe( map(repos => { - return repos.items.map(item => item.full_name); + return repos.map(item => item.full_name); }) - ); + ) } public convertCommit(projectName: string, commit: any): GitCommit { diff --git a/src/frontend/packages/cloud-foundry/src/shared/data-services/scm/gitlab-scm.ts b/src/frontend/packages/cloud-foundry/src/shared/data-services/scm/gitlab-scm.ts index 0d6b210764..badb54157d 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/data-services/scm/gitlab-scm.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/data-services/scm/gitlab-scm.ts @@ -1,6 +1,6 @@ import { HttpClient, HttpErrorResponse } from '@angular/common/http'; -import { Observable, of as observableOf } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { combineLatest, Observable, of as observableOf, of } from 'rxjs'; +import { catchError, map } from 'rxjs/operators'; import { Md5 } from 'ts-md5/dist/md5'; import { GitBranch, GitCommit, GitRepo } from '../../../store/types/git.types'; @@ -8,6 +8,8 @@ import { GitSCM, SCMIcon } from './scm'; import { GitSCMType } from './scm.service'; const gitLabAPIUrl = 'https://gitlab.com/api/v4'; +const GITLAB_PER_PAGE_PARAM = 'per_page'; +const GITLAB_PER_PAGE_PARAM_VALUE = 100; export class GitLabSCM implements GitSCM { @@ -29,19 +31,18 @@ export class GitLabSCM implements GitSCM { getRepository(httpClient: HttpClient, projectName: string): Observable { const parts = projectName.split('/'); - let obs$ = httpClient.get(`${gitLabAPIUrl}/users/${parts[0]}/projects?search=${parts[1]}`); - if (parts.length !== 2) { - obs$ = observableOf(null); - } + const obs$ = parts.length !== 2 ? + observableOf(null) : + httpClient.get(`${gitLabAPIUrl}/projects/${parts.join('%2F')}`); return obs$.pipe( map((data: any) => { - if (data.length !== 1) { + if (!data) { throw new HttpErrorResponse({ status: 404 }); } - return this.convertProject(data[0]); + return this.convertProject(data); }) ); } @@ -59,7 +60,13 @@ export class GitLabSCM implements GitSCM { getBranches(httpClient: HttpClient, projectName: string): Observable { const prjNameEncoded = encodeURIComponent(projectName); - return httpClient.get(`${gitLabAPIUrl}/projects/${prjNameEncoded}/repository/branches`).pipe( + return httpClient.get( + `${gitLabAPIUrl}/projects/${prjNameEncoded}/repository/branches`, { + params: { + [GITLAB_PER_PAGE_PARAM]: GITLAB_PER_PAGE_PARAM_VALUE.toString() + } + } + ).pipe( map((data: any) => { const branches = []; data.forEach(b => { @@ -87,7 +94,13 @@ export class GitLabSCM implements GitSCM { getCommits(httpClient: HttpClient, projectName: string, commitSha: string): Observable { const prjNameEncoded = encodeURIComponent(projectName); - return httpClient.get(`${gitLabAPIUrl}/projects/${prjNameEncoded}/repository/commits?ref_name=${commitSha}`).pipe( + return httpClient.get( + `${gitLabAPIUrl}/projects/${prjNameEncoded}/repository/commits?ref_name=${commitSha}`, { + params: { + [GITLAB_PER_PAGE_PARAM]: GITLAB_PER_PAGE_PARAM_VALUE.toString() + } + } + ).pipe( map((data: any) => { const commits = []; data.forEach(c => commits.push(this.convertCommit(projectName, c))); @@ -110,17 +123,29 @@ export class GitLabSCM implements GitSCM { getMatchingRepositories(httpClient: HttpClient, projectName: string): Observable { const prjParts = projectName.split('/'); - let url = `${gitLabAPIUrl}/projects?search=${projectName}`; - if (prjParts.length > 1) { - url = `${gitLabAPIUrl}/users/${prjParts[0]}/projects?search=${prjParts[1]}`; - } - return httpClient.get(url).pipe( - map((repos: any) => { - return repos.map(item => item.path_with_namespace); - }) + + const obs$ = prjParts.length > 1 ? + this.getMatchingUserGroupRepositories(httpClient, prjParts) : + httpClient.get(`${gitLabAPIUrl}/projects?search=${projectName}`, { + params: { + [GITLAB_PER_PAGE_PARAM]: GITLAB_PER_PAGE_PARAM_VALUE.toString() + } + }); + + return obs$.pipe( + map((repos: any[]) => repos.map(item => item.path_with_namespace)), ); } + private getMatchingUserGroupRepositories(httpClient: HttpClient, prjParts: string[]): Observable { + return combineLatest([ + httpClient.get<[]>(`${gitLabAPIUrl}/users/${prjParts[0]}/projects/?search=${prjParts[1]}`).pipe(catchError(() => of([]))), + httpClient.get<[]>(`${gitLabAPIUrl}/groups/${prjParts[0]}/projects?search=${prjParts[1]}`).pipe(catchError(() => of([]))), + ]).pipe( + map(([a, b]: [any[], any[]]) => a.concat(b)), + ) + } + private convertProject(prj: any): GitRepo { return { ...prj, diff --git a/src/frontend/packages/cloud-foundry/src/shared/directives/app-name-unique.directive/app-name-unique.directive.ts b/src/frontend/packages/cloud-foundry/src/shared/directives/app-name-unique.directive/app-name-unique.directive.ts index eab0dac1b9..59870a82a3 100644 --- a/src/frontend/packages/cloud-foundry/src/shared/directives/app-name-unique.directive/app-name-unique.directive.ts +++ b/src/frontend/packages/cloud-foundry/src/shared/directives/app-name-unique.directive/app-name-unique.directive.ts @@ -9,11 +9,9 @@ import { CFAppState } from '../../../cf-app-state'; import { environment } from './../../../../../core/src/environments/environment.prod'; import { selectNewAppState } from './../../../store/effects/create-app-effects'; -/* tslint:disable:no-use-before-declare */ const APP_UNIQUE_NAME_PROVIDER = { provide: NG_ASYNC_VALIDATORS, useExisting: forwardRef(() => AppNameUniqueDirective), multi: true }; -/* tslint:enable */ // See: https://medium.com/@kahlil/asynchronous-validation-with-angular-reactive-forms-1a392971c062 @@ -65,7 +63,7 @@ export class AppNameUniqueDirective implements AsyncValidator, OnInit { this.appApplicationNameUnique.set(false); } - public validate(control: AbstractControl): Observable<{ appNameTaken: boolean } | null> { + public validate(control: AbstractControl): Observable<{ appNameTaken: boolean; } | null> { if (!control.dirty) { return observableOf(null); } diff --git a/src/frontend/packages/cloud-foundry/src/store/effects/deploy-app.effects.ts b/src/frontend/packages/cloud-foundry/src/store/effects/deploy-app.effects.ts index 11a4310bf8..c840fe50b1 100644 --- a/src/frontend/packages/cloud-foundry/src/store/effects/deploy-app.effects.ts +++ b/src/frontend/packages/cloud-foundry/src/store/effects/deploy-app.effects.ts @@ -5,7 +5,6 @@ import { Store } from '@ngrx/store'; import { of as observableOf } from 'rxjs'; import { catchError, filter, map, mergeMap, switchMap, withLatestFrom } from 'rxjs/operators'; -import { LoggerService } from '../../../../core/src/core/logger.service'; import { entityCatalog } from '../../../../store/src/entity-catalog/entity-catalog'; import { NormalizedResponse } from '../../../../store/src/types/api.types'; import { PaginatedAction } from '../../../../store/src/types/pagination.types'; @@ -36,24 +35,24 @@ import { CF_ENDPOINT_TYPE } from '../../cf-types'; import { selectDeployAppState } from '../selectors/deploy-application.selector'; import { GitCommit } from '../types/git.types'; -function parseHttpPipeError(res: any, logger: LoggerService): { message?: string } { +function parseHttpPipeError(res: any): { message?: string } { if (!res.status) { return res; } try { return res.json ? res.json() : res; } catch (e) { - logger.warn('Failed to parse response body', e); + console.warn('Failed to parse response body', e); } return {}; } -export function createFailedGithubRequestMessage(error: any, logger: LoggerService) { - const response = parseHttpPipeError(error, logger); +export function createFailedGithubRequestMessage(error: any) { + const response = parseHttpPipeError(error); const message = response.message || ''; return error.status === 403 && message.startsWith('API rate limit exceeded for') ? - 'Github ' + message.substring(0, message.indexOf('(')) : - 'Github request failed'; + 'Git ' + message.substring(0, message.indexOf('(')) : + 'Git request failed'; } @Injectable() @@ -61,7 +60,6 @@ export class DeployAppEffects { constructor( private actions$: Actions, private store: Store, - private logger: LoggerService, private httpClient: HttpClient ) { } @@ -77,7 +75,7 @@ export class DeployAppEffects { map(res => new ProjectExists(action.projectName, res)), catchError(err => observableOf(err.status === 404 ? new ProjectDoesntExist(action.projectName) : - new ProjectFetchFail(action.projectName, createFailedGithubRequestMessage(err, this.logger)) + new ProjectFetchFail(action.projectName, createFailedGithubRequestMessage(err)) )) ); }) @@ -120,7 +118,7 @@ export class DeployAppEffects { ]; }), catchError(err => [ - new WrapperRequestActionFailed(createFailedGithubRequestMessage(err, this.logger), apiAction, actionType) + new WrapperRequestActionFailed(createFailedGithubRequestMessage(err), apiAction, actionType) ])); })); @@ -152,7 +150,7 @@ export class DeployAppEffects { ]; }), catchError(err => [ - new WrapperRequestActionFailed(createFailedGithubRequestMessage(err, this.logger), apiAction, actionType) + new WrapperRequestActionFailed(createFailedGithubRequestMessage(err), apiAction, actionType) ])); })); @@ -180,7 +178,7 @@ export class DeployAppEffects { ]; }), catchError(err => [ - new WrapperRequestActionFailed(createFailedGithubRequestMessage(err, this.logger), apiAction, actionType) + new WrapperRequestActionFailed(createFailedGithubRequestMessage(err), apiAction, actionType) ])); })); @@ -211,7 +209,7 @@ export class DeployAppEffects { ]; }), catchError(err => [ - new WrapperRequestActionFailed(createFailedGithubRequestMessage(err, this.logger), apiAction, actionType) + new WrapperRequestActionFailed(createFailedGithubRequestMessage(err), apiAction, actionType) ])); })); diff --git a/src/frontend/packages/cloud-foundry/src/store/effects/github.effects.ts b/src/frontend/packages/cloud-foundry/src/store/effects/github.effects.ts index 0864d7b8da..cf534bc46a 100644 --- a/src/frontend/packages/cloud-foundry/src/store/effects/github.effects.ts +++ b/src/frontend/packages/cloud-foundry/src/store/effects/github.effects.ts @@ -4,7 +4,6 @@ import { Actions, Effect, ofType } from '@ngrx/effects'; import { Store } from '@ngrx/store'; import { catchError, mergeMap } from 'rxjs/operators'; -import { LoggerService } from '../../../../core/src/core/logger.service'; import { NormalizedResponse } from '../../../../store/src/types/api.types'; import { StartRequestAction, @@ -29,7 +28,6 @@ export class GithubEffects { private actions$: Actions, private store: Store, private scmService: GitSCMService, - private logger: LoggerService, private httpClient: HttpClient ) { } @Effect() @@ -57,7 +55,7 @@ export class GithubEffects { ]; }), catchError(err => [ - new WrapperRequestActionFailed(createFailedGithubRequestMessage(err, this.logger), apiAction, actionType) + new WrapperRequestActionFailed(createFailedGithubRequestMessage(err), apiAction, actionType) ] )); })); diff --git a/src/frontend/packages/cloud-foundry/src/store/effects/request.effects.ts b/src/frontend/packages/cloud-foundry/src/store/effects/request.effects.ts index 9cd7107c35..ed653a0ddd 100644 --- a/src/frontend/packages/cloud-foundry/src/store/effects/request.effects.ts +++ b/src/frontend/packages/cloud-foundry/src/store/effects/request.effects.ts @@ -3,7 +3,6 @@ import { Actions, Effect, ofType } from '@ngrx/effects'; import { Store } from '@ngrx/store'; import { catchError, first, map, mergeMap, withLatestFrom } from 'rxjs/operators'; -import { LoggerService } from '../../../../core/src/core/logger.service'; import { SET_PAGE_BUSY } from '../../../../store/src/actions/pagination.actions'; import { rootUpdatingKey } from '../../../../store/src/reducers/api-request-reducer/types'; import { getAPIRequestDataState } from '../../../../store/src/selectors/api.selectors'; @@ -26,7 +25,6 @@ export class CfValidateEffects { constructor( private actions$: Actions, private store: Store, - private logger: LoggerService, ) { } /** @@ -89,7 +87,7 @@ export class CfValidateEffects { }) ) .pipe(catchError(error => { - this.logger.warn(`Entity validation process failed`, error); + console.warn(`Entity validation process failed`, error); this.update(apiAction, false, error.message); return []; })); diff --git a/src/frontend/packages/cloud-foundry/src/store/effects/users-roles.effects.ts b/src/frontend/packages/cloud-foundry/src/store/effects/users-roles.effects.ts index c75fb997b0..789eeb837e 100644 --- a/src/frontend/packages/cloud-foundry/src/store/effects/users-roles.effects.ts +++ b/src/frontend/packages/cloud-foundry/src/store/effects/users-roles.effects.ts @@ -2,9 +2,6 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Actions, Effect, ofType } from '@ngrx/effects'; import { Store } from '@ngrx/store'; -import { - ManageUsersSetUsernamesHelper, -} from 'frontend/packages/cloud-foundry/src/features/cf/users/manage-users/manage-users-set-usernames/manage-users-set-usernames.component'; import { combineLatest as observableCombineLatest, combineLatest, Observable, of as observableOf, of } from 'rxjs'; import { catchError, filter, first, map, mergeMap, pairwise, switchMap, tap, withLatestFrom } from 'rxjs/operators'; @@ -21,6 +18,9 @@ import { AddCfUserRole, ChangeCfUserRole, RemoveCfUserRole } from '../../actions import { CFAppState } from '../../cf-app-state'; import { organizationEntityType, spaceEntityType } from '../../cf-entity-types'; import { CF_ENDPOINT_TYPE } from '../../cf-types'; +import { + ManageUsersSetUsernamesHelper, +} from '../../features/cf/users/manage-users/manage-users-set-usernames/manage-users-set-usernames.component'; import { CfUserService } from '../../shared/data-services/cf-user.service'; import { fetchCfUserRole } from '../../user-permissions/cf-user-roles-fetch'; import { selectCfUsersRoles } from '../selectors/cf-users-roles.selector'; diff --git a/src/frontend/packages/cloud-foundry/src/user-permissions/cf-user-permissions-checkers.ts b/src/frontend/packages/cloud-foundry/src/user-permissions/cf-user-permissions-checkers.ts index 1aead1cd0f..f30b7697b4 100644 --- a/src/frontend/packages/cloud-foundry/src/user-permissions/cf-user-permissions-checkers.ts +++ b/src/frontend/packages/cloud-foundry/src/user-permissions/cf-user-permissions-checkers.ts @@ -39,7 +39,7 @@ export const cfCurrentUserPermissionsService = [ deps: [Store] }, CurrentUserPermissionsService, -] +]; export enum CfCurrentUserPermissions { APPLICATION_VIEW = 'view.application', @@ -164,7 +164,10 @@ export const cfPermissionConfigs: IPermissionConfigs = { [CfCurrentUserPermissions.ORGANIZATION_DELETE]: new PermissionConfig(CfPermissionTypes.ENDPOINT_SCOPE, CfScopeStrings.CF_ADMIN_GROUP), [CfCurrentUserPermissions.ORGANIZATION_EDIT]: new PermissionConfigLink(CfCurrentUserPermissions.ORGANIZATION_DELETE), [CfCurrentUserPermissions.ORGANIZATION_SUSPEND]: new PermissionConfig(CfPermissionTypes.ENDPOINT_SCOPE, CfScopeStrings.CF_ADMIN_GROUP), - [CfCurrentUserPermissions.ORGANIZATION_CHANGE_ROLES]: new PermissionConfig(CfPermissionTypes.ORGANIZATION, CfPermissionStrings.ORG_MANAGER), + [CfCurrentUserPermissions.ORGANIZATION_CHANGE_ROLES]: new PermissionConfig( + CfPermissionTypes.ORGANIZATION, + CfPermissionStrings.ORG_MANAGER + ), [CfCurrentUserPermissions.SERVICE_INSTANCE_DELETE]: new PermissionConfig(CfPermissionTypes.SPACE, CfPermissionStrings.SPACE_DEVELOPER), [CfCurrentUserPermissions.SERVICE_INSTANCE_CREATE]: new PermissionConfig(CfPermissionTypes.SPACE, CfPermissionStrings.SPACE_DEVELOPER), [CfCurrentUserPermissions.SERVICE_INSTANCE_EDIT]: new PermissionConfig(CfPermissionTypes.SPACE, CfPermissionStrings.SPACE_DEVELOPER), @@ -191,7 +194,9 @@ export class CfUserPermissionsChecker extends BaseCurrentUserPermissionsChecker endpointGuid?: string, orgOrSpaceGuid?: string, allSpacesWithinOrg = false - ) { + ): Observable { + // In some situations the observable returned here is not subscribed to (for example due to applyAdminCheck). + // This is bad (we should skip this function entirely) and should be fixed. This would require a thorough appraisal and overhaul. if (type === CfPermissionTypes.ENDPOINT_SCOPE) { if (!endpointGuid) { return of(false); @@ -217,8 +222,8 @@ export class CfUserPermissionsChecker extends BaseCurrentUserPermissionsChecker }; /** - * @param permissionConfig Single permission to be checked - */ + * @param permissionConfig Single permission to be checked + */ public getSimpleCheck(permissionConfig: PermissionConfig, endpointGuid?: string, orgOrSpaceGuid?: string, spaceGuid?: string) { const check$ = this.getBaseSimpleCheck(permissionConfig, endpointGuid, orgOrSpaceGuid, spaceGuid); if (permissionConfig.type === CfPermissionTypes.ORGANIZATION || permissionConfig.type === CfPermissionTypes.SPACE) { @@ -327,8 +332,8 @@ export class CfUserPermissionsChecker extends BaseCurrentUserPermissionsChecker } /** - * Includes read only admins, global auditors and users that don't have the cloud_controller.write scope - */ + * Includes read only admins, global auditors and users that don't have the cloud_controller.write scope + */ private getReadOnlyCheck(endpointGuid: string) { return this.getCfEndpointState(endpointGuid).pipe( map( @@ -357,6 +362,7 @@ export class CfUserPermissionsChecker extends BaseCurrentUserPermissionsChecker return of(true); } if (isReadOnly) { + // This is bad, we should not assume that the check type wants a negative result if the user only has 'read only' rights. return of(false); } return check$; @@ -365,8 +371,8 @@ export class CfUserPermissionsChecker extends BaseCurrentUserPermissionsChecker } /** - * If no endpoint is passed, check them all - */ + * If no endpoint is passed, check them all + */ private getReadOnlyChecks(endpointGuid?: string) { const endpointGuids$ = this.getEndpointGuidObservable(endpointGuid); return endpointGuids$.pipe( @@ -431,9 +437,9 @@ export class CfUserPermissionsChecker extends BaseCurrentUserPermissionsChecker const groupedChecks = this.groupConfigs(permissionConfigs); return Object.keys(groupedChecks).map((permission: PermissionTypes) => { const configGroup = groupedChecks[permission]; - const checkCombiner = this.getBaseCheckFromConfig(configGroup, permission, endpointGuid, orgOrSpaceGuid, spaceGuid) + const checkCombiner = this.getBaseCheckFromConfig(configGroup, permission, endpointGuid, orgOrSpaceGuid, spaceGuid); if (checkCombiner) { - checkCombiner.checks = checkCombiner.checks.map(check$ => this.applyAdminCheck(check$, endpointGuid)) + checkCombiner.checks = checkCombiner.checks.map(check$ => this.applyAdminCheck(check$, endpointGuid)); } return checkCombiner; }); diff --git a/src/frontend/packages/cloud-foundry/src/user-permissions/cf-user-roles-fetch.ts b/src/frontend/packages/cloud-foundry/src/user-permissions/cf-user-roles-fetch.ts index 06340d5496..e26807ae1b 100644 --- a/src/frontend/packages/cloud-foundry/src/user-permissions/cf-user-roles-fetch.ts +++ b/src/frontend/packages/cloud-foundry/src/user-permissions/cf-user-roles-fetch.ts @@ -31,7 +31,10 @@ import { cfEntityCatalog } from '../cf-entity-catalog'; import { CF_ENDPOINT_TYPE } from '../cf-types'; import { CFResponse } from '../store/types/cf-api.types'; -const createEndpointArray = (store: Store, endpoints: string[] | EntityUserRolesEndpoint[]): Observable => { +const createEndpointArray = ( + store: Store, + endpoints: string[] | EntityUserRolesEndpoint[] +): Observable => { // If there's no endpoints get all from store. Alternatively fetch specific endpoint id's from store if (!endpoints || !endpoints.length || typeof (endpoints[0]) === 'string') { const endpointIds = endpoints as string[]; @@ -44,7 +47,7 @@ const createEndpointArray = (store: Store, endpoints: string[] | Entit ); } return of(endpoints as EntityUserRolesEndpoint[]); -} +}; export const cfUserRolesFetch: EntityUserRolesFetch = ( endpoints: string[] | EntityUserRolesEndpoint[], @@ -56,7 +59,7 @@ export const cfUserRolesFetch: EntityUserRolesFetch = ( const isAllAdmins = cfEndpoints.every(endpoint => !!endpoint.user.admin); // If all endpoints are connected as admin, there's no permissions to fetch. So only update the permission state to initialised if (isAllAdmins) { - cfEndpoints.forEach(endpoint => store.dispatch(new GetCfUserRelations(endpoint.guid, GET_CURRENT_CF_USER_RELATIONS_SUCCESS))) + cfEndpoints.forEach(endpoint => store.dispatch(new GetCfUserRelations(endpoint.guid, GET_CURRENT_CF_USER_RELATIONS_SUCCESS))); } else { // If some endpoints are not connected as admin, go out and fetch the current user's specific roles const flagsAndRoleRequests = dispatchRoleRequests(cfEndpoints, store, httpClient); @@ -67,8 +70,8 @@ export const cfUserRolesFetch: EntityUserRolesFetch = ( } return of(true); }) - ) -} + ); +}; interface CfsRequestState { [cfGuid: string]: Observable[]; @@ -97,7 +100,7 @@ function dispatchRoleRequests( store.dispatch(new GetCfUserRelations(endpoint.guid, GET_CURRENT_CF_USER_RELATIONS)); // Dispatch feature flags fetch actions - const ffAction = cfEntityCatalog.featureFlag.actions.getMultiple(endpoint.guid) + const ffAction = cfEntityCatalog.featureFlag.actions.getMultiple(endpoint.guid); requests[endpoint.guid] = [createPaginationCompleteWatcher(store, ffAction)]; store.dispatch(ffAction); @@ -142,7 +145,7 @@ function fetchCfUserRoles(endpoint: IEndpointConnectionInfo, store: Store implements PaginationFlattener { - constructor(httpClient: HttpClient, public url, public requestOptions: { [key: string]: any }) { + constructor(httpClient: HttpClient, public url, public requestOptions: { [key: string]: any; }) { super(httpClient, url, requestOptions, 'page'); } public getTotalPages = (res: CFResponse) => res.total_pages; @@ -156,7 +159,7 @@ class PermissionFlattener extends BaseHttpClientFetcher implements P return finalRes; }, firstRes); return final; - } + }; public getTotalResults = (res: CFResponse): number => res.total_results; public clearResults = (res: CFResponse) => of(res); } diff --git a/src/frontend/packages/core/sass/components/json-schema-form.scss b/src/frontend/packages/core/sass/components/json-schema-form.scss new file mode 100644 index 0000000000..9f004b481a --- /dev/null +++ b/src/frontend/packages/core/sass/components/json-schema-form.scss @@ -0,0 +1,5 @@ +json-schema-form { + mat-error.mat-error { + margin-bottom: .05rem; + } +} diff --git a/src/frontend/packages/core/src/api-driven-views/api-drive-views.types.ts b/src/frontend/packages/core/src/api-driven-views/api-drive-views.types.ts deleted file mode 100644 index 7e902d54dd..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/api-drive-views.types.ts +++ /dev/null @@ -1,7 +0,0 @@ -export class ApiEntityType { - constructor( - public type: string, - public title: string, - public imageUrl?: string - ) { } -} diff --git a/src/frontend/packages/core/src/api-driven-views/api-driven-views-routing.module.ts b/src/frontend/packages/core/src/api-driven-views/api-driven-views-routing.module.ts deleted file mode 100644 index 1f7e0d4da2..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/api-driven-views-routing.module.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; - -import { ApiEndpointTypeSelectPageComponent } from './features/api-endpoint-type-select-page/api-endpoint-type-select-page.component'; -import { ApiEntityTypeSelectPageComponent } from './features/api-entity-type-select-page/api-entity-type-select-page.component'; -import { ApiEndpointSelectPageComponent } from './features/api-endpoint-select-page/api-endpoint-select-page.component'; -import { ApiEntityListPageComponent } from './features/api-entity-list-page/api-entity-list-page.component'; - -const routes: Routes = [ - { - path: '', - component: ApiEndpointTypeSelectPageComponent, - // children: [ - // { - // path: ':endpointType', - // component: ApiEntityTypeSelectPageComponent, - // children: [{ - // path: '/:endpointGuid', - // children: [{ - // path: '/:entityType' - // }] - // }] - // } - // ] - - }, - { - path: ':endpointType', - component: ApiEndpointSelectPageComponent - }, - { - path: ':endpointType/:endpointId', - component: ApiEntityTypeSelectPageComponent, - children: [{ - path: ':entityType', - component: ApiEntityListPageComponent - }] - } -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule] -}) -export class ApiDrivenViewsRoutingModule { } diff --git a/src/frontend/packages/core/src/api-driven-views/api-driven-views.module.ts b/src/frontend/packages/core/src/api-driven-views/api-driven-views.module.ts deleted file mode 100644 index 351b6eb173..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/api-driven-views.module.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; - -import { ApiDrivenViewsRoutingModule } from './api-driven-views-routing.module'; -import { ApiEndpointSelectPageComponent } from './features/api-endpoint-select-page/api-endpoint-select-page.component'; -import { ApiEndpointTypeSelectPageComponent } from './features/api-endpoint-type-select-page/api-endpoint-type-select-page.component'; -import { ApiEntityTypeSelectPageComponent } from './features/api-entity-type-select-page/api-entity-type-select-page.component'; -import { ApiEntityListPageComponent } from './features/api-entity-list-page/api-entity-list-page.component'; -import { SharedModule } from '../shared/shared.module'; -import { ApiEntityListComponent } from './components/api-entity-list/api-entity-list.component'; -import { ApiEntityTypeSelectorComponent } from './components/api-type-selector/api-entity-type-selector.component'; - -@NgModule({ - declarations: [ - ApiEndpointSelectPageComponent, - ApiEndpointTypeSelectPageComponent, - ApiEntityTypeSelectPageComponent, - ApiEntityListPageComponent, - ApiEntityListComponent, - ApiEntityTypeSelectorComponent - ], - imports: [ - CommonModule, - SharedModule, - ApiDrivenViewsRoutingModule - ] -}) -export class ApiDrivenViewsModule { } diff --git a/src/frontend/packages/core/src/api-driven-views/components/api-entity-list/api-entity-list.component.html b/src/frontend/packages/core/src/api-driven-views/components/api-entity-list/api-entity-list.component.html deleted file mode 100644 index c987a3c5a9..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/components/api-entity-list/api-entity-list.component.html +++ /dev/null @@ -1 +0,0 @@ -

api-entity-list works!

diff --git a/src/frontend/packages/core/src/api-driven-views/components/api-entity-list/api-entity-list.component.scss b/src/frontend/packages/core/src/api-driven-views/components/api-entity-list/api-entity-list.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/frontend/packages/core/src/api-driven-views/components/api-entity-list/api-entity-list.component.spec.ts b/src/frontend/packages/core/src/api-driven-views/components/api-entity-list/api-entity-list.component.spec.ts deleted file mode 100644 index f3913cbda0..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/components/api-entity-list/api-entity-list.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ApiEntityListComponent } from './api-entity-list.component'; - -describe('ApiEntityListComponent', () => { - let component: ApiEntityListComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ApiEntityListComponent] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ApiEntityListComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/frontend/packages/core/src/api-driven-views/components/api-entity-list/api-entity-list.component.ts b/src/frontend/packages/core/src/api-driven-views/components/api-entity-list/api-entity-list.component.ts deleted file mode 100644 index 45a254629d..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/components/api-entity-list/api-entity-list.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-api-entity-list', - templateUrl: './api-entity-list.component.html', - styleUrls: ['./api-entity-list.component.scss'] -}) -export class ApiEntityListComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/src/frontend/packages/core/src/api-driven-views/components/api-type-selector/api-entity-type-selector.component.html b/src/frontend/packages/core/src/api-driven-views/components/api-type-selector/api-entity-type-selector.component.html deleted file mode 100644 index e18ecb279a..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/components/api-type-selector/api-entity-type-selector.component.html +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/src/frontend/packages/core/src/api-driven-views/components/api-type-selector/api-entity-type-selector.component.scss b/src/frontend/packages/core/src/api-driven-views/components/api-type-selector/api-entity-type-selector.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/frontend/packages/core/src/api-driven-views/components/api-type-selector/api-entity-type-selector.component.spec.ts b/src/frontend/packages/core/src/api-driven-views/components/api-type-selector/api-entity-type-selector.component.spec.ts deleted file mode 100644 index b54398c933..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/components/api-type-selector/api-entity-type-selector.component.spec.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ApiEntityType } from '../../api-drive-views.types'; -import { SharedModule } from '../../../shared/shared.module'; -import { ApiEntityTypeSelectorComponent } from './api-entity-type-selector.component'; -import { ApiDrivenViewsModule } from '../../api-driven-views.module'; - -describe('ApiEntityTypeSelectorComponent', () => { - let component: ApiEntityTypeSelectorComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [SharedModule, ApiDrivenViewsModule] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ApiEntityTypeSelectorComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); - - it('should render endpoint', () => { - const endpointTypes: ApiEntityType[] = [{ - title: 'Endpoint1', - imageUrl: 'image1', - type: 'endpoint1Type' - }, - { - title: 'Endpoint2', - imageUrl: 'image2', - type: 'endpoint2Type' - }]; - component.entityTypes = endpointTypes; - fixture.detectChanges(); - const element: HTMLElement = fixture.nativeElement; - const tileElements = Array.from(element.getElementsByClassName('tile-selector')); - expect(tileElements.length).toBe(2); - expect(tileElements.length).toBe(2); - tileElements.forEach((tile, index) => { - expect(tile.getElementsByClassName('tile-selector__content')[0].textContent) - .toBe(endpointTypes[index].title); - expect( - tile.getElementsByClassName('tile-selector__header')[0] - .getElementsByTagName('img')[0] - .attributes.getNamedItem('src') - .value - ) - .toBe(endpointTypes[index].imageUrl); - - }); - }); -}); diff --git a/src/frontend/packages/core/src/api-driven-views/components/api-type-selector/api-entity-type-selector.component.ts b/src/frontend/packages/core/src/api-driven-views/components/api-type-selector/api-entity-type-selector.component.ts deleted file mode 100644 index eb61fb957d..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/components/api-type-selector/api-entity-type-selector.component.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Component, OnInit, Input, Output } from '@angular/core'; -import { ApiEntityType } from '../../api-drive-views.types'; -import { ITileConfig, ITileImgConfig } from '../../../shared/components/tile/tile-selector.types'; -import { Subject } from 'rxjs'; - -@Component({ - selector: 'app-api-entity-type-selector', - templateUrl: './api-entity-type-selector.component.html', - styleUrls: ['./api-entity-type-selector.component.scss'] -}) -export class ApiEntityTypeSelectorComponent implements OnInit { - public entityTiles: ITileConfig[]; - @Input() set entityTypes(types: ApiEntityType[]) { - this.entityTiles = types.map(type => { - return new ITileConfig(type.title, { - location: type.imageUrl - }, { - type: type.type - } - ); - }); - } - @Output() public entitySelected = new Subject(); - - public emitEntitySelection(tile: ITileConfig) { - if (tile) { - this.entitySelected.next( - new ApiEntityType(tile.data.type as string, tile.label as string, (tile.graphic as ITileImgConfig).location) - ); - } else { - this.entitySelected.next(null); - } - } - - constructor() { } - - ngOnInit() { - } - -} diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-select-page/api-endpoint-select-page.component.html b/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-select-page/api-endpoint-select-page.component.html deleted file mode 100644 index 52f7688c92..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-select-page/api-endpoint-select-page.component.html +++ /dev/null @@ -1,6 +0,0 @@ - - Select Endpoint - - - \ No newline at end of file diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-select-page/api-endpoint-select-page.component.scss b/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-select-page/api-endpoint-select-page.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-select-page/api-endpoint-select-page.component.spec.ts b/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-select-page/api-endpoint-select-page.component.spec.ts deleted file mode 100644 index e8e2769c61..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-select-page/api-endpoint-select-page.component.spec.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; -import { TabNavService } from 'frontend/packages/core/tab-nav.service'; -import { generateBaseTestStoreModules } from 'frontend/packages/core/test-framework/core-test.helper'; - -import { CoreModule } from '../../../core/core.module'; -import { SharedModule } from '../../../shared/shared.module'; -import { ApiDrivenViewsModule } from '../../api-driven-views.module'; -import { ApiEndpointSelectPageComponent } from './api-endpoint-select-page.component'; - -describe('ApiEndpointSelectPageComponent', () => { - let component: ApiEndpointSelectPageComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [ - ...generateBaseTestStoreModules(), - CoreModule, - RouterTestingModule, - SharedModule, - ApiDrivenViewsModule, - ], - providers: [ - TabNavService, - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ApiEndpointSelectPageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-select-page/api-endpoint-select-page.component.ts b/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-select-page/api-endpoint-select-page.component.ts deleted file mode 100644 index 01b3c5f54e..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-select-page/api-endpoint-select-page.component.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { GeneralAppState } from '../../../../../store/src/app-state'; -import { Observable } from 'rxjs'; -import { ApiEntityType } from '../../api-drive-views.types'; -import { Store } from '@ngrx/store'; -import { connectedEndpointsOfTypesSelector } from '../../../../../store/src/selectors/endpoint.selectors'; -import { ActivatedRoute, Router } from '@angular/router'; -import { map, filter } from 'rxjs/operators'; - -@Component({ - selector: 'app-api-endpoint-select-page', - templateUrl: './api-endpoint-select-page.component.html', - styleUrls: ['./api-endpoint-select-page.component.scss'] -}) -export class ApiEndpointSelectPageComponent implements OnInit { - public connectedEndpointsOfType$: Observable; - constructor( - private store: Store, - private route: ActivatedRoute, - private router: Router - ) { } - public endpointSelected(endpoint: ApiEntityType) { - this.router.navigate([endpoint.type], { relativeTo: this.route }); - } - ngOnInit() { - const endpointType = this.route.snapshot.params.endpointType; - - this.connectedEndpointsOfType$ = this.store.select(connectedEndpointsOfTypesSelector(endpointType)).pipe( - map(endpointsMap => Object.values(endpointsMap)), - filter(endpoints => !!endpoints || !endpoints.length), - map(endpoints => endpoints.map(endpoint => new ApiEntityType( - endpoint.guid, - endpoint.name - // TODO Get icon from entity catalog - ))) - ); - } - -} diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-type-select-page/api-endpoint-type-select-page.component.html b/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-type-select-page/api-endpoint-type-select-page.component.html deleted file mode 100644 index 63099672f9..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-type-select-page/api-endpoint-type-select-page.component.html +++ /dev/null @@ -1,6 +0,0 @@ - - Select Endpoint Type - - - \ No newline at end of file diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-type-select-page/api-endpoint-type-select-page.component.scss b/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-type-select-page/api-endpoint-type-select-page.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-type-select-page/api-endpoint-type-select-page.component.spec.ts b/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-type-select-page/api-endpoint-type-select-page.component.spec.ts deleted file mode 100644 index 960cbecc80..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-type-select-page/api-endpoint-type-select-page.component.spec.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; -import { TabNavService } from 'frontend/packages/core/tab-nav.service'; - -import { generateBaseTestStoreModules } from '../../../../test-framework/core-test.helper'; -import { CoreModule } from '../../../core/core.module'; -import { SharedModule } from '../../../shared/shared.module'; -import { ApiDrivenViewsModule } from '../../api-driven-views.module'; -import { ApiEndpointTypeSelectPageComponent } from './api-endpoint-type-select-page.component'; - -describe('ApiEndpointTypeSelectPageComponent', () => { - let component: ApiEndpointTypeSelectPageComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [ - ...generateBaseTestStoreModules(), - CoreModule, - RouterTestingModule, - SharedModule, - ApiDrivenViewsModule, - ], - providers: [TabNavService] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ApiEndpointTypeSelectPageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-type-select-page/api-endpoint-type-select-page.component.ts b/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-type-select-page/api-endpoint-type-select-page.component.ts deleted file mode 100644 index c897ea9c69..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/features/api-endpoint-type-select-page/api-endpoint-type-select-page.component.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; -import { Store } from '@ngrx/store'; -import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; - -import { GeneralAppState } from '../../../../../store/src/app-state'; -import { endpointEntitiesSelector } from '../../../../../store/src/selectors/endpoint.selectors'; -import { entityCatalog } from '../../../../../store/src/entity-catalog/entity-catalog'; -import { ApiEntityType } from '../../api-drive-views.types'; - -@Component({ - selector: 'app-api-endpoint-type-select-page', - templateUrl: './api-endpoint-type-select-page.component.html', - styleUrls: ['./api-endpoint-type-select-page.component.scss'] -}) -export class ApiEndpointTypeSelectPageComponent implements OnInit { - public connectedEndpointTypes$: Observable; - constructor( - public store: Store, - public router: Router, - public activeRoute: ActivatedRoute - ) { } - public endpointSelected(endpoint: ApiEntityType) { - this.router.navigate([endpoint.type], { relativeTo: this.activeRoute }); - } - ngOnInit() { - const endpointTypes = entityCatalog.getAllEndpointTypes(); - const endpointTypesWithEntities = endpointTypes - .filter(endpointType => entityCatalog.getAllEntitiesForEndpointType(endpointType.type).length > 0); - this.connectedEndpointTypes$ = this.store.select(endpointEntitiesSelector).pipe( - map(endpoints => { - const endpointTypeSet = new Set(); - Object.values(endpoints).forEach(endpoint => { - if (endpoint.connectionStatus === 'connected') { - endpointTypeSet.add(endpoint.cnsi_type); - } - }); - return Array.from(endpointTypeSet) - .map(type => endpointTypesWithEntities.find(endpoint => endpoint.type === type)) - .filter(endpoint => !!endpoint) - .map(endpoint => new ApiEntityType(endpoint.type, endpoint.definition.label, endpoint.definition.logoUrl)); - }) - ); - } - -} diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-entity-list-page/api-entity-list-page.component.html b/src/frontend/packages/core/src/api-driven-views/features/api-entity-list-page/api-entity-list-page.component.html deleted file mode 100644 index e3a7a3b7f3..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/features/api-entity-list-page/api-entity-list-page.component.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-entity-list-page/api-entity-list-page.component.scss b/src/frontend/packages/core/src/api-driven-views/features/api-entity-list-page/api-entity-list-page.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-entity-list-page/api-entity-list-page.component.spec.ts b/src/frontend/packages/core/src/api-driven-views/features/api-entity-list-page/api-entity-list-page.component.spec.ts deleted file mode 100644 index b06b48139e..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/features/api-entity-list-page/api-entity-list-page.component.spec.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; - -import { generateBaseTestStoreModules } from '../../../../test-framework/core-test.helper'; -import { CoreModule } from '../../../core/core.module'; -import { SharedModule } from '../../../shared/shared.module'; -import { ApiDrivenViewsModule } from '../../api-driven-views.module'; -import { ApiEntityListPageComponent } from './api-entity-list-page.component'; - -describe('ApiEntityListPageComponent', () => { - let component: ApiEntityListPageComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [ - ...generateBaseTestStoreModules(), - CoreModule, - RouterTestingModule, - SharedModule, - ApiDrivenViewsModule, - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ApiEntityListPageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-entity-list-page/api-entity-list-page.component.ts b/src/frontend/packages/core/src/api-driven-views/features/api-entity-list-page/api-entity-list-page.component.ts deleted file mode 100644 index eff169381f..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/features/api-entity-list-page/api-entity-list-page.component.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; - -import { entityCatalog } from '../../../../../store/src/entity-catalog/entity-catalog'; -import { - StratosBaseCatalogEntity, -} from '../../../../../store/src/entity-catalog/entity-catalog-entity/entity-catalog-entity'; - -@Component({ - selector: 'app-api-entity-list-page', - templateUrl: './api-entity-list-page.component.html', - styleUrls: ['./api-entity-list-page.component.scss'] -}) -export class ApiEntityListPageComponent implements OnInit { - public catalogEntity: StratosBaseCatalogEntity; - constructor( - public route: ActivatedRoute - ) { } - - ngOnInit() { - const endpointType = this.route.parent ? this.route.parent.snapshot.params.endpointType : null; - const entityType = this.route.snapshot.params.entityType; - this.catalogEntity = entityCatalog.getEntity(endpointType, entityType); - } - -} diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-entity-type-select-page/api-entity-type-select-page.component.html b/src/frontend/packages/core/src/api-driven-views/features/api-entity-type-select-page/api-entity-type-select-page.component.html deleted file mode 100644 index cb561c92a3..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/features/api-entity-type-select-page/api-entity-type-select-page.component.html +++ /dev/null @@ -1,4 +0,0 @@ - - {{ connectedEndpointsOfType$ | async }} - - \ No newline at end of file diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-entity-type-select-page/api-entity-type-select-page.component.scss b/src/frontend/packages/core/src/api-driven-views/features/api-entity-type-select-page/api-entity-type-select-page.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-entity-type-select-page/api-entity-type-select-page.component.spec.ts b/src/frontend/packages/core/src/api-driven-views/features/api-entity-type-select-page/api-entity-type-select-page.component.spec.ts deleted file mode 100644 index 12963030bf..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/features/api-entity-type-select-page/api-entity-type-select-page.component.spec.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; -import { TabNavService } from 'frontend/packages/core/tab-nav.service'; - -import { generateBaseTestStoreModules } from '../../../../test-framework/core-test.helper'; -import { CoreModule } from '../../../core/core.module'; -import { SharedModule } from '../../../shared/shared.module'; -import { ApiDrivenViewsModule } from '../../api-driven-views.module'; -import { ApiEntityTypeSelectPageComponent } from './api-entity-type-select-page.component'; - -describe('ApiEntityTypeSelectPageComponent', () => { - let component: ApiEntityTypeSelectPageComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [ - ...generateBaseTestStoreModules(), - CoreModule, - RouterTestingModule, - SharedModule, - ApiDrivenViewsModule, - ], - providers: [TabNavService] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ApiEntityTypeSelectPageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/frontend/packages/core/src/api-driven-views/features/api-entity-type-select-page/api-entity-type-select-page.component.ts b/src/frontend/packages/core/src/api-driven-views/features/api-entity-type-select-page/api-entity-type-select-page.component.ts deleted file mode 100644 index 69ce1bc3f9..0000000000 --- a/src/frontend/packages/core/src/api-driven-views/features/api-entity-type-select-page/api-entity-type-select-page.component.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; -import { Store } from '@ngrx/store'; -import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; - -import { GeneralAppState } from '../../../../../store/src/app-state'; -import { entityCatalog } from '../../../../../store/src/entity-catalog/entity-catalog'; -import { connectedEndpointsOfTypesSelector } from '../../../../../store/src/selectors/endpoint.selectors'; -import { TabNavService } from '../../../../tab-nav.service'; -import { IPageSideNavTab } from '../../../features/dashboard/page-side-nav/page-side-nav.component'; - -@Component({ - selector: 'app-api-entity-type-select-page', - templateUrl: './api-entity-type-select-page.component.html', - styleUrls: ['./api-entity-type-select-page.component.scss'] -}) -export class ApiEntityTypeSelectPageComponent implements OnInit { - public connectedEndpointsOfType$: Observable; - public tabs: IPageSideNavTab[]; - constructor( - private route: ActivatedRoute, - private router: Router, - private tabNavService: TabNavService, - private store: Store - ) { } - - ngOnInit() { - const endpointGuid = this.route.snapshot.params.endpointId; - const endpointType = this.route.snapshot.params.endpointType; - const endpointEntity = entityCatalog.getEndpoint(endpointType); - const endpointEntities = entityCatalog.getAllEntitiesForEndpointType(endpointType); - const entitiesWithGetMultiple = endpointEntities.filter( - entity => entity && entity.definition.tableConfig && entity.actionOrchestrator.hasActionBuilder('getMultiple') - ); - this.connectedEndpointsOfType$ = this.store.select(connectedEndpointsOfTypesSelector(endpointType)).pipe( - map(endpoints => endpoints[endpointGuid] ? endpoints[endpointGuid].name : 'Entities') - ); - if (endpointEntity) { - this.tabNavService.setHeader(endpointEntity.definition.label); - } - this.tabs = entitiesWithGetMultiple.map(entity => { - return { - link: entity.type, - label: entity.definition.labelPlural, - icon: entity.definition.icon, - iconFont: entity.definition.iconFont - }; - }); - } - -} diff --git a/src/frontend/packages/core/src/app.module.ts b/src/frontend/packages/core/src/app.module.ts index 64f5ca665b..0ed0d1b159 100644 --- a/src/frontend/packages/core/src/app.module.ts +++ b/src/frontend/packages/core/src/app.module.ts @@ -24,8 +24,6 @@ import { generateStratosEntities } from '../../store/src/stratos-entity-generato import { EndpointModel } from '../../store/src/types/endpoint.types'; import { IFavoriteMetadata, UserFavorite } from '../../store/src/types/user-favorites.types'; import { UserFavoriteManager } from '../../store/src/user-favorite-manager'; -import { TabNavService } from '../tab-nav.service'; -import { XSRFModule } from '../xsrf.module'; import { AppComponent } from './app.component'; import { RouteModule } from './app.routing'; import { CoreModule } from './core/core.module'; @@ -47,6 +45,8 @@ import { CustomReuseStrategy } from './route-reuse-stragegy'; import { endpointEventKey, GlobalEventData, GlobalEventService } from './shared/global-events.service'; import { SidePanelService } from './shared/services/side-panel.service'; import { SharedModule } from './shared/shared.module'; +import { TabNavService } from './tab-nav.service'; +import { XSRFModule } from './xsrf.module'; // Create action for router navigation. See // - https://github.com/ngrx/platform/issues/68 diff --git a/src/frontend/packages/core/src/app.routing.ts b/src/frontend/packages/core/src/app.routing.ts index 2020929d92..a54b1c30d5 100644 --- a/src/frontend/packages/core/src/app.routing.ts +++ b/src/frontend/packages/core/src/app.routing.ts @@ -2,6 +2,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { APIKeyAuthGuardService } from './core/apiKey-auth-guard.service'; import { AuthGuardService } from './core/auth-guard.service'; import { CoreModule } from './core/core.module'; import { EndpointsService } from './core/endpoints.service'; @@ -72,7 +73,6 @@ const appRoutes: Routes = [ } } }, - { path: 'entity-list', loadChildren: () => import('./api-driven-views/api-driven-views.module').then(m => m.ApiDrivenViewsModule) }, { path: 'endpoints', data: { @@ -95,6 +95,11 @@ const appRoutes: Routes = [ }, { path: 'about', loadChildren: () => import('./features/about/about.module').then(m => m.AboutModule) }, { path: 'user-profile', loadChildren: () => import('./features/user-profile/user-profile.module').then(m => m.UserProfileModule) }, + { + path: 'api-keys', + loadChildren: () => import('./features/api-keys/api-keys.module').then(m => m.ApiKeysModule), + canActivate: [APIKeyAuthGuardService] + }, { path: 'events', loadChildren: () => import('./features/event-page/event-page.module').then(m => m.EventPageModule) }, { path: 'errors/:endpointId', diff --git a/src/frontend/packages/core/src/core/apiKey-auth-guard.service.ts b/src/frontend/packages/core/src/core/apiKey-auth-guard.service.ts new file mode 100644 index 0000000000..70e965da23 --- /dev/null +++ b/src/frontend/packages/core/src/core/apiKey-auth-guard.service.ts @@ -0,0 +1,30 @@ +import { Injectable } from '@angular/core'; +import { CanActivate } from '@angular/router'; +import { Store } from '@ngrx/store'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; + +import { RouterNav } from '../../../store/src/actions/router.actions'; +import { AppState } from '../../../store/src/app-state'; +import { CurrentUserPermissionsService } from './permissions/current-user-permissions.service'; +import { StratosCurrentUserPermissions } from './permissions/stratos-user-permissions.checker'; + +@Injectable() +export class APIKeyAuthGuardService implements CanActivate { + + constructor( + private store: Store, + private cups: CurrentUserPermissionsService, + ) { } + + canActivate(): Observable { + return this.cups.can(StratosCurrentUserPermissions.API_KEYS).pipe( + map(can => { + if (!can) { + this.store.dispatch(new RouterNav({ path: ['/'] })); + } + return can; + }) + ); + } +} \ No newline at end of file diff --git a/src/frontend/packages/core/src/core/core.module.ts b/src/frontend/packages/core/src/core/core.module.ts index ff8b4eb280..792f489d5c 100644 --- a/src/frontend/packages/core/src/core/core.module.ts +++ b/src/frontend/packages/core/src/core/core.module.ts @@ -12,6 +12,7 @@ import { PaginationMonitorFactory } from '../../../store/src/monitors/pagination import { NoContentMessageComponent } from '../shared/components/no-content-message/no-content-message.component'; import { RecentEntitiesComponent } from '../shared/components/recent-entities/recent-entities.component'; import { UserAvatarComponent } from './../shared/components/user-avatar/user-avatar.component'; +import { APIKeyAuthGuardService } from './apiKey-auth-guard.service'; import { AuthGuardService } from './auth-guard.service'; import { ButtonBlurOnClickDirective } from './button-blur-on-click.directive'; import { BytesToHumanSize, MegaBytesToHumanSize } from './byte-formatters.pipe'; @@ -24,7 +25,6 @@ import { EntityFavoriteStarComponent } from './entity-favorite-star/entity-favor import { EventWatcherService } from './event-watcher/event-watcher.service'; import { InfinityPipe } from './infinity.pipe'; import { LogOutDialogComponent } from './log-out-dialog/log-out-dialog.component'; -import { LoggerService } from './logger.service'; import { MDAppModule } from './md.module'; import { NotSetupGuardService } from './not-setup-guard.service'; import { PageHeaderService } from './page-header-service/page-header.service'; @@ -70,12 +70,12 @@ import { WindowRef } from './window-ref/window-ref.service'; ], providers: [ AuthGuardService, + APIKeyAuthGuardService, NotSetupGuardService, PageHeaderService, EventWatcherService, WindowRef, UtilsService, - LoggerService, EndpointsService, UserService, EntityServiceFactory, diff --git a/src/frontend/packages/core/endpoints-health-checks.ts b/src/frontend/packages/core/src/core/endpoints-health-checks.ts similarity index 74% rename from src/frontend/packages/core/endpoints-health-checks.ts rename to src/frontend/packages/core/src/core/endpoints-health-checks.ts index 11e46ae3fc..37a5c3164b 100644 --- a/src/frontend/packages/core/endpoints-health-checks.ts +++ b/src/frontend/packages/core/src/core/endpoints-health-checks.ts @@ -1,8 +1,8 @@ import { Injectable } from '@angular/core'; -import { entityCatalog } from '../store/src/entity-catalog/entity-catalog'; -import { EndpointHealthCheck } from '../store/src/entity-catalog/entity-catalog.types'; -import { EndpointModel } from '../store/src/types/endpoint.types'; +import { entityCatalog } from '../../../store/src/entity-catalog/entity-catalog'; +import { EndpointHealthCheck } from '../../../store/src/entity-catalog/entity-catalog.types'; +import { EndpointModel } from '../../../store/src/types/endpoint.types'; @Injectable({ providedIn: 'root' diff --git a/src/frontend/packages/core/src/core/endpoints.service.ts b/src/frontend/packages/core/src/core/endpoints.service.ts index 6354590f8a..8da0f1d610 100644 --- a/src/frontend/packages/core/src/core/endpoints.service.ts +++ b/src/frontend/packages/core/src/core/endpoints.service.ts @@ -11,8 +11,8 @@ import { EndpointHealthCheck } from '../../../store/src/entity-catalog/entity-ca import { AuthState } from '../../../store/src/reducers/auth.reducer'; import { endpointEntitiesSelector, endpointStatusSelector } from '../../../store/src/selectors/endpoint.selectors'; import { EndpointModel, EndpointState } from '../../../store/src/types/endpoint.types'; -import { EndpointHealthChecks } from '../../endpoints-health-checks'; import { endpointHasMetricsByAvailable } from '../features/endpoints/endpoint-helpers'; +import { EndpointHealthChecks } from './endpoints-health-checks'; import { UserService } from './user.service'; diff --git a/src/frontend/packages/core/src/core/extension/extension-service.ts b/src/frontend/packages/core/src/core/extension/extension-service.ts index c2d198c7d6..495dd76d8e 100644 --- a/src/frontend/packages/core/src/core/extension/extension-service.ts +++ b/src/frontend/packages/core/src/core/extension/extension-service.ts @@ -66,9 +66,9 @@ export interface StratosExtensionRoutes { // Stores the extension metadata as defined by the decorators const extensionMetadata = { loginComponent: null, - extensionRoutes: {} as { [key: string]: StratosExtensionRoutes[] }, - tabs: {} as { [key: string]: IPageSideNavTab[] }, - actions: {} as { [key: string]: StratosActionMetadata[] }, + extensionRoutes: {} as { [key: string]: StratosExtensionRoutes[], }, + tabs: {} as { [key: string]: IPageSideNavTab[], }, + actions: {} as { [key: string]: StratosActionMetadata[], }, }; /** @@ -118,6 +118,10 @@ function addExtensionAction(action: StratosActionType, target: any, props: Strat extensionMetadata.actions[action].push(props); } +// Empty module used to support the registration of Extension Components +@NgModule() +export class ExtEmptyModule { } + // Injectable Extension Service @Injectable({ providedIn: 'root', @@ -201,7 +205,3 @@ export function getTabsFromExtensions(tabType: StratosTabType): IPageSideNavTab[ export function getActionsFromExtensions(actionType: StratosActionType): StratosActionMetadata[] { return extensionMetadata.actions[actionType] || []; } - -// Empty module used to support the registration of Extension Components -@NgModule() -export class ExtEmptyModule { } diff --git a/src/frontend/packages/core/src/core/logger.service.spec.ts b/src/frontend/packages/core/src/core/logger.service.spec.ts deleted file mode 100644 index 1720fe0b84..0000000000 --- a/src/frontend/packages/core/src/core/logger.service.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { inject, TestBed } from '@angular/core/testing'; -import { createBasicStoreModule } from '@stratosui/store/testing'; - -import { CoreTestingModule } from '../../test-framework/core-test.modules'; -import { LoggerService } from './logger.service'; - -describe('LoggerService', () => { - - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [ - LoggerService - ], - imports: [ - CoreTestingModule, - createBasicStoreModule(), - ] - }); - }); - - it('should be created', inject([LoggerService], (service: LoggerService) => { - expect(service).toBeTruthy(); - })); -}); diff --git a/src/frontend/packages/core/src/core/logger.service.ts b/src/frontend/packages/core/src/core/logger.service.ts deleted file mode 100644 index 2a98c6cbf4..0000000000 --- a/src/frontend/packages/core/src/core/logger.service.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Store } from '@ngrx/store'; - -import { - LoggerDebugAction, - LoggerErrorAction, - LoggerInfoAction, - LoggerWarnAction, - LogLevel, -} from '../../../store/src/actions/log.actions'; -import { GeneralEntityAppState } from '../../../store/src/app-state'; -import { environment } from '../environments/environment.prod'; - -export enum LogLevelStringToNumber { - DEBUG = 0, - INFO = 1, - WARN = 2, - ERROR = 3 -} - -@Injectable() -export class LoggerService { - - constructor(private store: Store) { } - - private log(level: LogLevel, message: string, arg: any) { - if (LogLevelStringToNumber[level] < LogLevelStringToNumber[environment.logLevel] || !environment.logToConsole) { - return; - } - const date = new Date(); - message = `${date.toUTCString()}- ${message}`; - - let func = console.log; - switch (level) { - case LogLevel.ERROR: - func = console.error; - this.store.dispatch(new LoggerErrorAction(message)); - break; - case LogLevel.WARN: - func = console.warn; - this.store.dispatch(new LoggerWarnAction(message)); - break; - case LogLevel.INFO: - // tslint:disable-next-line:no-console - func = console.info; - this.store.dispatch(new LoggerInfoAction(message)); - break; - case LogLevel.DEBUG: - func = console.log; - this.store.dispatch(new LoggerDebugAction(message)); - break; - } - - if (arg) { - func(message, arg); - } else { - func(message); - } - } - - debug(message: string, arg?: any) { - this.log(LogLevel.DEBUG, message, arg); - } - - info(message: string, arg?: any) { - this.log(LogLevel.INFO, message, arg); - } - - warn(message: string, arg?: any) { - this.log(LogLevel.WARN, message, arg); - } - - error(message: string, arg?: any) { - this.log(LogLevel.ERROR, message, arg); - } - -} diff --git a/src/frontend/packages/core/src/core/permissions/current-user-permissions.service.ts b/src/frontend/packages/core/src/core/permissions/current-user-permissions.service.ts index 4ad096b7c5..c7cf116b80 100644 --- a/src/frontend/packages/core/src/core/permissions/current-user-permissions.service.ts +++ b/src/frontend/packages/core/src/core/permissions/current-user-permissions.service.ts @@ -5,7 +5,6 @@ import { distinctUntilChanged, map, switchMap } from 'rxjs/operators'; import { InternalAppState } from '../../../../store/src/app-state'; import { stratosEntityCatalog } from '../../../../store/src/stratos-entity-catalog'; -import { LoggerService } from '../logger.service'; import { CurrentUserPermissions, PermissionConfig, @@ -28,7 +27,6 @@ export class CurrentUserPermissionsService { constructor( private store: Store, @Optional() @Inject(CUSTOM_USER_PERMISSION_CHECKERS) customCheckers: ICurrentUserPermissionsChecker[], - private logger: LoggerService ) { // Cannot set default value for parameter as the Optional decorator sets it to null const nullSafeCustomCheckers = customCheckers || []; @@ -136,7 +134,9 @@ export class CurrentUserPermissionsService { private combineChecks( checkCombiners: IPermissionCheckCombiner[], ) { - const reducedChecks = checkCombiners.map(combiner => BaseCurrentUserPermissionsChecker.reduceChecks(combiner.checks, combiner.combineType)); + const reducedChecks = checkCombiners.map(combiner => + BaseCurrentUserPermissionsChecker.reduceChecks(combiner.checks, combiner.combineType) + ); return combineLatest(reducedChecks).pipe( map(checks => checks.every(check => check)) ); @@ -172,21 +172,21 @@ export class CurrentUserPermissionsService { failureValue: T ): T { const res: T[] = []; - for (let i = 0; i < this.allCheckers.length; i++) { - const checkerRes = checkFn(this.allCheckers[i]); + for (const checker of this.allCheckers) { + const checkerRes = checkFn(checker); if (checkerRes) { res.push(checkerRes); } } - if (res.length == 0) { - this.logger.warn(`Permissions: Failed to find a '${checkNoun}' for '${checkType}'. Permission Denied.`); + if (res.length === 0) { + console.warn(`Permissions: Failed to find a '${checkNoun}' for '${checkType}'. Permission Denied.`); return failureValue; } if (res.length === 1) { return res[0]; } if (res.length > 1) { - this.logger.warn(`Permissions: Found too many '${checkNoun}' for '${checkType}'. Permission Denied.`); + console.warn(`Permissions: Found too many '${checkNoun}' for '${checkType}'. Permission Denied.`); return failureValue; } } diff --git a/src/frontend/packages/core/src/core/permissions/stratos-user-permissions.checker.ts b/src/frontend/packages/core/src/core/permissions/stratos-user-permissions.checker.ts index db4c382b26..181f62a1a0 100644 --- a/src/frontend/packages/core/src/core/permissions/stratos-user-permissions.checker.ts +++ b/src/frontend/packages/core/src/core/permissions/stratos-user-permissions.checker.ts @@ -1,12 +1,15 @@ import { Store } from '@ngrx/store'; -import { Observable } from 'rxjs'; +import { Observable, of } from 'rxjs'; +import { switchMap } from 'rxjs/operators'; import { GeneralEntityAppState } from '../../../../store/src/app-state'; +import { selectSessionData } from '../../../../store/src/reducers/auth.reducer'; import { getCurrentUserStratosHasScope, getCurrentUserStratosRole, PermissionValues, } from '../../../../store/src/selectors/current-user-role.selectors'; +import { APIKeysEnabled } from '../../../../store/src/types/auth.types'; import { IPermissionConfigs, PermissionConfig, PermissionTypes } from './current-user-permissions.config'; import { BaseCurrentUserPermissionsChecker, @@ -19,6 +22,10 @@ import { export enum StratosCurrentUserPermissions { ENDPOINT_REGISTER = 'register.endpoint', PASSWORD_CHANGE = 'change-password', + /** + * Does the user have permission to view/create/delete their own API Keys? + */ + API_KEYS = 'api-keys' } export enum StratosPermissionStrings { @@ -34,20 +41,28 @@ export enum StratosScopeStrings { export enum StratosPermissionTypes { STRATOS = 'internal', - STRATOS_SCOPE = 'internal-scope' + STRATOS_SCOPE = 'internal-scope', + API_KEY = 'api-key' } // For each set permissions are checked by permission types of ENDPOINT, ENDPOINT_SCOPE, STRATOS_SCOPE, FEATURE_FLAG or a random bag. // Every group result must be true in order for the permission to be true. A group result is true if all or some of it's permissions are // true (see `getCheckFromConfig`). export const stratosPermissionConfigs: IPermissionConfigs = { - [StratosCurrentUserPermissions.ENDPOINT_REGISTER]: new PermissionConfig(StratosPermissionTypes.STRATOS, StratosPermissionStrings.STRATOS_ADMIN), - [StratosCurrentUserPermissions.PASSWORD_CHANGE]: new PermissionConfig(StratosPermissionTypes.STRATOS_SCOPE, StratosScopeStrings.STRATOS_CHANGE_PASSWORD), + [StratosCurrentUserPermissions.ENDPOINT_REGISTER]: new PermissionConfig( + StratosPermissionTypes.STRATOS, + StratosPermissionStrings.STRATOS_ADMIN + ), + [StratosCurrentUserPermissions.PASSWORD_CHANGE]: new PermissionConfig( + StratosPermissionTypes.STRATOS_SCOPE, + StratosScopeStrings.STRATOS_CHANGE_PASSWORD + ), + [StratosCurrentUserPermissions.API_KEYS]: new PermissionConfig(StratosPermissionTypes.API_KEY, '') }; export class StratosUserPermissionsChecker extends BaseCurrentUserPermissionsChecker implements ICurrentUserPermissionsChecker { constructor(private store: Store, ) { - super() + super(); } getPermissionConfig(action: string) { @@ -75,6 +90,8 @@ export class StratosUserPermissionsChecker extends BaseCurrentUserPermissionsChe return this.getInternalCheck(permissionConfig.permission as StratosPermissionStrings); case (StratosPermissionTypes.STRATOS_SCOPE): return this.getInternalScopesCheck(permissionConfig.permission as StratosScopeStrings); + case (StratosPermissionTypes.API_KEY): + return this.apiKeyCheck(); } } @@ -95,6 +112,20 @@ export class StratosUserPermissionsChecker extends BaseCurrentUserPermissionsChe return this.check(StratosPermissionTypes.STRATOS_SCOPE, permission); } + private apiKeyCheck(): Observable { + return this.store.select(selectSessionData()).pipe( + switchMap(sessionData => { + switch (sessionData.config.APIKeysEnabled) { + case APIKeysEnabled.ADMIN_ONLY: + return this.store.select(getCurrentUserStratosRole(StratosPermissionStrings.STRATOS_ADMIN)); + case APIKeysEnabled.ALL_USERS: + return of(true); + } + return of(false); + }) + ); + } + public getComplexCheck( permissionConfig: PermissionConfig[], ...args: any[] @@ -108,7 +139,7 @@ export class StratosUserPermissionsChecker extends BaseCurrentUserPermissionsChe checks: this.getInternalScopesChecks(configGroup), }; } - }) + }); // Checker must handle all configs return res.every(check => !!check) ? res : null; } diff --git a/src/frontend/packages/core/src/core/utils.service.ts b/src/frontend/packages/core/src/core/utils.service.ts index d3d1c3f837..cd40db21ed 100644 --- a/src/frontend/packages/core/src/core/utils.service.ts +++ b/src/frontend/packages/core/src/core/utils.service.ts @@ -293,10 +293,13 @@ export const arraysEqual = (a: any[], b: any[]): boolean => { return false; }; + +/* tslint:disable:no-bitwise */ export const createGuid = (): string => { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => { - var r = Math.random() * 16 | 0, - v = c == 'x' ? r : (r & 0x3 | 0x8); + const r = Math.random() * 16 | 0; + const v = c === 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); -} +}; +/* tslint:enable */ diff --git a/src/frontend/packages/core/src/environments/environment.prod.ts b/src/frontend/packages/core/src/environments/environment.prod.ts index da8e7d8dbd..61c616a7fe 100644 --- a/src/frontend/packages/core/src/environments/environment.prod.ts +++ b/src/frontend/packages/core/src/environments/environment.prod.ts @@ -1,13 +1,9 @@ import { cfAPIVersion, proxyAPIVersion } from '../../../store/src/jetstream'; -import { LogLevel } from './../../../store/src/actions/log.actions'; export const environment = { production: true, - logLevel: LogLevel.WARN, proxyAPIVersion, cfAPIVersion, - logToConsole: true, - logEnableConsoleActions: false, showObsDebug: false, disablePolling: false }; diff --git a/src/frontend/packages/core/src/environments/environment.ts b/src/frontend/packages/core/src/environments/environment.ts index e10f7527a5..ee77d9adb8 100644 --- a/src/frontend/packages/core/src/environments/environment.ts +++ b/src/frontend/packages/core/src/environments/environment.ts @@ -1,4 +1,3 @@ -import { LogLevel } from '../../../store/src/actions/log.actions'; import { cfAPIVersion, proxyAPIVersion } from '../../../store/src/jetstream'; // The file contents for the current environment will overwrite these during build. @@ -10,9 +9,6 @@ export const environment = { production: false, proxyAPIVersion, cfAPIVersion, - logLevel: LogLevel.DEBUG, - logToConsole: true, - logEnableConsoleActions: false, showObsDebug: false, disablePolling: false }; diff --git a/src/frontend/packages/core/src/features/about/about-page/about-page.component.spec.ts b/src/frontend/packages/core/src/features/about/about-page/about-page.component.spec.ts index 3aea3c6790..69f0863602 100644 --- a/src/frontend/packages/core/src/features/about/about-page/about-page.component.spec.ts +++ b/src/frontend/packages/core/src/features/about/about-page/about-page.component.spec.ts @@ -2,10 +2,11 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { createBasicStoreModule } from '@stratosui/store/testing'; -import { TabNavService } from '../../../../tab-nav.service'; import { CoreTestingModule } from '../../../../test-framework/core-test.modules'; import { CoreModule } from '../../../core/core.module'; +import { CurrentUserPermissionsService } from '../../../core/permissions/current-user-permissions.service'; import { SharedModule } from '../../../shared/shared.module'; +import { TabNavService } from '../../../tab-nav.service'; import { AboutPageComponent } from './about-page.component'; describe('AboutPageComponent', () => { @@ -22,7 +23,10 @@ describe('AboutPageComponent', () => { CoreTestingModule, createBasicStoreModule(), ], - providers: [TabNavService] + providers: [ + TabNavService, + CurrentUserPermissionsService + ] }) .compileComponents(); })); diff --git a/src/frontend/packages/core/src/features/about/diagnostics-page/diagnostics-page.component.spec.ts b/src/frontend/packages/core/src/features/about/diagnostics-page/diagnostics-page.component.spec.ts index c65bac7fc7..16786352e6 100644 --- a/src/frontend/packages/core/src/features/about/diagnostics-page/diagnostics-page.component.spec.ts +++ b/src/frontend/packages/core/src/features/about/diagnostics-page/diagnostics-page.component.spec.ts @@ -2,10 +2,11 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { createBasicStoreModule } from '@stratosui/store/testing'; -import { TabNavService } from '../../../../tab-nav.service'; import { CoreTestingModule } from '../../../../test-framework/core-test.modules'; import { CoreModule } from '../../../core/core.module'; +import { CurrentUserPermissionsService } from '../../../core/permissions/current-user-permissions.service'; import { SharedModule } from '../../../shared/shared.module'; +import { TabNavService } from '../../../tab-nav.service'; import { DiagnosticsPageComponent } from './diagnostics-page.component'; describe('DiagnosticsPageComponent', () => { @@ -22,7 +23,10 @@ describe('DiagnosticsPageComponent', () => { CoreTestingModule, createBasicStoreModule(), ], - providers: [TabNavService] + providers: [ + TabNavService, + CurrentUserPermissionsService + ] }) .compileComponents(); })); diff --git a/src/frontend/packages/core/src/features/about/eula-page/eula-page.component.spec.ts b/src/frontend/packages/core/src/features/about/eula-page/eula-page.component.spec.ts index 113aac37d3..cd45da187e 100644 --- a/src/frontend/packages/core/src/features/about/eula-page/eula-page.component.spec.ts +++ b/src/frontend/packages/core/src/features/about/eula-page/eula-page.component.spec.ts @@ -4,9 +4,10 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { createBasicStoreModule } from '@stratosui/store/testing'; -import { TabNavService } from '../../../../tab-nav.service'; import { CoreModule } from '../../../core/core.module'; +import { CurrentUserPermissionsService } from '../../../core/permissions/current-user-permissions.service'; import { SharedModule } from '../../../shared/shared.module'; +import { TabNavService } from '../../../tab-nav.service'; import { EulaPageComponent } from './eula-page.component'; describe('EulaPageComponent', () => { @@ -24,7 +25,10 @@ describe('EulaPageComponent', () => { HttpClientTestingModule, createBasicStoreModule(), ], - providers: [TabNavService] + providers: [ + TabNavService, + CurrentUserPermissionsService + ] }) .compileComponents(); })); diff --git a/src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.html b/src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.html new file mode 100644 index 0000000000..bf044a85bf --- /dev/null +++ b/src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.html @@ -0,0 +1,28 @@ +
+ + +
+
+
+

+ Create an API Key +

+
+
+
+
+ + + +
+ + + + + + + +
\ No newline at end of file diff --git a/src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.scss b/src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.scss new file mode 100644 index 0000000000..a235091e2d --- /dev/null +++ b/src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.scss @@ -0,0 +1,28 @@ +.key-dialog { + &__loading { + left: 0; + position: absolute; + right: 0; + top: 0; + &-wrapper { + position: relative; + margin: 0 -24px; + transform: translateY(-24px); + } + } + + &__title { + display: flex; + h2 { + flex: 1; + } + } + + &__actions { + justify-content: flex-end; + } + + mat-form-field { + width: 100%; + } +} diff --git a/src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.spec.ts b/src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.spec.ts new file mode 100644 index 0000000000..e27047ec08 --- /dev/null +++ b/src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.spec.ts @@ -0,0 +1,40 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { MatDialogRef } from '@angular/material/dialog'; + +import { BaseTestModules } from '../../../../test-framework/core-test.helper'; +import { AddApiKeyDialogComponent } from './add-api-key-dialog.component'; + +describe('AddApiKeyDialogComponent', () => { + let component: AddApiKeyDialogComponent; + let fixture: ComponentFixture; + + const mockDialogRef = { + close: () => { } + }; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [ + ...BaseTestModules, + ], + declarations: [AddApiKeyDialogComponent], + providers: [ + { + provide: MatDialogRef, + useValue: mockDialogRef + } + ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AddApiKeyDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.ts b/src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.ts new file mode 100644 index 0000000000..eea0b54086 --- /dev/null +++ b/src/frontend/packages/core/src/features/api-keys/add-api-key-dialog/add-api-key-dialog.component.ts @@ -0,0 +1,66 @@ +import { Component, OnDestroy } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { MatDialogRef } from '@angular/material/dialog'; +import { BehaviorSubject, Subscription } from 'rxjs'; +import { filter, first, map, pairwise, tap } from 'rxjs/operators'; + +import { ApiKey } from '../../../../../store/src/apiKey.types'; +import { entityCatalog } from '../../../../../store/src/entity-catalog/entity-catalog'; +import { RequestInfoState } from '../../../../../store/src/reducers/api-request-reducer/types'; +import { stratosEntityCatalog } from '../../../../../store/src/stratos-entity-catalog'; +import { NormalizedResponse } from '../../../../../store/src/types/api.types'; +import { safeUnsubscribe } from '../../../core/utils.service'; + +@Component({ + selector: 'app-add-api-key-dialog', + templateUrl: './add-api-key-dialog.component.html', + styleUrls: ['./add-api-key-dialog.component.scss'] +}) +export class AddApiKeyDialogComponent implements OnDestroy { + + private hasErrored = new BehaviorSubject(null); + public hasErrored$ = this.hasErrored.asObservable(); + private isBusy = new BehaviorSubject(false) + public isBusy$ = this.isBusy.asObservable(); + + private sub: Subscription; + + public formGroup: FormGroup; + + constructor( + private fb: FormBuilder, + public dialogRef: MatDialogRef, + ) { + this.formGroup = this.fb.group({ + comment: ['', Validators.required], + }); + } + + ngOnDestroy(): void { + safeUnsubscribe(this.sub); + } + + submit() { + this.sub = stratosEntityCatalog.apiKey.api.create(this.formGroup.controls.comment.value).pipe( + tap(() => { + this.isBusy.next(true); + this.hasErrored.next(null); + }), + pairwise(), + filter(([oldR, newR]) => oldR.creating && !newR.creating), + map(([, newR]) => newR), + tap(state => { + if (state.error) { + this.hasErrored.next(`Failed to create key: ${state.message}`); + this.isBusy.next(false); + } else { + const response: NormalizedResponse = state.response; + const entityKey = entityCatalog.getEntityKey(stratosEntityCatalog.apiKey.actions.create('')); + this.dialogRef.close(response.entities[entityKey][response.result[0]]) + } + }), + first() + ).subscribe() + } + +} diff --git a/src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.html b/src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.html new file mode 100644 index 0000000000..0cacc03903 --- /dev/null +++ b/src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.html @@ -0,0 +1,33 @@ + +

API Keys

+
+ +
+
+ +
+ + + + vpn_keyNew API Key + + +

Your API Key has been successfully created. Use the following information to connect to Stratos.

+

Please safely record these details, there is no later way to view them

+
    +
  • Secret: {{keyDetails.secret}}
  • +
+ +
+
+
+ + + \ No newline at end of file diff --git a/src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.scss b/src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.scss new file mode 100644 index 0000000000..291e1522e1 --- /dev/null +++ b/src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.scss @@ -0,0 +1,15 @@ +.keys-page { + &__new { + mat-card { + margin-bottom: 24px; + mat-card-header { + align-items: center; + display: flex; + margin-bottom: 15px; + mat-icon { + margin-right: 5px; + } + } + } + } +} \ No newline at end of file diff --git a/src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.spec.ts b/src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.spec.ts new file mode 100644 index 0000000000..1c2318bba0 --- /dev/null +++ b/src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.spec.ts @@ -0,0 +1,42 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { MatDialogRef } from '@angular/material/dialog'; + +import { BaseTestModules } from '../../../../test-framework/core-test.helper'; +import { TabNavService } from '../../../tab-nav.service'; +import { ApiKeysPageComponent } from './api-keys-page.component'; + +describe('ApiKeysPageComponent', () => { + let component: ApiKeysPageComponent; + let fixture: ComponentFixture; + + const mockDialogRef = { + close: () => { } + }; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [ + ...BaseTestModules, + ], + declarations: [ApiKeysPageComponent], + providers: [ + { + provide: MatDialogRef, + useValue: mockDialogRef + }, + TabNavService + ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ApiKeysPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.ts b/src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.ts new file mode 100644 index 0000000000..4f130201b6 --- /dev/null +++ b/src/frontend/packages/core/src/features/api-keys/api-keys-page/api-keys-page.component.ts @@ -0,0 +1,63 @@ +import { Component } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; +import { Observable, Subject } from 'rxjs'; +import { first, map, startWith } from 'rxjs/operators'; + +import { stratosEntityCatalog } from '../../../../../store/src/stratos-entity-catalog'; +import { ApiKeyListConfigService } from '../../../shared/components/list/list-types/apiKeys/apiKey-list-config.service'; +import { ListConfig } from '../../../shared/components/list/list.component.types'; +import { AddApiKeyDialogComponent } from '../add-api-key-dialog/add-api-key-dialog.component'; + +@Component({ + selector: 'app-api-keys-page', + templateUrl: './api-keys-page.component.html', + styleUrls: ['./api-keys-page.component.scss'], + providers: [{ + provide: ListConfig, + useClass: ApiKeyListConfigService, + }] +}) +export class ApiKeysPageComponent { + + public keyDetails = new Subject(); + public keyDetails$ = this.keyDetails.asObservable(); + + /* tslint:disable:ban-types */ + // This is intentionally typed, property can be null and there's different logic associated with it + public hasKeys$: Observable; + /* tslint:enable */ + + constructor( + private dialog: MatDialog, + ) { + this.hasKeys$ = stratosEntityCatalog.apiKey.store.getPaginationService().entities$.pipe( + map(entities => entities && !!entities.length), + startWith(null), + ); + } + + addApiKey() { + this.showDialog().pipe(first()).subscribe(key => { + this.keyDetails.next(key); + }); + } + + clearKeyDetails() { + this.keyDetails.next(); + } + + private showDialog(): Observable { + return this.dialog.open(AddApiKeyDialogComponent, { + disableClose: true, + }).afterClosed().pipe( + map(newApiKey => { + if (newApiKey && newApiKey.guid) { + stratosEntityCatalog.apiKey.api.getMultiple(); + return newApiKey; + } + return null; + }) + ); + } + +} diff --git a/src/frontend/packages/core/src/features/api-keys/api-keys.module.ts b/src/frontend/packages/core/src/features/api-keys/api-keys.module.ts new file mode 100644 index 0000000000..c2311b97d4 --- /dev/null +++ b/src/frontend/packages/core/src/features/api-keys/api-keys.module.ts @@ -0,0 +1,22 @@ +import { NgModule } from '@angular/core'; + +import { CoreModule } from '../../core/core.module'; +import { SharedModule } from '../../shared/shared.module'; +import { ApiKeysPageComponent } from './api-keys-page/api-keys-page.component'; +import { ApiKeysRoutingModule } from './api-keys.routing'; +import { AddApiKeyDialogComponent } from './add-api-key-dialog/add-api-key-dialog.component'; + + +@NgModule({ + imports: [ + CoreModule, + SharedModule, + ApiKeysRoutingModule, + ], + declarations: [ + ApiKeysPageComponent, + AddApiKeyDialogComponent + ] +}) +export class ApiKeysModule { } + diff --git a/src/frontend/packages/core/src/features/api-keys/api-keys.routing.ts b/src/frontend/packages/core/src/features/api-keys/api-keys.routing.ts new file mode 100644 index 0000000000..395c58188b --- /dev/null +++ b/src/frontend/packages/core/src/features/api-keys/api-keys.routing.ts @@ -0,0 +1,18 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; + +import { ApiKeysPageComponent } from './api-keys-page/api-keys-page.component'; + +const apiKeys: Routes = [ + { + path: '', + component: ApiKeysPageComponent + }, +]; + +@NgModule({ + imports: [ + RouterModule.forChild(apiKeys), + ] +}) +export class ApiKeysRoutingModule { } diff --git a/src/frontend/packages/core/src/features/dashboard/dashboard-base/dashboard-base.component.spec.ts b/src/frontend/packages/core/src/features/dashboard/dashboard-base/dashboard-base.component.spec.ts index 395bdf628c..f448246a7d 100644 --- a/src/frontend/packages/core/src/features/dashboard/dashboard-base/dashboard-base.component.spec.ts +++ b/src/frontend/packages/core/src/features/dashboard/dashboard-base/dashboard-base.component.spec.ts @@ -7,11 +7,11 @@ import { RouterTestingModule } from '@angular/router/testing'; import { StoreModule } from '@ngrx/store'; import { appReducers } from '../../../../../store/src/reducers.module'; -import { TabNavService } from '../../../../tab-nav.service'; import { CoreModule } from '../../../core/core.module'; import { PageHeaderService } from '../../../core/page-header-service/page-header.service'; import { SidePanelService } from '../../../shared/services/side-panel.service'; import { SharedModule } from '../../../shared/shared.module'; +import { TabNavService } from '../../../tab-nav.service'; import { MetricsService } from '../../metrics/services/metrics-service'; import { PageSideNavComponent } from '../page-side-nav/page-side-nav.component'; import { SideNavComponent } from '../side-nav/side-nav.component'; diff --git a/src/frontend/packages/core/src/features/dashboard/dashboard-base/dashboard-base.component.ts b/src/frontend/packages/core/src/features/dashboard/dashboard-base/dashboard-base.component.ts index 42a8998120..b7da02c398 100644 --- a/src/frontend/packages/core/src/features/dashboard/dashboard-base/dashboard-base.component.ts +++ b/src/frontend/packages/core/src/features/dashboard/dashboard-base/dashboard-base.component.ts @@ -14,11 +14,11 @@ import { entityCatalog } from '../../../../../store/src/entity-catalog/entity-ca import { DashboardState } from '../../../../../store/src/reducers/dashboard-reducer'; import { selectDashboardState } from '../../../../../store/src/selectors/dashboard.selectors'; import { stratosEntityCatalog } from '../../../../../store/src/stratos-entity-catalog'; -import { TabNavService } from '../../../../tab-nav.service'; import { CustomizationService } from '../../../core/customizations.types'; import { EndpointsService } from '../../../core/endpoints.service'; import { IHeaderBreadcrumbLink } from '../../../shared/components/page-header/page-header.types'; import { SidePanelService } from '../../../shared/services/side-panel.service'; +import { TabNavService } from '../../../tab-nav.service'; import { IPageSideNavTab } from '../page-side-nav/page-side-nav.component'; import { PageHeaderService } from './../../../core/page-header-service/page-header.service'; import { SideNavItem } from './../side-nav/side-nav.component'; @@ -36,8 +36,8 @@ export class DashboardBaseComponent implements OnInit, OnDestroy, AfterViewInit public isMobile$: Observable; public sideNavMode$: Observable; public sideNavMode: string; - public mainNavState$: Observable<{ mode: string; opened: boolean; iconMode: boolean }>; - public rightNavState$: Observable<{ opened: boolean, component?: object, props?: object }>; + public mainNavState$: Observable<{ mode: string; opened: boolean; iconMode: boolean; }>; + public rightNavState$: Observable<{ opened: boolean, component?: object, props?: object; }>; private dashboardState$: Observable; public noMargin$: Observable; private closeSub: Subscription; diff --git a/src/frontend/packages/core/src/features/dashboard/page-side-nav/page-side-nav.component.spec.ts b/src/frontend/packages/core/src/features/dashboard/page-side-nav/page-side-nav.component.spec.ts index 58b9e971e8..871b3dd00c 100644 --- a/src/frontend/packages/core/src/features/dashboard/page-side-nav/page-side-nav.component.spec.ts +++ b/src/frontend/packages/core/src/features/dashboard/page-side-nav/page-side-nav.component.spec.ts @@ -1,8 +1,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { TabNavService } from '../../../../tab-nav.service'; -import { BaseTestModulesNoShared } from '../../../../test-framework/core-test.helper'; import { EntityMonitorFactory } from '../../../../../store/src/monitors/entity-monitor.factory.service'; +import { BaseTestModulesNoShared } from '../../../../test-framework/core-test.helper'; +import { TabNavService } from '../../../tab-nav.service'; import { PageSideNavComponent } from './page-side-nav.component'; describe('PageSideNavComponent', () => { diff --git a/src/frontend/packages/core/src/features/dashboard/page-side-nav/page-side-nav.component.ts b/src/frontend/packages/core/src/features/dashboard/page-side-nav/page-side-nav.component.ts index bab4cd21dc..aa0fb03459 100644 --- a/src/frontend/packages/core/src/features/dashboard/page-side-nav/page-side-nav.component.ts +++ b/src/frontend/packages/core/src/features/dashboard/page-side-nav/page-side-nav.component.ts @@ -2,15 +2,15 @@ import { Component, Input, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { Store } from '@ngrx/store'; import { Observable, of } from 'rxjs'; +import { map } from 'rxjs/operators'; import { AppState } from '../../../../../store/src/app-state'; import { EntityServiceFactory } from '../../../../../store/src/entity-service-factory.service'; import { selectIsMobile } from '../../../../../store/src/selectors/dashboard.selectors'; -import { TabNavService } from '../../../../tab-nav.service'; import { StratosTabMetadata } from '../../../core/extension/extension-service'; import { CurrentUserPermissionsService } from '../../../core/permissions/current-user-permissions.service'; import { IBreadcrumb } from '../../../shared/components/breadcrumbs/breadcrumbs.types'; -import { map } from 'rxjs/operators'; +import { TabNavService } from '../../../tab-nav.service'; diff --git a/src/frontend/packages/core/src/features/dashboard/side-nav/side-nav.component.html b/src/frontend/packages/core/src/features/dashboard/side-nav/side-nav.component.html index 42b179688b..15ec64efb0 100644 --- a/src/frontend/packages/core/src/features/dashboard/side-nav/side-nav.component.html +++ b/src/frontend/packages/core/src/features/dashboard/side-nav/side-nav.component.html @@ -2,7 +2,7 @@
- +
+ {rightItems.map((item, i) => ( + + ))} + {!disableColorModeSwitch && ( + + )} + +
+
+
+
+
+ + {logoImageUrl != null && ( + {logoAlt} + )} + {title != null && ( + {title} + )} + + {!disableColorModeSwitch && sidebarShown && ( + + )} +
+
+
+
    + {items.map((item, i) => ( + + ))} +
+
+
+
+ + ); +} + +export default Navbar; diff --git a/website/src/theme/Navbar/styles.module.css b/website/src/theme/Navbar/styles.module.css new file mode 100644 index 0000000000..fb524ac417 --- /dev/null +++ b/website/src/theme/Navbar/styles.module.css @@ -0,0 +1,26 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +@media screen and (max-width: 997px) { + .displayOnlyInLargeViewport { + display: none !important; + } +} + +@media (max-width: 768px) { + .hideLogoText { + display: none; + } +} + +.navbarHideable { + transition: top 0.2s ease-in-out; +} + +.navbarHidden { + top: calc(var(--ifm-navbar-height) * -1) !important; +} diff --git a/website/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.js b/website/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.js new file mode 100644 index 0000000000..570d9cb773 --- /dev/null +++ b/website/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.js @@ -0,0 +1,81 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +import { useActiveDocContext, useLatestVersion, useVersions } from '@theme/hooks/useDocs'; +import React from 'react'; + +import versionsWithHash from '../../../internal-versions.json'; +import DefaultNavbarItem from '../../../node_modules/@docusaurus/theme-classic/lib/theme/NavbarItem/DefaultNavbarItem'; + +const versionLabel = (version, nextVersionLabel) => + version.name === 'next' ? nextVersionLabel : version.name; + +const getVersionMainDoc = (version) => + version.docs.find((doc) => doc.id === version.mainDocId); + +const createStratosVersions = (versions) => { + // Remove certain versions from version drop down + const newVersions = []; + const pastVersions = versionsWithHash.map(versionWithHash => versionWithHash.split(':')) + versions.forEach(version => { + const pastVersion = pastVersions.find(pastVersion => pastVersion[0] === version.name) + if (version.name === 'next' || (pastVersion && pastVersion[2] === 'true')) { + newVersions.push(version) + } + }) + return newVersions; +} + +export default function DocsVersionDropdownNavbarItem({ + mobile, + docsPluginId, + nextVersionLabel, + ...props +}) { + const activeDocContext = useActiveDocContext(docsPluginId); + const versions = useVersions(docsPluginId); + const stratosVersions = createStratosVersions(versions) + const latestVersion = useLatestVersion(docsPluginId); + const items = stratosVersions.map((version) => { + // We try to link to the same doc, in another version + // When not possible, fallback to the "main doc" of the version + const versionDoc = + activeDocContext?.alternateDocVersions[version.name] || + getVersionMainDoc(version); + return { + isNavLink: true, + label: versionLabel(version, nextVersionLabel), + to: versionDoc.path, + isActive: () => version === activeDocContext?.activeVersion, + }; + }); + + // Stratos - Add the 'All Versions' link to the versions drop down + items.push({ + isNavLink: true, + label: "All Versions", + to: "/versions", + isActive: () => false, + }) + + const dropdownVersion = activeDocContext.activeVersion ?? latestVersion; // Mobile is handled a bit differently + + const dropdownLabel = mobile + ? 'Versions' + : versionLabel(dropdownVersion, nextVersionLabel); + const dropdownTo = mobile + ? undefined + : getVersionMainDoc(dropdownVersion).path; + return ( + + ); +}