mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge remote-tracking branch 'apache/4.16'
This commit is contained in:
commit
51d4e5475f
@ -31,6 +31,7 @@ import java.util.UUID;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.hypervisor.vmware.mo.DatastoreFile;
|
||||
import com.vmware.vim25.FileInfo;
|
||||
import com.vmware.vim25.FileQueryFlags;
|
||||
import com.vmware.vim25.HostDatastoreBrowserSearchResults;
|
||||
@ -1140,12 +1141,12 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
return "snapshots/" + accountId + "/" + volumeId;
|
||||
}
|
||||
|
||||
private long getVMSnapshotChainSize(VmwareContext context, VmwareHypervisorHost hyperHost, String fileName, ManagedObjectReference morDs, String exceptFileName)
|
||||
throws Exception {
|
||||
private long getVMSnapshotChainSize(VmwareContext context, VmwareHypervisorHost hyperHost, String fileName, ManagedObjectReference morDs,
|
||||
String exceptFileName, String vmName) throws Exception {
|
||||
long size = 0;
|
||||
DatastoreMO dsMo = new DatastoreMO(context, morDs);
|
||||
HostDatastoreBrowserMO browserMo = dsMo.getHostDatastoreBrowserMO();
|
||||
String datastorePath = "[" + dsMo.getName() + "]";
|
||||
String datastorePath = (new DatastoreFile(dsMo.getName(), vmName)).getPath();
|
||||
HostDatastoreBrowserSearchSpec searchSpec = new HostDatastoreBrowserSearchSpec();
|
||||
FileQueryFlags fqf = new FileQueryFlags();
|
||||
fqf.setFileSize(true);
|
||||
@ -1306,11 +1307,11 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
||||
// get volume's chain size for this VM snapshot; exclude current volume vdisk
|
||||
DataStoreTO store = volumeTO.getDataStore();
|
||||
ManagedObjectReference morDs = getDatastoreAsManagedObjectReference(baseName, hyperHost, store);
|
||||
long size = getVMSnapshotChainSize(context, hyperHost, baseName + "-*.vmdk", morDs, newPath);
|
||||
long size = getVMSnapshotChainSize(context, hyperHost, baseName + "-*.vmdk", morDs, newPath, vmName);
|
||||
|
||||
if (volumeTO.getVolumeType() == Volume.Type.ROOT) {
|
||||
// add memory snapshot size
|
||||
size += getVMSnapshotChainSize(context, hyperHost, vmName + "-*.vmsn", morDs, null);
|
||||
size += getVMSnapshotChainSize(context, hyperHost, vmName + "-*.vmsn", morDs, null, vmName);
|
||||
}
|
||||
|
||||
volumeTO.setSize(size);
|
||||
|
||||
@ -48,8 +48,6 @@ import java.util.stream.Collectors;
|
||||
import javax.naming.ConfigurationException;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
import com.cloud.utils.script.Script;
|
||||
import com.cloud.hypervisor.vmware.mo.NetworkMO;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.storage.command.CopyCommand;
|
||||
import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
|
||||
@ -234,6 +232,7 @@ import com.cloud.hypervisor.vmware.mo.HostMO;
|
||||
import com.cloud.hypervisor.vmware.mo.HostStorageSystemMO;
|
||||
import com.cloud.hypervisor.vmware.mo.HypervisorHostHelper;
|
||||
import com.cloud.hypervisor.vmware.mo.NetworkDetails;
|
||||
import com.cloud.hypervisor.vmware.mo.NetworkMO;
|
||||
import com.cloud.hypervisor.vmware.mo.PbmProfileManagerMO;
|
||||
import com.cloud.hypervisor.vmware.mo.StoragepodMO;
|
||||
import com.cloud.hypervisor.vmware.mo.TaskMO;
|
||||
@ -276,6 +275,7 @@ import com.cloud.utils.mgmt.JmxUtil;
|
||||
import com.cloud.utils.mgmt.PropertyMapDynamicBean;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.utils.nicira.nvp.plugin.NiciraNvpApiVersion;
|
||||
import com.cloud.utils.script.Script;
|
||||
import com.cloud.utils.ssh.SshHelper;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.PowerState;
|
||||
@ -1764,7 +1764,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
||||
|
||||
// Check if license supports the feature
|
||||
VmwareHelper.isFeatureLicensed(hyperHost, FeatureKeyConstants.HOTPLUG);
|
||||
VmwareHelper.setVmScaleUpConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getMaxSpeed(), vmSpec.getMinSpeed(), (int) requestedMaxMemoryInMb, ramMb,
|
||||
VmwareHelper.setVmScaleUpConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getMaxSpeed(), getReservedCpuMHZ(vmSpec), (int) requestedMaxMemoryInMb, ramMb,
|
||||
vmSpec.getLimitCpuUse());
|
||||
|
||||
if (!vmMo.configureVm(vmConfigSpec)) {
|
||||
|
||||
@ -3947,7 +3947,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
builder.append("VMSnapshot usage");
|
||||
if (vmSnapshotVO != null) {
|
||||
builder.append(" Id: ").append(vmSnapshotVO.getId()).append(" (").append(vmSnapshotVO.getUuid()).append(") ");
|
||||
builder.append(" Id: ").append(vmSnapshotVO.getUuid());
|
||||
}
|
||||
if (vmInstance != null) {
|
||||
builder.append(" for VM ").append(vmInstance.getHostName()).append(" (").append(vmInstance.getUuid()).append(")");
|
||||
@ -3990,7 +3990,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
builder.append("VMSnapshot on primary storage usage");
|
||||
if (vmSnapshotVO != null) {
|
||||
builder.append(" Id: ").append(vmSnapshotVO.getId()).append(" (").append(vmSnapshotVO.getUuid()).append(") ");
|
||||
builder.append(" Id: ").append(vmSnapshotVO.getUuid());
|
||||
}
|
||||
if (vmInstance != null) {
|
||||
builder.append(" for VM ").append(vmInstance.getHostName()).append(" (").append(vmInstance.getUuid()).append(") ")
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
// under the License.
|
||||
|
||||
import store from '@/store'
|
||||
import { isAdmin } from '@/role'
|
||||
|
||||
export default {
|
||||
name: 'network',
|
||||
@ -29,8 +30,20 @@ export default {
|
||||
icon: 'apartment',
|
||||
permission: ['listNetworks'],
|
||||
resourceType: 'Network',
|
||||
columns: ['name', 'state', 'type', 'vpcname', 'cidr', 'ip6cidr', 'broadcasturi', 'domain', 'account', 'zonename'],
|
||||
details: ['name', 'id', 'description', 'type', 'traffictype', 'vpcid', 'vlan', 'broadcasturi', 'cidr', 'ip6cidr', 'netmask', 'gateway', 'aclname', 'ispersistent', 'restartrequired', 'reservediprange', 'redundantrouter', 'networkdomain', 'zonename', 'account', 'domain'],
|
||||
columns: () => {
|
||||
var fields = ['name', 'state', 'type', 'vpcname', 'cidr', 'ip6cidr', 'broadcasturi', 'domain', 'account', 'zonename']
|
||||
if (!isAdmin()) {
|
||||
fields = fields.filter(function (e) { return e !== 'broadcasturi' })
|
||||
}
|
||||
return fields
|
||||
},
|
||||
details: () => {
|
||||
var fields = ['name', 'id', 'description', 'type', 'traffictype', 'vpcid', 'vlan', 'broadcasturi', 'cidr', 'ip6cidr', 'netmask', 'gateway', 'aclname', 'ispersistent', 'restartrequired', 'reservediprange', 'redundantrouter', 'networkdomain', 'zonename', 'account', 'domain']
|
||||
if (!isAdmin()) {
|
||||
fields = fields.filter(function (e) { return e !== 'broadcasturi' })
|
||||
}
|
||||
return fields
|
||||
},
|
||||
filters: ['all', 'isolated', 'shared', 'l2'],
|
||||
searchFilters: ['keyword', 'zoneid', 'domainid', 'account', 'tags'],
|
||||
related: [{
|
||||
|
||||
26
ui/src/role/index.js
Normal file
26
ui/src/role/index.js
Normal file
@ -0,0 +1,26 @@
|
||||
// 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 function isAdmin () {
|
||||
return ['Admin'].includes(store.getters.userInfo.roletype)
|
||||
}
|
||||
|
||||
export function isAdminOrDomainAdmin () {
|
||||
return ['Admin', 'DomainAdmin'].includes(this.$store.getters.userInfo.roletype)
|
||||
}
|
||||
@ -150,6 +150,7 @@
|
||||
|
||||
<script>
|
||||
import { api } from '@/api'
|
||||
import { isAdmin } from '@/role'
|
||||
import { mixinDevice } from '@/utils/mixin.js'
|
||||
import DetailsTab from '@/components/view/DetailsTab'
|
||||
import FirewallRules from '@/views/network/FirewallRules'
|
||||
@ -230,7 +231,7 @@ export default {
|
||||
dataIndex: 'zonename'
|
||||
}
|
||||
]
|
||||
if (!this.isAdmin()) {
|
||||
if (!isAdmin()) {
|
||||
this.vmColumns = this.vmColumns.filter(x => x.dataIndex !== 'instancename')
|
||||
}
|
||||
this.handleFetchData()
|
||||
@ -279,12 +280,6 @@ export default {
|
||||
}).join('&')
|
||||
)
|
||||
},
|
||||
isAdmin () {
|
||||
return ['Admin'].includes(this.$store.getters.userInfo.roletype)
|
||||
},
|
||||
isAdminOrDomainAdmin () {
|
||||
return ['Admin', 'DomainAdmin'].includes(this.$store.getters.userInfo.roletype)
|
||||
},
|
||||
isValidValueForKey (obj, key) {
|
||||
return key in obj && obj[key] != null
|
||||
},
|
||||
|
||||
@ -141,7 +141,7 @@
|
||||
:closable="true"
|
||||
:footer="null"
|
||||
@cancel="() => { showError = false }"
|
||||
v-ctrl-enter="showError = false"
|
||||
v-ctrl-enter="() => { showError = false }"
|
||||
centered
|
||||
>
|
||||
<span>{{ $t('message.required.traffic.type') }}</span>
|
||||
|
||||
@ -68,7 +68,7 @@
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="this.isAdminOrDomainAdmin()">
|
||||
<a-form-item v-if="isAdminOrDomainAdmin()">
|
||||
<tooltip-label slot="label" :title="$t('label.domainid')" :tooltip="apiParams.domainid.description"/>
|
||||
<a-select
|
||||
v-decorator="['domainid', {}]"
|
||||
@ -193,6 +193,7 @@
|
||||
|
||||
<script>
|
||||
import { api } from '@/api'
|
||||
import { isAdmin, isAdminOrDomainAdmin } from '@/role'
|
||||
import ResourceIcon from '@/components/view/ResourceIcon'
|
||||
import TooltipLabel from '@/components/widgets/TooltipLabel'
|
||||
|
||||
@ -231,7 +232,7 @@ export default {
|
||||
vpcs: [],
|
||||
vpcLoading: false,
|
||||
selectedVpc: {},
|
||||
accountVisible: this.isAdminOrDomainAdmin()
|
||||
accountVisible: isAdminOrDomainAdmin()
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -257,11 +258,8 @@ export default {
|
||||
this.fetchDomainData()
|
||||
this.fetchZoneData()
|
||||
},
|
||||
isAdmin () {
|
||||
return ['Admin'].includes(this.$store.getters.userInfo.roletype)
|
||||
},
|
||||
isAdminOrDomainAdmin () {
|
||||
return ['Admin', 'DomainAdmin'].includes(this.$store.getters.userInfo.roletype)
|
||||
return isAdminOrDomainAdmin()
|
||||
},
|
||||
isObjectEmpty (obj) {
|
||||
return !(obj !== null && obj !== undefined && Object.keys(obj).length > 0 && obj.constructor === Object)
|
||||
@ -320,7 +318,7 @@ export default {
|
||||
handleDomainChange (domain) {
|
||||
this.selectedDomain = domain
|
||||
this.accountVisible = domain.id !== '-1'
|
||||
if (this.isAdminOrDomainAdmin()) {
|
||||
if (isAdminOrDomainAdmin()) {
|
||||
this.updateVPCCheckAndFetchNetworkOfferingData()
|
||||
}
|
||||
},
|
||||
@ -349,10 +347,10 @@ export default {
|
||||
supportedServices: 'SourceNat',
|
||||
state: 'Enabled'
|
||||
}
|
||||
if (this.isAdminOrDomainAdmin() && this.selectedDomain.id !== '-1') { // domain is visible only for admins
|
||||
if (isAdminOrDomainAdmin() && this.selectedDomain.id !== '-1') { // domain is visible only for admins
|
||||
params.domainid = this.selectedDomain.id
|
||||
}
|
||||
if (!this.isAdmin()) { // normal user is not aware of the VLANs in the system, so normal user is not allowed to create network with network offerings whose specifyvlan = true
|
||||
if (!isAdmin()) { // normal user is not aware of the VLANs in the system, so normal user is not allowed to create network with network offerings whose specifyvlan = true
|
||||
params.specifyvlan = false
|
||||
}
|
||||
if (forVpc !== null) {
|
||||
|
||||
@ -68,7 +68,7 @@
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="this.isAdminOrDomainAdmin()">
|
||||
<a-form-item v-if="isAdminOrDomainAdmin()">
|
||||
<tooltip-label slot="label" :title="$t('label.domainid')" :tooltip="apiParams.domainid.description"/>
|
||||
<a-select
|
||||
v-decorator="['domainid', {}]"
|
||||
@ -180,6 +180,7 @@
|
||||
|
||||
<script>
|
||||
import { api } from '@/api'
|
||||
import { isAdmin, isAdminOrDomainAdmin } from '@/role'
|
||||
import ResourceIcon from '@/components/view/ResourceIcon'
|
||||
import TooltipLabel from '@/components/widgets/TooltipLabel'
|
||||
|
||||
@ -215,7 +216,7 @@ export default {
|
||||
networkOfferings: [],
|
||||
networkOfferingLoading: false,
|
||||
selectedNetworkOffering: {},
|
||||
accountVisible: this.isAdminOrDomainAdmin(),
|
||||
accountVisible: isAdminOrDomainAdmin(),
|
||||
isolatePvlanType: 'none'
|
||||
}
|
||||
},
|
||||
@ -242,11 +243,8 @@ export default {
|
||||
this.fetchDomainData()
|
||||
this.fetchZoneData()
|
||||
},
|
||||
isAdmin () {
|
||||
return ['Admin'].includes(this.$store.getters.userInfo.roletype)
|
||||
},
|
||||
isAdminOrDomainAdmin () {
|
||||
return ['Admin', 'DomainAdmin'].includes(this.$store.getters.userInfo.roletype)
|
||||
return isAdminOrDomainAdmin()
|
||||
},
|
||||
isObjectEmpty (obj) {
|
||||
return !(obj !== null && obj !== undefined && Object.keys(obj).length > 0 && obj.constructor === Object)
|
||||
@ -309,7 +307,7 @@ export default {
|
||||
handleDomainChange (domain) {
|
||||
this.selectedDomain = domain
|
||||
this.accountVisible = domain.id !== '-1'
|
||||
if (this.isAdminOrDomainAdmin()) {
|
||||
if (isAdminOrDomainAdmin()) {
|
||||
this.updateVPCCheckAndFetchNetworkOfferingData()
|
||||
}
|
||||
},
|
||||
@ -337,10 +335,10 @@ export default {
|
||||
guestiptype: 'L2',
|
||||
state: 'Enabled'
|
||||
}
|
||||
if (this.isAdminOrDomainAdmin() && this.selectedDomain.id !== '-1') { // domain is visible only for admins
|
||||
if (isAdminOrDomainAdmin() && this.selectedDomain.id !== '-1') { // domain is visible only for admins
|
||||
params.domainid = this.selectedDomain.id
|
||||
}
|
||||
if (!this.isAdmin()) { // normal user is not aware of the VLANs in the system, so normal user is not allowed to create network with network offerings whose specifyvlan = true
|
||||
if (!isAdmin()) { // normal user is not aware of the VLANs in the system, so normal user is not allowed to create network with network offerings whose specifyvlan = true
|
||||
params.specifyvlan = false
|
||||
}
|
||||
if (forVpc !== null) {
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
@refresh-data="refreshParent"
|
||||
@refresh="handleRefresh"/>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane :tab="$t('label.shared')" key="3" v-if="this.isAdmin()">
|
||||
<a-tab-pane :tab="$t('label.shared')" key="3" v-if="isAdmin()">
|
||||
<CreateSharedNetworkForm
|
||||
:loading="loading"
|
||||
:resource="resource"
|
||||
@ -48,6 +48,7 @@
|
||||
|
||||
<script>
|
||||
import { api } from '@/api'
|
||||
import { isAdmin } from '@/role'
|
||||
import CreateIsolatedNetworkForm from '@/views/network/CreateIsolatedNetworkForm'
|
||||
import CreateL2NetworkForm from '@/views/network/CreateL2NetworkForm'
|
||||
import CreateSharedNetworkForm from '@/views/network/CreateSharedNetworkForm'
|
||||
@ -89,9 +90,6 @@ export default {
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
isAdmin () {
|
||||
return ['Admin'].includes(this.$store.getters.userInfo.roletype)
|
||||
},
|
||||
fetchActionZoneData () {
|
||||
this.loading = true
|
||||
const params = {}
|
||||
@ -107,6 +105,9 @@ export default {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
isAdmin () {
|
||||
return isAdmin()
|
||||
},
|
||||
handleRefresh () {
|
||||
},
|
||||
refreshParent () {
|
||||
|
||||
@ -423,12 +423,6 @@ export default {
|
||||
this.fetchNetworkOfferingData()
|
||||
}
|
||||
},
|
||||
isAdmin () {
|
||||
return ['Admin'].includes(this.$store.getters.userInfo.roletype)
|
||||
},
|
||||
isAdminOrDomainAdmin () {
|
||||
return ['Admin', 'DomainAdmin'].includes(this.$store.getters.userInfo.roletype)
|
||||
},
|
||||
isObjectEmpty (obj) {
|
||||
return !(obj !== null && obj !== undefined && Object.keys(obj).length > 0 && obj.constructor === Object)
|
||||
},
|
||||
|
||||
@ -106,6 +106,7 @@
|
||||
|
||||
<script>
|
||||
import { api } from '@/api'
|
||||
import { isAdmin } from '@/role'
|
||||
import TooltipLabel from '@/components/widgets/TooltipLabel'
|
||||
|
||||
export default {
|
||||
@ -156,12 +157,12 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isAdmin () {
|
||||
return ['Admin'].includes(this.$store.getters.userInfo.roletype)
|
||||
},
|
||||
fetchData () {
|
||||
this.fetchNetworkOfferingData()
|
||||
},
|
||||
isAdmin () {
|
||||
return isAdmin()
|
||||
},
|
||||
arrayHasItems (array) {
|
||||
return array !== null && array !== undefined && Array.isArray(array) && array.length > 0
|
||||
},
|
||||
|
||||
@ -516,6 +516,7 @@
|
||||
|
||||
<script>
|
||||
import { api } from '@/api'
|
||||
import { isAdmin } from '@/role'
|
||||
import ResourceIcon from '@/components/view/ResourceIcon'
|
||||
import TooltipLabel from '@/components/widgets/TooltipLabel'
|
||||
|
||||
@ -609,19 +610,19 @@ export default {
|
||||
this.isSystem = true
|
||||
}
|
||||
this.fetchData()
|
||||
this.isPublic = this.isAdmin()
|
||||
this.isPublic = isAdmin()
|
||||
},
|
||||
methods: {
|
||||
fetchData () {
|
||||
this.fetchDomainData()
|
||||
this.fetchZoneData()
|
||||
if (this.isAdmin()) {
|
||||
if (isAdmin()) {
|
||||
this.fetchStorageTagData()
|
||||
this.fetchDeploymentPlannerData()
|
||||
}
|
||||
},
|
||||
isAdmin () {
|
||||
return ['Admin'].includes(this.$store.getters.userInfo.roletype)
|
||||
return isAdmin()
|
||||
},
|
||||
arrayHasItems (array) {
|
||||
return array !== null && array !== undefined && Array.isArray(array) && array.length > 0
|
||||
@ -713,7 +714,7 @@ export default {
|
||||
this.selectedDeployementPlanner = planner
|
||||
this.plannerModeVisible = false
|
||||
if (this.selectedDeployementPlanner === 'ImplicitDedicationPlanner') {
|
||||
this.plannerModeVisible = this.isAdmin()
|
||||
this.plannerModeVisible = isAdmin()
|
||||
}
|
||||
},
|
||||
handlePlannerModeChange (val) {
|
||||
|
||||
@ -351,6 +351,7 @@
|
||||
|
||||
<script>
|
||||
import { api } from '@/api'
|
||||
import { isAdmin } from '@/role'
|
||||
import ResourceIcon from '@/components/view/ResourceIcon'
|
||||
import TooltipLabel from '@/components/widgets/TooltipLabel'
|
||||
|
||||
@ -397,18 +398,18 @@ export default {
|
||||
}
|
||||
]
|
||||
this.fetchData()
|
||||
this.isPublic = this.isAdmin()
|
||||
this.isPublic = isAdmin()
|
||||
},
|
||||
methods: {
|
||||
fetchData () {
|
||||
this.fetchDomainData()
|
||||
this.fetchZoneData()
|
||||
if (this.isAdmin()) {
|
||||
if (isAdmin()) {
|
||||
this.fetchStorageTagData()
|
||||
}
|
||||
},
|
||||
isAdmin () {
|
||||
return ['Admin'].includes(this.$store.getters.userInfo.roletype)
|
||||
return isAdmin()
|
||||
},
|
||||
arrayHasItems (array) {
|
||||
return array !== null && array !== undefined && Array.isArray(array) && array.length > 0
|
||||
|
||||
@ -433,6 +433,7 @@
|
||||
|
||||
<script>
|
||||
import { api } from '@/api'
|
||||
import { isAdmin } from '@/role'
|
||||
import CheckBoxSelectPair from '@/components/CheckBoxSelectPair'
|
||||
import ResourceIcon from '@/components/view/ResourceIcon'
|
||||
import TooltipLabel from '@/components/widgets/TooltipLabel'
|
||||
@ -498,7 +499,7 @@ export default {
|
||||
this.fetchServiceOfferingData()
|
||||
},
|
||||
isAdmin () {
|
||||
return ['Admin'].includes(this.$store.getters.userInfo.roletype)
|
||||
return isAdmin()
|
||||
},
|
||||
isSupportedServiceObject (obj) {
|
||||
return (obj !== null && obj !== undefined && Object.keys(obj).length > 0 && obj.constructor === Object && 'provider' in obj)
|
||||
|
||||
@ -142,6 +142,7 @@
|
||||
|
||||
<script>
|
||||
import { api } from '@/api'
|
||||
import { isAdmin } from '@/role'
|
||||
import CheckBoxSelectPair from '@/components/CheckBoxSelectPair'
|
||||
import ResourceIcon from '@/components/view/ResourceIcon'
|
||||
import TooltipLabel from '@/components/widgets/TooltipLabel'
|
||||
@ -190,7 +191,7 @@ export default {
|
||||
this.fetchSupportedServiceData()
|
||||
},
|
||||
isAdmin () {
|
||||
return ['Admin'].includes(this.$store.getters.userInfo.roletype)
|
||||
return isAdmin()
|
||||
},
|
||||
isSupportedServiceObject (obj) {
|
||||
return (obj !== null && obj !== undefined && Object.keys(obj).length > 0 && obj.constructor === Object && 'provider' in obj)
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
@submit="handleSubmit"
|
||||
layout="vertical">
|
||||
|
||||
<a-form-item :label="$t('label.ispublic')" v-show="this.isAdmin()">
|
||||
<a-form-item :label="$t('label.ispublic')" v-show="isAdmin()">
|
||||
<a-switch v-decorator="['ispublic', { initialValue: this.offeringIsPublic }]" :checked="this.offeringIsPublic" @change="val => { this.offeringIsPublic = val }" />
|
||||
</a-form-item>
|
||||
|
||||
@ -103,6 +103,7 @@
|
||||
|
||||
<script>
|
||||
import { api } from '@/api'
|
||||
import { isAdmin } from '@/role'
|
||||
import ResourceIcon from '@/components/view/ResourceIcon'
|
||||
|
||||
export default {
|
||||
@ -169,7 +170,7 @@ export default {
|
||||
this.fetchZoneData()
|
||||
},
|
||||
isAdmin () {
|
||||
return ['Admin'].includes(this.$store.getters.userInfo.roletype)
|
||||
return isAdmin()
|
||||
},
|
||||
fetchOfferingData () {
|
||||
this.loading = true
|
||||
@ -228,7 +229,7 @@ export default {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.isAdmin()) {
|
||||
if (isAdmin()) {
|
||||
this.offeringIsPublic = true
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user