-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
done: - identities management - Identities list screen - Disable selection for tls identities on identities list - Identities detail overview - Identities detail groups view - TLS identities does not have groups view - Identities modify groups for a single identity - Identities modify groups for multiple identities - History undo/redo control for modify groups panel with modified status shown - Nested side navigation for storage and permissions - Hide nav items when side navigation is collapsed - Hover to expand side navigation for medium screen widths - Edit identity groups confirm modal - Align header layout for storage pages - Adjusted navigation to enter "scroll mode" automatically depending on its content overflow - lxd groups management - lxd Groups list view - lxd Groups empty state view - Setup for group actions menu - Create lxd groups in side panel Signed-off-by: Mason Hu <mason.hu@canonical.com>
- Loading branch information
Showing
102 changed files
with
6,795 additions
and
362 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,82 @@ | ||
import { handleResponse, handleSettledResult } from "util/helpers"; | ||
import { LxdApiResponse } from "types/apiResponse"; | ||
import { LxdGroup } from "types/permissions"; | ||
|
||
export const fetchGroups = (): Promise<LxdGroup[]> => { | ||
return new Promise((resolve, reject) => { | ||
fetch(`/1.0/auth/groups?recursion=1`) | ||
.then(handleResponse) | ||
.then((data: LxdApiResponse<LxdGroup[]>) => resolve(data.metadata)) | ||
.catch(reject); | ||
}); | ||
}; | ||
|
||
export const fetchGroup = (name: string): Promise<LxdGroup> => { | ||
return new Promise((resolve, reject) => { | ||
fetch(`/1.0/auth/groups/${name}`) | ||
.then(handleResponse) | ||
.then((data: LxdApiResponse<LxdGroup>) => resolve(data.metadata)) | ||
.catch(reject); | ||
}); | ||
}; | ||
|
||
export const createGroup = (group: Partial<LxdGroup>): Promise<void> => { | ||
return new Promise((resolve, reject) => { | ||
fetch(`/1.0/auth/groups`, { | ||
method: "POST", | ||
body: JSON.stringify(group), | ||
}) | ||
.then(handleResponse) | ||
.then(resolve) | ||
.catch(reject); | ||
}); | ||
}; | ||
|
||
export const deleteGroup = (group: string): Promise<void> => { | ||
return new Promise((resolve, reject) => { | ||
fetch(`/1.0/auth/groups/${group}`, { | ||
method: "DELETE", | ||
}) | ||
.then(handleResponse) | ||
.then(resolve) | ||
.catch(reject); | ||
}); | ||
}; | ||
|
||
export const deleteGroups = (groups: string[]): Promise<void> => { | ||
return new Promise((resolve, reject) => { | ||
void Promise.allSettled(groups.map((group) => deleteGroup(group))) | ||
.then(handleSettledResult) | ||
.then(resolve) | ||
.catch(reject); | ||
}); | ||
}; | ||
|
||
export const updateGroup = (group: Partial<LxdGroup>): Promise<void> => { | ||
return new Promise((resolve, reject) => { | ||
fetch(`/1.0/auth/groups/${group.name}`, { | ||
method: "PUT", | ||
body: JSON.stringify(group), | ||
}) | ||
.then(handleResponse) | ||
.then(resolve) | ||
.catch(reject); | ||
}); | ||
}; | ||
|
||
export const renameGroup = ( | ||
oldName: string, | ||
newName: string, | ||
): Promise<void> => { | ||
return new Promise((resolve, reject) => { | ||
fetch(`/1.0/auth/groups/${oldName}`, { | ||
method: "POST", | ||
body: JSON.stringify({ | ||
name: newName, | ||
}), | ||
}) | ||
.then(handleResponse) | ||
.then(resolve) | ||
.catch(reject); | ||
}); | ||
}; |
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,52 @@ | ||
import { handleResponse, handleSettledResult } from "util/helpers"; | ||
import { LxdApiResponse } from "types/apiResponse"; | ||
import { LxdIdentity } from "types/permissions"; | ||
|
||
export const fetchIdentities = (): Promise<LxdIdentity[]> => { | ||
return new Promise((resolve, reject) => { | ||
fetch(`/1.0/auth/identities?recursion=1`) | ||
.then(handleResponse) | ||
.then((data: LxdApiResponse<LxdIdentity[]>) => resolve(data.metadata)) | ||
.catch(reject); | ||
}); | ||
}; | ||
|
||
export const fetchIdentity = ( | ||
id: string, | ||
authMethod: string, | ||
): Promise<LxdIdentity> => { | ||
return new Promise((resolve, reject) => { | ||
fetch(`/1.0/auth/identities/${authMethod}/${id}`) | ||
.then(handleResponse) | ||
.then((data: LxdApiResponse<LxdIdentity>) => resolve(data.metadata)) | ||
.catch(reject); | ||
}); | ||
}; | ||
|
||
export const updateIdentity = (identity: Partial<LxdIdentity>) => { | ||
return new Promise((resolve, reject) => { | ||
fetch( | ||
`/1.0/auth/identities/${identity.authentication_method}/${identity.id}`, | ||
{ | ||
method: "PUT", | ||
body: JSON.stringify(identity), | ||
}, | ||
) | ||
.then(handleResponse) | ||
.then(resolve) | ||
.catch(reject); | ||
}); | ||
}; | ||
|
||
export const updateIdentities = ( | ||
identities: Partial<LxdIdentity>[], | ||
): Promise<void> => { | ||
return new Promise((resolve, reject) => { | ||
void Promise.allSettled( | ||
identities.map((identity) => updateIdentity(identity)), | ||
) | ||
.then(handleSettledResult) | ||
.then(resolve) | ||
.catch(reject); | ||
}); | ||
}; |
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,88 @@ | ||
import { handleResponse, handleSettledResult } from "util/helpers"; | ||
import { LxdApiResponse } from "types/apiResponse"; | ||
import { IdpGroup } from "types/permissions"; | ||
|
||
export const fetchIdpGroups = (): Promise<IdpGroup[]> => { | ||
return new Promise((resolve, reject) => { | ||
fetch(`/1.0/auth/identity-provider-groups?recursion=1`) | ||
.then(handleResponse) | ||
.then((data: LxdApiResponse<IdpGroup[]>) => resolve(data.metadata)) | ||
.catch(reject); | ||
}); | ||
}; | ||
|
||
export const fetchIdpGroup = (name: string): Promise<IdpGroup> => { | ||
return new Promise((resolve, reject) => { | ||
fetch(`/1.0/auth/identity-provider-groups/${name}`) | ||
.then(handleResponse) | ||
.then((data: LxdApiResponse<IdpGroup>) => resolve(data.metadata)) | ||
.catch(reject); | ||
}); | ||
}; | ||
|
||
export const createIdpGroup = (group: Partial<IdpGroup>): Promise<void> => { | ||
return new Promise((resolve, reject) => { | ||
fetch(`/1.0/auth/identity-provider-groups`, { | ||
method: "POST", | ||
body: JSON.stringify({ name: group.name }), | ||
}) | ||
.then(() => | ||
fetch(`/1.0/auth/identity-provider-groups/${group.name}`, { | ||
method: "PUT", | ||
body: JSON.stringify(group), | ||
}), | ||
) | ||
.then(handleResponse) | ||
.then(resolve) | ||
.catch(reject); | ||
}); | ||
}; | ||
|
||
export const updateIdpGroup = (group: IdpGroup): Promise<void> => { | ||
return new Promise((resolve, reject) => { | ||
fetch(`/1.0/auth/identity-provider-groups/${group.name}`, { | ||
method: "PUT", | ||
body: JSON.stringify(group), | ||
}) | ||
.then(handleResponse) | ||
.then(resolve) | ||
.catch(reject); | ||
}); | ||
}; | ||
|
||
export const renameIdpGroup = ( | ||
oldName: string, | ||
newName: string, | ||
): Promise<void> => { | ||
return new Promise((resolve, reject) => { | ||
fetch(`/1.0/auth/identity-provider-groups/${oldName}`, { | ||
method: "POST", | ||
body: JSON.stringify({ | ||
name: newName, | ||
}), | ||
}) | ||
.then(handleResponse) | ||
.then(resolve) | ||
.catch(reject); | ||
}); | ||
}; | ||
|
||
export const deleteIdpGroup = (group: string): Promise<void> => { | ||
return new Promise((resolve, reject) => { | ||
fetch(`/1.0/auth/identity-provider-groups/${group}`, { | ||
method: "DELETE", | ||
}) | ||
.then(handleResponse) | ||
.then(resolve) | ||
.catch(reject); | ||
}); | ||
}; | ||
|
||
export const deleteIdpGroups = (groups: string[]): Promise<void> => { | ||
return new Promise((resolve, reject) => { | ||
void Promise.allSettled(groups.map((group) => deleteIdpGroup(group))) | ||
.then(handleSettledResult) | ||
.then(resolve) | ||
.catch(reject); | ||
}); | ||
}; |
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 { handleResponse } from "util/helpers"; | ||
import { LxdApiResponse } from "types/apiResponse"; | ||
import { LxdPermission } from "types/permissions"; | ||
|
||
export const fetchPermissions = (args: { | ||
resourceType: string; | ||
project?: string; | ||
}): Promise<LxdPermission[]> => { | ||
const { resourceType, project } = args; | ||
let url = `/1.0/auth/permissions?entity-type=${resourceType}`; | ||
if (project) { | ||
url += `&project=${project}`; | ||
} | ||
|
||
return new Promise((resolve, reject) => { | ||
fetch(url) | ||
.then(handleResponse) | ||
.then((data: LxdApiResponse<LxdPermission[]>) => resolve(data.metadata)) | ||
.catch(reject); | ||
}); | ||
}; |
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.