json-object-editor
Version:
JOE the Json Object Editor | Platform Edition
117 lines (113 loc) • 12.2 kB
JavaScript
var schema = {
title : '${name}',
info:"An initiative is a particular group of work (projects and tasks) that align to larger goals of an group.",
default_schema:true,
// Curated summary for agents
summary:{
description:'Program of work aligning projects/tasks toward goals for a group.',
purpose:'Use initiatives to organize related delivery efforts under a theme. They reference a group and can be tagged and aligned to goals/areas.',
labelField:'name',
defaultSort:{ field:'joeUpdated', dir:'desc' },
searchableFields:['name','info','description','_id'],
allowedSorts:['joeUpdated','created','name','priority','group'],
relationships:{
outbound:[
{ field:'group', targetSchema:'group', cardinality:'one' },
{ field:'areas', targetSchema:'goal', cardinality:'many' },
{ field:'tags', targetSchema:'tag', cardinality:'many' }
],
inbound:{ graphRef:'server/relationships.graph.json' }
},
joeManagedFields:['created','joeUpdated'],
fields:[
{ name:'_id', type:'string', required:true },
{ name:'itemtype', type:'string', required:true, const:'initiative' },
{ name:'name', type:'string', required:true },
{ name:'info', type:'string' },
{ name:'description', type:'string' },
{ name:'group', type:'string', isReference:true, targetSchema:'group' },
{ name:'areas', type:'string', isArray:true, isReference:true, targetSchema:'goal' },
{ name:'goals', type:'objectList' },
{ name:'priority', type:'number', enumValues:[1,2,3,1000] },
{ name:'tags', type:'string', isArray:true, isReference:true, targetSchema:'tag' },
{ name:'joeUpdated', type:'string', format:'date-time', required:true },
{ name:'created', type:'string', format:'date-time', required:true }
]
},
menuicon:'<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="-100 -100 712 712" style="enable-background:new 0 0 512 512" xml:space="preserve"><style>.st0{fill:#fff}</style><path class="st0" d="M-1712 1169V919h460c-8.39 1.01-16.86 1.59-25.16 3.12-15.63 2.87-31.16 6.29-46.57 9.44 3.77 53.27 58.38 108.05 112.13 110.96 2.52-12.06 5.42-24.17 7.49-36.43 1.85-10.95 2.77-22.06 4.1-33.09v458h-248c2.74-1.8 5.87-3.2 8.15-5.46 15.38-15.22 31-30.23 45.72-46.08 17.59-18.95 28.12-41.47 29.69-67.57.32-5.25-1.11-10.61-1.85-16.96-3.49 2.5-5.58 4.12-7.79 5.56-25.74 16.83-51.33 33.9-77.37 50.27-6.74 4.23-10.54 7.38-10.12 16.78.61 13.63-2.12 27.45-3.94 41.12-1.64 12.28-.05 16.31 10.52 22.34h-257v-256c5.83 11.17 10.3 13.16 22.96 10.21 1.29-.3 2.59-.6 3.89-.9 14.64-3.42 29.41-5.95 44.47-4.04 3.46.44 4.97-.28 6.58-3.14 17.23-30.44 36.33-59.67 57.33-87.64.73-.98 1.27-2.1 2.67-4.46-6.15-.77-11.35-2.1-16.5-1.96-24.33.64-45.46 10.38-63.35 25.98-17.41 15.18-33.39 32.01-49.75 48.36-3.33 3.31-5.57 7.7-8.3 11.59zm358.02-225.49c-.49.18-1.45.46-2.36.85-36.12 15.36-68.96 36.09-99.25 60.92-56.83 46.57-101.92 103.1-140.16 165.45-1.51 2.46-1.36 3.89.71 5.91 9.54 9.31 18.96 18.74 28.27 28.28 2.17 2.22 3.94 2.27 6.93 1.59 9.99-2.29 20.09-5.1 30.24-5.56 26.93-1.21 46.09 16.82 47.72 43.67.72 11.82-1.47 23.21-5.64 34.22-.97 2.57-1.07 4.36 1.18 6.54 10.05 9.74 19.92 19.66 29.71 29.66 2 2.05 3.39 2.28 5.89.74 46.11-28.36 89.5-60.27 128.21-98.27 36.88-36.2 68.32-76.43 90.8-123.24 3.42-7.12 6.38-14.47 9.39-21.33-70.17-16.97-113.42-60.27-131.64-129.43zm-157.53 308.43c.09-15.91-6.34-22.26-20.07-21.39-16.29 1.04-30.23 7.72-41.62 19.27-9.82 9.96-19.45 20.13-28.68 30.64-18.28 20.8-35.2 42.62-47.9 67.4-3.83 7.46-3.05 14.48 1.94 19.35 4.89 4.77 11.76 5.58 18.95 1.8 6.03-3.17 12.01-6.5 17.75-10.15 30.12-19.15 56.4-42.95 81.53-68.06 11.2-11.2 17.23-25.1 18.1-38.86zm-37.04 97.84c7.02 8.97 13.53 11.6 21.78 7.54 15.31-7.54 30.34-15.65 45.12-23.33-8.27-8.27-16.32-16.32-24.11-24.1-13.85 12.92-28.19 26.28-42.79 39.89zm-42.56-124.99c-7.54-7.6-15.11-15.22-22.86-23.04-7.54 14.68-15.46 29.64-22.92 44.83-4.08 8.3-1.43 15.84 6.25 20.77 13.37-14.39 26.72-28.76 39.53-42.56z"/><path d="M-1200 973c-1.33 11.04-2.26 22.14-4.1 33.09-2.07 12.25-4.97 24.36-7.49 36.43-53.75-2.91-108.36-57.69-112.13-110.96 15.41-3.16 30.94-6.57 46.57-9.44 8.3-1.52 16.77-2.11 25.16-3.12h31c1.44.27 2.88.65 4.34.78 10.11.87 15.19 6 15.84 15.97.11 1.76.54 3.5.82 5.25-.01 10.67-.01 21.33-.01 32zM-1712 1169c2.73-3.89 4.97-8.28 8.29-11.59 16.37-16.35 32.35-33.18 49.75-48.36 17.89-15.6 39.02-25.34 63.35-25.98 5.16-.14 10.36 1.19 16.5 1.96-1.4 2.35-1.94 3.48-2.67 4.46-21 27.98-40.1 57.2-57.33 87.64-1.61 2.85-3.12 3.57-6.58 3.14-15.06-1.91-29.83.62-44.47 4.04-1.29.3-2.59.6-3.89.9-12.66 2.94-17.13.96-22.96-10.21.01-2 .01-4 .01-6zM-1455 1431c-10.57-6.03-12.16-10.06-10.52-22.34 1.83-13.67 4.55-27.49 3.94-41.12-.42-9.4 3.38-12.54 10.12-16.78 26.03-16.37 51.63-33.44 77.37-50.27 2.21-1.44 4.3-3.06 7.79-5.56.74 6.35 2.17 11.71 1.85 16.96-1.57 26.1-12.1 48.62-29.69 67.57-14.71 15.85-30.34 30.86-45.72 46.08-2.28 2.26-5.41 3.66-8.15 5.46h-6.99z"/><path class="st0" d="M-1200 941c-.28-1.75-.71-3.49-.82-5.25-.65-9.97-5.73-15.1-15.84-15.97-1.46-.13-2.89-.51-4.34-.78h21v22z"/><path d="M-1353.98 943.51c18.22 69.16 61.48 112.46 131.65 129.43-3 6.86-5.97 14.2-9.39 21.33-22.48 46.81-53.93 87.05-90.8 123.24-38.71 38-82.1 69.91-128.21 98.27-2.5 1.54-3.89 1.3-5.89-.74-9.79-10-19.66-19.92-29.71-29.66-2.25-2.18-2.15-3.97-1.18-6.54 4.17-11.02 6.35-22.4 5.64-34.22-1.63-26.85-20.78-44.88-47.72-43.67-10.15.46-20.25 3.27-30.24 5.56-2.99.69-4.76.63-6.93-1.59-9.31-9.54-18.73-18.97-28.27-28.28-2.08-2.03-2.22-3.45-.71-5.91 38.24-62.34 83.32-118.88 140.16-165.45 30.29-24.82 63.13-45.56 99.25-60.92.9-.39 1.85-.68 2.35-.85zm46.58 157.61c-.23-41.45-34.24-75.27-75.28-74.85-41.62.42-74.88 34.09-74.54 75.45.34 41.68 33.84 74.75 75.39 74.42 41.29-.34 74.66-33.97 74.43-75.02z"/><path d="M-1511.51 1251.94c-.87 13.75-6.9 27.66-18.11 38.86-25.12 25.11-51.41 48.91-81.53 68.06-5.75 3.65-11.72 6.98-17.75 10.15-7.19 3.78-14.05 2.97-18.95-1.8-4.99-4.87-5.77-11.88-1.94-19.35 12.7-24.78 29.62-46.6 47.9-67.4 9.23-10.5 18.86-20.68 28.68-30.64 11.39-11.56 25.33-18.24 41.62-19.27 13.74-.87 20.17 5.48 20.08 21.39zM-1548.55 1349.78l42.79-39.89c7.78 7.78 15.83 15.83 24.11 24.1-14.77 7.68-29.8 15.79-45.12 23.33-8.25 4.06-14.76 1.43-21.78-7.54zM-1591.11 1224.79c-12.81 13.79-26.16 28.16-39.54 42.56-7.68-4.93-10.32-12.47-6.25-20.77 7.46-15.19 15.39-30.15 22.92-44.83 7.76 7.82 15.33 15.45 22.87 23.04z"/><path class="st0" d="M-1307.4 1101.12c.23 41.05-33.14 74.68-74.44 75.01-41.54.33-75.04-32.74-75.39-74.42-.34-41.35 32.93-75.02 74.54-75.45 41.05-.41 75.06 33.41 75.29 74.86zm-119.79.09c-.06 24.69 19.9 44.8 44.62 44.93 24.75.14 45.37-20.45 45.11-45.04-.27-24.65-20.57-44.88-44.96-44.8-24.58.08-44.71 20.27-44.77 44.91z"/><path d="M-1427.19 1101.21c.06-24.64 20.19-44.83 44.77-44.91 24.39-.08 44.7 20.16 44.96 44.8.26 24.58-20.36 45.18-45.11 45.04-24.72-.14-44.68-20.24-44.62-44.93zM481.67 82.16c-1.19 9.84-2.01 19.75-3.66 29.52-1.84 10.93-4.44 21.73-6.68 32.49-47.94-2.6-96.65-51.46-100.01-98.97 13.74-2.81 27.6-5.86 41.54-8.42 7.4-1.36 14.95-1.88 22.44-2.78h27.65c1.29.24 2.57.58 3.87.69 9.02.78 13.55 5.35 14.13 14.25.1 1.57.48 3.12.73 4.68-.01 9.52-.01 19.03-.01 28.54zM25 256.98c2.44-3.47 4.43-7.39 7.39-10.34 14.6-14.58 28.85-29.59 44.38-43.13 15.96-13.91 34.8-22.6 56.51-23.18 4.6-.12 9.24 1.06 14.72 1.75-1.25 2.1-1.73 3.1-2.39 3.98a724.98 724.98 0 0 0-51.14 78.17c-1.44 2.54-2.79 3.19-5.87 2.8-13.43-1.7-26.6.55-39.66 3.6-1.15.27-2.31.54-3.47.81-11.3 2.63-15.28.85-20.48-9.11.01-1.78.01-3.56.01-5.35zM254.23 490.67c-9.43-5.38-10.85-8.97-9.38-19.93 1.63-12.19 4.06-24.52 3.52-36.68-.37-8.39 3.02-11.19 9.03-14.96 23.22-14.6 46.05-29.82 69.01-44.83 1.97-1.29 3.84-2.73 6.95-4.96.66 5.66 1.93 10.44 1.65 15.13-1.4 23.28-10.79 43.37-26.48 60.27-13.12 14.14-27.06 27.52-40.77 41.1-2.03 2.01-4.83 3.26-7.27 4.87-2.1-.01-4.18-.01-6.26-.01z"/><path d="M344.32 55.86c16.25 61.69 54.83 100.3 117.42 115.44-2.68 6.11-5.32 12.67-8.37 19.02-20.05 41.75-48.1 77.64-80.99 109.92-34.53 33.89-73.23 62.36-114.36 87.65-2.23 1.37-3.47 1.16-5.25-.66-8.73-8.92-17.54-17.77-26.5-26.46-2.01-1.95-1.92-3.54-1.05-5.83 3.72-9.82 5.67-19.98 5.03-30.52-1.45-23.94-18.54-40.03-42.56-38.95-9.05.41-18.06 2.91-26.97 4.96-2.67.61-4.25.57-6.18-1.42-8.3-8.51-16.71-16.92-25.21-25.22-1.85-1.81-1.98-3.08-.64-5.27 34.1-55.6 74.32-106.03 125.01-147.57 27.02-22.14 56.31-40.64 88.53-54.33.8-.35 1.66-.6 2.09-.76zm41.56 140.58c-.21-36.97-30.54-67.14-67.14-66.76-37.12.38-66.79 30.41-66.49 67.29.31 37.18 30.18 66.67 67.24 66.38 36.83-.3 66.59-30.3 66.39-66.91z"/><path d="M203.82 330.96c-.78 12.27-6.15 24.67-16.15 34.66-22.41 22.4-45.85 43.63-72.71 60.7-5.13 3.26-10.45 6.23-15.83 9.06-6.41 3.37-12.53 2.65-16.9-1.61-4.45-4.34-5.14-10.6-1.73-17.26 11.33-22.1 26.42-41.57 42.73-60.12 8.23-9.37 16.82-18.44 25.58-27.32 10.16-10.31 22.59-16.27 37.12-17.19 12.24-.78 17.97 4.89 17.89 19.08zM170.79 418.22c13.02-12.14 25.81-24.06 38.17-35.58l21.5 21.5c-13.18 6.85-26.58 14.08-40.24 20.81-7.37 3.62-13.17 1.27-19.43-6.73zM132.83 306.75c-11.43 12.3-23.33 25.12-35.26 37.96-6.85-4.4-9.21-11.13-5.57-18.53 6.66-13.55 13.72-26.89 20.44-39.99 6.91 6.98 13.66 13.78 20.39 20.56zM279.03 196.52c.05-21.98 18.01-39.98 39.93-40.05 21.76-.07 39.87 17.98 40.1 39.96.24 21.93-18.16 40.29-40.24 40.17-22.04-.13-39.85-18.06-39.79-40.08z"/></svg>',
listView:{
title: '<joe-title>${name}</joe-title><joe-subtitle>${info}</joe-subtitle>',
listWindowTitle: 'Initiatives'
},
sorter:['priority','group','name'],
subsets:function(){
var sets = [
{group_start:'groups',collapsed:false}
];
_joe.Data.group.sortBy('name').map(function(g){
sets.push({name:g.name,filter:{group:g._id}});
})
sets.push({group_end:'groups'});
return sets;
},
filters:function(){
var stats = [].concat(_joe.Filter.Options.tags({group:'tags',collapsed:true}));
return stats;
},
stripeColor:function(item){
if(item.priority && item.priority < 100){
return {
title:`P${item.priority}`,
color:_joe.Colors.priority[item.priority]
};
}
},
itemExpander:function(g){
var projects = _joe.Data.project.where({aligned_goals:{$in:[g._id]}});
var html =`<joe-subtitle>${projects.length} projects</joe-subtitle>
${projects.map(p=>{
return _joe.renderFieldListItem(p,null,'project');
}).join('')}
`
return html;
},
fields:[
'name',
'info',
{extend:'group',specs:{rerender:'areas'}},
{section_start:'objective'},
'description',
{name:'areas',display:'Areas of Focus',comment:'how does this latter up to aligned GOALS?',
type:'group',
values:function(i){
if(!i.group){
return _joe.Data.goal;
}else{
return _joe.Data.goal.where({group:i.group});
}
},
icon:'goal',blank:true},
{name:'goals',type:'objectList',
template:function(obj,subobj){
return '<joe-title >${name}</joe-title>'
+'<joe-subtext>${metric}</joe-subtext>';
},
properties:['name',{name:'metric',width:'40%'}]
},
{section_end:'objective'},
{section_start:'system',collapsed:true},
'_id','created','itemtype',
{section_end:'system'},
{sidebar_start:'right'},
'reports',
'priority',
{section_start:'tags', collapsed:function(i){
return !(i.tags || i.tags.length)
}},
'tags',
{section_end:'tags'},
{sidebar_end:'right'}
],
idprop : "_id"
};
module.exports = schema;