-
Notifications
You must be signed in to change notification settings - Fork 1
/
my-policies.html
212 lines (212 loc) · 13.1 KB
/
my-policies.html
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
<!DOCTYPE html>
<html class="vs-api-policies" lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="webroot/frags/layout/head.htm :: header">
<script src="/dist/js/lib/jquery.min.js"></script>
<script src="/dist/js/lib/thymus.min.js" id="thymus"
data-thx-base-path="." data-thx-frag-extension=".htm"
data-thx-head-frag="th:include=webroot/frags/layout/head.htm :: header"
data-thx-preload-js="/dist/js/loader.js"
data-thx-onfrags="fragsListener();" data-thx-onfrag="fragListener()"></script>
</head>
<body>
<div id="portal" class="wrapper" v-bind:class="pageClass">
<div th:replace="webroot/frags/layout/navs.htm :: navs"></div>
<main class="page-wrapper">
<api-policies inline-template v-on:set-state="setState" v-on:set-page="setPage" v-bind:root-state="rootState" v-if="!$root.isLoading">
<div class="columns">
<section class="column column-main column-main-fixed">
<div class="column-main-fixed-overlay" v-if="rootState == 'add' || rootState == 'edit'" v-on:click="$emit('set-state', 'init'); cancelPolicy();"></div>
<div class="nicescroll--bar">
<table class="table table-hover table-bordered table-edge">
<tr>
<th class="td-bool" v-bind:class="sort.order" v-on:click="sortList(sort, 'isactive', Boolean)">Status</th>
<th class="td-name" v-bind:class="sort.order" v-on:click="sortList(sort, 'name', String)">Name</th>
<th class="td-name" v-bind:class="sort.order" v-on:click="sortList(sort, 'policyinstance.info.type', String)">Type</th>
<th class="td-name" v-bind:class="sort.order" v-on:click="sortList(sort, 'policyinstance.info.subType', String)">subType</th>
<th class="td-bool" v-bind:class="sort.order" v-on:click="sortList(sort, 'policyinstance.openApiLifeCycle.onBusinessRequest', Boolean)">Business Request</th>
<th class="td-bool" v-bind:class="sort.order" v-on:click="sortList(sort, 'policyinstance.openApiLifeCycle.onBusinessResponse', Boolean)">Business Response</th>
<th class="td-bool" v-bind:class="sort.order" v-on:click="sortList(sort, 'policyinstance.openApiLifeCycle.onProxyRequest', Boolean)">Proxy Request</th>
<th class="td-bool" v-bind:class="sort.order" v-on:click="sortList(sort, 'policyinstance.openApiLifeCycle.onProxyResponse', Boolean)">Proxy Response</th>
<th class="td-datetime-x" v-bind:class="sort.order" v-on:click="sortList(sort, 'created', Date)">Created / Updated / Deleted</th>
<th class="td-action-1"></th>
<th class="td-action-1"></th>
<th class="td-action-1"></th>
</tr>
<tr v-for="(policy, index) in sortByNested(sort, policyList)" v-bind:key="policy.uuid" v-bind:class="{'active': isSelected(index), 'tr-deleted': policy.isdeleted}">
<td class="txt-c">
<i class="fas fa-times-circle" title="Not Active" v-if="!policy.isactive"></i>
<i class="fas fa-check-circle txt-green" title="Active" v-if="policy.isactive"></i>
</td>
<td>{{policy.name}} <small class="d-block">{{policy.description}}</small></td>
<td>{{policy.policyinstance.info.type}}</td>
<td>{{policy.policyinstance.info.subType}}</td>
<td class="txt-c"><i class="fas fa-circle" title="Active" v-bind:class="{'txt-cyan': policy.policyinstance.openApiLifeCycle.onBusinessRequest}"></i></td>
<td class="txt-c"><i class="fas fa-circle" title="Active" v-bind:class="{'txt-cyan': policy.policyinstance.openApiLifeCycle.onBusinessResponse}"></i></td>
<td class="txt-c"><i class="fas fa-circle" title="Active" v-bind:class="{'txt-purple': policy.policyinstance.openApiLifeCycle.onProxyRequest}"></i></td>
<td class="txt-c"><i class="fas fa-circle" title="Active" v-bind:class="{'txt-purple': policy.policyinstance.openApiLifeCycle.onProxyResponse}"></i></td>
<td>
<div>
<strong class="small">CREATED:</strong>
<small>{{policy.created | formatDateTime}}</small>
</div>
<div>
<strong class="small">UPDATED:</strong>
<small>{{policy.updated | formatDateTime}}</small>
</div>
<div v-if="policy.isdeleted">
<strong class="small">DELETED:</strong>
<small>{{policy.deleted | formatDateTime}}</small>
</div>
</td>
<td class="td-action-1">
<a class="btn btn-xl txt-link btn-square" title="CHANGE LOGS" v-on:click="changeLogs(policy.uuid, '/policy*/_search');"><i class="fa fa-search"></i></a>
</td>
<td class="td-action-1">
<a v-if="!policy.isdeleted" class="btn btn-xl txt-link btn-square" title="EDIT POLICY" v-on:click="$emit('set-state', 'edit'); selectPolicy(policy, index);"><i class="fas fa-edit"></i></a>
</td>
<td class="td-action-1">
<a v-if="!policy.isdeleted" class="btn btn-xl txt-link txt-grey btn-square" title="DELETE POLICY" v-on:click="deletePolicy(policy, index)"><i class="fas fa-trash-alt"></i></a>
</td>
</tr>
</table>
</div>
</section>
<aside class="column column-aside column-aside-2x add-column">
<div class="clearfix brd-b column-header column-min-button">
<h5 class="column-header-title" >
<span v-if="rootState == 'add'">Add New Policy</span>
<span v-if="rootState == 'edit'">Edit Policy</span>
</h5>
</div>
<div class="column-content">
<div class="nicescroll-bar">
<div class="p-3">
<div class="form-group" v-bind:class="{ 'has-error': errors.has('name') }">
<label for="name">Policy Name:</label>
<input type="text" name="name" id="name" v-model="policy.name" v-validate="'required|min:2'" class="form-control">
<em v-bind:class="{ 'show': errors.has('name') }">{{ errors.first('name') }}</em>
</div>
<div class="form-group" v-bind:class="{ 'has-error': errors.has('description') }">
<label for="description">Description:</label>
<textarea type="text" name="description" id="description" v-model="policy.description" v-validate="'required'" class="form-control"></textarea>
<em v-bind:class="{ 'show': errors.has('description') }">{{ errors.first('description') }}</em>
</div>
<div class="form-group form-inline">
<label class="d-block">Is Active?</label>
<span class="switch switch-green ml-auto">
<input type="checkbox" name="isactive" id="isactive" v-model="policy.isactive">
<label for="isactive"></label>
</span>
</div>
<div class="form-group " v-bind:class="{ 'has-error': errors.has('type') }">
<label>Policy Type</label>
<select class="form-control" name="type" id="type" v-model="policy.typeid" v-validate="'required'" v-on:change="getTemplate($event.target.value, true)">
<option v-for="(type,index) in policyTypes" :value="type.uuid">{{type.type}} / {{type.subtype}} / {{type.name}}</option>
</select>
<em v-bind:class="{ 'show': errors.has('type') }">{{ errors.first('type') }}</em>
</div>
<div v-if="template">
<h6>{{template.info.title}}</h6>
<p class="small">{{template.info.description}}</p>
<div v-for="(cv, ck, ci) in template.components.schemas">
<div v-for="(pv, pk, pi) in cv.properties">
<schema-template-form :v="pv" :k="pk" :i="pi" :req="cv.required" :attr="policy.policyinstance"></schema-template-form>
</div>
</div>
</div>
<div class="form-group" v-bind:class="{ 'has-error': errors.has('attributes') }">
<label for="attributes" class="txt-muted">Attributes:</label>
<textarea type="text" name="attributes" id="attributes" v-model="stringifyAttribute" v-validate="'required'" class="form-control" :readonly="!$root.abyssSandbox"></textarea>
<em v-bind:class="{ 'show': errors.has('attributes') }">{{ errors.first('attributes') }}</em>
</div>
<div class="form-group d-flex justify-content-between">
<button type="button" class="btn btn-secondary btn-rounded" v-on:click="$emit('set-state', 'init'); cancelPolicy()">CANCEL</button>
<button type="button" class="btn btn-primary btn-rounded" v-if="rootState == 'add'" v-on:click="policyAction('add')">ADD</button>
<button type="button" class="btn btn-primary btn-rounded" v-if="rootState == 'edit'" v-on:click="policyAction('edit')">SAVE</button>
</div>
</div>
</div>
</div>
</aside>
<aside class="column column-aside manage-column column-minimize">
<div class="clearfix brd-b column-header column-min-button">
<h5 class="column-header-title">Policy Types</h5>
</div>
<div class="column-content">
<div class="nicescroll-bar">
<policy-types v-for="(t,index) in policyTypes" :key="t.uuid" :t="t" :index="index" :orgoptions="orgOptions" inline-template>
<article class="field-controls field-color-grey field-level-1" :class="{'is-deleted': t.isdeleted}">
<div class="field-sum">
<a class="field-link nav-caret d-flex align-items-center" data-toggle="collapse" v-bind:data-target="'#t'+index" v-bind:aria-controls="'t'+index">
<i class="fas fa-times-circle txt-muted mr-2" title="Not Active" v-if="!t.isactive"></i>
<i class="fas fa-check-circle txt-green mr-2" title="Active" v-if="t.isactive"></i>
<strong class="fnt-bold">{{t.name}}</strong>
</a>
<div class="ficon-actions dropdown dropdown-hover" v-if="!t.isdeleted">
<button type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="fas fa-ellipsis-h"></i></button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
<li><a title="Add Policy Type" v-on:click="addType()"><i class="fas fa-lg fa-plus"></i> Add Policy Type</a></li>
<li><a title="Remove Policy Type" v-on:click="deleteType(t, index)"><i class="fa fa-trash-alt"></i> Remove Policy Type</a></li>
</ul>
</div>
</div>
<fieldset v-bind:id="'t'+index" class="collapse field-acc" :disabled="t.isdeleted">
<div class="form-group" v-bind:class="{ 'has-error': errors.has('name') }">
<label>Name</label>
<input class="form-control" name="name" v-model="t.name" v-validate="'required'">
<em v-bind:class="{ 'show': errors.has('name') }">{{ errors.first('name') }}</em>
</div>
<div class="form-group" v-bind:class="{ 'has-error': errors.has('type') }">
<label>Type</label>
<input class="form-control" name="type" v-model="t.type" v-validate="'required'">
<em v-bind:class="{ 'show': errors.has('type') }">{{ errors.first('type') }}</em>
</div>
<div class="form-group" v-bind:class="{ 'has-error': errors.has('subtype') }">
<label>Sub Type</label>
<input class="form-control" name="subtype" v-model="t.subtype" v-validate="'required'">
<em v-bind:class="{ 'show': errors.has('subtype') }">{{ errors.first('subtype') }}</em>
</div>
<div class="form-group">
<label>Description</label>
<textarea class="form-control" name="description" v-model="t.description"></textarea>
</div>
<div class="form-group" v-bind:class="{ 'has-error': errors.has('organization') }">
<label>Organization</label>
<select class="form-control" name="organization" v-model="t.organizationid" v-validate="'required'">
<option v-for="(org,index) in orgoptions" :value="org.uuid" :class="{'op-deleted': org.isdeleted}" :disabled="org.isdeleted">{{org.name}}</option>
</select>
<em v-bind:class="{ 'show': errors.has('organization') }">{{ errors.first('organization') }}</em>
</div>
<div class="form-group form-inline">
<label class="d-block">Is Active?</label>
<span class="switch switch-green ml-auto">
<input type="checkbox" name="isactive" :id="'isactive'+t.uuid" v-model="t.isactive">
<label :for="'isactive'+t.uuid"></label>
</span>
</div>
<div class="form-group" v-bind:class="{ 'has-error': errors.has('template') }">
<label for="template">Template:</label>
<textarea type="text" name="template" id="template" v-model.lazy="stringifyTemplate" v-validate="'required'" class="form-control"></textarea>
<em v-bind:class="{ 'show': errors.has('template') }">{{ errors.first('template') }}</em>
</div>
<div class="form-group d-flex justify-content-center">
<button type="button" class="btn btn-secondary btn-rounded mr-auto" v-if="!t.uuid" v-on:click="cancelAddType(t)">CANCEL</button>
<button type="button" class="btn btn-primary btn-rounded" v-if="!t.uuid" v-on:click="saveAddType(t)">ADD</button>
<button type="button" class="btn btn-primary btn-rounded" v-if="t.uuid" v-on:click="saveType(t)">SAVE</button>
</div>
</fieldset>
</article>
</policy-types>
</div>
</div>
</aside>
<div class="btn-float-br btn-float-under">
<button class="btn btn-xl btn-green btn-circle" v-on:click="$emit('set-state', 'add', 'init')" title="ADD NEW POLICY "><i class="fas fa-plus"></i></button>
</div>
</div>
</api-policies>
</main>
</div>
<script id="reqVue" data-module="api-policies" data-main="/dist/js/main" src="/dist/js/lib/require.min.js"></script>
</body>
</html>