Compare commits

..

301 Commits

Author SHA1 Message Date
Ronald A. Richardson
313b6e63a8 added other extensions 2023-11-24 17:30:53 +08:00
Ronald A. Richardson
a7ed7ee935 resolved conflicts for merge 2023-11-24 17:25:37 +08:00
Ronald A. Richardson
1e28d9d8d8 Upgraded dependencies with patches and improvements for improved UX 2023-11-24 17:20:03 +08:00
Ron
0c31b54fde Merge pull request #159 from fleetbase/fix-deploy-workflow
Fix CD workflow
2023-11-22 16:40:41 +08:00
Ronald A. Richardson
f6b83e5638 upgraded to aws-actions/configure-aws-credentials@v4 2023-11-22 16:39:04 +08:00
Ronald A. Richardson
b30ee818fc added api/auth.json to gitignore 2023-11-22 16:34:30 +08:00
Ronald A. Richardson
6ec9ad59d3 few patches for flespi extension integration 2023-11-17 13:38:55 +08:00
Ron
10ff2e066b Merge pull request #156 from fleetbase/dev-v0.3.0
v0.3.0
2023-11-16 19:01:14 +08:00
Ronald A. Richardson
f56db88ad6 fleetops: fix filters, improve drawer component w/ state, several patches and upgrades 2023-11-16 18:49:17 +08:00
Ron
033cf5cfe0 Merge pull request #155 from fleetbase/dev-v0.2.9
v0.2.9
2023-11-09 17:21:56 +08:00
Ronald A. Richardson
4a4dc76e60 Added scheduler feature, scope/live map drawer feature, and bug fixes and dependency upgrades 2023-11-09 17:04:10 +08:00
Ron
a52af94b00 Merge pull request #154 from fleetbase/dev-v0.2.8
v0.2.8
2023-11-06 20:12:39 +08:00
Ronald A. Richardson
9c4daf7a68 fix dependencies 2023-11-06 19:55:42 +08:00
Ronald A. Richardson
a8904ba112 Full refactor of management section, upgrade of dependencies 2023-11-06 19:39:11 +08:00
Ronald A. Richardson
6880664d9e update packages to latest commits 2023-10-30 19:57:33 +08:00
Ron
99b30d7f58 Merge pull request #148 from fleetbase/feature-notifications
Feature notifications
2023-10-30 19:56:10 +08:00
Ronald A. Richardson
c8539fd2a0 merged with main 2023-10-30 19:41:23 +08:00
Ronald A. Richardson
cb1aec40fd ready for new release with notification tray and settings 2023-10-30 19:37:37 +08:00
Ronald A. Richardson
b728b366a0 patch notification settings in admin 2023-10-30 19:17:01 +08:00
Ronald A. Richardson
5cfc3f1cc7 add back package.json 2023-10-30 14:58:54 +08:00
Ronald A. Richardson
e7b5282aa3 updated notificaiton setting structure to be more robust 2023-10-30 14:53:19 +08:00
Ronald A. Richardson
7ffb7ac24a Latest updates, moved save buttons to subheader for easy access to save 2023-10-30 12:40:39 +08:00
Ron
6e4a9edd7d Merge pull request #146 from fleetbase/add-notification-settings
Add notification settings to Admin
2023-10-30 11:55:57 +08:00
Ron
d9d01c8bbc Merge branch 'feature-notifications' into add-notification-settings 2023-10-30 11:55:12 +08:00
Ronald A. Richardson
c54d75fa0f hotfix notification read event trigger 2023-10-27 17:50:35 +08:00
Ronald A. Richardson
91904c3836 Patches and improved styling for notification page 2023-10-27 17:35:31 +08:00
Ronald A. Richardson
0e075e3b24 dont check in dependency mgmt files 2023-10-27 15:24:58 +08:00
Ron
c56bea95d0 Merge pull request #140 from fleetbase/dev-v0.2.6
v0.2.6
2023-10-27 10:33:17 +08:00
Ronald A. Richardson
f1cec329bc add back environment files 2023-10-27 10:15:40 +08:00
Ronald A. Richardson
34dc365dd2 Preparing release with latest dependencies 2023-10-27 10:11:33 +08:00
TemuulenBM
74a782f4ea WIP: Notification Settings interface on Admin 2023-10-26 17:54:29 +08:00
TemuulenBM
a8b2042d85 Latest updates for notification tray and page 2023-10-26 11:32:54 +08:00
Temuulen Bayanmunkh
cc52a40660 Almost completed the notifications route, <NotificationTray /> component responds with notifications route changes 2023-10-24 17:58:52 +08:00
Temuulen Bayanmunkh
4fb2dec8c3 Added notification tray component 2023-10-20 18:06:43 +08:00
Ronald A. Richardson
0db3634ab3 checkin environments directory and update API_SECURE to be casted to boolean 2023-10-18 16:34:09 +08:00
Ronald A. Richardson
1c0d324ba9 Fix reset of branding settings 2023-10-14 13:48:21 +08:00
Ron
096cc1097a Merge pull request #139 from fleetbase/dev-v0.2.5
preparing for new release
2023-10-13 18:11:07 +08:00
Ronald A. Richardson
eca881156a add required lockfile back to console 2023-10-13 17:50:07 +08:00
Ronald A. Richardson
40b499bcb2 preparing for new release 2023-10-13 17:40:02 +08:00
Ron
c6e7dcae8b Merge pull request #136 from fleetbase/dev-v0.2.4
Migrating to monorepo for extensions
2023-10-10 21:38:38 +08:00
Ronald A. Richardson
4bba957123 remove old files 2023-10-10 21:26:16 +08:00
Ronald A. Richardson
33b6174247 should fix pipeline, using all latest versions for monorepo arch 2023-10-10 21:19:03 +08:00
Ronald A. Richardson
79d80184cd remove socket as submodule 2023-10-10 20:45:16 +08:00
Ronald A. Richardson
8c1f96ef0e console is no longer a submodule 🚀 2023-10-10 20:43:18 +08:00
Ronald A. Richardson
c139c00404 Migrating to monorepo for extensions 2023-10-10 20:41:14 +08:00
Ron
92032ca56c Merge pull request #135 from fleetbase/dev-v0.2.3
preparing release for 0.2.3
2023-10-06 16:42:24 +08:00
Ronald A. Richardson
c265c6fbda preparing release for 0.2.3 2023-10-06 16:41:24 +08:00
Ron
d8ae53d811 Merge pull request #132 from fleetbase/dev-v0.2.2
preparing for hotfix/critical release patches
2023-10-03 22:49:12 +08:00
Ronald A. Richardson
729e347a78 preparing for hotfix/critical release patches 2023-10-03 23:47:58 +09:00
Ron
3453ccffd4 Merge pull request #130 from fleetbase/dev-v0.2.1
preparing release with updated fleet ops ui/data and devices for tele…
2023-09-30 14:35:36 +08:00
Ronald A. Richardson
3d54ada328 latest ember-ui 2023-09-30 15:23:31 +09:00
Ronald A. Richardson
e9f6f875a1 latest console 2023-09-30 15:21:15 +09:00
Ronald A. Richardson
fa45669a6c preparing release with updated fleet ops ui/data and devices for telematics integrations 2023-09-30 15:15:42 +09:00
Ron
280ff14af0 Merge pull request #128 from fleetbase/dev-v0.2.0-critical
WIP but contains critical patches
2023-09-16 13:04:11 +08:00
Ronald A. Richardson
4ac088bc72 WIP but contains critical patches 2023-09-16 13:00:46 +08:00
Ron
a8eb55d68e Merge pull request #127 from ekini/fix/frontend_deployment 2023-09-16 09:22:36 +08:00
Eugene Dementyev
4a0a775429 Use a parametrized deployment bucket name if it's not defined 2023-09-16 10:14:42 +12:00
Ron
36e85548f2 Merge pull request #126 from ekini/fix/frontend_fix
Use the static deployment bucket from SSM
2023-09-15 16:42:18 +08:00
Eugene Dementyev
5b805b1e2f Use the static deployment bucket from SSM 2023-09-15 20:41:02 +12:00
Ron
b041b4d555 Merge pull request #124 from fleetbase/dev-v0.1.9
Patches branding configuration and user/company creation timestamp issue
2023-09-15 12:39:48 +08:00
Ronald A. Richardson
b30c101bea Patches branding configuration and user/company creation timestamp issue 2023-09-15 12:33:30 +08:00
Ron
e932cdd9c6 Merge pull request #122 from fleetbase/dev-v0.1.8
v0.1.8
2023-09-14 20:23:59 +08:00
Ronald A. Richardson
a7ff7094b6 v0.1.8 2023-09-14 20:17:34 +08:00
Ron
8514203b88 Merge pull request #117 from ekini/feature/log_output
Add run task log output on deployment
2023-09-08 10:55:19 +08:00
Eugene Dementyev
17c7759a47 Add run task log output on deployment 2023-09-06 21:18:11 +12:00
Ron
690c9d7486 Merge pull request #114 from fleetbase/feature-driver-simulation-api
Add driver simulation API, critical bugfixes, and a few new features
2023-08-25 20:21:45 +08:00
Ronald A. Richardson
6deeb9fd0a Several critical patches and a few new features 2023-08-25 20:15:30 +08:00
Ron
4dbe344bb5 Merge pull request #111 from fleetbase/dev-main
v0.1.6 Release
2023-08-18 15:07:48 +08:00
Ronald A. Richardson
216e6a9a18 Merged console submodule 2023-08-18 15:04:13 +08:00
Ronald A. Richardson
5855df6a5d preparing to release v0.1.6 2023-08-18 15:01:21 +08:00
Ronald A. Richardson
782c1aa706 remove fleetbase-db.mmd is wrong and outdated 2023-08-15 16:09:43 +08:00
Ron
32cca548c3 Merge pull request #109 from fleetbase/add-mermaid-diagram
Add mermaid diagram
2023-08-15 16:07:58 +08:00
Ronald A. Richardson
1761b45911 removed mermerd.yaml 2023-08-15 16:03:35 +08:00
Ronald A. Richardson
93ac555427 now use schemacrawler in conjunction to generate database.mmd as well as erd diagrams 2023-08-15 15:57:21 +08:00
Ronald A. Richardson
04b6a1f47e added mermerd cli config file, and the generated mmd for erd 2023-08-15 14:24:34 +08:00
Ron
843e9a21cc Merge pull request #108 from ekini/feature/gitlab
Add gitlab ci config
2023-08-14 18:13:01 +08:00
Eugene Dementyev
220b486c3d Add gitlab ci config 2023-08-14 22:10:12 +12:00
Ron
60690ec334 Merge pull request #107 from fleetbase/fix-docker-build-without-auth
fix application build without composer auth
2023-08-10 15:58:35 +08:00
Ronald A. Richardson
a71c3c46d8 use console main branch 2023-08-10 15:41:07 +08:00
Ronald A. Richardson
f956f853e1 fix application build without composer auth 2023-08-10 15:38:45 +08:00
Ronald A. Richardson
c2efb2ac4d forgot one package... 2023-08-10 14:20:47 +08:00
Ronald A. Richardson
bb0951feba Add more Config Tests + Sentry Integration + Upgrades for v0.1.6 2023-08-10 14:19:44 +08:00
Shiv Thakker
fca83a25e5 Update README.md 2023-08-10 10:17:46 +08:00
Ron
f0f3800d3c Merge pull request #103 from ekini/feature/docker_cache
Use docker layer cache
2023-08-08 15:15:29 +08:00
Eugene Dementyev
2edb3f66e1 Use docker layer cache 2023-08-08 19:10:36 +12:00
Ron
36b15f1544 Merge pull request #102 from fleetbase/dev-main
urgent hotfix
2023-08-06 23:58:13 +08:00
Ronald A. Richardson
60f8f33d5c urgent hotfix 2023-08-06 23:56:12 +08:00
Ron
6ed95b8cd7 Merge pull request #101 from fleetbase/dev-main
upgrade `fleetbase/core-api^1.2.2`
2023-08-06 23:16:30 +08:00
Ronald A. Richardson
079cfabeb5 upgrade fleetbase/core-api^1.2.2 2023-08-06 23:10:09 +08:00
Ron
d8d8063620 Merge pull request #100 from fleetbase/dev-main
Dev main
2023-08-06 17:10:18 +08:00
Ronald A. Richardson
46b3554fce upgrade fleetbase/core-api^1.2.1 2023-08-06 17:09:34 +08:00
Ronald A. Richardson
d604acebe4 use dev-main console 2023-08-06 14:44:42 +08:00
Ron
962f46d4e2 Merge pull request #97 from fleetbase/dev-main
Dev main
2023-08-06 14:36:57 +08:00
Ronald A. Richardson
664d7f19cd set docker-compose version to v3.8 2023-08-06 14:32:52 +08:00
Ronald A. Richardson
06dcb90499 upgraded fleetbase/core-api to v1.2.0 2023-08-06 14:32:20 +08:00
Ronald A. Richardson
6d0ac8496d Upgraded fleetbase/core-api - Prevent mergeConfigFromSettings() from overwriting ENV variables 2023-08-06 14:30:58 +08:00
Ronald A. Richardson
10f8e694fe published @fleetbase/fleetops-data to github registry 2023-08-04 10:24:35 +08:00
Ronald A. Richardson
8e68ed1aeb engines now publish to github npm registry 2023-08-04 10:15:38 +08:00
Ron
267184df5f Merge pull request #94 from fleetbase/dev-main
update console `.gitignore` to ignore `.npmrc`
2023-08-03 13:19:36 +08:00
Ronald A. Richardson
98d96a50ab update console .gitignore to ignore .npmrc 2023-08-03 13:18:21 +08:00
Ron
51f8e4d289 Merge pull request #92 from fleetbase/dev-main
new workflow which restricts pull request from any other branch excep…
2023-08-03 13:02:04 +08:00
Ronald A. Richardson
04b01c734d new workflow which restricts pull request from any other branch except dev-cloud and main 2023-08-03 13:01:03 +08:00
Ron
405e299f07 Merge pull request #91 from fleetbase/dev-main
use `AWS_BUCKET_ENDPOINT` for s3 filesystem
2023-08-03 12:50:28 +08:00
Ronald A. Richardson
aea4b781b8 use AWS_BUCKET_ENDPOINT for s3 filesystem 2023-08-03 12:45:32 +08:00
Ron
35e81f05cd Merge pull request #89 from fleetbase/builds-with-private-auth
test build with github auth token depn packages
2023-08-03 12:13:56 +08:00
Ronald A. Richardson
9d388892b1 supress cp error message if any 2023-08-03 12:06:55 +08:00
Ronald A. Richardson
becb39b447 should work 2023-08-03 12:05:36 +08:00
Ronald A. Richardson
f490a552c4 dont change owner if composer auth comes form mounted secret 2023-08-03 11:58:51 +08:00
Ronald A. Richardson
95381ba140 works with local auth file too now 2023-08-03 11:50:23 +08:00
Ronald A. Richardson
7b190d7718 fix lock file 2023-08-03 09:43:59 +08:00
Ronald A. Richardson
92c153cf93 work for local builds too 2023-08-02 21:22:38 +08:00
Ronald A. Richardson
ef662fbd5e remove MAIL_MAILER from environment on application 2023-08-02 21:04:25 +08:00
Ronald A. Richardson
a5d05de27c remove test composer.lock 2023-08-02 21:00:19 +08:00
Ronald A. Richardson
5a6f44aee5 seems to be working now, next will get console working 2023-08-02 20:59:22 +08:00
Ronald A. Richardson
60cbc41b36 last attempt before 😴 2023-08-02 20:50:02 +08:00
Ronald A. Richardson
81e3d8466d place /.composer/auth.json in the correct place 2023-08-02 20:44:21 +08:00
Ronald A. Richardson
4f9096a94a do install on one command 2023-08-02 20:37:52 +08:00
Ronald A. Richardson
122fcf80cb added for debugging purposes 2023-08-02 20:28:41 +08:00
Ronald A. Richardson
50b5f54a63 fix the docker-bake 2023-08-02 20:23:51 +08:00
Ronald A. Richardson
243032469d try the docker-bake method 2023-08-02 20:22:05 +08:00
Ronald A. Richardson
42d26a6d81 updated ci.yml 2023-08-02 20:11:05 +08:00
Ronald A. Richardson
e2b2097855 updated ci.yml 2023-08-02 20:09:33 +08:00
Ronald A. Richardson
dbcc2fe8ef updated ci.yml 2023-08-02 20:08:01 +08:00
Ronald A. Richardson
d34b845719 updated ci.yml 2023-08-02 20:02:20 +08:00
Ronald A. Richardson
a8e050b20c try dynamically setting secret using set 2023-08-02 20:00:07 +08:00
Ronald A. Richardson
9b68458114 try to set secret 1 dimension 2023-08-02 19:37:13 +08:00
Ronald A. Richardson
eb12313614 try as per docs 2023-08-02 19:31:48 +08:00
Ronald A. Richardson
68ee8be32c added some output for debug 2023-08-02 18:52:57 +08:00
Ronald A. Richardson
6f35a2b456 make ./composer directory owned by www-data 2023-08-02 18:46:11 +08:00
Ronald A. Richardson
4bdd25288a diable --no-cache flag on composer install so git driver can download from git 2023-08-02 18:39:18 +08:00
Ronald A. Richardson
5804f65ef6 try CI pipeline with private package 2023-08-02 18:32:21 +08:00
Ronald A. Richardson
4db3677b6d update CI to work with composer-auth 2023-08-02 18:25:19 +08:00
Ronald A. Richardson
475c03c077 lets see 2023-08-02 18:21:34 +08:00
Ronald A. Richardson
00b49a7c04 hope this fixex logging error 2023-08-02 18:05:04 +08:00
Ronald A. Richardson
768fa6fc27 retry using new LOG_CHANNEL for build 2023-08-02 17:57:09 +08:00
Ronald A. Richardson
ed72c2afdd take 3? 2023-08-02 17:41:28 +08:00
Ronald A. Richardson
3aa5e2f89e set LOG_CHANNEL to stderr during docker build 2023-08-02 12:23:24 +08:00
Ronald A. Richardson
2656c764a1 set permissions on log file 2023-08-02 12:15:18 +08:00
Ronald A. Richardson
c217d6dc44 test build with github auth token depn packages 2023-08-02 12:07:22 +08:00
Ronald A. Richardson
c68ec787c1 update workflow for dynamic use _GITHUB_AUTH_TOKEN to generate composer auth, and .npmrc for private repo access in builds 2023-08-01 21:20:25 +08:00
Ronald A. Richardson
22a2f2048e set correct default config options 2023-08-01 21:02:15 +08:00
Ronald A. Richardson
c53d360ef0 added stdout logging channel 2023-08-01 17:32:40 +08:00
Ronald A. Richardson
406ca11199 modified to setup composer auth for private packages/extensions in builds and deploy if arg provided 2023-08-01 17:08:44 +08:00
Ronald A. Richardson
9c604edcf5 build with redis-tools not redis-cli 2023-08-01 16:50:27 +08:00
Ronald A. Richardson
cb96b4112c fix Dockerfile so packages is copied to a packages dir 2023-08-01 16:27:13 +08:00
Ronald A. Richardson
a502e1f5f3 use ExceptionHandler from fleetbase/core-api package 2023-08-01 16:19:32 +08:00
Ronald A. Richardson
27e10a2b33 Critical patches on API, added consumable API routes and essential middlewares 2023-08-01 15:54:42 +08:00
Ronald A. Richardson
1c70b2f62c update Dockerfile so that /api and /packages directory are copied and not contents 2023-08-01 11:30:26 +08:00
Ronald A. Richardson
a8ba45fc73 Hotfix Utils::parseUrl for correctly parsing encoded urls 2023-07-31 20:29:46 +08:00
Ronald A. Richardson
f6a7edf6f4 patch deploy script, update core-api to v1.1.7 to use utf-8 aware url parser for db connections 2023-07-30 10:57:53 +08:00
Ronald A. Richardson
9889c4b4aa updated console 2023-07-28 10:47:38 +08:00
Ron
8bdababe5e Merge pull request #87 from ekini/feature/cd_tweak 2023-07-27 20:40:24 +08:00
Eugene Dementyev
a3184b3c6e Fix the quotes 2023-07-28 00:38:59 +12:00
Ron
1de56e08fa Merge pull request #86 from ekini/feature/cd_tweak 2023-07-27 20:04:28 +08:00
Eugene Dementyev
475b7ddda0 Fail when unable to get parameters 2023-07-28 00:00:27 +12:00
Ron
f9ba04198c Merge pull request #85 from ekini/feature/cd_tweak
Parametrise some variables
2023-07-27 19:37:51 +08:00
Eugene Dementyev
e8fce1b1fc Parametrise some variables 2023-07-27 23:31:44 +12:00
Ron
174dd83542 Merge pull request #84 from ekini/fix/cd
Fix the deploy bucket name
2023-07-27 14:02:04 +08:00
Eugene Dementyev
629d8bdd26 Fix the deploy bucket name 2023-07-27 18:00:21 +12:00
Ronald A. Richardson
045bcc1648 fix Deploy Console 🚀 step 2023-07-27 10:35:58 +08:00
Ronald A. Richardson
a0e9a912f6 updated github workflows for deploy added Set Dynamic ENV Vars step for console deploy 2023-07-27 10:05:13 +08:00
Ron
cbed2de0d5 Merge pull request #83 from fleetbase/fix-deploy-sh-permissions
fix `deploy.sh` permissions
2023-07-27 09:12:57 +08:00
Ronald A. Richardson
557666252b fix deploy.sh permissions 2023-07-27 09:12:00 +08:00
Ronald A. Richardson
7cf544bd30 update cd.yml workflow to use pnpm build 2023-07-25 22:49:06 +08:00
Ronald A. Richardson
5bf9e691aa renamed after-deploy.sh -> deploy.sh 2023-07-25 22:41:11 +08:00
Ron
011f658086 Merge pull request #82 from ekini/fix/deploy_script_name 2023-07-25 17:10:34 +08:00
Eugene Dementyev
08b50cbfc1 Fix deploy script name 2023-07-25 21:09:17 +12:00
Ron
6c0888ffae Merge pull request #80 from ekini/feature/deploy_console 2023-07-25 17:07:18 +08:00
Eugene Dementyev
de4b088c31 Add deployment of console 2023-07-25 21:02:18 +12:00
Ronald A. Richardson
1e5ea0e2fa Started on Pallet - the Fleetbase inventory management extension, added after-deploy.sh script to api 2023-07-25 14:48:44 +08:00
Ron
0f8f7bb423 Merge pull request #79 from ekini/feature/deploy
feature/deploy
2023-07-24 20:58:40 +08:00
Eugene Dementyev
1b4993cb93 Push to ECR and deploy 2023-07-25 00:06:50 +12:00
Eugene Dementyev
2d905e50c9 always build on main and tags and PRs 2023-07-24 22:23:14 +12:00
Ron
98b9afd151 Merge pull request #78 from fleetbase/dev-main
includes small update to retain mysql data locally, also includes upd…
2023-07-24 18:07:18 +08:00
Ronald A. Richardson
03e6a87696 includes small update to retain mysql data locally, also includes update script 2023-07-24 18:05:06 +08:00
Ronald A. Richardson
947746e4f1 Ready to release v0.1.5 and updated .gitignore - releasing UniverseService 2023-07-23 19:01:10 +08:00
Ronald A. Richardson
d819516a17 updated composer.lock and packages 2023-07-23 18:56:08 +08:00
Ronald A. Richardson
3a34ff1627 updated .gitignore and removed /examples directory 2023-07-23 18:22:39 +08:00
Ron
cb53cb7270 Merge pull request #76 from fleetbase/feature-universe-powered-extensions
Feature universe powered extensions
2023-07-23 18:08:39 +08:00
Ronald A. Richardson
f75efa6c07 merge ready 2023-07-23 18:07:03 +08:00
Ronald A. Richardson
90b1987ade latest docker-compose.yml 2023-07-23 18:02:33 +08:00
Ronald A. Richardson
bc854c5d6c mergeable 2023-07-23 18:01:31 +08:00
Ronald A. Richardson
b467f30d69 universe powered releases! 2023-07-23 17:57:16 +08:00
Ronald A. Richardson
74ed29ad8c wip 2023-07-17 18:49:12 +08:00
Ronald A. Richardson
04125ebfb3 fix the Dockerfile 2023-07-16 13:54:30 +08:00
Ronald A. Richardson
05746fccd0 wip 2023-07-16 13:53:25 +08:00
Ron
c90df0218e Merge pull request #73 from fleetbase/use-httpd-container-for-dev
Use httpd container for dev
2023-07-16 13:37:41 +08:00
Ronald A. Richardson
03bbae856a reverted back to useing httpd container via docker-compose for development, use volume mount for uploads, upgraded core-api to patch seed, removed nginx.conf and startup.sh as no longer needed 2023-07-16 13:34:28 +08:00
Ronald A. Richardson
71d27375c6 wip for new extensions system 2023-07-16 13:02:56 +08:00
Ron
75a1a1b389 Merge pull request #72 from ekini/fix/app_dockerfile 2023-07-15 20:19:11 +08:00
Eugene Dementyev
fc5a5df5c7 Use the external httpd container 2023-07-16 00:17:06 +12:00
Ron
3dfa7a4076 Merge pull request #71 from ekini/feature/parametrise_nginx 2023-07-15 19:53:35 +08:00
Eugene Dementyev
45387cb360 Parametrise nginx app hostname 2023-07-15 23:51:56 +12:00
Ron
6425180c40 Merge pull request #70 from ekini/feature/build_other_images 2023-07-15 19:41:19 +08:00
Eugene Dementyev
98f3a2ceba Use Socketcluster official images 2023-07-15 23:13:22 +12:00
Ron
275b1bcab8 Merge pull request #69 from ekini/feature/build_other_images 2023-07-15 19:01:33 +08:00
Eugene Dementyev
e61ace5bcb Build app-httpd and socketcluster images 2023-07-15 23:00:05 +12:00
Ron
b5d6ba2114 Merge pull request #68 from ekini/feature/remove_jobs 2023-07-15 18:43:48 +08:00
Eugene Dementyev
7b62ff9d50 Remove jobs from the Dockerfile as it's not used.
Change the events queue name to "sqs"
2023-07-15 22:41:59 +12:00
Ron
b601136754 Merge pull request #66 from ekini/feature/docker_edge_tag
Use Docker edge tag for commits in main, even untagged
2023-07-14 18:42:06 +08:00
Ronald A. Richardson
b1da01d4f6 added extensions example 2023-07-14 18:41:09 +08:00
Eugene Dementyev
80b43ffa72 Use Docker edge tag for commits in main, even untagged 2023-07-14 22:33:36 +12:00
Ron
c1545dbd14 Merge pull request #65 from ekini/fix/move_ssm_parent_config 2023-07-13 19:53:39 +08:00
Eugene Dementyev
452f8c4bd5 Moves ssm-parent config to the right location 2023-07-13 23:29:06 +12:00
Ron
4de6ea1e30 Merge pull request #64 from fleetbase/dev-main
Patched order creation, core components, and upgraded dependencies
2023-07-10 20:57:48 +08:00
Ronald A. Richardson
de374069dd Patched order creation, core components, and upgraded dependencies 2023-07-10 20:56:10 +08:00
Ron
dd5accecef Merge pull request #63 from ekini/feature/action_builds
Feature/action builds
2023-07-07 19:55:44 +08:00
Eugene Dementyev
cae2774632 Only run build and release from tags 2023-07-07 22:34:17 +12:00
Eugene Dementyev
b399d0092c Release packages with docker bake 2023-07-07 22:21:07 +12:00
Ron
b056a07fa2 Update README.md 2023-07-07 12:24:37 +08:00
Ron
90a590e156 Merge pull request #61 from fleetbase/dev-main
Added IAM Extension + Important bug fixes
2023-07-06 22:29:01 +08:00
Ronald A. Richardson
bcb1470138 Added IAM Extension + Important bug fixes 2023-07-06 22:15:20 +08:00
Eugene Dementyev
9cba77709f Simplify installation of ssm-parent and update version 2023-07-04 19:17:34 +12:00
Ron
0cab9b816b Merge pull request #59 from fleetbase/dev-main
updated github workflow for a discord announcement
2023-06-30 13:04:55 +08:00
Ronald A. Richardson
a5892a1cc4 updated github workflow for a discord announcement 2023-06-30 13:04:34 +08:00
Ron
ba6cdd9db3 Merge pull request #58 from fleetbase/dev-main
Added Branding Settings to Admin section
2023-06-30 11:38:10 +08:00
Ronald A. Richardson
80c621d020 Added Branding Settings to Admin section 2023-06-30 11:36:14 +08:00
Ron
915293d9b1 Update README.md 2023-06-30 10:47:25 +08:00
Ron
fe41262c89 Update README.md 2023-06-20 18:42:35 +08:00
Ron
5cc39304e0 Update README.md 2023-06-20 15:12:22 +08:00
Ron
b7d87c5ad7 Update README.md 2023-06-20 10:20:48 +08:00
Ron
fa9a43ae49 Merge pull request #55 from fleetbase/dev-main
Updated FleetOps api/engine for critical patches and improvements
2023-06-19 17:46:39 +08:00
Ronald A. Richardson
21bccc1499 Updated FleetOps api/engine for critical patches and improvements 2023-06-19 16:29:56 +07:00
Ron
ef5464aede Merge pull request #54 from fleetbase/dev-main
- Uses initializer from `@fleetbase/ember-core` to globally load `soc…
2023-06-16 14:53:28 +08:00
Ronald A. Richardson
ddd3d05f09 exclude socketcluster-client from fingerprint 2023-06-16 14:46:07 +08:00
Ronald A. Richardson
039033da47 added back load-socketcluster-client initializer 2023-06-16 14:36:54 +08:00
Ronald A. Richardson
3077b6df8c - Uses initializer from @fleetbase/ember-core to globally load socketcluster-client, now packages do not need to include as dependency\n- Upgraded @fleetbase/leaflet-routing-machine to v3.2.16 which introduces option to provide markerOptions to customize waypoint markers\n- Patched FleetOps extension so that waypoint map markers load 2023-06-16 14:12:34 +08:00
Ron
25601cee70 Update README.md 2023-06-15 17:39:34 +08:00
Ron
3ebc6d11cc Update README.md 2023-06-15 17:38:18 +08:00
Ron
27f1b26684 Merge pull request #44 from fleetbase/dev-main
v0.0.9
2023-06-14 19:40:28 +08:00
Ronald A. Richardson
b231a24edc bumped console to v0.1.1 2023-06-14 19:27:22 +08:00
Ronald A. Richardson
b3f87fc078 patch socketcluster-client resolve issue among packages and extensions on production build 2023-06-14 18:50:04 +08:00
Ronald A. Richardson
bb6c6cf9d5 Upgrade to all package dependencies, includes essential patches and hotfixes, added Extensions placeholder 2023-06-14 16:44:50 +08:00
Ron
3adc943450 Merge pull request #43 from fleetbase/dev-main
Update console with new Dashboard, Added Changelog, Added new `Socket…
2023-06-14 00:10:18 +08:00
Ronald A. Richardson
e8bc17c5b9 Update console with new Dashboard, Added Changelog, Added new SocketService for handling socket connections and listening, fleetbase-extensions-indexer now extracts custom fleetbase key from extension packages, <Layout::Sidebar /> is now collapsible, <Layout::Header /> can now accept custom nav items from argument, Patched <ModelSelect /> component to properly accept and handle customSearchEndpoint arg 2023-06-13 23:57:34 +08:00
Ron
2a8c5cb130 Merge pull request #42 from fleetbase/dev-main
updated Dockerfile to handle permission issues and patch composer ins…
2023-06-11 12:22:01 +08:00
Ronald A. Richardson
9b938e84c5 updated nginx config for timeout and logging 2023-06-11 12:15:05 +08:00
Ronald A. Richardson
672ac85d7d updated docker-compose.yml 2023-06-11 11:55:03 +08:00
Ronald A. Richardson
9decae6e26 set target as app-dev for application 2023-06-11 11:33:11 +08:00
Ronald A. Richardson
6d4d037d2f removed all shared volumes from docker environment - only use for dev, drop httpd container 2023-06-11 11:01:36 +08:00
Ronald A. Richardson
3969473b99 updated Dockerfile to handle permission issues and patch composer install and dump, as well as dependency updates for api 2023-06-09 16:08:38 +08:00
Ron
8212eceb50 Merge pull request #41 from fleetbase/dev-main
updated api to use `fleetbase/core-api#v1.0.6-alpha`
2023-06-09 12:40:26 +08:00
Ronald A. Richardson
cb23dda979 updated api to use fleetbase/core-api#v1.0.6-alpha 2023-06-09 12:39:23 +08:00
Shiv Thakker
4ffc2c750e Update README.md 2023-06-09 12:11:36 +08:00
Ron
b55f37ffdf Merge pull request #40 from fleetbase/dev-main
updated `fleetbase/core-api` to v1.0.5-alpha to add server IP as CORS…
2023-06-09 12:09:48 +08:00
Ronald A. Richardson
8a2ce65763 updated fleetbase/core-api to v1.0.5-alpha to add server IP as CORS origin 2023-06-09 12:08:50 +08:00
Ron
f60e72e96d Merge pull request #39 from fleetbase/dev-main
updated console to v0.0.7 which includes `window.crypto.randomUUID` p…
2023-06-09 11:23:01 +08:00
Ronald A. Richardson
b4c4012557 updated console to v0.0.7 which includes window.crypto.randomUUID polyfill patch 2023-06-09 11:22:09 +08:00
Shiv Thakker
d46d22e6cc Update README.md 2023-06-09 09:52:47 +08:00
Ron
190394e853 Merge pull request #38 from fleetbase/dev-main
Admin System Configuration v1 ready
2023-06-08 18:44:35 +08:00
Ronald A. Richardson
8683f1b0ca Admin System Configuration v1 ready 2023-06-08 18:43:34 +08:00
Ron
96dfd6e48a Merge pull request #37 from fleetbase/dev-main
bump console to v0.0.5 for firefox patches
2023-06-07 21:25:54 +08:00
Ronald A. Richardson
80774383bc bump console to v0.0.5 for firefox patches 2023-06-07 21:22:08 +08:00
Ron
07606b8d15 Merge pull request #36 from fleetbase/dev-main
patch Dockerfile
2023-06-07 19:16:30 +08:00
Ronald A. Richardson
acf3c66c9f patch Dockerfile 2023-06-07 19:15:37 +08:00
Ron
1d75130724 Merge pull request #35 from fleetbase/dev-main
patched Dockerfile, console updated to v0.0.4 with all latest depende…
2023-06-07 18:37:38 +08:00
Ronald A. Richardson
4e635716bb patched Dockerfile, console updated to v0.0.4 with all latest dependencies 2023-06-07 18:36:53 +08:00
Ron
1bb3569518 Merge pull request #34 from fleetbase/dev-main
console now builds for production
2023-06-06 15:22:00 +08:00
Ronald A. Richardson
f3240c049f console now builds for production 2023-06-06 14:21:10 +07:00
Ron
f974b07000 Merge pull request #33 from fleetbase/dev-main
oops, dont use local dir for api depn
2023-06-05 12:29:16 +08:00
Ronald A. Richardson
3d1140d45c oops, dont use local dir for api depn 2023-06-05 11:28:32 +07:00
Ron
fdcd526f7b Merge pull request #32 from fleetbase/dev-main
update core-api to v1.0.3-alpha
2023-06-05 12:25:26 +08:00
Ronald A. Richardson
bbd02e4e8a update core-api to v1.0.3-alpha 2023-06-05 11:24:36 +07:00
Ron
fb93443aff Merge pull request #31 from fleetbase/dev-main
now uses installer, dropped entrypoint scripts
2023-05-30 17:50:25 +08:00
Ronald A. Richardson
fb4e51d1ba now uses installer, dropped entrypoint scripts 2023-05-30 17:48:08 +08:00
Ron
3c122d6897 Merge pull request #29 from fleetbase/shivthakker-patch-12
Update README.md
2023-05-30 16:39:21 +08:00
Ron
d73a381141 Merge pull request #28 from fleetbase/shivthakker-patch-11
Create PULL_REQUEST_TEMPLATE.md
2023-05-30 16:38:39 +08:00
Ron
8b23afc08a Merge pull request #27 from fleetbase/shivthakker-patch-10
Create SECURITY.md
2023-05-30 16:38:18 +08:00
Ron
32b9db4da9 Merge pull request #26 from fleetbase/shivthakker-patch-9
Create LICENSE
2023-05-30 16:37:58 +08:00
Ron
dd95ab14d4 Merge pull request #25 from fleetbase/shivthakker-patch-8
Create CODE_OF_CONDUCT.md
2023-05-30 16:37:33 +08:00
Ron
46ea479102 Merge pull request #30 from fleetbase/dev-main
Added installer flow
2023-05-30 16:37:07 +08:00
Ronald A. Richardson
ae5fb66e5b latest 2023-05-30 16:36:33 +08:00
Shiv Thakker
ed5fe522fe Update README.md
made introductions more concise
2023-05-30 15:43:38 +08:00
Shiv Thakker
68ce0167e3 Create PULL_REQUEST_TEMPLATE.md
added pull request template
2023-05-30 15:39:04 +08:00
Shiv Thakker
554c5cdbea Create SECURITY.md
added security file
2023-05-30 15:36:54 +08:00
Shiv Thakker
95df545e62 Create LICENSE
added MIT License
2023-05-30 15:33:08 +08:00
Shiv Thakker
d55edb73eb Create CODE_OF_CONDUCT.md
added code of conduct template
2023-05-30 15:31:31 +08:00
Ron
2578a5302f Merge pull request #24 from fleetbase/dev-main
remove publish job from ci
2023-05-29 15:17:09 +08:00
Ron
827040336c Merge pull request #23 from fleetbase/dev-main
updated github ci workflow to publish to dockerhub
2023-05-29 14:58:50 +08:00
Ron
c919b13943 Merge pull request #22 from fleetbase/roncodes-patch-3
Update README.md
2023-05-29 12:25:01 +08:00
Ron
afac4c7788 Update README.md
Added internationalize to the roadmap
2023-05-29 12:24:53 +08:00
Ron
d1dee5789e Update README.md
Include Roadmap link in Table of Contents
2023-05-26 16:18:46 +08:00
Ron
797de1d38c Merge pull request #21 from fleetbase/roncodes-patch-2
Update README.md
2023-05-26 16:14:32 +08:00
Ron
10dcc4bab8 Update README.md
Added link to Cloud API Status
2023-05-26 16:14:22 +08:00
Ron
59aab8c9cc Merge pull request #20 from fleetbase/roncodes-patch-1
Update README.md
2023-05-26 16:08:33 +08:00
Ron
c7707d6c8e Update README.md 2023-05-26 16:08:24 +08:00
Ron
9809ebe28e Merge pull request #19 from fleetbase/dev-main
API dependencies updated to the latest versions
2023-05-26 12:52:38 +08:00
Ron
5dbce3edfd Merge pull request #18 from fleetbase/dev-main
latest
2023-05-25 21:09:40 +08:00
Ron
61bedf737b Merge pull request #16 from fleetbase/dev-main
move ci to workflows dir
2023-05-25 21:08:16 +08:00
Ron
49b8858cad Merge pull request #17 from fleetbase/readme-update-7
Update README.md
2023-05-25 20:40:46 +08:00
Ron
7c698ee8c9 Update README.md
Added submodule initialization step
2023-05-25 20:40:36 +08:00
Ron
38679fcd07 Merge pull request #14 from fleetbase/shivthakker-patch-7
Update README.md
2023-05-25 20:30:33 +08:00
Ron
6fcee898d8 Merge pull request #15 from fleetbase/dev-main
Added Github CI workflow
2023-05-25 20:30:19 +08:00
Ron
c9920cceb6 Merge pull request #13 from fleetbase/shivthakker-patch-6
Update CONTRIBUTING.md
2023-05-25 20:30:08 +08:00
Shiv Thakker
2b98d488fc Update README.md
updated links
2023-05-25 18:47:23 +08:00
Shiv Thakker
59f4188465 Update CONTRIBUTING.md
updated issues link
2023-05-25 18:30:46 +08:00
Ron
ad8adbf1c3 Merge pull request #12 from fleetbase/shivthakker-patch-5
Create CONTRIBUTING.md
2023-05-25 18:18:59 +08:00
Shiv Thakker
4439c75158 Create CONTRIBUTING.md 2023-05-25 17:30:47 +08:00
Shiv Thakker
26345ab075 Update issue templates - docs 2023-05-25 16:48:09 +08:00
Shiv Thakker
a0cee3444b Update issue templates 2023-05-25 16:28:23 +08:00
Shiv Thakker
b0abd6129f Update issue templates 2023-05-25 16:23:14 +08:00
410 changed files with 36411 additions and 1324 deletions

3
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,3 @@
# These are supported funding model platforms
github: fleetbase

10
.github/ISSUE_TEMPLATE/custom.md vendored Normal file
View File

@@ -0,0 +1,10 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''
---

View File

@@ -0,0 +1,17 @@
---
name: "\U0001F4DA Docs Feedback"
about: Improve Fleetbase Documentation
title: ''
labels: ''
assignees: ''
---
**Describe the improvement**
A clear and concise description of documentation improvement .
**Related Page**
Which section and page is this improvement related to? .
**Additional context**
Add any other context about the improvement here.

View File

@@ -0,0 +1,20 @@
---
name: "\U0001F680 Feature request"
about: Submit a proposal for a new feature
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -0,0 +1,41 @@
---
name: "\U0001FAB2Bug Report"
about: Report a bug to help us improve.
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Logs (if relevant)**
Any log relevant log messages or snippets
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

167
.github/workflows/cd.yml vendored Normal file
View File

@@ -0,0 +1,167 @@
name: Fleetbase CI/CD
on:
push:
branches: [ "deploy/*" ]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
PROJECT: ${{ secrets.PROJECT }}
jobs:
build_service:
name: Build and Deploy the Service
runs-on: ubuntu-latest
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set Dynamic ENV Vars
run: |
SHORT_COMMIT=$(echo $GITHUB_SHA | cut -c -8)
echo "VERSION=${SHORT_COMMIT}" >> $GITHUB_ENV
echo "STACK=$(basename $GITHUB_REF)" >> $GITHUB_ENV
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_NUMBER }}:role/${{ env.PROJECT }}-${{ env.STACK }}-deployer
role-session-name: github
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Prepare Composer Auth Secret
run: |
if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then
echo '{"github-oauth": {"github.com": "'${{ secrets._GITHUB_AUTH_TOKEN }}'"}}' > composer-auth.json
else
echo '{}' > composer-auth.json
fi
- name: Build and Release
uses: docker/bake-action@v2
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT }}-${{ env.STACK }}
VERSION: ${{ env.VERSION }}
CACHE: type=gha
with:
push: true
files: |
./docker-bake.hcl
- name: Download ecs-tool
run: |
wget -O ecs-tool.tar.gz https://github.com/springload/ecs-tool/releases/download/1.9.6/ecs-tool_1.9.6_linux_amd64.tar.gz && tar -xvf ecs-tool.tar.gz ecs-tool
- name: Deploy the images 🚀
run: |-
set -eu
# run deploy.sh script before deployments
env "ECS_RUN.SERVICE=app" "ECS_RUN.LAUNCH_TYPE=FARGATE" ./ecs-tool run -l "ecs-tool" --image_tag '{container_name}-${{ env.VERSION }}' --cluster ${{ env.PROJECT }}-${{ env.STACK }} --task_definition ${{ env.PROJECT }}-${{ env.STACK }}-app --container_name app ./deploy.sh
./ecs-tool deploy --image_tag '{container_name}-${{ env.VERSION }}' --cluster ${{ env.PROJECT }}-${{ env.STACK }} -s app -s scheduler -s events
build_frontend:
name: Build and Deploy the Console
needs: [build_service]
runs-on: ubuntu-latest
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Set Dynamic ENV Vars
run: |
SHORT_COMMIT=$(echo $GITHUB_SHA | cut -c -8)
echo "VERSION=${SHORT_COMMIT}" >> $GITHUB_ENV
echo "STACK=$(basename $GITHUB_REF)" >> $GITHUB_ENV
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_NUMBER }}:role/${{ env.PROJECT }}-${{ env.STACK }}-deployer
role-session-name: github
aws-region: ${{ secrets.AWS_REGION }}
- name: Get infra-provided configuration
run: |
set -eu
wget -O- https://github.com/springload/ssm-parent/releases/download/1.8.0/ssm-parent_1.8.0_linux_amd64.tar.gz | tar xvzf - ssm-parent
./ssm-parent -n /actions/${{ env.PROJECT }}/${{ env.STACK }}/configuration dotenv /tmp/dotenv.file
# remove double quotes and pipe into the env
cat /tmp/dotenv.file | sed -e 's/"//g' >> $GITHUB_ENV
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false
- name: Get pnpm Store Directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm Cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Check for _GITHUB_AUTH_TOKEN and create .npmrc
run: |
if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then
echo "//npm.pkg.github.com/:_authToken=${{ secrets._GITHUB_AUTH_TOKEN }}" > .npmrc
fi
working-directory: ./console
- name: Install dependencies
run: pnpm install
working-directory: ./console
- name: Build
run: |
set -eu
pnpm build
working-directory: ./console
- name: Deploy Console 🚀
run: |
set -u
DEPLOY_BUCKET=${STATIC_DEPLOY_BUCKET:-${{ env.PROJECT }}-${{ env.STACK }}}
# this value will come from the dotenv above
echo "Deploying to $DEPLOY_BUCKET"
wget -O- https://github.com/bep/s3deploy/releases/download/v2.11.0/s3deploy_2.11.0_linux-amd64.tar.gz | tar xzv -f - s3deploy
./s3deploy -region ${AWS_REGION} -source console/dist -bucket ${DEPLOY_BUCKET}

View File

@@ -15,16 +15,23 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and Start Docker Services
- name: Prepare Composer Auth Secret
run: |
docker-compose up -d --build
if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then
echo '{"github-oauth": {"github.com": "'${{ secrets._GITHUB_AUTH_TOKEN }}'"}}' > composer-auth.json
else
echo '{}' > composer-auth.json
fi
- name: Build and Release
uses: docker/bake-action@v2
with:
files: |
./docker-bake.hcl

18
.github/workflows/cloud.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: "Close Invalid PRs"
on:
pull_request:
branches:
- cloud
jobs:
close_pr:
runs-on: ubuntu-latest
steps:
- name: Close invalid PRs
run: |
if [[ "${{ github.event.pull_request.head.ref }}" != "main" ]] && [[ "${{ github.event.pull_request.head.ref }}" != "dev-cloud" ]]; then
echo "This PR is from '${{ github.event.pull_request.head.ref }}', but only PRs from 'main' or 'dev-cloud' are allowed. Closing PR."
gh pr close ${{ github.event.pull_request.number }} --repo ${{ github.repository }}
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -0,0 +1,48 @@
name: Discord Announcement
on:
push:
tags:
- "v*"
jobs:
discord_announcement:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get tag message
id: tag
run: |
echo "::set-output name=version::$(git describe --tags --abbrev=0)"
if [[ "${ACT}" == "true" ]]; then
# If running with act, use an environment variable for the tag message
echo "::set-output name=message::$(echo -e "${TAG_MESSAGE}" | base64)"
else
# If running on GitHub, use git to get the tag message
echo "::set-output name=message::$(git tag -l --format='%(contents)' $(git describe --tags --abbrev=0) | base64)"
fi
- name: Print tag message
run: echo "${{ steps.tag.outputs.message }}"
- name: Get tag name
id: get_tag
run: echo "::set-output name=tag::${GITHUB_REF/refs\/tags\//}"
- name: Decode message
id: decode
run: |
echo "Decoding message..."
echo "::set-output name=message::$(echo '${{ steps.tag.outputs.message }}' | base64 --decode)"
- name: Send message to Discord
uses: tsickert/discord-webhook@v5.3.0
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
content: "@everyone \n📦 New Fleetbase Version ${{ steps.get_tag.outputs.tag }} Released!\n${{ steps.decode.outputs.message }} \nVersion: ${{ steps.get_tag.outputs.tag }} \n[Release Notes for ${{ steps.get_tag.outputs.tag }}](https://github.com/fleetbase/fleetbase/releases/tag/${{ steps.get_tag.outputs.tag }})"
username: Fleetbase

14
.gitignore vendored
View File

@@ -11,4 +11,16 @@ api/public/storage
api/storage/*.key
api/storage/uploads
api/storage/public
api/vendor
api/vendor
api/composer.dev.json
api/composer-install-dev.sh
api/auth.json
act.sh
composer-auth.json
packages/billing-api
packages/billing-engine
packages/flespi-engine
packages/flespi-integration
packages/projectargus-engine
docker/database/*
docker/database/mysql/*

48
.gitmodules vendored
View File

@@ -1,55 +1,41 @@
[submodule "console"]
path = console
url = git@github.com:fleetbase/console.git
[submodule "packages/fleetops"]
path = packages/fleetops
url = git@github.com:fleetbase/fleetops.git
[submodule "packages/storefront"]
path = packages/storefront
url = git@github.com:fleetbase/storefront.git
[submodule "packages/pallet"]
path = packages/pallet
url = git@github.com:fleetbase/pallet.git
[submodule "packages/core-api"]
path = packages/core-api
url = git@github.com:fleetbase/core-api.git
branch = dev-main
[submodule "packages/fleetops-api"]
path = packages/fleetops-api
url = git@github.com:fleetbase/fleetops-api.git
branch = dev-main
branch = main
[submodule "packages/ember-core"]
path = packages/ember-core
url = git@github.com:fleetbase/ember-core.git
branch = dev-main
branch = main
[submodule "packages/ember-ui"]
path = packages/ember-ui
url = git@github.com:fleetbase/ember-ui.git
branch = dev-main
[submodule "packages/storefront-engine"]
path = packages/storefront-engine
url = git@github.com:fleetbase/storefront-engine.git
branch = dev-main
branch = main
[submodule "packages/iam-engine"]
path = packages/iam-engine
url = git@github.com:fleetbase/iam-engine.git
[submodule "packages/dev-engine"]
path = packages/dev-engine
url = git@github.com:fleetbase/dev-engine.git
branch = dev-main
branch = main
[submodule "packages/fleetbase-extensions-indexer"]
path = packages/fleetbase-extensions-indexer
url = git@github.com:fleetbase/fleetbase-extensions-indexer.git
[submodule "packages/fleetops-engine"]
path = packages/fleetops-engine
url = git@github.com:fleetbase/fleetops-engine.git
branch = dev-main
[submodule "packages/fleetops-data"]
path = packages/fleetops-data
url = git@github.com:fleetbase/fleetops-data.git
branch = main
[submodule "docs/guides"]
path = docs/guides
url = git@github.com:fleetbase/guides.git
[submodule "docs/api-reference"]
path = docs/api-reference
url = git@github.com:fleetbase/api-reference.git
[submodule "packages/storefront-api"]
path = packages/storefront-api
url = git@github.com:fleetbase/storefront-api.git
branch = dev-main
[submodule "packages/fleetops-data"]
path = packages/fleetops-data
url = git@github.com:fleetbase/fleetops-data.git
branch = dev-main
[submodule "socket"]
path = socket
url = git@github.com:fleetbase/socket.git
branch = dev-main

13
.s3deploy.yml Normal file
View File

@@ -0,0 +1,13 @@
routes:
- route: "^.+\\.(js|css|svg|ttf)$"
headers:
Cache-Control: "max-age=600, no-transform, public"
gzip: true
- route: "^.+\\.(png|jpg)$"
headers:
Cache-Control: "max-age=600, no-transform, public"
gzip: false
- route: "^.+\\.(html|xml|json)$"
headers:
Cache-Control: "public, max-age=0, must-revalidate"
gzip: true

128
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
hello@fleetbase.io.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

47
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,47 @@
# Contributing to Fleetbase
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing new features
- Becoming a maintainer
## We Develop with Github
We use github to host code, to track issues and feature requests, as well as accept pull requests.
## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), So All Code Changes Happen Through Pull Requests
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests:
1. Fork the repo and create your branch from `master`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code lints.
6. Issue that pull request!
## Any contributions you make will be under the MIT Software License
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
## Report bugs using Github's [issues](https://github.com/fleetbase/fleetbase/issues)
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/fleetbase/fleetbase/issues), it's that easy!
## Write bug reports with detail, background, and sample code
**Great Bug Reports** tend to have:
- A quick summary and/or background
- Steps to reproduce
- Be specific!
- Give sample code if you can.
- What you expected would happen
- What actually happens
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
People *love* thorough bug reports. I'm not even kidding.
## License
By contributing, you agree that your contributions will be licensed under its MIT License.
## References
This document was adapted from the open-source contribution guidelines for [Facebook's Draft](https://github.com/facebook/draft-js/blob/a9316a723f9e918afde44dea68b5f9f39b7d9b00/CONTRIBUTING.md)

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Fleetbase Pte Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

12
PULL_REQUEST_TEMPLATE.md Normal file
View File

@@ -0,0 +1,12 @@
### What change does this PR introduce?
<!-- Explain here the changes your PR introduces and text to help us understand the context of this change. -->
### Why was this change needed?
<!-- If your PR fixes an open issue, use `Closes #999` to link your PR with the issue. #999 stands for the issue number you are fixing, Example: Closes #31 -->
### Other information (Screenshots)
<!-- Add notes or any other information here -->
<!-- Also add all the screenshots which support your changes -->

View File

@@ -5,33 +5,44 @@
</a>
</p>
<p align="center" dir="auto">
Open Source Logistics & Supply Chain Platform and Infrastructure
Open Source Modular Logistics Platform
<br>
<a href="https://docs.fleetbase.dev/api" rel="nofollow">Fleetbase Documentation →</a>
<a href="https://fleetbase.github.io/guides" rel="nofollow">Fleetbase Documentation →</a>
<br>
<br>
<a href="https://github.com/fleetbase/fleetbase/issues">Report an Issue</a>
·
<a href="https://fleetbase.dev/api">API Reference</a>
<a href="https://fleetbase.github.io/api-reference">API Reference</a>
·
<a href="https://github.com/fleetbase/guides">Guides</a>
<a href="https://fleetbase.github.io/guides">Guides</a>
·
<a href="https://github.com/fleetbase/fleetbase/issues">Request a Feature</a>
·
<a href="https://www.fleetbase.io/blog-2" rel="nofollow">Blog</a>
·
<a href="https://fleetbase.apichecker.com" target="_api_status" rel="nofollow">API Status</a>
·
<a href="https://discord.gg/V7RVWRQ2Wm" target="discord" rel="nofollow">Discord</a>
</p>
<hr />
</div>
# ⭐️ Overview
Fleetbase is a comprehensive, open-source platform for the management and orchestration of logistics and supply chain operations. This dual-natured platform serves not only as an efficient operational tool for companies within these industries but also as a robust foundational layer for developers. Its versatility emanates from its core, which is skillfully constructed around a series of "extensions," creating a flexible and customizable framework that accommodates a wide spectrum of supply chain and logistics requirements.
Fleetbase is an open-source modular platform designed for the efficient management and orchestration of logistics operations. It serves as both a powerful operational tool for businesses and a flexible foundation for developers. The platform's core is built around a collection of "extensions," which create a customizable framework capable of meeting a wide range of supply chain and logistics requirements.
Every individual extension within Fleetbase is purposefully engineered to fulfill specific roles within the expansive ecosystem of supply chain and logistics. With inherent extensibility users have the freedom to craft their own extensions, thereby expanding the ecosystem and ensuring the platform's adaptability across a multitude of use cases. This extensible nature ensures that Fleetbase remains at the forefront of meeting diverse logistical and supply chain needs now and into the future.
Each extension in Fleetbase is purposefully engineered to fulfill specific roles within the logistics ecosystem. Users have the freedom to create their own extensions, expanding the platform's ecosystem and ensuring its adaptability to various use cases. This extensible nature keeps Fleetbase at the forefront of addressing diverse logistical and supply chain needs now and in the future.
<p align="center" dir="auto">
<img src="https://flb-assets.s3.ap-southeast-1.amazonaws.com/github/dark-light-layered-screenshots.png" alt="Fleetbase Console" width="600" style="max-width: 100%;" />
</p>
<img src="https://github.com/fleetbase/fleetbase/assets/816371/deef79fa-e30c-4ce9-8a04-0dee990ffd9d" alt="Fleetbase Console" width="600" style="max-width: 100%;" />
</p>
<div align="center">
<a href="https://www.producthunt.com/posts/fleetbase-alpha" target="_producthunt">🚀 We've just announced our Alpha release on Product Hunt! 🚀</a>
<p>Check Fleetbase out on ProductHunt, and support with a Upvote!</p>
<a href="https://www.producthunt.com/posts/fleetbase-alpha?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-fleetbase&#0045;alpha" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=399731&theme=light" alt="Fleetbase&#0032;&#0040;Alpha&#0041; - The&#0032;open&#0032;source&#0032;OnFleet&#0032;alternative | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
</div>
# 📖 Table of contents
@@ -41,6 +52,7 @@ Every individual extension within Fleetbase is purposefully engineered to fulfil
- [Installation](#-installation)
- [Extensions](#-extensions)
- [Apps](#-apps)
- [Roadmap](#-roadmap)
- [Bugs and Feature Requests](#-bugs-and--feature-requests)
- [Documentation](#-documentation)
- [Contributing](#-contributing)
@@ -54,10 +66,10 @@ Fleetbase is more than just a platform; it's a versatile ecosystem carefully arc
<ul>
<li>
<strong>Console</strong>: Fleetbase's frontend console is constructed using Ember.js and Ember Engines, providing a highly modular and extensible design. This not only enables the system to adapt and scale to your growing requirements but also simplifies the process of integrating new extensions. With the console's design, extensions can be easily installed using their respective package managers, thereby reducing complexity and time spent on integration.
<strong>Console</strong>: Fleetbase's frontend console is built with Ember.js and Ember Engines, offering a modular and extensible design. This design allows the system to easily adapt and scale according to your evolving needs while simplifying the integration of new extensions. By leveraging the console's design, extensions can be seamlessly installed using their respective package managers, reducing complexity and integration time.
</li>
<li>
<strong>Fleetbase API</strong>: Fleetbase's backend API and framework, developed using the reliable Laravel framework, is thoughtfully designed with extension development and integration in mind. This robust and flexible infrastructure not only manages intricate data structures and transactions with grace but also facilitates the easy incorporation of new extensions via package managers. We provide additional packages that allow developers to craft their unique extensions, further enhancing the flexibility and extensibility of the Fleetbase ecosystem.
<strong>Fleetbase API</strong>: Fleetbase's backend API and framework are built with Laravel, providing a robust and flexible infrastructure for extension development and integration. The system efficiently manages complex data structures and transactions while seamlessly incorporating new extensions through package managers. We offer additional packages for developers to create custom extensions, enhancing the flexibility and extensibility of the Fleetbase ecosystem.
</li>
<li>
<strong>Extensions</strong>: Fleetbase is designed to provide immediate utility out-of-the-box. It comes pre-installed with several key extensions
@@ -161,12 +173,16 @@ Getting Fleetbase up and running on your system using Docker and Docker-compose
</li>
<li>
Clone the Fleetbase repository to your local machine:
<pre>bash git clone https://github.com/fleetbase/fleetbase.git</pre>
<pre>git clone git@github.com:fleetbase/fleetbase.git</pre>
</li>
<li>
Navigate to the cloned repository:
<pre>cd fleetbase</pre>
</li>
<li>
Initialize and pull submodules:
<pre>git submodule update --init --recursive</pre>
</li>
</ul>
### Build and Run Fleetbase
@@ -175,7 +191,7 @@ Getting Fleetbase up and running on your system using Docker and Docker-compose
<li>
<strong>Start the Docker daemon:</strong>
Ensure the Docker daemon is running on your machine. You can either start Docker Desktop or either executed by running:
<pre>sudo systemctl start docker</pre>
<pre>service docker start</pre>
</li>
<li>
<strong>Build the Docker containers:</strong>
@@ -184,6 +200,36 @@ Use Docker Compose to build and run the necessary containers. In the root direct
</li>
</ol>
### Additional Steps
<ol>
<li>Fleetbase will try to find the current hostname or public IP address to whitelist in for CORS, but if this fails you will need to manually add your hostname or instance URL to <code>api/config/cors.php</code> in the <code>allowed_origins</code> array. This will whitelist the console for CORS access to your instance backend.
</li>
<li>🛣 Routing! By default Fleetbase currently will use it's own routing engine which is hosted at <a href="https://routing.fleetbase.io" target="_fleetbase_routing_machine">https://routing.fleetbase.io</a>, this routing engine only works for a few enabled countries which include USA, Canada, Belgium, Spain, Serbia, Taiwan, Malaysia, Singapore, Brunei, Mongolia, India, Ghana. We can enable more regions and countries upon request. There is a Roadmap item to allow users to easily change to any routing engine provider such as Mapbox, Google Maps, and other 3rd Party Routing services. Optionally, you can switch out Fleetase Routing engine with any OSRM compatible service such as OpenStreetMap by changing the console environment variable <code>OSRM_HOST</code> which can be found in <code>console/environments/*.env</code>.
</li>
<li>If you find any bugs or unexpected issues please <a href="https://github.com/fleetbase/fleetbase/issues/new/choose">post an issue</a> to the repo or join our <a href="https://discord.gg/V7RVWRQ2Wm" target="_discord" alt="Fleetbase Discord">Discord</a>.
</li>
</ol>
### Troubleshoot
Have an issue with the installation, try a few of these workarounds.
<ul>
<li><strong>Installer not working?</strong> <br>If you encounter issues with the web based installer use this workaround to get going.
<ol>
<li>Login to the application container.
<pre class="bash">docker exec -ti fleetbase-application-1 bash</pre>
</li>
<li>Manually run the database setup and migrations.
<pre class="bash">php artisan mysql:createdb
php artisan migrate:refresh --seed</pre>
</li>
<li>After completing these steps you should be able to proceed with account creation.</li>
</ol>
</li>
</ul>
### Access Fleetbase
Now that Fleetbase is up and running via Docker you can find the console and the API accessible:
@@ -202,18 +248,18 @@ Fleetbase Extensions are built using both a backend PHP package and a frontend E
### How do Extensions Work?
<ul>
<li><strong>Backend</strong>: The backend of an extension is developed as a PHP package. This package should utilize the composer package `fleetbase/core-api`, which provides core API functionalities, making it easier to integrate your extension with Fleetbase's backend.</li>
<li><strong>Backend</strong>: The backend of an extension is developed as a PHP package. This package should utilize the composer package <code>fleetbase/core-api</code>, which provides core API functionalities, making it easier to integrate your extension with Fleetbase's backend.</li>
<li><strong>Engine</strong>: The frontend of an extension is built as an Ember Engine Addon. The Addon must require the packages `@fleetbase/ember-core` and `@fleetbase/ember-ui`. The `@fleetbase/ember-core` package provides core services and utilities that help to align your extension with Fleetbase's frontend. The `@fleetbase/ember-ui` package, on the other hand, supplies all the stylesheets, components, and template helpers needed to design a Fleetbase extension that seamlessly matches the look and feel of the Fleetbase UI.</li>
<li><strong>Engine</strong>: The frontend of an extension is built as an Ember Engine Addon. The Addon must require the packages <code>@fleetbase/ember-core</code> and <code>@fleetbase/ember-ui</code>. The <code>@fleetbase/ember-core</code> package provides core services and utilities that help to align your extension with Fleetbase's frontend. The <code>@fleetbase/ember-ui</code> package, on the other hand, supplies all the stylesheets, components, and template helpers needed to design a Fleetbase extension that seamlessly matches the look and feel of the Fleetbase UI.</li>
</ul>
### Building a Fleetbase Extension
To create a Fleetbase extension, follow these steps:
<ul>
<li><strong>Backend PHP Package Creation</strong>: Begin by creating a backend PHP package. Make sure to use the composer package `fleetbase/core-api` to ensure smooth integration with Fleetbase's backend.</li>
<li><strong>Backend PHP Package Creation</strong>: Begin by creating a backend PHP package. Make sure to use the composer package <code>fleetbase/core-api</code> to ensure smooth integration with Fleetbase's backend.</li>
<li><strong>Frontend Ember Engine Addon</strong>: Next, you need to create the frontend of the extension using Ember Engine. Be sure to include the `@fleetbase/ember-core` and `@fleetbase/ember-ui` packages. These packages provide necessary services, utilities, and design components for aligning your extension with Fleetbase's UI.</li>
<li><strong>Frontend Ember Engine Addon</strong>: Next, you need to create the frontend of the extension using Ember Engine. Be sure to include the <code>@fleetbase/ember-core</code> and <code>@fleetbase/ember-ui</code> packages. These packages provide necessary services, utilities, and design components for aligning your extension with Fleetbase's UI.</li>
<li><strong>Integrate Your Extension</strong>: Once you have the backend and frontend ready, you can integrate your extension into Fleetbase by installing it via the respective package managers. In the future you will be able to publish your extension to the Fleetbase extensions repository making it available to all instances of Fleetbase with the ability to even sell your extension.</li>
</ul>
@@ -232,8 +278,10 @@ Fleetbase offers a few open sourced apps which are built on Fleetbase which can
# 🛣 Roadmap
<ol>
<li>Install Flow & System Configuration from Console</li>
<li>Open Source Extension Repository</li>
<li>🌎 Internationalize</li>
<li>Multiple and Custom Routing Engine's in FleetOps</li>
<li>Identity & Access Management (IAM) Extension</li>
<li>Inventory and Warehouse Management Extension</li>
<li>Freight Forwarder Quote Parser/ System Extension</li>
</ol>
@@ -248,11 +296,11 @@ View and contribute to our <a href="https://github.com/fleetbase/guides">Fleetba
# 👨‍💻 Contributing
Please read through our <a href="https://github.com/fleetbase/fleetbase/blob/main/.github/CONTRIBUTING.md">contributing guidelines</a>. Included are directions for opening issues, coding standards, and notes on development.
Please read through our <a href="https://github.com/fleetbase/fleetbase/blob/main/CONTRIBUTING.md">contributing guidelines</a>. Included are directions for opening issues, coding standards, and notes on development.
# 👥 Community
Get updates on Fleetbase's development and chat with the project maintainers and community members.
Get updates on Fleetbase's development and chat with the project maintainers and community members by joining our <a href="https://discord.gg/V7RVWRQ2Wm">Discord</a>.
<ul>
<li>Follow <a href="https://twitter.com/fleetbase_io">@fleetbase_io on Twitter</a>.</li>

39
SECURITY.md Normal file
View File

@@ -0,0 +1,39 @@
Contact: hello@fleetbase.io
Based on: https://supabase.com/.well-known/security.txt
At Fleetbase, we consider the security of our systems a top priority. But no matter how much effort we put into system security, there can still be vulnerabilities present.
If you discover a vulnerability, we would like to know about it so we can take steps to address it as quickly as possible. We would like to ask you to help us better protect our clients and our systems.
Out of scope vulnerabilities:
- Clickjacking on pages with no sensitive actions.
- Unauthenticated/logout/login CSRF.
- Attacks requiring MITM or physical access to a user's device.
- Any activity that could lead to the disruption of our service (DoS).
- Content spoofing and text injection issues without showing an attack vector/without being able to modify HTML/CSS.
- Email spoofing
- Missing DNSSEC, CAA, CSP headers
- Lack of Secure or HTTP only flag on non-sensitive cookies
- Deadlinks
Please do the following:
- E-mail your findings to hello@fleetbase.io.
- Do not run automated scanners on our infrastructure or dashboard. If you wish to do this, contact us and we will set up a sandbox for you.
- Do not take advantage of the vulnerability or problem you have discovered, for example by downloading more data than necessary to demonstrate the vulnerability or deleting or modifying other people's data,
- Do not reveal the problem to others until it has been resolved,
- Do not use attacks on physical security, social engineering, distributed denial of service, spam or applications of third parties, and
- Do provide sufficient information to reproduce the problem, so we will be able to resolve it as quickly as possible. Usually, the IP address or the URL of the affected system and a description of the vulnerability will be sufficient, but complex vulnerabilities may require further explanation.
What we promise:
- We will respond to your report within 3 business days with our evaluation of the report and an expected resolution date,
- If you have followed the instructions above, we will not take any legal action against you in regard to the report,
- We will handle your report with strict confidentiality, and not pass on your personal details to third parties without your permission,
- We will keep you informed of the progress towards resolving the problem,
- In the public information concerning the problem reported, we will give your name as the discoverer of the problem (unless you desire otherwise), and
We strive to resolve all problems as quickly as possible, and we would like to play an active role in the ultimate publication on the problem after it is resolved.

1
api/.gitignore vendored
View File

@@ -13,3 +13,4 @@ npm-debug.log
yarn-error.log
/.idea
/.vscode
.composer.dev.json

View File

@@ -1,64 +0,0 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>
<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
### Premium Partners
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[OP.GG](https://op.gg)**
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
- **[Lendio](https://lendio.com)**
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

View File

@@ -2,20 +2,10 @@
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
use Fleetbase\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array<int, class-string<Throwable>>
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
@@ -26,16 +16,4 @@ class Handler extends ExceptionHandler
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {
//
});
}
}

View File

@@ -14,8 +14,6 @@ class Authenticate extends Middleware
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
return response()->error('Unauthenticated.');
}
}

View File

@@ -2,22 +2,26 @@
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"fleetbase/core-api": "^1.0.1-alpha",
"fleetbase/fleetops-api": "^1.0.1-alpha",
"fleetbase/storefront-api": "^1.0.1-alpha",
"fleetbase/core-api": "^1.3.2",
"fleetbase/fleetops-api": "^0.3.5",
"fleetbase/storefront-api": "^0.2.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.75",
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5",
"league/flysystem-aws-s3-v3": "^1.0",
"maatwebsite/excel": "^3.1",
"phpoffice/phpspreadsheet": "^1.28",
"psr/http-factory-implementation": "*",
"textalk/websocket": "^1.6"
"predis/predis": "^2.1",
"psr/http-factory-implementation": "*"
},
"require-dev": {
"facade/ignition": "^2.5",

2300
api/composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -165,7 +165,7 @@ return [
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/

View File

@@ -15,7 +15,7 @@ return [
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
'default' => env('BROADCAST_DRIVER', 'socketcluster'),
/*
|--------------------------------------------------------------------------

View File

@@ -15,7 +15,7 @@ return [
|
*/
'default' => env('CACHE_DRIVER', 'file'),
'default' => env('CACHE_DRIVER', 'redis'),
/*
|--------------------------------------------------------------------------

View File

@@ -19,7 +19,7 @@ return [
'allowed_methods' => ['*'],
'allowed_origins' => ['http://localhost:4200'],
'allowed_origins' => ['http://localhost:4200', env('CONSOLE_HOST')],
'allowed_origins_patterns' => [],

View File

@@ -39,24 +39,15 @@ return [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
'uploads' => [
'driver' => 'local',
'root' => storage_path('app/uploads'),
'url' => env('APP_URL').'/uploads',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'region' => env('AWS_DEFAULT_REGION', 'ap-southeast-1'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
],

View File

@@ -1,5 +1,6 @@
<?php
use Monolog\Formatter\JsonFormatter;
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
@@ -89,12 +90,21 @@ return [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'formatter' => JsonFormatter::class,
'with' => [
'stream' => 'php://stderr',
],
],
'stdout' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'formatter' => JsonFormatter::class,
'with' => [
'stream' => 'php://stdout',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),

View File

@@ -50,7 +50,6 @@ return [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'version' => '2010-12-01'
],
'mailgun' => [
@@ -96,8 +95,8 @@ return [
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
'address' => env('MAIL_FROM_ADDRESS', 'hello@fleetbase.io'),
'name' => env('MAIL_FROM_NAME', 'Fleetbase'),
],
/*

View File

@@ -13,7 +13,7 @@ return [
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
'default' => env('QUEUE_CONNECTION', 'redis'),
/*
|--------------------------------------------------------------------------

16
api/deploy.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
# Exit the script as soon as a command fails
set -e
# Create mysql databases if none exists
php artisan mysql:createdb
# Run migrations
php artisan migrate --force
# Run migrations for sandbox too
php artisan sandbox:migrate --force
# Seed database
php artisan fleetbase:seed

Submodule console deleted from ed54e50dfa

25
console/.dockerignore Normal file
View File

@@ -0,0 +1,25 @@
# Ignore files not needed for docker to build microservice image
node_modules/*
postgres/*
typings/*
*/.git*
*.git*
*.git
*.md
!gulpfile.js
ci/
.circleci/
Vagrantfile
concourse/
infra/*
vagrant/*
docker/*
deploy/*
media/*
data/*
appspec.yml
compose.yml
docker-compose-prod.yml
docker-compose.yml
$virtualenv.tar.gz
$node_modules.tar.gz

19
console/.editorconfig Normal file
View File

@@ -0,0 +1,19 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
[*.hbs]
insert_final_newline = false
[*.{diff,md}]
trim_trailing_whitespace = false

15
console/.ember-cli Normal file
View File

@@ -0,0 +1,15 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.
Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false,
/**
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
*/
"isTypeScriptProject": false
}

25
console/.eslintignore Normal file
View File

@@ -0,0 +1,25 @@
# unconventional js
/blueprints/*/files/
/vendor/
# compiled output
/dist/
/tmp/
# dependencies
/bower_components/
/node_modules/
# misc
/coverage/
!.*
.*/
.eslintcache
# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try

82
console/.eslintrc.js Normal file
View File

@@ -0,0 +1,82 @@
'use strict';
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
},
},
plugins: ['ember'],
extends: ['eslint:recommended', 'plugin:ember/recommended', 'plugin:prettier/recommended'],
ignorePatterns: ['prebuild.js'],
env: {
browser: true,
},
globals: {
socketClusterClient: 'readonly',
L: 'readonly',
module: 'readonly',
require: 'readonly',
},
rules: {
'ember/no-array-prototype-extensions': 'off',
'ember/no-computed-properties-in-native-classes': 'off',
'ember/no-controller-access-in-routes': 'off',
'ember/no-empty-glimmer-component-classes': 'off',
'ember/no-get': 'off',
'ember/classic-decorator-no-classic-methods': 'off',
'node/no-unpublished-require': [
'error',
{
allowModules: [
'ember-cli',
'tailwindcss',
'@tailwindcss/forms',
'postcss-import',
'postcss-preset-env',
'postcss-each',
'postcss-mixins',
'postcss-conditionals-renewed',
'autoprefixer',
'broccoli-funnel',
'ember-auto-import',
],
},
],
'no-prototype-builtins': 'off',
},
overrides: [
// node files
{
files: [
'./.eslintrc.js',
'./.prettierrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./index.js',
'./testem.js',
'./blueprints/*/index.js',
'./config/**/*.js',
'./tests/dummy/config/**/*.js',
],
parserOptions: {
sourceType: 'script',
},
env: {
browser: false,
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
},
{
// test files
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
},
],
};

60
console/.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,60 @@
name: Ember CI
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x] # Build on Node.js 16
steps:
- uses: actions/checkout@v2
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Setup pnpm
uses: pnpm/action-setup@v2.0.1
with:
version: latest
- name: Get pnpm Store Directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm Cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Create .npmrc
run: |
if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then
echo "@fleetbase:registry=https://npm.pkg.github.com/" > .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets._GITHUB_AUTH_TOKEN }}" >> .npmrc
fi
- name: Install Dependencies
run: pnpm install
- name: Lint
run: pnpm run lint
- name: Build
run: npx ember build --environment production

34
console/.gitignore vendored Normal file
View File

@@ -0,0 +1,34 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist/
/tmp/
# dependencies
/bower_components/
/node_modules/
# misc
/.env*
/environments/.env*
/.pnp*
/.sass-cache
/.eslintcache
/connect.lock
/coverage/
/libpeerconnection.log
/npm-debug.log*
/testem.log
/yarn-error.log
/.npmrc
# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
# broccoli-debug
/DEBUG/

25
console/.prettierignore Normal file
View File

@@ -0,0 +1,25 @@
# unconventional js
/blueprints/*/files/
/vendor/
# compiled output
/dist/
/tmp/
# dependencies
/bower_components/
/node_modules/
# misc
/coverage/
!.*
.eslintcache
.lint-todo/
# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try

17
console/.prettierrc.js Normal file
View File

@@ -0,0 +1,17 @@
'use strict';
module.exports = {
trailingComma: 'es5',
tabWidth: 4,
semi: true,
singleQuote: true,
printWidth: 190,
overrides: [
{
files: '*.hbs',
options: {
singleQuote: false,
},
},
],
};

View File

@@ -0,0 +1,14 @@
'use strict';
module.exports = {
extends: 'recommended',
rules: {
'no-bare-strings': 'off',
'no-invalid-interactive': 'off',
'no-yield-only': 'off',
'no-down-event-binding': 'off',
'table-groups': 'off',
'link-href-attributes': 'off',
'require-input-label': 'off',
},
};

3
console/.watchmanconfig Normal file
View File

@@ -0,0 +1,3 @@
{
"ignore_dirs": ["tmp", "dist"]
}

51
console/Dockerfile Normal file
View File

@@ -0,0 +1,51 @@
# ---- Build Stage ----
FROM node:16.20-alpine AS builder
# Set the working directory in the container to /app
WORKDIR /app
# Create the pnpm directory and set the PNPM_HOME environment variable
RUN mkdir -p ~/.pnpm
ENV PNPM_HOME /root/.pnpm
# Add the pnpm global bin to the PATH
ENV PATH /root/.pnpm/bin:$PATH
# Copy pnpm-lock.yaml (or package.json) into the directory /app in the container
COPY console/package.json console/pnpm-lock.yaml ./
# Copy over .npmrc if applicable
COPY console/.npmr[c] ./
# Install global dependencies
RUN npm install -g ember-cli pnpm
# Install git
RUN apk update && apk add git openssh-client
# Trust GitHub's RSA host key
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
# Install app dependencies
RUN pnpm install
# Copy the console directory contents into the container at /app
COPY console .
# Build the application
RUN pnpm build
# ---- Serve Stage ----
FROM nginx:alpine
# Copy the built app to our served directory
COPY --from=builder /app/dist /usr/share/nginx/html
# Expose the port nginx is bound to
EXPOSE 4200
# Use custom nginx.conf
COPY console/nginx.conf /etc/nginx/conf.d/default.conf
# Start Nginx server
CMD ["nginx", "-g", "daemon off;"]

22
console/README.md Normal file
View File

@@ -0,0 +1,22 @@
<div id="hero">
<p align="center" dir="auto">
<a href="https://fleetbase.io" rel="nofollow">
<img src="https://user-images.githubusercontent.com/58805033/191936702-fed04b0f-7966-4041-96d0-95e27bf98248.png" alt="Fleetbase logo" width="600" height="140" style="max-width: 100%;">
</a>
</p>
<h2 align="center" dir="auto">
Fleetbase Console
</h2>
</div>
<p align="center" dir="auto">
<img src="https://user-images.githubusercontent.com/816371/246987420-deef79fa-e30c-4ce9-8a04-0dee990ffd9d.png" alt="Fleetbase Console" width="600" style="max-width: 100%;" />
</p>
# ⭐️ Overview
<p>The Fleetbase Console, a vital component of the Fleetbase Platform, serves as the graphical user interface that facilitates interaction with all Fleetbase extensions. It's architecturally designed to be lightweight, primarily employing Ember Engines for its operational foundation. Ember Engines, a scalable development paradigm for ambitious web applications, allow the Console to dynamically load and manage extensions, ensuring a streamlined and efficient user experience.</p>
<p>The responsibilities of the Console are kept minimalistic to maintain its performance and agility. The Console's key responsibilities encompass administration management, configuration of organization and user settings, and establishing a robust connection to the Fleetbase extensions repository. In its administrative capacity, it provides an intuitive interface for configuring the Fleetbas instance.</p>
<p>Lastly, the Console plays a pivotal role in connecting to the Fleetbase extensions repository. This provides the flexibility to add, update, or remove extensions as per the organizational needs and preferences, all while ensuring the seamless operation and integrity of the Fleetbase Platform.</p>

View File

@@ -0,0 +1 @@
export { default } from '@fleetbase/ember-core/adapters/application';

View File

@@ -0,0 +1,15 @@
import ApplicationAdapter from './application';
export default class BrandAdapter extends ApplicationAdapter {
urlForFindRecord() {
return `${this.host}/${this.namespace}/settings/branding`;
}
urlForUpdateRecord() {
return `${this.host}/${this.namespace}/settings/branding`;
}
urlForCreateRecord() {
return `${this.host}/${this.namespace}/settings/branding`;
}
}

23
console/app/app.js Normal file
View File

@@ -0,0 +1,23 @@
import Application from '@ember/application';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from '@fleetbase/console/config/environment';
import loadExtensions from '@fleetbase/ember-core/utils/load-extensions';
import mapEngines from '@fleetbase/ember-core/utils/map-engines';
export default class App extends Application {
modulePrefix = config.modulePrefix;
podModulePrefix = config.podModulePrefix;
Resolver = Resolver;
extensions = [];
engines = {};
async ready() {
const extensions = await loadExtensions();
this.extensions = extensions;
this.engines = mapEngines(extensions);
}
}
loadInitializers(App, config.modulePrefix);

View File

View File

@@ -0,0 +1,21 @@
<ContentPanel @title="Filesystem" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<InputGroup @name="Driver" @helpText="Select the default filesystem driver for Fleetbase to use.">
<Select @options={{this.disks}} @value={{this.driver}} @onSelect={{this.setDriver}} @placeholder="Select filesystem driver" class="w-full" disabled={{this.isLoading}} />
</InputGroup>
{{#if (eq this.driver "s3")}}
<InputGroup @name="S3 Bucket" @value={{this.s3Bucket}} disabled={{this.isLoading}} />
<InputGroup @name="S3 URL" @value={{this.s3Url}} disabled={{this.isLoading}} />
<InputGroup @name="S3 Endpoint" @value={{this.s3Endpoint}} disabled={{this.isLoading}} />
{{/if}}
{{#if this.testResponse}}
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
<FaIcon @icon={{if (eq this.testResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.testResponse.status 'error') 'text-red-200' 'text-green-200'}}" />
<span class="text-xs">{{this.this.testResponse.message}}</span>
</div>
{{/if}}
<Button @wrapperClass="mt-3" @icon="plug" @text="Test Config" @onClick={{this.test}} @isLoading={{this.isLoading}} />
</ContentPanel>
<EmberWormhole @to="next-view-section-subheader-actions">
<Button @type="primary" @size="sm" @icon="save" @text="Save Changes" @onClick={{this.save}} @disabled={{this.isLoading}} @isLoading={{this.isLoading}} />
</EmberWormhole>

View File

@@ -0,0 +1,85 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class ConfigureFilesystemComponent extends Component {
@service fetch;
@service notifications;
@tracked isLoading = false;
@tracked testResponse;
@tracked disks = [];
@tracked driver = 'local';
@tracked s3Bucket = null;
@tracked s3Url = null;
@tracked s3Endpoint = null;
/**
* Creates an instance of ConfigureFilesystemComponent.
* @memberof ConfigureFilesystemComponent
*/
constructor() {
super(...arguments);
this.loadConfigValues();
}
@action setConfigValues(config) {
for (const key in config) {
if (this[key] !== undefined) {
this[key] = config[key];
}
}
}
@action setDriver(driver) {
this.driver = driver;
}
@action loadConfigValues() {
this.isLoading = true;
this.fetch
.get('settings/filesystem-config')
.then((response) => {
this.setConfigValues(response);
})
.finally(() => {
this.isLoading = false;
});
}
@action save() {
this.isLoading = true;
this.fetch
.post('settings/filesystem-config', {
driver: this.driver,
s3: {
bucket: this.s3Bucket,
url: this.s3Url,
endpoint: this.s3Endpoint,
},
})
.then(() => {
this.notifications.success('Filesystem configuration saved.');
})
.finally(() => {
this.isLoading = false;
});
}
@action test() {
this.isLoading = true;
this.fetch
.post('settings/test-filesystem-config', {
disk: this.driver,
})
.then((response) => {
this.testResponse = response;
})
.finally(() => {
this.isLoading = false;
});
}
}

View File

@@ -0,0 +1,27 @@
<ContentPanel @title="Mail" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<InputGroup @name="Mailer" @helpText="Select the default mailer for Fleetbase to use.">
<Select @options={{this.mailers}} @value={{this.mailer}} @onSelect={{this.setMailer}} @placeholder="Select mailer" class="w-full" />
</InputGroup>
{{#if (eq this.mailer "smtp")}}
<InputGroup @name="SMTP Host" @value={{this.smtpHost}} disabled={{this.isLoading}} />
<InputGroup @name="SMTP Port" @type="number" @value={{this.smtpPort}} disabled={{this.isLoading}} />
<InputGroup @name="SMTP Encryption" @value={{this.smtpEncryption}} disabled={{this.isLoading}} />
<InputGroup @name="SMTP Username" @value={{this.smtpUsername}} disabled={{this.isLoading}} />
<InputGroup @name="SMTP Password" @type="password" @value={{this.smtpPassword}} disabled={{this.isLoading}} />
<InputGroup @name="SMTP Timeout" @value={{this.smtpTimeout}} disabled={{this.isLoading}} />
<InputGroup @name="SMTP Auth Mode" @value={{this.smtpAuth_mode}} disabled={{this.isLoading}} />
{{/if}}
<InputGroup @name="From Address" @helpText="Input the email address for Fleetbase to send emails from." @value={{this.fromAddress}} @placeholder="From Address" disabled={{this.isLoading}} />
<InputGroup @name="From Name" @helpText="Input the name for Fleetbase to send emails from." @value={{this.fromName}} @placeholder="From Name" disabled={{this.isLoading}} />
{{#if this.testResponse}}
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
<FaIcon @icon={{if (eq this.testResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.testResponse.status 'error') 'text-red-200' 'text-green-200'}}" />
<span class="text-xs">{{this.this.testResponse.message}}</span>
</div>
{{/if}}
<Button @wrapperClass="mt-3" @icon="plug" @text="Test Config" @onClick={{this.test}} @isLoading={{this.isLoading}} />
</ContentPanel>
<EmberWormhole @to="next-view-section-subheader-actions">
<Button @type="primary" @size="sm" @icon="save" @text="Save Changes" @onClick={{this.save}} @disabled={{this.isLoading}} @isLoading={{this.isLoading}} />
</EmberWormhole>

View File

@@ -0,0 +1,108 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class ConfigureMailComponent extends Component {
@service fetch;
@service notifications;
@tracked isLoading = false;
@tracked testResponse;
@tracked mailers = [];
@tracked mailer = 'smtp';
@tracked fromAddress = null;
@tracked fromName = null;
@tracked smtpHost = 'smtp.mailgun.org';
@tracked smtpPort = 587;
@tracked smtpEncryption = 'tls';
@tracked smtpUsername = null;
@tracked smtpPassword = null;
@tracked smtpTimeout = null;
@tracked smtpAuth_mode = null;
/**
* Creates an instance of ConfigureFilesystemComponent.
* @memberof ConfigureFilesystemComponent
*/
constructor() {
super(...arguments);
this.loadConfigValues();
}
@action setConfigValues(config) {
for (const key in config) {
if (this[key] !== undefined) {
this[key] = config[key];
}
}
}
@action setMailer(mailer) {
this.mailer = mailer;
}
@action serializeSmtpConfig() {
return {
host: this.smtpHost,
port: this.smtpPort,
encryption: this.smtpEncryption,
username: this.smtpUsername,
password: this.smtpPassword,
timeout: this.smtpTimeout,
auth_mode: this.smtpAuth_mode,
};
}
@action loadConfigValues() {
this.isLoading = true;
this.fetch
.get('settings/mail-config')
.then((response) => {
this.setConfigValues(response);
})
.finally(() => {
this.isLoading = false;
});
}
@action test() {
this.isLoading = true;
this.fetch
.post('settings/test-mail-config', {
mailer: this.mailer,
from: {
address: this.fromAddress,
name: this.fromName,
},
smtp: this.serializeSmtpConfig(),
})
.then((response) => {
this.testResponse = response;
})
.finally(() => {
this.isLoading = false;
});
}
@action save() {
this.isLoading = true;
this.fetch
.post('settings/mail-config', {
mailer: this.mailer,
from: {
address: this.fromAddress,
name: this.fromName,
},
smtp: this.serializeSmtpConfig(),
})
.then(() => {
this.notifications.success('Mail configuration saved.');
})
.finally(() => {
this.isLoading = false;
});
}
}

View File

@@ -0,0 +1,52 @@
<ContentPanel @title="APN Configutation" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<InputGroup @name="APN Key ID" @value={{this.apn.key_id}} disabled={{this.isLoading}} />
<InputGroup @name="APN Team ID" @value={{this.apn.team_id}} disabled={{this.isLoading}} />
<InputGroup @name="APN App Bundle ID" @value={{this.apn.app_bundle_id}} disabled={{this.isLoading}} />
{{!-- <InputGroup @name="APN Private Key" disabled={{this.isLoading}}>
<Textarea class="form-input w-full" @value={{this.apn.private_key_content}} placeholder="APN Private Key" rows="10" disabled={{this.isLoading}} />
</InputGroup> --}}
<InputGroup @wrapperClass="flex flex-row items-center">
<UploadButton @name="apn-key" @accept="text/plain,application/x-pem-file,application/x-pkcs12,application/x-x509-ca-cert,.p12,.pem,.p8" @onFileAdded={{this.uploadApnKey}} @buttonText="Upload P8 Key File" @uploadIcon="upload" class="w-auto m-0i mt-0i" />
{{#if this.apn.private_key_file}}
<div class="ml-2.5 text-sm dark:text-white text-black flex flex-row items-center border border-blue-500 rounded-lg px-2 py-0.5 -mt-1">
<FaIcon @icon="file-text" @size="sm" class="mr-2 dark:text-white text-black" />
<span>{{this.apn.private_key_file.original_filename}}</span>
<a href="javascript:;" class="text-red-500 ml-2" {{on "click" this.removeApnFile}}><FaIcon @icon="times" class="text-red-500" /></a>
</div>
{{/if}}
</InputGroup>
<InputGroup>
<Checkbox @label="APN Production" @value={{this.apn.production}} @onToggle={{fn (mut this.apn.production)}} @disabled={{this.isLoading}} />
</InputGroup>
{{#if this.testResponse}}
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
<FaIcon @icon={{if (eq this.testResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.testResponse.status 'error') 'text-red-200' 'text-green-200'}}" />
<span class="text-xs">{{this.this.testResponse.message}}</span>
</div>
{{/if}}
<div class="mt-3 rounded-lg bg-gray-900 shadow-inner p-3">
<div class="flex flex-col space-y-2">
<div class="flex flex-row items-center">
<div class="text-sm w-40">Title:</div>
<Input @value={{this.testTitle}} placeholder="Push Notification Title" class="form-input flex-1" />
</div>
<div class="flex flex-row items-center">
<div class="text-sm w-40">Message:</div>
<Input @value={{this.testMessage}} placeholder="Push Notification Message" class="form-input flex-1" />
</div>
<div class="flex flex-row items-center">
<div class="text-sm w-40">APN Device Token:</div>
<Input @value={{this.apnToken}} placeholder="APN Device Token" class="form-input flex-1" />
</div>
<div class="flex flex-row items-center">
<div class="text-sm w-40">FCM Device Token:</div>
<Input @value={{this.fcmToken}} placeholder="FCM Device Token" class="form-input flex-1" />
</div>
</div>
<Button @wrapperClass="mt-3" @icon="plug" @text="Test Config" @onClick={{this.test}} @isLoading={{this.isLoading}} />
</div>
</ContentPanel>
<EmberWormhole @to="next-view-section-subheader-actions">
<Button @type="primary" @size="sm" @icon="save" @text="Save Changes" @onClick={{this.save}} @disabled={{this.isLoading}} @isLoading={{this.isLoading}} />
</EmberWormhole>

View File

@@ -0,0 +1,127 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class ConfigureNotificationChannelsComponent extends Component {
@service fetch;
@service notifications;
@service currentUser;
@tracked isLoading = false;
@tracked testResponse;
@tracked testTitle = 'Hello World from Fleetbase 🚀';
@tracked testMessage = 'This is a test push notification!';
@tracked apnToken;
@tracked fcmToken;
@tracked apn = {
key_id: '',
team_id: '',
app_bundle_id: '',
private_key_path: '',
private_key_file_id: '',
private_key_file: null,
production: true,
};
@tracked fcm = {
firebase_credentials_json: '',
firebase_database_url: '',
firebase_project_name: '',
};
constructor() {
super(...arguments);
this.loadConfigValues();
}
@action removeApnFile() {
const apnConfig = this.apn;
apnConfig.private_key_file = null;
apnConfig.private_key_file_id = '';
apnConfig.private_key_path = '';
this.apn = apnConfig;
}
@action uploadApnKey(file) {
try {
this.fetch.uploadFile.perform(
file,
{
disk: 'local',
path: `apn`,
subject_uuid: this.currentUser.companyId,
subject_type: `company`,
type: `apn_key`,
},
(uploadedFile) => {
const apnConfig = this.apn;
apnConfig.private_key_file = uploadedFile;
apnConfig.private_key_file_id = uploadedFile.id;
apnConfig.private_key_path = uploadedFile.path;
this.apn = apnConfig;
}
);
} catch (error) {
this.notifications.serverError(error);
}
}
@action setConfigValues(config) {
for (const key in config) {
if (this[key] !== undefined) {
this[key] = config[key];
}
}
}
@action loadConfigValues() {
this.isLoading = true;
this.fetch
.get('settings/notification-channels-config')
.then((response) => {
this.setConfigValues(response);
})
.finally(() => {
this.isLoading = false;
});
}
@action save() {
this.isLoading = true;
const apnConfig = this.apn;
delete apnConfig.private_key_file;
this.fetch
.post('settings/notification-channels-config', {
apn: apnConfig,
})
.then(() => {
this.notifications.success("Notification channel's configuration saved.");
})
.finally(() => {
this.isLoading = false;
});
}
@action test() {
this.isLoading = true;
this.fetch
.post('settings/test-notification-channels-config', {
apn: this.apn,
title: this.testTitle,
message: this.testMessage,
apnToken: this.apnToken,
fcmToken: this.fcmToken,
})
.then((response) => {
this.testResponse = response;
})
.finally(() => {
this.isLoading = false;
});
}
}

View File

@@ -0,0 +1,25 @@
<ContentPanel @title="Queue" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<InputGroup @name="Driver" @helpText="Select the default queue driver for Fleetbase to use.">
<Select @options={{this.connections}} @value={{this.driver}} @onSelect={{this.setDriver}} @placeholder="Select queue driver" disabled={{this.isLoading}} class="w-full" />
</InputGroup>
{{#if (eq this.driver "beanstalkd")}}
<InputGroup @name="Beanstalk Host" @value={{this.beanstalkdHost}} disabled={{this.isLoading}} />
<InputGroup @name="Beanstalk Queue" @value={{this.beanstalkdQueue}} />
{{/if}}
{{#if (eq this.driver "sqs")}}
<InputGroup @name="SQS Prefix" @value={{this.sqsPrefix}} disabled={{this.isLoading}} />
<InputGroup @name="SQS Queue" @value={{this.sqsQueue}} disabled={{this.isLoading}} />
<InputGroup @name="SQS Suffix" @value={{this.sqsSuffix}} disabled={{this.isLoading}} />
{{/if}}
{{#if this.testResponse}}
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
<FaIcon @icon={{if (eq this.testResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.testResponse.status 'error') 'text-red-200' 'text-green-200'}}" />
<span class="text-xs">{{this.this.testResponse.message}}</span>
</div>
{{/if}}
<Button @wrapperClass="mt-3" @icon="plug" @text="Test Config" @onClick={{this.test}} @isLoading={{this.isLoading}} />
</ContentPanel>
<EmberWormhole @to="next-view-section-subheader-actions">
<Button @type="primary" @size="sm" @icon="save" @text="Save Changes" @onClick={{this.save}} @disabled={{this.isLoading}} @isLoading={{this.isLoading}} />
</EmberWormhole>

View File

@@ -0,0 +1,91 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class ConfigureQueueComponent extends Component {
@service fetch;
@service notifications;
@tracked isLoading = false;
@tracked testResponse;
@tracked connections = [];
@tracked driver = 'sync';
@tracked sqsPrefix = null;
@tracked sqsQueue = null;
@tracked sqsSuffix = null;
@tracked beanstalkdHost = 'localhost';
@tracked beanstalkdQueue = 'default';
/**
* Creates an instance of ConfigureQueueComponent.
* @memberof ConfigureQueueComponent
*/
constructor() {
super(...arguments);
this.loadConfigValues();
}
@action setConfigValues(config) {
for (const key in config) {
if (this[key] !== undefined) {
this[key] = config[key];
}
}
}
@action setDriver(driver) {
this.driver = driver;
}
@action loadConfigValues() {
this.isLoading = true;
this.fetch
.get('settings/queue-config')
.then((response) => {
this.setConfigValues(response);
})
.finally(() => {
this.isLoading = false;
});
}
@action save() {
this.isLoading = true;
this.fetch
.post('settings/queue-config', {
driver: this.driver,
sqs: {
prefix: this.sqsPrefix,
queue: this.sqsQueue,
suffix: this.sqsSuffix,
},
beanstalkd: {
host: this.beanstalkdHost,
queue: this.beanstalkdQueue,
},
})
.then(() => {
this.notifications.success('Queue configuration saved.');
})
.finally(() => {
this.isLoading = false;
});
}
@action test() {
this.isLoading = true;
this.fetch
.post('settings/test-queue-config', {
queue: this.driver,
})
.then((response) => {
this.testResponse = response;
})
.finally(() => {
this.isLoading = false;
});
}
}

View File

@@ -0,0 +1,45 @@
<ContentPanel @title="AWS" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<InputGroup @name="AWS Access Key" @value={{this.awsKey}} disabled={{this.isLoading}} />
<InputGroup @name="AWS Access Secret" @value={{this.awsSecret}} disabled={{this.isLoading}} />
<InputGroup @name="AWS Region" @value={{this.awsRegion}} disabled={{this.isLoading}} />
</ContentPanel>
<ContentPanel @title="Google Maps" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<InputGroup @name="Google Maps API Key" @value={{this.googleMapsApiKey}} disabled={{this.isLoading}} />
<InputGroup @name="Google Maps Locale" @value={{this.googleMapsLocale}} disabled={{this.isLoading}} />
</ContentPanel>
<ContentPanel @title="Twilio" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<InputGroup @name="Twilio SID" @value={{this.twilioSid}} disabled={{this.isLoading}} />
<InputGroup @name="Twilio Token" @value={{this.twilioToken}} disabled={{this.isLoading}} />
<InputGroup @name="Twilio From" @value={{this.twilioFrom}} disabled={{this.isLoading}} />
{{#if this.twilioTestResponse}}
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.twilioTestResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
<FaIcon @icon={{if (eq this.twilioTestResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.twilioTestResponse.status 'error') 'text-red-200' 'text-green-200'}}" />
<span class="text-xs">{{this.this.twilioTestResponse.message}}</span>
</div>
{{/if}}
<div class="flex flex-row items-center mt-3">
<Input @value={{this.twilioTestPhone}} @type="tel" placeholder="Send Test SMS Here" class="form-input form-input-sm" />
<Button @wrapperClass="ml-2" @icon="plug" @text="Test Twilio Config" @onClick={{this.testTwilio}} @isLoading={{this.isLoading}} @disabled={{not this.twilioTestPhone}} />
</div>
</ContentPanel>
<ContentPanel @title="Sentry" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<InputGroup @name="Sentry DSN" @value={{this.sentryDsn}} disabled={{this.isLoading}} />
{{#if this.sentryTestResponse}}
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.sentryTestResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
<FaIcon @icon={{if (eq this.sentryTestResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.sentryTestResponse.status 'error') 'text-red-200' 'text-green-200'}}" />
<span class="text-xs">{{this.this.sentryTestResponse.message}}</span>
</div>
{{/if}}
<Button @wrapperClass="mt-3" @icon="plug" @text="Test Sentry Config" @onClick={{this.testSentry}} @isLoading={{this.isLoading}} />
</ContentPanel>
<ContentPanel @title="IP Info" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<InputGroup @name="IP Info API Key" @value={{this.ipinfoApiKey}} disabled={{this.isLoading}} />
</ContentPanel>
<EmberWormhole @to="next-view-section-subheader-actions">
<Button @type="primary" @size="sm" @icon="save" @text="Save Changes" @onClick={{this.save}} @disabled={{this.isLoading}} @isLoading={{this.isLoading}} />
</EmberWormhole>

View File

@@ -0,0 +1,130 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class ConfigureServicesComponent extends Component {
@service fetch;
@service notifications;
@tracked isLoading = false;
/** aws service */
@tracked awsKey = null;
@tracked awsSecret = null;
@tracked awsRegion = null;
/** ipinfo service */
@tracked ipinfoApiKey = null;
/** google maps service */
@tracked googleMapsApiKey = null;
@tracked googleMapsLocale = 'us';
/** twilio service */
@tracked twilioSid = null;
@tracked twilioToken = null;
@tracked twilioFrom = null;
@tracked twilioTestPhone = null;
@tracked twilioTestResponse;
/** sentry service */
@tracked sentryDsn = null;
@tracked sentryTestResponse;
/**
* Creates an instance of ConfigureServicesComponent.
* @memberof ConfigureServicesComponent
*/
constructor() {
super(...arguments);
this.loadConfigValues();
}
@action setConfigValues(config) {
for (const key in config) {
if (this[key] !== undefined) {
this[key] = config[key];
}
}
}
@action loadConfigValues() {
this.isLoading = true;
this.fetch
.get('settings/services-config')
.then((response) => {
this.setConfigValues(response);
})
.finally(() => {
this.isLoading = false;
});
}
@action save() {
this.isLoading = true;
this.fetch
.post('settings/services-config', {
aws: {
key: this.awsKey,
secret: this.awsSecret,
region: this.awsRegion,
},
ipinfo: {
api_key: this.ipinfoApiKey,
},
googleMaps: {
api_key: this.googleMapsApiKey,
locale: this.googleMapsLocale,
},
twilio: {
sid: this.twilioSid,
token: this.twilioToken,
from: this.twilioFrom,
},
sentry: {
dsn: this.sentryDsn,
},
})
.then(() => {
this.notifications.success('Services configuration saved.');
})
.finally(() => {
this.isLoading = false;
});
}
@action testTwilio() {
this.isLoading = true;
this.fetch
.post('settings/test-twilio-config', {
sid: this.twilioSid,
token: this.twilioToken,
from: this.twilioFrom,
phone: this.twilioTestPhone,
})
.then((response) => {
this.twilioTestResponse = response;
})
.finally(() => {
this.isLoading = false;
});
}
@action testSentry() {
this.isLoading = true;
this.fetch
.post('settings/test-sentry-config', {
dsn: this.sentryDsn,
})
.then((response) => {
this.sentryTestResponse = response;
})
.finally(() => {
this.isLoading = false;
});
}
}

View File

@@ -0,0 +1,46 @@
<ContentPanel @title="SocketCluster Connection" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<p class="mb-4">The SocketCluster configuration cannot be changed at this time.</p>
<div id="output" class="font-mono rounded-lg max-h-full px-6 py-4 overflow-y-scroll bg-black shadow-inner dark:shadow-none">
<div class="flex items-center justify-between mb-4">
<div class="block w-1/2 font-mono text-sm font-semibold text-green-300">
Output
</div>
{{#if this.events.length}}
<div class="flex items-center justify-end w-1/2 text-sm text-green-300">
<Spinner @iconClass="green-loader" />
<span class="ml-2 text-sm font-mono">
Awaiting events...
</span>
</div>
{{/if}}
</div>
<div>
{{#each this.events as |event|}}
<div class="mb-3 text-sm font-mono rounded-lg shadow-sm flex flex-row">
<div class="text-{{event.color}}-300 uppercase text-sm font-mono pr-2 flex-shrink-0">
[{{event.time}}]:
</div>
<div class="text-{{event.color}}-300 text-sm font-mono">
{{html-safe event.content}}
</div>
</div>
{{else}}
<div class="flex items-center mt-6 text-green-300">
<Spinner @iconClass="green-loader" />
<span class="ml-2 text-sm font-mono">
Awaiting events...
</span>
</div>
{{/each}}
</div>
</div>
{{#if this.testResponse}}
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
<FaIcon @icon={{if (eq this.testResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.testResponse.status 'error') 'text-red-200' 'text-green-200'}}" />
<span class="text-xs">{{this.this.testResponse.message}}</span>
</div>
{{/if}}
<Button @wrapperClass="mt-3" @icon="plug" @text="Test Socket Connection" @onClick={{this.testSocketConnection}} @isLoading={{this.isLoading}} />
</ContentPanel>

View File

@@ -0,0 +1,165 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { format } from 'date-fns';
export default class ConfigureSocketComponent extends Component {
/**
* Inject the `router` service
*
* @var {Service}
* @memberof ConfigureSocketComponent
*/
@service router;
/**
* Inject the `fetch` service
*
* @var {Service}
* @memberof ConfigureSocketComponent
*/
@service fetch;
/**
* Inject the `notifications` service
*
* @var {Service}
* @memberof ConfigureSocketComponent
*/
@service notifications;
/**
* Inject the `socket` service
*
* @var {Service}
* @memberof ConfigureSocketComponent
*/
@service socket;
/**
* State of the test request.
*
* @memberof ConfigureSocketComponent
*/
@tracked isLoading = null;
/**
* The response form testing the socket.
*
* @memberof ConfigureSocketComponent
*/
@tracked testResponse = null;
/**
* Incoming events logged from test socket channel.
*
* @memberof ConfigureSocketComponent
*/
@tracked events = [];
/**
* Date format to use for socket console events.
*
* @memberof ConfigureSocketComponent
*/
consoleDateFormat = 'MMM-dd HH:mm';
/**
* Creates an instance of ConfigureSocketComponent.
* @memberof ConfigureSocketComponent
*/
constructor() {
super(...arguments);
this.listenToTestSocket();
}
/**
* Send a request to test the socket connection.
*
* @memberof ConfigureSocketComponent
*/
@action testSocketConnection() {
this.isLoading = true;
this.fetch
.post('settings/test-socket', {
channel: 'test',
})
.then((response) => {
this.testResponse = response;
})
.finally(() => {
this.isLoading = false;
});
}
/**
* Opens socket and logs all incoming events.
*
* @memberof ConfigureSocketComponent
*/
@action async listenToTestSocket() {
// Create SocketClusterClient
const socket = this.socket.instance();
// Listen for socket connection errors
(async () => {
// eslint-disable-next-line no-unused-vars
for await (let event of socket.listener('error')) {
// Push an event or notification for socket connection here
this.events.pushObject({
time: format(new Date(), this.consoleDateFormat),
content: 'Socket connection error!',
color: 'red',
});
}
})();
// Listen for socket connection
(async () => {
// eslint-disable-next-line no-unused-vars
for await (let event of socket.listener('connect')) {
// Push an event or notification for socket connection here
this.events.pushObject({
time: format(new Date(), this.consoleDateFormat),
content: 'Socket is connected',
color: 'green',
});
}
})();
// Listed on company channel
const channel = socket.subscribe('test');
// Listen for channel subscription
(async () => {
// eslint-disable-next-line no-unused-vars
for await (let event of channel.listener('subscribe')) {
// Push an event or notification for channel subscription here
this.events.pushObject({
time: format(new Date(), this.consoleDateFormat),
content: `Socket subscribed to test channel`,
color: 'blue',
});
}
})();
// Listen for channel subscription
(async () => {
for await (let data of channel) {
this.events.pushObject({
time: format(new Date(), this.consoleDateFormat),
content: JSON.stringify(data, undefined, 2),
color: 'green',
});
}
})();
// disconnect when transitioning
this.router.on('routeWillChange', () => {
channel.close();
this.events = [];
});
}
}

View File

@@ -0,0 +1,7 @@
<div class="fleetbase-dashboard-grid">
<div class="grid grid-cols-1 md:grid-cols-12 gap-4">
{{#each this.dashboards as |dashboard index|}}
<Dashboard::Create @index={{index}} @dashboard={{dashboard}} />
{{/each}}
</div>
</div>

View File

@@ -0,0 +1,48 @@
import Component from '@glimmer/component';
import loadExtensions from '@fleetbase/ember-core/utils/load-extensions';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { isArray } from '@ember/array';
import { tracked } from '@glimmer/tracking';
import { task } from 'ember-concurrency-decorators';
export default class DashboardComponent extends Component {
@service fetch;
@tracked extensions;
@tracked dashboards = [];
@tracked isLoading;
constructor() {
super(...arguments);
this.loadExtensions();
}
@action async loadExtensions() {
this.extensions = await loadExtensions();
this.loadDashboardBuilds.perform();
}
@task *loadDashboard(extension) {
this.isLoading = extension.extension;
let dashboardBuild;
try {
dashboardBuild = yield this.fetch.get(extension.fleetbase.dashboard, {}, { namespace: '' });
} catch {
return;
}
if (isArray(dashboardBuild)) {
this.dashboards = [...this.dashboards, ...dashboardBuild.map((build) => ({ ...build, extension }))];
}
}
@task({ enqueue: true, maxConcurrency: 1 }) *loadDashboardBuilds() {
const extensionsWithDashboards = this.extensions.filter((extension) => typeof extension.fleetbase?.dashboard === 'string');
for (let i = 0; i < extensionsWithDashboards.length; i++) {
const extension = extensionsWithDashboards[i];
yield this.loadDashboard.perform(extension);
}
}
}

View File

@@ -0,0 +1,6 @@
<div class="dashboard-component-count lg:col-span-2">
<h3 class="text-sm dark:text-gray-100 text-black mb-4">{{@options.title}}</h3>
<h1 class="text-3xl font-bold dark:text-gray-100 text-black mb-4">
{{this.displayValue}}
</h1>
</div>

View File

@@ -0,0 +1,43 @@
import Component from '@glimmer/component';
import { computed } from '@ember/object';
import formatCurrency from '@fleetbase/ember-ui/utils/format-currency';
import formatMeters from '@fleetbase/ember-ui/utils/format-meters';
import formatBytes from '@fleetbase/ember-ui/utils/format-bytes';
import formatDuration from '@fleetbase/ember-ui/utils/format-duration';
import formatDate from '@fleetbase/ember-ui/utils/format-date';
export default class DashboardCountComponent extends Component {
@computed('args.options.{currency,dateFormat,format,value}') get displayValue() {
let format = this.args.options?.format;
let currency = this.args.options?.currency;
let dateFormat = this.args.options?.dateFormat;
let value = this.args.options?.value;
switch (format) {
case 'money':
value = formatCurrency([value, currency]);
break;
case 'meters':
value = formatMeters([value]);
break;
case 'bytes':
value = formatBytes([value]);
break;
case 'duration':
value = formatDuration([value]);
break;
case 'date':
value = formatDate([value, dateFormat]);
break;
default:
break;
}
return value;
}
}

View File

@@ -0,0 +1,18 @@
<div class="col-span-{{or @dashboard.size 12}}">
<div class="dashboard-title flex flex-col lg:flex-row lg:items-center">
<div class="flex flex-row items-center mb-2 lg:mb-0">
{{#if this.isLoading}}
<Spinner class="mr-2i" />
{{/if}}
<h2 class="text-sm font-bold dark:text-gray-100 text-black">{{@dashboard.title}}</h2>
</div>
<div>
<Dashboard::QueryParams @params={{@dashboard.queryParams}} @onChange={{this.onQueryParamsChanged}} />
</div>
</div>
<div class="grid grid-cols-2 lg:grid-cols-12 gap-4">
{{#each this.dashboard.widgets as |widget|}}
{{component (concat "dashboard/" widget.component) options=widget.options}}
{{/each}}
</div>
</div>

View File

@@ -0,0 +1,41 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { isArray } from '@ember/array';
import { task } from 'ember-concurrency-decorators';
export default class DashboardCreateComponent extends Component {
@service fetch;
@tracked isLoading = false;
@tracked dashboard;
constructor() {
super(...arguments);
this.dashboard = this.args.dashboard;
}
@action onQueryParamsChanged(changedParams) {
this.reloadDashboard.perform(changedParams);
}
@task *reloadDashboard(params) {
const { extension } = this.args.dashboard;
const index = this.args.index;
let dashboards = [];
this.isLoading = true;
try {
dashboards = yield this.fetch.get(extension.fleetbase.dashboard, params, { namespace: '' });
} catch {
return;
}
this.isLoading = false;
if (isArray(dashboards)) {
this.dashboard = dashboards.objectAt(index);
}
}
}

View File

@@ -0,0 +1,8 @@
<div class="flex flex-row items-center space-x-3" ...attributes>
{{#each-in @params as |param options|}}
<div class="flex flex-col lg:flex-row lg:items-center">
<label class="hidden lg:flex mr-2 text-sm">{{humanize param}}:</label>
{{component options.component onChange=(fn this.onChange param) placeholder=(humanize param) class="form-input-sm"}}
</div>
{{/each-in}}
</div>

View File

@@ -0,0 +1,21 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class DashboardQueryParamsComponent extends Component {
@tracked changedParams = {};
@action onChange(param, value) {
const component = this.args.params[param].component;
if (component === 'date-picker') {
value = value.formattedDate;
}
this.changedParams = { ...this.changedParams, [param]: value };
if (typeof this.args.onChange === 'function') {
this.args.onChange(this.changedParams);
}
}
}

View File

@@ -0,0 +1,27 @@
<div class="fleetbase-blog" ...attributes>
<div class="border dark:border-gray-700 border-gray-200 dark:bg-gray-800 bg-gray-50 rounded-lg shadow-sm flex flex-col">
<div class="flex flex-row items-center justify-between rounded-t-lg px-4 py-2 border-b border-gray-200 dark:border-gray-700">
<span class="text-base font-bold text-black dark:text-gray-100">Fleetbase Blog</span>
<a href="https://www.fleetbase.io/blog" target="_blog" class="flex flex-row items-center text-sm">
<FaIcon @icon="arrow-up-right-from-square" @size="xs" class="mr-2" />
<span>Visit Blog</span>
</a>
</div>
<div class="px-4 py-2.5">
{{#if this.isLoading}}
<Spinner />
{{else}}
<ul class="space-y-2">
{{#each this.posts as |post|}}
<li class="text-sm flex flex-col lg:flex-row">
<a href={{post.link}} target="_blog" class="text-black truncate max-w-lg dark:text-gray-200">
<span class="truncate">{{post.title}}</span>
</a>
<span class="ml-1 text-gray-900 dark:text-gray-400">- {{post.pubDate}}</span>
</li>
{{/each}}
</ul>
{{/if}}
</div>
</div>
</div>

View File

@@ -0,0 +1,28 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class FleetbaseBlogComponent extends Component {
@service fetch;
@tracked posts = [];
@tracked isLoading = false;
constructor() {
super(...arguments);
this.loadBlogPosts();
}
@action loadBlogPosts() {
this.isLoading = true;
return this.fetch
.get('lookup/fleetbase-blog')
.then((response) => {
this.posts = response;
})
.finally(() => {
this.isLoading = false;
});
}
}

View File

@@ -0,0 +1,49 @@
<div class="fleetbase-github-card relative flex-1 w-full" ...attributes>
<div class="border dark:border-gray-700 border-gray-200 dark:bg-gray-800 bg-gray-50 rounded-lg shadow-sm flex flex-col">
{{#if this.isLoading}}
<div class="p-4">
<Spinner />
</div>
{{else}}
<div class="flex flex-row p-4 border-b dark:border-gray-700 border-gray-200">
<div class="w-12 flex-shrink-0"><img src={{this.data.owner.avatar_url}} alt="fleetbase/fleetbase" class="rounded-full w-8 h-8" width="32" height="32" /></div>
<div class="flex-1 -mt-2">
<div class="flex flex-1 flex-row items-center justify-between mb-2">
<a href={{this.data.html_url}} target="_github" class="dark:text-gray-100 text-black text-lg font-semibold">{{this.data.full_name}}</a>
<a href={{this.data.html_url}} target="_github" class="btn btn-xs btn-default">
<FaIcon @icon="star" class="text-yellow-400" />
<span class="hidden lg:flex ml-2.5">Star on Github</span>
</a>
</div>
<p class="dark:text-gray-100 text-black text-sm">{{this.data.description}}</p>
<div class="flex-grow-0 flex mt-2">
<a href={{this.releaseUrl}} class="rounded-lg px-2 py-1 flex flex-row items-center text-xs text-white font-bold font-mono">
<FaIcon @icon="arrow-up-right-from-square" @size="xs" class="mr-2" />
<span>Latest Release: {{this.latestRelease.name}}</span>
</a>
</div>
</div>
</div>
<div class="rounded-b-lg px-4 py-2">
<div class="grid grid-cols-12 gap-2">
<div class="col-span-3 dark:text-gray-100 text-black text-xs flex flex-row">
<span class="font-bold mr-1">{{this.data.stargazers_count}}</span>
<span>Stars</span>
</div>
<div class="col-span-3 dark:text-gray-100 text-black text-xs flex flex-row">
<span class="font-bold mr-1">{{this.data.subscribers_count}}</span>
<span>Watchers</span>
</div>
<div class="col-span-3 dark:text-gray-100 text-black text-xs flex flex-row">
<span class="font-bold mr-1">{{this.data.forks_count}}</span>
<span>Forks</span>
</div>
<div class="col-span-3 dark:text-gray-100 text-black text-xs flex flex-row">
<span class="font-bold mr-1">{{this.data.open_issues_count}}</span>
<span><span class="hidden lg:inline-flex">Open</span> Issues</span>
</div>
</div>
</div>
{{/if}}
</div>
</div>

View File

@@ -0,0 +1,58 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action, computed } from '@ember/object';
import { isArray } from '@ember/array';
import { isBlank } from '@ember/utils';
import fetch from 'fetch';
export default class GithubCardComponent extends Component {
@tracked data;
@tracked tags;
@tracked isLoading = false;
@computed('tags.length') get latestRelease() {
if (isArray(this.tags) && this.tags.length) {
return this.tags[0];
}
return { name: 'v0.0.1' };
}
@computed('data.releases_url', 'latestRelease.name') get releaseUrl() {
let url = 'https://github.com/fleetbase/fleetbase/releases';
if (!isBlank(this.latestRelease?.name)) {
url += '/tag/' + this.latestRelease.name;
}
return url;
}
constructor() {
super(...arguments);
this.loadRepositoryData();
this.loadRepositoryTags();
}
@action loadRepositoryData() {
this.isLoading = true;
return fetch('https://api.github.com/repos/fleetbase/fleetbase')
.then((response) => {
return response.json().then((data) => {
this.data = data;
});
})
.finally(() => {
this.isLoading = false;
});
}
@action loadRepositoryTags() {
return fetch('https://api.github.com/repos/fleetbase/fleetbase/tags').then((response) => {
return response.json().then((data) => {
this.tags = data;
});
});
}
}

View File

View File

@@ -0,0 +1,3 @@
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {}

View File

@@ -0,0 +1,68 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class AuthForgotPasswordController extends Controller {
/**
* Inject the `fetch` service
*
* @memberof AuthForgotPasswordController
*/
@service fetch;
/**
* Inject the `notifications` service
*
* @memberof AuthForgotPasswordController
*/
@service notifications;
/**
* The email variable
*
* @memberof AuthForgotPasswordController
*/
@tracked email;
/**
* The loading state
*
* @memberof AuthForgotPasswordController
*/
@tracked isLoading;
/**
* Indicator if request has been sent.
*
* @memberof AuthForgotPasswordController
*/
@tracked isSent = false;
/**
* Sends a secure magic reset link to the user provided email.
*
* @memberof AuthForgotPasswordController
*/
@action sendSecureLink(event) {
// firefox patch
event.preventDefault();
const { email } = this;
this.isLoading = true;
this.fetch
.post('auth/get-magic-reset-link', { email })
.then(() => {
this.notifications.success('Check your email to continue!');
this.isSent = true;
})
.catch((error) => {
this.notifications.serverError(error);
})
.finally(() => {
this.isLoading = false;
});
}
}

View File

@@ -0,0 +1,207 @@
import Controller, { inject as controller } from '@ember/controller';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import pathToRoute from '@fleetbase/ember-core/utils/path-to-route';
export default class AuthLoginController extends Controller {
/**
* Inject the `forgotPassword` controller
*
* @var {Controller}
*/
@controller('auth.forgot-password') forgotPasswordController;
/**
* Inject the `notifications` service
*
* @var {Service}
*/
@service notifications;
/**
* Inject the `urlSearchParams` service
*
* @var {Service}
*/
@service urlSearchParams;
/**
* Inject the `session` service
*
* @var {Service}
*/
@service session;
/**
* Whether or not to remember the users session
*
* @var {Boolean}
*/
@tracked rememberMe = false;
/**
* The identity to authenticate with
*
* @var {String}
*/
@tracked identity = null;
/**
* The password to authenticate with
*
* @var {String}
*/
@tracked password = null;
/**
* Login is validating user input
*
* @var {Boolean}
*/
@tracked isValidating = false;
/**
* Login is processing
*
* @var {Boolean}
*/
@tracked isLoading = false;
/**
* If the connection or requesst it taking too long
*
* @var {Boolean}
*/
@tracked isSlowConnection = false;
/**
* Interval to determine when to timeout the request
*
* @var {Integer}
*/
@tracked timeout = null;
/**
* Number of failed login attempts
*
* @var {Integer}
*/
@tracked failedAttempts = 0;
/**
* Authenticate the user
*
* @void
*/
@action async login(event) {
// firefox patch
event.preventDefault();
// get user credentials
const { email, password, rememberMe } = this;
// start loader
this.set('isLoading', true);
// set where to redirect on login
this.setRedirect();
try {
await this.session.authenticate('authenticator:fleetbase', { email, password }, rememberMe);
} catch (error) {
this.failedAttempts++;
return this.failure(error);
}
if (this.session.isAuthenticated) {
this.success();
}
}
/**
* Transition user to onboarding screen
*/
@action transitionToOnboard() {
return this.transitionToRoute('onboard');
}
/**
* Transition to forgot password screen, if email is set - set it.
*/
@action forgotPassword() {
return this.transitionToRoute('auth.forgot-password').then(() => {
if (this.email) {
this.forgotPasswordController.email = this.email;
}
});
}
/**
* Sets correct route to send user to after login.
*
* @void
*/
setRedirect() {
const shift = this.urlSearchParams.get('shift');
if (shift) {
this.session.setRedirect(pathToRoute(shift));
}
}
/**
* Handles the authentication success
*
* @void
*/
success() {
this.reset('success');
}
/**
* Handles the authentication failure
*
* @param {String} error An error message
* @void
*/
failure(error) {
this.notifications.serverError(error);
this.reset('error');
}
/**
* Handles the request slow connection
*
* @void
*/
slowConnection() {
this.notifications.error('Experiencing connectivity issues.');
}
/**
* Reset the login form
*
* @param {String} type
* @void
*/
reset(type) {
// reset login form state
this.isLoading = false;
this.isSlowConnection = false;
// reset login form state depending on type of reset
switch (type) {
case 'success':
this.identity = null;
this.password = null;
this.isValidating = false;
break;
case 'error':
case 'fail':
this.password = null;
break;
}
// clearTimeout(this.timeout);
}
}

View File

@@ -0,0 +1,77 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class AuthResetPasswordController extends Controller {
/**
* Inject the `fetch` service
*
* @memberof AuthResetPasswordController
*/
@service fetch;
/**
* Inject the `notifications` service
*
* @memberof AuthResetPasswordController
*/
@service notifications;
/**
* The code param.
*
* @memberof AuthResetPasswordController
*/
@tracked code;
/**
* Users new password.
*
* @memberof AuthResetPasswordController
*/
@tracked password;
/**
* Users new password confirmation.
*
* @memberof AuthResetPasswordController
*/
@tracked password_confirmation;
/**
* Loading stae of password reset.
*
* @memberof AuthResetPasswordController
*/
@tracked isLoading;
/**
* The reset password action.
*
* @memberof AuthResetPasswordController
*/
@action resetPassword(event) {
// firefox patch
event.preventDefault();
const { code, password, password_confirmation } = this;
const { id } = this.model;
this.isLoading = true;
this.fetch
.post('auth/reset-password', { link: id, code, password, password_confirmation })
.then(() => {
this.notifications.success('Your password has been reset! Login to continue.');
return this.transitionToRoute('auth.login');
})
.catch((error) => {
this.notifications.serverError(error);
})
.finally(() => {
this.isLoading = false;
});
}
}

View File

@@ -0,0 +1,257 @@
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { getOwner } from '@ember/application';
import { later } from '@ember/runloop';
import { action, computed } from '@ember/object';
import { alias } from '@ember/object/computed';
import { isArray } from '@ember/array';
import first from '@fleetbase/ember-core/utils/first';
export default class ConsoleController extends Controller {
/**
* Inject the `currentUser` service.
*
* @var {Service}
*/
@service currentUser;
/**
* Inject the `modalsManager` service.
*
* @var {Service}
*/
@service modalsManager;
/**
* Inject the `session` service.
*
* @var {Service}
*/
@service session;
/**
* Inject the `fetch` service.
*
* @var {Service}
*/
@service fetch;
/**
* Inject the `notifications` service.
*
* @var {Service}
*/
@service notifications;
/**
* Inject the `router` service.
*
* @var {Service}
*/
@service router;
/**
* Inject the `universe` service.
*
* @var {Service}
*/
@service universe;
/**
* Authenticated user organizations.
*
* @var {Array}
*/
@tracked organizations = [];
/**
* Sidebar Context Controls
*
* @var {SidebarContext}
*/
@tracked sidebarContext;
/**
* Routes which should hide the sidebar menu.
*
* @var {Array}
*/
@tracked hiddenSidebarRoutes = ['console.home', 'console.extensions', 'console.notifications'];
/**
* Installed extensions.
*
* @var {Array}
*/
@computed() get extensions() {
return getOwner(this).application.extensions;
}
/**
* Get the currently authenticated user
*
* @var {Model}
*/
@alias('currentUser.user') user;
/**
* Creates an instance of ConsoleController.
* @memberof ConsoleController
*/
constructor() {
super(...arguments);
this.router.on('routeDidChange', (transition) => {
if (this.sidebarContext) {
if (this.hiddenSidebarRoutes.includes(transition.to.name)) {
this.sidebarContext.hideNow();
} else {
this.sidebarContext.show();
}
}
});
}
/**
* Sets the sidebar context
*
* @param {SidebarContext} sidebarContext
* @memberof ConsoleController
*/
@action setSidebarContext(sidebarContext) {
this.sidebarContext = sidebarContext;
this.universe.sidebarContext = sidebarContext;
if (this.hiddenSidebarRoutes.includes(this.router.currentRouteName)) {
this.sidebarContext.hideNow();
}
}
/**
* Action handler.
*
* @void
*/
@action onAction(action, ...params) {
if (typeof this[action] === 'function') {
this[action](...params);
}
}
/**
* Action to invalidate and log user out
*
* @void
*/
@action invalidateSession(noop, event) {
event.preventDefault();
this.session.invalidateWithLoader();
}
/**
* Action to invalidate and log user out
*
* @void
*/
@action createOrJoinOrg() {
const currency = this.currentUser.currency;
const country = this.currentUser.country;
this.modalsManager.show('modals/create-or-join-org', {
title: 'Create or join a organization',
acceptButtonText: 'Confirm',
acceptButtonIcon: 'check',
acceptButtonIconPrefix: 'fas',
action: 'join',
next: null,
name: null,
decription: null,
phone: null,
currency,
country,
timezone: null,
changeAction: (action) => {
this.modalsManager.setOption('action', action);
},
confirm: (modal) => {
modal.startLoading();
const { action, next, name, description, phone, currency, country, timezone } = modal.getOptions();
if (action === 'join') {
return this.fetch.post('auth/join-organization', { next }).then(() => {
this.fetch.flushRequestCache('auth/organizations');
this.notifications.success('You have joined a new organization!');
setTimeout(() => {
window.location.reload();
}, 900);
});
}
return this.fetch
.post('auth/create-organization', {
name,
description,
phone,
currency,
country,
timezone,
})
.then(() => {
this.fetch.flushRequestCache('auth/organizations');
this.notifications.success('You have created a new organization!');
later(
this,
() => {
window.location.reload();
},
900
);
});
},
});
}
/**
* Confirm prompt for user to switch organization
*
* @void
*/
@action switchOrganization(organization) {
if (isArray(organization)) {
organization = first(organization);
}
this.modalsManager.confirm({
title: `Are you sure you want to switch organization to ${organization.name}?`,
body: `By confirming your account will remain logged in, but your primary organization will be switched.`,
acceptButtonText: `Yes, I want to switch organization`,
acceptButtonScheme: 'primary',
confirm: (modal) => {
modal.startLoading();
return this.fetch
.post('auth/switch-organization', { next: organization.uuid })
.then(() => {
this.fetch.flushRequestCache('auth/organizations');
this.notifications.success('You have switched organizations');
setTimeout(() => {
window.location.reload();
}, 900);
})
.catch((error) => {
this.notifications.serverError(error);
});
},
});
}
@action viewChangelog() {
this.modalsManager.show('modals/changelog', {
title: 'Changelog',
acceptButtonText: 'OK',
hideDeclineButton: true,
});
}
}

View File

@@ -0,0 +1,11 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ConsoleAccountController extends Controller {
/**
* Inject the `universe` service.
*
* @memberof ConsoleAdminController
*/
@service universe;
}

View File

@@ -0,0 +1,92 @@
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { alias } from '@ember/object/computed';
export default class ConsoleAccountIndexController extends Controller {
/**
* Inject the `currentUser` service.
*
* @memberof ConsoleAccountIndexController
*/
@service currentUser;
/**
* Inject the `fetch` service.
*
* @memberof ConsoleAccountIndexController
*/
@service fetch;
/**
* Inject the `notifications` service.
*
* @memberof ConsoleAccountIndexController
*/
@service notifications;
/**
* The loading state of request.
*
* @memberof ConsoleAccountIndexController
*/
@tracked isLoading = false;
/**
* Alias to the currentUser service user record.
*
* @memberof ConsoleAccountIndexController
*/
@alias('currentUser.user') user;
/**
* Handle upload of new photo
*
* @param {UploadFile} file
* @memberof ConsoleAccountIndexController
*/
@action uploadNewPhoto(file) {
return this.fetch.uploadFile.perform(
file,
{
path: `uploads/${this.user.company_uuid}/users/${this.user.slug}`,
key_uuid: this.user.id,
key_type: `user`,
type: `user_avatar`,
},
(uploadedFile) => {
this.user.setProperties({
avatar_uuid: uploadedFile.id,
avatar_url: uploadedFile.url,
});
return this.user.save();
}
);
}
/**
* Save the Profile settings.
*
* @return {Promise}
* @memberof ConsoleAccountIndexController
*/
@action saveProfile() {
const user = this.user;
this.isLoading = true;
return user
.save()
.then((user) => {
this.notifications.success('Profile changes saved.');
this.currentUser.set('user', user);
})
.catch((error) => {
this.notifications.serverError(error);
})
.finally(() => {
this.isLoading = false;
});
}
}

View File

@@ -0,0 +1,11 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ConsoleAdminController extends Controller {
/**
* Inject the `universe` service.
*
* @memberof ConsoleAdminController
*/
@service universe;
}

View File

@@ -0,0 +1,158 @@
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { isArray } from '@ember/array';
export default class ConsoleAdminBrandingController extends Controller {
/**
* Inject the `fetch` service.
*
* @memberof ConsoleAdminBrandingController
*/
@service fetch;
/**
* Inject the `notifications` service.
*
* @memberof ConsoleAdminBrandingController
*/
@service notifications;
/**
* Inject the `theme` service.
*
* @memberof ConsoleAdminBrandingController
*/
@service theme;
/**
* Status of loading process.
*
* @memberof ConsoleAdminBrandingController
*/
@tracked isLoading = false;
/**
* Theme options.
*
* @memberof ConsoleAdminBrandingController
*/
@tracked themeOptions = ['light', 'dark'];
/**
* Set the default theme
*
* @param {String} theme
* @memberof ConsoleAdminBrandingController
*/
@action setTheme(theme) {
this.model.default_theme = theme;
this.theme.setTheme(theme);
}
/**
* Unsets the value of a given key or array of keys on the model.
*
* @action
* @param {string | string[]} key - The key or keys to unset on the model.
* @param {*} [newValue=null] - The new value to set for the given key or keys. Defaults to null.
* @memberof ConsoleAdminBrandingController
*/
@action unset(key, newValue = null) {
if (isArray(key)) {
return key.forEach((k) => this.unset(k, undefined));
}
this.model.set(key, newValue);
}
/**
* Unsets the icon properties on the model.
*
* @action
* @returns {void} - No return value.
* @memberof ConsoleAdminBrandingController
*/
@action unsetIcon() {
this.unset(['icon_uuid', 'icon_url']);
this.model.set('icon_url', '/images/icon.png');
}
/**
* Unsets the logo properties on the model.
*
* @action
* @returns {void} - No return value.
* @memberof ConsoleAdminBrandingController
*/
@action unsetLogo() {
this.unset(['logo_uuid', 'logo_url']);
this.model.set('logo_url', '/images/fleetbase-logo-svg.svg');
}
/**
* Save branding settings.
*
* @return {Promise}
* @memberof ConsoleAdminBrandingController
*/
@action save() {
this.isLoading = true;
return this.model
.save()
.then(() => {
this.notifications.success('Branding settings saved.');
})
.finally(() => {
this.isLoading = false;
});
}
/**
* Handle upload of new console icon
*
* @param {UploadFile} file
* @memberof ConsoleAccountIndexController
*/
@action uploadIcon(file) {
this.isLoading = true;
return this.fetch.uploadFile.perform(
file,
{
path: `uploads/system`,
type: `system`,
},
(uploadedFile) => {
this.model.icon_uuid = uploadedFile.id;
this.model.icon_url = uploadedFile.url;
this.isLoading = false;
}
);
}
/**
* Handle upload of new console logo
*
* @param {UploadFile} file
* @memberof ConsoleAccountIndexController
*/
@action uploadLogo(file) {
this.isLoading = true;
return this.fetch.uploadFile.perform(
file,
{
path: `uploads/system`,
type: `system`,
},
(uploadedFile) => {
this.model.logo_uuid = uploadedFile.id;
this.model.logo_url = uploadedFile.url;
this.isLoading = false;
}
);
}
}

View File

@@ -0,0 +1,3 @@
import Controller from '@ember/controller';
export default class ConsoleAdminConfigCacheController extends Controller {}

View File

@@ -0,0 +1,3 @@
import Controller from '@ember/controller';
export default class ConsoleAdminConfigDatabaseController extends Controller {}

View File

@@ -0,0 +1,3 @@
import Controller from '@ember/controller';
export default class ConsoleAdminConfigFilesystemController extends Controller {}

View File

@@ -0,0 +1,3 @@
import Controller from '@ember/controller';
export default class ConsoleAdminConfigMailController extends Controller {}

View File

@@ -0,0 +1,3 @@
import Controller from '@ember/controller';
export default class ConsoleAdminConfigNotificationChannelsController extends Controller {}

View File

@@ -0,0 +1,3 @@
import Controller from '@ember/controller';
export default class ConsoleAdminConfigQueueController extends Controller {}

View File

@@ -0,0 +1,3 @@
import Controller from '@ember/controller';
export default class ConsoleAdminConfigServicesController extends Controller {}

View File

@@ -0,0 +1,136 @@
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import createNotificationKey from '../../../utils/create-notification-key';
export default class ConsoleAdminNotificationsController extends Controller {
/**
* Inject the notifications service.
*
* @memberof ConsoleAdminNotificationsController
*/
@service notifications;
/**
* Inject the fetch service.
*
* @memberof ConsoleAdminNotificationsController
*/
@service fetch;
/**
* The notification settings value JSON.
*
* @memberof ConsoleAdminNotificationsController
* @var {Object}
*/
@tracked notificationSettings = {};
/**
* Notification transport methods enabled.
*
* @memberof ConsoleAdminNotificationsController
* @var {Array}
*/
@tracked notificationTransportMethods = ['email', 'sms'];
/**
* Tracked property for the loading state
*
* @memberof ConsoleAdminNotificationsController
* @var {Boolean}
*/
@tracked isLoading = false;
/**
* Creates an instance of ConsoleAdminNotificationsController.
* @memberof ConsoleAdminNotificationsController
*/
constructor() {
super(...arguments);
this.getSettings();
}
/**
* Selectes notifiables for settings.
*
* @param {Object} notification
* @param {Array} notifiables
* @memberof ConsoleAdminNotificationsController
*/
@action onSelectNotifiable(notification, notifiables) {
const notificationKey = createNotificationKey(notification.definition, notification.name);
const _notificationSettings = { ...this.notificationSettings };
if (!_notificationSettings[notificationKey]) {
_notificationSettings[notificationKey] = {};
}
_notificationSettings[notificationKey].notifiables = notifiables;
_notificationSettings[notificationKey].definition = notification.definition;
_notificationSettings[notificationKey].via = notifiables.map((notifiable) => {
return {
identifier: notifiable.value,
methods: this.notificationTransportMethods,
};
});
this.mutateNotificationSettings(_notificationSettings);
}
/**
* Mutates the notification settings property.
*
* @param {Object} [_notificationSettings={}]
* @memberof ConsoleAdminNotificationsController
*/
mutateNotificationSettings(_notificationSettings = {}) {
this.notificationSettings = {
...this.notificationSettings,
..._notificationSettings,
};
}
/**
* Save notification settings to the server.
*
* @action
* @method saveSettings
* @returns {Promise}
* @memberof ConsoleAdminNotificationsController
*/
@action saveSettings() {
const { notificationSettings } = this;
this.isLoading = true;
return this.fetch
.post('notifications/save-settings', { notificationSettings })
.then(() => {
this.notifications.success('Notification settings successfully saved.');
})
.catch((error) => {
this.notifications.serverError(error);
})
.finally(() => {
this.isLoading = false;
});
}
/**
* Fetches and updates notification settings asynchronously.
*
* @returns {Promise<void>} A promise for successful retrieval and update, or an error on failure.
*/
getSettings() {
return this.fetch
.get('notifications/get-settings')
.then(({ notificationSettings }) => {
this.notificationSettings = notificationSettings;
})
.catch((error) => {
this.notifications.serverError(error);
});
}
}

View File

@@ -0,0 +1,3 @@
import Controller from '@ember/controller';
export default class ConsoleHomeController extends Controller {}

View File

@@ -0,0 +1,188 @@
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
/**
* Controller for managing notifications.
*/
export default class NotificationsController extends Controller {
/**
* Inject the `socket` service
*
* @memberof NotificationsController
*/
@service socket;
/**
* Inject the `store` service
*
* @memberof NotificationsController
*/
@service store;
/**
* Inject the `fetch` service
*
* @memberof NotificationsController
*/
@service fetch;
/**
* Inject the `notifications` service
*
* @memberof NotificationsController
*/
@service notifications;
/**
* Inject the `universe` service
*
* @memberof NotificationsController
*/
@service universe;
/**
* Inject the `router` service
*
* @memberof NotificationsController
*/
@service router;
/**
* Queryable parameters for this controller's model
*
* @var {Array}
*/
queryParams = ['page', 'limit', 'sort', 'query', 'created_at'];
/**
* The current page of data being viewed
*
* @var {Integer}
*/
@tracked page = 1;
/**
* The maximum number of items to show per page
*
* @var {Integer}
*/
@tracked limit = 20;
/**
* The param to sort the data on, the param with prepended `-` is descending
*
* @var {String}
*/
@tracked sort = '-created_at';
/**
* The selected notifications.
*
* @tracked
* @var {Array}
* @memberof NotificationsController
*/
@tracked selected = [];
/**
* Creates an instance of NotificationsController.
* @memberof NotificationsController
*/
constructor() {
super(...arguments);
// listen for received notifications
this.universe.on('notification.received', () => {
this.router.refresh();
});
}
/**
* Action to select or deselect a notification.
*
* @param {NotificationModel} notification - The notification to select or deselect.
* @memberof NotificationsController
*/
@action selectNotification(notification) {
if (this.selected.includes(notification)) {
this.selected.removeObject(notification);
} else {
this.selected.pushObject(notification);
}
}
/**
* Action to delete selected notifications.
*
* @memberof NotificationsController
*/
@action delete() {
return this.fetch
.delete('notifications/bulk-delete', {
notifications: this.selected.map(({ id }) => id),
})
.then(() => {
this.notifications.success(`${this.selected.length} notifications deleted`);
this.universe.trigger('notifications.deleted', [...this.selected]);
this.selected.clear();
return this.router.refresh();
})
.catch((error) => {
this.notifications.serverError(error);
});
}
/**
* Action to mark selected notifications as read.
*
* @memberof NotificationsController
*/
@action read() {
const unreadSelectedNotifications = this.selected.filter((notification) => notification.unread);
return this.fetch
.put('notifications/mark-as-read', {
notifications: unreadSelectedNotifications.map(({ id }) => id),
})
.then(() => {
this.notifications.success(`${unreadSelectedNotifications.length} notifications marked as read`);
this.universe.trigger('notifications.read', [...unreadSelectedNotifications]);
this.selected.clear();
return this.router.refresh();
})
.catch((error) => {
this.notifications.serverError(error);
});
}
/**
* Action to select all notifications.
*
* @memberof NotificationsController
*/
@action selectAll() {
if (this.selected.length === this.model.length) {
this.selected.clear();
} else {
this.selected = this.model.toArray();
}
}
/**
* Action to mark a notification as read.
*
* @param {NotificationModel} notification
* @return {Promise}
* @memberof NotificationsController
*/
@action markNotificationAsRead(notification) {
return notification.markAsRead().then(() => {
this.notifications.info('Notification marked as read.');
this.universe.trigger('notifications.read', [notification]);
});
}
}

View File

@@ -0,0 +1,11 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ConsoleSettingsController extends Controller {
/**
* INject the `universe` service
*
* @memberof ConsoleSettingsController
*/
@service universe;
}

View File

@@ -0,0 +1,94 @@
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class ConsoleSettingsIndexController extends Controller {
/**
* Inject the `currentUser` service
*
* @memberof ConsoleSettingsIndexController
*/
@service currentUser;
/**
* Inject the `notifications` service
*
* @memberof ConsoleSettingsIndexController
*/
@service notifications;
/**
* Inject the `fetch` service
*
* @memberof ConsoleSettingsIndexController
*/
@service fetch;
/**
* The request loading state.
*
* @memberof ConsoleSettingsIndexController
*/
@tracked isLoading = false;
/**
* the upload queue.
*
* @memberof ConsoleSettingsIndexController
*/
@tracked uploadQueue = [];
/**
* Uploaded files.
*
* @memberof ConsoleSettingsIndexController
*/
@tracked uploadedFiles = [];
/**
* Save the organization settings.
*
* @memberof ConsoleSettingsIndexController
*/
@action saveSettings(event) {
event.preventDefault();
this.isLoading = true;
this.model
.save()
.then(() => {
this.notifications.success('Organization changes successfully saved.');
})
.finally(() => {
this.isLoading = false;
});
}
/**
* Upload file to company.
*
* @param {String} type
* @param {File} file
* @return {Promise}
* @memberof ConsoleSettingsIndexController
*/
@action uploadFile(type, file) {
return this.fetch.uploadFile.perform(
file,
{
path: `uploads/companies/${this.currentUser.companyId}/${type}`,
key_uuid: this.currentUser.companyId,
key_type: `company`,
type,
},
(uploadedFile) => {
this.model.setProperties({
[`${type}_uuid`]: uploadedFile.id,
[`${type}_url`]: uploadedFile.url,
[type]: uploadedFile,
});
}
);
}
}

View File

@@ -0,0 +1,101 @@
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { task } from 'ember-concurrency-decorators';
export default class InstallController extends Controller {
@service fetch;
@service notifications;
@tracked error;
@tracked steps = [
{ task: 'createdb', name: 'Create Database', status: 'pending' },
{ task: 'migrate', name: 'Run Migrations', status: 'pending' },
{ task: 'seed', name: 'Seed Database', status: 'pending' },
];
@action updateTask(task, properties = {}) {
const steps = [...this.steps];
const index = steps.findIndex((step) => step.task === task);
if (index > -1) {
steps[index] = { ...steps[index], ...properties };
}
this.steps = [...steps];
}
@action startInstall() {
this.install.perform();
}
@action reset(options = {}) {
const install = options.install === true;
this.steps.forEach((step) => {
this.updateTask(step.task, { status: 'pending' });
});
if (install) {
this.install.perform();
}
}
@action onInstallCompleted() {
const isCompleted = this.steps.every(({ status }) => status === 'completed');
if (isCompleted) {
this.notifications.success('Install completed successfully!');
return this.transitionToRoute('onboard');
}
}
@task({ enqueue: true, maxConcurrency: 1 }) *install() {
try {
yield this.createdb.perform();
yield this.migrate.perform();
yield this.seed.perform();
} catch (error) {
this.error = error;
return this.reset();
}
this.onInstallCompleted();
}
@task *createdb() {
this.updateTask('createdb', { status: 'in_progress' });
try {
yield this.fetch.post('installer/createdb');
this.updateTask('createdb', { status: 'completed' });
} catch (error) {
this.updateTask('createdb', { status: 'failed' });
throw error;
}
}
@task *migrate() {
this.updateTask('migrate', { status: 'in_progress' });
try {
yield this.fetch.post('installer/migrate');
this.updateTask('migrate', { status: 'completed' });
} catch (error) {
this.updateTask('migrate', { status: 'failed' });
throw error;
}
}
@task *seed() {
this.updateTask('seed', { status: 'in_progress' });
try {
yield this.fetch.post('installer/seed');
this.updateTask('seed', { status: 'completed' });
} catch (error) {
this.updateTask('seed', { status: 'failed' });
throw error;
}
}
}

View File

@@ -0,0 +1,57 @@
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class InviteForUserController extends Controller {
@service fetch;
@service session;
@service notifications;
@service modalsManager;
@tracked code;
@tracked isLoading;
@action acceptInvite() {
const { code } = this;
this.isLoading = true;
this.fetch
.post('users/accept-company-invite', { code })
.then((response) => {
this.session.manuallyAuthenticate(response.token);
this.notifications.success('Invitation accepted, welcome to Fleetbase!');
this.isLoading = false;
return this.transitionToRoute('console').then(() => {
if (response.needs_password && response.needs_password === true) {
this.setPassword();
}
});
})
.catch((error) => {
this.notifications.serverError(error);
this.isLoading = false;
});
}
@action setPassword() {
this.modalsManager.show('modals/set-password', {
title: 'Set a new password',
closeButton: false,
backdropClose: false,
hideDeclineButton: true,
declineButtonDisabled: true,
password: null,
password_confirmation: null,
confirm: (modal) => {
modal.startLoading();
const input = modal.getOptions(['password', 'password_confirmation']);
return this.fetch.post('users/set-password', input);
},
});
}
}

Some files were not shown because too many files have changed in this diff Show More