Commit e04c4f5c by kevalbhatt

ATLAS-3596: UI: Improved System attribute presentation for user friendliness

parent 4d44690a
...@@ -294,6 +294,21 @@ td { ...@@ -294,6 +294,21 @@ td {
.query-builder { .query-builder {
.rule-container { .rule-container {
margin: 6px 0; margin: 6px 0;
display: flex;
flex-wrap: wrap;
.values-box {
display: flex;
flex-grow: 1;
width: 100%;
padding-right: 26px;
}
.action-box {
position: absolute;
right: 4px;
top: calc(50% - 18px);
}
.rule-header { .rule-header {
.rule-actions { .rule-actions {
...@@ -301,24 +316,34 @@ td { ...@@ -301,24 +316,34 @@ td {
} }
} }
.error-container {
color: $color_trinidad_approx;
}
.rule-value-container { .rule-value-container {
display: inline-block !important; display: inline-block !important;
border-left: none;
width: calc(65% - 105px);
.form-control { .form-control {
width: 220px !important; width: 100% !important;
padding: 6px 12px !important; padding: 6px 12px !important;
} }
} }
.rule-filter-container { .rule-filter-container {
width: 35%;
.form-control { .form-control {
width: 200px !important; width: 100% !important;
} }
} }
.rule-operator-container { .rule-operator-container {
width: 105px;
.form-control { .form-control {
width: auto !important; width: 100% !important;
} }
} }
} }
......
...@@ -57,7 +57,7 @@ $color_celeste_approx: #1D1F2B; ...@@ -57,7 +57,7 @@ $color_celeste_approx: #1D1F2B;
background-color: $color_jungle_green_approx; background-color: $color_jungle_green_approx;
border-radius: 10px; border-radius: 10px;
box-shadow: inset 0 1px rgba(black, .02); box-shadow: inset 0 1px rgba(black, .02);
@include transition(inherit) @include transition(inherit);
} }
.switch-input:checked~& { .switch-input:checked~& {
...@@ -240,6 +240,47 @@ hr.hr-filter { ...@@ -240,6 +240,47 @@ hr.hr-filter {
} }
} }
.filter-btn-wrapper { .query-builder {
padding-left: 0; .rule-container {
&.user-define {
.values-box {
display: flex;
flex-wrap: wrap;
.rule-filter-container {
width: 200px;
}
.rule-value-container {
width: 100%;
padding: 7px 0px 0px 0px;
}
}
}
.rule-value-container {
&>table.custom-table {
tr {
display: none;
&.custom-tr {
display: table-row;
td.custom-col-1 {
width: 48%;
.errorMsg {
display: none;
}
}
}
}
input,
textarea {
width: 100% !important;
}
}
}
}
} }
\ No newline at end of file
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<table class="custom-table">
<tbody>
<tr class="custom-tr">
<td class="custom-col-1">
<input placeholder="key" type="text" data-type="key" data-index="0" class="form-control" value="">
<p class="errorMsg"></p>
</td>
<td class="custom-col-0"> : </td>
<td class="custom-col-1">
<textarea placeholder="value" data-type="value" data-index="0" class="form-control"></textarea>
<p class="errorMsg"></p>
</td>
<!-- <td class="custom-col-2">
<button class="btn btn-default btn-sm" title="" data-index="0" data-id="deleteUserDefineItem">
<i class="fa fa-minus"> </i>
</button>
<button class="btn btn-default btn-sm" title="" data-index="0" data-id="addUserDefineItem">
<i class="fa fa-plus"> </i>
</button>
</td> -->
</tr>
<tr>
<td colspan="4">
<p class="errorMsg" data-id="charSupportMsg"></p>
</td>
</tr>
</tbody>
</table>
\ No newline at end of file
...@@ -194,8 +194,8 @@ define(['require'], function(require) { ...@@ -194,8 +194,8 @@ define(['require'], function(require) {
}; };
Enums.systemAttributes = { Enums.systemAttributes = {
"__classificationNames": "Classification(s)", "__classificationNames": "Classification(s)",
"__createdBy": "Created By", "__createdBy": "Created By User",
"__customAttributes": "User-defined attributes", "__customAttributes": "User-defined Properties",
"__guid": "Guid", "__guid": "Guid",
"__isIncomplete": "IsIncomplete", "__isIncomplete": "IsIncomplete",
"__labels": "Label(s)", "__labels": "Label(s)",
......
...@@ -54,7 +54,7 @@ define(['require', ...@@ -54,7 +54,7 @@ define(['require',
}, },
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'entity', 'customFilter')); _.extend(this, _.pick(options, 'entity', 'customFilter'));
this.userDefineAttr = this.entity.customAttributes || []; this.userDefineAttr = this.entity && this.entity.customAttributes || [];
this.initialCall = false; this.initialCall = false;
this.swapItem = false, this.saveAttrItems = false; this.swapItem = false, this.saveAttrItems = false;
this.readOnlyEntity = this.customFilter === undefined ? Enums.entityStateReadOnly[this.entity.status] : this.customFilter; this.readOnlyEntity = this.customFilter === undefined ? Enums.entityStateReadOnly[this.entity.status] : this.customFilter;
...@@ -123,7 +123,7 @@ define(['require', ...@@ -123,7 +123,7 @@ define(['require',
data: JSON.stringify(payload), data: JSON.stringify(payload),
type: 'POST', type: 'POST',
success: function() { success: function() {
var msg = _.isEmpty(that.customAttibutes) ? 'addSuccessMessage' : 'editSuccessMessage', var msg = that.initialCall ? 'addSuccessMessage' : 'editSuccessMessage',
caption = "One or more user-defined propertie"; // 's' will be added in abbreviation function caption = "One or more user-defined propertie"; // 's' will be added in abbreviation function
that.customAttibutes = list; that.customAttibutes = list;
if (list.length === 0) { if (list.length === 0) {
......
...@@ -89,7 +89,8 @@ define(['require', ...@@ -89,7 +89,8 @@ define(['require',
entityDefCollection: this.entityDefCollection, entityDefCollection: this.entityDefCollection,
enumDefCollection: this.enumDefCollection, enumDefCollection: this.enumDefCollection,
classificationDefCollection: this.classificationDefCollection, classificationDefCollection: this.classificationDefCollection,
searchTableFilters: this.searchTableFilters searchTableFilters: this.searchTableFilters,
typeHeaders: this.typeHeaders
} }
if (this.tag) { if (this.tag) {
......
...@@ -807,6 +807,9 @@ define(['require', ...@@ -807,6 +807,9 @@ define(['require',
} }
return; return;
} }
if (key == "__historicalGuids" || key == "__classificationsText" || key == "__classificationNames" || key == "__propagatedClassificationNames") {
return;
}
col[obj.name] = { col[obj.name] = {
label: Enums.systemAttributes[obj.name] ? Enums.systemAttributes[obj.name] : _.escape(obj.name).capitalize(), label: Enums.systemAttributes[obj.name] ? Enums.systemAttributes[obj.name] : _.escape(obj.name).capitalize(),
cell: "Html", cell: "Html",
...@@ -826,6 +829,28 @@ define(['require', ...@@ -826,6 +829,28 @@ define(['require',
'valueObject': {}, 'valueObject': {},
'isTable': false 'isTable': false
}; };
if (key == "__labels") {
var values = modelObj.attributes[key] ? modelObj.attributes[key].split("|") : null,
valueOfArray = [];
if (values) {
if (values[values.length - 1] === "") { values.pop(); }
if (values[0] === "") { values.shift(); }
_.each(values, function(names) {
valueOfArray.push('<span class="json-string"><a class="btn btn-action btn-sm btn-blue btn-icon" ><span title="" data-original-title="' + names + '" >' + names + '</span></a></span>');
});
return valueOfArray.join(' ');
}
}
if (key == "__customAttributes") {
var customAttributes = modelObj.attributes[key] ? JSON.parse(modelObj.attributes[key]) : null,
valueOfArray = [];
if (customAttributes) {
_.each(Object.keys(customAttributes), function(value, index) {
valueOfArray.push('<span class="json-string"><a class="btn btn-action btn-sm btn-blue btn-icon" ><span title="" data-original-title="' + value + ' : ' + Object.values(customAttributes)[index] + '" ><span>' + value + '</span> : <span>' + Object.values(customAttributes)[index] + '</span></span></a></span>');
});
return valueOfArray.join(' ');
}
}
tempObj.valueObject[key] = modelObj.attributes[key]; tempObj.valueObject[key] = modelObj.attributes[key];
var tablecolumn = CommonViewFunction.propertyTable(tempObj); var tablecolumn = CommonViewFunction.propertyTable(tempObj);
if (_.isArray(modelObj.attributes[key])) { if (_.isArray(modelObj.attributes[key])) {
......
...@@ -246,6 +246,21 @@ ...@@ -246,6 +246,21 @@
.query-builder { .query-builder {
.rule-container { .rule-container {
margin: 6px 0; margin: 6px 0;
display: flex;
flex-wrap: wrap;
.values-box {
display: flex;
flex-grow: 1;
width: 100%;
padding-right: 26px;
}
.action-box {
position: absolute;
right: 4px;
top: calc(50% - 18px);
}
.rule-header { .rule-header {
.rule-actions { .rule-actions {
...@@ -253,24 +268,34 @@ ...@@ -253,24 +268,34 @@
} }
} }
.error-container {
color: $color_trinidad_approx;
}
.rule-value-container { .rule-value-container {
display: inline-block !important; display: inline-block !important;
border-left: none;
width: calc(65% - 105px);
.form-control { .form-control {
width: 220px !important; width: 100% !important;
padding: 6px 12px !important; padding: 6px 12px !important;
} }
} }
.rule-filter-container { .rule-filter-container {
width: 35%;
.form-control { .form-control {
width: 200px !important; width: 100% !important;
} }
} }
.rule-operator-container { .rule-operator-container {
width: 105px;
.form-control { .form-control {
width: auto !important; width: 100% !important;
} }
} }
} }
......
...@@ -425,10 +425,10 @@ hr.hr-filter { ...@@ -425,10 +425,10 @@ hr.hr-filter {
padding: 0px 15px; padding: 0px 15px;
} }
.attribute-result-footer, // .attribute-result-footer,
.attribute-edit-footer { // .attribute-edit-footer {
display: inline-block; // display: inline-block;
} // }
} }
.filter-box { .filter-box {
...@@ -477,4 +477,49 @@ hr.hr-filter { ...@@ -477,4 +477,49 @@ hr.hr-filter {
.attributePopOver { .attributePopOver {
min-height: 190px; min-height: 190px;
} }
}
.query-builder {
.rule-container {
&.user-define {
.values-box {
display: flex;
flex-wrap: wrap;
.rule-filter-container {
width: 200px;
}
.rule-value-container {
width: 100%;
padding: 7px 0px 0px 0px;
}
}
}
.rule-value-container {
&>table.custom-table {
tr {
display: none;
&.custom-tr {
display: table-row;
td.custom-col-1 {
width: 48%;
.errorMsg {
display: none;
}
}
}
}
input,
textarea {
width: 100% !important;
}
}
}
}
} }
\ No newline at end of file
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<table class="custom-table">
<tbody>
<tr class="custom-tr">
<td class="custom-col-1">
<input placeholder="key" type="text" data-type="key" data-index="0" class="form-control" value="">
<p class="errorMsg"></p>
</td>
<td class="custom-col-0"> : </td>
<td class="custom-col-1">
<textarea placeholder="value" data-type="value" data-index="0" class="form-control"></textarea>
<p class="errorMsg"></p>
</td>
<!-- <td class="custom-col-2">
<button class="btn btn-default btn-sm" title="" data-index="0" data-id="deleteUserDefineItem">
<i class="fa fa-minus"> </i>
</button>
<button class="btn btn-default btn-sm" title="" data-index="0" data-id="addUserDefineItem">
<i class="fa fa-plus"> </i>
</button>
</td> -->
</tr>
<tr>
<td colspan="4">
<p class="errorMsg" data-id="charSupportMsg"></p>
</td>
</tr>
</tbody>
</table>
\ No newline at end of file
...@@ -194,8 +194,8 @@ define(['require'], function(require) { ...@@ -194,8 +194,8 @@ define(['require'], function(require) {
}; };
Enums.systemAttributes = { Enums.systemAttributes = {
"__classificationNames": "Classification(s)", "__classificationNames": "Classification(s)",
"__createdBy": "Created By", "__createdBy": "Created By User",
"__customAttributes": "User-defined attributes", "__customAttributes": "User-defined Properties",
"__guid": "Guid", "__guid": "Guid",
"__isIncomplete": "IsIncomplete", "__isIncomplete": "IsIncomplete",
"__labels": "Label(s)", "__labels": "Label(s)",
...@@ -208,7 +208,7 @@ define(['require'], function(require) { ...@@ -208,7 +208,7 @@ define(['require'], function(require) {
}; };
Enums.__isIncomplete = { Enums.__isIncomplete = {
0: "false", 0: "false",
1: "rue" 1: "true"
} };
return Enums; return Enums;
}); });
\ No newline at end of file
...@@ -54,7 +54,7 @@ define(['require', ...@@ -54,7 +54,7 @@ define(['require',
}, },
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'entity', 'customFilter')); _.extend(this, _.pick(options, 'entity', 'customFilter'));
this.userDefineAttr = this.entity.customAttributes || []; this.userDefineAttr = this.entity && this.entity.customAttributes || [];
this.initialCall = false; this.initialCall = false;
this.swapItem = false, this.saveAttrItems = false; this.swapItem = false, this.saveAttrItems = false;
this.readOnlyEntity = this.customFilter === undefined ? Enums.entityStateReadOnly[this.entity.status] : this.customFilter; this.readOnlyEntity = this.customFilter === undefined ? Enums.entityStateReadOnly[this.entity.status] : this.customFilter;
......
...@@ -819,6 +819,9 @@ define(['require', ...@@ -819,6 +819,9 @@ define(['require',
} }
return; return;
} }
if (key == "__historicalGuids" || key == "__classificationsText" || key == "__classificationNames" || key == "__propagatedClassificationNames") {
return;
}
col[obj.name] = { col[obj.name] = {
label: Enums.systemAttributes[obj.name] ? Enums.systemAttributes[obj.name] : _.escape(obj.name).capitalize(), label: Enums.systemAttributes[obj.name] ? Enums.systemAttributes[obj.name] : _.escape(obj.name).capitalize(),
cell: "Html", cell: "Html",
...@@ -838,6 +841,28 @@ define(['require', ...@@ -838,6 +841,28 @@ define(['require',
'valueObject': {}, 'valueObject': {},
'isTable': false 'isTable': false
}; };
if (key == "__labels") {
var values = modelObj.attributes[key] ? modelObj.attributes[key].split("|") : null,
valueOfArray = [];
if (values) {
if (values[values.length - 1] === "") { values.pop(); }
if (values[0] === "") { values.shift(); }
_.each(values, function(names) {
valueOfArray.push('<span class="json-string"><a class="btn btn-action btn-sm btn-blue btn-icon" ><span title="" data-original-title="' + names + '" >' + names + '</span></a></span>');
});
return valueOfArray.join(' ');
}
}
if (key == "__customAttributes") {
var customAttributes = modelObj.attributes[key] ? JSON.parse(modelObj.attributes[key]) : null,
valueOfArray = [];
if (customAttributes) {
_.each(Object.keys(customAttributes), function(value, index) {
valueOfArray.push('<span class="json-string"><a class="btn btn-action btn-sm btn-blue btn-icon" ><span title="" data-original-title="' + value + ' : ' + Object.values(customAttributes)[index] + '" ><span>' + value + '</span> : <span>' + Object.values(customAttributes)[index] + '</span></span></a></span>');
});
return valueOfArray.join(' ');
}
}
tempObj.valueObject[key] = modelObj.attributes[key]; tempObj.valueObject[key] = modelObj.attributes[key];
var tablecolumn = CommonViewFunction.propertyTable(tempObj); var tablecolumn = CommonViewFunction.propertyTable(tempObj);
if (_.isArray(modelObj.attributes[key])) { if (_.isArray(modelObj.attributes[key])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment