Skip to content

Commit

Permalink
Merge branch '0.1-devel' of https://github.com/alexstocker/sensorlogger
Browse files Browse the repository at this point in the history
… into 0.1-devel
  • Loading branch information
alexstocker committed Jul 2, 2021
2 parents 877fead + e00d7dc commit 66ad7db
Show file tree
Hide file tree
Showing 11 changed files with 250 additions and 314 deletions.
12 changes: 5 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### 0.1.1 UNRELEASED
* Added #101 PHP 8 Support
* Fixed creating device groups and types on the fly within device details sidebar
* Reworked and cleaned up JS #11
* Added #51 make dashboard widgets position persistant
* Modified #85 Allow 0 value @Kixunil
Expand All @@ -11,10 +12,7 @@
* Changed DeviceTypeList request type to GET
* Changed DeviceGroupList request type to GET
* Changed DataTypeList request type to GET

### 0.1.0.1 RELEASED
* Fixed problem in deployment pipeline causing broken owncloud marketplace archive. #76 Thanx to @ibaranov-cp


### 0.1.0 RELEASED
* Fixed GetDeviceDataTypes API call
* Renamed SensorDevices to Devices
Expand All @@ -28,7 +26,7 @@
* Added some more data validation #69 @vitoller
* Modified registerDevice set deviceType optional
* Modified registerDevice set deviceGroup optional
* Modified registerDevice set deviceParentGroup optional
* Modified registerDevice set deviceParentGroup optional
* Modified Device Sidebar content by adding some Labels
* Modified Device Sidebar Select boxes by making the ability to create on the fly more visible
* Added Share/Edit Icons to Devices. Removed Delete Icon because of already existing wipeOut action in Sidebar. #19 #74
Expand All @@ -42,7 +40,7 @@
* Added some more data validation #69 @vitoller
* Removed obsolete and undefined properties in LogExtended
* Adding some more requirements

### 0.0.10 REVOKED

### 0.0.9 RELEASED
Expand Down Expand Up @@ -73,7 +71,7 @@
* Add CONTRIBUTING.md
* Added CODE_OF_CONDUCT.md
* Updated README

### 0.0.5
* Fixed missing Select2 on oc v10.0.3, added DataTypes::deleteDeviceDataTypesByDeviceId, SensorDevices::isDeletable
* Added missing DataTypes::getDataTypesByUserId
Expand Down
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

<dependencies>
<owncloud min-version="10" max-version="11"/>
<nextcloud min-version="14" max-version="15"/>
<nextcloud min-version="14" max-version="21"/>
<database min-version="5.7">mysql</database>
<php min-version="7.0" max-version="8.0"/>
</dependencies>
Expand Down
21 changes: 18 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
{
"require-dev": {
"owncloud/coding-standard": "^1.0"
}
"name": "alexstocker/sensorlogger",
"description": "SensorLogger for owncloud",
"type": "project",
"version": "0.1.0",
"license": "AGPL",
"minimum-stability": "dev",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/alexstocker/sensorlogger.git"
}
],
"require": {
"php": ">=7.2"
},
"require-dev": {},
"autoload": {},
"autoload-dev": {}
}
48 changes: 40 additions & 8 deletions controller/sensorloggercontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,14 +636,22 @@ public function showDeviceDetails($id)
$groups = DeviceGroups::getDeviceGroups($this->userSession->getUser()->getUID(), $this->connection);
$types = DeviceTypes::getDeviceTypes($this->userSession->getUser()->getUID(), $this->connection);

$dataTypes = DataTypes::getDeviceDataTypesByDeviceId(
$this->userSession->getUser()->getUID(),
$id,
$this->connection
);


$policy = new ContentSecurityPolicy();
$policy->addAllowedFrameDomain("'self'");

$deviceDetails->setId($id);
$response = $this->returnJSON([
'deviceDetails' => $deviceDetails,
'groups' => $groups,
'types' => $types
'types' => $types,
'dataTypes' => $dataTypes
]);

$response->setContentSecurityPolicy($policy);
Expand All @@ -660,13 +668,37 @@ public function updateDevice($id)
$field = $this->request->getParam('name');
$value = $this->request->getParam('value');

try {
if(Devices::updateDevice($id, $field, $value, $this->connection)) {
return $this->returnJSON(['success' => true]);
}
} catch (Exception $exception) {
}
return $this->returnJSON(['success' => false]);
if (($field === 'group_id' || $field === 'group_parent_id') && strpos($value, 'create_') !== false) {
$deviceGroupId = DeviceGroups::insertSensorGroup(
$this->userSession->getUser()->getUID(),
str_replace('create_', '', $value),
$this->connection);
if (is_int($deviceGroupId)) {
$value = $deviceGroupId;
} else {
return $this->returnJSON(['success' => false]);
}
} else if ($field === 'type_id' && strpos($value, 'create_') !== false) {
$deviceTypeId = DeviceTypes::insertDeviceType(
$this->userSession->getUser()->getUID(),
str_replace('create_', '', $value),
$this->connection);
if (is_int($deviceTypeId)) {
$value = $deviceTypeId;
} else {
return $this->returnJSON(['success' => false]);
}
} else {

}

try {
if(Devices::updateDevice($id, $field, $value, $this->connection)) {
return $this->returnJSON(['success' => true]);
}
} catch (Exception $exception) {
}
return $this->returnJSON(['success' => false]);
}

/**
Expand Down
11 changes: 10 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -313,4 +313,13 @@ h2.widget-header a span.icon {
cursor: pointer;
/* box-shadow: 0 0 0 rgba(204,169,44, 0.4); */
animation: pulse 2s infinite;
}
}

.device-data-type-tag {
background-color: rgba(240, 240, 240, .9);
border-radius: 3px;
margin-bottom: 3px;
padding-left: 3px;
padding-right: 3px;
display: table;
}
Loading

0 comments on commit 66ad7db

Please sign in to comment.