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