Skip to content

Commit

Permalink
Merge branch 'koderover:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
landylee007 committed May 23, 2021
2 parents 13c7910 + 62a36b8 commit 5240d60
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 79 deletions.
2 changes: 1 addition & 1 deletion community/dev/contributor-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ yarn run dev

#### 后端本地测试

使用 Zadig CLI 进行本地调试,使用方式参见 [Zadig CLI 使用指南](https://docs.koderover.com/cli/overview/)
使用 Zadig CLI 进行本地调试,使用方式参见 [Zadig CLI 使用指南](https://docs.koderover.com/zadig/cli/kodespace-usage-for-contributor)

1 change: 1 addition & 0 deletions examples/voting-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/*/dotnet/*/obj
10 changes: 9 additions & 1 deletion zadig-portal/src/components/projects/guide/service.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@
class="no-content">
<img src="@assets/icons/illustration/editor_nodata.svg"
alt="">
<p v-if="services.length === 0">暂无服务,创建服务请在左侧栏点击创建服务按钮</p>
<p v-if="services.length === 0">暂无服务,点击 <el-button size="mini"
icon="el-icon-plus"
@click="createService()"
plain
circle>
</el-button> 创建服务</p>
<p v-else-if="service.service_name==='服务列表' && services.length >0">请在左侧选择需要编辑的服务</p>
<p v-else-if="!service.service_name && services.length >0">请在左侧选择需要编辑的服务</p>
</div>
Expand Down Expand Up @@ -112,6 +117,9 @@ export default {
}
},
methods: {
createService() {
this.$refs['serviceTree'].createService('platform');
},
toNext() {
this.$router.push(`/v1/projects/create/${this.projectName}/basic/runtime?serviceName=${this.serviceName}&serviceType=${this.serviceType}`);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,11 @@
</el-radio-group>
</div>
</el-col>
<el-col :span="14" class="text-right">
<el-col :span="14"
class="text-right">
<div style="line-height:32px">
<el-tooltip effect="dark"
content="平台编辑"
content="创建服务"
placement="top">
<el-button v-if="deployType==='k8s'"
size="mini"
Expand Down Expand Up @@ -299,15 +300,24 @@
</keep-alive>
<div v-if="showNewServiceInput && mode==='edit'"
class="add-new-service">
<span class="service-status new"></span>
<i class="service-type iconfont iconrongqifuwu"></i>
<el-input v-model="newServiceName"
size="mini"
autofocus
ref="serviceNamedRef"
@blur="inputServiceNameDoneWhenBlur"
@keyup.enter.native="inputServiceNameDoneWhenEnter"
placeholder="请输入服务名称"></el-input>
<el-form :model="service"
:rules="serviceRules"
ref="newServiceNameForm"
@submit.native.prevent>
<el-form-item label=""
prop="newServiceName">
<span class="service-status new"></span>
<i class="service-type iconfont iconrongqifuwu"></i>
<el-input v-model="service.newServiceName"
size="mini"
autofocus
ref="serviceNamedRef"
@blur="inputServiceNameDoneWhenBlur"
@keyup.enter.native="inputServiceNameDoneWhenEnter"
placeholder="请输入服务名称"></el-input>
</el-form-item>

</el-form>
</div>
<el-tree v-if="mode==='arrange' && deployType === 'k8s'"
:data="serviceGroup"
Expand Down Expand Up @@ -437,7 +447,9 @@ export default {
data() {
return {
mode: 'edit',
newServiceName: '',
service: {
newServiceName: ''
},
showHover: {},
searchService: '',
serviceGroup: [],
Expand Down Expand Up @@ -487,7 +499,7 @@ export default {
type: 'string',
required: true,
validator: validateServiceName,
trigger: 'blur'
trigger: ['blur', 'change']
}
]
Expand Down Expand Up @@ -709,16 +721,16 @@ export default {
},
async createService(cmd) {
const res = await getCodeSourceByAdminAPI(1);
if (res && res.length > 0) {
if (cmd && this.deployType === 'k8s') {
if (cmd === 'platform') {
this.showNewServiceInput = true;
this.mode = 'edit';
this.$nextTick(() => {
this.$refs.serviceNamedRef.focus();
});
}
else if (cmd === 'repo') {
if (cmd && this.deployType === 'k8s') {
if (cmd === 'platform') {
this.showNewServiceInput = true;
this.mode = 'edit';
this.$nextTick(() => {
this.$refs.serviceNamedRef.focus();
});
}
else if (cmd === 'repo') {
if (res && res.length > 0) {
this.dialogImportFileVisible = true;
this.showNewServiceInput = false;
this.mode = 'edit';
Expand All @@ -729,65 +741,70 @@ export default {
return element;
});
});
} else {
this.$emit('onAddCodeSource', true);
}
}
} else {
this.$emit('onAddCodeSource', true);
}
},
inputServiceNameDoneWhenBlur() {
const val = this.newServiceName;
const node = this.$refs.serviceTree.getNode(val);
if (val && !node) {
const data = {
label: val,
status: 'named',
service_name: val,
type: this.deployType ? this.deployType : 'k8s',
visibility: 'private'
};
this.services.push(data);
this.setServiceSelected(data.service_name);
this.$router.replace({ query: { service_name: data.service_name, rightbar: 'help' } });
this.$emit('onSelectServiceChange', data);
this.showNewServiceInput = false;
this.newServiceName = '';
}
else {
this.showNewServiceInput = false;
}
this.$refs['newServiceNameForm'].validate((valid) => {
if (valid) {
const val = this.service.newServiceName;
const node = this.$refs.serviceTree.getNode(val);
if (!node) {
const data = {
label: val,
status: 'named',
service_name: val,
type: this.deployType ? this.deployType : 'k8s',
visibility: 'private'
};
this.services.push(data);
this.setServiceSelected(data.service_name);
this.$router.replace({ query: { service_name: data.service_name, rightbar: 'help' } });
this.$emit('onSelectServiceChange', data);
this.showNewServiceInput = false;
this.service.newServiceName = '';
}
}
});
},
inputServiceNameDoneWhenEnter() {
const val = this.newServiceName;
const node = this.$refs.serviceTree.getNode(val);
let data = null;
if (val && !node) {
data = {
label: val,
status: 'named',
service_name: val,
type: this.deployType ? this.deployType : 'k8s',
visibility: 'private'
};
}
else {
data = {
label: 'untitled',
status: 'named',
service_name: 'untitled',
type: this.deployType ? this.deployType : 'k8s',
visibility: 'private'
};
}
if (!node) {
this.services.push(data);
}
this.setServiceSelected(data.service_name);
this.$router.replace({ query: { service_name: data.service_name, rightbar: 'help' } });
this.$emit('onSelectServiceChange', data);
this.showNewServiceInput = false;
this.newServiceName = '';
this.$refs['newServiceNameForm'].validate((valid) => {
if (valid) {
const val = this.service.newServiceName;
const node = this.$refs.serviceTree.getNode(val);
let data = null;
if (!node) {
data = {
label: val,
status: 'named',
service_name: val,
type: this.deployType ? this.deployType : 'k8s',
visibility: 'private'
};
}
else {
data = {
label: 'untitled',
status: 'named',
service_name: 'untitled',
type: this.deployType ? this.deployType : 'k8s',
visibility: 'private'
};
}
if (!node) {
this.services.push(data);
}
this.setServiceSelected(data.service_name);
this.$router.replace({ query: { service_name: data.service_name, rightbar: 'help' } });
this.$emit('onSelectServiceChange', data);
this.showNewServiceInput = false;
this.service.newServiceName = '';
}
});
},
reEditServiceName(node, data) {
const service = this.$utils.cloneObj(data);
Expand All @@ -797,7 +814,7 @@ export default {
const index = this.filteredServices.findIndex(d => d.service_name === service.service_name);
this.services.splice(index, 1);
this.showNewServiceInput = true;
this.newServiceName = service.service_name;
this.service.newServiceName = service.service_name;
this.$nextTick(() => {
this.$refs.serviceNamedRef.focus();
});
Expand Down Expand Up @@ -1151,4 +1168,4 @@ export default {
.text-right {
text-align: right;
}
</style>
</style>
10 changes: 9 additions & 1 deletion zadig-portal/src/components/projects/service_mgr/service.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@
class="no-content">
<img src="@assets/icons/illustration/editor_nodata.svg"
alt="">
<p v-if="services.length === 0">暂无服务,创建服务请在左侧栏点击创建服务按钮</p>
<p v-if="services.length === 0">暂无服务,点击 <el-button size="mini"
icon="el-icon-plus"
@click="createService()"
plain
circle>
</el-button> 创建服务</p>
<p v-else-if="service.service_name==='服务列表' && services.length >0">请在左侧选择需要编辑的服务</p>
<p v-else-if="!service.service_name && services.length >0">请在左侧选择需要编辑的服务</p>
</div>
Expand Down Expand Up @@ -130,6 +135,9 @@ export default {
}
},
methods: {
createService() {
this.$refs['serviceTree'].createService('platform');
},
toNext() {
this.updateEnvDialogVisible = true;
},
Expand Down

0 comments on commit 5240d60

Please sign in to comment.