aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/view-models/workspace/tabs/req-and-capabilities/req-and-capabilities-editable-view.html
blob: 566cc5fc2cfe29daa87f600bbc25f1d06b4fe28a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<!--
  ~ Copyright © 2016-2018 European Support Limited
  ~
  ~ Licensed 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.
-->

<div class="workspace-req-and-cap-editable">
    <loader data-display="isLoading"></loader>

    <div class="tabs-header">
        <div class="req-and-cap-tabs">
            <div data-tests-id="req-tab" data-ng-click="onSwitchTab()" class="tab"
                 data-ng-class="{'selected':mode=='requirements'}">Requirements
            </div>
            <div data-tests-id="cap-tab" data-ng-click="onSwitchTab()" class="tab"
                 data-ng-class="{'selected':mode=='capabilities'}">Capabilities
            </div>
        </div>
        <div class="buttons-in-right" data-ng-if="!isListEmpty()">
            <div class="search">
                <input id="search-box" data-ng-if="filter.show" data-tests-id="search-box" placeholder="Search"
                       data-ng-model-options="{debounce: 200}" data-ng-model="filter.txt" data-ng-change="onFilter()"/>
                <div class="search-icon-container" data-tests-id="search-icon">
                    <svg-icon
                            class="hand"
                            [name]="'search-o'"
                            [mode]="'primary'"
                            [size]="'small'"
                            [clickable]="'true'"
                            data-ng-click="onSearchIconClick()">
                    </svg-icon>
                </div>
            </div>
            <div class="add-button-icon-and-label" data-ng-if="isEditable" data-ng-click="onAddBtnClicked()"
                 data-ng-class="{'disabled': isReadonly()}" data-tests-id="add-button">
                <svg-icon
                        name="plus"
                        mode="primary"
                        size="small"
                        clickable="true"
                        [disabled]="isReadonly()"
                        labelPlacement="top">
                </svg-icon>
                <span class="icon-label-txt">{{mode === 'requirements' ? 'Add Requirement' : 'Add Capability'}}</span>
            </div>
        </div>
    </div>

    <div class="empty-list-container" data-ng-if="isListEmpty() && !isLoading" data-tests-id="empty-list-container">
        <div class="empty-list-add-btn add-button-icon-and-label" data-ng-class="{'disabled': isReadonly()}"
             data-ng-click="onAddBtnClicked()" data-tests-id="empty-list-add-btn">
            <svg-icon
                    name="plus-circle"
                    mode="primary"
                    size="x_large"
                    clickable="true"
                    [disabled]="isReadonly()">
            </svg-icon>
            <div class="icon-label-txt">{{mode === 'requirements' ? 'Add Requirement' : 'Add Capability'}}</div>
        </div>
    </div>

    <div class="table-container-flex requirements-table" data-ng-if="mode=='requirements' && !isListEmpty()">
        <div class="table" data-ng-class="{'view-mode': isViewMode()}" data-tests-id="requirement-table">
            <div class="head flex-container">
                <div data-ng-repeat="header in editableRequirementsTableHeadersList track by $index"
                     data-ng-click="sort(header.property, requirementsSortTableDefined, false)"
                     class="table-header head-row hand flex-item {{header.property}}"
                     data-tests-id="table-header-{{header.property}}">
                    {{header.title}}
                    <span data-ng-if="requirementsSortTableDefined.sortByField === header.property"
                          class="table-header-sort-arrow" data-tests-id="table-header-sort-arrow"
                          data-ng-class="{'down': requirementsSortTableDefined.reverse, 'up':!requirementsSortTableDefined.reverse}"> </span>
                </div>
            </div>

            <div class="body">
                <perfect-scrollbar scroll-y-margin-offset="0" include-padding="true" class="editable-table-data">
                    <div data-ng-if="filteredRequirementsList.length === 0" class="no-row-text"
                         data-tests-id="no-rows-in-table">
                        There are no requirements to display

                    </div>
                    <div data-ng-repeat="req in filteredRequirementsList | orderBy:requirementsSortTableDefined.sortByField:requirementsSortTableDefined.reverse  track by $index"
                         data-tests-id="reqRow">
                        <div class="flex-container data-row" data-ng-class="{'editable-row': req.isCreatedManually}"
                             data-ng-click="req.isCreatedManually && onEditRequirement(req)">
                            <div class="table-col-general flex-item text ellipsis-text" tooltips
                                 tooltip-content="{{(!req.isCreatedManually ? req.ownerName + '.' : '') + req.name}}">
                                <span data-tests-id="{{(!req.isCreatedManually ? req.ownerName + '.' : '') + req.name}}">{{(!req.isCreatedManually ? req.ownerName + '.' : '') + req.name}}</span>
                            </div>
                            <div class="table-col-general flex-item text ellipsis-text" tooltips
                                 tooltip-content="{{req.capability}}">
                                <span data-tests-id="{{req.capability}}">{{req.capability && cutToscaTypePrefix(req.capability, 'capabilities.')}}</span>
                            </div>
                            <div class="table-col-general flex-item text ellipsis-text" tooltips
                                 tooltip-content="{{req.node}}">
                                <span data-tests-id="{{req.node}}">{{req.node && cutToscaTypePrefix(req.node, "nodes.")}}</span>
                            </div>
                            <div class="table-col-general flex-item text ellipsis-text" tooltips
                                 tooltip-content="{{req.relationship}}">
                                <span data-tests-id="{{req.relationship}}">{{req.relationship && cutToscaTypePrefix(req.relationship, "relationships.")}}</span>
                            </div>
                            <div class="table-col-general flex-item text ellipsis-text occurrences-col" tooltips
                                 tooltip-content="{{req.minOccurrences}} - {{req.maxOccurrences}}">
                                <span data-tests-id="{{req.minOccurrences}} - {{req.maxOccurrences}}">{{req.minOccurrences}} - {{req.maxOccurrences}}</span>
                            </div>
                            <div class="table-col-general flex-item text other-col" data-tests-id="delete-req"
                                 data-ng-class="{'disabled': isReadonly()}">
                                <svg-icon name="trash-o" class="trash-icon" size="small"
                                          data-ng-if="req.isCreatedManually && !isReadonly()"
                                          data-ng-click="onDeleteReq($event, req)"></svg-icon>
                            </div>
                        </div>
                    </div>
                </perfect-scrollbar>
            </div>

        </div>
    </div>
    <div class="table-container-flex capabilities-table" data-ng-if="mode=='capabilities' && !isListEmpty()"
         data-tests-id="capabilities-table">
        <div class="table" data-ng-class="{'view-mode': isViewMode()}">
            <div class="head flex-container">
                <div data-ng-repeat="header in editableCapabilitiesTableHeadersList track by $index"
                     data-ng-click="sort(header.property, capabilitiesSortTableDefined, true)"
                     class="table-header head-row hand flex-item {{header.property}}"
                     data-tests-id="header-{{header.property}}">
                    {{header.title}}
                    <span data-ng-if="capabilitiesSortTableDefined.sortByField === header.property"
                          class="table-header-sort-arrow" data-tests-id=="table-header-sort-arrow"
                          data-ng-class="{'down': capabilitiesSortTableDefined.reverse, 'up':!capabilitiesSortTableDefined.reverse}"> </span>
                </div>
            </div>

            <div class="body">
                <perfect-scrollbar scroll-y-margin-offset="0" include-padding="true" class="editable-table-data">
                    <div data-ng-if="filteredCapabilitiesList.length === 0" class="no-row-text"
                         data-tests-id="no-rows-in-table">
                        There are no capabilities to display
                    </div>
                    <div data-ng-repeat-start="capability in filteredCapabilitiesList | orderBy:capabilitiesSortTableDefined.sortByField:capabilitiesSortTableDefined.reverse  track by $index"
                         class="flex-container data-row"
                         data-ng-class="{'selected': capability.selected, 'editable-row': capability.isCreatedManually}"
                         data-ng-click="capability.isCreatedManually && onEditCapability(capability)"
                         data-tests-id="capabilities-table-row">

                        <div class="table-col-general flex-item text ellipsis-text" tooltips
                             tooltip-content="{{(!capability.isCreatedManually ? capability.ownerName + '.' : '') + capability.name}}">
                            <span class="sprite-new arrow-up-small hand"
                                  data-ng-class="{'hideme': !capability.properties.length, 'opened': capability.selected}"
                                  data-ng-click="capability.selected = !capability.selected; $event.stopPropagation();"></span>
                            <span data-tests-id="{{(!capability.isCreatedManually ? capability.ownerName + '.' : '') + capability.name}}"
                                  class="name-col" data-ng-class="{'opened': capability.selected}">
                                {{(!capability.isCreatedManually ? capability.ownerName + '.' : '') + capability.name}}
                            </span>
                        </div>
                        <div class="table-col-general flex-item text ellipsis-text" tooltips
                             tooltip-content="{{capability.type}}">
                            <span data-tests-id="{{capability.type}}">{{capability.type && cutToscaTypePrefix(capability.type, 'capabilities.')}}</span>
                        </div>

                        <div class="table-col-general flex-item text description-col">
                            <div data-tests-id="{{capability.description}}" class="multiline-ellipsis"
                                 ellipsis="capability.description" max-chars="60">{{capability.description}}
                            </div>
                        </div>

                        <div class="table-col-general flex-item text ellipsis-text" tooltips
                             tooltip-content="{{capability.validSourceTypes.join(',')}}">
                            <span data-tests-id="{{capability.validSourceTypes.join(',')}}">{{capability.validSourceTypes.join(',')}}</span>
                        </div>

                        <div class="table-col-general flex-item text ellipsis-text occurrences-col" tooltips
                             tooltip-content="{{capability.minOccurrences}} - {{capability.maxOccurrences}}">
                            <span data-tests-id="{{capability.minOccurrences}} - {{capability.maxOccurrences}}">{{capability.minOccurrences}} - {{capability.maxOccurrences}}</span>
                        </div>

                        <div class="table-col-general flex-item text other-col" data-tests-id="delete-cap"
                             data-ng-class="{'disabled': isReadonly()}">
                            <svg-icon name="trash-o" class="trash-icon" size="small"
                                      data-ng-if="capability.isCreatedManually && !isReadonly()"
                                      data-ng-click="onDeleteCap($event, capability)"></svg-icon>
                        </div>
                    </div>
                    <div data-ng-repeat-end data-ng-if="capability.selected" class="item-opened properties-section">
                        <p class="properties-title">Properties</p>
                        <div class="table-container-flex properties-table">
                            <div class="table" data-ng-class="{'view-mode': true}">
                                <div class="head flex-container">
                                    <div class="table-header head-row hand flex-item"
                                         data-ng-repeat="header in capabilityPropertiesTableHeadersList track by $index"
                                         data-ng-click="sort(header.property, propertiesSortTableDefined, false)">
                                        {{header.title}}
                                        <span data-ng-if="propertiesSortTableDefined.sortByField === header.property"
                                              class="table-header-sort-arrow"
                                              data-ng-class="{'down': propertiesSortTableDefined.reverse, 'up':!propertiesSortTableDefined.reverse}"> </span>
                                    </div>
                                </div>

                                <div class="body">
                                    <div data-ng-repeat="property in capability.properties | orderBy:propertiesSortTableDefined.sortByField:propertiesSortTableDefined.reverse track by $index"
                                         data-tests-id="propertyRow"
                                         class="flex-container data-row">
                                        <div class="table-col-general flex-item text"
                                             data-tests-id="{{property.name}}"
                                             tooltips tooltip-content="{{property.name}}">
                                            {{property.name}}
                                        </div>
                                        <div class="table-col-general flex-item text"
                                             data-tests-id="{{property.type}}"
                                             tooltips tooltip-content="{{property.type}}">
                                            {{property.type}}
                                        </div>
                                        <div class="table-col-general flex-item text"
                                             data-tests-id="{{property.schema.property.type}}"
                                             tooltips tooltip-content="{{property.schema.property.type}}">
                                            {{property.schema.property.type}}
                                        </div>
                                        <div class="table-col-general flex-item text"
                                             tooltips tooltip-content="{{property.description}}"
                                             data-tests-id="{{property.description}}">
                                            {{property.description}}
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                </perfect-scrollbar>
            </div>

        </div>
    </div>
</div>