aboutsummaryrefslogtreecommitdiffstats
path: root/moon_gui/static/app/policy/edit/parameter/assignments/assignments-edit.tpl.html
blob: 9069dcd0a14a4ba8db3be2c492cf88ccba95ba6d (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
<div>

    <div class="col-md-12 col-sm-12 col-xs-12">

        <form ng-if="!edit.fromList" class="form-horizontal" role="form" name="edit.form">

            <!-- Select Policy -->
            <div class="form-group" ng-class="{'has-error': edit.form.policyList.$invalid && edit.form.policyList.$dirty}" >

                <label for="policyList" class="col-sm-3 control-label" data-translate="moon.policy.assignments.edit.policies">Policy List</label>

                <div class="col-sm-6" ng-if="edit.loadingPolicies" >
                    <moon-loader></moon-loader>
                </div>

                <div class="col-sm-6" ng-if="!edit.loadingPolicies" >

                    <ui-select ng-model="edit.selectedPolicy"  name="policyList" id="policyList" required>

                        <ui-select-match placeholder="(None)" ng-bind="$select.selected.name"></ui-select-match>
                        <ui-select-choices repeat="aPolicy in edit.policyList">
                            <div ng-value="aPolicy" ng-bind="aPolicy.name"></div>
                        </ui-select-choices>

                    </ui-select>

                    <div class="help-block" ng-show="edit.form.policyList.$dirty && edit.form.policyList.$invalid">
                        <small class="error" ng-show="edit.form.policyList.$error.required" data-translate="moon.policy.assignments.edit.check.policy.required">Policy is required</small>
                    </div>

                </div>

            </div>

            <!-- Select Perimeter -->
            <div class="form-group" ng-class="{'has-error': edit.form.perimeterList.$invalid && edit.form.perimeterList.$dirty}" >

                <label for="perimeterList" class="col-sm-3 control-label" data-translate="moon.policy.assignments.edit.perimeters">Perimeter List</label>

                <div class="col-sm-6" ng-if="edit.loadingPerimeters" >
                    <moon-loader></moon-loader>
                </div>

                <div class="col-sm-6" ng-if="!edit.loadingPerimeters" >

                    <ui-select ng-model="edit.selectedPerimeter"  name="perimeterList" id="perimeterList" required>

                        <ui-select-match placeholder="(None)" ng-bind="$select.selected.name"></ui-select-match>
                        <ui-select-choices repeat="aPerimeter in edit.perimeterList">
                            <div ng-value="aPerimeter" ng-bind="aPerimeter.name"></div>
                        </ui-select-choices>

                    </ui-select>

                    <div class="help-block" ng-show="edit.form.perimeterList.$dirty && edit.form.perimeterList.$invalid">
                        <small class="error" ng-show="edit.form.perimeterList.$error.required" data-translate="moon.policy.assignments.edit.check.perimeter.required">Perimeter is required</small>
                    </div>

                </div>

            </div>

            <!-- Select Category -->
            <div class="form-group" ng-class="{'has-error': edit.form.categoryList.$invalid && edit.form.categoryList.$dirty}" >

                <label for="categoryList" class="col-sm-3 control-label" data-translate="moon.policy.assignments.edit.categories">Category List</label>

                <div class="col-sm-6" ng-if="edit.loadingCategories" >
                    <moon-loader></moon-loader>
                </div>

                <div class="col-sm-6" ng-if="!edit.loadingCategories" >

                    <ui-select ng-model="edit.selectedCategory"  name="categoryList" id="categoryList" required>

                        <ui-select-match placeholder="(None)" ng-bind="$select.selected.name"></ui-select-match>
                        <ui-select-choices repeat="aCategory in edit.categoryList">
                            <div ng-value="aCategory" ng-bind="aCategory.name"></div>
                        </ui-select-choices>

                    </ui-select>

                    <div class="help-block" ng-show="edit.form.categoryList.$dirty && edit.form.categoryList.$invalid">
                        <small class="error" ng-show="edit.form.categoryList.$error.required" data-translate="moon.policy.assignments.edit.check.category.required">Category is required</small>
                    </div>

                </div>

            </div>

            <!-- Select Data -->
            <div class="form-group" ng-if="edit.selectedCategory" ng-class="{'has-error': edit.form.dataList.$invalid && edit.form.dataList.$dirty}" >

                <label for="dataList" class="col-sm-3 control-label" data-translate="moon.policy.assignments.edit.data">Data List</label>

                <div class="col-sm-6" ng-if="edit.loadingData" >
                    <moon-loader></moon-loader>
                </div>

                <div class="col-sm-4" ng-if="!edit.loadingData" >

                    <ui-select ng-model="edit.selectedData"  name="dataList" id="dataList">

                        <ui-select-match placeholder="(None)" ng-bind="edit.getName($select.selected)"></ui-select-match>
                        <ui-select-choices repeat="aData in edit.dataToBeSelected">
                            <div ng-value="aData" ng-bind="edit.getName(aData)"></div>
                        </ui-select-choices>

                    </ui-select>

                    <div class="help-block" ng-show="edit.form.dataList.$dirty && edit.form.dataList.$invalid || !edit.assignementsAttributeValid">
                        <small class="error" ng-show="edit.form.dataList.$error.required || !edit.assignementsAttributeValid" data-translate="moon.policy.assignments.edit.check.data.required">Data is required</small>
                    </div>

                </div>

                <div class="col-sm-2 text-center">
                    <a href="" ng-if="edit.selectedData"
                       ng-click="edit.addSelectedData()"><span style="font-size:1.5em; line-height: 1.5em;" class="glyphicon glyphicon-plus-sign"></span></a>
                </div>

            </div>

            <!-- Selected DataList -->
            <div class="form-group" ng-if="!edit.loadingData">

                <label class="col-sm-3 control-label" data-translate="moon.policy.assignments.edit.selectedData">Selected Data)</label>

                <div class="col-sm-6">

                    <ul>

                        <li ng-repeat="(key, value) in edit.selectedDataList">

                            <span ng-bind="edit.getName(value)" ></span> <a href="" ng-click="edit.removeSelectedData(value)"><span style="font-size:1.5em; line-height: 1.5em" class="glyphicon glyphicon-remove"></span></a>

                        </li>

                    </ul>

                </div>

            </div>

            <div class="form-group">

                <div class="pull-right">

                    <a href="" ng-disabled="edit.loading" ng-click="edit.create()" class="btn btn-warning">
                        <span class="glyphicon glyphicon-save"></span>
                        <span data-translate="moon.policy.assignments.edit.action.create">Create</span>
                    </a>

                    <moon-loader ng-if="edit.loading"></moon-loader>

                </div>

            </div>


        </form>

    </div>

</div>