Compare commits
No commits in common. "7bb5be8fa7bd1d16b5ddd7ffe9ac55c4bf79f428" and "46d0e78d3c05c88ecc3501a7fbec4150439ee23f" have entirely different histories.
7bb5be8fa7
...
46d0e78d3c
|
@ -1128,15 +1128,9 @@ class HistoryViewSet(Base, List, Retrieve):
|
|||
def get_queryset(self):
|
||||
queryset = models.HistoryIndex.objects
|
||||
|
||||
exclude_system = self.request.query_params.get('exclude_system', '') == 'true'
|
||||
member_id = self.request.query_params.get('member_id', '')
|
||||
|
||||
if exclude_system:
|
||||
if 'exclude_system' in self.request.query_params:
|
||||
queryset = queryset.filter(is_system=False)
|
||||
|
||||
if member_id:
|
||||
queryset = queryset.filter(owner_id=member_id)
|
||||
|
||||
return queryset.order_by('-history_date')[:50]
|
||||
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ export function AdminVetting(props) {
|
|||
}
|
||||
|
||||
export function AdminHistory(props) {
|
||||
const { token, filterMember } = props;
|
||||
const { token } = props;
|
||||
const [history, setHistory] = useState(historyCache);
|
||||
const [excludeSystem, setExcludeSystem] = useState(excludeSystemCache);
|
||||
const [focus, setFocus] = useState(focusCache);
|
||||
|
@ -131,11 +131,7 @@ export function AdminHistory(props) {
|
|||
};
|
||||
|
||||
useEffect(() => {
|
||||
let extra = '?exclude_system=' + excludeSystem;
|
||||
if (filterMember) {
|
||||
extra += '&member_id=' + filterMember;
|
||||
}
|
||||
|
||||
const extra = excludeSystem ? '?exclude_system' : '';
|
||||
requester('/history/'+extra, 'GET', token)
|
||||
.then(res => {
|
||||
setHistory(res.results);
|
||||
|
@ -152,9 +148,6 @@ export function AdminHistory(props) {
|
|||
{!error ?
|
||||
history ?
|
||||
<>
|
||||
<Header size='medium'>History</Header>
|
||||
<p>Last 50 database changes:</p>
|
||||
|
||||
<Checkbox
|
||||
label='Exclude System'
|
||||
onChange={handleExcludeSystem}
|
||||
|
@ -167,15 +160,13 @@ export function AdminHistory(props) {
|
|||
<Table.HeaderCell>Date</Table.HeaderCell>
|
||||
<Table.HeaderCell>Username</Table.HeaderCell>
|
||||
<Table.HeaderCell>Type</Table.HeaderCell>
|
||||
{!filterMember && <Table.HeaderCell>Owner</Table.HeaderCell>}
|
||||
<Table.HeaderCell>Owner</Table.HeaderCell>
|
||||
<Table.HeaderCell>Object</Table.HeaderCell>
|
||||
<Table.HeaderCell>Changed Fields</Table.HeaderCell>
|
||||
</Table.Row>
|
||||
</Table.Header>}
|
||||
|
||||
<Table.Body>
|
||||
{!history.length && <p>None</p>}
|
||||
|
||||
{history.map(x =>
|
||||
<React.Fragment key={x.id}>
|
||||
<Table.Row>
|
||||
|
@ -186,7 +177,7 @@ export function AdminHistory(props) {
|
|||
</Table.Cell>
|
||||
<Table.Cell>{isMobile && 'User: '}{x.is_system ? 'System' : (x.history_user || 'Deleted User')}</Table.Cell>
|
||||
<Table.Cell>{isMobile && 'Type: '}{x.history_type}</Table.Cell>
|
||||
{!filterMember && <Table.Cell>{isMobile && 'Owner: '}{x.owner_name}</Table.Cell>}
|
||||
<Table.Cell>{isMobile && 'Owner: '}{x.owner_name}</Table.Cell>
|
||||
<Table.Cell>{isMobile && 'Object: '}{x.object_name}</Table.Cell>
|
||||
<Table.Cell>{isMobile && 'Changed: '}{x.changes.map(x => x.field).join(', ')}</Table.Cell>
|
||||
</Table.Row>
|
||||
|
@ -366,7 +357,9 @@ export function Admin(props) {
|
|||
<p>All times are in Mountain time.</p>
|
||||
<AdminUsage {...props} />
|
||||
|
||||
<p/>
|
||||
|
||||
<Header size='medium'>History</Header>
|
||||
<p>Last 50 database changes:</p>
|
||||
|
||||
<AdminHistory {...props} />
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import { statusColor, isAdmin, isInstructor, BasicTable, staticUrl, requester }
|
|||
import { NotFound } from './Misc.js';
|
||||
import { AdminMemberInfo, AdminMemberPause, AdminMemberForm, AdminMemberCards, AdminMemberTraining, AdminMemberCertifications } from './AdminMembers.js';
|
||||
import { AdminMemberTransactions } from './AdminTransactions.js';
|
||||
import { AdminHistory } from './Admin.js';
|
||||
import { StorageButton } from './Storage.js';
|
||||
import AbortController from 'abort-controller';
|
||||
|
||||
|
@ -342,8 +341,7 @@ export function MemberDetail(props) {
|
|||
<Link to={'/members/'+member.id+'/cards'}>Cards</Link>{' - '}
|
||||
<Link to={'/members/'+member.id+'/lockouts'}>Lockouts</Link>{' - '}
|
||||
<Link to={'/members/'+member.id+'/training'}>Training</Link>{' - '}
|
||||
<Link to={'/members/'+member.id+'/transactions'}>Transactions</Link>{' - '}
|
||||
<Link to={'/members/'+member.id+'/history'}>History</Link>
|
||||
<Link to={'/members/'+member.id+'/transactions'}>Transactions</Link>
|
||||
</p>
|
||||
}
|
||||
|
||||
|
@ -352,38 +350,42 @@ export function MemberDetail(props) {
|
|||
<Grid stackable columns={2}>
|
||||
<Grid.Column width={8}>
|
||||
<AdminMemberInfo result={result} refreshResult={refreshResult} {...props} />
|
||||
|
||||
<Segment padded>
|
||||
<AdminMemberPause result={result} refreshResult={refreshResult} {...props} />
|
||||
</Segment>
|
||||
</Grid.Column>
|
||||
|
||||
<Grid.Column width={8}>
|
||||
<Segment padded>
|
||||
<AdminMemberForm result={result} refreshResult={refreshResult} {...props} />
|
||||
</Segment>
|
||||
|
||||
<Segment padded>
|
||||
<AdminMemberPause result={result} refreshResult={refreshResult} {...props} />
|
||||
</Segment>
|
||||
</Grid.Column>
|
||||
</Grid>
|
||||
</Route>}
|
||||
|
||||
{isAdmin(user) && <Route path='/members/:id/cards'>
|
||||
<Segment padded>
|
||||
<AdminMemberCards result={result} refreshResult={refreshResult} {...props} />
|
||||
</Segment>
|
||||
</Route>}
|
||||
|
||||
{isAdmin(user) && <Route path='/members/:id/lockouts'>
|
||||
<Segment padded>
|
||||
<AdminMemberCertifications result={result} refreshResult={refreshResult} {...props} />
|
||||
</Segment>
|
||||
</Route>}
|
||||
|
||||
{isAdmin(user) && <Route path='/members/:id/training'>
|
||||
<Segment padded>
|
||||
<AdminMemberTraining result={result} refreshResult={refreshResult} {...props} />
|
||||
</Segment>
|
||||
</Route>}
|
||||
|
||||
{isAdmin(user) && <Route path='/members/:id/transactions'>
|
||||
<Segment padded>
|
||||
<AdminMemberTransactions result={result} refreshResult={refreshResult} {...props} />
|
||||
</Route>}
|
||||
|
||||
{isAdmin(user) && <Route path='/members/:id/history'>
|
||||
<AdminHistory filterMember={member.id} {...props} />
|
||||
</Segment>
|
||||
</Route>}
|
||||
|
||||
<Route path='/members/:id'>
|
||||
|
|
Loading…
Reference in New Issue
Block a user