Skip to content

Commit 0a9e92c

Browse files
authored
Merge branch 'main' into add_cf_to_auto_alarm
2 parents 532c4be + ebbbb23 commit 0a9e92c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2961
-572
lines changed

.github/CODEOWNERS

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Set a "catch-all" owner. Should be set to the current active admin for the repo.
3+
* @kcantrel
4+
#
5+
# Set the owner for all the individual samples, if the owner is known and they want to continue to maintain the sample:
6+
/AI/GenAI-ChatBot-application-sample/ @cbenbass
7+
/CloudFormation/deploy-fsx-ontap/ @kcantrel
8+
/Ansible/fsx_inventory_report/ @kcantrel
9+
/Ansible/snapmirror_report/ @kcantrel
10+
/EKS/FSxN-as-PVC-for-EKS/ @mickeysh
11+
/Management-Utilities/auto_create_sm_relationships/ @kcantrel
12+
/Management-Utilities/auto_set_fsxn_auto_grow/ @kcantrel
13+
/Management-Utilities/fsx-ontap-aws-cli-scripts/ @kcantrel
14+
/Management-Utilities/fsxn-rotate-secret/ @kcantrel
15+
/Management-Utilities/warm_performance_tier/ @kcantrel
16+
/Monitoring/CloudWatch-FSx/ @LirazRom10
17+
/Monitoring/LUN-monitoring/ @LirazRom10
18+
/Monitoring/auto-add-cw-alarms/ @kcantrel
19+
/Monitoring/monitor-ontap-services/ @kcantrel
20+
/Monitoring/ingest_nas_audit_logs_into_cloudwatch/ @kcantrel
21+
/Terraform/deploy-fsx-ontap-sqlserver/ @varunrai
22+
/Terraform/deploy-fsx-ontap-fileshare-access/ @varunrai
23+
/Terraform/deploy-fsx-ontap/ @kcantrel
24+
/Terraform/fsxn-replicate/ @nichollri

.github/linters/.yaml-lint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
extends: default
33
rules:
44
line-length: disable
5+
comments-indentation: disable
56
trailing-spaces: disable
67
truthy: disable
78
braces:
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Dependency Review Action
2+
#
3+
# This Action will scan dependency manifest files that change as part of a Pull Request,
4+
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
5+
# Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable
6+
# packages will be blocked from merging.
7+
#
8+
# Source repository: https://github.com/actions/dependency-review-action
9+
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
10+
name: 'Dependency review'
11+
on:
12+
pull_request:
13+
branches: [ "main" ]
14+
15+
# If using a dependency submission action in this workflow this permission will need to be set to:
16+
#
17+
# permissions:
18+
# contents: write
19+
#
20+
# https://docs.github.com/en/enterprise-cloud@latest/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api
21+
permissions:
22+
contents: read
23+
# Write permissions for pull-requests are required for using the `comment-summary-in-pr` option, comment out if you aren't using this option
24+
pull-requests: write
25+
26+
jobs:
27+
dependency-review:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: 'Checkout repository'
31+
uses: actions/checkout@v4
32+
- name: 'Dependency Review'
33+
uses: actions/dependency-review-action@v4
34+
# Commonly enabled options, see https://github.com/actions/dependency-review-action#configuration-options for all available options.
35+
with:
36+
comment-summary-in-pr: always
37+
# fail-on-severity: moderate
38+
# deny-licenses: GPL-1.0-or-later, LGPL-2.0-or-later
39+
# retry-on-snapshot-warnings: true

AI/GenAI-ChatBot-application-sample/.env.local.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ NEXT_PUBLIC_LOGIN_PROVIDER=cognito
22
NEXT_PUBLIC_KNOWLEDGE_BASE_ID=YOUR_KNOWLEDGE_BASE_ID
33
NEXT_PUBLIC_AWS_USER_POOLS_ID=YOUR_AWS_USER_POOLS_ID
44
NEXT_PUBLIC_AWS_USER_WEB_CLIENT_ID=YOUR_AWS_USER_WEB_CLIENT_ID
5+
# NEXT_PUBLIC_LOGIN_EXTERNAL_PROVIDER=AD--NAME-SAMPLE
6+
# NEXT_PUBLIC_AWS_OAUTH={"domain":"<DOMAIN_PREFIX>.auth.<REGION>.amazoncognito.com","scope":["openid","profile","email"],"redirectSignIn":"http://localhost:9091","redirectSignOut":"http://localhost:9091","responseType":"code"}
57

68
# NEXT_PUBLIC_LOGIN_PROVIDER=clerk
79
# NEXT_PUBLIC_KNOWLEDGE_BASE_ID=YOUR_KNOWLEDGE_BASE_ID

AI/GenAI-ChatBot-application-sample/README.md

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ To get started, you need to configure one of the supported login providers. Conf
3737
- NEXT_PUBLIC_AWS_USER_POOLS_ID=YOUR_AWS_USER_POOLS_ID
3838
- NEXT_PUBLIC_AWS_USER_WEB_CLIENT_ID=YOUR_AWS_USER_WEB_CLIENT_ID
3939

40+
#### Configure Active Directory with Amazon Cognito
41+
1. To integrate Active Directory with Amazon Cognito, follow the [A guide to AD FS federation with Amazon Cognito user pools instructions (Steps 1 to 4)](https://aws.amazon.com/blogs/security/simplify-web-app-authentication-a-guide-to-ad-fs-federation-with-amazon-cognito-user-pools/).
42+
2. To configure SAML request signing, follow the instructions in [Signing SAML requests](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-SAML-signing-encryption.html#cognito-user-pools-SAML-signing).
43+
3. Specify the federated identity provider and authorization by adding the following variables to the `.env.local` file, with values that match your environment.
44+
- NEXT_PUBLIC_LOGIN_EXTERNAL_PROVIDER=YOUR_COGNITO_IDENTITY_PROVIDER_NAME
45+
- NEXT_PUBLIC_AWS_OAUTH={"domain":"<DOMAIN_PREFIX>.auth.<REGION>.amazoncognito.com","scope":["openid", "profile", "email"],"redirectSignIn":"http://localhost:9091","redirectSignOut":"http://localhost:9091","responseType":"code"}
46+
- Domain - The domain for your Cognito user pool.
47+
- Scope - Scopes specifying the access privileges.
48+
- redirectSignIn - The URL to redirect to after a successful sign-in.
49+
- redirectSignOut - The URL to redirect to after a successful sign-out.
50+
- responseType - The type of response to receive from the authorization server.
51+
4052
### Set up Clerk
4153
1. Follow the [Sign up](https://dashboard.clerk.com/sign-in?redirect_url=https%3A%2F%2Fdashboard.clerk.com%2F) instructions to sign up for a Clerk account.
4254
2. Download and unpack the Workload Factory GenAI sample application source package.
@@ -49,21 +61,8 @@ To get started, you need to configure one of the supported login providers. Conf
4961
- CLERK_SECRET_KEY=YOUR_CLERK_SECRET_KEY
5062
- NEXT_PUBLIC_CLERK_TEMPLATE=YOUR_CLERK_TEMPLATE
5163

52-
## Download the application
53-
To download the application, clone the GitHub repository. Then, change to the sample application directory so that you can build or run it:
54-
55-
1.
56-
```bash
57-
git clone https://github.com/NetApp/FSx-ONTAP-samples-scripts
58-
```
59-
60-
2.
61-
```bash
62-
cd FSx-ONTAP-samples-scripts/AI/GenAI-ChatBot-application-sample
63-
```
64-
65-
## Install dependencies
66-
To install dependencies for the sample application, run the following command:
64+
## Install the application
65+
To install the sample application, run the following command:
6766

6867
```bash
6968
npm install
@@ -91,21 +90,4 @@ npm run build
9190
- Learn more about the APIs used in this sample application by visiting the [Workload Factory API documentation](https://console.workloads.netapp.com/api-doc).
9291
- To learn more about Next.js, take a look at the following resources:
9392
- [Next.js documentation](https://nextjs.org/docs) - learn about Next.js features and API.
94-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
95-
96-
## Author Information
97-
98-
This repository is maintained by the contributors listed on [GitHub](https://github.com/NetApp/FSx-ONTAP-samples-scripts/graphs/contributors).
99-
100-
## License
101-
102-
Licensed under the Apache License, Version 2.0 (the "License").
103-
104-
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0).
105-
106-
Unless required by applicable law or agreed to in writing, software distributed under the License
107-
is distributed on an _"AS IS"_ basis, without WARRANTIES or conditions of any kind, either express or implied.
108-
109-
See the License for the specific language governing permissions and limitations under the License.
110-
111-
© 2024 NetApp, Inc. All Rights Reserved.
93+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gen-ai-standalone-app",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"private": true,
55
"scripts": {
66
"dev": "cross-env HOST=localhost PORT=9091 next dev",
@@ -9,27 +9,27 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12-
"@clerk/nextjs": "^5.2.2",
13-
"@reduxjs/toolkit": "^2.2.5",
14-
"@types/react-redux": "^7.1.33",
12+
"@clerk/nextjs": "^5.7.2",
13+
"@reduxjs/toolkit": "^2.2.8",
14+
"@types/react-redux": "^7.1.34",
1515
"aws-amplify": "5.3.11",
1616
"cross-env": "^7.0.3",
17-
"html-react-parser": "^5.1.10",
17+
"html-react-parser": "^5.1.18",
1818
"moment": "^2.30.1",
19-
"next": "14.2.4",
19+
"next": "14.2.15",
2020
"react": "^18",
2121
"react-dom": "^18",
2222
"react-popper-tooltip": "^4.4.2",
2323
"react-redux": "^9.1.2",
24-
"sass": "^1.77.6"
24+
"sass": "^1.79.5"
2525
},
2626
"devDependencies": {
2727
"@svgr/webpack": "^8.1.0",
28-
"@types/node": "^20",
28+
"@types/node": "^22",
2929
"@types/react": "^18",
3030
"@types/react-dom": "^18",
3131
"eslint": "^8",
32-
"eslint-config-next": "14.2.4",
32+
"eslint-config-next": "14.2.15",
3333
"typescript": "^5"
3434
}
3535
}

AI/GenAI-ChatBot-application-sample/src/app/auth/auth-service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class AuthService {
1919
await Auth.signUp({
2020
username,
2121
password,
22-
}).then(data => {
22+
}).then(() => {
2323

2424
logger.info("Registering " + username);
2525

@@ -131,7 +131,7 @@ export class AuthService {
131131
data: data
132132
});
133133
})
134-
.catch(err => {
134+
.catch(() => {
135135
logger.error("Couldn't sign out for some reason");
136136
Hub.dispatch(AuthService.CHANNEL, {
137137
event: AuthService.AUTH_EVENTS.SIGN_OUT,

AI/GenAI-ChatBot-application-sample/src/app/cognito/aws-configs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const awsConfig = {
55
aws_user_pools_mfa_type: 'OFF',
66
aws_user_pools_web_client_id: process.env.NEXT_PUBLIC_AWS_USER_WEB_CLIENT_ID,
77
aws_user_settings: 'enable',
8+
oauth: process.env.NEXT_PUBLIC_AWS_OAUTH
89
};
910

1011
export default awsConfig

AI/GenAI-ChatBot-application-sample/src/app/components/loginForm/loginForm.tsx

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@ import { addNotification, removeNotification } from '@/lib/slices/notifications.
1515
import { NOTIFICATION_CONSTS } from '../NotificationGroup/notification.consts';
1616
import { setAuth } from '@/lib/slices/auth.slice';
1717
import { ClerkSignIn } from '@/app/services/clerk.service';
18-
import { SignInResult, LoginProvider } from '@/lib/api/api.types';
18+
import {LoginProvider, SignInResultClerk, SignInResultCognito} from '@/lib/api/api.types';
1919
import useRunUntil from '@/app/hooks/useRunUntil';
2020

21-
const LoginForm = () => {
21+
export type LoginType = 'AD' | 'UserPassword'
22+
interface LoginFormProps {
23+
onLoginSuccess: (loginType:LoginType )=> void
24+
}
25+
26+
const LoginForm = ({onLoginSuccess}:LoginFormProps) => {
2227
const loginProvider = process.env.NEXT_PUBLIC_LOGIN_PROVIDER as LoginProvider;
28+
const loginEternalProvider:string | undefined = process.env.NEXT_PUBLIC_LOGIN_EXTERNAL_PROVIDER;
2329

2430
const emailRef = useRef<HTMLInputElement>(null);
2531

@@ -29,8 +35,8 @@ const LoginForm = () => {
2935
const [email, setEmail] = useState<string | undefined>();
3036
const [password, setPassword] = useState<string | undefined>();
3137

32-
const { isLoading: isLoadingCog, jwtToken: jwtTokenCog, email: emailCog, password: passwordCog, userName: userNameCog, error: errorCog, doLogin: doLoginCog } = loginProvider === 'cognito' ? CognitoSignIn() : {} as SignInResult
33-
const { isLoading: isLoadingClerk, jwtToken: jwtTokenClerk, email: emailClerk, password: passwordClerk, userName: userNameClerk, error: errorClerk, doLogin: doLoginClerk } = loginProvider === 'clerk' ? ClerkSignIn() : {} as SignInResult;
38+
const { isLoading: isLoadingCog, jwtToken: jwtTokenCog, email: emailCog, password: passwordCog, userName: userNameCog, error: errorCog, doLogin: doLoginCog } = loginProvider === 'cognito' ? CognitoSignIn() : {} as SignInResultCognito
39+
const { isLoading: isLoadingClerk, jwtToken: jwtTokenClerk, email: emailClerk, password: passwordClerk, userName: userNameClerk, error: errorClerk, doLogin: doLoginClerk } = loginProvider === 'clerk' ? ClerkSignIn() : {} as SignInResultClerk;
3440

3541
useRunUntil(() => {
3642
emailRef.current?.focus();
@@ -53,18 +59,19 @@ const LoginForm = () => {
5359

5460
useEffect(() => {
5561
if (jwtTokenCog || jwtTokenClerk) {
62+
onLoginSuccess(loginEternalProvider? 'AD': 'UserPassword')
5663
dispatch(setAuth({
5764
isSuccess: true,
5865
accessToken: jwtTokenCog || jwtTokenClerk,
5966
userName: userNameClerk || userNameCog
6067
}));
6168
router.push(`${ROUTES.BASE}${ROUTES.CHAT}`);
6269
}
63-
}, [jwtTokenCog, jwtTokenClerk, router, userNameClerk, userNameCog, dispatch])
70+
}, [jwtTokenCog, jwtTokenClerk, router, userNameClerk, userNameCog, dispatch, loginEternalProvider, onLoginSuccess])
6471

6572
const doLogin = () => {
6673
dispatch(removeNotification(NOTIFICATION_CONSTS.UNIQUE_IDS.USER_NOT_CONFIRMED));
67-
loginProvider === 'cognito' ? doLoginCog(email, password) : doLoginClerk(email, password);
74+
loginProvider === 'cognito' ? doLoginCog(email, password,loginEternalProvider) : doLoginClerk(email, password);
6875
}
6976

7077
return (
@@ -73,7 +80,8 @@ const LoginForm = () => {
7380
<div className={styles.formContent}>
7481
<span className={_Classes(global.Regular_24, styles.formTitle)}>Log in to Workload Factory GenAI sample application</span>
7582
<span className={`${global.Regular_14}`}>Log in to NetApp GenAI Studio chatbot sample application with<br />your company user account.</span>
76-
<DsTextField
83+
{!process.env.NEXT_PUBLIC_LOGIN_EXTERNAL_PROVIDER && <>
84+
<DsTextField
7785
ref={emailRef}
7886
title='Email'
7987
className={styles.formInput}
@@ -91,20 +99,21 @@ const LoginForm = () => {
9199
value: 'This field is required.'
92100
} : undefined}
93101
/>
94-
<DsTextField
95-
title='Password'
96-
isPassword
97-
className={styles.formInput}
98-
onChange={event => setPassword(event?.target.value)}
99-
onKeyDown={event => {
100-
if (event.key === 'Enter') {
101-
doLogin();
102-
}
103-
}}
104-
message={password === '' ? {
105-
type: 'error',
106-
value: 'This field is required.'
107-
} : undefined} />
102+
<DsTextField
103+
title='Password'
104+
isPassword
105+
className={styles.formInput}
106+
onChange={event => setPassword(event?.target.value)}
107+
onKeyDown={event => {
108+
if (event.key === 'Enter') {
109+
doLogin();
110+
}
111+
}}
112+
message={password === '' ? {
113+
type: 'error',
114+
value: 'This field is required.'
115+
} : undefined} />
116+
</>}
108117
<DsButton onClick={() => doLogin()} className={styles.loginButton} isLoading={isLoadingCog || isLoadingClerk}>Login</DsButton>
109118
</div>
110119
</div>

AI/GenAI-ChatBot-application-sample/src/app/global.module.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
77
color: #404040;
88

9+
&.isHidden {
10+
opacity: 0;
11+
}
12+
913
&.font-variants {
1014
--semibold-font-weight: 500;
1115

@@ -37,7 +41,7 @@
3741
font-size: 20px;
3842
line-height: 32px;
3943
font-weight: 400;
40-
}
44+
}
4145

4246
.Regular_14 {
4347
font-size: 14px;

0 commit comments

Comments
 (0)