-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List Admin Extensions React Conversion #289
Merged
chandra-tacc
merged 4 commits into
feat/apcd-react-conversion
from
feat/apcd-react-list-extensions
Aug 16, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
aa1a61e
first run at the react conversion
happycodemonkey ec22752
Update list_admin_extension.html from merge feat branch
chandra-tacc 3ba18cd
Updated incorrect import
happycodemonkey 3e61333
Merge branch 'feat/apcd-react-conversion' into feat/apcd-react-list-e…
chandra-tacc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,11 +1,18 @@ | ||
from django.urls import path | ||
from django.views.generic import TemplateView | ||
from apps.admin_extension.views import AdminExtensionsTable | ||
|
||
|
||
app_name = 'admin_extension' | ||
urlpatterns = [ | ||
path('list-extensions/', AdminExtensionsTable.as_view(), name="list_extensions"), | ||
path('list-extensions/', TemplateView.as_view(template_name='list_admin_extension.html'), name="list_extensions"), | ||
path('list-extensions/<str:status>', AdminExtensionsTable.as_view(), name='status'), | ||
path('list-extensions/<str:org>', AdminExtensionsTable.as_view(), name='org'), | ||
path('list-extensions/<str:status><str:org>', AdminExtensionsTable.as_view(), name='status_org') | ||
path('list-extensions/<str:status><str:org>', AdminExtensionsTable.as_view(), name='status_org'), | ||
path(r'list-extensions/api/', AdminExtensionsTable.as_view(), name='admin_extensions_table_api'), | ||
path(r'list-extensions/api/?status=(?P<status>)/', AdminExtensionsTable.as_view(), | ||
name='admin_extensions_table_api'), | ||
path(r'list-extensions/api/?org=(?P<org>)/', AdminExtensionsTable.as_view(), name='admin_extensions_table_api'), | ||
path(r'list-extensions/api/?status=(?P<status>)&org=(?P<org>)/', AdminExtensionsTable.as_view(), | ||
name='admin_extensions_table_api') | ||
] |
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
apcd-cms/src/client/src/components/Admin/Extensions/AdminExtensions.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 React, { useEffect, useMemo } from 'react'; | ||
import { useExtensions, ExtensionRow } from 'hooks/admin'; | ||
|
||
export const AdminExtensions: React.FC = () => { | ||
const { data, isLoading, isError } = useExtensions({}); | ||
|
||
if (isLoading) { | ||
return <div>Loading...</div>; | ||
} | ||
|
||
if (isError) { | ||
return <div>Error loading data</div>; | ||
} | ||
|
||
return ( | ||
<table id="extensionTable" className="extension-table"> | ||
<thead> | ||
<tr> | ||
{data?.header.map((columnName: string, index: number) => ( | ||
<th key={index}>{columnName}</th> | ||
))} | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{data?.page.map((row: ExtensionRow, rowIndex: number) => ( | ||
<tr key={rowIndex}> | ||
<td>{row.created}</td> | ||
<td>{row.org_name}</td> | ||
<td>{row.requestor}</td> | ||
<td>{row.type}</td> | ||
<td>{row.ext_outcome}</td> | ||
<td>{row.ext_status}</td> | ||
<td>{row.approved_expiration_date}</td> | ||
<td className="modal-cell"> | ||
<select id={`actionsDropdown_${row.ext_id}`} onChange={`openAction('${row.ext_id}')`}> | ||
<option value="">Select Action</option> | ||
<option value="viewAdminExtensions">View Record</option> | ||
<option value="editExtension">Edit Record</option> | ||
</select> | ||
</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
); | ||
}; |
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,4 @@ | ||
// index.ts | ||
import { AdminExtensions } from './AdminExtensions'; | ||
|
||
export { AdminExtensions }; |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The datetime import needs to be updated to the following:
from datetime import date as datetimeDate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated this import