Istio Virtual Service feature flag

This commit is contained in:
loganhz 2019-09-28 12:14:55 +08:00
parent eb12e1a980
commit 02deb50669
4 changed files with 55 additions and 44 deletions

View File

@ -1,19 +1,29 @@
import Component from '@ember/component';
import { get, computed } from '@ember/object';
import { set, get, computed } from '@ember/object';
import layout from './template';
import { inject as service } from '@ember/service';
import { alias } from '@ember/object/computed';
import C from 'ui/utils/constants';
export default Component.extend({
scope: service(),
grafana: service(),
scope: service(),
grafana: service(),
features: service(),
layout,
showVirtualServiceUI: false,
cluster: alias('scope.currentCluster'),
project: alias('scope.currentProject'),
pageScope: alias('scope.currentPageScope'),
init() {
this._super(...arguments);
set(this, 'showVirtualServiceUI', get(this, 'features').isFeatureEnabled(C.FEATURES.ISTIO_VIRTUAL_SERVICE_UI))
},
kialiUrl: computed('cluster.id', function() {
return `/k8s/clusters/${ get(this, 'cluster.id') }/api/v1/namespaces/istio-system/services/http:kiali-http:80/proxy/`
}),

View File

@ -8,14 +8,14 @@
{{#link-to "project-istio.graph"}}{{t "istio.nav.graph"}}{{/link-to}}
</li>
{{/unless}}
{{!--
<li>
{{#link-to "project-istio.destination-rules"}}{{t "istio.nav.destinationRules.label"}}{{/link-to}}
</li>
<li>
{{#link-to "project-istio.virtual-services"}}{{t "istio.nav.virtualServices.label"}}{{/link-to}}
</li>
--}}
{{#if showVirtualServiceUI}}
<li>
{{#link-to "project-istio.destination-rules"}}{{t "istio.nav.destinationRules.label"}}{{/link-to}}
</li>
<li>
{{#link-to "project-istio.virtual-services"}}{{t "istio.nav.virtualServices.label"}}{{/link-to}}
</li>
{{/if}}
{{!-- <li>
{{#link-to "project-istio.rules"}}{{t "istio.nav.rules"}}{{/link-to}}
</li> --}}

View File

@ -18,42 +18,40 @@
>
<span>{{t "rulesPage.new"}}</span>
</a>
{{!--
{{else if (eq currentRouteName "authenticated.project.istio.project-istio.destination-rules.index")}}
<button
{{action "importYaml"}}
class="btn btn-sm bg-default mr-10"
disabled={{rbac-prevents resource="destinationrule" scope="project" permission="create"}}
>
{{t "nav.containers.importCompose"}}
</button>
<button
{{action "importYaml"}}
class="btn btn-sm bg-default mr-10"
disabled={{rbac-prevents resource="destinationrule" scope="project" permission="create"}}
>
{{t "nav.containers.importCompose"}}
</button>
{{#link-to
"project-istio.destination-rules.new"
scope.currentProject.id
class="btn btn-sm bg-primary"
disabled=(rbac-prevents resource="destinationrule" scope="project" permission="create")
}}
{{t "istio.nav.destinationRules.add"}}
{{/link-to}}
{{#link-to
"project-istio.destination-rules.new"
scope.currentProject.id
class="btn btn-sm bg-primary"
disabled=(rbac-prevents resource="destinationrule" scope="project" permission="create")
}}
{{t "istio.nav.destinationRules.add"}}
{{/link-to}}
{{else if (eq currentRouteName "authenticated.project.istio.project-istio.virtual-services.index")}}
<button
{{action "importYaml"}}
class="btn btn-sm bg-default mr-10"
disabled={{rbac-prevents resource="virtualservice" scope="project" permission="create"}}
>
{{t "nav.containers.importCompose"}}
</button>
<button
{{action "importYaml"}}
class="btn btn-sm bg-default mr-10"
disabled={{rbac-prevents resource="virtualservice" scope="project" permission="create"}}
>
{{t "nav.containers.importCompose"}}
</button>
{{#link-to
"project-istio.virtual-services.new"
scope.currentProject.id
class="btn btn-sm bg-primary"
disabled=(rbac-prevents resource="virtualservice" scope="project" permission="create")
}}
{{t "istio.nav.virtualServices.add"}}
{{/link-to}}
--}}
{{#link-to
"project-istio.virtual-services.new"
scope.currentProject.id
class="btn btn-sm bg-primary"
disabled=(rbac-prevents resource="virtualservice" scope="project" permission="create")
}}
{{t "istio.nav.virtualServices.add"}}
{{/link-to}}
{{/if}}
<button
{{action "importYaml"}}

View File

@ -914,6 +914,9 @@ C.RESOURCE_TYPES = {
CLUSTER: 'cluster'
};
C.FEATURES = { UNSUPPORTED_STORAGE_DRIVERS: 'unsupported-storage-drivers' }
C.FEATURES = {
UNSUPPORTED_STORAGE_DRIVERS: 'unsupported-storage-drivers',
ISTIO_VIRTUAL_SERVICE_UI: 'istio-virtual-service-ui',
}
export default C;