-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b381299
commit 27bf7c3
Showing
4 changed files
with
120 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export interface PageWrapperProps { | ||
children: React.ReactElement | React.ReactElement[]; | ||
} | ||
const PageWrapper = ({ children }: PageWrapperProps): React.ReactElement => { | ||
return <div className="page-content padding-16 flex-grow">{children}</div>; | ||
}; | ||
export default PageWrapper; |
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,56 @@ | ||
import { WorkItemField } from 'azure-devops-extension-api/WorkItemTracking'; | ||
import { Button } from 'azure-devops-ui/Button'; | ||
import { FormItem } from 'azure-devops-ui/Components/FormItem/FormItem'; | ||
import { TextField } from 'azure-devops-ui/TextField'; | ||
import { useEffect, useState } from 'react'; | ||
|
||
import { WorkItemFieldNames } from '../../common/constants'; | ||
import WorkItemService from '../../common/services/WorkItemService'; | ||
import PageWrapper from '../components/PageWrapper'; | ||
const CreateFieldForm = (): React.ReactElement => { | ||
const [name, setName] = useState<string>(''); | ||
|
||
return ( | ||
<div> | ||
<FormItem label="Title"> | ||
<TextField value={name} onChange={(_, v) => setName(v)} /> | ||
</FormItem> | ||
<Button | ||
text="Create" | ||
onClick={async () => { | ||
const service = new WorkItemService(); | ||
// await service.createField(); | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
const AdminConfigurationTab = (): React.ReactElement => { | ||
const validFields: string[] = [WorkItemFieldNames.Status]; | ||
const [fields, setFields] = useState<WorkItemField[]>(); | ||
useEffect(() => { | ||
async function fetchMyAPI() { | ||
const service = new WorkItemService(); | ||
const result = await service.getFields(); | ||
setFields(result); | ||
console.log(result); | ||
} | ||
fetchMyAPI(); | ||
}, []); | ||
return ( | ||
<PageWrapper> | ||
<div>Page content</div> | ||
<ul> | ||
{fields && | ||
fields | ||
.filter(x => validFields.includes(x.referenceName)) | ||
.sort((a, b) => (a.referenceName > b.referenceName ? 1 : -1)) | ||
.map(x => <li key={x.referenceName}>{x.referenceName}</li>)} | ||
</ul> | ||
<CreateFieldForm /> | ||
</PageWrapper> | ||
); | ||
}; | ||
|
||
export default AdminConfigurationTab; |
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,11 @@ | ||
import PageWrapper from '../components/PageWrapper'; | ||
|
||
const AreaConfigurationTab = (): React.ReactElement => { | ||
return ( | ||
<PageWrapper> | ||
<div>Areas</div> | ||
</PageWrapper> | ||
); | ||
}; | ||
|
||
export default AreaConfigurationTab; |