Browse Source

Merge pull request 'fix-3124' (#3127) from fix-2524 into V20221102

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/3127
Reviewed-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.11.1^2
zouap 3 years ago
parent
commit
44fc4dc529
6 changed files with 152 additions and 79 deletions
  1. +12
    -8
      routers/admin/cloudbrains.go
  2. +39
    -37
      routers/api/v1/repo/cloudbrain_dashboard.go
  3. +11
    -8
      routers/user/home.go
  4. +44
    -12
      templates/admin/cloudbrain/search.tmpl
  5. +44
    -12
      templates/admin/cloudbrain/search_dashboard.tmpl
  6. +2
    -2
      web_src/js/features/cloudrbanin.js

+ 12
- 8
routers/admin/cloudbrains.go View File

@@ -70,7 +70,7 @@ func CloudBrains(ctx *context.Context) {


keyword := strings.Trim(ctx.Query("q"), " ") keyword := strings.Trim(ctx.Query("q"), " ")


ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{
ciTasks, _, err := models.Cloudbrains(&models.CloudbrainsOptions{
ListOptions: models.ListOptions{ ListOptions: models.ListOptions{
Page: page, Page: page,
PageSize: setting.UI.IssuePagingNum, PageSize: setting.UI.IssuePagingNum,
@@ -84,7 +84,6 @@ func CloudBrains(ctx *context.Context) {
IsLatestVersion: modelarts.IsLatestVersion, IsLatestVersion: modelarts.IsLatestVersion,
ComputeResource: listType, ComputeResource: listType,
Type: models.TypeCloudBrainAll, Type: models.TypeCloudBrainAll,
AiCenter: aiCenter,
Cluster: cluster, Cluster: cluster,
}) })
if err != nil { if err != nil {
@@ -93,19 +92,24 @@ func CloudBrains(ctx *context.Context) {
} }


models.LoadSpecs4CloudbrainInfo(ciTasks) models.LoadSpecs4CloudbrainInfo(ciTasks)

for i, task := range ciTasks {
ciTasks[i].CanDebug = true
ciTasks[i].CanDel = true
ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource
tasks := []*models.CloudbrainInfo{}

for _, task := range ciTasks {
if aiCenter == "" || aiCenter == task.Cloudbrain.Spec.AiCenterCode {
task.CanDebug = true
task.CanDel = true
task.Cloudbrain.ComputeResource = task.ComputeResource
tasks = append(tasks, task)
}
} }


count := int64(len(tasks))
pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, getTotalPage(count, setting.UI.IssuePagingNum)) pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, getTotalPage(count, setting.UI.IssuePagingNum))
pager.SetDefaultParams(ctx) pager.SetDefaultParams(ctx)
pager.AddParam(ctx, "listType", "ListType") pager.AddParam(ctx, "listType", "ListType")
ctx.Data["Page"] = pager ctx.Data["Page"] = pager
ctx.Data["PageIsCloudBrain"] = true ctx.Data["PageIsCloudBrain"] = true
ctx.Data["Tasks"] = ciTasks
ctx.Data["Tasks"] = tasks
ctx.Data["CanCreate"] = true ctx.Data["CanCreate"] = true
ctx.Data["Keyword"] = keyword ctx.Data["Keyword"] = keyword




+ 39
- 37
routers/api/v1/repo/cloudbrain_dashboard.go View File

@@ -732,7 +732,7 @@ func GetCloudbrainsDetailData(ctx *context.Context) {


keyword := strings.Trim(ctx.Query("q"), " ") keyword := strings.Trim(ctx.Query("q"), " ")


ciTasks, count, err := models.CloudbrainAll(&models.CloudbrainsOptions{
ciTasks, _, err := models.CloudbrainAll(&models.CloudbrainsOptions{
ListOptions: models.ListOptions{ ListOptions: models.ListOptions{
Page: page, Page: page,
PageSize: pageSize, PageSize: pageSize,
@@ -747,8 +747,8 @@ func GetCloudbrainsDetailData(ctx *context.Context) {
NeedRepoInfo: true, NeedRepoInfo: true,
BeginTimeUnix: int64(recordBeginTime), BeginTimeUnix: int64(recordBeginTime),
EndTimeUnix: endTime.Unix(), EndTimeUnix: endTime.Unix(),
AiCenter: aiCenter,
NeedDeleteInfo: needDeleteInfo,
// AiCenter: aiCenter,
NeedDeleteInfo: needDeleteInfo,
}) })
if err != nil { if err != nil {
ctx.ServerError("Get job failed:", err) ctx.ServerError("Get job failed:", err)
@@ -758,43 +758,45 @@ func GetCloudbrainsDetailData(ctx *context.Context) {
nilTime := time.Time{} nilTime := time.Time{}
tasks := []models.TaskDetail{} tasks := []models.TaskDetail{}
for i, task := range ciTasks { for i, task := range ciTasks {
ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource
var taskDetail models.TaskDetail
taskDetail.ID = ciTasks[i].Cloudbrain.ID
taskDetail.JobID = ciTasks[i].Cloudbrain.JobID
taskDetail.JobName = ciTasks[i].JobName
taskDetail.DisplayJobName = ciTasks[i].DisplayJobName
taskDetail.Status = ciTasks[i].Status
taskDetail.JobType = ciTasks[i].JobType
taskDetail.CreatedUnix = ciTasks[i].Cloudbrain.CreatedUnix
taskDetail.RunTime = ciTasks[i].Cloudbrain.TrainJobDuration
taskDetail.StartTime = ciTasks[i].StartTime
taskDetail.EndTime = ciTasks[i].EndTime
taskDetail.ComputeResource = ciTasks[i].ComputeResource
taskDetail.Type = ciTasks[i].Cloudbrain.Type
taskDetail.UserName = ciTasks[i].User.Name
taskDetail.RepoID = ciTasks[i].RepoID
if ciTasks[i].Repo != nil {
taskDetail.RepoName = ciTasks[i].Repo.OwnerName + "/" + ciTasks[i].Repo.Name
taskDetail.RepoAlias = ciTasks[i].Repo.OwnerName + "/" + ciTasks[i].Repo.Alias
}
if ciTasks[i].Cloudbrain.WorkServerNumber >= 1 {
taskDetail.WorkServerNum = int64(ciTasks[i].Cloudbrain.WorkServerNumber)
} else {
taskDetail.WorkServerNum = 1
}
taskDetail.CardDuration = repo.GetCloudbrainCardDuration(ciTasks[i].Cloudbrain)
taskDetail.WaitTime = repo.GetCloudbrainWaitTime(ciTasks[i].Cloudbrain)
if aiCenter == "" || aiCenter == task.Cloudbrain.Spec.AiCenterCode {
ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource
var taskDetail models.TaskDetail
taskDetail.ID = ciTasks[i].Cloudbrain.ID
taskDetail.JobID = ciTasks[i].Cloudbrain.JobID
taskDetail.JobName = ciTasks[i].JobName
taskDetail.DisplayJobName = ciTasks[i].DisplayJobName
taskDetail.Status = ciTasks[i].Status
taskDetail.JobType = ciTasks[i].JobType
taskDetail.CreatedUnix = ciTasks[i].Cloudbrain.CreatedUnix
taskDetail.RunTime = ciTasks[i].Cloudbrain.TrainJobDuration
taskDetail.StartTime = ciTasks[i].StartTime
taskDetail.EndTime = ciTasks[i].EndTime
taskDetail.ComputeResource = ciTasks[i].ComputeResource
taskDetail.Type = ciTasks[i].Cloudbrain.Type
taskDetail.UserName = ciTasks[i].User.Name
taskDetail.RepoID = ciTasks[i].RepoID
if ciTasks[i].Repo != nil {
taskDetail.RepoName = ciTasks[i].Repo.OwnerName + "/" + ciTasks[i].Repo.Name
taskDetail.RepoAlias = ciTasks[i].Repo.OwnerName + "/" + ciTasks[i].Repo.Alias
}
if ciTasks[i].Cloudbrain.WorkServerNumber >= 1 {
taskDetail.WorkServerNum = int64(ciTasks[i].Cloudbrain.WorkServerNumber)
} else {
taskDetail.WorkServerNum = 1
}
taskDetail.CardDuration = repo.GetCloudbrainCardDuration(ciTasks[i].Cloudbrain)
taskDetail.WaitTime = repo.GetCloudbrainWaitTime(ciTasks[i].Cloudbrain)


if ciTasks[i].Cloudbrain.DeletedAt != nilTime || ciTasks[i].Repo == nil {
taskDetail.IsDelete = true
} else {
taskDetail.IsDelete = false
if ciTasks[i].Cloudbrain.DeletedAt != nilTime || ciTasks[i].Repo == nil {
taskDetail.IsDelete = true
} else {
taskDetail.IsDelete = false
}
taskDetail.Spec = ciTasks[i].Spec
tasks = append(tasks, taskDetail)
} }
taskDetail.Spec = ciTasks[i].Spec
tasks = append(tasks, taskDetail)
} }
count := int64(len(tasks))
pager := context.NewPagination(int(count), pageSize, page, getTotalPage(count, pageSize)) pager := context.NewPagination(int(count), pageSize, page, getTotalPage(count, pageSize))
pager.SetDefaultParams(ctx) pager.SetDefaultParams(ctx)
pager.AddParam(ctx, "listType", "ListType") pager.AddParam(ctx, "listType", "ListType")


+ 11
- 8
routers/user/home.go View File

@@ -812,7 +812,7 @@ func Cloudbrains(ctx *context.Context) {
for i, _ := range repos { for i, _ := range repos {
repoIDList = append(repoIDList, repos[i].ID) repoIDList = append(repoIDList, repos[i].ID)
} }
ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{
ciTasks, _, err := models.Cloudbrains(&models.CloudbrainsOptions{
ListOptions: models.ListOptions{ ListOptions: models.ListOptions{
Page: page, Page: page,
PageSize: setting.UI.IssuePagingNum, PageSize: setting.UI.IssuePagingNum,
@@ -828,7 +828,6 @@ func Cloudbrains(ctx *context.Context) {
RepoIDList: repoIDList, RepoIDList: repoIDList,
ComputeResource: listType, ComputeResource: listType,
Type: models.TypeCloudBrainAll, Type: models.TypeCloudBrainAll,
AiCenter: aiCenter,
Cluster: cluster, Cluster: cluster,
}) })
if err != nil { if err != nil {
@@ -836,18 +835,22 @@ func Cloudbrains(ctx *context.Context) {
return return
} }
models.LoadSpecs4CloudbrainInfo(ciTasks) models.LoadSpecs4CloudbrainInfo(ciTasks)
for i, task := range ciTasks {
ciTasks[i].CanDebug = true
ciTasks[i].CanDel = true
ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource
tasks := []*models.CloudbrainInfo{}
for _, task := range ciTasks {
if aiCenter == "" || aiCenter == task.Cloudbrain.Spec.AiCenterCode {
task.CanDebug = true
task.CanDel = true
task.Cloudbrain.ComputeResource = task.ComputeResource
tasks = append(tasks, task)
}
} }

count := int64(len(tasks))
pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, getTotalPage(count, setting.UI.IssuePagingNum)) pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, getTotalPage(count, setting.UI.IssuePagingNum))
pager.SetDefaultParams(ctx) pager.SetDefaultParams(ctx)
pager.AddParam(ctx, "listType", "ListType") pager.AddParam(ctx, "listType", "ListType")
ctx.Data["Page"] = pager ctx.Data["Page"] = pager
ctx.Data["PageIsUserCloudBrain"] = true ctx.Data["PageIsUserCloudBrain"] = true
ctx.Data["Tasks"] = ciTasks
ctx.Data["Tasks"] = tasks
ctx.Data["CanCreate"] = true ctx.Data["CanCreate"] = true
ctx.Data["Keyword"] = keyword ctx.Data["Keyword"] = keyword




+ 44
- 12
templates/admin/cloudbrain/search.tmpl View File

@@ -16,19 +16,11 @@
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster=resource_cluster_c2net&aiCenter={{$.aiCenter}}" data-value="{{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}">{{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}</a> <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster=resource_cluster_c2net&aiCenter={{$.aiCenter}}" data-value="{{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}">{{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}</a>
</div> </div>
</div> </div>
<div class="ui selection dropdown" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;">
<div class="default text" style="color: rgba(0,0,0,.87);">{{.i18n.Tr "cloudbrain.all_ai_center"}}</div>
<div class="ui selection dropdown" id="aiCenter-sel" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;">
<div class="default text" style="color: rgba(0,0,0,.87);" aicenter="{{$.aiCenter}}">{{if eq $.aiCenter ""}}{{.i18n.Tr "cloudbrain.all_ai_center"}}{{end}}</div>
<i class="dropdown icon"></i> <i class="dropdown icon"></i>
<div class="menu"> <div class="menu">
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=" data-value='{{.i18n.Tr "cloudbrain.all_ai_center"}}'>{{.i18n.Tr "cloudbrain.all_ai_center"}}</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=鹏城云计算所" data-value="鹏城云计算所">鹏城云计算所</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=成都智算" data-value="成都智算">成都智算</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=合肥类脑" data-value="合肥类脑">合肥类脑</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=octopus" data-value="octopus">octopus</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=武汉智算" data-value="武汉智算">武汉智算</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=西安智算" data-value="西安智算">西安智算</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=中原智算" data-value="中原智算">中原智算</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=许昌AI中心" data-value="许昌AI中心">许昌AI中心</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=" data-value='{{.i18n.Tr "cloudbrain.all_ai_center"}}'>{{.i18n.Tr "cloudbrain.all_ai_center"}}</a>
</div> </div>
</div> </div>
<div class="ui selection dropdown" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;"> <div class="ui selection dropdown" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;">
@@ -73,4 +65,44 @@
</div> </div>
</div> </div>
</div>
</div>
<script>
;(function() {
document.addEventListener('DOMContentLoaded', function() {
$.ajax({
type: "GET",
url: "/admin/resources/queue/centers",
dataType: "json",
data: {},
success: function (res) {
if (res && res.Code === 0) {
var data = res.Data;
var aiCenterSelEl = $('#aiCenter-sel');
var itemEl = aiCenterSelEl.find('.menu .item').eq(0);
var selectAiCenterCode = aiCenterSelEl.find('.default').attr('aicenter');
var selectAiCenterName = '';
for (var i = 0, iLen = data.length; i < iLen; i++) {
var dataI = data[i];
var itemClone = itemEl.clone();
var oHref = itemClone.attr('href');
var oId = itemClone.attr('id');
itemClone.attr('data-value', dataI.AiCenterCode);
itemClone.removeAttr('id');
itemClone.attr('href', oHref + dataI.AiCenterCode);
itemClone.text(dataI.AiCenterName);
aiCenterSelEl.find('.menu').append(itemClone);
if (selectAiCenterCode === dataI.AiCenterCode) {
selectAiCenterName = dataI.AiCenterName;
}
}
selectAiCenterCode && aiCenterSelEl.dropdown('set selected', selectAiCenterCode);
selectAiCenterName && aiCenterSelEl.dropdown('set text', selectAiCenterName);
}
},
error: function (err) {
console.log(err);
}
});
});
})();
</script>

+ 44
- 12
templates/admin/cloudbrain/search_dashboard.tmpl View File

@@ -28,19 +28,11 @@
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster=resource_cluster_c2net&aiCenter={{$.aiCenter}}" data-value="{{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}">{{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}</a> <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster=resource_cluster_c2net&aiCenter={{$.aiCenter}}" data-value="{{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}">{{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}</a>
</div> </div>
</div> </div>
<div class="ui selection dropdown" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;">
<div class="default text" style="color: rgba(0,0,0,.87);">{{.i18n.Tr "cloudbrain.all_ai_center"}}</div>
<div class="ui selection dropdown" id="aiCenter-sel" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;">
<div class="default text" style="color: rgba(0,0,0,.87);" aicenter="{{$.aiCenter}}">{{if eq $.aiCenter ""}}{{.i18n.Tr "cloudbrain.all_ai_center"}}{{end}}</div>
<i class="dropdown icon"></i> <i class="dropdown icon"></i>
<div class="menu"> <div class="menu">
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=" data-value='{{.i18n.Tr "cloudbrain.all_ai_center"}}'>{{.i18n.Tr "cloudbrain.all_ai_center"}}</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=鹏城云计算所" data-value="鹏城云计算所">鹏城云计算所</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=成都智算" data-value="成都智算">成都智算</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=合肥类脑" data-value="合肥类脑">合肥类脑</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=octopus" data-value="octopus">octopus</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=武汉智算" data-value="武汉智算">武汉智算</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=西安智算" data-value="西安智算">西安智算</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=中原智算" data-value="中原智算">中原智算</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=许昌AI中心" data-value="许昌AI中心">许昌AI中心</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter=" data-value='{{.i18n.Tr "cloudbrain.all_ai_center"}}'>{{.i18n.Tr "cloudbrain.all_ai_center"}}</a>
</div> </div>
</div> </div>
<div class="ui selection dropdown" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;"> <div class="ui selection dropdown" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;">
@@ -87,4 +79,44 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
<script>
;(function() {
document.addEventListener('DOMContentLoaded', function() {
$.ajax({
type: "GET",
url: "/admin/resources/queue/centers",
dataType: "json",
data: {},
success: function (res) {
if (res && res.Code === 0) {
var data = res.Data;
var aiCenterSelEl = $('#aiCenter-sel');
var itemEl = aiCenterSelEl.find('.menu .item').eq(0);
var selectAiCenterCode = aiCenterSelEl.find('.default').attr('aicenter');
var selectAiCenterName = '';
for (var i = 0, iLen = data.length; i < iLen; i++) {
var dataI = data[i];
var itemClone = itemEl.clone();
var oHref = itemClone.attr('href');
var oId = itemClone.attr('id');
itemClone.attr('data-value', dataI.AiCenterCode);
itemClone.removeAttr('id');
itemClone.attr('href', oHref + dataI.AiCenterCode);
itemClone.text(dataI.AiCenterName);
aiCenterSelEl.find('.menu').append(itemClone);
if (selectAiCenterCode === dataI.AiCenterCode) {
selectAiCenterName = dataI.AiCenterName;
}
}
selectAiCenterCode && aiCenterSelEl.dropdown('set selected', selectAiCenterCode);
selectAiCenterName && aiCenterSelEl.dropdown('set text', selectAiCenterName);
}
},
error: function (err) {
console.log(err);
}
});
});
})();
</script>

+ 2
- 2
web_src/js/features/cloudrbanin.js View File

@@ -529,7 +529,7 @@ function userSearchControll() {
: params.get("jobStatus").toUpperCase(); : params.get("jobStatus").toUpperCase();
const dropdownValueArray = [cluster, aiCenter, jobType, listType, jobStatus]; const dropdownValueArray = [cluster, aiCenter, jobType, listType, jobStatus];
$("#userCloud .default.text ").each(function (index, e) { $("#userCloud .default.text ").each(function (index, e) {
$(e).text(dropdownValueArray[index]);
index != 1 && $(e).text(dropdownValueArray[index]);
}); });
} }


@@ -564,7 +564,7 @@ function AdaminSearchControll() {
: params.get("jobStatus").toUpperCase(); : params.get("jobStatus").toUpperCase();
const dropdownValueArray = [cluster, aiCenter, jobType, listType, jobStatus]; const dropdownValueArray = [cluster, aiCenter, jobType, listType, jobStatus];
$("#adminCloud .default.text ").each(function (index, e) { $("#adminCloud .default.text ").each(function (index, e) {
$(e).text(dropdownValueArray[index]);
index != 1 && $(e).text(dropdownValueArray[index]);
}); });
} }
userSearchControll(); userSearchControll();


Loading…
Cancel
Save