Order items manually
This commit is contained in:
parent
dc7f19fa37
commit
6caac1019d
1 changed files with 28 additions and 3 deletions
|
@ -27,13 +27,26 @@ const styles = StyleSheet.create({
|
||||||
} as React.ViewStyle
|
} as React.ViewStyle
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const ITEM_ORDER = [
|
||||||
|
'score',
|
||||||
|
'calc_time',
|
||||||
|
'guesses',
|
||||||
|
'crack_times_display',
|
||||||
|
'online_throttling_100_per_hour',
|
||||||
|
'online_no_throttling_10_per_second',
|
||||||
|
'offline_slow_hashing_1e4_per_second',
|
||||||
|
'offline_fast_hashing_1e10_per_second',
|
||||||
|
'feedback',
|
||||||
|
'sequence'
|
||||||
|
];
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State {}
|
interface State {}
|
||||||
|
|
||||||
export default class Result extends React.Component<Props, State> {
|
export default class Results extends React.Component<Props, State> {
|
||||||
dataSource: any;
|
dataSource: any;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -42,18 +55,30 @@ export default class Result extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
parseData(results: any) {
|
parseData(results: any) {
|
||||||
const newResults = _.clone(results);
|
let newResults = _.clone(results);
|
||||||
const hashTimes = Object.keys(newResults.crack_times_display).map(function (key) {
|
const hashTimes = Object.keys(newResults.crack_times_display).map(function (key) {
|
||||||
const value = newResults.crack_times_display[key];
|
const value = newResults.crack_times_display[key];
|
||||||
return {key, value};
|
return {key, value};
|
||||||
});
|
});
|
||||||
|
const guesses = [{
|
||||||
|
key: 'guesses',
|
||||||
|
value: newResults.guesses * Math.pow(10, newResults.guesses_log10)
|
||||||
|
}];
|
||||||
delete newResults.crack_times_display;
|
delete newResults.crack_times_display;
|
||||||
delete newResults.crack_times_seconds;
|
delete newResults.crack_times_seconds;
|
||||||
|
delete newResults.guesses_log10;
|
||||||
|
delete newResults.password;
|
||||||
|
delete newResults.guesses;
|
||||||
const out = Object.keys(newResults).map(function (key) {
|
const out = Object.keys(newResults).map(function (key) {
|
||||||
const value = newResults[key];
|
const value = newResults[key];
|
||||||
return {key, value};
|
return {key, value};
|
||||||
});
|
});
|
||||||
return _.union(out, hashTimes);
|
const allResults = _.union(out, hashTimes, guesses);
|
||||||
|
let orderedResults : any[] = [];
|
||||||
|
allResults.forEach(function (result) {
|
||||||
|
orderedResults[ITEM_ORDER.indexOf(result.key)] = result;
|
||||||
|
});
|
||||||
|
return orderedResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderRow(rowData: any, sectionId: string, rowId: string) {
|
renderRow(rowData: any, sectionId: string, rowId: string) {
|
||||||
|
|
Reference in a new issue