mirror of https://github.com/rancher/dashboard.git
Add copy config to project/namespace and cluster config header
This commit is contained in:
parent
1d3f8c7b9e
commit
7b47c33776
|
|
@ -2743,6 +2743,7 @@ namespace:
|
||||||
enableAutoInjection: Enable Istio Auto Injection
|
enableAutoInjection: Enable Istio Auto Injection
|
||||||
disableAutoInjection: Disable Istio Auto Injection
|
disableAutoInjection: Disable Istio Auto Injection
|
||||||
move: Move
|
move: Move
|
||||||
|
copy: Copy Config to Clipboard
|
||||||
resourceStates:
|
resourceStates:
|
||||||
success: 'Active'
|
success: 'Active'
|
||||||
info: 'Transitioning'
|
info: 'Transitioning'
|
||||||
|
|
|
||||||
|
|
@ -277,6 +277,16 @@ export default {
|
||||||
>
|
>
|
||||||
<i class="icon icon-file icon-lg" />
|
<i class="icon icon-file icon-lg" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
v-tooltip="t('nav.kubeconfig')"
|
||||||
|
:disabled="!kubeConfigEnabled"
|
||||||
|
type="button"
|
||||||
|
class="btn header-btn role-tertiary"
|
||||||
|
@click="currentCluster.copyKubeConfig()"
|
||||||
|
>
|
||||||
|
<i class="icon icon-copy icon-lg" />
|
||||||
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import Vue from 'vue';
|
||||||
import { CATALOG } from '@/config/labels-annotations';
|
import { CATALOG } from '@/config/labels-annotations';
|
||||||
import { NODE, FLEET, MANAGEMENT } from '@/config/types';
|
import { NODE, FLEET, MANAGEMENT } from '@/config/types';
|
||||||
import { insertAt } from '@/utils/array';
|
import { insertAt } from '@/utils/array';
|
||||||
|
|
@ -55,6 +56,14 @@ export default class MgmtCluster extends HybridModel {
|
||||||
enabled: this.$rootGetters['isRancher'],
|
enabled: this.$rootGetters['isRancher'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
insertAt(out, 2, {
|
||||||
|
action: 'copyKubeConfig',
|
||||||
|
label: this.t('namespace.copy'),
|
||||||
|
bulkable: false,
|
||||||
|
enabled: true,
|
||||||
|
icon: 'icon icon-copy',
|
||||||
|
});
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -307,7 +316,16 @@ export default class MgmtCluster extends HybridModel {
|
||||||
const out = jsyaml.dump(obj);
|
const out = jsyaml.dump(obj);
|
||||||
|
|
||||||
downloadFile('kubeconfig.yaml', out, 'application/yaml');
|
downloadFile('kubeconfig.yaml', out, 'application/yaml');
|
||||||
}
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
copyKubeConfig() {
|
||||||
|
return async() => {
|
||||||
|
const config = await this.generateKubeConfig();
|
||||||
|
|
||||||
|
Vue.prototype.$copyText(config);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
async fetchNodeMetrics() {
|
async fetchNodeMetrics() {
|
||||||
const nodes = await this.$dispatch('cluster/findAll', { type: NODE }, { root: true });
|
const nodes = await this.$dispatch('cluster/findAll', { type: NODE }, { root: true });
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import Vue from 'vue';
|
||||||
import SYSTEM_NAMESPACES from '@/config/system-namespaces';
|
import SYSTEM_NAMESPACES from '@/config/system-namespaces';
|
||||||
import { PROJECT, SYSTEM_NAMESPACE, ISTIO as ISTIO_LABELS, FLEET } from '@/config/labels-annotations';
|
import { PROJECT, SYSTEM_NAMESPACE, ISTIO as ISTIO_LABELS, FLEET } from '@/config/labels-annotations';
|
||||||
import { ISTIO, MANAGEMENT } from '@/config/types';
|
import { ISTIO, MANAGEMENT } from '@/config/types';
|
||||||
|
|
@ -53,12 +54,28 @@ export default class Namespace extends SteveModel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
insertAt(out, 5, {
|
||||||
|
action: 'copy',
|
||||||
|
label: this.t('namespace.copy'),
|
||||||
|
bulkable: false,
|
||||||
|
enabled: true,
|
||||||
|
icon: 'icon icon-copy',
|
||||||
|
weight: 3,
|
||||||
|
});
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
move(resources = this) {
|
move(resources = this) {
|
||||||
this.$dispatch('promptMove', resources);
|
this.$dispatch('promptMove', resources);
|
||||||
}
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
copy() {
|
||||||
|
return (resource = this) => {
|
||||||
|
Vue.prototype.$copyText(JSON.stringify(resource));
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
get isSystem() {
|
get isSystem() {
|
||||||
if ( this.metadata?.annotations?.[SYSTEM_NAMESPACE] === 'true' ) {
|
if ( this.metadata?.annotations?.[SYSTEM_NAMESPACE] === 'true' ) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue