Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions lib/Migration/Version000004Date20210331142734.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;

Expand Down Expand Up @@ -34,20 +35,20 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt

if (!$schema->hasTable('approval_rules')) {
$table = $schema->createTable('approval_rules');
$table->addColumn('id', 'integer', [
$table->addColumn('id', Types::INTEGER, [
'autoincrement' => true,
'notnull' => true,
'length' => 4,
]);
$table->addColumn('tag_pending', 'integer', [
$table->addColumn('tag_pending', Types::INTEGER, [
'notnull' => true,
'length' => 4,
]);
$table->addColumn('tag_approved', 'integer', [
$table->addColumn('tag_approved', Types::INTEGER, [
'notnull' => true,
'length' => 4,
]);
$table->addColumn('tag_rejected', 'integer', [
$table->addColumn('tag_rejected', Types::INTEGER, [
'notnull' => true,
'length' => 4,
]);
Expand All @@ -56,20 +57,20 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt

if (!$schema->hasTable('approval_rule_requesters')) {
$table = $schema->createTable('approval_rule_requesters');
$table->addColumn('id', 'integer', [
$table->addColumn('id', Types::INTEGER, [
'autoincrement' => true,
'notnull' => true,
'length' => 4,
]);
$table->addColumn('rule_id', 'integer', [
$table->addColumn('rule_id', Types::INTEGER, [
'notnull' => true,
'length' => 4,
]);
$table->addColumn('entity_type', 'integer', [
$table->addColumn('entity_type', Types::INTEGER, [
'notnull' => true,
'length' => 4,
]);
$table->addColumn('entity_id', 'string', [
$table->addColumn('entity_id', Types::STRING, [
'notnull' => true,
'length' => 300,
]);
Expand All @@ -78,20 +79,20 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt

if (!$schema->hasTable('approval_rule_approvers')) {
$table = $schema->createTable('approval_rule_approvers');
$table->addColumn('id', 'integer', [
$table->addColumn('id', Types::INTEGER, [
'autoincrement' => true,
'notnull' => true,
'length' => 4,
]);
$table->addColumn('rule_id', 'integer', [
$table->addColumn('rule_id', Types::INTEGER, [
'notnull' => true,
'length' => 4,
]);
$table->addColumn('entity_type', 'integer', [
$table->addColumn('entity_type', Types::INTEGER, [
'notnull' => true,
'length' => 4,
]);
$table->addColumn('entity_id', 'string', [
$table->addColumn('entity_id', Types::STRING, [
'notnull' => true,
'length' => 300,
]);
Expand Down
5 changes: 3 additions & 2 deletions lib/Migration/Version000004Date20210427102750.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
use OCP\IDBConnection;
Expand Down Expand Up @@ -43,9 +44,9 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
$table = $schema->getTable('approval_rules');
$table->addColumn('description', 'text', [
$table->addColumn('description', Types::TEXT, [
'notnull' => true,
'default' => '',
'default' => '???',
]);
return $schema;
}
Expand Down
13 changes: 7 additions & 6 deletions lib/Migration/Version000004Date20210427142434.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;

Expand Down Expand Up @@ -34,27 +35,27 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt

if (!$schema->hasTable('approval_activity')) {
$table = $schema->createTable('approval_activity');
$table->addColumn('id', 'integer', [
$table->addColumn('id', Types::INTEGER, [
'autoincrement' => true,
'notnull' => true,
'length' => 4,
]);
$table->addColumn('file_id', 'integer', [
$table->addColumn('file_id', Types::INTEGER, [
'notnull' => true,
'length' => 4,
]);
$table->addColumn('rule_id', 'integer', [
$table->addColumn('rule_id', Types::INTEGER, [
'notnull' => true,
'length' => 4,
]);
$table->addColumn('user_id', 'string', [
$table->addColumn('user_id', Types::STRING, [
'notnull' => true,
'length' => 300,
]);
$table->addColumn('new_state', 'integer', [
$table->addColumn('new_state', Types::INTEGER, [
'notnull' => true,
]);
$table->addColumn('timestamp', 'integer', [
$table->addColumn('timestamp', Types::INTEGER, [
'notnull' => true,
'length' => 4,
]);
Expand Down
8 changes: 6 additions & 2 deletions src/components/AdminSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ export default {
},
invalidRuleMessage() {
const newRule = this.newRule
const noMissingField = newRule.tagPending && newRule.tagApproved && newRule.tagRejected && newRule.approvers.length > 0
const noMissingField = newRule.description
&& newRule.tagPending
&& newRule.tagApproved
&& newRule.tagRejected
&& newRule.approvers.length > 0
if (!noMissingField) {
return t('approval', 'All fields are required')
}
Expand Down Expand Up @@ -230,7 +234,7 @@ export default {
},
onRuleInput(id, rule) {
// save if all values are set
if (rule.tagPending && rule.tagApproved && rule.tagRejected && rule.approvers.length > 0) {
if (rule.description && rule.tagPending && rule.tagApproved && rule.tagRejected && rule.approvers.length > 0) {
this.savingRule = true
const req = {
tagPending: rule.tagPending,
Expand Down