Skip to content

Commit

Permalink
Rework various forms and integrate type metadata into forms
Browse files Browse the repository at this point in the history
This is done by extending the existing form config system, now
called field hints, which is integrated into various action builders
for editing and saving forms.
  • Loading branch information
mikesname committed Aug 7, 2024
1 parent 6cf3826 commit d26d6fb
Show file tree
Hide file tree
Showing 143 changed files with 8,190 additions and 1,055 deletions.
9 changes: 9 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,15 @@ module.exports = function (grunt) {
],
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
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;
61 changes: 51 additions & 10 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
27 changes: 27 additions & 0 deletions modules/admin/app/assets/css/dmeditor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,30 @@ $active-table-row: #e7f1ff;
overflow: auto;
flex-basis: 0;
}

.section {
background-color: $gray-100;
font-weight: bold;
}

.fm-list td.fm-actions {
width: 5rem;
}

.fm-see-also a + a {
display: inline-block;
}

.fm-usage {
white-space: nowrap;

}

.fm-list td:last-child a {
margin-left: $margin-xs;
}

#delete-metadata {
margin-right: auto;
}

6 changes: 5 additions & 1 deletion modules/admin/app/assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ jQuery(function ($) {
event.preventDefault();

var container = $(event.target).closest(".inline-formset");
var set = container.children(".inline-element-list");
var set = container.children(".control-elements").children(".inline-element-list").first();
var prefix = container.data("prefix");
if (!prefix) {
throw "No prefix found for formset";
Expand All @@ -212,6 +212,10 @@ jQuery(function ($) {

// And a help popover
addPopover($elem.find("textarea,input"));

// Focus the first input
$elem.find("input,textarea").first().focus();

}).on("click", ".remove-inline-element", function (event) {
event.preventDefault();
$(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import _takeWhile from 'lodash/takeWhile';
import _find from 'lodash/find';
import {DataTransformation} from "../types";
let initialConvertState = function (config) {
return {
ingesting: {},
Expand Down
Loading

0 comments on commit d26d6fb

Please sign in to comment.