-
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.
add: connect with upstream api to obtain allocation (#50)
* create: upstream autenticator * add: authentication api * add: upstream context * add: login to upstream server too * add: upstream provider * add: node-fetch types * fix: authenticator * add: hooks and api projects * fix: add project selector * fix: remove console * add: list members * fix: share and unshare * add: css link * fix: css * add: typing
- Loading branch information
Showing
29 changed files
with
689 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,18 @@ | ||
import { Apps } from '@tapis/tapis-typescript'; | ||
import { apiGenerator, errorDecoder } from 'tapis-api/utils'; | ||
|
||
const unShareApp = ( | ||
request: Apps.UnShareAppRequest, | ||
basePath: string, | ||
jwt: string | ||
) => { | ||
const api: Apps.SharingApi = apiGenerator<Apps.SharingApi>( | ||
Apps, | ||
Apps.SharingApi, | ||
basePath, | ||
jwt | ||
); | ||
return errorDecoder<Apps.RespBasic>(() => api.unShareApp(request)); | ||
}; | ||
|
||
export default unShareApp; |
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
46 changes: 46 additions & 0 deletions
46
src/tapis-app/Apps/_components/Toolbar/ShareModal/components/ProjectSelector.tsx
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,46 @@ | ||
import { useState } from 'react'; | ||
import { Container, FormGroup, Input, Label } from 'reactstrap'; | ||
import { QueryWrapper } from 'tapis-ui/_wrappers'; | ||
import { Project } from 'upstream-api/projects/types'; | ||
import { useList } from 'upstream-hooks/projects'; | ||
|
||
interface ProjectSelectorProps { | ||
setUsers: (users: Array<string>) => void; | ||
users: Array<string>; | ||
} | ||
|
||
const ProjectSelector = ({ setUsers, users }: ProjectSelectorProps) => { | ||
const [selectedProjects, setSelectedProjects] = useState<number[]>([]); | ||
const { data: projects, isLoading, error } = useList(); | ||
const handleCheckboxChange = (project: Project) => { | ||
if (selectedProjects.includes(project.id)) { | ||
setSelectedProjects(selectedProjects.filter((p) => p !== project.id)); | ||
} else { | ||
setSelectedProjects([...selectedProjects, project.id]); | ||
const usernames = project.members.map((member) => member.username); | ||
setUsers([...users, ...usernames]); | ||
} | ||
}; | ||
|
||
return ( | ||
<QueryWrapper isLoading={isLoading} error={error}> | ||
<FormGroup> | ||
{projects && | ||
projects?.map((project, index) => ( | ||
<FormGroup check key={index}> | ||
<Label check> | ||
<Input | ||
type="checkbox" | ||
checked={selectedProjects.includes(project.id)} | ||
onChange={() => handleCheckboxChange(project)} | ||
/> | ||
{project.title} | ||
</Label> | ||
</FormGroup> | ||
))} | ||
</FormGroup> | ||
</QueryWrapper> | ||
); | ||
}; | ||
|
||
export default ProjectSelector; |
15 changes: 15 additions & 0 deletions
15
src/tapis-app/Apps/_components/Toolbar/ShareModal/components/UserSelector.css
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,15 @@ | ||
.link-button { | ||
background: none; | ||
background-color: none; | ||
color: blue; | ||
border: none; | ||
padding: 0; | ||
font: inherit; | ||
cursor: pointer; | ||
text-decoration: underline; | ||
margin-left: 10px; | ||
} | ||
|
||
.link-button:hover { | ||
color: darkblue; | ||
} |
Oops, something went wrong.