Skip to content

Commit

Permalink
fix: admin42 buildpack/builder/runner 体验问题修复 (#1650)
Browse files Browse the repository at this point in the history
Co-authored-by: schnee <suzh9@mail2.sysu.edu.cn>
  • Loading branch information
lyzqs and narasux authored Oct 15, 2024
1 parent a6472ce commit fec61a8
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,13 @@ class Meta:
exclude = ["modules", "id", "created", "updated", "environments"]

def validate_name(self, name: str) -> str:
if AppSlugBuilder.objects.filter(name=name).exists():
if AppSlugRunner.objects.filter(name=name).exists():
raise serializers.ValidationError("name already exists")
return name


class AppSlugRunnerUpdateInputSLZ(AppSlugRunnerCreateInputSLZ):
def validate_name(self, name: str) -> str:
if AppSlugBuilder.objects.exclude(id=self.instance.id).filter(name=name).exists():
if AppSlugRunner.objects.exclude(id=self.instance.id).filter(name=name).exists():
raise serializers.ValidationError("name already exists")
return name
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<span :class="props.row.is_hidden ? 'off-shelf' : ''">$[ props.row.version ]</span>
</template>
</bk-table-column>
<bk-table-column label="是否显示">
<bk-table-column label="是否显示" prop="is_hidden" width="100" :filters="isHiddenFilters" :filter-multiple="false" :filter-method="filterMethod">
<template slot-scope="props">
<span :class="props.row.is_hidden ? 'off-shelf' : ''">$[ props.row.is_hidden ? '否' : '是' ] </span>
</template>
Expand Down Expand Up @@ -416,6 +416,16 @@
size: 'medium'
},
typeFilters: typeFilters,
isHiddenFilters: [
{
text: '是',
value: false,
},
{
text: '否',
value: true,
}
],
}
},
methods: {
Expand All @@ -428,11 +438,16 @@
}
await this.$http.get(url).then(res => {
this.data = res;
});
if (this.curRegionActive === 'all') {
this.regionList = [{"key": "all", "text": `全部 (${this.data.length})`}];
for (let i = 0; i < regions.length; i++) {
this.regionList.push({"key": regions[i], "text": `${regions[i]} (${this.data.filter(item => item.region === regions[i]).length})`});
this.regionList.push({
"key": regions[i],
"text": `${regions[i]} (${this.data.filter(item => item.region === regions[i]).length})`
});
}
});
}
} catch (e) {
if (e.response.status === 400) {
this.$bkMessage({
Expand Down Expand Up @@ -480,7 +495,7 @@
}
if (success) {
this.cancelDialog();
await this.fetchBuildPackList();
this.switchRegion("all");
}
},
handleCreate: function () {
Expand Down Expand Up @@ -533,11 +548,7 @@
deleteRow: async function (row) {
const url = this.fillUrlTemplate(URLRouter.detail, {row});
await this.$http.delete(url);

const index = this.data.findIndex(item => item.id === row.id);
if (index !== -1) {
this.data.splice(index, 1);
}
this.switchRegion("all");
},
handleBind: async function (row) {
try {
Expand Down Expand Up @@ -683,8 +694,8 @@
return row[property] === value
}
},
mounted: function () {
this.fetchBuildPackList();
mounted: async function () {
await this.fetchBuildPackList();
},
})
})
Expand Down Expand Up @@ -851,5 +862,9 @@
border-radius: 2px;
background-color: #e6e9ea;
}

.bk-checkbox-text {
font-weight: normal;
}
</style>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
</bk-table>
</template>
</bk-table-column>
<bk-table-column label="名称" prop="name" min-width="250">
<bk-table-column label="名称" prop="name" min-width="200">
<template slot-scope="props">
<span class="name" :class="props.row.is_hidden ? 'off-shelf' : ''" @click="showDetailDialog(props.row)">$[ props.row.name ]</span>
<span class="display_name" :class="props.row.is_hidden ? 'off-shelf' : ''">$[ props.row.display_name ]</span>
Expand Down Expand Up @@ -100,12 +100,12 @@
<span :class="props.row.is_hidden ? 'off-shelf' : ''">$[ props.row.image + ':' + props.row.tag ]</span>
</template>
</bk-table-column>
<bk-table-column label="是否显示" width="80">
<bk-table-column label="是否显示" prop="is_hidden" width="100" :filters="isHiddenFilters" :filter-multiple="false" :filter-method="filterMethod">
<template slot-scope="props">
<span :class="props.row.is_hidden ? 'off-shelf' : ''">$[ props.row.is_hidden ? '否' : '是' ] </span>
</template>
</bk-table-column>
<bk-table-column label="是否默认" width="80">
<bk-table-column label="是否默认" prop="is_default" width="100" :filters="isDefaultFilters" :filter-multiple="false" :filter-method="filterMethod">
<template slot-scope="props">
<span :class="props.row.is_hidden ? 'off-shelf' : ''">$[ props.row.is_default ? '✅' : '❌' ] </span>
</template>
Expand Down Expand Up @@ -487,6 +487,26 @@
size: 'medium'
},
typeFilters: typeFilters,
isHiddenFilters: [
{
text: '是',
value: false,
},
{
text: '否',
value: true,
}
],
isDefaultFilters: [
{
text: '是',
value: true,
},
{
text: '否',
value: false,
},
],
}
},
methods: {
Expand All @@ -499,11 +519,16 @@
}
await this.$http.get(url).then(res => {
this.data = res;
})
if (this.curRegionActive === 'all') {
this.regionList = [{"key": "all", "text": `全部 (${this.data.length})`}];
for (let i = 0; i < regions.length; i++) {
this.regionList.push({"key": regions[i], "text": `${regions[i]} (${this.data.filter(item => item.region === regions[i]).length})`});
this.regionList.push({
"key": regions[i],
"text": `${regions[i]} (${this.data.filter(item => item.region === regions[i]).length})`
});
}
})
}
} catch (e) {
if (e.response.status === 400) {
this.$bkMessage({
Expand Down Expand Up @@ -554,7 +579,7 @@
}
if (success) {
this.cancelDialog();
await this.fetchSlugBuilderList();
this.switchRegion("all");
}
},
handleCreate: function () {
Expand Down Expand Up @@ -609,11 +634,7 @@
deleteRow: async function (row) {
const url = this.fillUrlTemplate(URLRouter.detail, {row});
await this.$http.delete(url);

const index = this.data.findIndex(item => item.id === row.id);
if (index !== -1) {
this.data.splice(index, 1);
}
this.switchRegion("all");
},
handleBind: async function (row) {
try {
Expand Down Expand Up @@ -759,8 +780,8 @@
return row[property] === value
}
},
mounted: function () {
this.fetchSlugBuilderList();
mounted: async function () {
await this.fetchSlugBuilderList();
},
})
})
Expand Down Expand Up @@ -928,6 +949,10 @@
background-color: #e6e9ea;
}

.bk-checkbox-text {
font-weight: normal;
}

.empty-text {
font-size: 14px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@
<span :class="props.row.is_hidden ? 'off-shelf' : ''">$[ props.row.image + ':' + props.row.tag ]</span>
</template>
</bk-table-column>
<bk-table-column label="是否显示" width="80">
<bk-table-column label="是否显示" prop="is_hidden" width="100" :filters="isHiddenFilters" :filter-multiple="false" :filter-method="filterMethod">
<template slot-scope="props">
<span :class="props.row.is_hidden ? 'off-shelf' : ''">$[ props.row.is_hidden ? '否' : '是' ] </span>
</template>
</bk-table-column>
<bk-table-column label="是否默认" width="80">
<bk-table-column label="是否默认" prop="is_default" width="100" :filters="isDefaultFilters" :filter-multiple="false" :filter-method="filterMethod">
<template slot-scope="props">
<span :class="props.row.is_hidden ? 'off-shelf' : ''">$[ props.row.is_default ? '✅' : '❌' ] </span>
</template>
Expand Down Expand Up @@ -372,6 +372,26 @@
size: 'medium'
},
typeFilters: typeFilters,
isHiddenFilters: [
{
text: '是',
value: false,
},
{
text: '否',
value: true,
}
],
isDefaultFilters: [
{
text: '是',
value: true,
},
{
text: '否',
value: false,
},
],
}
},
methods: {
Expand All @@ -384,11 +404,16 @@
}
await this.$http.get(url).then(res => {
this.data = res;
})
if (this.curRegionActive === 'all') {
this.regionList = [{"key": "all", "text": `全部 (${this.data.length})`}];
for (let i = 0; i < regions.length; i++) {
this.regionList.push({"key": regions[i], "text": `${regions[i]} (${this.data.filter(item => item.region === regions[i]).length})`});
this.regionList.push({
"key": regions[i],
"text": `${regions[i]} (${this.data.filter(item => item.region === regions[i]).length})`
});
}
})
}
} catch (e) {
if (e.response.status === 400) {
this.$bkMessage({
Expand Down Expand Up @@ -438,7 +463,7 @@
}
if (success) {
this.cancelDialog();
await this.fetchSlugrunnerList();
this.switchRegion("all");
}
},
handleCreate: function () {
Expand Down Expand Up @@ -493,11 +518,7 @@
deleteRow: async function (row) {
const url = this.fillUrlTemplate(URLRouter.detail, {row});
await this.$http.delete(url);

const index = this.data.findIndex(item => item.id === row.id);
if (index !== -1) {
this.data.splice(index, 1);
}
this.switchRegion("all");
},
fillUrlTemplate: function (url_template, {row}) {
if (!row) {
Expand Down Expand Up @@ -568,7 +589,7 @@
switchRegion: function(region) {
this.expandRowKeys = [];
this.curRegionActive = region;
this.fetchSlugBuilderList();
this.fetchSlugrunnerList();
},
handleSettingChange ({ fields, size }) {
this.setting.size = size;
Expand All @@ -579,8 +600,8 @@
return row[property] === value
}
},
mounted: function () {
this.fetchSlugrunnerList();
mounted: async function () {
await this.fetchSlugrunnerList();
},
})
})
Expand Down

0 comments on commit fec61a8

Please sign in to comment.