Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Styling of filtering settings (#727)

DonWillems34a71718f60d
diff --git a/manager/src/web/shared/locales/en/or.json b/manager/src/web/shared/locales/en/or.json
index 090609c22..fcd021944 100644
--- a/manager/src/web/shared/locales/en/or.json
+++ b/manager/src/web/shared/locales/en/or.json
@@ -473,6 +473,8 @@
"no": "No",
"linked": "Linked",
"filter": {
+ "filter": "Filter",
+ "clear": "CLEAR",
"action": "FILTER",
"assetTypeLabel": "Asset type",
"assetTypeNone": "None",
diff --git a/manager/src/web/shared/locales/nl/or.json b/manager/src/web/shared/locales/nl/or.json
index 1384de96b..0561bc4cd 100644
--- a/manager/src/web/shared/locales/nl/or.json
+++ b/manager/src/web/shared/locales/nl/or.json
@@ -468,11 +468,13 @@
"yes": "Ja",
"no": "Nee",
"filter": {
+ "filter": "Filter",
+ "clear": "LEEGMAKEN",
"action": "FILTER",
"assetTypeLabel": "Asset type",
- "assetTypeNone": "None",
- "assetTypeMenuNone": "None",
- "attributeLabel": "Attribute",
- "attributeValueLabel": "Attribute value"
+ "assetTypeNone": "Geen",
+ "assetTypeMenuNone": "Geen",
+ "attributeLabel": "Attribuut",
+ "attributeValueLabel": "Attribuutwaarde"
}
}
diff --git a/ui/component/or-asset-tree/src/index.ts b/ui/component/or-asset-tree/src/index.ts
index e16a2c863..c514537e5 100644
--- a/ui/component/or-asset-tree/src/index.ts
+++ b/ui/component/or-asset-tree/src/index.ts
@@ -429,7 +429,7 @@ export class OrAssetTree extends subscribe(manager)(LitElement) {
?disabled="${this._loading}"
style="width: 100%;"
type="${ InputType.TEXT }"
- icon="magnify"
+ placeholder="${i18next.t("filter.filter")}..."
compact="true"
outlined="true"
@input="${(e: KeyboardEvent) => {
@@ -442,25 +442,6 @@ export class OrAssetTree extends subscribe(manager)(LitElement) {
}}"
trailingSpace="true">
</or-mwc-input>
- <div id="clearIconContainer">
- <or-icon id="clearIcon" icon="close" @click="${() => {
- // Wipe the current value and hide the clear button
- this._filterInput.value = undefined;
- this._clearIconContainer.classList.remove("visible");
-
- this._attributeValueFilter.value = undefined;
- this._attributeNameFilter.value = undefined;
-
- this._attributeValueFilter.disabled = true;
-
- this._assetTypeFilter = '';
-
- this._filter = new OrAssetTreeFilter();
-
- // Call filtering
- this._doFiltering();
- }}"></or-icon>
- </div>
<or-icon id="filterSettingsIcon" icon="tune" @click="${() => {
if ( this._filterSetting.classList.contains("visible") ) {
this._filterSetting.classList.remove("visible");
@@ -505,7 +486,7 @@ export class OrAssetTree extends subscribe(manager)(LitElement) {
<or-mwc-input id="attributeNameFilter" .label="${i18next.t("filter.attributeLabel")}"
.type="${InputType.TEXT}"
- style="margin-top: 14px;"
+ style="margin-top: 10px;"
?disabled="${this._loading}"
@input="${(e: KeyboardEvent) => {
this._shouldEnableAttrTypeEvent(e);
@@ -516,10 +497,26 @@ export class OrAssetTree extends subscribe(manager)(LitElement) {
<or-mwc-input id="attributeValueFilter" .label="${i18next.t("filter.attributeValueLabel")}"
.type="${InputType.TEXT}"
- style="margin-top: 14px;"
+ style="margin-top: 10px;"
disabled></or-mwc-input>
- <div>
- <or-mwc-input style="float: right;" style="margin-top: 14px;" type="${ InputType.BUTTON }" .label="${i18next.t("filter.action")}" raised @or-mwc-input-changed="${() => {
+ <div style="margin-top: 10px;">
+ <or-mwc-input style="float:left;" type="${ InputType.BUTTON }" .label="${i18next.t("filter.clear")}" @or-mwc-input-changed="${() => {
+ // Wipe the current value and hide the clear button
+ this._filterInput.value = undefined;
+
+ this._attributeValueFilter.value = undefined;
+ this._attributeNameFilter.value = undefined;
+
+ this._attributeValueFilter.disabled = true;
+
+ this._assetTypeFilter = '';
+
+ this._filter = new OrAssetTreeFilter();
+
+ // Call filtering
+ this._doFiltering();
+ }}"></or-mwc-input>
+ <or-mwc-input style="float: right;" type="${ InputType.BUTTON }" .label="${i18next.t("filter.action")}" raised @or-mwc-input-changed="${() => {
this._filterFromSettings();
}}"></or-mwc-input>
</div>
@@ -886,12 +883,6 @@ export class OrAssetTree extends subscribe(manager)(LitElement) {
let newFilterForSearchInput: string = this.formatFilter(this._filter);
- if (newFilterForSearchInput) {
- this._clearIconContainer.classList.add("visible");
- } else {
- this._clearIconContainer.classList.remove("visible");
- }
-
this._filterInput.value = newFilterForSearchInput;
this._filterSetting.classList.remove("visible");
@@ -904,24 +895,12 @@ export class OrAssetTree extends subscribe(manager)(LitElement) {
if (e.composedPath()) {
value = ((e.composedPath()[0] as HTMLInputElement).value) || undefined;
-
- if (value) {
- this._clearIconContainer.classList.add("visible");
- } else {
- this._clearIconContainer.classList.remove("visible");
- }
}
this._onFilterInput(value, false);
}
protected _onFilterInput(newValue: string | undefined, force: boolean): void {
- if (newValue) {
- this._clearIconContainer.classList.add("visible");
- } else {
- this._clearIconContainer.classList.remove("visible");
- }
-
let currentFilter: OrAssetTreeFilter = this.parseFromInputFilter(newValue);
if (Util.objectsEqual(this._filter, currentFilter,true)) {
@@ -937,7 +916,7 @@ export class OrAssetTree extends subscribe(manager)(LitElement) {
if (!force) {
this._searchInputTimer = window.setTimeout(() => {
this._doFiltering();
- }, 1500);
+ }, 350);
} else {
this._doFiltering();
}
diff --git a/ui/component/or-asset-tree/src/style.ts b/ui/component/or-asset-tree/src/style.ts
index accac65bb..5216f4df4 100644
--- a/ui/component/or-asset-tree/src/style.ts
+++ b/ui/component/or-asset-tree/src/style.ts
@@ -222,7 +222,7 @@ export const style = css`
display: flex;
align-items: center;
position: relative;
- background-color: #F9F9F9;
+ background-color: var(--internal-or-asset-tree-selected-background-color);
}
#filterInput {
@@ -239,7 +239,7 @@ export const style = css`
#clearIcon {
--or-icon-width: 20px;
--or-icon-height: 20px;
- position: absolute;
+ position: relative;
right: 0;
padding-right: 16px;
cursor: pointer;
@@ -261,14 +261,14 @@ export const style = css`
#asset-tree-filter-setting {
position: absolute;
- background-color: #F9F9F9;
+ background-color: var(--internal-or-asset-tree-background-color);
top: calc(var(--internal-or-asset-tree-header-height) + var(--internal-or-header-height, 50px) - 1px);
display: none;
width: 300px;
z-index: 100;
box-shadow: rgb(0 0 0 / 21%) 0px 1px 3px 0px;
box-sizing: border-box;
- padding: 5px;
+ padding: 10px;
}
#asset-tree-filter-setting .advanced-filter {