| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- module.exports = {
- data() {
- return {
- container_data : {
- host: 'localhost',
- post: '8080',
- type: 'OTHER'
- },
- container_rules: {
- host : [{
- required: true,
- message : '请填写容器所在服务器地址!',
- trigger : 'blur'
- }],
- home : [{
- required: true,
- message : '请填写容器根目录!',
- trigger : 'blur'
- }],
- port: [{
- required: true,
- type: 'number',
- message : '端口不能为空!',
- trigger : 'blur'
- }],
- description: [{
- required: true,
- message : '描述不能为空!',
- trigger : 'blur'
- }]
- }
- }
- },
- methods: {
- save_container(ref) {
- this.$refs[ref].validate((valid) => {
- if (valid) {
- this.$$api_deployment_saveContainer(this[ref], data => {
- this.$message.success('保存成功');
- this.$router.push('/deployment/container/list');
- });
- }
- });
- },
- reset_artifact(ref) {
- this.$refs[ref].resetFields();
- },
- getView(){
- if (this.$route.query.id) {
- this.$$api_deployment_getContainer({
- id: this.$route.query.id
- }, (data) => {
- this.container_data = data.content;
- });
- } else{
- this.$delete(this.container_data, 'id');
- this.$refs.container_data.resetFields();
- }
- },
- onHomeFieldBlur(ref) {
- if ('CLUSTER' != this[ref].type) {
- this.$$api_deployment_checkContainer({
- path: this[ref].home
- }, (data) => {
- data.content.host = 'localhost';
- this.container_data = data.content;
- });
- }
- }
- },
- mounted() {
- this.getView();
- },
- watch: {
- $route(to, from){
- this.getView();
- }
- }
- }
|