Skip to content

Commit

Permalink
feat(tag-select): add select all tag
Browse files Browse the repository at this point in the history
  • Loading branch information
zack9433 committed Apr 9, 2019
1 parent f3296d8 commit 06757f1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/component/tag-selector/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"TAG_SELECTOR_DIALOG_FORM_EQUIPMENT_TYPE": "Type",
"TAG_SELECTOR_DIALOG_TABLE_LOG_UNIT": "Unit",
"TAG_SELECTOR_DIALOG_TABLE_LOG_DATATYPE": "Data Type",
"TAG_SELECTOR_DIALOG_PREVIEW_MSG": "Example for publish message format"
"TAG_SELECTOR_DIALOG_PREVIEW_MSG": "Example for publish message format",
"TAG_SELECTOR_DIALOG_TAG_LIST_SELECT_ALL": "Select all tag"
}
3 changes: 2 additions & 1 deletion src/component/tag-selector/lang/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"TAG_SELECTOR_DIALOG_FORM_EQUIPMENT_TYPE": "型態",
"TAG_SELECTOR_DIALOG_TABLE_LOG_UNIT": "單位",
"TAG_SELECTOR_DIALOG_TABLE_LOG_DATATYPE": "資料型態",
"TAG_SELECTOR_DIALOG_PREVIEW_MSG": "發佈訊息範例"
"TAG_SELECTOR_DIALOG_PREVIEW_MSG": "發佈訊息範例",
"TAG_SELECTOR_DIALOG_TAG_LIST_SELECT_ALL": "全選"
}
19 changes: 19 additions & 0 deletions src/component/tag-selector/tag-list.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,25 @@ export default class TagListController {
}
}

toggleAllTag(device, status) {
device.equipmentTags.forEach(tag => (tag.isSelected = status));
this.selectedTags = device.equipmentTags.map(item => {
return {
name: item.name,
equipmentName: device.equipmentName,
equipmentType: device.equipmentType,
unit: item.unit || '',
dataType: item.dataType,
description: item.description,
logOnChange: item.logOnChange,
logDescription: item.logDescription,
logUnit: item.logUnit,
logDataType: item.logDataType
};
});
this.updateEquipmentTagListStatus(this.devices, this.selectedTags);
}

toggleAllLogDataType(device, status) {
device.equipmentTags.forEach(tag => (tag.logDataType = status));
if (status) {
Expand Down
6 changes: 6 additions & 0 deletions src/component/tag-selector/tag-list.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ <h2 translate="TAG_SELECTOR_DIALOG_UPLOAD_EDIT_DIALOG_TITLE"></h2>
<md-toolbar class="md-table-toolbar md-default" ng-if="0===$ctrl.table[$ctrl.selectedDevice.equipmentName].selected.length">
<div class="md-toolbar-tools">
<span translate="TAG_SELECTOR_DIALOG_TAG_LIST"></span>
<div flex></div>
<md-button class="md-icon-button" aria-label="Select All Tag"
ng-click="$ctrl.toggleAllTag($ctrl.selectedDevice, true)">
<md-tooltip><span translate="TAG_SELECTOR_DIALOG_TAG_LIST_SELECT_ALL"></span></md-tooltip>
<md-icon ng-md-icon icon="select_all" style="fill: rgba(0, 0, 0, .54)"></md-icon>
</md-button>
</div>
</md-toolbar>

Expand Down

0 comments on commit 06757f1

Please sign in to comment.