Skip to content

Commit 95c3136

Browse files
committed
Setting up licenses global filters location and add settings api service licenses locations scope
1 parent 712f383 commit 95c3136

File tree

8 files changed

+64
-9
lines changed

8 files changed

+64
-9
lines changed

src/components/GlobalFilters.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,7 @@
7878
{{ $t('common.forms.reset') }}
7979
{{ $t('common.globalFilters.location') }}
8080
</option>
81-
<option
82-
v-for="(loc, index) in globalFilters.locations"
83-
:key="index"
84-
>
81+
<option v-for="(loc, index) in setLocations" :key="index">
8582
{{ loc }}
8683
</option>
8784
</b-select>
@@ -163,6 +160,7 @@
163160
</template>
164161

165162
<script>
163+
import _ from 'lodash'
166164
import { mapState, mapActions, mapGetters, mapMutations } from 'vuex'
167165
import { formatDatepickerDate } from '@/helpers/helpers.js'
168166
import formatDate from '@/filters/formatDate.js'
@@ -416,6 +414,13 @@ export default {
416414
this.$route.name !== 'nodes'
417415
)
418416
},
417+
setLocations() {
418+
if (_.includes(this.$route.path, 'licenses')) {
419+
return this.globalFilters.locationsLicenses
420+
} else {
421+
return this.globalFilters.locations
422+
}
423+
},
419424
},
420425
}
421426
</script>

src/components/licenses/contracts/Microsoft/MsSqlServerForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ export default {
324324
325325
this.locationList = JSON.parse(
326326
localStorage.getItem('persisted-data')
327-
).globalFilters.locations
327+
).globalFilters.locationsLicenses
328328
this.locationList.unshift('All')
329329
},
330330
methods: {

src/components/licenses/contracts/MySQL/MySqlContractsForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ export default {
349349
350350
this.locationList = JSON.parse(
351351
localStorage.getItem('persisted-data')
352-
).globalFilters.locations
352+
).globalFilters.locationsLicenses
353353
this.locationList.unshift('All')
354354
},
355355
methods: {

src/components/licenses/contracts/Oracle/OracleContractsForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ export default {
445445
446446
this.locationList = JSON.parse(
447447
localStorage.getItem('persisted-data')
448-
).globalFilters.locations
448+
).globalFilters.locationsLicenses
449449
this.locationList.unshift('All')
450450
},
451451
methods: {

src/components/settings/ApiService.vue

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,35 @@
324324
</div>
325325
</div>
326326
</BoxContent>
327+
328+
<BoxContent
329+
title="Licenses Locations"
330+
class="is-size-5 has-text-weight-semibold"
331+
customStyle="padding: 20px 40px"
332+
border
333+
hasShadow
334+
>
335+
<div class="column is-one-quarter">
336+
<div class="field">
337+
<div
338+
class="is-flex is-flex-direction-row is-justify-content-space-between"
339+
>
340+
<label
341+
v-html="highlight(APIServiceLabels[22])"
342+
class="label is-small"
343+
/>
344+
<b-icon
345+
pack="fas"
346+
icon="circle-info"
347+
size="is-small"
348+
type="is-info"
349+
v-tooltip.top="options(licensesLocationsOptions)"
350+
/>
351+
</div>
352+
<CustomInput v-model="APIService.ScopeAsLocation" />
353+
</div>
354+
</div>
355+
</BoxContent>
327356
</BoxContent>
328357
</article>
329358
</template>

src/mixins/settings/settings.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export default {
5757
EnableAwsMenu: null,
5858
EnableGcpMenu: null,
5959
EnableOciMenu: null,
60+
ScopeAsLocation: null,
6061
},
6162
AlertService: {
6263
RemoteEndpoint: null,
@@ -228,6 +229,7 @@ export default {
228229
'Policy Audit Names to Verify on Databases',
229230
'Round Decimal Licenses',
230231
'Threshold Percentage of DB Memory vs Host Memory',
232+
'Set Licenses Location Scope',
231233
],
232234
highlightApiService: false,
233235
AlertServiceLabels: [
@@ -406,6 +408,7 @@ export default {
406408
EnableAwsMenu: this.getAPIService.EnableAwsMenu,
407409
EnableGcpMenu: this.getAPIService.EnableGcpMenu,
408410
EnableOciMenu: this.getAPIService.EnableOciMenu,
411+
ScopeAsLocation: this.getAPIService.ScopeAsLocation,
409412
}
410413
},
411414
bindOriginalResourceFilePathData() {
@@ -697,6 +700,9 @@ export default {
697700
crontabOptions() {
698701
return `Available options: </br> @daily </br> @weekly </br> @monthly`
699702
},
703+
licensesLocationsOptions() {
704+
return `To set licenses locations scope </br> use ´comma ( , )´ as separator: </br> loc1, loc2, loc3`
705+
},
700706
warningAndCritical() {
701707
return [
702708
{

src/store/modules/common/global-filters.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { axiosRequest } from '@/services/services.js'
22

33
export const state = () => ({
4-
locations: {},
5-
environments: {},
4+
locations: [],
5+
locationsLicenses: [],
6+
environments: [],
67
activeFilters: {
78
location: null,
89
environment: null,
@@ -25,6 +26,9 @@ export const mutations = {
2526
SET_LOCATIONS: (state, payload) => {
2627
state.locations = payload
2728
},
29+
SET_LOCATIONS_LICENSES: (state, payload) => {
30+
state.locationsLicenses = payload
31+
},
2832
SET_ENVIRONMENTS: (state, payload) => {
2933
state.environments = payload
3034
},
@@ -47,6 +51,15 @@ export const actions = {
4751
commit('SET_LOCATIONS', res.data)
4852
})
4953
},
54+
async getGlobalFiltersLicensesLocations({ commit }) {
55+
const config = {
56+
method: 'get',
57+
url: 'hosts/technologies/all/databases/licenses/locations',
58+
}
59+
await axiosRequest('baseApi', config).then((res) => {
60+
commit('SET_LOCATIONS_LICENSES', res.data)
61+
})
62+
},
5063
async getGlobalFiltersEnvironments({ commit }) {
5164
const config = {
5265
method: 'get',

src/views/Dashboard.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export default {
5757
this.getCloudObjects()
5858
5959
this.getGlobalFiltersLocations()
60+
this.getGlobalFiltersLicensesLocations()
6061
this.getGlobalFiltersEnvironments()
6162
this.requestSettings()
6263
},
@@ -65,6 +66,7 @@ export default {
6566
'getDashboardData',
6667
'getTechnologiesData',
6768
'getGlobalFiltersLocations',
69+
'getGlobalFiltersLicensesLocations',
6870
'getGlobalFiltersEnvironments',
6971
'getCloudObjects',
7072
'getDbConnection',

0 commit comments

Comments
 (0)