summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/imports/api/inventories/server/methods.js16
-rw-r--r--ui/imports/ui/components/scanning-request/scanning-request.html17
-rw-r--r--ui/imports/ui/components/scanning-request/scanning-request.js14
-rw-r--r--ui/imports/ui/components/scheduled-scan/scheduled-scan.html17
-rw-r--r--ui/imports/ui/components/scheduled-scan/scheduled-scan.js12
5 files changed, 55 insertions, 21 deletions
diff --git a/ui/imports/api/inventories/server/methods.js b/ui/imports/api/inventories/server/methods.js
index ec2f27d..3daf570 100644
--- a/ui/imports/api/inventories/server/methods.js
+++ b/ui/imports/api/inventories/server/methods.js
@@ -143,9 +143,17 @@ function calcAttrsForNode(node, attrsDefsRec) {
let attrsDefs = attrsDefsRec.attributes;
return R.reduce((acc, attrDef) => {
- return R.ifElse(R.isNil,
- R.always(acc),
- (attrVal) => R.append(R.assoc(attrDef, attrVal, {}), acc)
- )(R.prop(attrDef, node));
+ if (R.is(Array, attrDef)) {
+ let value = R.path(attrDef, node);
+ if (R.isNil(value)) { return acc; }
+ let name = R.join('.', attrDef);
+ return R.append(R.assoc(name, value, {}), acc);
+
+ } else {
+ return R.ifElse(R.isNil,
+ R.always(acc),
+ (attrVal) => R.append(R.assoc(attrDef, attrVal, {}), acc)
+ )(R.prop(attrDef, node));
+ }
}, [], attrsDefs);
}
diff --git a/ui/imports/ui/components/scanning-request/scanning-request.html b/ui/imports/ui/components/scanning-request/scanning-request.html
index 9f0e044..b28e5b2 100644
--- a/ui/imports/ui/components/scanning-request/scanning-request.html
+++ b/ui/imports/ui/components/scanning-request/scanning-request.html
@@ -22,6 +22,15 @@
<h3>{{ pageHeader }}</h3>
<div class="sm-form-container">
+
+ {{#if (getState 'isMessage') }}
+ <div class="js-message-panel alert {{#if (getState 'isError')}}alert-danger{{/if}}
+ {{#if (getState 'isSuccess')}}alert-success{{/if}}"
+ role="alert">
+ {{ getState 'message' }}
+ </div>
+ {{/if }}
+
<form role="form" class="form-horizontal">
{{#each commandOption in commandOptions }}
@@ -61,14 +70,6 @@
</form>
- {{#if (getState 'isMessage') }}
- <div class="js-message-panel alert {{#if (getState 'isError')}}alert-danger{{/if}}
- {{#if (getState 'isSuccess')}}alert-success{{/if}}"
- role="alert">
- {{ getState 'message' }}
- </div>
- {{/if }}
-
</div>
</div>
</template>
diff --git a/ui/imports/ui/components/scanning-request/scanning-request.js b/ui/imports/ui/components/scanning-request/scanning-request.js
index 6181150..6e6d3e4 100644
--- a/ui/imports/ui/components/scanning-request/scanning-request.js
+++ b/ui/imports/ui/components/scanning-request/scanning-request.js
@@ -52,11 +52,13 @@ Template.ScanningRequest.onCreated(function() {
disabled: false,
notifications: {},
model: {},
- beforeInsert: true
+ beforeInsert: true,
+ reload: null,
});
instance.autorun(function () {
let data = Template.currentData();
+ instance.state.get('reload');
new SimpleSchema({
action: { type: String, allowedValues: ['insert', 'view', 'update'] },
@@ -67,6 +69,12 @@ Template.ScanningRequest.onCreated(function() {
},
}).validate(data);
+ instance.state.set('isError', false);
+ instance.state.set('isSuccess', false);
+ instance.state.set('isMessage', false);
+ instance.state.set('message', null);
+ instance.state.set('disabled', false);
+
switch (data.action) {
case 'insert':
initInsertView(instance, data);
@@ -318,6 +326,10 @@ function processActionResult(instance, error) {
} else if (action === 'update') {
instance.state.set('message', 'Record had been updated successfully');
}
+
+ setTimeout(() => {
+ instance.state.set('reload', Date.now());
+ }, 7000);
}
}
diff --git a/ui/imports/ui/components/scheduled-scan/scheduled-scan.html b/ui/imports/ui/components/scheduled-scan/scheduled-scan.html
index c5c5c72..2abdcaf 100644
--- a/ui/imports/ui/components/scheduled-scan/scheduled-scan.html
+++ b/ui/imports/ui/components/scheduled-scan/scheduled-scan.html
@@ -11,8 +11,17 @@
<template name="ScheduledScan">
<div class="os-scheduled-scan cards white">
+ {{#if (getState 'isMessage') }}
+ <div class="js-message-panel alert {{#if (getState 'isError')}}alert-danger{{/if}}
+ {{#if (getState 'isSuccess')}}alert-success{{/if}}"
+ role="alert">
+ {{ getState 'message' }}
+ </div>
+ {{/if }}
+
<h3>{{ getState 'pageHeader' }}</h3>
<div class="sm-form-container">
+
<form role="form" class="sm-item-form form-horizontal">
<div class="sm-field-group-id cl-field-group">
@@ -103,14 +112,6 @@
</form>
- {{#if (getState 'isMessage') }}
- <div class="js-message-panel alert {{#if (getState 'isError')}}alert-danger{{/if}}
- {{#if (getState 'isSuccess')}}alert-success{{/if}}"
- role="alert">
- {{ getState 'message' }}
- </div>
- {{/if }}
-
</div>
</div>
</template>
diff --git a/ui/imports/ui/components/scheduled-scan/scheduled-scan.js b/ui/imports/ui/components/scheduled-scan/scheduled-scan.js
index 4092d00..56622dc 100644
--- a/ui/imports/ui/components/scheduled-scan/scheduled-scan.js
+++ b/ui/imports/ui/components/scheduled-scan/scheduled-scan.js
@@ -41,10 +41,13 @@ Template.ScheduledScan.onCreated(function() {
envsAsOptions: [],
logLevelsAsOptions: [],
pageHeader: 'Schedule a Scan',
+ reload: null,
});
instance.autorun(function () {
let data = Template.currentData();
+ instance.state.get('reload');
+
new SimpleSchema({
_id: {
type: { _str: { type: String, regEx: SimpleSchema.RegEx.Id } },
@@ -55,6 +58,12 @@ Template.ScheduledScan.onCreated(function() {
}).validate(data);
instance.state.set('action', data.action);
+ instance.state.set('isError', false);
+ instance.state.set('isSuccess', false);
+ instance.state.set('isMessage', false);
+ instance.state.set('message', null);
+ instance.state.set('disabled', false);
+
R.when(R.pipe(R.isNil, R.not), x => instance.state.set('_id', x))(data._id);
R.when(R.pipe(R.isNil, R.not), x => instance.state.set('env', x))(data.env);
});
@@ -500,4 +509,7 @@ function processActionResult(instance, error) {
}
//Router.go('/link-types-list');
+ setTimeout(() => {
+ instance.state.set('reload', Date.now());
+ }, 7000);
}