@things-factory/dataset 5.0.0-alpha.26 → 5.0.0-alpha.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/client/pages/{data-entry-form.js → data-entry/data-entry-form.js} +1 -0
  2. package/client/pages/data-entry/data-entry-list-page.js +464 -0
  3. package/client/pages/{data-ooc.js → data-ooc/data-ooc-list-page.js} +3 -3
  4. package/client/pages/{data-ooc-view.js → data-ooc/data-ooc-view.js} +0 -0
  5. package/client/pages/{data-sample.js → data-sample/data-sample-list-page.js} +3 -3
  6. package/client/pages/{data-sample-view.js → data-sample/data-sample-view.js} +0 -0
  7. package/client/pages/{data-sensor.js → data-sensor/data-sensor-list-page.js} +3 -3
  8. package/client/pages/{data-item-list.js → data-set/data-item-list.js} +12 -0
  9. package/client/pages/{data-set-importer.js → data-set/data-set-importer.js} +0 -0
  10. package/client/pages/{data-set.js → data-set/data-set-list-page.js} +113 -32
  11. package/client/route.js +12 -8
  12. package/dist-server/controllers/create-data-sample.js +15 -10
  13. package/dist-server/controllers/create-data-sample.js.map +1 -1
  14. package/dist-server/service/data-item/data-item-type.js +4 -0
  15. package/dist-server/service/data-item/data-item-type.js.map +1 -1
  16. package/dist-server/service/data-item/data-item.js +7 -0
  17. package/dist-server/service/data-item/data-item.js.map +1 -1
  18. package/dist-server/service/data-set/data-set-query.js +98 -1
  19. package/dist-server/service/data-set/data-set-query.js.map +1 -1
  20. package/dist-server/service/data-set/data-set-type.js +32 -4
  21. package/dist-server/service/data-set/data-set-type.js.map +1 -1
  22. package/dist-server/service/data-set/data-set.js +39 -7
  23. package/dist-server/service/data-set/data-set.js.map +1 -1
  24. package/package.json +18 -16
  25. package/server/controllers/create-data-sample.ts +23 -14
  26. package/server/service/data-item/data-item-type.ts +3 -0
  27. package/server/service/data-item/data-item.ts +6 -0
  28. package/server/service/data-set/data-set-query.ts +79 -1
  29. package/server/service/data-set/data-set-type.ts +26 -4
  30. package/server/service/data-set/data-set.ts +36 -6
  31. package/things-factory.config.js +12 -8
  32. package/translations/en.json +9 -0
  33. package/translations/ko.json +8 -0
  34. package/translations/ms.json +8 -0
  35. package/translations/zh.json +8 -0
@@ -10,12 +10,23 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  var _a, _b, _c, _d, _e;
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.DataSet = void 0;
13
+ exports.DataSet = exports.DataSetViewType = void 0;
14
14
  const type_graphql_1 = require("type-graphql");
15
15
  const typeorm_1 = require("typeorm");
16
16
  const auth_base_1 = require("@things-factory/auth-base");
17
17
  const shell_1 = require("@things-factory/shell");
18
18
  const data_item_1 = require("../data-item/data-item");
19
+ var DataSetViewType;
20
+ (function (DataSetViewType) {
21
+ DataSetViewType["Generated"] = "generated";
22
+ DataSetViewType["Board"] = "board";
23
+ DataSetViewType["Page"] = "page";
24
+ DataSetViewType["ExternalURL"] = "external";
25
+ })(DataSetViewType = exports.DataSetViewType || (exports.DataSetViewType = {}));
26
+ (0, type_graphql_1.registerEnumType)(DataSetViewType, {
27
+ name: 'DataSetViewType',
28
+ description: 'view type enumeration for data-set'
29
+ });
19
30
  let DataSet = class DataSet {
20
31
  };
21
32
  __decorate([
@@ -75,19 +86,40 @@ __decorate([
75
86
  }),
76
87
  (0, type_graphql_1.Field)({ nullable: true }),
77
88
  __metadata("design:type", String)
78
- ], DataSet.prototype, "useCase", void 0);
89
+ ], DataSet.prototype, "entryType", void 0);
79
90
  __decorate([
80
- (0, typeorm_1.Column)('simple-json', { nullable: true }),
81
- (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
82
- __metadata("design:type", typeof (_c = typeof shell_1.ScalarObject !== "undefined" && shell_1.ScalarObject) === "function" ? _c : Object)
83
- ], DataSet.prototype, "partitionKeys", void 0);
91
+ (0, typeorm_1.Column)({
92
+ nullable: true
93
+ }),
94
+ (0, type_graphql_1.Field)({ nullable: true }),
95
+ __metadata("design:type", String)
96
+ ], DataSet.prototype, "entryView", void 0);
97
+ __decorate([
98
+ (0, typeorm_1.Column)({
99
+ nullable: true
100
+ }),
101
+ (0, type_graphql_1.Field)({ nullable: true }),
102
+ __metadata("design:type", String)
103
+ ], DataSet.prototype, "monitorType", void 0);
104
+ __decorate([
105
+ (0, typeorm_1.Column)({
106
+ nullable: true
107
+ }),
108
+ (0, type_graphql_1.Field)({ nullable: true }),
109
+ __metadata("design:type", String)
110
+ ], DataSet.prototype, "monitorView", void 0);
84
111
  __decorate([
85
112
  (0, typeorm_1.Column)({
86
113
  nullable: true
87
114
  }),
88
115
  (0, type_graphql_1.Field)({ nullable: true }),
89
116
  __metadata("design:type", String)
90
- ], DataSet.prototype, "slugger", void 0);
117
+ ], DataSet.prototype, "useCase", void 0);
118
+ __decorate([
119
+ (0, typeorm_1.Column)('simple-json', { nullable: true }),
120
+ (0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true }),
121
+ __metadata("design:type", typeof (_c = typeof shell_1.ScalarObject !== "undefined" && shell_1.ScalarObject) === "function" ? _c : Object)
122
+ ], DataSet.prototype, "partitionKeys", void 0);
91
123
  __decorate([
92
124
  (0, typeorm_1.OneToMany)(type => data_item_1.DataItem, dataItem => dataItem.dataSet),
93
125
  (0, type_graphql_1.Field)(type => [data_item_1.DataItem], { nullable: true }),
@@ -1 +1 @@
1
- {"version":3,"file":"data-set.js","sourceRoot":"","sources":["../../../server/service/data-set/data-set.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAAoD;AACpD,qCAUgB;AAEhB,yDAAsD;AACtD,iDAA4D;AAE5D,sDAAiD;AAKjD,IAAa,OAAO,GAApB,MAAa,OAAO;CAoGnB,CAAA;AAjGC;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;mCACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,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-1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/dataset",
3
- "version": "5.0.0-alpha.26",
3
+ "version": "5.0.0-alpha.29",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -24,20 +24,22 @@
24
24
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
25
25
  },
26
26
  "dependencies": {
27
- "@operato/app": "1.0.0-alpha.48",
28
- "@operato/data-grist": "1.0.0-alpha.48",
29
- "@operato/dataset": "1.0.0-alpha.48",
30
- "@operato/graphql": "1.0.0-alpha.48",
31
- "@operato/i18n": "1.0.0-alpha.48",
32
- "@operato/layout": "1.0.0-alpha.48",
33
- "@operato/shell": "1.0.0-alpha.48",
34
- "@operato/styles": "1.0.0-alpha.48",
35
- "@operato/utils": "1.0.0-alpha.48",
36
- "@things-factory/auth-base": "^5.0.0-alpha.26",
37
- "@things-factory/env": "^5.0.0-alpha.26",
38
- "@things-factory/shell": "^5.0.0-alpha.26",
39
- "@things-factory/work-shift": "^5.0.0-alpha.26",
40
- "moment": "^2.29.1"
27
+ "@operato/app": "1.0.0-alpha.53",
28
+ "@operato/data-grist": "1.0.0-alpha.53",
29
+ "@operato/dataset": "1.0.0-alpha.53",
30
+ "@operato/graphql": "1.0.0-alpha.53",
31
+ "@operato/i18n": "1.0.0-alpha.53",
32
+ "@operato/layout": "1.0.0-alpha.53",
33
+ "@operato/shell": "1.0.0-alpha.53",
34
+ "@operato/styles": "1.0.0-alpha.53",
35
+ "@operato/utils": "1.0.0-alpha.53",
36
+ "@things-factory/auth-base": "^5.0.0-alpha.29",
37
+ "@things-factory/board-service": "^5.0.0-alpha.29",
38
+ "@things-factory/env": "^5.0.0-alpha.29",
39
+ "@things-factory/shell": "^5.0.0-alpha.29",
40
+ "@things-factory/work-shift": "^5.0.0-alpha.29",
41
+ "cron-parser": "^4.3.0",
42
+ "moment-timezone": "^0.5.34"
41
43
  },
42
- "gitHead": "841b6ef41df481ea7ae4a925328ff5c0a7e9a9cd"
44
+ "gitHead": "b173f0b3a55165db246df58668a99b456cc47996"
43
45
  }
@@ -1,15 +1,17 @@
1
- import { DataOoc, DataOocStatus } from '../service/data-ooc/data-ooc'
1
+ import moment from 'moment-timezone'
2
+ import { EntityManager } from 'typeorm'
3
+
4
+ import { User } from '@things-factory/auth-base'
2
5
  import { Domain, getRedirectSubdomainPath, pubsub } from '@things-factory/shell'
3
6
 
4
7
  import { DataItem } from '../service/data-item/data-item'
8
+ import { DataOoc, DataOocStatus } from '../service/data-ooc/data-ooc'
5
9
  import { DataSample } from '../service/data-sample/data-sample'
10
+ import { NewDataSample } from '../service/data-sample/data-sample-type'
6
11
  import { DataSet } from '../service/data-set/data-set'
7
12
  import { DataUseCase } from './data-use-case'
8
- import { EntityManager } from 'typeorm'
9
- import { NewDataSample } from '../service/data-sample/data-sample-type'
10
- import { User } from '@things-factory/auth-base'
11
13
  import { getWorkDateAndShift } from '@things-factory/work-shift'
12
- import moment from 'moment'
14
+
13
15
 
14
16
  const debug = require('debug')('things-factory:dataset:controller/save-data-sample')
15
17
 
@@ -67,20 +69,29 @@ export async function createDataSample(
67
69
  const spec = dataItems.reduce((spec, dataItem) => {
68
70
  spec[dataItem.tag] = {
69
71
  ...dataItem.spec,
70
- name: dataItem.name /* do we need ? */
72
+ name: dataItem.name, /* do we need ? */
73
+ hidden: dataItem.hidden
71
74
  }
72
75
 
73
76
  return spec
74
77
  }, {})
75
78
 
76
79
  const collectedAt = dataSample.collectedAt || new Date()
77
- const momentUtc = moment(collectedAt).utc()
80
+ // workDate ex) 2022-04-04
81
+ const { workDate, workShift } = await getWorkDateAndShift(domain, collectedAt)
82
+
83
+ const dateFormat = 'YYYY-MM-DD'
84
+ // local time dataSet timezone or domain timezone or default 'UTC'
85
+ const timezone = dataSet['timezone'] || domain['timezone'] || 'UTC'
86
+
87
+ // const collectedAt = dataSample.collectedAt || new Date()
88
+ const localDateTz = moment(collectedAt).tz(timezone)
78
89
  const defaultPartitionKeys = {
79
90
  domain: domain.subdomain,
80
- datasetid: dataSample.dataSet.id /* It should not be 'data_set_id' as column name duplicated for Glue */,
81
- year: momentUtc.format('Y'),
82
- month: momentUtc.format('M'),
83
- day: momentUtc.format('D')
91
+ datasetid: dataSample.dataSet.id, /* It should not be 'data_set_id' as column name duplicated for Glue */
92
+ date: localDateTz.format(dateFormat), /* local time date */
93
+ workdate: workDate, /* working date */
94
+ workshift: workShift
84
95
  }
85
96
 
86
97
  var partitionKeys = {
@@ -88,14 +99,12 @@ export async function createDataSample(
88
99
  ...dataSet.partitionKeys
89
100
  }
90
101
 
91
- partitionKeys = formatDate(partitionKeys, momentUtc)
102
+ partitionKeys = formatDate(partitionKeys, localDateTz)
92
103
  partitionKeys = replaceVariables(partitionKeys, {
93
104
  ...dataSample.data
94
105
  })
95
106
 
96
107
  const { ooc, oos } = DataUseCase.evaluate(dataSet, dataItems, dataSample.data) || {}
97
- const { workDate, workShift } = await getWorkDateAndShift(domain, collectedAt)
98
-
99
108
  const result = await tx.getRepository(DataSample).save({
100
109
  name: dataSet.name,
101
110
  description: dataSet.description,
@@ -37,6 +37,9 @@ export class DataItemPatch {
37
37
  @Field({ nullable: true })
38
38
  active?: boolean
39
39
 
40
+ @Field({ nullable: true })
41
+ hidden?: boolean
42
+
40
43
  @Field(type => ScalarObject, { nullable: true })
41
44
  spec?: ScalarObject
42
45
 
@@ -75,6 +75,12 @@ export class DataItem {
75
75
  @Field({ nullable: true })
76
76
  active?: boolean
77
77
 
78
+ @Column({
79
+ nullable: true
80
+ })
81
+ @Field({ nullable: true })
82
+ hidden?: boolean
83
+
78
84
  @Column({
79
85
  nullable: true
80
86
  })
@@ -1,13 +1,17 @@
1
1
  import { Arg, Args, Ctx, Directive, FieldResolver, Query, Resolver, Root } from 'type-graphql'
2
- import { getRepository } from 'typeorm'
2
+ import { Equal, getRepository } from 'typeorm'
3
3
 
4
4
  import { Role, User } from '@things-factory/auth-base'
5
+ import { Board } from '@things-factory/board-service'
5
6
  import { convertListParams, Domain, ListParam } from '@things-factory/shell'
6
7
 
7
8
  import { DataItem } from '../data-item/data-item'
9
+ import { DataSample } from '../data-sample/data-sample'
8
10
  import { DataSet } from './data-set'
9
11
  import { DataSetList } from './data-set-type'
10
12
 
13
+ var parser = require('cron-parser')
14
+
11
15
  @Resolver(DataSet)
12
16
  export class DataSetQuery {
13
17
  @Directive('@privilege(category: "data-set", privilege: "query", domainOwnerGranted: true)')
@@ -31,6 +35,25 @@ export class DataSetQuery {
31
35
  return { items, total }
32
36
  }
33
37
 
38
+ @Query(returns => DataSetList, { description: 'To fetch multiple DataSets for data entry manually' })
39
+ async dataSetsForEntry(@Args() params: ListParam, @Ctx() context: any): Promise<DataSetList> {
40
+ const { domain } = context.state
41
+
42
+ /* TODO. 조회한 사용자가 supervisory 역할을 가진 data-set 리스트만 반환 */
43
+
44
+ const { where = {}, order, skip, take } = convertListParams(params, domain.id)
45
+ where.active = Equal(true)
46
+
47
+ const [items, total] = await getRepository(DataSet).findAndCount({
48
+ where,
49
+ order,
50
+ skip,
51
+ take
52
+ })
53
+
54
+ return { items, total }
55
+ }
56
+
34
57
  @FieldResolver(type => [DataItem])
35
58
  async dataItems(@Root() dataSet: DataSet): Promise<DataItem[]> {
36
59
  return await getRepository(DataItem).find({
@@ -45,6 +68,20 @@ export class DataSetQuery {
45
68
  })
46
69
  }
47
70
 
71
+ @FieldResolver(type => Board, { nullable: true })
72
+ async entryBoard(@Root() dataSet: DataSet) {
73
+ if (dataSet.entryType == 'board' && dataSet.entryView) {
74
+ return await getRepository(Board).findOne({ id: dataSet.entryView })
75
+ }
76
+ }
77
+
78
+ @FieldResolver(type => Board, { nullable: true })
79
+ async monitorBoard(@Root() dataSet: DataSet) {
80
+ if (dataSet.monitorType == 'board' && dataSet.monitorView) {
81
+ return await getRepository(Board).findOne({ id: dataSet.monitorView })
82
+ }
83
+ }
84
+
48
85
  @FieldResolver(type => Domain)
49
86
  async domain(@Root() dataSet: DataSet): Promise<Domain> {
50
87
  return await getRepository(Domain).findOne(dataSet.domainId)
@@ -59,4 +96,45 @@ export class DataSetQuery {
59
96
  async creator(@Root() dataSet: DataSet): Promise<User> {
60
97
  return await getRepository(User).findOne(dataSet.creatorId)
61
98
  }
99
+
100
+ @FieldResolver(type => Date, { nullable: true })
101
+ async latestCollectedAt(@Root() dataSet: DataSet): Promise<Date> {
102
+ const sample = await getRepository(DataSample).findOne({
103
+ select: ['collectedAt'],
104
+ where: { dataSet },
105
+ order: { collectedAt: 'DESC' }
106
+ })
107
+
108
+ return sample?.collectedAt
109
+ }
110
+
111
+ @FieldResolver(type => Date, { nullable: true })
112
+ async nextSchedule(@Root() dataSet: DataSet): Promise<Date> {
113
+ const { timezone, schedule } = dataSet
114
+
115
+ if (!schedule) {
116
+ return
117
+ }
118
+
119
+ var interval = parser.parseExpression(schedule, {
120
+ tz: timezone
121
+ })
122
+
123
+ return interval.next().toDate()
124
+ }
125
+
126
+ @FieldResolver(type => Date, { nullable: true })
127
+ async prevSchedule(@Root() dataSet: DataSet): Promise<Date> {
128
+ const { timezone, schedule } = dataSet
129
+
130
+ if (!schedule) {
131
+ return
132
+ }
133
+
134
+ var interval = parser.parseExpression(schedule, {
135
+ tz: timezone
136
+ })
137
+
138
+ return interval.prev().toDate()
139
+ }
62
140
  }
@@ -1,7 +1,8 @@
1
1
  import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'
2
+
2
3
  import { ObjectRef, ScalarObject } from '@things-factory/shell'
3
4
 
4
- import { DataSet } from './data-set'
5
+ import { DataSet, DataSetViewType } from './data-set'
5
6
 
6
7
  @InputType()
7
8
  export class NewDataSet {
@@ -31,6 +32,18 @@ export class NewDataSet {
31
32
 
32
33
  @Field({ nullable: true })
33
34
  timezone?: string
35
+
36
+ @Field({ nullable: true })
37
+ entryType?: DataSetViewType
38
+
39
+ @Field({ nullable: true })
40
+ entryView?: string
41
+
42
+ @Field({ nullable: true })
43
+ monitorType?: DataSetViewType
44
+
45
+ @Field({ nullable: true })
46
+ monitorView?: string
34
47
  }
35
48
 
36
49
  @InputType()
@@ -50,9 +63,6 @@ export class DataSetPatch {
50
63
  @Field({ nullable: true })
51
64
  active?: boolean
52
65
 
53
- @Field({ nullable: true })
54
- type?: 'manual' | 'automatic' | string
55
-
56
66
  @Field({ nullable: true })
57
67
  useCase?: string
58
68
 
@@ -65,6 +75,18 @@ export class DataSetPatch {
65
75
  @Field({ nullable: true })
66
76
  timezone?: string
67
77
 
78
+ @Field({ nullable: true })
79
+ entryType?: DataSetViewType
80
+
81
+ @Field({ nullable: true })
82
+ entryView?: string
83
+
84
+ @Field({ nullable: true })
85
+ monitorType?: DataSetViewType
86
+
87
+ @Field({ nullable: true })
88
+ monitorView?: string
89
+
68
90
  @Field()
69
91
  cuFlag: string
70
92
  }
@@ -1,4 +1,4 @@
1
- import { Field, ID, ObjectType } from 'type-graphql'
1
+ import { Field, ID, ObjectType, registerEnumType } from 'type-graphql'
2
2
  import {
3
3
  Column,
4
4
  CreateDateColumn,
@@ -16,6 +16,18 @@ import { Domain, ScalarObject } from '@things-factory/shell'
16
16
 
17
17
  import { DataItem } from '../data-item/data-item'
18
18
 
19
+ export enum DataSetViewType {
20
+ Generated = 'generated',
21
+ Board = 'board',
22
+ Page = 'page',
23
+ ExternalURL = 'external'
24
+ }
25
+
26
+ registerEnumType(DataSetViewType, {
27
+ name: 'DataSetViewType',
28
+ description: 'view type enumeration for data-set'
29
+ })
30
+
19
31
  @Entity()
20
32
  @Index('ix_data_set_0', (dataSet: DataSet) => [dataSet.domain, dataSet.name], { unique: true })
21
33
  @ObjectType({ description: 'Entity for DataSet' })
@@ -66,17 +78,35 @@ export class DataSet {
66
78
  nullable: true
67
79
  })
68
80
  @Field({ nullable: true })
69
- useCase?: string
81
+ entryType?: DataSetViewType
70
82
 
71
- @Column('simple-json', { nullable: true })
72
- @Field(type => ScalarObject, { nullable: true })
73
- partitionKeys?: ScalarObject
83
+ @Column({
84
+ nullable: true
85
+ })
86
+ @Field({ nullable: true })
87
+ entryView?: string
88
+
89
+ @Column({
90
+ nullable: true
91
+ })
92
+ @Field({ nullable: true })
93
+ monitorType?: DataSetViewType
74
94
 
75
95
  @Column({
76
96
  nullable: true
77
97
  })
78
98
  @Field({ nullable: true })
79
- slugger?: string
99
+ monitorView?: string
100
+
101
+ @Column({
102
+ nullable: true
103
+ })
104
+ @Field({ nullable: true })
105
+ useCase?: string
106
+
107
+ @Column('simple-json', { nullable: true })
108
+ @Field(type => ScalarObject, { nullable: true })
109
+ partitionKeys?: ScalarObject
80
110
 
81
111
  @OneToMany(type => DataItem, dataItem => dataItem.dataSet)
82
112
  @Field(type => [DataItem], { nullable: true })
@@ -5,20 +5,24 @@ export default {
5
5
  route,
6
6
  routes: [
7
7
  {
8
- tagname: 'data-set-page',
9
- page: 'data-set'
8
+ tagname: 'data-set-list-page',
9
+ page: 'data-set-list'
10
10
  },
11
11
  {
12
- tagname: 'data-sensor-page',
13
- page: 'data-sensor'
12
+ tagname: 'data-sensor-list-page',
13
+ page: 'data-sensor-list'
14
14
  },
15
15
  {
16
- tagname: 'data-sample-page',
17
- page: 'data-sample'
16
+ tagname: 'data-sample-list-page',
17
+ page: 'data-sample-list'
18
18
  },
19
19
  {
20
- tagname: 'data-ooc-page',
21
- page: 'data-ooc'
20
+ tagname: 'data-ooc-list-page',
21
+ page: 'data-ooc-list'
22
+ },
23
+ {
24
+ tagname: 'data-entry-list-page',
25
+ page: 'data-entry-list'
22
26
  }
23
27
  ],
24
28
  bootstrap
@@ -10,11 +10,19 @@
10
10
  "field.data-sample": "data sample",
11
11
  "field.data-set": "data set",
12
12
  "field.device-id": "device id",
13
+ "field.entry-type": "entry type",
14
+ "field.entry-view": "entry view",
15
+ "field.hidden": "hidden",
16
+ "field.latest-collected-at": "latest collected at",
17
+ "field.monitor-type": "monitor type",
18
+ "field.monitor-view": "monitor view",
13
19
  "field.netmask": "network mask",
20
+ "field.next-schedule": "next schedule",
14
21
  "field.oos": "out of critical limit",
15
22
  "field.ooc": "out of control limit",
16
23
  "field.options": "options",
17
24
  "field.partition-keys": "partition keys",
25
+ "field.prev-schedule": "previous schedule",
18
26
  "field.quota": "sampling #",
19
27
  "field.raw-data": "raw data",
20
28
  "field.ref-by": "ref. by",
@@ -30,6 +38,7 @@
30
38
  "text.data sample created successfully": "a data sample created successfully",
31
39
  "text.data ooc updated successfully": "a data ooc updated successfully",
32
40
  "title.data-entry-form": "data entry form",
41
+ "title.data-entry list": "data entry list",
33
42
  "title.data-item list": "data item list",
34
43
  "title.data-ooc list": "data OOC list",
35
44
  "title.data-ooc view": "data OOC view",
@@ -10,11 +10,19 @@
10
10
  "field.data-sample": "데이타 샘플",
11
11
  "field.data-set": "데이타셋",
12
12
  "field.device-id": "디바이스 아이디",
13
+ "field.entry-type": "입력용 화면종류",
14
+ "field.entry-view": "입력용 화면",
15
+ "field.hidden": "숨기기",
16
+ "field.latest-collected-at": "최근 수집 시간",
17
+ "field.monitor-type": "모니터용 화면종류",
18
+ "field.monitor-view": "모니터용 화면",
13
19
  "field.netmask": "네트워크마스크",
20
+ "field.next-schedule": "다음 수집계획",
14
21
  "field.oos": "허용한계 이탈여부",
15
22
  "field.ooc": "관리한계 이탈여부",
16
23
  "field.options": "선택옵션",
17
24
  "field.partition-keys": "파티션 키",
25
+ "field.prev-schedule": "이전 수집계획",
18
26
  "field.quota": "샘플수",
19
27
  "field.raw-data": "데이타 원본",
20
28
  "field.ref-by": "참조아이템",
@@ -10,11 +10,19 @@
10
10
  "field.data-sample": "data sample",
11
11
  "field.data-set": "data set",
12
12
  "field.device-id": "device id",
13
+ "field.entry-type": "entry type",
14
+ "field.entry-view": "entry view",
15
+ "field.latest-collected-at": "latest collected at",
16
+ "field.monitor-type": "monitor type",
17
+ "field.monitor-view": "monitor view",
13
18
  "field.netmask": "network mask",
19
+ "field.next-schedule": "next schedule",
14
20
  "field.oos": "out of critical limit",
15
21
  "field.ooc": "out of control limit",
16
22
  "field.options": "options",
23
+ "field.hidden": "hidden",
17
24
  "field.partition-keys": "partition keys",
25
+ "field.prev-schedule": "previous schedule",
18
26
  "field.quota": "sampling #",
19
27
  "field.raw-data": "raw data",
20
28
  "field.ref-by": "ref. by",
@@ -10,11 +10,19 @@
10
10
  "field.data-sample": "data sample",
11
11
  "field.data-set": "data set",
12
12
  "field.device-id": "device id",
13
+ "field.entry-type": "entry type",
14
+ "field.entry-view": "entry view",
15
+ "field.hidden": "hidden",
16
+ "field.latest-collected-at": "latest collected at",
17
+ "field.monitor-type": "monitor type",
18
+ "field.monitor-view": "monitor view",
13
19
  "field.netmask": "network mask",
20
+ "field.next-schedule": "next schedule",
14
21
  "field.oos": "out of critical limit",
15
22
  "field.ooc": "out of control limit",
16
23
  "field.options": "options",
17
24
  "field.partition-keys": "partition keys",
25
+ "field.prev-schedule": "previous schedule",
18
26
  "field.quota": "sampling #",
19
27
  "field.raw-data": "raw data",
20
28
  "field.ref-by": "ref. by",