mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
新版IP库管理阶段性提交(未完成)
This commit is contained in:
@@ -316,6 +316,10 @@ func (this *RPCClient) IPLibraryRPC() pb.IPLibraryServiceClient {
|
|||||||
return pb.NewIPLibraryServiceClient(this.pickConn())
|
return pb.NewIPLibraryServiceClient(this.pickConn())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *RPCClient) IPLibraryFileRPC() pb.IPLibraryFileServiceClient {
|
||||||
|
return pb.NewIPLibraryFileServiceClient(this.pickConn())
|
||||||
|
}
|
||||||
|
|
||||||
func (this *RPCClient) IPListRPC() pb.IPListServiceClient {
|
func (this *RPCClient) IPListRPC() pb.IPListServiceClient {
|
||||||
return pb.NewIPListServiceClient(this.pickConn())
|
return pb.NewIPListServiceClient(this.pickConn())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ func (this *ProvincesAction) RunGet(params struct {
|
|||||||
selectedProvinceIds = policyConfig.Inbound.Region.DenyProvinceIds
|
selectedProvinceIds = policyConfig.Inbound.Region.DenyProvinceIds
|
||||||
}
|
}
|
||||||
|
|
||||||
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithCountryIdRequest{
|
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithRegionCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithRegionCountryIdRequest{
|
||||||
RegionCountryId: int64(ChinaCountryId),
|
RegionCountryId: int64(ChinaCountryId),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ func (this *ProvincesAction) RunGet(params struct {
|
|||||||
selectedProvinceIds = policyConfig.Inbound.Region.DenyProvinceIds
|
selectedProvinceIds = policyConfig.Inbound.Region.DenyProvinceIds
|
||||||
}
|
}
|
||||||
|
|
||||||
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithCountryIdRequest{
|
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithRegionCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithRegionCountryIdRequest{
|
||||||
RegionCountryId: int64(ChinaCountryId),
|
RegionCountryId: int64(ChinaCountryId),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ type ProvinceOptionsAction struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *ProvinceOptionsAction) RunPost(params struct{}) {
|
func (this *ProvinceOptionsAction) RunPost(params struct{}) {
|
||||||
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithCountryIdRequest{RegionCountryId: ChinaCountryId})
|
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithRegionCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithRegionCountryIdRequest{RegionCountryId: ChinaCountryId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func (this *SelectProvincesPopupAction) RunGet(params struct {
|
|||||||
}) {
|
}) {
|
||||||
var selectedProvinceIds = utils.SplitNumbers(params.ProvinceIds)
|
var selectedProvinceIds = utils.SplitNumbers(params.ProvinceIds)
|
||||||
|
|
||||||
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithCountryIdRequest{RegionCountryId: ChinaCountryId})
|
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithRegionCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithRegionCountryIdRequest{RegionCountryId: ChinaCountryId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
Vue.component("values-box", {
|
Vue.component("values-box", {
|
||||||
props: ["values", "size", "maxlength", "name", "placeholder"],
|
props: ["values", "v-values", "size", "maxlength", "name", "placeholder"],
|
||||||
data: function () {
|
data: function () {
|
||||||
let values = this.values;
|
let values = this.values;
|
||||||
if (values == null) {
|
if (values == null) {
|
||||||
values = [];
|
values = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.vValues != null && typeof this.vValues == "object") {
|
||||||
|
values = this.vValues
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"vValues": values,
|
"realValues": values,
|
||||||
"isUpdating": false,
|
"isUpdating": false,
|
||||||
"isAdding": false,
|
"isAdding": false,
|
||||||
"index": 0,
|
"index": 0,
|
||||||
@@ -26,7 +31,7 @@ Vue.component("values-box", {
|
|||||||
this.cancel()
|
this.cancel()
|
||||||
this.isUpdating = true;
|
this.isUpdating = true;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.value = this.vValues[index];
|
this.value = this.realValues[index];
|
||||||
var that = this;
|
var that = this;
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
that.$refs.value.focus();
|
that.$refs.value.focus();
|
||||||
@@ -38,16 +43,16 @@ Vue.component("values-box", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.isUpdating) {
|
if (this.isUpdating) {
|
||||||
Vue.set(this.vValues, this.index, this.value);
|
Vue.set(this.realValues, this.index, this.value);
|
||||||
} else {
|
} else {
|
||||||
this.vValues.push(this.value);
|
this.realValues.push(this.value);
|
||||||
}
|
}
|
||||||
this.cancel()
|
this.cancel()
|
||||||
this.$emit("change", this.vValues)
|
this.$emit("change", this.realValues)
|
||||||
},
|
},
|
||||||
remove: function (index) {
|
remove: function (index) {
|
||||||
this.vValues.$remove(index)
|
this.realValues.$remove(index)
|
||||||
this.$emit("change", this.vValues)
|
this.$emit("change", this.realValues)
|
||||||
},
|
},
|
||||||
cancel: function () {
|
cancel: function () {
|
||||||
this.isUpdating = false;
|
this.isUpdating = false;
|
||||||
@@ -55,10 +60,10 @@ Vue.component("values-box", {
|
|||||||
this.value = "";
|
this.value = "";
|
||||||
},
|
},
|
||||||
updateAll: function (values) {
|
updateAll: function (values) {
|
||||||
this.vValeus = values
|
this.realValues = values
|
||||||
},
|
},
|
||||||
addValue: function (v) {
|
addValue: function (v) {
|
||||||
this.vValues.push(v)
|
this.realValues.push(v)
|
||||||
},
|
},
|
||||||
|
|
||||||
startEditing: function () {
|
startEditing: function () {
|
||||||
@@ -66,13 +71,13 @@ Vue.component("values-box", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
template: `<div>
|
template: `<div>
|
||||||
<div v-show="!isEditing && vValues.length > 0">
|
<div v-show="!isEditing && realValues.length > 0">
|
||||||
<div class="ui label tiny basic" v-for="(value, index) in vValues" style="margin-top:0.4em;margin-bottom:0.4em">{{value}}</div>
|
<div class="ui label tiny basic" v-for="(value, index) in realValues" style="margin-top:0.4em;margin-bottom:0.4em">{{value}}</div>
|
||||||
<a href="" @click.prevent="startEditing" style="font-size: 0.8em; margin-left: 0.2em">[修改]</a>
|
<a href="" @click.prevent="startEditing" style="font-size: 0.8em; margin-left: 0.2em">[修改]</a>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="isEditing || vValues.length == 0">
|
<div v-show="isEditing || realValues.length == 0">
|
||||||
<div style="margin-bottom: 1em" v-if="vValues.length > 0">
|
<div style="margin-bottom: 1em" v-if="realValues.length > 0">
|
||||||
<div class="ui label tiny basic" v-for="(value, index) in vValues" style="margin-top:0.4em;margin-bottom:0.4em">{{value}}
|
<div class="ui label tiny basic" v-for="(value, index) in realValues" style="margin-top:0.4em;margin-bottom:0.4em">{{value}}
|
||||||
<input type="hidden" :name="name" :value="value"/>
|
<input type="hidden" :name="name" :value="value"/>
|
||||||
<a href="" @click.prevent="update(index)" title="修改"><i class="icon pencil small" ></i></a>
|
<a href="" @click.prevent="update(index)" title="修改"><i class="icon pencil small" ></i></a>
|
||||||
<a href="" @click.prevent="remove(index)" title="删除"><i class="icon remove"></i></a>
|
<a href="" @click.prevent="remove(index)" title="删除"><i class="icon remove"></i></a>
|
||||||
|
|||||||
Reference in New Issue
Block a user