mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
plugin: add support for Cloudian (#163)
This adds support for Cloudian UI plugin and some basic quota plugin. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> Co-authored-by: Rohit Yadav <rohit@apache.org>
This commit is contained in:
parent
f8c026183a
commit
9a27cf89b4
87
ui/src/assets/icons/cloudian.svg
Normal file
87
ui/src/assets/icons/cloudian.svg
Normal file
@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xml:space="preserve"
|
||||
width="160"
|
||||
height="160"
|
||||
version="1.1"
|
||||
style="clip-rule:evenodd;fill-rule:evenodd;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
|
||||
viewBox="0 0 1666.6667 1666.8369"
|
||||
id="svg38"
|
||||
sodipodi:docname="cloudian.svg"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><metadata
|
||||
id="metadata42"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1673"
|
||||
inkscape:window-height="931"
|
||||
id="namedview40"
|
||||
showgrid="false"
|
||||
units="px"
|
||||
inkscape:zoom="1.11"
|
||||
inkscape:cx="159.90991"
|
||||
inkscape:cy="95.225335"
|
||||
inkscape:window-x="54"
|
||||
inkscape:window-y="26"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg38" />
|
||||
<defs
|
||||
id="defs4">
|
||||
<style
|
||||
type="text/css"
|
||||
id="style2">
|
||||
<![CDATA[
|
||||
.fil0 {fill:#424B53;fill-rule:nonzero}
|
||||
.fil2 {fill:#969C98;fill-rule:nonzero}
|
||||
.fil1 {fill:#BFD43F;fill-rule:nonzero}
|
||||
]]>
|
||||
</style>
|
||||
</defs>
|
||||
<g
|
||||
id="g4573"
|
||||
transform="translate(-686.25631,82.403259)"><polygon
|
||||
transform="translate(0,-69.453818)"
|
||||
class="fil0"
|
||||
points="1524,293 1524,-5 815,404 1073,553 "
|
||||
id="polygon7"
|
||||
style="fill:#424b53;fill-rule:nonzero" /><polygon
|
||||
transform="translate(0,-69.453818)"
|
||||
class="fil0"
|
||||
points="1524,814 1726,697 1524,581 1323,697 "
|
||||
id="polygon9"
|
||||
style="fill:#424b53;fill-rule:nonzero" /><polygon
|
||||
transform="translate(0,-69.453818)"
|
||||
class="fil1"
|
||||
points="1524,814 1524,1047 1726,930 1726,697 "
|
||||
id="polygon11"
|
||||
style="fill:#bfd43f;fill-rule:nonzero" /><polygon
|
||||
transform="translate(0,-69.453818)"
|
||||
class="fil1"
|
||||
points="2234,404 1976,553 1976,1074 1524,1335 1524,1632 2234,1223 "
|
||||
id="polygon13"
|
||||
style="fill:#bfd43f;fill-rule:nonzero" /><polygon
|
||||
transform="translate(0,-69.453818)"
|
||||
class="fil2"
|
||||
points="1524,1047 1524,814 1323,697 1323,930 "
|
||||
id="polygon15"
|
||||
style="fill:#969c98;fill-rule:nonzero" /><polygon
|
||||
transform="translate(0,-69.453818)"
|
||||
class="fil2"
|
||||
points="1073,1074 1073,553 815,404 815,1223 1524,1632 1524,1335 "
|
||||
id="polygon17"
|
||||
style="fill:#969c98;fill-rule:nonzero" /></g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
@ -29,7 +29,8 @@ import iam from '@/config/section/iam'
|
||||
import infra from '@/config/section/infra'
|
||||
import offering from '@/config/section/offering'
|
||||
import config from '@/config/section/config'
|
||||
import plugin from '@/config/section/plugin'
|
||||
import quota from '@/config/section/plugin/quota'
|
||||
import cloudian from '@/config/section/plugin/cloudian'
|
||||
|
||||
export function generateRouterMap (section) {
|
||||
var map = {
|
||||
@ -201,7 +202,8 @@ export const asyncRouterMap = [
|
||||
generateRouterMap(infra),
|
||||
generateRouterMap(offering),
|
||||
generateRouterMap(config),
|
||||
generateRouterMap(plugin),
|
||||
generateRouterMap(quota),
|
||||
generateRouterMap(cloudian),
|
||||
|
||||
{
|
||||
path: '/exception',
|
||||
|
||||
@ -15,22 +15,12 @@
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
import cloudian from '@/assets/icons/cloudian.svg?inline'
|
||||
|
||||
export default {
|
||||
name: 'plugin',
|
||||
title: 'Plugins',
|
||||
icon: 'heat-map',
|
||||
children: [
|
||||
{
|
||||
name: 'quota',
|
||||
title: 'Quota',
|
||||
icon: 'pie-chart',
|
||||
permission: ['quotaSummary', 'quotaIsEnabled']
|
||||
},
|
||||
{
|
||||
name: 'cloudian',
|
||||
title: 'Cloudian Storage',
|
||||
icon: 'cloud-download',
|
||||
permission: ['cloudianSsoLogin', 'cloudianIsEnabled']
|
||||
}
|
||||
]
|
||||
name: 'cloudian',
|
||||
title: 'Cloudian Storage',
|
||||
icon: cloudian,
|
||||
permission: ['cloudianSsoLogin'],
|
||||
component: () => import('@/views/plugins/CloudianPlugin.vue')
|
||||
}
|
||||
49
ui/src/config/section/plugin/quota.js
Normal file
49
ui/src/config/section/plugin/quota.js
Normal file
@ -0,0 +1,49 @@
|
||||
// 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.
|
||||
|
||||
export default {
|
||||
name: 'quota',
|
||||
title: 'Quota',
|
||||
icon: 'pie-chart',
|
||||
permission: ['quotaSummary'],
|
||||
children: [
|
||||
{
|
||||
name: 'quotasummary',
|
||||
title: 'Summary',
|
||||
icon: 'bars',
|
||||
permission: ['quotaSummary'],
|
||||
columns: ['account', 'domain', 'state', 'currency', 'balance', 'quota'],
|
||||
details: ['account', 'domain', 'state', 'currency', 'balance', 'quota', 'startdate', 'enddate']
|
||||
},
|
||||
{
|
||||
name: 'quotatariff',
|
||||
title: 'Tariff',
|
||||
icon: 'credit-card',
|
||||
permission: ['quotaTariffList'],
|
||||
columns: ['usageName', 'description', 'usageUnit', 'tariffValue'],
|
||||
details: ['usageName', 'description', 'usageUnit', 'tariffValue']
|
||||
},
|
||||
{
|
||||
name: 'quotaemailtemplate',
|
||||
title: 'Email Template',
|
||||
icon: 'mail',
|
||||
permission: ['quotaEmailTemplateList'],
|
||||
columns: ['templatetype', 'templatesubject', 'templatebody'],
|
||||
details: ['templatetype', 'templatesubject', 'templatebody']
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -30,7 +30,8 @@ const getters = {
|
||||
addRouters: state => state.permission.addRouters,
|
||||
multiTab: state => state.app.multiTab,
|
||||
asyncJobIds: state => state.user.asyncJobIds,
|
||||
isLdapEnabled: state => state.user.isLdapEnabled
|
||||
isLdapEnabled: state => state.user.isLdapEnabled,
|
||||
cloudian: state => state.user.cloudian
|
||||
}
|
||||
|
||||
export default getters
|
||||
|
||||
@ -32,7 +32,8 @@ const user = {
|
||||
features: {},
|
||||
project: {},
|
||||
asyncJobIds: [],
|
||||
isLdapEnabled: false
|
||||
isLdapEnabled: false,
|
||||
cloudian: {}
|
||||
},
|
||||
|
||||
mutations: {
|
||||
@ -66,6 +67,9 @@ const user = {
|
||||
SET_LDAP: (state, isLdapEnabled) => {
|
||||
state.isLdapEnabled = isLdapEnabled
|
||||
},
|
||||
SET_CLOUDIAN: (state, cloudian) => {
|
||||
state.cloudian = cloudian
|
||||
},
|
||||
RESET_THEME: (state) => {
|
||||
Vue.ls.set(DEFAULT_THEME, 'light')
|
||||
}
|
||||
@ -137,20 +141,37 @@ const user = {
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
|
||||
api('cloudianIsEnabled').then(response => {
|
||||
const cloudian = response.cloudianisenabledresponse.cloudianisenabled || {}
|
||||
commit('SET_CLOUDIAN', cloudian)
|
||||
}).catch(ignored => {
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
Logout ({ commit, state }) {
|
||||
return new Promise((resolve) => {
|
||||
var cloudianUrl = null
|
||||
if (state.cloudian.url && state.cloudian.enabled) {
|
||||
cloudianUrl = state.cloudian.url + 'logout.htm?redirect=' + encodeURIComponent(window.location.href)
|
||||
}
|
||||
|
||||
commit('SET_TOKEN', '')
|
||||
commit('SET_PROJECT', {})
|
||||
commit('SET_APIS', {})
|
||||
commit('SET_CLOUDIAN', {})
|
||||
commit('RESET_THEME')
|
||||
Vue.ls.remove(CURRENT_PROJECT)
|
||||
Vue.ls.remove(ACCESS_TOKEN)
|
||||
Vue.ls.remove(ASYNC_JOB_IDS)
|
||||
|
||||
logout(state.token).then(() => {
|
||||
resolve()
|
||||
if (cloudianUrl) {
|
||||
window.location.href = cloudianUrl
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
}).catch(() => {
|
||||
resolve()
|
||||
})
|
||||
|
||||
62
ui/src/views/plugins/CloudianPlugin.vue
Normal file
62
ui/src/views/plugins/CloudianPlugin.vue
Normal file
@ -0,0 +1,62 @@
|
||||
// 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.
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<span v-if="showError">
|
||||
<a-alert type="error" message="Single-Sign-On failed for Cloudian Management Console. Please ask your administrator to fix integration issues." showIcon />
|
||||
<br/>
|
||||
<a-button @click="doSso()">Try Again</a-button>
|
||||
</span>
|
||||
<span v-else>
|
||||
<a-alert type="info" message="Cloudian Management Console should open in another window" showIcon />
|
||||
</span>
|
||||
<br/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { api } from '@/api'
|
||||
|
||||
export default {
|
||||
name: 'CloudianPlugin',
|
||||
mounted () {
|
||||
this.doSso()
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
showError: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doSso () {
|
||||
api('cloudianSsoLogin').then(json => {
|
||||
const url = json.cloudianssologinresponse.cloudianssologin.url
|
||||
const cmcWindow = window.open(url, 'CMCWindow')
|
||||
cmcWindow.focus()
|
||||
}).catch(error => {
|
||||
this.$notification.error({
|
||||
message: 'Single-Sign-On Failed',
|
||||
description: error.response.headers['x-description'] || 'Request Failed',
|
||||
duration: 0
|
||||
})
|
||||
this.showError = true
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Loading…
x
Reference in New Issue
Block a user