.
This commit is contained in:
parent
35852f03a0
commit
ab6862f894
src/ts/containers/agent
@ -40,7 +40,7 @@ export class AgentDetail extends React.Component<any, any> {
|
||||
appToAdd: 1,
|
||||
addType : 'host'
|
||||
}
|
||||
|
||||
console.log(this.props.agent);
|
||||
};
|
||||
|
||||
handleAddTarget = () => {
|
||||
|
@ -22,43 +22,6 @@ const styles = {
|
||||
},
|
||||
};
|
||||
|
||||
const tableData = [
|
||||
{
|
||||
agentId: '111',
|
||||
desc: 'Agent 1',
|
||||
status: 'Wait For Auth',
|
||||
},
|
||||
{
|
||||
agentId: 'wqekoekeeeeerw',
|
||||
desc: 'Agent 2',
|
||||
status: 'Wait For Auth',
|
||||
},
|
||||
{
|
||||
agentId: 'wqekoekeeeeerw',
|
||||
desc: 'Agent 3',
|
||||
status: 'Wait For Auth',
|
||||
},
|
||||
{
|
||||
agentId: 'wqekoekeeeeerw',
|
||||
desc: 'Agent 4',
|
||||
status: 'Wait For Auth',
|
||||
},
|
||||
{
|
||||
agentId: 'wqekoekeeeeerw',
|
||||
desc: 'Agent 5',
|
||||
status: 'Wait For Auth',
|
||||
},
|
||||
{
|
||||
agentId: 'wqekoekeeeeerw',
|
||||
desc: 'Agent 6',
|
||||
status: 'Wait For Auth',
|
||||
},
|
||||
{
|
||||
agentId: 'wqekoekeeeeerw',
|
||||
desc: 'Agent 7',
|
||||
status: 'Wait For Auth',
|
||||
},
|
||||
];
|
||||
|
||||
export class Agents extends React.Component<any, any> {
|
||||
constructor(props: any, context: any) {
|
||||
@ -66,30 +29,42 @@ export class Agents extends React.Component<any, any> {
|
||||
this.state = {
|
||||
agents: []
|
||||
};
|
||||
this.getAgents();
|
||||
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.getAgents();
|
||||
}
|
||||
|
||||
getAgents = () => {
|
||||
let output: string;
|
||||
let obj: any; //new object declaration
|
||||
obj = {
|
||||
"phone": this.state.phone
|
||||
};
|
||||
// let output: string;
|
||||
// let obj: any; //new object declaration
|
||||
// obj = {
|
||||
// "memberId":"1"
|
||||
// };
|
||||
|
||||
let os: OFRest = new OFRest("Agent", "Regist", obj);
|
||||
// let os: OFRest = new OFRest("Agent", "getAgentList", obj);
|
||||
|
||||
os.Call().then(function (res) {
|
||||
return res.json();
|
||||
}).then(function (json) {
|
||||
console.log(json);
|
||||
}).catch(function (err) {
|
||||
console.log(err);
|
||||
// os.Call().then(function (res) {
|
||||
// return res.json();
|
||||
// }).then(function (json) {
|
||||
// console.log(json);
|
||||
// }).catch(function (err) {
|
||||
// console.log(err);
|
||||
// });
|
||||
|
||||
var val = '[{"id":3,"member":{"id":1,"email":"insanity33@loafle.com","pwSalt":"salktttt","digest":"bbbbbbbbb","name":"insanity3","company":"loafle","phone":"000-000-0000","authorizedDate":null},"authorizedDate":null,"description":"test agent2"},{"id":4,"member":{"id":1,"email":"","pwSalt":"","digest":"","name":"","company":"","phone":"","authorizedDate":0},"authorizedDate":null,"description":"test agent3"}]';
|
||||
this.setState({
|
||||
agents : JSON.parse(val)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
handleRowSelected = (selectedRows: number[] | string) => {
|
||||
this.props.history.push('/agent/agentDetail');
|
||||
this.props.history.push({
|
||||
pathname : '/agent/agentDetail',
|
||||
props: { agent : this.state.agents[selectedRows[0]] }
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -107,19 +82,23 @@ export class Agents extends React.Component<any, any> {
|
||||
enableSelectAll={false}
|
||||
displaySelectAll={false}>
|
||||
<TableRow>
|
||||
<TableHeaderColumn tooltip="The Agent Id">Agent Id</TableHeaderColumn>
|
||||
<TableHeaderColumn tooltip="The Description">Description</TableHeaderColumn>
|
||||
<TableHeaderColumn tooltip="The Status">Status</TableHeaderColumn>
|
||||
<TableHeaderColumn >Agent Id</TableHeaderColumn>
|
||||
<TableHeaderColumn >Description</TableHeaderColumn>
|
||||
<TableHeaderColumn >Authorized At</TableHeaderColumn>
|
||||
<TableHeaderColumn >Status</TableHeaderColumn>
|
||||
<TableHeaderColumn >Last Polling At</TableHeaderColumn>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody
|
||||
displayRowCheckbox={false}
|
||||
>
|
||||
{tableData.map((row: any, index: number) => (
|
||||
{this.state.agents.map((row: any, index: number) => (
|
||||
<TableRow key={index} >
|
||||
<TableRowColumn>{row.agentId}</TableRowColumn>
|
||||
<TableRowColumn>{row.desc}</TableRowColumn>
|
||||
<TableRowColumn>{row.id}</TableRowColumn>
|
||||
<TableRowColumn>{row.description}</TableRowColumn>
|
||||
<TableRowColumn>{row.authorizedDate}</TableRowColumn>
|
||||
<TableRowColumn>{row.status}</TableRowColumn>
|
||||
<TableRowColumn>{row.lastPollingDate}</TableRowColumn>
|
||||
</TableRow>
|
||||
))};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user