File tree Expand file tree Collapse file tree
src/main/resources/static/js/pages/editor Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import accordions from "../../shared/modules/accordions.js" ;
2- import { identifierValid , widgetsValid } from "./utils/editorValidations.js" ;
2+ import {
3+ identifierValid ,
4+ widgetsValid ,
5+ sourcesValid ,
6+ } from "./utils/editorValidations.js" ;
37import state from "./utils/editorState.js" ;
48import {
59 createSource ,
@@ -137,7 +141,8 @@ export default class Editor {
137141 widgets : state . grid . save ( false ) ,
138142 } ;
139143
140- const ok = identifierValid ( config ) && widgetsValid ( config ) ;
144+ const ok =
145+ identifierValid ( config ) && widgetsValid ( config ) && sourcesValid ( config ) ;
141146
142147 if ( ok && pipelines . includes ( config . id ) ) {
143148 state . modal . confirm (
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { getAnnotations } from "../../../api/annotations.api.js";
33export default class Source {
44 static defaultConfig = {
55 uri : "" ,
6- createsGenerators : [ ] ,
6+ settings : { } ,
77 } ;
88 static formConfig = {
99 uri : {
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ export default class SourceController {
1414 this . item = item ;
1515 }
1616
17- init ( generators ) {
17+ init ( generators = [ ] ) {
1818 const buttons = this . root . querySelectorAll ( "button" ) ;
1919 const options = this . root . querySelector ( ".dv-dropdown-menu" ) ;
2020 const body = this . root . querySelector ( ".dv-source-card-body" ) ;
Original file line number Diff line number Diff line change @@ -42,3 +42,21 @@ export function widgetsValid(config) {
4242 return false ;
4343 }
4444}
45+
46+ export function sourcesValid ( config ) {
47+ const empty = config . sources . filter ( ( source ) => source . uri === "" ) ;
48+
49+ if ( empty . length === 1 ) {
50+ state . modal . alert (
51+ "Empty Sources" ,
52+ `There is one source with no annotation type selected.` ,
53+ ) ;
54+ } else if ( empty . length > 1 ) {
55+ state . modal . alert (
56+ "Empty Sources" ,
57+ `There are ${ empty . length } sources with no annotation type selected.` ,
58+ ) ;
59+ }
60+
61+ return empty . length === 0 ;
62+ }
You can’t perform that action at this time.
0 commit comments