This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
react translations and some other stuff
- Loading branch information
Theodor Truffer
committed
Feb 11, 2021
1 parent
8f93af2
commit 9c5963a
Showing
14 changed files
with
239 additions
and
44 deletions.
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
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
use ActiveRecord; | ||
use ilCloudException; | ||
use stdClass; | ||
|
||
/** | ||
* Class EventLogEntry | ||
|
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,10 +1,42 @@ | ||
<?php | ||
namespace srag\Plugins\OneDrive\EventLog\UI; | ||
|
||
use srag\Plugins\OneDrive\EventLog\EventLogEntryAR; | ||
use ilTemplate; | ||
use ILIAS\DI\Container; | ||
|
||
/** | ||
* Class EventLogTableUI | ||
* @author Theodor Truffer <[email protected]> | ||
*/ | ||
class EventLogTableUI | ||
{ | ||
/** | ||
* @var Container | ||
*/ | ||
protected $dic; | ||
|
||
/** | ||
* EventLogTableUI constructor. | ||
* @param Container $dic | ||
*/ | ||
public function __construct(Container $dic) | ||
{ | ||
$this->dic = $dic; | ||
} | ||
|
||
public function render() : string | ||
{ | ||
$tpl = new ilTemplate(__DIR__ . '/table/build/index.html', false, false); | ||
$data = array_map(function($entry) { | ||
return array_map(function($value) { | ||
return $value[1]; | ||
}, $entry->getArrayForConnector()); | ||
}, EventLogEntryAR::get()); | ||
return '<script type="application/javascript">' . | ||
'window.exod_log_data = ' . json_encode(array_values($data)) . ';' . | ||
'window.lng = "' . $this->dic->language()->getLangKey() . '";' . | ||
'</script>' | ||
. $tpl->get(); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const columns: { | ||
dataIndex: string, | ||
key: string | ||
}[] = [ | ||
{ | ||
dataIndex: "id", | ||
key: "id" | ||
}, | ||
{ | ||
dataIndex: "timestamp", | ||
key: "timestamp" | ||
}, | ||
{ | ||
dataIndex: "event_type", | ||
key: "event_type" | ||
}, | ||
{ | ||
dataIndex: "path", | ||
key: "path" | ||
}, | ||
{ | ||
dataIndex: "object_type", | ||
key: "object_type" | ||
}, | ||
{ | ||
dataIndex: "additional_data", | ||
key: "additional_data" | ||
} | ||
]; | ||
export default columns; |
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,52 +1,33 @@ | ||
import React from "react"; | ||
import { Table } from "antd"; | ||
import {Table} from "antd"; | ||
import "antd/dist/antd.css"; | ||
import columns from "./Columns"; | ||
import { withTranslation } from "react-i18next"; | ||
|
||
export default class DataTable extends React.Component<any, any> { | ||
columns: any = [ | ||
{ | ||
title: 'Id', | ||
dataIndex: 'id', | ||
key: 'id' | ||
}, | ||
{ | ||
title: 'Timestamp', | ||
dataIndex: 'timestamp', | ||
key: 'timestamp', | ||
}, | ||
{ | ||
title: 'Name', | ||
dataIndex: 'event_type', | ||
key: 'event_type', | ||
}, | ||
{ | ||
title: 'Path', | ||
dataIndex: 'path', | ||
key: 'path', | ||
}, | ||
{ | ||
title: 'Object Type', | ||
dataIndex: 'object_type', | ||
key: 'object_type', | ||
}, | ||
{ | ||
title: 'Additional Data', | ||
dataIndex: 'additional_data', | ||
key: 'additional_data', | ||
} | ||
]; | ||
class DataTable extends React.Component<any, any> { | ||
|
||
constructor(props: any) { | ||
super(props); | ||
// @ts-ignore | ||
let data: any = window.exod_log_data; | ||
this.state = { | ||
data: data | ||
data: data.map((set: any) => { | ||
set.event_type = this.props.t("event_type." + set.event_type); | ||
set.object_type = this.props.t("object_type." + set.object_type); | ||
return set; | ||
}) | ||
} | ||
} | ||
|
||
render() { | ||
console.log(this.state.data); | ||
return (<Table dataSource={this.state.data} columns={this.columns} />); | ||
return (<Table dataSource={this.state.data} columns={columns.map((val) => { | ||
return { | ||
dataIndex: val.dataIndex, | ||
key: val.key, | ||
title: this.props.t("column." + val.key) | ||
} | ||
})}/>); | ||
} | ||
} | ||
|
||
export default withTranslation()(DataTable); |
Oops, something went wrong.