Skip to content

Commit

Permalink
metric with foo list
Browse files Browse the repository at this point in the history
  • Loading branch information
shackbarth committed Aug 21, 2014
1 parent b7524a2 commit 7b00911
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source/xtuple-field-dev-sample-2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
xtuple-field-dev-sample-2
================

### Overview

Customer says to you: I want a read-only, searchable list of the `metric` table in
the setup area. But I also need some `foo` on every record.
59 changes: 59 additions & 0 deletions source/xtuple-field-dev-sample-2/client/core.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*jshint indent:2, curly:true, eqeqeq:true, immed:true, latedef:true,
newcap:true, noarg:true, regexp:true, undef:true, strict:true, trailing:true,
white:true*/
/*global XT:true, XM:true, XV:true, enyo:true */

(function () {
"use strict";

XT.extensions.xtuple_field_dev_sample_2 = {

initModels: function () {
XM.MetricFoo = XM.Model.extend({
recordType: "XM.MetricFoo"
});
XM.MetricFooCollection = XM.Collection.extend({
model: XM.MetricFoo
});
},

initViews: function () {
enyo.kind({
name: "XV.MetricFooListParameters",
kind: "XV.ParameterWidget",
components: [
{kind: "onyx.GroupboxHeader", content: "_metrics".loc()},
{name: "name", label: "_name".loc(), attr: "name"},
{name: "value", label: "_value".loc(), attr: "value"}
]
});

enyo.kind({
name: "XV.MetricFooList",
kind: "XV.List",
label: "_metrics".loc(),
collection: "XM.MetricFooCollection",
parameterWidget: "XV.MetricFooListParameters",
query: {orderBy: [
{attribute: 'name'}
]},
components: [
{kind: "XV.ListItem", components: [
{kind: "FittableColumns", components: [
{kind: "XV.ListColumn", classes: "first", components: [
{kind: "XV.ListAttr", attr: "name"},
{kind: "XV.ListAttr", attr: "foo"}
]},
{kind: "XV.ListColumn", classes: "last", fit: true, components: [
{kind: "XV.ListAttr", attr: "value"}
]}
]}
]}
]
});

XT.app.$.postbooks.appendPanels("setup", [{name: "metricFooList", kind: "XV.MetricFooList"}]);
}
};

}());
16 changes: 16 additions & 0 deletions source/xtuple-field-dev-sample-2/client/en/strings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*jshint node:true, indent:2, curly:false, eqeqeq:true, immed:true,
latedef:true, newcap:true, noarg:true, regexp:true, undef:true,
strict:true, trailing:true, white:true */
/*global XT:true */

(function () {
"use strict";

var lang = XT.stringsFor("en_US", {
"_metrics": "Metrics"
});

if (typeof exports !== 'undefined') {
exports.language = lang;
}
}());
3 changes: 3 additions & 0 deletions source/xtuple-field-dev-sample-2/client/package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
enyo.depends(
"core.js"
);
44 changes: 44 additions & 0 deletions source/xtuple-field-dev-sample-2/database/orm/models/metric.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[
{
"context": "xtuple-field-dev-sample-2",
"nameSpace": "XM",
"type": "MetricFoo",
"table": "xtfielddev.metric_foo",
"comment": "Metric Map With Foo",
"privileges": {
"all": {
"create": false,
"read": true,
"update": false,
"delete": false
}
},
"properties": [
{
"name": "name",
"attr": {
"type": "String",
"column": "metric_name",
"isPrimaryKey": true,
"isNaturalKey": true
}
},
{
"name": "value",
"attr": {
"type": "String",
"column": "metric_value"
}
},
{
"name": "foo",
"attr": {
"type": "String",
"column": "foo"
}
}
],
"isSystem": true
}
]

10 changes: 10 additions & 0 deletions source/xtuple-field-dev-sample-2/database/source/manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "xtuple-field-dev-sample-2",
"version": "0.0.1",
"comment": "Simple field dev 2",
"loadOrder": 999,
"dependencies": [],
"databaseScripts": [
"metric_with_foo.sql"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
select xt.create_schema('xtfielddev');

select xt.create_view('xtfielddev.metric_foo', $$

select metric_name, metric_value, 'foo'::text as foo
from public.metric

$$);
18 changes: 18 additions & 0 deletions source/xtuple-field-dev-sample-2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"author": "Steve Hackbarth <[email protected]>",
"name": "xtuple-field-dev-sample-2",
"description": "Another xTuple field dev sample",
"version": "0.0.1",
"dependencies": {
},
"peerDependencies": {
"xtuple": "~4.7.0"
},
"repository": {
"type": "git",
"url": "http://github.com/shackbarth/xtuple-extensions"
},
"engines": {
"node": "0.8.x"
}
}

0 comments on commit 7b00911

Please sign in to comment.