| @@ -49,6 +49,14 @@ const ( | |||||
| ActionApprovePullRequest // 21 | ActionApprovePullRequest // 21 | ||||
| ActionRejectPullRequest // 22 | ActionRejectPullRequest // 22 | ||||
| ActionCommentPull // 23 | ActionCommentPull // 23 | ||||
| ActionUploadAttachment //24 | |||||
| ActionCreateDebugGPUTask //25 | |||||
| ActionCreateDebugNPUTask //26 | |||||
| ActionCreateTrainTask //27 | |||||
| ActionCreateInferenceTask // 28 | |||||
| ActionCreateBenchMarkTask //29 | |||||
| ActionCreateNewModelTask //30 | |||||
| ) | ) | ||||
| // Action represents user operation type and other information to | // Action represents user operation type and other information to | ||||
| @@ -1,16 +1,17 @@ | |||||
| package cloudbrain | package cloudbrain | ||||
| import ( | import ( | ||||
| "code.gitea.io/gitea/modules/storage" | |||||
| "encoding/json" | "encoding/json" | ||||
| "errors" | "errors" | ||||
| "strconv" | "strconv" | ||||
| "code.gitea.io/gitea/modules/setting" | |||||
| "code.gitea.io/gitea/modules/storage" | |||||
| "code.gitea.io/gitea/models" | "code.gitea.io/gitea/models" | ||||
| "code.gitea.io/gitea/modules/context" | "code.gitea.io/gitea/modules/context" | ||||
| "code.gitea.io/gitea/modules/log" | "code.gitea.io/gitea/modules/log" | ||||
| "code.gitea.io/gitea/modules/notification" | |||||
| "code.gitea.io/gitea/modules/setting" | |||||
| ) | ) | ||||
| const ( | const ( | ||||
| @@ -221,13 +222,19 @@ func GenerateTask(ctx *context.Context, jobName, image, command, uuid, codePath, | |||||
| ComputeResource: models.GPUResource, | ComputeResource: models.GPUResource, | ||||
| BenchmarkTypeID: benchmarkTypeID, | BenchmarkTypeID: benchmarkTypeID, | ||||
| BenchmarkChildTypeID: benchmarkChildTypeID, | BenchmarkChildTypeID: benchmarkChildTypeID, | ||||
| Description: description, | |||||
| Description: description, | |||||
| }) | }) | ||||
| if err != nil { | if err != nil { | ||||
| return err | return err | ||||
| } | } | ||||
| if string(models.JobTypeBenchmark) == jobType { | |||||
| notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, jobID, jobName, models.ActionCreateBenchMarkTask) | |||||
| } else { | |||||
| notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, jobID, jobName, models.ActionCreateDebugGPUTask) | |||||
| } | |||||
| return nil | return nil | ||||
| } | } | ||||
| @@ -10,6 +10,7 @@ import ( | |||||
| "code.gitea.io/gitea/models" | "code.gitea.io/gitea/models" | ||||
| "code.gitea.io/gitea/modules/context" | "code.gitea.io/gitea/modules/context" | ||||
| "code.gitea.io/gitea/modules/log" | "code.gitea.io/gitea/modules/log" | ||||
| "code.gitea.io/gitea/modules/notification" | |||||
| "code.gitea.io/gitea/modules/setting" | "code.gitea.io/gitea/modules/setting" | ||||
| "code.gitea.io/gitea/modules/storage" | "code.gitea.io/gitea/modules/storage" | ||||
| ) | ) | ||||
| @@ -261,7 +262,7 @@ func GenerateTask(ctx *context.Context, jobName, uuid, description, flavor strin | |||||
| if err != nil { | if err != nil { | ||||
| return err | return err | ||||
| } | } | ||||
| notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, jobResult.ID, jobName, models.ActionCreateDebugNPUTask) | |||||
| return nil | return nil | ||||
| } | } | ||||
| @@ -345,12 +346,12 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error | |||||
| log.Error("GetAttachmentByUUID(%s) failed:%v", strconv.FormatInt(jobResult.JobID, 10), err.Error()) | log.Error("GetAttachmentByUUID(%s) failed:%v", strconv.FormatInt(jobResult.JobID, 10), err.Error()) | ||||
| return err | return err | ||||
| } | } | ||||
| jobId := strconv.FormatInt(jobResult.JobID, 10) | |||||
| err = models.CreateCloudbrain(&models.Cloudbrain{ | err = models.CreateCloudbrain(&models.Cloudbrain{ | ||||
| Status: TransTrainJobStatus(jobResult.Status), | Status: TransTrainJobStatus(jobResult.Status), | ||||
| UserID: ctx.User.ID, | UserID: ctx.User.ID, | ||||
| RepoID: ctx.Repo.Repository.ID, | RepoID: ctx.Repo.Repository.ID, | ||||
| JobID: strconv.FormatInt(jobResult.JobID, 10), | |||||
| JobID: jobId, | |||||
| JobName: req.JobName, | JobName: req.JobName, | ||||
| JobType: string(models.JobTypeTrain), | JobType: string(models.JobTypeTrain), | ||||
| Type: models.TypeCloudBrainTwo, | Type: models.TypeCloudBrainTwo, | ||||
| @@ -381,7 +382,7 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error | |||||
| log.Error("CreateCloudbrain(%s) failed:%v", req.JobName, err.Error()) | log.Error("CreateCloudbrain(%s) failed:%v", req.JobName, err.Error()) | ||||
| return err | return err | ||||
| } | } | ||||
| notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, jobId, req.JobName, models.ActionCreateTrainTask) | |||||
| return nil | return nil | ||||
| } | } | ||||
| @@ -565,12 +566,12 @@ func GenerateInferenceJob(ctx *context.Context, req *GenerateInferenceJobReq) (e | |||||
| log.Error("GetAttachmentByUUID(%s) failed:%v", strconv.FormatInt(jobResult.JobID, 10), err.Error()) | log.Error("GetAttachmentByUUID(%s) failed:%v", strconv.FormatInt(jobResult.JobID, 10), err.Error()) | ||||
| return err | return err | ||||
| } | } | ||||
| jobID := strconv.FormatInt(jobResult.JobID, 10) | |||||
| err = models.CreateCloudbrain(&models.Cloudbrain{ | err = models.CreateCloudbrain(&models.Cloudbrain{ | ||||
| Status: TransTrainJobStatus(jobResult.Status), | Status: TransTrainJobStatus(jobResult.Status), | ||||
| UserID: ctx.User.ID, | UserID: ctx.User.ID, | ||||
| RepoID: ctx.Repo.Repository.ID, | RepoID: ctx.Repo.Repository.ID, | ||||
| JobID: strconv.FormatInt(jobResult.JobID, 10), | |||||
| JobID: jobID, | |||||
| JobName: req.JobName, | JobName: req.JobName, | ||||
| JobType: string(models.JobTypeInference), | JobType: string(models.JobTypeInference), | ||||
| Type: models.TypeCloudBrainTwo, | Type: models.TypeCloudBrainTwo, | ||||
| @@ -605,7 +606,7 @@ func GenerateInferenceJob(ctx *context.Context, req *GenerateInferenceJobReq) (e | |||||
| log.Error("CreateCloudbrain(%s) failed:%v", req.JobName, err.Error()) | log.Error("CreateCloudbrain(%s) failed:%v", req.JobName, err.Error()) | ||||
| return err | return err | ||||
| } | } | ||||
| notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, jobID, req.JobName, models.ActionCreateInferenceTask) | |||||
| return nil | return nil | ||||
| } | } | ||||
| @@ -330,3 +330,18 @@ func (a *actionNotifier) NotifySyncDeleteRef(doer *models.User, repo *models.Rep | |||||
| log.Error("notifyWatchers: %v", err) | log.Error("notifyWatchers: %v", err) | ||||
| } | } | ||||
| } | } | ||||
| func (a *actionNotifier) NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string, optype models.ActionType) { | |||||
| if err := models.NotifyWatchers(&models.Action{ | |||||
| ActUserID: repo.OwnerID, | |||||
| ActUser: doer, | |||||
| OpType: optype, | |||||
| RepoID: repo.ID, | |||||
| Repo: repo, | |||||
| IsPrivate: repo.IsPrivate, | |||||
| RefName: name, | |||||
| Content: id, | |||||
| }); err != nil { | |||||
| log.Error("notifyWatchers: %v", err) | |||||
| } | |||||
| } | |||||
| @@ -54,4 +54,6 @@ type Notifier interface { | |||||
| NotifySyncPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *repository.PushCommits) | NotifySyncPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *repository.PushCommits) | ||||
| NotifySyncCreateRef(doer *models.User, repo *models.Repository, refType, refFullName string) | NotifySyncCreateRef(doer *models.User, repo *models.Repository, refType, refFullName string) | ||||
| NotifySyncDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string) | NotifySyncDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string) | ||||
| NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string, optype models.ActionType) | |||||
| } | } | ||||
| @@ -154,3 +154,7 @@ func (*NullNotifier) NotifySyncCreateRef(doer *models.User, repo *models.Reposit | |||||
| // NotifySyncDeleteRef places a place holder function | // NotifySyncDeleteRef places a place holder function | ||||
| func (*NullNotifier) NotifySyncDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string) { | func (*NullNotifier) NotifySyncDeleteRef(doer *models.User, repo *models.Repository, refType, refFullName string) { | ||||
| } | } | ||||
| func (*NullNotifier) NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string, optype models.ActionType) { | |||||
| } | |||||
| @@ -37,6 +37,13 @@ func NewContext() { | |||||
| RegisterNotifier(action.NewNotifier()) | RegisterNotifier(action.NewNotifier()) | ||||
| } | } | ||||
| // NotifyUploadAttachment notifies attachment upload message to notifiers | |||||
| func NotifyOtherTask(doer *models.User, repo *models.Repository, id string, name string, optype models.ActionType) { | |||||
| for _, notifier := range notifiers { | |||||
| notifier.NotifyOtherTask(doer, repo, id, name, optype) | |||||
| } | |||||
| } | |||||
| // NotifyCreateIssueComment notifies issue comment related message to notifiers | // NotifyCreateIssueComment notifies issue comment related message to notifiers | ||||
| func NotifyCreateIssueComment(doer *models.User, repo *models.Repository, | func NotifyCreateIssueComment(doer *models.User, repo *models.Repository, | ||||
| issue *models.Issue, comment *models.Comment) { | issue *models.Issue, comment *models.Comment) { | ||||
| @@ -2683,6 +2683,13 @@ mirror_sync_create = synced new reference <a href="%s/src/%s">%[2]s</a> to <a hr | |||||
| mirror_sync_delete = synced and deleted reference <code>%[2]s</code> at <a href="%[1]s">%[3]s</a> from mirror | mirror_sync_delete = synced and deleted reference <code>%[2]s</code> at <a href="%[1]s">%[3]s</a> from mirror | ||||
| approve_pull_request = `approved <a href="%s/pulls/%s">%s#%[2]s</a>` | approve_pull_request = `approved <a href="%s/pulls/%s">%s#%[2]s</a>` | ||||
| reject_pull_request = `suggested changes for <a href="%s/pulls/%s">%s#%[2]s</a>` | reject_pull_request = `suggested changes for <a href="%s/pulls/%s">%s#%[2]s</a>` | ||||
| upload_dataset=`upload dataset <a href="%s/datasets?type=%s">%s</a>` | |||||
| task_gpudebugjob=`created CPU/GPU type debugging task<a href="%s/cloudbrain/%s">%s</a>` | |||||
| task_npudebugjob=`created NPU type debugging task <a href="%s/modelarts/notebook/%s">%s</a>` | |||||
| task_trainjob=`created training task<a href="%s/modelarts/train-job/%s">%s</a>` | |||||
| task_inferencejob=`created reasoning task <a href="%s/modelarts/inference-job/%s">%s</a>` | |||||
| task_benchmark=`created profiling task <a href="%s/cloudbrain/benchmark/%s">%s</a>` | |||||
| task_createmodel=`created new model <a href="%s/modelmanage/show_model_info?name=%s">%s</a>` | |||||
| [tool] | [tool] | ||||
| ago = %s ago | ago = %s ago | ||||
| @@ -2693,6 +2693,13 @@ mirror_sync_create=从镜像同步了新的引用 <a href="%s/src/%s">%[2]s</a> | |||||
| mirror_sync_delete=从镜像同步并从 <a href="%[1]s">%[3]s</a> 删除了引用 <code>%[2]s</code> | mirror_sync_delete=从镜像同步并从 <a href="%[1]s">%[3]s</a> 删除了引用 <code>%[2]s</code> | ||||
| approve_pull_request=`同意了 <a href="%s/pulls/%s">%s#%[2]s</a>` | approve_pull_request=`同意了 <a href="%s/pulls/%s">%s#%[2]s</a>` | ||||
| reject_pull_request=`建议变更 <a href="%s/pulls/%s">%s#%[2]s</a>` | reject_pull_request=`建议变更 <a href="%s/pulls/%s">%s#%[2]s</a>` | ||||
| upload_dataset=`上传了数据集文件 <a href="%s/datasets?type=%s">%s</a>` | |||||
| task_gpudebugjob=`创建了CPU/GPU类型调试任务 <a href="%s/cloudbrain/%s">%s</a>` | |||||
| task_npudebugjob=`创建了NPU类型调试任务 <a href="%s/modelarts/notebook/%s">%s</a>` | |||||
| task_trainjob=`创建了训练任务 <a href="%s/modelarts/train-job/%s">%s</a>` | |||||
| task_inferencejob=`创建了推理任务 <a href="%s/modelarts/inference-job/%s">%s</a>` | |||||
| task_benchmark=`创建了评测任务 <a href="%s/cloudbrain/benchmark/%s">%s</a>` | |||||
| task_createmodel=`导入了新模型 <a href="%s/modelmanage/show_model_info?name=%s">%s</a>` | |||||
| [tool] | [tool] | ||||
| ago=%s前 | ago=%s前 | ||||
| @@ -125,12 +125,15 @@ socket.onmessage = function (e) { | |||||
| else if(record.OpType == "2"){ | else if(record.OpType == "2"){ | ||||
| actionName = actionName.replace("{oldRepoName}",record.Content); | actionName = actionName.replace("{oldRepoName}",record.Content); | ||||
| html += recordPrefix + actionName; | html += recordPrefix + actionName; | ||||
| html += " <a href=\"" + getRepoLink(record) + "\" rel=\"nofollow\">" + getRepotext(record) + "</a>" | |||||
| html += " <a href=\"" + getRepoLink(record) + "\" rel=\"nofollow\">" + getRepoLink(record) + "</a>" | |||||
| } | |||||
| else if(record.OpType == "24" || record.OpType == "25" || record.OpType == "26" || record.OpType == "27" || record.OpType == "28" || record.OpType == "29" || record.OpType == "30"){ | |||||
| html += recordPrefix + actionName; | |||||
| html += " <a href=\"" + getTaskLink(record) + "\" rel=\"nofollow\">" + record.RefName + "</a>" | |||||
| } | } | ||||
| else{ | else{ | ||||
| continue; | continue; | ||||
| } | } | ||||
| if(record.Repo != null){ | if(record.Repo != null){ | ||||
| var time = getTime(record.CreatedUnix,currentTime); | var time = getTime(record.CreatedUnix,currentTime); | ||||
| html += " " + time; | html += " " + time; | ||||
| @@ -138,13 +141,32 @@ socket.onmessage = function (e) { | |||||
| html += "</div>"; | html += "</div>"; | ||||
| html += "</div>"; | html += "</div>"; | ||||
| } | } | ||||
| } | } | ||||
| output.innerHTML = html; | output.innerHTML = html; | ||||
| swiperNewMessage.updateSlides(); | swiperNewMessage.updateSlides(); | ||||
| swiperNewMessage.updateProgress(); | swiperNewMessage.updateProgress(); | ||||
| }; | }; | ||||
| function getTaskLink(record){ | |||||
| var re = getRepoLink(record); | |||||
| if(record.OpType == 24){ | |||||
| return re + "/datasets?type=" + record.Content; | |||||
| }else if(record.OpType == 25){ | |||||
| return re + "/cloudbrain/" + record.RefName; | |||||
| }else if(record.OpType == 26){ | |||||
| return re + "/modelarts/notebook/" + record.Content; | |||||
| }else if(record.OpType == 27){ | |||||
| return re + "/modelarts/train-job/" + record.Content; | |||||
| }else if(record.OpType == 28){ | |||||
| return re + "/modelarts/inference-job/" + record.Content; | |||||
| }else if(record.OpType == 29){ | |||||
| return re + "/cloudbrain/benchmark/" + record.RefName; | |||||
| }else if(record.OpType == 30){ | |||||
| return re + "/modelmanage/show_model_info?name=" + record.RefName; | |||||
| } | |||||
| return re; | |||||
| } | |||||
| function getMsg(record){ | function getMsg(record){ | ||||
| var html =""; | var html =""; | ||||
| html += "<div class=\"swiper-slide item\">"; | html += "<div class=\"swiper-slide item\">"; | ||||
| @@ -276,7 +298,14 @@ var actionNameZH={ | |||||
| "15":"重新开启了合并请求", | "15":"重新开启了合并请求", | ||||
| "17":"从 {repoName} 删除分支 {deleteBranchName}", | "17":"从 {repoName} 删除分支 {deleteBranchName}", | ||||
| "22":"建议变更", | "22":"建议变更", | ||||
| "23":"评论了合并请求" | |||||
| "23":"评论了合并请求", | |||||
| "24":"上传了数据集文件", | |||||
| "25":"创建了CPU/GPU类型调试任务", | |||||
| "26":"创建了NPU类型调试任务", | |||||
| "27":"创建了训练任务", | |||||
| "28":"创建了推理任务", | |||||
| "29":"创建了评测任务", | |||||
| "30":"导入了新模型" | |||||
| }; | }; | ||||
| var actionNameEN={ | var actionNameEN={ | ||||
| @@ -294,7 +323,14 @@ var actionNameEN={ | |||||
| "15":" reopened pull request", | "15":" reopened pull request", | ||||
| "17":" deleted branch {deleteBranchName} from {repoName}", | "17":" deleted branch {deleteBranchName} from {repoName}", | ||||
| "22":" proposed changes", | "22":" proposed changes", | ||||
| "23":" commented on pull request" | |||||
| "23":" commented on pull request", | |||||
| "24":" upload dataset ", | |||||
| "25":" created CPU/GPU type debugging task ", | |||||
| "26":" created NPU type debugging task ", | |||||
| "27":" created training task", | |||||
| "28":" created reasoning task", | |||||
| "29":" created profiling task", | |||||
| "30":" created new model" | |||||
| }; | }; | ||||
| var repoAndOrgZH={ | var repoAndOrgZH={ | ||||
| @@ -12,6 +12,7 @@ import ( | |||||
| "code.gitea.io/gitea/models" | "code.gitea.io/gitea/models" | ||||
| "code.gitea.io/gitea/modules/context" | "code.gitea.io/gitea/modules/context" | ||||
| "code.gitea.io/gitea/modules/log" | "code.gitea.io/gitea/modules/log" | ||||
| "code.gitea.io/gitea/modules/notification" | |||||
| "code.gitea.io/gitea/modules/setting" | "code.gitea.io/gitea/modules/setting" | ||||
| "code.gitea.io/gitea/modules/storage" | "code.gitea.io/gitea/modules/storage" | ||||
| uuid "github.com/satori/go.uuid" | uuid "github.com/satori/go.uuid" | ||||
| @@ -113,7 +114,7 @@ func saveModelByParameters(jobId string, versionName string, name string, versio | |||||
| models.UpdateRepositoryUnits(ctx.Repo.Repository, units, deleteUnitTypes) | models.UpdateRepositoryUnits(ctx.Repo.Repository, units, deleteUnitTypes) | ||||
| log.Info("save model end.") | log.Info("save model end.") | ||||
| notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, id, name, models.ActionCreateNewModelTask) | |||||
| return nil | return nil | ||||
| } | } | ||||
| @@ -20,11 +20,11 @@ import ( | |||||
| "code.gitea.io/gitea/modules/labelmsg" | "code.gitea.io/gitea/modules/labelmsg" | ||||
| "code.gitea.io/gitea/modules/log" | "code.gitea.io/gitea/modules/log" | ||||
| "code.gitea.io/gitea/modules/minio_ext" | "code.gitea.io/gitea/modules/minio_ext" | ||||
| "code.gitea.io/gitea/modules/notification" | |||||
| "code.gitea.io/gitea/modules/setting" | "code.gitea.io/gitea/modules/setting" | ||||
| "code.gitea.io/gitea/modules/storage" | "code.gitea.io/gitea/modules/storage" | ||||
| "code.gitea.io/gitea/modules/upload" | "code.gitea.io/gitea/modules/upload" | ||||
| "code.gitea.io/gitea/modules/worker" | "code.gitea.io/gitea/modules/worker" | ||||
| gouuid "github.com/satori/go.uuid" | gouuid "github.com/satori/go.uuid" | ||||
| ) | ) | ||||
| @@ -845,6 +845,9 @@ func CompleteMultipart(ctx *context.Context) { | |||||
| ctx.Error(500, fmt.Sprintf("InsertAttachment: %v", err)) | ctx.Error(500, fmt.Sprintf("InsertAttachment: %v", err)) | ||||
| return | return | ||||
| } | } | ||||
| dataset, _ := models.GetDatasetByID(attachment.DatasetID) | |||||
| repository, _ := models.GetRepositoryByID(dataset.RepoID) | |||||
| notification.NotifyOtherTask(ctx.User, repository, fmt.Sprint(attachment.Type), attachment.Name, models.ActionUploadAttachment) | |||||
| if attachment.DatasetID != 0 { | if attachment.DatasetID != 0 { | ||||
| if isCanDecompress(attachment.Name) { | if isCanDecompress(attachment.Name) { | ||||
| @@ -865,7 +868,6 @@ func CompleteMultipart(ctx *context.Context) { | |||||
| labelmsg.SendDecompressAttachToLabelOBS(string(attachjson)) | labelmsg.SendDecompressAttachToLabelOBS(string(attachjson)) | ||||
| } | } | ||||
| } else { | } else { | ||||
| dataset, _ := models.GetDatasetByID(attachment.DatasetID) | |||||
| var labelMap map[string]string | var labelMap map[string]string | ||||
| labelMap = make(map[string]string) | labelMap = make(map[string]string) | ||||
| labelMap["UUID"] = uuid | labelMap["UUID"] = uuid | ||||
| @@ -350,18 +350,15 @@ func CloudBrainShow(ctx *context.Context) { | |||||
| func cloudBrainShow(ctx *context.Context, tpName base.TplName) { | func cloudBrainShow(ctx *context.Context, tpName base.TplName) { | ||||
| ctx.Data["PageIsCloudBrain"] = true | ctx.Data["PageIsCloudBrain"] = true | ||||
| var jobName = ctx.Params(":jobname") | var jobName = ctx.Params(":jobname") | ||||
| task, err := models.GetCloudbrainByName(jobName) | task, err := models.GetCloudbrainByName(jobName) | ||||
| if err != nil { | if err != nil { | ||||
| ctx.Data["error"] = err.Error() | ctx.Data["error"] = err.Error() | ||||
| } | } | ||||
| result, err := cloudbrain.GetJob(task.JobID) | result, err := cloudbrain.GetJob(task.JobID) | ||||
| if err != nil { | if err != nil { | ||||
| ctx.Data["error"] = err.Error() | ctx.Data["error"] = err.Error() | ||||
| } | } | ||||
| if result != nil { | if result != nil { | ||||
| jobRes, _ := models.ConvertToJobResultPayload(result.Payload) | jobRes, _ := models.ConvertToJobResultPayload(result.Payload) | ||||
| jobRes.Resource.Memory = strings.ReplaceAll(jobRes.Resource.Memory, "Mi", "MB") | jobRes.Resource.Memory = strings.ReplaceAll(jobRes.Resource.Memory, "Mi", "MB") | ||||
| @@ -369,6 +366,7 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName) { | |||||
| ctx.Data["resource_spec"] = spec | ctx.Data["resource_spec"] = spec | ||||
| taskRoles := jobRes.TaskRoles | taskRoles := jobRes.TaskRoles | ||||
| if jobRes.JobStatus.State != string(models.JobFailed) { | if jobRes.JobStatus.State != string(models.JobFailed) { | ||||
| taskRes, _ := models.ConvertToTaskPod(taskRoles[cloudbrain.SubTaskName].(map[string]interface{})) | taskRes, _ := models.ConvertToTaskPod(taskRoles[cloudbrain.SubTaskName].(map[string]interface{})) | ||||
| ctx.Data["taskRes"] = taskRes | ctx.Data["taskRes"] = taskRes | ||||
| task.Status = taskRes.TaskStatuses[0].State | task.Status = taskRes.TaskStatuses[0].State | ||||
| @@ -1099,6 +1097,9 @@ func GetChildTypes(ctx *context.Context) { | |||||
| } | } | ||||
| func CloudBrainBenchmarkNew(ctx *context.Context) { | func CloudBrainBenchmarkNew(ctx *context.Context) { | ||||
| ctx.Data["description"] = "" | |||||
| ctx.Data["benchmarkTypeID"] = -1 | |||||
| ctx.Data["benchmark_child_types_id_hidden"] = -1 | |||||
| err := cloudBrainNewDataPrepare(ctx) | err := cloudBrainNewDataPrepare(ctx) | ||||
| if err != nil { | if err != nil { | ||||
| ctx.ServerError("get new cloudbrain info failed", err) | ctx.ServerError("get new cloudbrain info failed", err) | ||||
| @@ -1201,6 +1202,9 @@ func CloudBrainBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainF | |||||
| benchmarkTypeID := form.BenchmarkTypeID | benchmarkTypeID := form.BenchmarkTypeID | ||||
| benchmarkChildTypeID := form.BenchmarkChildTypeID | benchmarkChildTypeID := form.BenchmarkChildTypeID | ||||
| ctx.Data["description"] = form.Description | |||||
| ctx.Data["benchmarkTypeID"] = benchmarkTypeID | |||||
| ctx.Data["benchmark_child_types_id_hidden"] = benchmarkChildTypeID | |||||
| if !jobNamePattern.MatchString(jobName) { | if !jobNamePattern.MatchString(jobName) { | ||||
| cloudBrainNewDataPrepare(ctx) | cloudBrainNewDataPrepare(ctx) | ||||
| ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_jobname_err"), tplCloudBrainBenchmarkNew, &form) | ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_jobname_err"), tplCloudBrainBenchmarkNew, &form) | ||||
| @@ -1445,6 +1445,7 @@ func TrainJobShow(ctx *context.Context) { | |||||
| ctx.Data["jobName"] = VersionListTasks[0].JobName | ctx.Data["jobName"] = VersionListTasks[0].JobName | ||||
| ctx.Data["version_list_task"] = VersionListTasks | ctx.Data["version_list_task"] = VersionListTasks | ||||
| ctx.Data["version_list_count"] = VersionListCount | ctx.Data["version_list_count"] = VersionListCount | ||||
| ctx.Data["canDownload"] = cloudbrain.CanDeleteJob(ctx, &VersionListTasks[0].Cloudbrain) | |||||
| ctx.HTML(http.StatusOK, tplModelArtsTrainJobShow) | ctx.HTML(http.StatusOK, tplModelArtsTrainJobShow) | ||||
| } | } | ||||
| @@ -2044,6 +2045,7 @@ func InferenceJobShow(ctx *context.Context) { | |||||
| ctx.Data["jobID"] = jobID | ctx.Data["jobID"] = jobID | ||||
| ctx.Data["jobName"] = task.JobName | ctx.Data["jobName"] = task.JobName | ||||
| ctx.Data["task"] = task | ctx.Data["task"] = task | ||||
| ctx.Data["canDownload"] = cloudbrain.CanDeleteJob(ctx, task) | |||||
| tempUids := []int64{} | tempUids := []int64{} | ||||
| tempUids = append(tempUids, task.UserID) | tempUids = append(tempUids, task.UserID) | ||||
| @@ -996,7 +996,6 @@ func RegisterRoutes(m *macaron.Macaron) { | |||||
| m.Get("", reqRepoCloudBrainReader, repo.CloudBrainBenchMarkShow) | m.Get("", reqRepoCloudBrainReader, repo.CloudBrainBenchMarkShow) | ||||
| }) | }) | ||||
| m.Group("/:jobid", func() { | m.Group("/:jobid", func() { | ||||
| // m.Get("", reqRepoCloudBrainReader, repo.CloudBrainBenchMarkShow) | |||||
| m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.CloudBrainStop) | m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.CloudBrainStop) | ||||
| m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.BenchmarkDel) | m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.BenchmarkDel) | ||||
| m.Get("/rate", reqRepoCloudBrainReader, repo.GetRate) | m.Get("/rate", reqRepoCloudBrainReader, repo.GetRate) | ||||
| @@ -10,7 +10,7 @@ import ( | |||||
| "github.com/elliotchance/orderedmap" | "github.com/elliotchance/orderedmap" | ||||
| ) | ) | ||||
| var opTypes = []int{1, 2, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 22, 23} | |||||
| var opTypes = []int{1, 2, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 22, 23, 24, 25, 26, 27, 28, 29, 30} | |||||
| type ClientsManager struct { | type ClientsManager struct { | ||||
| Clients *orderedmap.OrderedMap | Clients *orderedmap.OrderedMap | ||||
| @@ -100,7 +100,6 @@ | |||||
| <!-- 任务名 --> | <!-- 任务名 --> | ||||
| <div class="three wide column padding0"> | <div class="three wide column padding0"> | ||||
| <a class="title" href="{{$.Link}}/{{.JobName}}" title="{{.JobName}}" style="font-size: 14px;"> | <a class="title" href="{{$.Link}}/{{.JobName}}" title="{{.JobName}}" style="font-size: 14px;"> | ||||
| <span class="fitted" style="width: 90%;vertical-align: middle;">{{.JobName}}</span> | <span class="fitted" style="width: 90%;vertical-align: middle;">{{.JobName}}</span> | ||||
| </a> | </a> | ||||
| </div> | </div> | ||||
| @@ -83,7 +83,7 @@ | |||||
| </div> | </div> | ||||
| <div class="unite min_title inline field"> | <div class="unite min_title inline field"> | ||||
| <label style="font-weight: normal;" for="description">{{.i18n.Tr "repo.modelarts.train_job.description"}} </label> | <label style="font-weight: normal;" for="description">{{.i18n.Tr "repo.modelarts.train_job.description"}} </label> | ||||
| <textarea style="width: 80%;" id="description" name="description" rows="3" maxlength="254" placeholder={{.i18n.Tr "repo.modelarts.train_job.new_place"}} onchange="this.value=this.value.substring(0, 255)" onkeydown="this.value=this.value.substring(0, 255)" onkeyup="this.value=this.value.substring(0, 255)"></textarea> | |||||
| <textarea style="width: 80%;" id="description" name="description" rows="3" maxlength="254" placeholder={{.i18n.Tr "repo.modelarts.train_job.new_place"}} onchange="this.value=this.value.substring(0, 255)" onkeydown="this.value=this.value.substring(0, 255)" onkeyup="this.value=this.value.substring(0, 255)">{{.description}}</textarea> | |||||
| </div> | </div> | ||||
| <div class="required unite min_title inline field"> | <div class="required unite min_title inline field"> | ||||
| @@ -102,11 +102,16 @@ | |||||
| <span> </span> | <span> </span> | ||||
| <select class="ui fluid selection search dropdown" id="benchmark_types_id" name="benchmark_types_id" > | <select class="ui fluid selection search dropdown" id="benchmark_types_id" name="benchmark_types_id" > | ||||
| {{range .benchmark_types}} | {{range .benchmark_types}} | ||||
| <option value="{{.Id}}">{{.First}}</option> | |||||
| {{if eq .Id $.benchmarkTypeID}} | |||||
| <option value="{{.Id}}" selected="true">{{.First}}</option> | |||||
| {{else}} | |||||
| <option value="{{.Id}}">{{.First}}</option> | |||||
| {{end}} | |||||
| {{end}} | {{end}} | ||||
| </select> | </select> | ||||
| </div> | </div> | ||||
| <div class="eight wide field" id="engine_name"> | <div class="eight wide field" id="engine_name"> | ||||
| <input type="hidden" id="benchmark_child_types_id_hidden" name="benchmark_child_types_id_hidden" value="{{.benchmark_child_types_id_hidden}}"> | |||||
| <label style="font-weight: normal;white-space: nowrap;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_child_type"}}</label> | <label style="font-weight: normal;white-space: nowrap;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_child_type"}}</label> | ||||
| <select class="ui fluid selection dropdown nowrap" id="benchmark_child_types_id" style='width: 100%;' name="benchmark_child_types_id"> | <select class="ui fluid selection dropdown nowrap" id="benchmark_child_types_id" style='width: 100%;' name="benchmark_child_types_id"> | ||||
| </select> | </select> | ||||
| @@ -182,12 +187,17 @@ | |||||
| function setChildType(){ | function setChildType(){ | ||||
| let type_id = $('#benchmark_types_id').val(); | let type_id = $('#benchmark_types_id').val(); | ||||
| let child_selected_id = $('#benchmark_child_types_id_hidden').val(); | |||||
| $.get(`${repolink}/cloudbrain/benchmark/get_child_types?benchmark_type_id=${type_id}`, (data) => { | $.get(`${repolink}/cloudbrain/benchmark/get_child_types?benchmark_type_id=${type_id}`, (data) => { | ||||
| console.log(JSON.stringify(data)) | console.log(JSON.stringify(data)) | ||||
| const n_length = data['child_types'].length | const n_length = data['child_types'].length | ||||
| let html='' | let html='' | ||||
| for (let i=0;i<n_length;i++){ | for (let i=0;i<n_length;i++){ | ||||
| html += `<option value="${data['child_types'][i].id}">${data['child_types'][i].value}</option>`; | |||||
| if(child_selected_id == data['child_types'][i].id){ | |||||
| html += `<option value="${data['child_types'][i].id}" selected="true">${data['child_types'][i].value}</option>`; | |||||
| }else{ | |||||
| html += `<option value="${data['child_types'][i].id}">${data['child_types'][i].value}</option>`; | |||||
| } | |||||
| } | } | ||||
| document.getElementById("benchmark_child_types_id").innerHTML=html; | document.getElementById("benchmark_child_types_id").innerHTML=html; | ||||
| }) | }) | ||||
| @@ -188,6 +188,7 @@ td, th { | |||||
| </h4> | </h4> | ||||
| {{range $k ,$v := .version_list_task}} | {{range $k ,$v := .version_list_task}} | ||||
| <div class="ui accordion border-according" id="accordion{{.VersionName}}" data-repopath="{{$.RepoRelPath}}" data-jobid="{{.JobID}}" data-version="{{.VersionName}}"> | <div class="ui accordion border-according" id="accordion{{.VersionName}}" data-repopath="{{$.RepoRelPath}}" data-jobid="{{.JobID}}" data-version="{{.VersionName}}"> | ||||
| <input type="hidden" id="jobId_input" name="jobId_input" value="{{.JobID}}"> | |||||
| <div class="{{if eq $k 0}}active{{end}} title padding0"> | <div class="{{if eq $k 0}}active{{end}} title padding0"> | ||||
| <div class="according-panel-heading"> | <div class="according-panel-heading"> | ||||
| <div class="accordion-panel-title"> | <div class="accordion-panel-title"> | ||||
| @@ -441,7 +442,6 @@ td, th { | |||||
| jobName = urlArr.slice(-1)[0] | jobName = urlArr.slice(-1)[0] | ||||
| }) | }) | ||||
| function loadLog(version_name){ | function loadLog(version_name){ | ||||
| document.getElementById("mask").style.display = "block" | document.getElementById("mask").style.display = "block" | ||||
| $.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${jobName}/log?version_name=${version_name}&lines=50&order=asc`, (data) => { | $.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${jobName}/log?version_name=${version_name}&lines=50&order=asc`, (data) => { | ||||
| @@ -11,9 +11,8 @@ | |||||
| {{template "repo/header" .}} | {{template "repo/header" .}} | ||||
| <script> | <script> | ||||
| $(document).ready(function() { | $(document).ready(function() { | ||||
| url = window.location.href | |||||
| type = url.split('?type=')[1] | |||||
| if (type == 0){ | |||||
| const params = new URLSearchParams(window.location.search); | |||||
| if (params.get('type') == 0){ | |||||
| $('.contorl_component').attr("id", 'minioUploader') | $('.contorl_component').attr("id", 'minioUploader') | ||||
| }else{ | }else{ | ||||
| $('.contorl_component').attr("id", 'obsUploader') | $('.contorl_component').attr("id", 'obsUploader') | ||||
| @@ -490,11 +490,11 @@ | |||||
| <script> | <script> | ||||
| // 调试和评分新开窗口 | // 调试和评分新开窗口 | ||||
| console.log({{.Tasks}}) | |||||
| const {AppSubUrl, StaticUrlPrefix, csrf} = window.config; | const {AppSubUrl, StaticUrlPrefix, csrf} = window.config; | ||||
| let url={{.RepoLink}} | let url={{.RepoLink}} | ||||
| let getParam=getQueryVariable('debugListType') | let getParam=getQueryVariable('debugListType') | ||||
| let dropdownValue = getParam==='all'||getParam==='' ? '全部' : getParam | |||||
| let dropdownValue = ['all','',false].includes(getParam)? '全部' : getParam | |||||
| localStorage.setItem('all',location.href) | localStorage.setItem('all',location.href) | ||||
| function getQueryVariable(variable) | function getQueryVariable(variable) | ||||
| { | { | ||||
| @@ -255,7 +255,7 @@ | |||||
| {{end}} | {{end}} | ||||
| </div> | </div> | ||||
| <div class="ui six wide tablet four wide computer column"> | <div class="ui six wide tablet four wide computer column"> | ||||
| <div id="repo-desc" data-IsSigned= "{{.IsSigned}}" > | |||||
| <div id="repo-desc" data-IsAdmin= "{{.Permission.IsAdmin}}" data-IsArchived="{{.Repository.IsArchived}}" > | |||||
| <h4 id="about-desc" class="ui header">简介</h4> | <h4 id="about-desc" class="ui header">简介</h4> | ||||
| <input type="hidden" id="edit-alias" value="{{.Repository.Alias}}"> | <input type="hidden" id="edit-alias" value="{{.Repository.Alias}}"> | ||||
| <p> | <p> | ||||
| @@ -469,13 +469,13 @@ td, th { | |||||
| </div> | </div> | ||||
| {{template "base/footer" .}} | {{template "base/footer" .}} | ||||
| <script> | <script> | ||||
| console.log({{.task}}) | |||||
| $(document).ready(function(){ | $(document).ready(function(){ | ||||
| $('.secondary.menu .item').tab(); | $('.secondary.menu .item').tab(); | ||||
| }); | }); | ||||
| let userName | let userName | ||||
| let repoPath | let repoPath | ||||
| let jobID | let jobID | ||||
| let downlaodFlag = {{$.canDownload }} | |||||
| $(document).ready(function(){ | $(document).ready(function(){ | ||||
| let url = window.location.href; | let url = window.location.href; | ||||
| let urlArr = url.split('/') | let urlArr = url.split('/') | ||||
| @@ -621,7 +621,12 @@ function renderDir(data,version_name){ | |||||
| html += `<a onclick="loadModelFile('${version_name}','${data.Dirs[i].ParenDir}','${data.Dirs[i].FileName}','folder')">` | html += `<a onclick="loadModelFile('${version_name}','${data.Dirs[i].ParenDir}','${data.Dirs[i].FileName}','folder')">` | ||||
| html += "<span class='fitted'><i class='folder icon' width='16' height='16' aria-hidden='true'></i>" + data.Dirs[i].FileName + "</span>" | html += "<span class='fitted'><i class='folder icon' width='16' height='16' aria-hidden='true'></i>" + data.Dirs[i].FileName + "</span>" | ||||
| }else{ | }else{ | ||||
| html += `<a href="${location.href}/result_download?version_name=${version_name}&file_name=${data.Dirs[i].FileName}&parent_dir=${data.Dirs[i].ParenDir}">` | |||||
| if(downlaodFlag){ | |||||
| html += `<a href="${location.href}/result_download?version_name=${version_name}&file_name=${data.Dirs[i].FileName}&parent_dir=${data.Dirs[i].ParenDir}">` | |||||
| } | |||||
| else{ | |||||
| html += `<a class="disabled">` | |||||
| } | |||||
| html += "<span class='fitted'><i class='file icon' width='16' height='16' aria-hidden='true'></i>" + data.Dirs[i].FileName + "</span>" | html += "<span class='fitted'><i class='file icon' width='16' height='16' aria-hidden='true'></i>" + data.Dirs[i].FileName + "</span>" | ||||
| } | } | ||||
| html += '</a>' | html += '</a>' | ||||
| @@ -532,6 +532,7 @@ td, th { | |||||
| let userName | let userName | ||||
| let repoPath | let repoPath | ||||
| let jobID | let jobID | ||||
| let downlaodFlag = {{$.canDownload }} | |||||
| $(document).ready(function(){ | $(document).ready(function(){ | ||||
| let url = window.location.href; | let url = window.location.href; | ||||
| let urlArr = url.split('/') | let urlArr = url.split('/') | ||||
| @@ -787,7 +788,12 @@ td, th { | |||||
| html += `<a onclick="loadModelFile('${version_name}','${data.Dirs[i].ParenDir}','${data.Dirs[i].FileName}','folder')">` | html += `<a onclick="loadModelFile('${version_name}','${data.Dirs[i].ParenDir}','${data.Dirs[i].FileName}','folder')">` | ||||
| html += "<span class='fitted'><i class='folder icon' width='16' height='16' aria-hidden='true'></i>" + data.Dirs[i].FileName + "</span>" | html += "<span class='fitted'><i class='folder icon' width='16' height='16' aria-hidden='true'></i>" + data.Dirs[i].FileName + "</span>" | ||||
| }else{ | }else{ | ||||
| html += `<a href="${location.href}/model_download?version_name=${version_name}&file_name=${data.Dirs[i].FileName}&parent_dir=${data.Dirs[i].ParenDir}">` | |||||
| if(downlaodFlag){ | |||||
| html += `<a href="${location.href}/model_download?version_name=${version_name}&file_name=${data.Dirs[i].FileName}&parent_dir=${data.Dirs[i].ParenDir}">` | |||||
| } | |||||
| else{ | |||||
| html += `<a class="disabled">` | |||||
| } | |||||
| html += "<span class='fitted'><i class='file icon' width='16' height='16' aria-hidden='true'></i>" + data.Dirs[i].FileName + "</span>" | html += "<span class='fitted'><i class='file icon' width='16' height='16' aria-hidden='true'></i>" + data.Dirs[i].FileName + "</span>" | ||||
| } | } | ||||
| html += '</a>' | html += '</a>' | ||||
| @@ -69,7 +69,21 @@ | |||||
| {{$.i18n.Tr "action.reject_pull_request" .GetRepoLink $index .ShortRepoFullDisplayName | Str2html}} | {{$.i18n.Tr "action.reject_pull_request" .GetRepoLink $index .ShortRepoFullDisplayName | Str2html}} | ||||
| {{else if eq .GetOpType 23}} | {{else if eq .GetOpType 23}} | ||||
| {{ $index := index .GetIssueInfos 0}} | {{ $index := index .GetIssueInfos 0}} | ||||
| {{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoFullDisplayName | Str2html}} | |||||
| {{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoPath | Str2html}} | |||||
| {{else if eq .GetOpType 24}} | |||||
| {{$.i18n.Tr "action.upload_dataset" .GetRepoLink .Content .RefName | Str2html}} | |||||
| {{else if eq .GetOpType 25}} | |||||
| {{$.i18n.Tr "action.task_gpudebugjob" .GetRepoLink .RefName .RefName | Str2html}} | |||||
| {{else if eq .GetOpType 26}} | |||||
| {{$.i18n.Tr "action.task_npudebugjob" .GetRepoLink .Content .RefName | Str2html}} | |||||
| {{else if eq .GetOpType 27}} | |||||
| {{$.i18n.Tr "action.task_trainjob" .GetRepoLink .Content .RefName | Str2html}} | |||||
| {{else if eq .GetOpType 28}} | |||||
| {{$.i18n.Tr "action.task_inferencejob" .GetRepoLink .Content .RefName | Str2html}} | |||||
| {{else if eq .GetOpType 29}} | |||||
| {{$.i18n.Tr "action.task_benchmark" .GetRepoLink .RefName .RefName | Str2html}} | |||||
| {{else if eq .GetOpType 30}} | |||||
| {{$.i18n.Tr "action.task_createmodel" .GetRepoLink .RefName .RefName | Str2html}} | |||||
| {{end}} | {{end}} | ||||
| </p> | </p> | ||||
| {{if or (eq .GetOpType 5) (eq .GetOpType 18)}} | {{if or (eq .GetOpType 5) (eq .GetOpType 18)}} | ||||
| @@ -101,7 +115,23 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="ui two wide right aligned column"> | <div class="ui two wide right aligned column"> | ||||
| <span class="text grey">{{svg (printf "octicon-%s" (ActionIcon .GetOpType)) 32}}</span> | |||||
| {{if eq .GetOpType 24}} | |||||
| <span class="text grey"><i class="ri-uninstall-line icon big"></i></span> | |||||
| {{else if eq .GetOpType 25}} | |||||
| <span class="text grey"><i class="ri-voice-recognition-line icon big"></i></span> | |||||
| {{else if eq .GetOpType 26}} | |||||
| <span class="text grey"><i class="ri-voice-recognition-line icon big"></i></span> | |||||
| {{else if eq .GetOpType 27}} | |||||
| <span class="text grey"><i class="ri-character-recognition-line icon big"></i></span> | |||||
| {{else if eq .GetOpType 28}} | |||||
| <span class="text grey"><i class="ri-haze-2-line icon big"></i></span> | |||||
| {{else if eq .GetOpType 29}} | |||||
| <span class="text grey"><i class="ri-vip-crown-line icon big"></i></span> | |||||
| {{else if eq .GetOpType 30}} | |||||
| <span class="text grey"><i class="ri-picture-in-picture-exit-line icon big"></i></span> | |||||
| {{else}} | |||||
| <span class="text grey">{{svg (printf "octicon-%s" (ActionIcon .GetOpType)) 32}}</span> | |||||
| {{end}} | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="ui divider"></div> | <div class="ui divider"></div> | ||||
| @@ -1,7 +1,7 @@ | |||||
| <template> | <template> | ||||
| <div> | <div> | ||||
| <h4 id="about-desc" class="ui header desc-home">简介 | <h4 id="about-desc" class="ui header desc-home">简介 | ||||
| <a class="edit-icon" v-if="IsSigned" id ="editBtn" href="javascript:void(0)" @click="editClick" > | |||||
| <a class="edit-icon" v-if="IsPermit" id ="editBtn" href="javascript:void(0)" @click="editClick" > | |||||
| <i class="gray edit outline icon" style="margin-right: 0;"></i> | <i class="gray edit outline icon" style="margin-right: 0;"></i> | ||||
| </a> | </a> | ||||
| </h4> | </h4> | ||||
| @@ -53,7 +53,7 @@ export default { | |||||
| index_web: '', | index_web: '', | ||||
| repo_name_name: '', | repo_name_name: '', | ||||
| alias:'', | alias:'', | ||||
| IsSigned:false | |||||
| IsPermit:false | |||||
| }, | }, | ||||
| // rule1:[{min:3,max:5,message:'1',trigger:"blur"}], | // rule1:[{min:3,max:5,message:'1',trigger:"blur"}], | ||||
| rule: { | rule: { | ||||
| @@ -65,14 +65,15 @@ export default { | |||||
| }, | }, | ||||
| methods: { | methods: { | ||||
| getIsSigned(){ | getIsSigned(){ | ||||
| this.IsSigned = document.getElementById("repo-desc").dataset.issigned; | |||||
| var isadmin= document.getElementById("repo-desc").dataset.isadmin; | |||||
| var isarchived=document.getElementById("repo-desc").dataset.isarchived; | |||||
| // console.log("IsSigned:",this.IsSigned) | // console.log("IsSigned:",this.IsSigned) | ||||
| if (this.IsSigned==true || this.IsSigned=="true"){ | |||||
| this.IsSigned=true; | |||||
| if ((isadmin==true || isadmin=="true")&& (isarchived==false || isarchived=="false")){ | |||||
| this.IsPermit=true; | |||||
| } | } | ||||
| }, | }, | ||||
| editClick() { | editClick() { | ||||
| if (this.IsSigned){ | |||||
| if (this.IsPermit){ | |||||
| this.editDataDialog = true; | this.editDataDialog = true; | ||||
| } | } | ||||
| }, | }, | ||||
| @@ -58,15 +58,22 @@ | |||||
| stripe | stripe | ||||
| > | > | ||||
| </el-table-column> | </el-table-column> | ||||
| <el-table-column | |||||
| label="项目名称中文" | |||||
| align="left" | |||||
| prop="name" | |||||
| v-if='0' | |||||
| > | |||||
| </el-table-column> | |||||
| <el-table-column | <el-table-column | ||||
| label="项目名称" | label="项目名称" | ||||
| width="125px" | width="125px" | ||||
| align="left" | align="left" | ||||
| prop="name" | |||||
| prop="alias" | |||||
| style="color:#0366D6;font-family: Roboto" | style="color:#0366D6;font-family: Roboto" | ||||
| > | > | ||||
| <template slot-scope="scope"> | <template slot-scope="scope"> | ||||
| <a @click=goToDetailPage(scope.row.repo_id,scope.row.name,scope.row.ownerName)>{{scope.row.name}} </a> | |||||
| <a @click=goToDetailPage(scope.row.repo_id,scope.row.name,scope.row.ownerName,scope.row.alias)>{{scope.row.alias}} </a> | |||||
| </template> | </template> | ||||
| </el-table-column> | </el-table-column> | ||||
| <el-table-column | <el-table-column | ||||
| @@ -160,7 +167,7 @@ | |||||
| </div> | </div> | ||||
| <div id ="pro_detail" style="display:none;width: 100%;"> | <div id ="pro_detail" style="display:none;width: 100%;"> | ||||
| <div style="margin-top: 10px;"> | <div style="margin-top: 10px;"> | ||||
| <a class="pro_item" :href="'../../../'+this.ownerName+'/'+this.pro_name">{{this.ownerName}} / {{this.pro_name}}</a> <span class="update_time">数据更新时间:</span><span style="font-size: 12px;">{{tableDataIDTotal.lastUpdatedTime}} / 从{{tableDataIDTotal.recordBeginTime}}开始统计</span> | |||||
| <a class="pro_item" :href="'../../../'+this.ownerName+'/'+this.pro_name">{{this.ownerName}} / {{this.alias}}</a> <span class="update_time">数据更新时间:</span><span style="font-size: 12px;">{{tableDataIDTotal.lastUpdatedTime}} / 从{{tableDataIDTotal.recordBeginTime}}开始统计</span> | |||||
| </div> | </div> | ||||
| <div style="margin-top: 10px;"> | <div style="margin-top: 10px;"> | ||||
| 项目描述:{{tableDataIDTotal.description | discriptionFun}} | 项目描述:{{tableDataIDTotal.description | discriptionFun}} | ||||
| @@ -388,6 +395,7 @@ | |||||
| create_time_pro: '', | create_time_pro: '', | ||||
| dynamic_pro:7, | dynamic_pro:7, | ||||
| pro_name:'', | pro_name:'', | ||||
| alias:'', | |||||
| pro_id:'', | pro_id:'', | ||||
| ownerName:'', | ownerName:'', | ||||
| radarOpenI:'', | radarOpenI:'', | ||||
| @@ -445,7 +453,7 @@ | |||||
| startDate = this.comparedate(tmp,this.recordBeginTime) | startDate = this.comparedate(tmp,this.recordBeginTime) | ||||
| console.log("comparedate:"+startDate) | console.log("comparedate:"+startDate) | ||||
| saveFileName = this.pro_name+"_"+startDate+'_'+endDate | |||||
| saveFileName = this.alias+"_"+startDate+'_'+endDate | |||||
| }else{ | }else{ | ||||
| switch(this.paramsID.type){ | switch(this.paramsID.type){ | ||||
| case "yesterday":{ | case "yesterday":{ | ||||
| @@ -453,7 +461,7 @@ | |||||
| startDate = this.comparedate(yesterday_tmp,this.recordBeginTime) | startDate = this.comparedate(yesterday_tmp,this.recordBeginTime) | ||||
| endDate = startDate | endDate = startDate | ||||
| saveFileName = this.pro_name+"_"+startDate+'_'+ endDate | |||||
| saveFileName = this.alias+"_"+startDate+'_'+ endDate | |||||
| break | break | ||||
| } | } | ||||
| case "current_week":{ | case "current_week":{ | ||||
| @@ -465,7 +473,7 @@ | |||||
| endDate = yesterday | endDate = yesterday | ||||
| saveFileName = this.pro_name+"_"+startDate+'_'+ endDate | |||||
| saveFileName = this.alias+"_"+startDate+'_'+ endDate | |||||
| break | break | ||||
| } | } | ||||
| case "current_month":{ | case "current_month":{ | ||||
| @@ -475,7 +483,7 @@ | |||||
| endDate = yesterday | endDate = yesterday | ||||
| saveFileName = this.pro_name+"_"+startDate+'_'+ endDate | |||||
| saveFileName = this.alias+"_"+startDate+'_'+ endDate | |||||
| break | break | ||||
| } | } | ||||
| case "last_month":{ | case "last_month":{ | ||||
| @@ -495,7 +503,7 @@ | |||||
| var days = (monthEndDate - monthStartDate) / (1000 * 60 * 60 * 24) | var days = (monthEndDate - monthStartDate) / (1000 * 60 * 60 * 24) | ||||
| endDate=this.saveFormatDate(lastYear, lastMonth+1, days); //月份从0开始,所以+1保存月份 | endDate=this.saveFormatDate(lastYear, lastMonth+1, days); //月份从0开始,所以+1保存月份 | ||||
| saveFileName = this.pro_name+"_"+startDate+'_'+ endDate | |||||
| saveFileName = this.alias+"_"+startDate+'_'+ endDate | |||||
| break | break | ||||
| } | } | ||||
| case "monthly":{ | case "monthly":{ | ||||
| @@ -504,7 +512,7 @@ | |||||
| startDate = this.comparedate(startDate,this.recordBeginTime) | startDate = this.comparedate(startDate,this.recordBeginTime) | ||||
| endDate = yesterday | endDate = yesterday | ||||
| saveFileName = this.pro_name+"_"+startDate+'_'+ endDate | |||||
| saveFileName = this.alias+"_"+startDate+'_'+ endDate | |||||
| break | break | ||||
| } | } | ||||
| case "current_year":{ | case "current_year":{ | ||||
| @@ -512,14 +520,14 @@ | |||||
| startDate = this.comparedate(startDate,this.recordBeginTime) | startDate = this.comparedate(startDate,this.recordBeginTime) | ||||
| endDate = yesterday | endDate = yesterday | ||||
| saveFileName = this.pro_name+"_"+startDate+'_'+ endDate | |||||
| saveFileName = this.alias+"_"+startDate+'_'+ endDate | |||||
| break | break | ||||
| } | } | ||||
| case "all":{ | case "all":{ | ||||
| console.log("e:"+today) | console.log("e:"+today) | ||||
| startDate = 'all' | startDate = 'all' | ||||
| endDate = yesterday | endDate = yesterday | ||||
| saveFileName = this.pro_name+'_所有' | |||||
| saveFileName = this.alias+'_所有' | |||||
| break | break | ||||
| } | } | ||||
| } | } | ||||
| @@ -641,7 +649,7 @@ | |||||
| this.tableData = res.data.pageRecords | this.tableData = res.data.pageRecords | ||||
| this.totalPage=res.data.totalPage | this.totalPage=res.data.totalPage | ||||
| this.totalNum = res.data.totalCount//this.totalPage*this.params.pagesize | this.totalNum = res.data.totalCount//this.totalPage*this.params.pagesize | ||||
| console.log("this.totalPage:"+this.totalPage) | |||||
| // console.log("this.totalPage:"+this.totalPage) | |||||
| }) | }) | ||||
| }, | }, | ||||
| @@ -652,13 +660,14 @@ | |||||
| this.getAllProList(this.params.type, this.dynamic) | this.getAllProList(this.params.type, this.dynamic) | ||||
| }, | }, | ||||
| goToDetailPage(pro_id,pro_name,ownerName){ | |||||
| goToDetailPage(pro_id,pro_name,ownerName,alias){ | |||||
| this.currentPage=1 | this.currentPage=1 | ||||
| document.getElementById("pro_main").style.display="none"; | document.getElementById("pro_main").style.display="none"; | ||||
| document.getElementById("pro_detail").style.display="block"; | document.getElementById("pro_detail").style.display="block"; | ||||
| console.log(pro_id) | |||||
| console.log(pro_name) | |||||
| // console.log(pro_id) | |||||
| // console.log(pro_name) | |||||
| this.pro_name=pro_name; | this.pro_name=pro_name; | ||||
| this.alias=alias; | |||||
| this.pro_id=pro_id; | this.pro_id=pro_id; | ||||
| this.ownerName=ownerName | this.ownerName=ownerName | ||||
| this.getOneProData(pro_id); | this.getOneProData(pro_id); | ||||