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 Component from '@ember/component';
import { get, computed } from '@ember/object'; import { set, get, computed } from '@ember/object';
import layout from './template'; import layout from './template';
import { inject as service } from '@ember/service'; import { inject as service } from '@ember/service';
import { alias } from '@ember/object/computed'; import { alias } from '@ember/object/computed';
import C from 'ui/utils/constants';
export default Component.extend({ export default Component.extend({
scope: service(), scope: service(),
grafana: service(), grafana: service(),
features: service(),
layout, layout,
showVirtualServiceUI: false,
cluster: alias('scope.currentCluster'), cluster: alias('scope.currentCluster'),
project: alias('scope.currentProject'), project: alias('scope.currentProject'),
pageScope: alias('scope.currentPageScope'), 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() { kialiUrl: computed('cluster.id', function() {
return `/k8s/clusters/${ get(this, 'cluster.id') }/api/v1/namespaces/istio-system/services/http:kiali-http:80/proxy/` 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}} {{#link-to "project-istio.graph"}}{{t "istio.nav.graph"}}{{/link-to}}
</li> </li>
{{/unless}} {{/unless}}
{{!-- {{#if showVirtualServiceUI}}
<li> <li>
{{#link-to "project-istio.destination-rules"}}{{t "istio.nav.destinationRules.label"}}{{/link-to}} {{#link-to "project-istio.destination-rules"}}{{t "istio.nav.destinationRules.label"}}{{/link-to}}
</li> </li>
<li> <li>
{{#link-to "project-istio.virtual-services"}}{{t "istio.nav.virtualServices.label"}}{{/link-to}} {{#link-to "project-istio.virtual-services"}}{{t "istio.nav.virtualServices.label"}}{{/link-to}}
</li> </li>
--}} {{/if}}
{{!-- <li> {{!-- <li>
{{#link-to "project-istio.rules"}}{{t "istio.nav.rules"}}{{/link-to}} {{#link-to "project-istio.rules"}}{{t "istio.nav.rules"}}{{/link-to}}
</li> --}} </li> --}}

View File

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

View File

@ -914,6 +914,9 @@ C.RESOURCE_TYPES = {
CLUSTER: 'cluster' 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; export default C;