Skip to content

Commit

Permalink
Merge pull request #1497 from appknox/change-storeknox-flow
Browse files Browse the repository at this point in the history
change storeknox flow to land on inventory first
  • Loading branch information
future-pirate-king authored Dec 9, 2024
2 parents 0dd5489 + 8545aff commit fde4df5
Show file tree
Hide file tree
Showing 34 changed files with 452 additions and 281 deletions.
37 changes: 37 additions & 0 deletions app/components/ak-svg/security-bg-img.hbs

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions app/components/ak-svg/security-indicator.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<svg
width='44'
height='42'
viewBox='0 0 44 42'
fill='none'
xmlns='http://www.w3.org/2000/svg'
...attributes
>
<circle
cx='22.0516'
cy='21'
r='20.3438'
fill='#D7DCEE'
stroke='#363C72'
stroke-width='1.3125'
/>
<path
d='M19.7582 22.9922C19.7582 23.6078 19.603 24.1924 19.2926 24.7459C18.9822 25.2942 18.4985 25.7391 17.8415 26.0806C17.1897 26.422 16.3465 26.5927 15.3119 26.5927C14.7946 26.5927 14.3393 26.5694 13.9462 26.5229C13.5582 26.4763 13.1961 26.4013 12.8598 26.2978C12.5236 26.1892 12.1744 26.0495 11.8122 25.8788V23.1474C12.4279 23.4578 13.0486 23.6957 13.6746 23.8613C14.3005 24.0216 14.867 24.1018 15.374 24.1018C15.6792 24.1018 15.9275 24.0656 16.1189 23.9932C16.3155 23.9208 16.4603 23.8225 16.5534 23.6983C16.6466 23.569 16.6931 23.4216 16.6931 23.256C16.6931 23.0594 16.6233 22.8939 16.4836 22.7594C16.3491 22.6197 16.1318 22.4749 15.8318 22.3248C15.5317 22.1748 15.136 21.9886 14.6445 21.7661C14.2255 21.5696 13.8453 21.3678 13.5039 21.1609C13.1676 20.954 12.8779 20.7186 12.6348 20.4548C12.3968 20.1858 12.2132 19.8728 12.0838 19.5158C11.9545 19.1589 11.8898 18.7373 11.8898 18.251C11.8898 17.5216 12.0683 16.9112 12.4253 16.4197C12.7874 15.9231 13.2892 15.5506 13.9307 15.3023C14.5773 15.054 15.3222 14.9298 16.1654 14.9298C16.9052 14.9298 17.57 15.0126 18.1597 15.1781C18.7546 15.3437 19.2874 15.5325 19.7582 15.7446L18.8193 18.1113C18.333 17.8889 17.8545 17.713 17.3837 17.5837C16.913 17.4492 16.4758 17.3819 16.0723 17.3819C15.8085 17.3819 15.5912 17.4155 15.4205 17.4828C15.255 17.5449 15.1308 17.6302 15.048 17.7389C14.9705 17.8475 14.9317 17.9716 14.9317 18.1113C14.9317 18.2872 14.9989 18.445 15.1334 18.5847C15.2731 18.7243 15.5033 18.8769 15.824 19.0425C16.1499 19.2029 16.5922 19.4124 17.1509 19.671C17.7045 19.9193 18.1752 20.1883 18.5632 20.478C18.9512 20.7626 19.2461 21.1066 19.4478 21.5101C19.6547 21.9084 19.7582 22.4024 19.7582 22.9922ZM30.862 20.5246C30.862 21.8437 30.6163 22.9405 30.1248 23.8147C29.6334 24.689 28.9402 25.346 28.0452 25.7857C27.1555 26.2202 26.1079 26.4375 24.9025 26.4375H21.2322V15.0928H25.1586C26.3795 15.0928 27.4141 15.3023 28.2625 15.7213C29.1109 16.1404 29.755 16.7534 30.1947 17.5604C30.6396 18.3674 30.862 19.3555 30.862 20.5246ZM27.6805 20.6332C27.6805 19.9452 27.5874 19.3762 27.4012 18.9261C27.2201 18.4709 26.9459 18.132 26.5786 17.9096C26.2114 17.682 25.7484 17.5681 25.1897 17.5681H24.2973V23.9234H24.9801C25.9113 23.9234 26.5942 23.6543 27.0287 23.1163C27.4633 22.5732 27.6805 21.7455 27.6805 20.6332Z'
fill='#363C72'
/>
</svg>
18 changes: 9 additions & 9 deletions app/components/ak-svg/sm-indicator.hbs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<svg
...attributes
width='25'
height='24'
viewBox='0 0 25 24'
width='36'
height='34'
viewBox='0 0 36 34'
fill='none'
xmlns='http://www.w3.org/2000/svg'
...attributes
>
<circle
cx='12.2886'
cy='12'
r='11.625'
cx='18.0107'
cy='17'
r='16.4688'
fill='#E1EBFF'
stroke='#034BD6'
stroke-width='0.75'
stroke-width='1.0625'
/>
<path
d='M9.72819 13.2812C9.72819 13.633 9.63951 13.9671 9.46214 14.2834C9.28478 14.5967 9.00838 14.8509 8.63296 15.046C8.26049 15.2411 7.77865 15.3387 7.18744 15.3387C6.89183 15.3387 6.63169 15.3254 6.40703 15.2988C6.18532 15.2722 5.9784 15.2293 5.78625 15.1702C5.59411 15.1081 5.39457 15.0283 5.18765 14.9307V13.3699C5.53942 13.5473 5.89415 13.6833 6.25184 13.7779C6.60952 13.8695 6.93321 13.9153 7.22291 13.9153C7.39732 13.9153 7.53921 13.8946 7.64858 13.8533C7.76092 13.8119 7.84369 13.7557 7.8969 13.6848C7.95011 13.6109 7.97671 13.5266 7.97671 13.432C7.97671 13.3197 7.9368 13.2251 7.85699 13.1482C7.78013 13.0684 7.65597 12.9856 7.48452 12.8999C7.31307 12.8142 7.08693 12.7078 6.8061 12.5807C6.56666 12.4683 6.34939 12.353 6.15428 12.2348C5.96214 12.1166 5.7966 11.9821 5.65766 11.8313C5.52168 11.6776 5.41674 11.4987 5.34284 11.2948C5.26894 11.0908 5.23199 10.8499 5.23199 10.572C5.23199 10.1552 5.33397 9.80637 5.53794 9.52555C5.74487 9.24176 6.03161 9.02892 6.39816 8.88703C6.76767 8.74514 7.19335 8.67419 7.67519 8.67419C8.09791 8.67419 8.47777 8.72149 8.81476 8.81609C9.15471 8.91068 9.45919 9.01858 9.72819 9.13978L9.19166 10.4922C8.91379 10.3651 8.64035 10.2646 8.37135 10.1907C8.10234 10.1138 7.85255 10.0754 7.62198 10.0754C7.47122 10.0754 7.34706 10.0946 7.24951 10.133C7.15492 10.1685 7.08397 10.2173 7.03668 10.2793C6.99233 10.3414 6.97016 10.4124 6.97016 10.4922C6.97016 10.5927 7.00859 10.6829 7.08545 10.7627C7.16526 10.8425 7.29681 10.9297 7.48009 11.0243C7.66632 11.1159 7.91907 11.2356 8.23832 11.3834C8.55462 11.5253 8.82363 11.6791 9.04533 11.8446C9.26704 12.0072 9.43554 12.2038 9.55082 12.4343C9.66907 12.6619 9.72819 12.9443 9.72819 13.2812ZM13.395 15.25L12.0692 10.5809H12.0293C12.0411 10.7021 12.0529 10.8661 12.0648 11.0731C12.0796 11.28 12.0929 11.5032 12.1047 11.7426C12.1165 11.9821 12.1224 12.2126 12.1224 12.4343V15.25H10.5705V8.76731H12.9028L14.2552 13.3699H14.2907L15.6165 8.76731H17.9533V15.25H16.3437V12.4077C16.3437 12.2038 16.3467 11.985 16.3526 11.7515C16.3614 11.515 16.3703 11.2933 16.3792 11.0864C16.391 10.8765 16.4013 10.7109 16.4102 10.5897H16.3703L15.0622 15.25H13.395Z'
d='M14.3835 18.8984C14.3835 19.3968 14.2579 19.87 14.0066 20.3181C13.7554 20.762 13.3638 21.1221 12.832 21.3985C12.3043 21.6749 11.6217 21.8131 10.7841 21.8131C10.3654 21.8131 9.99683 21.7943 9.67855 21.7566C9.36447 21.7189 9.07133 21.6582 8.79912 21.5744C8.52691 21.4865 8.24424 21.3734 7.95109 21.2352V19.0241C8.44944 19.2753 8.95197 19.468 9.4587 19.602C9.96542 19.7318 10.424 19.7967 10.8344 19.7967C11.0815 19.7967 11.2825 19.7674 11.4374 19.7088C11.5966 19.6501 11.7138 19.5706 11.7892 19.4701C11.8646 19.3654 11.9023 19.246 11.9023 19.112C11.9023 18.9529 11.8457 18.8189 11.7327 18.71C11.6238 18.5969 11.4479 18.4797 11.205 18.3582C10.9621 18.2368 10.6417 18.086 10.2439 17.9059C9.90469 17.7468 9.59689 17.5835 9.3205 17.416C9.04829 17.2484 8.81378 17.0579 8.61695 16.8443C8.42431 16.6266 8.27565 16.3732 8.17095 16.0842C8.06626 15.7953 8.01391 15.454 8.01391 15.0603C8.01391 14.4699 8.15839 13.9757 8.44735 13.5779C8.74049 13.1758 9.14671 12.8743 9.66599 12.6733C10.1895 12.4723 10.7925 12.3718 11.4751 12.3718C12.074 12.3718 12.6121 12.4388 13.0895 12.5728C13.5711 12.7068 14.0024 12.8596 14.3835 13.0313L13.6234 14.9473C13.2298 14.7672 12.8424 14.6248 12.4613 14.5201C12.0802 14.4112 11.7264 14.3568 11.3997 14.3568C11.1862 14.3568 11.0103 14.384 10.8721 14.4384C10.7381 14.4887 10.6376 14.5578 10.5706 14.6457C10.5077 14.7337 10.4763 14.8342 10.4763 14.9473C10.4763 15.0896 10.5308 15.2174 10.6397 15.3304C10.7527 15.4435 10.9391 15.5671 11.1987 15.7011C11.4626 15.8309 11.8206 16.0005 12.2729 16.2099C12.721 16.4109 13.1021 16.6287 13.4162 16.8632C13.7302 17.0935 13.9689 17.372 14.1323 17.6986C14.2998 18.0211 14.3835 18.421 14.3835 18.8984ZM19.5782 21.6875L17.7 15.0729H17.6434C17.6602 15.2446 17.6769 15.477 17.6937 15.7702C17.7146 16.0633 17.7335 16.3795 17.7502 16.7187C17.767 17.0579 17.7754 17.3846 17.7754 17.6986V21.6875H15.5768V12.5037H18.8809L20.7968 19.0241H20.8471L22.7253 12.5037H26.0358V21.6875H23.7555V17.6609C23.7555 17.372 23.7597 17.0621 23.7681 16.7313C23.7806 16.3962 23.7932 16.0822 23.8058 15.789C23.8225 15.4917 23.8372 15.2572 23.8497 15.0855H23.7932L21.9401 21.6875H19.5782Z'
fill='#034BD6'
/>
</svg>
21 changes: 21 additions & 0 deletions app/components/ak-svg/vapt-indicator.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<svg
width='34'
height='34'
viewBox='0 0 34 34'
fill='none'
xmlns='http://www.w3.org/2000/svg'
...attributes
>
<circle
cx='17'
cy='17'
r='16.4688'
fill='#FFEDEC'
stroke='#FF3A44'
stroke-width='1.0625'
/>
<path
d='M16.8096 12.7997L14.076 21.1431H11.4224L8.70022 12.7997H11.234L12.3697 17.0285C12.4115 17.1883 12.4591 17.3937 12.5123 17.6448C12.5694 17.8921 12.6208 18.1394 12.6664 18.3867C12.7159 18.634 12.7463 18.8356 12.7577 18.9916C12.773 18.8356 12.8015 18.6359 12.8433 18.3924C12.8852 18.1489 12.9308 17.9054 12.9803 17.6619C13.0336 17.4146 13.083 17.2111 13.1287 17.0513L14.2872 12.7997H16.8096ZM22.1627 21.1431L21.7518 19.5794H19.0411L18.6188 21.1431H16.1421L18.8642 12.7655H21.8717L24.6281 21.1431H22.1627ZM21.2839 17.7304L20.9244 16.3608C20.8863 16.2124 20.8311 16.0013 20.7589 15.7273C20.6866 15.4496 20.6143 15.1643 20.542 14.8713C20.4735 14.5746 20.4203 14.3311 20.3822 14.1408C20.348 14.3311 20.2985 14.5669 20.2338 14.8485C20.173 15.1262 20.1083 15.402 20.0398 15.676C19.9751 15.9499 19.9181 16.1782 19.8686 16.3608L19.5091 17.7304H21.2839Z'
fill='#FF4D3F'
/>
</svg>
21 changes: 0 additions & 21 deletions app/components/ak-svg/vp-indicator.hbs

This file was deleted.

1 change: 0 additions & 1 deletion app/components/appknox-wrapper/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@

<SideNav
local-class='dashboard-sidenav'
@isSecurityEnabled={{this.isSecurityEnabled}}
@isCollapsed={{this.isSidebarCollapsed}}
@toggleSidebar={{this.toggleSidebar}}
@menuItems={{this.menuItems}}
Expand Down
23 changes: 0 additions & 23 deletions app/components/appknox-wrapper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export default class AppknoxWrapperComponent extends Component<AppknoxWrapperSig
@service declare configuration: ConfigurationService;
@service('browser/window') declare window: Window;

@tracked isSecurityEnabled = false;
@tracked isEmptyOrgName = this.checkIfOrgNameIsEmpty;
@tracked showAddEditModal = this.isEmptyOrgName;
@tracked showOnboardingGuide = false;
Expand All @@ -53,8 +52,6 @@ export default class AppknoxWrapperComponent extends Component<AppknoxWrapperSig
const storedState = this.window.localStorage.getItem('sidebarState');
this.isSidebarCollapsed =
storedState !== null ? storedState === 'collapsed' : true;

this.securityEnabled();
}

get checkIfOrgNameIsEmpty() {
Expand Down Expand Up @@ -190,10 +187,6 @@ export default class AppknoxWrapperComponent extends Component<AppknoxWrapperSig
currentWhen:
'authenticated.partner.clients authenticated.partner.client authenticated.partner.analytics',
},
this.isSecurityEnabled && {
label: this.intl.t('security'),
component: 'side-nav/security-menu-item' as const,
},
].filter(Boolean) as MenuItem[];
}

Expand Down Expand Up @@ -269,22 +262,6 @@ export default class AppknoxWrapperComponent extends Component<AppknoxWrapperSig
this.freshdesk.openSupportWidget();
}

@action
securityEnabled() {
this.ajax
.request('projects', {
namespace: 'api/hudson-api',
})
.then(
() => {
this.isSecurityEnabled = true;
},
() => {
this.isSecurityEnabled = false;
}
);
}

@action
handleAddEditOrgNameCancel() {
this.showAddEditModal = false;
Expand Down
1 change: 1 addition & 0 deletions app/components/home-page/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
@linkText={{t 'takeMeToDashboard'}}
@coverBackgroundImage={{productCardDetails.coverImage}}
@indicatorSvg={{productCardDetails.indicator}}
@openInNewTab={{productCardDetails.openInNewTab}}
/>
{{/each}}
</AkStack>
Expand Down
42 changes: 30 additions & 12 deletions app/components/home-page/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,72 @@ import Component from '@glimmer/component';
import type IntlService from 'ember-intl/services/intl';

import type OrganizationService from 'irene/services/organization';
import type ConfigurationService from 'irene/services/configuration';
import type UserAuthService from 'irene/services/user-auth';
import type WhitelabelService from 'irene/services/whitelabel';

interface productCardDetails {
title: string;
desc: string;
link: string;
indicator: 'ak-svg/sm-indicator' | 'ak-svg/vp-indicator';
coverImage: 'ak-svg/storeknox-bg-img' | 'ak-svg/appknox-bg-img';
indicator:
| 'ak-svg/sm-indicator'
| 'ak-svg/vapt-indicator'
| 'ak-svg/security-indicator';
coverImage:
| 'ak-svg/storeknox-bg-img'
| 'ak-svg/appknox-bg-img'
| 'ak-svg/security-bg-img';
openInNewTab?: boolean;
}

export default class HomePageComponent extends Component {
@service declare intl: IntlService;
@service declare organization: OrganizationService;
@service declare configuration: ConfigurationService;
@service declare userAuth: UserAuthService;
@service declare session: any;
@service declare ajax: any;
@service declare whitelabel: WhitelabelService;

get isStoreknoxEnabled() {
return this.organization.selected?.features?.storeknox;
}

get orgIsAnEnterprise() {
return this.configuration.serverData.enterprise;
get isWhitelabel() {
return !this.whitelabel.is_appknox_url;
}

get productCardDetails() {
return [
{
title: this.orgIsAnEnterprise
? this.intl.t('vapt')
: this.intl.t('appknox'),
title: this.isWhitelabel ? this.intl.t('vapt') : this.intl.t('appknox'),
desc: this.intl.t('appknoxDesc'),
link: 'authenticated.dashboard.projects',
indicator: 'ak-svg/vp-indicator',
indicator: 'ak-svg/vapt-indicator',
coverImage: 'ak-svg/appknox-bg-img',
},
this.isStoreknoxEnabled && {
title: this.orgIsAnEnterprise
title: this.isWhitelabel
? this.intl.t('appMonitoring')
: this.intl.t('storeknox'),
desc: this.intl.t('storeknoxDesc'),
link: 'authenticated.storeknox.discover',
link: 'authenticated.storeknox.inventory.app-list',
indicator: 'ak-svg/sm-indicator',
coverImage: 'ak-svg/storeknox-bg-img',
},
this.isSecurityEnabled && {
title: this.intl.t('securityDashboard'),
desc: this.intl.t('securityDashboardDesc'),
link: 'authenticated.security.projects',
indicator: 'ak-svg/security-indicator',
coverImage: 'ak-svg/security-bg-img',
openInNewTab: true,
},
].filter(Boolean) as productCardDetails[];
}

get isSecurityEnabled() {
return this.organization.isSecurityEnabled;
}
}

declare module '@glint/environment-ember-loose/registry' {
Expand Down
2 changes: 2 additions & 0 deletions app/components/home-page/product-card/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
@route={{this.route}}
@underline='always'
@fontWeight='medium'
target={{if @openInNewTab '_blank'}}
rel={{if @openInNewTab 'noopener noreferrer'}}
>
{{@linkText}}
</AkLink>
Expand Down
11 changes: 9 additions & 2 deletions app/components/home-page/product-card/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ export interface ProductCardComponentSignature {
description: string;
linkText: string;
route: string;
coverBackgroundImage: 'ak-svg/storeknox-bg-img' | 'ak-svg/appknox-bg-img';
indicatorSvg: 'ak-svg/sm-indicator' | 'ak-svg/vp-indicator';
coverBackgroundImage:
| 'ak-svg/storeknox-bg-img'
| 'ak-svg/appknox-bg-img'
| 'ak-svg/security-bg-img';
indicatorSvg:
| 'ak-svg/sm-indicator'
| 'ak-svg/vapt-indicator'
| 'ak-svg/security-indicator';
openInNewTab?: boolean;
};
Blocks: {
default: [];
Expand Down
Loading

0 comments on commit fde4df5

Please sign in to comment.