Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity Type metadata for field auditing #1509

Merged
merged 4 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
with:
java-version: "[email protected]"

- name: Build the docker-compose stack
run: docker-compose up -d
- name: Build the docker compose stack
run: docker compose up -d

- name: Cache node modules
uses: actions/cache@v2
Expand Down
10 changes: 9 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,19 @@ module.exports = function (grunt) {
expand: true,
cwd: 'node_modules/vue/dist',
src: [
'vue.global.js',
'vue.runtime.global.js'
],
dest: paths.adminJsLib
},
{
expand: true,
cwd: 'node_modules/vue-i18n/dist',
src: [
// not using runtime 'cos we need the messages compiler
'vue-i18n.global.js'
],
dest: paths.adminJsLib
},
],
},
},
Expand Down
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ val coreDependencies = backendDependencies ++ Seq(
"com.typesafe.akka" %% "akka-http-xml" % akkaHttpVersion,

// Anorm DB lib
"org.playframework.anorm" %% "anorm" % "2.6.10",
"org.playframework.anorm" %% "anorm-postgres" % "2.6.10",
"org.playframework.anorm" %% "anorm" % "2.7.0",
"org.playframework.anorm" %% "anorm-postgres" % "2.7.0",

// Commons IO
"commons-io" % "commons-io" % "2.5",
Expand Down
33 changes: 33 additions & 0 deletions conf/evolutions/default/1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,42 @@ CREATE INDEX coreference_value_text ON coreference_value(text);
CREATE INDEX coreference_value_target_id ON coreference_value(target_id);
CREATE INDEX coreference_value_set_id ON coreference_value(set_id);

CREATE TABLE entity_type_meta(
entity_type VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
description TEXT,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated TIMESTAMP
);

CREATE INDEX entity_type_meta_entity_type ON entity_type_meta(entity_type);

CREATE TABLE field_meta(
entity_type VARCHAR(50) NOT NULL,
id VARCHAR(50) NOT NULL,
name VARCHAR(100) NOT NULL,
description TEXT,
usage VARCHAR(50),
category VARCHAR(50),
default_val TEXT,
see_also TEXT[],
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated TIMESTAMP,
PRIMARY KEY (entity_type, id),
CONSTRAINT field_meta_entity_type
FOREIGN KEY (entity_type)
REFERENCES entity_type_meta (entity_type)
ON DELETE CASCADE
ON UPDATE CASCADE
);

CREATE INDEX field_meta_entity_type ON field_meta(entity_type);
CREATE INDEX field_meta_id ON field_meta(id);

# --- !Downs

DROP TABLE IF EXISTS field_meta CASCADE;
DROP TABLE IF EXISTS entity_type_meta CASCADE;
DROP TABLE IF EXISTS coreference CASCADE;
DROP TABLE IF EXISTS coreference_value CASCADE;
DROP TABLE IF EXISTS cleanup_action_redirect CASCADE;
Expand Down
104 changes: 0 additions & 104 deletions conf/schema/pg.sql

This file was deleted.

35 changes: 35 additions & 0 deletions etc/db_migrations/20240807_add_entity_meta_tables.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
BEGIN TRANSACTION;

CREATE TABLE entity_type_meta(
entity_type VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
description TEXT,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated TIMESTAMP
);

CREATE INDEX entity_type_meta_entity_type ON entity_type_meta(entity_type);

CREATE TABLE field_meta(
entity_type VARCHAR(50) NOT NULL,
id VARCHAR(50) NOT NULL,
name VARCHAR(100) NOT NULL,
description TEXT,
usage VARCHAR(50),
category VARCHAR(50),
default_val TEXT,
see_also TEXT[],
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated TIMESTAMP,
PRIMARY KEY (entity_type, id),
CONSTRAINT field_meta_entity_type
FOREIGN KEY (entity_type)
REFERENCES entity_type_meta (entity_type)
ON DELETE CASCADE
ON UPDATE CASCADE
);

CREATE INDEX field_meta_entity_type ON field_meta(entity_type);
CREATE INDEX field_meta_id ON field_meta(id);

COMMIT;
69 changes: 56 additions & 13 deletions modules/admin/app/assets/css/admin/_admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,36 @@ body > .admin-content > .flash {
background-color: $gray-100;
}
}
}

.markdown-helper {
font-style: italic;
cursor: help;
}
.markdown-helper {
font-style: italic;
cursor: pointer;
}

.inline-remove > a:hover {
text-decoration: none;
cursor: pointer;
}

.form-legend {
font-size: $font-size-base;

dl {
display: flex;
flex-wrap: wrap;

dt {
@include make-col(3);
font-weight: bold;
}

dd {
@include make-col(9);
}
}
}

.address-form,
.concept-description-form {
background-color: $gray-100;
Expand Down Expand Up @@ -127,8 +145,11 @@ body > .admin-content > .flash {
padding-top: $margin-md;
}

.add-address {
.add-address,
.add-concept
{
float: right;
margin-bottom: $margin-md;
}

.admin-help-notice {
Expand Down Expand Up @@ -315,12 +336,18 @@ pre.code-format {
margin-bottom: $margin-md;
}

.add-description {
margin-bottom: $margin-md;
@include clearfix();
a {
float: right;
.control-elements {
.add-inline-element:not(.btn) {
display: block;
background-color: $gray-100;
border-bottom: 1px solid darken($gray-100, 5%);
padding: 0 $margin-xs;
color: $gray-700;
}
.add-inline-element:hover:not(.btn) {
background-color: darken($gray-100, 5%);
}

}

.inline-element-block-controls {
Expand Down Expand Up @@ -436,6 +463,20 @@ pre.code-format {
}
}

// Metadata validation
.metadata-validation {
summary {
font-size: $font-size-lg;
@extend .alert, .alert-warning;
}
.validation-errors {
@extend .alert, .alert-danger;
}
.validation-warnings {
@extend .alert, .alert-warning;
}
}

// Vue Single-page applications
%expanding-row {
display: flex;
Expand Down Expand Up @@ -470,11 +511,13 @@ body.spa-app {
}

.app-content {
@extend %expanding-column;
}

.app-content-inner {
@include make-container();
@include make-container-max-widths();
flex: 1;
display: flex;
flex-direction: column;
@extend %expanding-column;
margin-top: $margin-md;
}

Expand Down
Loading
Loading