forked from opendatahub-io/odh-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into cypress-RHOAIENG-17124
- Loading branch information
Showing
23 changed files
with
491 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { AuthKind } from '~/k8sTypes'; | ||
|
||
type MockAuthData = { | ||
adminGroups?: string[]; | ||
allowedGroups?: string[]; | ||
}; | ||
|
||
export const mockAuth = ({ | ||
adminGroups = ['odh-admins'], | ||
allowedGroups = ['system:authenticated'], | ||
}: MockAuthData = {}): AuthKind => ({ | ||
apiVersion: 'services.platform.opendatahub.io/v1alpha1', | ||
kind: 'Auth', | ||
metadata: { | ||
name: 'auth', | ||
}, | ||
spec: { | ||
adminGroups, | ||
allowedGroups, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { k8sGetResource, k8sPatchResource, Patch } from '@openshift/dynamic-plugin-sdk-utils'; | ||
import { AuthModel } from '~/api'; | ||
import { AuthKind } from '~/k8sTypes'; | ||
|
||
export const AUTH_SINGLETON_NAME = 'auth'; | ||
|
||
export const getAuth = (): Promise<AuthKind> => | ||
k8sGetResource<AuthKind>({ model: AuthModel, queryOptions: { name: AUTH_SINGLETON_NAME } }); | ||
|
||
export type GroupData = { adminGroups?: string[]; allowedGroups?: string[] }; | ||
export const patchAuth = (groupData: GroupData): Promise<AuthKind> => { | ||
const { adminGroups, allowedGroups } = groupData; | ||
const patches: Patch[] = []; | ||
if (adminGroups) { | ||
patches.push({ | ||
value: adminGroups, | ||
op: 'replace', | ||
path: '/spec/adminGroups', | ||
}); | ||
} | ||
if (allowedGroups) { | ||
patches.push({ | ||
value: allowedGroups, | ||
op: 'replace', | ||
path: '/spec/allowedGroups', | ||
}); | ||
} | ||
|
||
return k8sPatchResource<AuthKind>({ | ||
model: AuthModel, | ||
queryOptions: { name: AUTH_SINGLETON_NAME }, | ||
patches, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.