Skip to content

Commit 3074a94

Browse files
sureshanapartidhslove
authored andcommitted
UI: Move Backup Repository to Infrastructure (from Configuration) (apache#11738)
* UI: Move Backup Repository to Infrastructure (from Configuration) * Updated nas doc help link
1 parent 3d1f642 commit 3074a94

File tree

6 files changed

+82
-50
lines changed

6 files changed

+82
-50
lines changed

plugins/metrics/src/main/java/org/apache/cloudstack/metrics/MetricsServiceImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import org.apache.cloudstack.api.response.UserVmResponse;
6060
import org.apache.cloudstack.api.response.VolumeResponse;
6161
import org.apache.cloudstack.api.response.ZoneResponse;
62+
import org.apache.cloudstack.backup.dao.BackupRepositoryDao;
6263
import org.apache.cloudstack.cluster.ClusterDrsAlgorithm;
6364
import org.apache.cloudstack.context.CallContext;
6465
import org.apache.cloudstack.framework.config.ConfigKey;
@@ -158,6 +159,8 @@ public class MetricsServiceImpl extends MutualExclusiveIdsManagerBase implements
158159
@Inject
159160
private ImageStoreDao imageStoreDao;
160161
@Inject
162+
BackupRepositoryDao backupRepositoryDao;
163+
@Inject
161164
private VMInstanceDao vmInstanceDao;
162165
@Inject
163166
private DomainRouterDao domainRouterDao;
@@ -558,6 +561,7 @@ public InfrastructureResponse listInfrastructure() {
558561
response.setHosts(hostCountAndCpuSockets.first());
559562
response.setStoragePools(storagePoolDao.countAll());
560563
response.setImageStores(imageStoreDao.countAllImageStores());
564+
response.setBackupRepositories(backupRepositoryDao.countAll());
561565
response.setObjectStores(objectStoreDao.countAllObjectStores());
562566
response.setSystemvms(vmInstanceDao.countByTypes(VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm));
563567
response.setRouters(domainRouterDao.countAllByRole(VirtualRouter.Role.VIRTUAL_ROUTER));

plugins/metrics/src/main/java/org/apache/cloudstack/response/InfrastructureResponse.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public class InfrastructureResponse extends BaseResponse {
4747
@Param(description = "Number of images stores")
4848
private Integer imageStores;
4949

50+
@SerializedName("backuprepositories")
51+
@Param(description = "Number of backup repositories", since = "4.22.0")
52+
private Integer backupRepositories;
53+
5054
@SerializedName("objectstores")
5155
@Param(description = "Number of object stores")
5256
private Integer objectStores;
@@ -103,6 +107,10 @@ public void setImageStores(final Integer imageStores) {
103107
this.imageStores = imageStores;
104108
}
105109

110+
public void setBackupRepositories(Integer backupRepositories) {
111+
this.backupRepositories = backupRepositories;
112+
}
113+
106114
public void setSystemvms(final Integer systemvms) {
107115
this.systemvms = systemvms;
108116
}

ui/src/config/section/config.js

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -133,52 +133,6 @@ export default {
133133
}
134134
]
135135
},
136-
{
137-
name: 'backuprepository',
138-
title: 'label.backup.repository',
139-
icon: 'inbox-outlined',
140-
docHelp: 'adminguide/backup_and_recovery.html',
141-
permission: ['listBackupRepositories'],
142-
searchFilters: ['zoneid'],
143-
columns: ['name', 'provider', 'type', 'address', 'zonename'],
144-
details: ['name', 'type', 'address', 'provider', 'zonename', 'crosszoneinstancecreation'],
145-
actions: [
146-
{
147-
api: 'addBackupRepository',
148-
icon: 'plus-outlined',
149-
label: 'label.backup.repository.add',
150-
listView: true,
151-
args: [
152-
'name', 'provider', 'address', 'type', 'mountopts', 'zoneid', 'crosszoneinstancecreation'
153-
],
154-
mapping: {
155-
type: {
156-
options: ['nfs', 'cifs', 'ceph']
157-
},
158-
provider: {
159-
value: (record) => { return 'nas' }
160-
}
161-
}
162-
},
163-
{
164-
api: 'updateBackupRepository',
165-
icon: 'edit-outlined',
166-
label: 'label.backup.repository.edit',
167-
message: 'message.action.edit.backup.repository',
168-
args: ['name', 'address', 'mountopts', 'crosszoneinstancecreation'],
169-
dataView: true,
170-
popup: true
171-
},
172-
{
173-
api: 'deleteBackupRepository',
174-
icon: 'delete-outlined',
175-
label: 'label.backup.repository.remove',
176-
message: 'message.action.delete.backup.repository',
177-
dataView: true,
178-
popup: true
179-
}
180-
]
181-
},
182136
{
183137
name: 'hypervisorcapability',
184138
title: 'label.hypervisor.capabilities',

ui/src/config/section/infra.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import clusters from '@/config/section/infra/clusters'
2323
import hosts from '@/config/section/infra/hosts'
2424
import primaryStorages from '@/config/section/infra/primaryStorages'
2525
import secondaryStorages from '@/config/section/infra/secondaryStorages'
26+
import backupRepositories from '@/config/section/infra/backupRepositories'
2627
import objectStorages from '@/config/section/infra/objectStorages'
2728
import systemVms from '@/config/section/infra/systemVms'
2829
import routers from '@/config/section/infra/routers'
@@ -51,6 +52,7 @@ export default {
5152
hosts,
5253
primaryStorages,
5354
secondaryStorages,
55+
backupRepositories,
5456
objectStorages,
5557
systemVms,
5658
routers,
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
export default {
19+
name: 'backuprepository',
20+
title: 'label.backup.repository',
21+
icon: 'inbox-outlined',
22+
docHelp: 'adminguide/nas_plugin.html',
23+
permission: ['listBackupRepositories'],
24+
searchFilters: ['zoneid'],
25+
columns: ['name', 'provider', 'type', 'address', 'zonename'],
26+
details: ['name', 'type', 'address', 'provider', 'zonename', 'crosszoneinstancecreation'],
27+
actions: [
28+
{
29+
api: 'addBackupRepository',
30+
icon: 'plus-outlined',
31+
label: 'label.backup.repository.add',
32+
listView: true,
33+
args: [
34+
'name', 'provider', 'address', 'type', 'mountopts', 'zoneid', 'crosszoneinstancecreation'
35+
],
36+
mapping: {
37+
type: {
38+
options: ['nfs', 'cifs', 'ceph']
39+
},
40+
provider: {
41+
value: (record) => { return 'nas' }
42+
}
43+
}
44+
},
45+
{
46+
api: 'updateBackupRepository',
47+
icon: 'edit-outlined',
48+
label: 'label.backup.repository.edit',
49+
message: 'message.action.edit.backup.repository',
50+
args: ['name', 'address', 'mountopts', 'crosszoneinstancecreation'],
51+
dataView: true,
52+
popup: true
53+
},
54+
{
55+
api: 'deleteBackupRepository',
56+
icon: 'delete-outlined',
57+
label: 'label.backup.repository.remove',
58+
message: 'message.action.delete.backup.repository',
59+
dataView: true,
60+
popup: true
61+
}
62+
]
63+
}

ui/src/views/infra/InfraSummary.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
v-if="routes[section]">
157157
<chart-card :loading="loading">
158158
<div class="chart-card-inner">
159-
<router-link :to="{ name: section.substring(0, section.length - 1) }">
159+
<router-link :to="{ name: section === 'backuprepositories' ? 'backuprepository' : section.substring(0, section.length - 1) }">
160160
<h2>{{ $t(routes[section].title) }}</h2>
161161
<h2><render-icon :icon="routes[section].icon" /> {{ stats[section] }}</h2>
162162
</router-link>
@@ -187,7 +187,7 @@ export default {
187187
return {
188188
loading: true,
189189
routes: {},
190-
sections: ['zones', 'pods', 'clusters', 'hosts', 'storagepools', 'imagestores', 'objectstores', 'systemvms', 'routers', 'cpusockets', 'managementservers', 'alerts', 'ilbvms', 'metrics'],
190+
sections: ['zones', 'pods', 'clusters', 'hosts', 'storagepools', 'imagestores', 'backuprepositories', 'objectstores', 'systemvms', 'routers', 'cpusockets', 'managementservers', 'alerts', 'ilbvms', 'metrics'],
191191
sslFormVisible: false,
192192
stats: {},
193193
intermediateCertificates: [],
@@ -216,10 +216,11 @@ export default {
216216
fetchData () {
217217
this.routes = {}
218218
for (const section of this.sections) {
219-
if (router.resolve('/' + section.substring(0, section.length - 1)).matched[0].redirect === '/exception/404') {
219+
const route = section === 'backuprepositories' ? 'backuprepository' : section.substring(0, section.length - 1)
220+
if (router.resolve('/' + route).matched[0].redirect === '/exception/404') {
220221
continue
221222
}
222-
const node = router.resolve({ name: section.substring(0, section.length - 1) })
223+
const node = router.resolve({ name: route })
223224
this.routes[section] = {
224225
title: node.meta.title,
225226
icon: node.meta.icon

0 commit comments

Comments
 (0)