mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
edit dashboard name, closes #233
This commit is contained in:
parent
ed26cd16fd
commit
5567bb433c
2 changed files with 23 additions and 3 deletions
|
@ -21,14 +21,14 @@ import { FormGroup, FormControl, FormLabel } from 'react-bootstrap';
|
|||
import Dialog from '../common/dialogs/dialog';
|
||||
|
||||
class EditDashboardDialog extends React.Component {
|
||||
valid: false;
|
||||
valid = true;
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
name: '',
|
||||
_id: ''
|
||||
id: ''
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ class EditDashboardDialog extends React.Component {
|
|||
resetState() {
|
||||
this.setState({
|
||||
name: this.props.dashboard.name,
|
||||
_id: this.props.dashboard._id
|
||||
id: this.props.dashboard.id
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import TableColumn from '../common/table-column';
|
|||
import ImportConfigDialog from '../componentconfig/import-config';
|
||||
import ImportDashboardDialog from "../dashboard/import-dashboard";
|
||||
import NewDashboardDialog from "../dashboard/new-dashboard";
|
||||
import EditDashboardDialog from '../dashboard/edit-dashboard';
|
||||
import EditFiles from '../file/edit-files'
|
||||
|
||||
import ICAction from '../ic/ic-action';
|
||||
|
@ -101,6 +102,7 @@ class Scenario extends React.Component {
|
|||
editInputSignalsModal: prevState.editInputSignalsModal || false,
|
||||
|
||||
newDashboardModal: false,
|
||||
dashboardEditModal: prevState.dashboardEditModal || false,
|
||||
deleteDashboardModal: false,
|
||||
importDashboardModal: false,
|
||||
modalDashboardData: {},
|
||||
|
@ -336,6 +338,21 @@ class Scenario extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
closeEditDashboardModal(data) {
|
||||
this.setState({ dashboardEditModal: false });
|
||||
|
||||
let editDashboard = this.state.modalDashboardData;
|
||||
|
||||
if (data != null) {
|
||||
editDashboard.name = data.name;
|
||||
AppDispatcher.dispatch({
|
||||
type: 'dashboards/start-edit',
|
||||
data: editDashboard,
|
||||
token: this.state.sessionToken
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
closeDeleteDashboardModal(confirmDelete) {
|
||||
this.setState({ deleteDashboardModal: false });
|
||||
|
||||
|
@ -600,8 +617,10 @@ class Scenario extends React.Component {
|
|||
<TableColumn
|
||||
title=''
|
||||
width='200'
|
||||
editButton
|
||||
deleteButton
|
||||
exportButton
|
||||
onEdit={index => this.setState({ dashboardEditModal: true, modalDashboardData: this.state.dashboards[index] })}
|
||||
onDelete={(index) => this.setState({ deleteDashboardModal: true, modalDashboardData: this.state.dashboards[index], modalDashboardIndex: index })}
|
||||
onExport={index => this.exportDashboard(index)}
|
||||
/>
|
||||
|
@ -615,6 +634,7 @@ class Scenario extends React.Component {
|
|||
<div style={{ clear: 'both' }} />
|
||||
|
||||
<NewDashboardDialog show={this.state.newDashboardModal} onClose={data => this.closeNewDashboardModal(data)} />
|
||||
<EditDashboardDialog show={this.state.dashboardEditModal} dashboard={this.state.modalDashboardData} onClose={data => this.closeEditDashboardModal(data)} />
|
||||
<ImportDashboardDialog show={this.state.importDashboardModal} onClose={data => this.closeImportDashboardModal(data)} />
|
||||
|
||||
<DeleteDialog title="dashboard" name={this.state.modalDashboardData.name} show={this.state.deleteDashboardModal} onClose={(e) => this.closeDeleteDashboardModal(e)} />
|
||||
|
|
Loading…
Add table
Reference in a new issue