Skip to content

Commit 480cec7

Browse files
committed
Merge branch 'master' into create-volume-v2
2 parents 993044c + 9e18403 commit 480cec7

File tree

12 files changed

+68
-88
lines changed

12 files changed

+68
-88
lines changed

.env.example

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ DB_DATABASE="biigle"
2121
DB_USERNAME="biigle"
2222
DB_PASSWORD="secret"
2323

24-
VECTOR_DB_HOST="vector_database"
25-
VECTOR_DB_PORT=5432
26-
VECTOR_DB_DATABASE="biigle"
27-
VECTOR_DB_USERNAME="biigle"
28-
VECTOR_DB_PASSWORD="secret"
29-
3024
VOLUME_ADMIN_STORAGE_DISKS=local
3125

3226
BROADCAST_DRIVER=pusher

.github/workflows/test.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ jobs:
3737
- name: Start test database
3838
run: |
3939
docker-compose up -d --no-build database_testing
40-
docker-compose up -d --no-build vector_database_testing
4140
sleep 5
4241
4342
- name: Run tests
@@ -80,7 +79,6 @@ jobs:
8079
- name: Start test database
8180
run: |
8281
docker-compose up -d --no-build database_testing
83-
docker-compose up -d --no-build vector_database_testing
8482
sleep 5
8583
8684
- name: Run tests

DEVELOPING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ composer create-project biigle/core:dev-dev-modules \
3434

3535
Note the `--ignore-platform-reqs` flag to keep Composer from complaining about missing requirements. These requirements will be met by the Docker containers.
3636

37-
This will set up the project in the `dev-modules` branch of this repository. The `dev-modules` branch is configured with all BIIGLE modules which makes it easy to start module development. If you want to develop a feature directly in `biigle/core`, please switch to the `master` branch (or create your own branch based on `master`).
37+
This will set up the project in the `dev-modules` branch of this repository. The `dev-modules` branch is configured with all BIIGLE modules which makes it easy to start module development. If you want to develop a feature directly in `biigle/core`, please switch to the `master` branch (or create your own branch based on `master`). Pull requests from a `dev-modules`-based branch will not be accepted.
3838

3939
### 2. Build and run the application
4040

config/database.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,6 @@
7878
'sslmode' => 'prefer',
7979
],
8080

81-
'pgvector' => [
82-
'driver' => 'pgsql',
83-
'url' => env('VECTOR_DATABASE_URL'),
84-
'host' => env('VECTOR_DB_HOST', 'localhost'),
85-
'port' => env('VECTOR_DB_PORT', '5432'),
86-
'database' => env('VECTOR_DB_DATABASE', 'forge'),
87-
'username' => env('VECTOR_DB_USERNAME', 'forge'),
88-
'password' => env('VECTOR_DB_PASSWORD', ''),
89-
'charset' => 'utf8',
90-
'prefix' => '',
91-
'prefix_indexes' => true,
92-
'search_path' => 'public',
93-
'sslmode' => 'prefer',
94-
],
95-
9681
'sqlsrv' => [
9782
'driver' => 'sqlsrv',
9883
'url' => env('DATABASE_URL'),

database/migrations/2022_08_03_000000_create_vector_extension.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@
1111
*/
1212
public function up()
1313
{
14-
DB::connection('pgvector')->statement('CREATE EXTENSION IF NOT EXISTS vector');
14+
// The pgvector connection was removed later so it may not always be present.
15+
// There is a second migration that enables pgvector for the default connection.
16+
// See: https://github.com/biigle/maia/pull/150
17+
if (!is_null(config('database.connections-pgvector'))) {
18+
DB::connection('pgvector')
19+
->statement('CREATE EXTENSION IF NOT EXISTS vector');
20+
21+
}
1522
}
1623

1724
/**
@@ -21,6 +28,10 @@ public function up()
2128
*/
2229
public function down()
2330
{
24-
DB::connection('pgvector')->statement('DROP EXTENSION IF EXISTS vector');
31+
if (!is_null(config('database.connections-pgvector'))) {
32+
DB::connection('pgvector')
33+
->statement('DROP EXTENSION IF NOT EXISTS vector');
34+
35+
}
2536
}
2637
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Support\Facades\DB;
5+
6+
return new class extends Migration {
7+
/**
8+
* Run the migrations.
9+
*
10+
* @return void
11+
*/
12+
public function up()
13+
{
14+
DB::statement('CREATE EXTENSION IF NOT EXISTS vector');
15+
}
16+
17+
/**
18+
* Reverse the migrations.
19+
*
20+
* @return void
21+
*/
22+
public function down()
23+
{
24+
DB::statement('DROP EXTENSION IF NOT EXISTS vector');
25+
}
26+
};

docker-compose.yml

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ services:
2222
depends_on:
2323
- app
2424
- database_testing
25-
- vector_database_testing
2625
build:
2726
context: ./
2827
dockerfile: .docker/worker.dockerfile
@@ -66,7 +65,7 @@ services:
6665

6766
# The database
6867
database:
69-
image: postgres:14-alpine
68+
image: ghcr.io/biigle/pgvector
7069
volumes:
7170
- dbdata:/var/lib/postgresql/data
7271
- ./:/data
@@ -77,28 +76,7 @@ services:
7776
ports:
7877
- "54320:5432"
7978

80-
vector_database:
81-
image: ghcr.io/biigle/pgvector
82-
volumes:
83-
- vecdbdata:/var/lib/postgresql/data
84-
- ./:/data
85-
environment:
86-
- "POSTGRES_DB=biigle"
87-
- "POSTGRES_USER=biigle"
88-
- "POSTGRES_PASSWORD=secret"
89-
ports:
90-
- "54321:5432"
91-
9279
database_testing:
93-
image: postgres:14-alpine
94-
tmpfs:
95-
- /var/lib/postgresql/data
96-
environment:
97-
- "POSTGRES_DB=biigle"
98-
- "POSTGRES_USER=biigle"
99-
- "POSTGRES_PASSWORD=secret"
100-
101-
vector_database_testing:
10280
image: ghcr.io/biigle/pgvector
10381
tmpfs:
10482
- /var/lib/postgresql/data
@@ -109,5 +87,3 @@ services:
10987

11088
volumes:
11189
dbdata:
112-
vecdbdata:
113-

phpunit.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,5 @@
2929
<env name="DB_DATABASE" value="biigle"/>
3030
<env name="DB_USERNAME" value="biigle"/>
3131
<env name="DB_PASSWORD" value="secret"/>
32-
<env name="VECTOR_DB_HOST" value="vector_database_testing"/>
33-
<env name="VECTOR_DB_DATABASE" value="biigle"/>
34-
<env name="VECTOR_DB_USERNAME" value="biigle"/>
35-
<env name="VECTOR_DB_PASSWORD" value="secret"/>
3632
</php>
3733
</phpunit>

resources/assets/js/volumes/components/filterListComponent.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<strong>with<span v-if="rule.negate">out</span></strong>
44
<span v-text="name"></span>
55
<strong v-if="dataName" v-text="dataName"></strong>
6+
<span class="text-muted" v-text="fileCount"></span>
67
</span>
78
</template>
89

@@ -18,18 +19,28 @@ export default {
1819
type: Object,
1920
required: true,
2021
},
22+
type: {
23+
type: String,
24+
required: true,
25+
},
2126
},
2227
data() {
2328
return {
2429
name: this.rule.id,
2530
};
2631
},
2732
computed: {
33+
fileCount() {
34+
let typeForm = this.rule.sequence.length === 1 ? `${this.type}` : `${this.type}s`;
35+
return `(${this.rule.sequence.length} ${typeForm})`;
36+
},
2837
dataName() {
2938
if (this.rule.data) {
30-
return this.rule.data.name;
39+
if(this.rule.data.name) {
40+
return this.rule.data.name;
41+
}
3142
}
32-
43+
3344
return '';
3445
},
3546
},

resources/assets/js/volumes/components/filterTab.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,22 @@ export default {
161161
162162
return null;
163163
},
164+
itemsAreEqual(itemData, ruleData) {
165+
// handle Array
166+
if (itemData !== null && ruleData !== null) {
167+
if (itemData instanceof Array) {
168+
return itemData.length === ruleData.length &&
169+
itemData.every((val, index) => val === ruleData[index]);
170+
}
171+
}
172+
// handle all other types (Objects, null)
173+
return itemData === ruleData;
174+
},
164175
hasRule(rule) {
165-
return this.rules.findIndex(function (item) {
176+
return this.rules.findIndex((item) => {
166177
return item.id === rule.id &&
167178
item.negate === rule.negate &&
168-
item.data === rule.data;
179+
this.itemsAreEqual(item.data, rule.data);
169180
}) !== -1;
170181
},
171182
addRule(data) {
@@ -176,7 +187,6 @@ export default {
176187
data: data,
177188
negate: this.negate,
178189
};
179-
180190
if (this.hasRule(rule)) return;
181191
182192
this.startLoading();

0 commit comments

Comments
 (0)