Skip to content

Commit

Permalink
Added basics of an API and frontend for managing type metadata
Browse files Browse the repository at this point in the history
Type metadata is information about types and fields, as hardcoded
in the app.
  • Loading branch information
mikesname committed Aug 2, 2024
1 parent 9de1af7 commit 6cf3826
Show file tree
Hide file tree
Showing 116 changed files with 20,110 additions and 16,611 deletions.
1 change: 0 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ module.exports = function (grunt) {
expand: true,
cwd: 'node_modules/vue/dist',
src: [
'vue.global.js',
'vue.runtime.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
8 changes: 5 additions & 3 deletions modules/admin/app/assets/css/admin/_admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,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
85 changes: 85 additions & 0 deletions modules/admin/app/assets/css/apps.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
@import "lib/docview-portal/css/portal.scss";

//Admin
@import "./admin/admin";
@import "./admin/forms";

// Styling common to docview VueJS applications

#app-error-notice {
position: absolute;
bottom: $margin-sm;
right: $margin-sm;
padding: $margin-xs $margin-sm;
z-index: 100;

.close {
margin-left: $margin-xs;
margin-top: -3px;
cursor: pointer;
}
}

.modal {
background-color: rgba(0, 0, 0, 0.1);
}

.modal-alert {
z-index: 1000;
display: flex !important;

.modal-content {
box-shadow: $box-shadow-lg;
}
}

.modal-content.resizable {
min-height: 30rem;
}

.modal-content.resizable > .modal-body {
display: flex;
flex-direction: column;
flex: 1;
}

.modal-resize-handle {
position: absolute;
right: 0;
bottom: 0;
display: inline;
width: 1rem;
height: 1rem;
cursor: nwse-resize;
}

.modal-resize-handle:after {
content:'';
display:block;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid $ehri-border-gray;
width: 2px;
height: 5px;
position: absolute;
pointer-events: none;
right: -1px;
bottom: 1px;
transform: rotate(135deg);
}

.options-form {
padding: $margin-md;
input:invalid {
background-color: lighten($danger, 40%);
}
}

.resizable .options-form {
flex: 1;
}

.options-form .small.form-text {
color: $text-muted;
}

85 changes: 2 additions & 83 deletions modules/admin/app/assets/css/datasets.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
@import "lib/docview-portal/css/portal.scss";

//Admin
@import "./admin/admin";
@import "./admin/forms";
@import "apps";

$active-table-row: #e7f1ff;

Expand Down Expand Up @@ -165,60 +161,6 @@ $active-table-row: #e7f1ff;
flex: 1;
justify-content: flex-end;
}

#app-error-notice {
position: absolute;
bottom: $margin-sm;
right: $margin-sm;
padding: $margin-xs $margin-sm;
z-index: 100;

.close {
margin-left: $margin-xs;
margin-top: -3px;
cursor: pointer;
}
}

.modal {
background-color: rgba(0, 0, 0, 0.1);
}

.modal-content.resizable {
min-height: 30rem;
}

.modal-content.resizable > .modal-body {
display: flex;
flex-direction: column;
flex: 1;
}

.modal-resize-handle {
position: absolute;
right: 0;
bottom: 0;
display: inline;
width: 1rem;
height: 1rem;
cursor: nwse-resize;
}

.modal-resize-handle:after {
content:'';
display:block;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid $ehri-border-gray;
width: 2px;
height: 5px;
position: absolute;
pointer-events: none;
right: -1px;
bottom: 1px;
transform: rotate(135deg);
}

#stage-tabs,
#dataset-manager-tabs
{
Expand All @@ -236,15 +178,6 @@ $active-table-row: #e7f1ff;
margin-bottom: $margin-sm;
}

.modal-alert {
z-index: 1000;
display: flex !important;

.modal-content {
box-shadow: $box-shadow-lg;
}
}

.file-picker {
display: flex;
align-items: center;
Expand Down Expand Up @@ -676,6 +609,7 @@ $active-table-row: #e7f1ff;
// strange gaps.
border-collapse: separate;
border-spacing: 0;
border: none; // table doesn't need a double border, however cells do have one
}

// Sticky headers. Note: applying `position: sticky` to `thead`
Expand Down Expand Up @@ -985,21 +919,6 @@ $active-table-row: #e7f1ff;
background-color: $gray-100;
}

.options-form {
padding: $margin-md;
input:invalid {
background-color: lighten($danger, 40%);
}
}

.resizable .options-form {
flex: 1;
}

.options-form .small.form-text {
color: $text-muted;
}

.data-manager-form-item {
margin-bottom: $margin-xs;
@include make-row();
Expand Down
14 changes: 14 additions & 0 deletions modules/admin/app/assets/css/dmeditor.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@import "apps";

$active-table-row: #e7f1ff;

.app-wrapper {
background-color: $white;
}

// Make content area scrollable, this prevents
// weird behaviour with modal popups
.app-content {
overflow: auto;
flex-basis: 0;
}
1 change: 1 addition & 0 deletions modules/admin/app/assets/css/vocabeditor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//Admin
@import "./admin/admin";
@import "./admin/forms";
//@import "apps"; // import this after compat check

.footer-buttons {
margin-top: $margin-sm;
Expand Down
2 changes: 1 addition & 1 deletion modules/admin/app/assets/js/datasets/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default {
</script>

<template>
<div class="app-content">
<div class="app-content-inner">
<div v-if="error" id="app-error-notice" class="alert alert-danger alert-dismissable">
<span class="close" v-on:click="error = null">&times;</span>
{{error}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export default {
<slot></slot>
</div>
<div class="modal-footer">
<button v-if="cancel" type="button" class="btn" v-on:click="$emit('close')" autofocus>{{ cancel }}</button>
<button v-if="accept" type="button" class="btn" v-bind:class="'btn-' + cls" v-on:click="$emit('accept')">
<button v-if="cancel" type="button" class="btn cancel" v-on:click="$emit('close')" autofocus>{{ cancel }}</button>
<button v-if="accept" type="button" class="btn accept" v-bind:class="'btn-' + cls" v-on:click="$emit('accept')">
{{ accept }}
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ export default {
<div v-if="tab === 'copy'" class="form-group">
<label class="form-label" for="from-dataset">
Source dataset
<span class="required-input">*</span>
<span class="input-mandatory">*</span>
</label>
<select v-model="copyFrom" class="form-control" id="from-dataset">
<option v-bind:value="null" disabled selected hidden>(required)</option>
Expand All @@ -352,7 +352,7 @@ export default {
<div v-if="tab === 'copy'" class="form-group">
<label class="form-label" for="copy-type">
Copy configuration
<span class="required-input">*</span>
<span class="input-mandatory">*</span>
</label>
<select v-model="copyType" class="form-control" id="copy-type">
<option v-bind:value="null" disabled>(required)</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default {
<div class="form-group">
<label class="form-label" for="opt-cleanup-msg">
Cleanup log message
<span class="required-input">*</span>
<span class="input-mandatory">*</span>
</label>
<input v-bind:disabled="cleanupRunning" type="text" v-model="data"
id="opt-cleanup-msg" class="form-control" placeholder="Heuristic cleanup for update on..."/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default {
<div class="form-group" v-if="info === null">
<label class="form-label" for="dataset-id">
Identifier
<span class="required-input">*</span>
<span class="input-mandatory">*</span>
</label>
<input v-model="id"
v-bind:class="{'is-invalid': !isValidIdentifier}"
Expand All @@ -157,14 +157,14 @@ export default {
<div class="form-group">
<label class="form-label" for="dataset-name">
Name
<span class="required-input">*</span>
<span class="input-mandatory">*</span>
</label>
<input type="text" v-model="name" id="dataset-name" class="form-control" placeholder="(required)"/>
</div>
<div class="form-group">
<label class="form-label" for="dataset-src">
Type
<span class="required-input">*</span>
<span class="input-mandatory">*</span>
</label>
<select v-model="src" class="form-control" id="dataset-src">
<option v-bind:value="null" disabled selected hidden>(required)</option>
Expand Down
2 changes: 1 addition & 1 deletion modules/admin/app/assets/js/datasets/dashboard-app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default {
</script>

<template>
<div id="dashboard-container" class="app-content">
<div id="dashboard-container" class="app-content-inner">
<div v-if="error" id="app-error-notice" class="alert alert-danger alert-dismissable">
<span class="close" v-on:click="error = null">&times;</span>
{{error}}
Expand Down
Loading

0 comments on commit 6cf3826

Please sign in to comment.