Skip to content

ui,api: support secondary staging store actions #11381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ public class ApiConstants {
public static final String NEXT_ACL_RULE_ID = "nextaclruleid";
public static final String NEXT_HOP = "nexthop";
public static final String MOVE_ACL_CONSISTENCY_HASH = "aclconsistencyhash";
public static final String IMAGE_CACHE_STORES = "imagecachestores";
public static final String IMAGE_PATH = "imagepath";
public static final String INSTANCE_CONVERSION_SUPPORTED = "instanceconversionsupported";
public static final String INTERNAL_DNS1 = "internaldns1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public interface ImageStoreDao extends GenericDao<ImageStoreVO, Long> {

List<ImageStoreVO> listImageStores();

Integer countAllImageCacheStores();

List<ImageStoreVO> listImageCacheStores();

List<ImageStoreVO> listStoresByZoneId(long zoneId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ public List<ImageStoreVO> listImageStores() {
return listBy(sc);
}

@Override
public Integer countAllImageCacheStores() {
SearchCriteria<ImageStoreVO> sc = createSearchCriteria();
sc.addAnd("role", SearchCriteria.Op.EQ, DataStoreRole.Image);
return getCount(sc);
}

@Override
public List<ImageStoreVO> listImageCacheStores() {
SearchCriteria<ImageStoreVO> sc = createSearchCriteria();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ public InfrastructureResponse listInfrastructure() {
response.setHosts(hostCountAndCpuSockets.first());
response.setStoragePools(storagePoolDao.countAll());
response.setImageStores(imageStoreDao.countAllImageStores());
response.setImageCacheStores(imageStoreDao.countAllImageCacheStores());
response.setObjectStores(objectStoreDao.countAllObjectStores());
response.setSystemvms(vmInstanceDao.countByTypes(VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm));
response.setRouters(domainRouterDao.countAllByRole(VirtualRouter.Role.VIRTUAL_ROUTER));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;

import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;

public class InfrastructureResponse extends BaseResponse {
Expand Down Expand Up @@ -75,6 +77,10 @@ public class InfrastructureResponse extends BaseResponse {
@Param(description = "Number of Alerts")
private Integer alerts;

@SerializedName(ApiConstants.IMAGE_CACHE_STORES)
@Param(description = "Number of image cache stores", since = "4.22.0")
private Integer imageCacheStores;

public InfrastructureResponse() {
setObjectName("infrastructure");
}
Expand Down Expand Up @@ -126,4 +132,8 @@ public void setManagementServers(Integer managementServers) {
public void setObjectStores(Integer objectStores) {
this.objectStores = objectStores;
}

public void setImageCacheStores(Integer imageCacheStores) {
this.imageCacheStores = imageCacheStores;
}
}
4 changes: 4 additions & 0 deletions ui/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
"label.action.delete.pod": "Delete Pod",
"label.action.delete.primary.storage": "Delete Primary Storage",
"label.action.delete.routing.firewall.rule": "Delete IPv4 Routing firewall rule",
"label.action.delete.secondary.staging.storage": "Delete Secondary Staging Storage",
"label.action.delete.secondary.storage": "Delete Secondary Storage",
"label.action.delete.security.group": "Delete Security Group",
"label.action.delete.snapshot": "Delete Snapshot",
Expand Down Expand Up @@ -315,6 +316,7 @@
"label.add.routing.policy": "Add Routing Policy",
"label.add.rule": "Add Rule",
"label.add.secondary.ip": "Add Secondary IP",
"label.add.secondary.staging.storage": "Add Secondary Staging Storage",
"label.add.secondary.storage": "Add Secondary Storage",
"label.add.security.group": "Add Security Group",
"label.add.setting": "Add setting",
Expand Down Expand Up @@ -2167,6 +2169,7 @@
"label.search": "Search",
"label.secondary.isolated.vlan.type.isolated": "Isolated",
"label.secondary.isolated.vlan.type.promiscuous": "Promiscuous",
"label.secondary.staging.storage": "Secondary Staging Storage",
"label.secondary.storage": "Secondary Storage",
"label.secondary.storage.vm": "Secondary Storage VM",
"label.secondaryips": "Secondary IPs",
Expand Down Expand Up @@ -2878,6 +2881,7 @@
"message.action.delete.oauth.provider": "Please confirm that you want to delete the OAuth provider.",
"message.action.delete.physical.network": "Please confirm that you want to delete this physical Network.",
"message.action.delete.pod": "Please confirm that you want to delete this Pod.",
"message.action.delete.secondary.staging.storage": "Please confirm that you want to delete this secondary staging storage.",
"message.action.delete.secondary.storage": "Please confirm that you want to delete this secondary storage.",
"message.action.delete.security.group": "Please confirm that you want to delete this security group.",
"message.action.delete.snapshot": "Please confirm that you want to delete this Snapshot.",
Expand Down
1 change: 1 addition & 0 deletions ui/src/config/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function generateRouterMap (section) {
if ('show' in child && !child.show()) {
continue
}
console.log('Generating route for child:', child.name)
var component = child.component ? child.component : shallowRef(AutogenView)
var route = {
name: child.name,
Expand Down
2 changes: 2 additions & 0 deletions ui/src/config/section/infra.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import clusters from '@/config/section/infra/clusters'
import hosts from '@/config/section/infra/hosts'
import primaryStorages from '@/config/section/infra/primaryStorages'
import secondaryStorages from '@/config/section/infra/secondaryStorages'
import secondaryStagingStorages from '@/config/section/infra/secondaryStagingStorages'
import objectStorages from '@/config/section/infra/objectStorages'
import systemVms from '@/config/section/infra/systemVms'
import routers from '@/config/section/infra/routers'
Expand Down Expand Up @@ -50,6 +51,7 @@ export default {
hosts,
primaryStorages,
secondaryStorages,
secondaryStagingStorages,
objectStorages,
systemVms,
routers,
Expand Down
64 changes: 64 additions & 0 deletions ui/src/config/section/infra/secondaryStagingStorages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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.

import store from '@/store'

export default {
name: 'imagecachestore',
title: 'label.secondary.staging.storage',
icon: 'file-image-outlined',
docHelp: 'adminguide/storage.html#secondary-storage',
permission: ['listSecondaryStagingStores'],
searchFilters: ['name', 'zoneid', 'provider'],
hidden: true,
columns: () => {
var fields = ['name', 'url', 'protocol', 'scope', 'zonename']
if (store.getters.apis.listSecondaryStagingStores.params.filter(x => x.name === 'readonly').length > 0) {
fields.push({
field: 'readonly',
customTitle: 'access'
})
}
return fields
},
details: () => {
var fields = ['name', 'id', 'url', 'protocol', 'provider', 'scope', 'zonename']
if (store.getters.apis.listSecondaryStagingStores.params.filter(x => x.name === 'readonly').length > 0) {
fields.push('readonly')
}
return fields
},
resourceType: 'SecondaryStagingStorage',
actions: [
{
api: 'createSecondaryStagingStore',
icon: 'plus-outlined',
docHelp: 'installguide/configuration.html#add-secondary-storage',
label: 'label.add.secondary.staging.storage',
listView: true,
args: ['url', 'zoneid', 'scope', 'provider']
},
{
api: 'deleteSecondaryStagingStore',
icon: 'delete-outlined',
label: 'label.action.delete.secondary.staging.storage',
message: 'message.action.delete.secondary.staging.storage',
dataView: true,
displayName: (record) => { return record.name || record.displayName || record.id }
}
]
}
2 changes: 2 additions & 0 deletions ui/src/core/lazy_lib/icons_use.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import {
EyeOutlined,
FieldTimeOutlined,
FileDoneOutlined,
FileImageOutlined,
FileProtectOutlined,
FileSyncOutlined,
FileTextOutlined,
Expand Down Expand Up @@ -257,6 +258,7 @@ export default {
app.component('EyeOutlined', EyeOutlined)
app.component('FieldTimeOutlined', FieldTimeOutlined)
app.component('FileDoneOutlined', FileDoneOutlined)
app.component('FileImageOutlined', FileImageOutlined)
app.component('FileProtectOutlined', FileProtectOutlined)
app.component('FileSyncOutlined', FileSyncOutlined)
app.component('FileTextOutlined', FileTextOutlined)
Expand Down
15 changes: 9 additions & 6 deletions ui/src/views/infra/InfraSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@
v-if="routes[section]">
<chart-card :loading="loading">
<div class="chart-card-inner">
<router-link :to="{ name: section.substring(0, section.length - 1) }">
<h2>{{ $t(routes[section].title) }}</h2>
<router-link :to="{ name: routes[section].routename }">
<h2 style="overflow: hidden; text-overflow: ellipsis;">{{ $t(routes[section].title) }}</h2>
<h2><render-icon :icon="routes[section].icon" /> {{ stats[section] }}</h2>
</router-link>
</div>
Expand Down Expand Up @@ -187,7 +187,7 @@ export default {
return {
loading: true,
routes: {},
sections: ['zones', 'pods', 'clusters', 'hosts', 'storagepools', 'imagestores', 'objectstores', 'systemvms', 'routers', 'cpusockets', 'managementservers', 'alerts', 'ilbvms', 'metrics'],
sections: ['zones', 'pods', 'clusters', 'hosts', 'storagepools', 'imagestores', 'imagecachestores', 'objectstores', 'systemvms', 'routers', 'cpusockets', 'managementservers', 'alerts', 'ilbvms', 'metrics'],
sslFormVisible: false,
stats: {},
intermediateCertificates: [],
Expand Down Expand Up @@ -216,11 +216,14 @@ export default {
fetchData () {
this.routes = {}
for (const section of this.sections) {
if (router.resolve('/' + section.substring(0, section.length - 1)).matched[0].redirect === '/exception/404') {
const sectionRouteName = section.substring(0, section.length - 1)
const sectionKey = section
if (router.resolve('/' + sectionRouteName).matched[0].redirect === '/exception/404') {
continue
}
const node = router.resolve({ name: section.substring(0, section.length - 1) })
this.routes[section] = {
const node = router.resolve({ name: sectionRouteName })
this.routes[sectionKey] = {
routename: sectionRouteName,
title: node.meta.title,
icon: node.meta.icon
}
Expand Down
Loading