| @@ -566,6 +566,17 @@ type FlavorInfo struct { | |||
| Desc string `json:"desc"` | |||
| } | |||
| type SpecialPools struct { | |||
| Pools []*SpecialPool `json:"pools"` | |||
| } | |||
| type SpecialPool struct { | |||
| Org string `json:"org"` | |||
| Type string `json:"type"` | |||
| IsExclusive bool `json:"isExclusive"` | |||
| Pool []*GpuInfo `json:"pool"` | |||
| JobType []string `json:"jobType"` | |||
| } | |||
| type ImageInfosModelArts struct { | |||
| ImageInfo []*ImageInfoModelArts `json:"image_info"` | |||
| } | |||
| @@ -1955,12 +1966,12 @@ type DatasetInfo struct { | |||
| Name string | |||
| } | |||
| func GetDatasetInfo(uuidStr string) (map[string]DatasetInfo, string, error) { | |||
| var datasetNames string | |||
| func GetDatasetInfo(uuidStr string) (map[string]DatasetInfo, string, string, error) { | |||
| var datasetNames, fileNames string | |||
| uuids := strings.Split(uuidStr, ";") | |||
| if len(uuids) > setting.MaxDatasetNum { | |||
| log.Error("the dataset count(%d) exceed the limit", len(uuids)) | |||
| return nil, datasetNames, errors.New("the dataset count exceed the limit") | |||
| return nil, datasetNames, fileNames, errors.New("the dataset count exceed the limit") | |||
| } | |||
| datasetInfos := make(map[string]DatasetInfo) | |||
| @@ -1968,13 +1979,13 @@ func GetDatasetInfo(uuidStr string) (map[string]DatasetInfo, string, error) { | |||
| attach, err := GetAttachmentByUUID(uuid) | |||
| if err != nil { | |||
| log.Error("GetAttachmentByUUID failed: %v", err) | |||
| return nil, datasetNames, err | |||
| return nil, datasetNames, fileNames, err | |||
| } | |||
| for _, datasetInfo := range datasetInfos { | |||
| if attach.Name == datasetInfo.Name { | |||
| log.Error("the dataset name is same: %v", attach.Name) | |||
| return nil, datasetNames, errors.New("the dataset name is same") | |||
| return nil, datasetNames, fileNames, errors.New("the dataset name is same") | |||
| } | |||
| } | |||
| @@ -1984,16 +1995,19 @@ func GetDatasetInfo(uuidStr string) (map[string]DatasetInfo, string, error) { | |||
| AttachmentRelativePath(uuid) + | |||
| uuid | |||
| fileName := strings.TrimSuffix(strings.TrimSuffix(strings.TrimSuffix(attach.Name, ".zip"), ".tar.gz"), ".tgz") | |||
| datasetInfos[uuid] = DatasetInfo{ | |||
| DataLocalPath: dataLocalPath, | |||
| Name: strings.TrimSuffix(strings.TrimSuffix(strings.TrimSuffix(attach.Name, ".zip"), ".tar.gz"), ".tgz"), | |||
| Name: fileName, | |||
| } | |||
| if i == 0 { | |||
| datasetNames = attach.Name | |||
| fileNames = fileName | |||
| } else { | |||
| datasetNames += ";" + attach.Name | |||
| fileNames += "|" + fileName | |||
| } | |||
| } | |||
| return datasetInfos, datasetNames, nil | |||
| return datasetInfos, datasetNames, fileNames, nil | |||
| } | |||
| @@ -406,7 +406,7 @@ func RestartTask(ctx *context.Context, task *models.Cloudbrain, newID *string) e | |||
| return errors.New("no such resourceSpec") | |||
| } | |||
| datasetInfos, _, err := models.GetDatasetInfo(task.Uuid) | |||
| datasetInfos, _, _, err := models.GetDatasetInfo(task.Uuid) | |||
| if err != nil { | |||
| log.Error("GetDatasetInfo failed:%v", err, ctx.Data["MsgID"]) | |||
| return err | |||
| @@ -1,12 +1,16 @@ | |||
| package grampus | |||
| import ( | |||
| "encoding/json" | |||
| "strings" | |||
| "code.gitea.io/gitea/modules/setting" | |||
| "code.gitea.io/gitea/models" | |||
| "code.gitea.io/gitea/modules/context" | |||
| "code.gitea.io/gitea/modules/log" | |||
| "code.gitea.io/gitea/modules/notification" | |||
| "code.gitea.io/gitea/modules/timeutil" | |||
| "strings" | |||
| ) | |||
| const ( | |||
| @@ -28,6 +32,8 @@ var ( | |||
| poolInfos *models.PoolInfos | |||
| FlavorInfos *models.FlavorInfos | |||
| ImageInfos *models.ImageInfosModelArts | |||
| SpecialPools *models.SpecialPools | |||
| ) | |||
| type GenerateTrainJobReq struct { | |||
| @@ -63,6 +69,27 @@ type GenerateTrainJobReq struct { | |||
| func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error) { | |||
| createTime := timeutil.TimeStampNow() | |||
| var CenterID []string | |||
| var CenterName []string | |||
| if SpecialPools != nil { | |||
| for _, pool := range SpecialPools.Pools { | |||
| if !pool.IsExclusive && strings.Contains(req.ComputeResource, pool.Type) { | |||
| org, _ := models.GetOrgByName(pool.Org) | |||
| if org != nil { | |||
| isOrgMember, _ := models.IsOrganizationMember(org.ID, ctx.User.ID) | |||
| if isOrgMember { | |||
| for _, info := range pool.Pool { | |||
| CenterID = append(CenterID, info.Queue) | |||
| CenterName = append(CenterName, info.Value) | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| jobResult, err := createJob(models.CreateGrampusJobRequest{ | |||
| Name: req.JobName, | |||
| Tasks: []models.GrampusTasks{ | |||
| @@ -72,6 +99,8 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error | |||
| ResourceSpecId: req.ResourceSpecId, | |||
| ImageId: req.ImageId, | |||
| ImageUrl: req.ImageUrl, | |||
| CenterID: CenterID, | |||
| CenterName: CenterName, | |||
| ReplicaNum: 1, | |||
| }, | |||
| }, | |||
| @@ -136,3 +165,8 @@ func TransTrainJobStatus(status string) string { | |||
| return strings.ToUpper(status) | |||
| } | |||
| func InitSpecialPool() { | |||
| if SpecialPools == nil && setting.Grampus.SpecialPools != "" { | |||
| json.Unmarshal([]byte(setting.Grampus.SpecialPools), &SpecialPools) | |||
| } | |||
| } | |||
| @@ -531,10 +531,11 @@ var ( | |||
| //grampus config | |||
| Grampus = struct { | |||
| Env string | |||
| Host string | |||
| UserName string | |||
| Password string | |||
| Env string | |||
| Host string | |||
| UserName string | |||
| Password string | |||
| SpecialPools string | |||
| }{} | |||
| //elk config | |||
| @@ -1414,6 +1415,8 @@ func GetGrampusConfig() { | |||
| Grampus.Host = sec.Key("SERVER_HOST").MustString("") | |||
| Grampus.UserName = sec.Key("USERNAME").MustString("") | |||
| Grampus.Password = sec.Key("PASSWORD").MustString("") | |||
| Grampus.SpecialPools = sec.Key("SPECIAL_POOL").MustString("") | |||
| } | |||
| func SetRadarMapConfig() { | |||
| @@ -6,6 +6,7 @@ package setting | |||
| import ( | |||
| "net/url" | |||
| "strings" | |||
| "code.gitea.io/gitea/modules/log" | |||
| ) | |||
| @@ -13,14 +14,18 @@ import ( | |||
| var ( | |||
| // Webhook settings | |||
| Webhook = struct { | |||
| QueueLength int | |||
| DeliverTimeout int | |||
| SkipTLSVerify bool | |||
| Types []string | |||
| PagingNum int | |||
| ProxyURL string | |||
| ProxyURLFixed *url.URL | |||
| ProxyHosts []string | |||
| QueueLength int | |||
| DeliverTimeout int | |||
| SkipTLSVerify bool | |||
| Types []string | |||
| PagingNum int | |||
| ProxyURL string | |||
| ProxyURLFixed *url.URL | |||
| ProxyHosts []string | |||
| Socks5Proxy string | |||
| Socks5UserName string | |||
| Socks5Password string | |||
| Socks5ProxyHosts []string | |||
| }{ | |||
| QueueLength: 1000, | |||
| DeliverTimeout: 5, | |||
| @@ -39,6 +44,10 @@ func newWebhookService() { | |||
| Webhook.Types = []string{"gitea", "gogs", "slack", "discord", "dingtalk", "telegram", "msteams", "feishu", "matrix"} | |||
| Webhook.PagingNum = sec.Key("PAGING_NUM").MustInt(10) | |||
| Webhook.ProxyURL = sec.Key("PROXY_URL").MustString("") | |||
| Webhook.Socks5Proxy = sec.Key("SOCKS5_PROXY_URL").MustString("") | |||
| Webhook.Socks5UserName = sec.Key("SOCKS5_USER_NAME").MustString("") | |||
| Webhook.Socks5Password = sec.Key("SOCKS5_PASSWORD").MustString("") | |||
| Webhook.Socks5ProxyHosts = strings.Split(sec.Key("SOCKS5_PROXY_HOST").MustString(""), ";") | |||
| if Webhook.ProxyURL != "" { | |||
| var err error | |||
| Webhook.ProxyURLFixed, err = url.Parse(Webhook.ProxyURL) | |||
| @@ -16,6 +16,8 @@ import ( | |||
| "sync" | |||
| "time" | |||
| "golang.org/x/net/proxy" | |||
| "code.gitea.io/gitea/models" | |||
| "code.gitea.io/gitea/modules/graceful" | |||
| "code.gitea.io/gitea/modules/log" | |||
| @@ -137,8 +139,10 @@ func Deliver(t *models.HookTask) error { | |||
| return | |||
| } | |||
| }() | |||
| match := isSocks5ProxyUrlMatch(req) | |||
| resp, err := makeReq(req, match) | |||
| resp, err := webhookHTTPClient.Do(req) | |||
| if err != nil { | |||
| t.ResponseInfo.Body = fmt.Sprintf("Delivery: %v", err) | |||
| return err | |||
| @@ -161,6 +165,23 @@ func Deliver(t *models.HookTask) error { | |||
| return nil | |||
| } | |||
| func makeReq(req *http.Request, proxyMatch bool) (*http.Response, error) { | |||
| if proxyMatch { | |||
| return webhookSocks5PoxyHTTPClient.Do(req) | |||
| } | |||
| return webhookHTTPClient.Do(req) | |||
| } | |||
| func isSocks5ProxyUrlMatch(req *http.Request) bool { | |||
| for _, v := range socks5HostMatchers { | |||
| if v.Match(req.URL.Host) { | |||
| return true | |||
| } | |||
| } | |||
| return false | |||
| } | |||
| // DeliverHooks checks and delivers undelivered hooks. | |||
| // FIXME: graceful: This would likely benefit from either a worker pool with dummy queue | |||
| // or a full queue. Then more hooks could be sent at same time. | |||
| @@ -225,9 +246,11 @@ func DeliverHooks(ctx context.Context) { | |||
| } | |||
| var ( | |||
| webhookHTTPClient *http.Client | |||
| once sync.Once | |||
| hostMatchers []glob.Glob | |||
| webhookHTTPClient *http.Client | |||
| once sync.Once | |||
| hostMatchers []glob.Glob | |||
| webhookSocks5PoxyHTTPClient *http.Client | |||
| socks5HostMatchers []glob.Glob | |||
| ) | |||
| func webhookProxy() func(req *http.Request) (*url.URL, error) { | |||
| @@ -274,5 +297,31 @@ func InitDeliverHooks() { | |||
| }, | |||
| } | |||
| if setting.Webhook.Socks5Proxy != "" { | |||
| auth := proxy.Auth{ | |||
| User: setting.Webhook.Socks5UserName, | |||
| Password: setting.Webhook.Socks5Password, | |||
| } | |||
| dialSocksProxy, err := proxy.SOCKS5("tcp", setting.Webhook.Socks5Proxy, &auth, proxy.Direct) | |||
| if err != nil { | |||
| fmt.Println("Error connecting to proxy:", err) | |||
| } | |||
| tr := &http.Transport{Dial: dialSocksProxy.Dial} | |||
| webhookSocks5PoxyHTTPClient = &http.Client{ | |||
| Transport: tr, | |||
| } | |||
| for _, h := range setting.Webhook.Socks5ProxyHosts { | |||
| if g, err := glob.Compile(h); err == nil { | |||
| socks5HostMatchers = append(socks5HostMatchers, g) | |||
| } else { | |||
| log.Error("glob.Compile %s failed: %v", h, err) | |||
| } | |||
| } | |||
| } | |||
| go graceful.GetManager().RunWithShutdownContext(DeliverHooks) | |||
| } | |||
| @@ -1178,6 +1178,7 @@ model.manage.model_accuracy = Model Accuracy | |||
| grampus.train_job.ai_center = AI Center | |||
| grampus.dataset_path_rule = The code is storaged in /cache/code;the dataset is storaged in /cache/dataset;and please put your model into /cache/output, then you can download it online。 | |||
| grampus.no_operate_right = You have no right to do this operation. | |||
| template.items = Template Items | |||
| template.git_content = Git Content (Default Branch) | |||
| @@ -1193,6 +1193,8 @@ model.manage.model_accuracy = 模型精度 | |||
| grampus.train_job.ai_center=智算中心 | |||
| grampus.dataset_path_rule = 训练脚本存储在/cache/code中,数据集存储在/cache/dataset中,训练输出请存储在/cache/output中以供后续下载。 | |||
| grampus.no_operate_right = 您没有权限创建这类任务。 | |||
| template.items=模板选项 | |||
| template.git_content=Git数据(默认分支) | |||
| template.git_hooks=Git 钩子 | |||
| @@ -215,20 +215,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||
| resourceSpecId := form.ResourceSpecId | |||
| branchName := form.BranchName | |||
| repo := ctx.Repo.Repository | |||
| tpl := tplCloudBrainNew | |||
| command := cloudbrain.Command | |||
| if jobType == string(models.JobTypeTrain) { | |||
| tpl = tplCloudBrainTrainJobNew | |||
| commandTrain, err := getTrainJobCommand(form) | |||
| if err != nil { | |||
| log.Error("getTrainJobCommand failed: %v", err) | |||
| ctx.RenderWithErr(err.Error(), tpl, &form) | |||
| return | |||
| } | |||
| command = commandTrain | |||
| } | |||
| tasks, err := models.GetCloudbrainsByDisplayJobName(repo.ID, jobType, displayJobName) | |||
| if err == nil { | |||
| @@ -274,7 +261,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||
| } | |||
| } | |||
| datasetInfos, datasetNames, err := models.GetDatasetInfo(uuids) | |||
| datasetInfos, datasetNames, fileNames, err := models.GetDatasetInfo(uuids) | |||
| if err != nil { | |||
| log.Error("GetDatasetInfo failed: %v", err, ctx.Data["MsgID"]) | |||
| cloudBrainNewDataPrepare(ctx) | |||
| @@ -282,6 +269,19 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { | |||
| return | |||
| } | |||
| command := cloudbrain.Command | |||
| if jobType == string(models.JobTypeTrain) { | |||
| tpl = tplCloudBrainTrainJobNew | |||
| commandTrain, err := getTrainJobCommand(form, fileNames) | |||
| if err != nil { | |||
| log.Error("getTrainJobCommand failed: %v", err) | |||
| ctx.RenderWithErr(err.Error(), tpl, &form) | |||
| return | |||
| } | |||
| command = commandTrain | |||
| } | |||
| if branchName == "" { | |||
| branchName = cloudbrain.DefaultBranchName | |||
| } | |||
| @@ -2036,7 +2036,7 @@ func BenchMarkAlgorithmCreate(ctx *context.Context, form auth.CreateCloudBrainFo | |||
| } | |||
| uuid := childInfo.Attachment | |||
| datasetInfos, datasetNames, err := models.GetDatasetInfo(uuid) | |||
| datasetInfos, datasetNames, _, err := models.GetDatasetInfo(uuid) | |||
| if err != nil { | |||
| log.Error("GetDatasetInfo failed: %v", err, ctx.Data["MsgID"]) | |||
| cloudBrainNewDataPrepare(ctx) | |||
| @@ -2164,7 +2164,7 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm) | |||
| command = fmt.Sprintf(cloudbrain.BrainScoreCommand, getBrainRegion(benchmarkChildTypeID), displayJobName, trimSpaceNewlineInString(form.Description)) | |||
| } | |||
| datasetInfos, datasetNames, err := models.GetDatasetInfo(uuid) | |||
| datasetInfos, datasetNames, _, err := models.GetDatasetInfo(uuid) | |||
| if err != nil { | |||
| log.Error("GetDatasetInfo failed: %v", err, ctx.Data["MsgID"]) | |||
| cloudBrainNewDataPrepare(ctx) | |||
| @@ -2246,7 +2246,7 @@ func CloudBrainTrainJobNew(ctx *context.Context) { | |||
| ctx.HTML(http.StatusOK, tplCloudBrainTrainJobNew) | |||
| } | |||
| func getTrainJobCommand(form auth.CreateCloudBrainForm) (string, error) { | |||
| func getTrainJobCommand(form auth.CreateCloudBrainForm, fileNames string) (string, error) { | |||
| var command string | |||
| bootFile := strings.TrimSpace(form.BootFile) | |||
| params := form.Params | |||
| @@ -2270,6 +2270,8 @@ func getTrainJobCommand(form auth.CreateCloudBrainForm) (string, error) { | |||
| } | |||
| } | |||
| param += " --dataset_list=" + fileNames | |||
| command += "python /code/" + bootFile + param + " > " + cloudbrain.ModelMountPath + "/" + form.DisplayJobName + "-" + cloudbrain.LogFile | |||
| return command, nil | |||
| @@ -71,6 +71,25 @@ func grampusTrainJobNewDataPrepare(ctx *context.Context, processType string) err | |||
| ctx.Data["images"] = images.Infos | |||
| } | |||
| grampus.InitSpecialPool() | |||
| ctx.Data["GPUEnabled"] = true | |||
| ctx.Data["NPUEnabled"] = true | |||
| if grampus.SpecialPools != nil { | |||
| for _, pool := range grampus.SpecialPools.Pools { | |||
| if pool.IsExclusive { | |||
| org, _ := models.GetOrgByName(pool.Org) | |||
| if org != nil { | |||
| isOrgMember, _ := models.IsOrganizationMember(org.ID, ctx.User.ID) | |||
| if !isOrgMember { | |||
| ctx.Data[pool.Type+"Enabled"] = false | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| //get valid resource specs | |||
| specs, err := grampus.GetResourceSpecs(processType) | |||
| if err != nil { | |||
| @@ -128,10 +147,18 @@ func GrampusTrainJobGpuCreate(ctx *context.Context, form auth.CreateGrampusTrain | |||
| image := strings.TrimSpace(form.Image) | |||
| if !jobNamePattern.MatchString(displayJobName) { | |||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | |||
| ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_jobname_err"), tplGrampusTrainJobGPUNew, &form) | |||
| return | |||
| } | |||
| errStr := checkSpecialPool(ctx, "GPU") | |||
| if errStr != "" { | |||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeGPU) | |||
| ctx.RenderWithErr(errStr, tplGrampusTrainJobGPUNew, &form) | |||
| return | |||
| } | |||
| //check count limit | |||
| count, err := models.GetGrampusCountByUserID(ctx.User.ID, string(models.JobTypeTrain), models.GPUResource) | |||
| if err != nil { | |||
| @@ -263,6 +290,28 @@ func GrampusTrainJobGpuCreate(ctx *context.Context, form auth.CreateGrampusTrain | |||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/train-job") | |||
| } | |||
| func checkSpecialPool(ctx *context.Context, resourceType string) string { | |||
| grampus.InitSpecialPool() | |||
| if grampus.SpecialPools != nil { | |||
| for _, pool := range grampus.SpecialPools.Pools { | |||
| if pool.IsExclusive && pool.Type == resourceType { | |||
| org, _ := models.GetOrgByName(pool.Org) | |||
| if org != nil { | |||
| isOrgMember, _ := models.IsOrganizationMember(org.ID, ctx.User.ID) | |||
| if !isOrgMember { | |||
| return ctx.Tr("repo.grampus.no_operate_right") | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| return "" | |||
| } | |||
| func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrainJobForm) { | |||
| displayJobName := form.DisplayJobName | |||
| jobName := util.ConvertDisplayJobNameToJobName(displayJobName) | |||
| @@ -281,10 +330,18 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain | |||
| engineName := form.EngineName | |||
| if !jobNamePattern.MatchString(displayJobName) { | |||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | |||
| ctx.RenderWithErr(ctx.Tr("repo.cloudbrain_jobname_err"), tplGrampusTrainJobNPUNew, &form) | |||
| return | |||
| } | |||
| errStr := checkSpecialPool(ctx, "NPU") | |||
| if errStr != "" { | |||
| grampusTrainJobNewDataPrepare(ctx, grampus.ProcessorTypeNPU) | |||
| ctx.RenderWithErr(errStr, tplGrampusTrainJobGPUNew, &form) | |||
| return | |||
| } | |||
| //check count limit | |||
| count, err := models.GetGrampusCountByUserID(ctx.User.ID, string(models.JobTypeTrain), models.NPUResource) | |||
| if err != nil { | |||
| @@ -90,6 +90,19 @@ | |||
| <input type="hidden" id="ai_engine_name" name="engine_names" value=""> | |||
| <input type="hidden" id="ai_flaver_name" name="flaver_names" value=""> | |||
| <h4 class="train-job-title ui header ">{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:</h4> | |||
| <div class="required unite min_title inline field"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_cluster"}}</label> | |||
| <div class="ui blue mini menu compact selectcloudbrain"> | |||
| <a class="active item" href="{{.RepoLink}}/cloudbrain/train-job/create"> | |||
| <svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg> | |||
| {{.i18n.Tr "cloudbrain.resource_cluster_openi"}} | |||
| </a> | |||
| <a class="item" href="{{.RepoLink}}/grampus/train-job/{{if.NPUEnabled}}npu{{else}}gpu{{end}}/create"> | |||
| <svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg> | |||
| {{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}(Beta) | |||
| </a> | |||
| </div> | |||
| </div> | |||
| <div class="required min_title inline field"> | |||
| <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.compute_resource"}}</label> | |||
| <div class="ui blue mini menu compact selectcloudbrain"> | |||
| @@ -89,23 +89,23 @@ | |||
| <svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg> | |||
| {{.i18n.Tr "cloudbrain.resource_cluster_openi"}} | |||
| </a> | |||
| <a class="active item" href="{{.RepoLink}}/grampus/train-job/npu/create"> | |||
| <svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg> | |||
| {{.i18n.Tr "cloudbrain.resource_cluster_c2net"}} | |||
| </a> | |||
| <a class="active item" href="{{.RepoLink}}/grampus/train-job/{{if.NPUEnabled}}npu{{else}}gpu{{end}}/create"> | |||
| <svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg> | |||
| {{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}(Beta) | |||
| </a> | |||
| </div> | |||
| </div> | |||
| <div class="required unite min_title inline field"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.compute_resource"}}</label> | |||
| <div class="ui blue mini menu compact selectcloudbrain"> | |||
| <a class="active item" href="{{.RepoLink}}/grampus/train-job/gpu/create"> | |||
| <a {{if.GPUEnabled}}class="active item" href="{{.RepoLink}}/grampus/train-job/gpu/create"{{else}}href="javascript:return false;" class="item disabled" {{end}}> | |||
| <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"> | |||
| <path fill="none" d="M0 0h24v24H0z"/> | |||
| <path d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z"/> | |||
| </svg> | |||
| CPU/GPU | |||
| </a> | |||
| <a class="item" href="{{.RepoLink}}/grampus/train-job/npu/create"> | |||
| <a {{if.NPUEnabled}}class="item" href="{{.RepoLink}}/grampus/train-job/npu/create"{{else}}href="javascript:return false;" class="item disabled" {{end}} > | |||
| <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"> | |||
| <path fill="none" d="M0 0h24v24H0z"/> | |||
| <path d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z"/> | |||
| @@ -85,23 +85,23 @@ | |||
| <svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg> | |||
| {{.i18n.Tr "cloudbrain.resource_cluster_openi"}} | |||
| </a> | |||
| <a class="active item" href="{{.RepoLink}}/grampus/train-job/npu/create"> | |||
| <svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg> | |||
| {{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}(Beta) | |||
| <a class="active item" href="{{.RepoLink}}/grampus/train-job/{{if.NPUEnabled}}npu{{else}}gpu{{end}}/create"> | |||
| <svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg> | |||
| {{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}(Beta) | |||
| </a> | |||
| </div> | |||
| </div> | |||
| <div class="required unite min_title inline field"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.compute_resource"}}</label> | |||
| <div class="ui blue mini menu compact selectcloudbrain"> | |||
| <!--a class="item" href="{{.RepoLink}}/grampus/train-job/gpu/create" type="hidden"> | |||
| <a {{if.GPUEnabled}}class="item" href="{{.RepoLink}}/grampus/train-job/gpu/create"{{else}}href="javascript:return false;" class="item disabled" {{end}}> | |||
| <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"> | |||
| <path fill="none" d="M0 0h24v24H0z"/> | |||
| <path d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z"/> | |||
| </svg> | |||
| CPU/GPU | |||
| </a--> | |||
| <a class="active item" href="{{.RepoLink}}/grampus/train-job/npu/create"> | |||
| </a> | |||
| <a {{if.NPUEnabled}}class="active item" href="{{.RepoLink}}/grampus/train-job/npu/create"{{else}}href="javascript:return false;" class="item disabled" {{end}} > | |||
| <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"> | |||
| <path fill="none" d="M0 0h24v24H0z"/> | |||
| <path d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z"/> | |||
| @@ -85,6 +85,19 @@ | |||
| <input type="hidden" id="ai_engine_name" name="engine_names" value=""> | |||
| <input type="hidden" id="ai_flaver_name" name="flaver_names" value=""> | |||
| <h4 class="unite title ui header ">{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:</h4> | |||
| <div class="required unite min_title inline field"> | |||
| <label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_cluster"}}</label> | |||
| <div class="ui blue mini menu compact selectcloudbrain"> | |||
| <a class="active item" href="{{.RepoLink}}/cloudbrain/train-job/create"> | |||
| <svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg> | |||
| {{.i18n.Tr "cloudbrain.resource_cluster_openi"}} | |||
| </a> | |||
| <a class="item" href="{{.RepoLink}}/grampus/train-job/npu/create"> | |||
| <svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg> | |||
| {{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}(Beta) | |||
| </a> | |||
| </div> | |||
| </div> | |||
| <div class="required inline min_title field"> | |||
| <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.compute_resource"}}</label> | |||
| <div class="ui blue mini menu compact selectcloudbrain"> | |||
| @@ -54,7 +54,11 @@ | |||
| " | |||
| >选择数据集 | |||
| </el-button> | |||
| <el-dialog title="选择数据集" :visible.sync="dialogVisible" width="50%"> | |||
| <el-dialog | |||
| title="选择数据集" | |||
| :visible.sync="dialogVisible" | |||
| :width="dialogWidth" | |||
| > | |||
| <div class="ui icon input dataset-search-vue"> | |||
| <i | |||
| class="search icon" | |||
| @@ -70,7 +74,7 @@ | |||
| </div> | |||
| <el-row> | |||
| <el-col | |||
| :span="18" | |||
| :span="17" | |||
| style=" | |||
| padding-right: 1rem; | |||
| border-right: 1px solid #f5f5f6; | |||
| @@ -106,7 +110,7 @@ | |||
| <span v-else class="dataset-title dataset-nowrap" | |||
| >{{ node.label }} | |||
| </span> | |||
| <a | |||
| <!-- <a | |||
| :href=" | |||
| '/' + | |||
| data.Repo.OwnerName + | |||
| @@ -118,7 +122,24 @@ | |||
| class="dataset-repolink dataset-nowrap" | |||
| :title="data.Repo.OwnerName + '/' + data.Repo.Alias" | |||
| >{{ data.Repo.OwnerName }}/{{ data.Repo.Alias }}</a | |||
| > --> | |||
| <span | |||
| class="dataset-repolink dataset-nowrap" | |||
| @click.stop="return false;" | |||
| > | |||
| <a | |||
| :href=" | |||
| '/' + | |||
| data.Repo.OwnerName + | |||
| '/' + | |||
| data.Repo.Alias + | |||
| '/datasets' | |||
| " | |||
| target="_blank" | |||
| :title="data.Repo.OwnerName + '/' + data.Repo.Alias" | |||
| >{{ data.Repo.OwnerName }}/{{ data.Repo.Alias }}</a | |||
| > | |||
| </span> | |||
| </span> | |||
| <span v-else style="display: flex"> | |||
| <span class="dataset-nowrap" :title="node.label"> | |||
| @@ -401,7 +422,7 @@ | |||
| </el-tabs> | |||
| </el-col> | |||
| <el-col | |||
| :span="6" | |||
| :span="7" | |||
| style=" | |||
| display: flex; | |||
| flex-direction: column; | |||
| @@ -414,12 +435,13 @@ | |||
| <div | |||
| style=" | |||
| font-size: 14px; | |||
| height: 20px; | |||
| height: 40px; | |||
| text-align: left; | |||
| color: #0066ff; | |||
| line-height: 40px; | |||
| " | |||
| > | |||
| 已选择数据集 | |||
| 已选数据文件 | |||
| </div> | |||
| <div style="flex: 1; margin-top: 1.5rem"> | |||
| <el-checkbox-group v-model="checkList"> | |||
| @@ -461,7 +483,7 @@ export default { | |||
| children: "Attachments", | |||
| label: "label", | |||
| }, | |||
| dialogWidth: "65%", | |||
| dialogVisible: false, | |||
| benchmarkNew: false, | |||
| imageAddress: "", | |||
| @@ -476,7 +498,7 @@ export default { | |||
| confirmDatasetList: "", | |||
| confirmFlag: false, | |||
| saveStutusCheck: [], | |||
| saveStatusList: [], | |||
| //当前项目数据集页面配置的初始化 | |||
| initCurrentPage: 1, | |||
| totalNumCurrent: 0, | |||
| @@ -541,7 +563,11 @@ export default { | |||
| this.selectDatasetArray.every((item) => item.id !== data.id) | |||
| ) { | |||
| console.log("111111111111"); | |||
| if (this.selectDatasetArray.some((item) => item.label === data.label)) { | |||
| if ( | |||
| this.selectDatasetArray.some((item) => { | |||
| return item.label === data.label && item.id === data.id; | |||
| }) | |||
| ) { | |||
| this.$refs[data.ref].setChecked(data.id, false, false); | |||
| this.$message.warning("不能选择相同名称的数据文件"); | |||
| } else if (this.selectDatasetArray.length === 5) { | |||
| @@ -564,70 +590,35 @@ export default { | |||
| this.checkList = this.selectDatasetArray.map((item) => { | |||
| return item.label; | |||
| }); | |||
| this.confirmDatasetList = this.selectDatasetArray | |||
| .map((item) => { | |||
| return item.UUID; | |||
| }) | |||
| .join(";"); | |||
| console.log("this.confirmDatasetList", this.confirmDatasetList); | |||
| this.saveStutusCheck = this.selectDatasetArray.reduce((pre, cur) => { | |||
| let checkedKeys = {}; | |||
| checkedKeys.treeRef = cur.ref; | |||
| checkedKeys.id = cur.id; | |||
| checkedKeys.page = cur.page; | |||
| pre.push(checkedKeys); | |||
| return pre; | |||
| }, []); | |||
| console.log("this.saveStutusCheck", this.saveStutusCheck); | |||
| this.saveStatusList = this.selectDatasetArray.map((item) => { | |||
| return item.UUID; | |||
| }); | |||
| this.confirmDatasetList = this.saveStatusList.join(";"); | |||
| console.log(this.selectDatasetArray, this.checkList); | |||
| console.log("this.saveStatusList", this.saveStatusList); | |||
| console.log("this.confirmDatasetList", this.confirmDatasetList); | |||
| console.log("======================================"); | |||
| }, | |||
| //已选择数据集checkbox group 勾选事件 | |||
| changeCheckbox(checked, data) { | |||
| console.log(checked, data); | |||
| switch (data.ref) { | |||
| case "currentTree": { | |||
| this.$refs.currentTree.setChecked(data.id, false, false); | |||
| let index = this.saveStutusCheck.findIndex((item) => { | |||
| return item.id === data.id; | |||
| }); | |||
| index !== -1 && this.saveStutusCheck.splice(index, 1); | |||
| } | |||
| case "myTree": { | |||
| this.$refs.myTree.setChecked(data.id, false, false); | |||
| let index = this.saveStutusCheck.findIndex((item) => { | |||
| return item.id === data.id; | |||
| }); | |||
| index !== -1 && this.saveStutusCheck.splice(index, 1); | |||
| } | |||
| case "publicTree": { | |||
| this.$refs.publicTree.setChecked(data.id, false, false); | |||
| let index = this.saveStutusCheck.findIndex((item) => { | |||
| return item.id === data.id; | |||
| }); | |||
| index !== -1 && this.saveStutusCheck.splice(index, 1); | |||
| } | |||
| case "favoriteTree": { | |||
| this.$refs.myTree.setChecked(data.id, false, false); | |||
| let index = this.saveStutusCheck.findIndex((item) => { | |||
| return item.id === data.id; | |||
| }); | |||
| index !== -1 && this.saveStutusCheck.splice(index, 1); | |||
| } | |||
| default: | |||
| } | |||
| this.$refs.currentTree.setChecked(data.id, false, false); | |||
| this.$refs.myTree.setChecked(data.id, false, false); | |||
| this.$refs.publicTree.setChecked(data.id, false, false); | |||
| this.$refs.favoriteTree.setChecked(data.id, false, false); | |||
| let index = this.selectDatasetArray.findIndex((item) => { | |||
| console.log(item.id, data.id); | |||
| return item.id === data.id; | |||
| }); | |||
| console.log("index", index); | |||
| this.selectDatasetArray.splice(index, 1); | |||
| this.saveStatusList.splice(index, 1); | |||
| console.log(this.selectDatasetArray); | |||
| this.confirmDatasetList = this.selectDatasetArray | |||
| .map((item) => { | |||
| return item.UUID; | |||
| }) | |||
| .join(";"); | |||
| this.confirmDatasetList = this.saveStatusList.join(";"); | |||
| console.log("selectDatasetArray--:", this.selectDatasetArray); | |||
| console.log("saveStatusList----:", this.saveStatusList); | |||
| console.log("confirmDatasetList----:", this.confirmDatasetList); | |||
| console.log("=================================================="); | |||
| }, | |||
| tableHeaderStyle({ row, column, rowIndex, columnIndex }) { | |||
| if (rowIndex === 0) { | |||
| @@ -676,15 +667,17 @@ export default { | |||
| this.totalNumCurrent = parseInt(res.data.count); | |||
| console.log(this.selectDatasetArray); | |||
| console.log("this.currentDatasetList:", this.currentDatasetList); | |||
| let setCheckedKeysList = this.saveStutusCheck.reduce((pre, cur) => { | |||
| if ( | |||
| cur.treeRef === "currentTree" && | |||
| cur.page === this.paramsCurrent.page | |||
| ) { | |||
| pre.push(cur.id); | |||
| } | |||
| return pre; | |||
| }, []); | |||
| let setCheckedKeysList = this.currentDatasetList.reduce( | |||
| (pre, cur) => { | |||
| cur.Attachments.forEach((item) => { | |||
| if (this.saveStatusList.includes(item.id)) { | |||
| pre.push(item.id); | |||
| } | |||
| }); | |||
| return pre; | |||
| }, | |||
| [] | |||
| ); | |||
| console.log("setCheckedKeysList", setCheckedKeysList); | |||
| this.$refs.currentTree.setCheckedKeys(setCheckedKeysList); | |||
| }) | |||
| @@ -714,11 +707,12 @@ export default { | |||
| this.initMyTreeNode = [this.myDatasetList[0].id]; | |||
| this.totalNumMy = parseInt(res.data.count); | |||
| console.log("this.myDatasetList:", this.myDatasetList); | |||
| console.log("this.aveStutusCheck:", this.saveStutusCheck); | |||
| let setCheckedKeysList = this.saveStutusCheck.reduce((pre, cur) => { | |||
| if (cur.treeRef === "myTree" && cur.page === this.paramsMy.page) { | |||
| pre.push(cur.id); | |||
| } | |||
| let setCheckedKeysList = this.myDatasetList.reduce((pre, cur) => { | |||
| cur.Attachments.forEach((item) => { | |||
| if (this.saveStatusList.includes(item.id)) { | |||
| pre.push(item.id); | |||
| } | |||
| }); | |||
| return pre; | |||
| }, []); | |||
| console.log("setCheckedKeysList", setCheckedKeysList); | |||
| @@ -750,13 +744,13 @@ export default { | |||
| this.initPublicTreeNode = [this.publicDatasetList[0].id]; | |||
| this.totalNumPublic = parseInt(res.data.count); | |||
| console.log("this.publicDatasetList:", this.publicDatasetList); | |||
| let setCheckedKeysList = this.saveStutusCheck.reduce((pre, cur) => { | |||
| if ( | |||
| cur.treeRef === "publicTree" && | |||
| cur.page === this.paramsPublics.page | |||
| ) { | |||
| pre.push(cur.id); | |||
| } | |||
| let setCheckedKeysList = this.publicDatasetList.reduce((pre, cur) => { | |||
| cur.Attachments.forEach((item) => { | |||
| if (this.saveStatusList.includes(item.id)) { | |||
| pre.push(item.id); | |||
| } | |||
| }); | |||
| return pre; | |||
| }, []); | |||
| console.log("setCheckedKeysList", setCheckedKeysList); | |||
| @@ -792,15 +786,18 @@ export default { | |||
| "this.MyFavoriteDatasetList:", | |||
| this.MyFavoriteDatasetList | |||
| ); | |||
| let setCheckedKeysList = this.saveStutusCheck.reduce((pre, cur) => { | |||
| if ( | |||
| cur.treeRef === "favoriteTree" && | |||
| cur.page === this.paramsFavorite.page | |||
| ) { | |||
| pre.push(cur.id); | |||
| } | |||
| return pre; | |||
| }, []); | |||
| let setCheckedKeysList = this.MyFavoriteDatasetList.reduce( | |||
| (pre, cur) => { | |||
| cur.Attachments.forEach((item) => { | |||
| if (this.saveStatusList.includes(item.id)) { | |||
| pre.push(item.id); | |||
| } | |||
| }); | |||
| return pre; | |||
| }, | |||
| [] | |||
| ); | |||
| console.log("setCheckedKeysList", setCheckedKeysList); | |||
| this.$refs.favoriteTree.setCheckedKeys(setCheckedKeysList); | |||
| }) | |||
| @@ -811,18 +808,17 @@ export default { | |||
| }, | |||
| transformeTreeData(data, ref, page) { | |||
| return data.reduce((preParent, curParent) => { | |||
| curParent.id = `paraent-${curParent.ID}`; | |||
| curParent.id = curParent.ID; | |||
| curParent.disabled = true; | |||
| curParent.parent = true; | |||
| curParent.label = curParent.Title; | |||
| let childrenData = curParent.Attachments.reduce( | |||
| (preChild, curchild) => { | |||
| curchild.id = `chilrden-${ref}-${curchild.ID}`; | |||
| curchild.ref = ref; | |||
| curchild.page = page; | |||
| curchild.id = curchild.UUID; | |||
| if (curchild.DecompressState !== 1) { | |||
| curchild.disabled = true; | |||
| } | |||
| curchild.ref = ref; | |||
| curchild.label = curchild.Name; | |||
| preChild.push(curchild); | |||
| return preChild; | |||
| @@ -860,6 +856,18 @@ export default { | |||
| this.dialogVisible = false; | |||
| this.confirmFlag = true; | |||
| }, | |||
| setDialogWidth() { | |||
| const cWidth = document.body.clientWidth; | |||
| if (cWidth > 1600) { | |||
| this.dialogWidth = "1200px"; | |||
| } else if (cWidth < 1600 && 1200 < cWidth) { | |||
| this.dialogWidth = "1127px"; | |||
| } else if (992 < cWidth && cWidth < 1200) { | |||
| this.dialogWidth = "993px"; | |||
| } else { | |||
| this.dialogWidth = "723px"; | |||
| } | |||
| }, | |||
| }, | |||
| watch: { | |||
| search(val) { | |||
| @@ -904,8 +912,15 @@ export default { | |||
| if (location.href.indexOf("modelarts/notebook/create") !== -1) { | |||
| this.required = false; | |||
| } | |||
| window.onresize = () => { | |||
| return (() => { | |||
| this.setDialogWidth(); | |||
| })(); | |||
| }; | |||
| }, | |||
| created() { | |||
| this.setDialogWidth(); | |||
| }, | |||
| created() {}, | |||
| }; | |||
| </script> | |||
| @@ -1037,7 +1052,7 @@ export default { | |||
| .dataset-search-vue { | |||
| z-index: 9999; | |||
| position: absolute; | |||
| right: 28%; | |||
| right: 31%; | |||
| height: 30px; | |||
| top: 6px; | |||
| } | |||
| @@ -1046,6 +1061,7 @@ export default { | |||
| overflow: hidden; | |||
| text-overflow: ellipsis; | |||
| margin-right: 1rem; | |||
| white-space: nowrap; | |||
| } | |||
| .dataset_flex { | |||
| display: flex; | |||
| @@ -1079,9 +1095,10 @@ export default { | |||
| display: flex; | |||
| flex-direction: column; | |||
| } | |||
| @media screen and (min-width: 1200px) and (max-width: 1600px) { | |||
| .dataset-search-vue { | |||
| top: -30px; | |||
| top: -36px; | |||
| } | |||
| } | |||
| @media screen and (min-width: 1200px) and (max-width: 1400px) { | |||