@@ -43,6 +43,7 @@ type Attachment struct { | |||
Name string | |||
Description string `xorm:"TEXT"` | |||
DownloadCount int64 `xorm:"DEFAULT 0"` | |||
UseNumber int64 `xorm:"DEFAULT 0"` | |||
Size int64 `xorm:"DEFAULT 0"` | |||
IsPrivate bool `xorm:"DEFAULT false"` | |||
DecompressState int32 `xorm:"DEFAULT 0"` | |||
@@ -107,6 +108,15 @@ func (a *Attachment) IncreaseDownloadCount() error { | |||
return nil | |||
} | |||
func IncreaseAttachmentUseNumber(uuid string) error { | |||
// Update use number. | |||
if _, err := x.Exec("UPDATE `attachment` SET use_number=use_number+1 WHERE uuid=?", uuid); err != nil { | |||
return fmt.Errorf("increase attachment use count: %v", err) | |||
} | |||
return nil | |||
} | |||
func (a *Attachment) UpdateDatasetUpdateUnix() error { | |||
// Update download count. | |||
if _, err := x.Exec("UPDATE `dataset` SET updated_unix="+fmt.Sprint(time.Now().Unix())+" WHERE id=?", a.DatasetID); err != nil { | |||
@@ -1150,6 +1150,17 @@ type LogFile struct { | |||
Name string | |||
} | |||
type GetTrainJobMetricStatisticResult struct { | |||
TrainJobResult | |||
Interval int `json:"interval"` //查询的时间间隔,单位为分钟 | |||
MetricsInfo []Metrics `json:"metrics"` //监控详情 | |||
} | |||
type Metrics struct { | |||
Metric string `json:"metric"` //监控指标项 | |||
Value []string `json:"value"` //获取的监控值的序列,元素为String类型 | |||
} | |||
func Cloudbrains(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { | |||
sess := x.NewSession() | |||
defer sess.Close() | |||
@@ -1395,6 +1406,8 @@ func CreateCloudbrain(cloudbrain *Cloudbrain) (err error) { | |||
if _, err = x.NoAutoTime().Insert(cloudbrain); err != nil { | |||
return err | |||
} | |||
go IncreaseDatasetUseCount(cloudbrain.Uuid) | |||
return nil | |||
} | |||
@@ -1629,6 +1642,8 @@ func RestartCloudbrain(old *Cloudbrain, new *Cloudbrain) (err error) { | |||
return err | |||
} | |||
go IncreaseDatasetUseCount(new.Uuid) | |||
return nil | |||
} | |||
func CloudbrainAll(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { | |||
@@ -25,8 +25,9 @@ type Dataset struct { | |||
Category string | |||
Description string `xorm:"TEXT"` | |||
DownloadTimes int64 | |||
NumStars int `xorm:"INDEX NOT NULL DEFAULT 0"` | |||
Recommend bool `xorm:"INDEX NOT NULL DEFAULT false"` | |||
UseCount int64 `xorm:"DEFAULT 0"` | |||
NumStars int `xorm:"INDEX NOT NULL DEFAULT 0"` | |||
Recommend bool `xorm:"INDEX NOT NULL DEFAULT false"` | |||
License string | |||
Task string | |||
ReleaseID int64 `xorm:"INDEX"` | |||
@@ -212,7 +213,7 @@ func SearchDatasetByCondition(opts *SearchDatasetOptions, cond builder.Cond) (Da | |||
defer sess.Close() | |||
datasets := make(DatasetList, 0, opts.PageSize) | |||
selectColumnsSql := "distinct dataset.id,dataset.title, dataset.status, dataset.category, dataset.description, dataset.download_times, dataset.license, dataset.task, dataset.release_id, dataset.user_id, dataset.repo_id, dataset.created_unix,dataset.updated_unix,dataset.num_stars,dataset.recommend" | |||
selectColumnsSql := "distinct dataset.id,dataset.title, dataset.status, dataset.category, dataset.description, dataset.download_times, dataset.license, dataset.task, dataset.release_id, dataset.user_id, dataset.repo_id, dataset.created_unix,dataset.updated_unix,dataset.num_stars,dataset.recommend,dataset.use_count" | |||
count, err := sess.Distinct("dataset.id").Join("INNER", "repository", "repository.id = dataset.repo_id"). | |||
Join("INNER", "attachment", "attachment.dataset_id=dataset.id"). | |||
@@ -350,6 +351,17 @@ func UpdateDataset(ctx DBContext, rel *Dataset) error { | |||
return err | |||
} | |||
func IncreaseDatasetUseCount(uuid string) { | |||
IncreaseAttachmentUseNumber(uuid) | |||
attachment, _ := GetAttachmentByUUID(uuid) | |||
if attachment != nil { | |||
x.Exec("UPDATE `dataset` SET use_count=use_count+1 WHERE id=?", attachment.DatasetID) | |||
} | |||
} | |||
// GetDatasetByID returns Dataset with given ID. | |||
func GetDatasetByID(id int64) (*Dataset, error) { | |||
rel := new(Dataset) | |||
@@ -218,6 +218,8 @@ const ( | |||
SearchOrderByForks SearchOrderBy = "num_forks ASC" | |||
SearchOrderByForksReverse SearchOrderBy = "num_forks DESC" | |||
SearchOrderByDownloadTimes SearchOrderBy = "download_times DESC" | |||
SearchOrderByUseCount SearchOrderBy = "use_count ASC" | |||
SearchOrderByUseCountReverse SearchOrderBy = "use_count DESC" | |||
SearchOrderByHot SearchOrderBy = "(num_watches + num_stars + num_forks + clone_cnt) DESC" | |||
SearchOrderByActive SearchOrderBy = "(num_issues + num_pulls + num_commit) DESC" | |||
SearchOrderByWatches SearchOrderBy = "num_watches DESC" | |||
@@ -1119,3 +1119,44 @@ sendjob: | |||
return &result, nil | |||
} | |||
func GetTrainJobMetricStatistic(jobID, versionID, podName string) (*models.GetTrainJobMetricStatisticResult, error) { | |||
checkSetting() | |||
client := getRestyClient() | |||
var result models.GetTrainJobMetricStatisticResult | |||
retry := 0 | |||
sendjob: | |||
res, err := client.R(). | |||
SetAuthToken(TOKEN). | |||
SetResult(&result). | |||
Get(HOST + "/v1/" + setting.ProjectID + urlTrainJob + "/" + jobID + "/versions/" + versionID + "/pod/" + podName + "/metric-statistic") | |||
if err != nil { | |||
return nil, fmt.Errorf("resty GetTrainJobMetricStatistic: %v", err) | |||
} | |||
if res.StatusCode() == http.StatusUnauthorized && retry < 1 { | |||
retry++ | |||
_ = getToken() | |||
goto sendjob | |||
} | |||
if res.StatusCode() != http.StatusOK { | |||
var temp models.ErrorResult | |||
if err = json.Unmarshal([]byte(res.String()), &temp); err != nil { | |||
log.Error("json.Unmarshal failed(%s): %v", res.String(), err.Error()) | |||
return &result, fmt.Errorf("json.Unmarshal failed(%s): %v", res.String(), err.Error()) | |||
} | |||
log.Error("GetTrainJobMetricStatistic failed(%d):%s(%s)", res.StatusCode(), temp.ErrorCode, temp.ErrorMsg) | |||
return &result, fmt.Errorf("GetTrainJobMetricStatistic failed(%d):%s(%s)", res.StatusCode(), temp.ErrorCode, temp.ErrorMsg) | |||
} | |||
if !result.IsSuccess { | |||
log.Error("GetTrainJobMetricStatistic(%s) failed", jobID) | |||
return &result, fmt.Errorf("获取任务资源占用情况失败:%s", result.ErrorMsg) | |||
} | |||
return &result, nil | |||
} |
@@ -564,3 +564,17 @@ func ObsCreateObject(path string) error { | |||
return nil | |||
} | |||
func GetObsLogFileName(prefix string) (string, error) { | |||
input := &obs.ListObjectsInput{} | |||
input.Bucket = setting.Bucket | |||
input.Prefix = prefix | |||
output, err := ObsCli.ListObjects(input) | |||
if err != nil { | |||
log.Error("PutObject failed:", err.Error()) | |||
return "", err | |||
} | |||
return output.Contents[0].Key, nil | |||
} |
@@ -898,6 +898,10 @@ search_dataset = Search Dataset Files | |||
unzip_tooltips = If it has not been decompressed for a long time, please check whether the compressed package has encrypted files or file errors | |||
zip_failed = Decompression failed, please check whether the compressed package is encrypted or contact technical support | |||
dataset_desc = The description should not exceed 1024 characters | |||
unzip_successed=Unzip Successed | |||
unzip_failed=Unzip Failed | |||
unzip_stared=Unzipping | |||
unzip_status=Unzip Status | |||
[repo] | |||
owner = Owner | |||
repo_name = Repository Name | |||
@@ -1141,6 +1145,7 @@ modelarts.infer_job.model_version = Model/Version | |||
modelarts.infer_job.select_model = Select Model | |||
modelarts.infer_job.boot_file_helper=The startup file is the entry file for your program execution and must end in.py.Such as inference.py, main.py, example/inference. Py, case/main.py. | |||
modelarts.infer_job.tooltip = The model has been deleted and cannot be viewed. | |||
modelarts.download_log=Download log file | |||
debug_task_not_created = Debug task has not been created | |||
@@ -1447,7 +1452,8 @@ issues.filter_sort.feweststars = Fewest stars | |||
issues.filter_sort.mostforks = Most forks | |||
issues.filter_sort.fewestforks = Fewest forks | |||
issues.filter_sort.downloadtimes = Most downloaded | |||
issues.filter_sort.moststars = Most star | |||
issues.filter_sort.mostusecount = Most Quote | |||
issues.filter_sort.fewestusecount=Fewest Quote | |||
issues.action_open = Open | |||
issues.action_close = Close | |||
issues.action_label = Label | |||
@@ -903,6 +903,10 @@ search_dataset = 搜索数据集文件 | |||
unzip_tooltips = 如果长时间未解压,请检查压缩包是否有加密文件或者文件错误 | |||
zip_failed = 解压失败,请检查压缩包是否有加密或者联系技术支持人员。 | |||
dataset_desc = 描述字数不超过1024个字符 | |||
unzip_successed=解压成功 | |||
unzip_failed=解压失败 | |||
unzip_stared=解压中 | |||
unzip_status=解压状态 | |||
[repo] | |||
owner=拥有者 | |||
@@ -1151,6 +1155,7 @@ modelarts.infer_job.model_version = 模型/版本 | |||
modelarts.infer_job.select_model = 选择模型 | |||
modelarts.infer_job.boot_file_helper=启动文件是您程序执行的入口文件,必须是以.py结尾的文件。比如inference.py、main.py、example/inference.py、case/main.py。 | |||
modelarts.infer_job.tooltip = 该模型已删除,无法查看。 | |||
modelarts.download_log=下载日志文件 | |||
debug_task_not_created = 未创建过调试任务 | |||
@@ -1453,12 +1458,13 @@ issues.filter_sort.mostcomment=最多评论 | |||
issues.filter_sort.leastcomment=最少评论 | |||
issues.filter_sort.nearduedate=到期日从近到远 | |||
issues.filter_sort.farduedate=到期日从远到近 | |||
issues.filter_sort.moststars=点赞由多到少 | |||
issues.filter_sort.feweststars=点赞由少到多 | |||
issues.filter_sort.mostforks=派生由多到少 | |||
issues.filter_sort.fewestforks=派生由少到多 | |||
issues.filter_sort.downloadtimes=下载次数 | |||
issues.filter_sort.moststars=收藏数量 | |||
issues.filter_sort.mostusecount=最多引用 | |||
issues.filter_sort.fewestusecount=最少引用 | |||
issues.action_open=开启 | |||
issues.action_close=关闭 | |||
issues.action_label=标签 | |||
@@ -61,6 +61,10 @@ func Datasets(ctx *context.Context) { | |||
orderBy = models.SearchOrderByForksReverse | |||
case "fewestforks": | |||
orderBy = models.SearchOrderByForks | |||
case "mostusecount": | |||
orderBy = models.SearchOrderByUseCountReverse | |||
case "fewestusecount": | |||
orderBy = models.SearchOrderByUseCount | |||
default: | |||
ctx.Data["SortType"] = "recentupdate" | |||
orderBy = models.SearchOrderByRecentUpdated | |||
@@ -922,6 +922,7 @@ func RegisterRoutes(m *macaron.Macaron) { | |||
m.Post("/del_version", repo.DelTrainJobVersion) | |||
m.Post("/stop_version", repo.StopTrainJobVersion) | |||
m.Get("/model_list", repo.ModelList) | |||
m.Get("/metric_statistics", repo.TrainJobGetMetricStatistic) | |||
}) | |||
}) | |||
m.Group("/inference-job", func() { | |||
@@ -462,3 +462,46 @@ func ResultList(ctx *context.APIContext) { | |||
"PageIsCloudBrain": true, | |||
}) | |||
} | |||
func TrainJobGetMetricStatistic(ctx *context.APIContext) { | |||
var ( | |||
err error | |||
) | |||
var jobID = ctx.Params(":jobid") | |||
var versionName = ctx.Query("version_name") | |||
result, err := trainJobGetMetricStatistic(jobID, versionName) | |||
if err != nil { | |||
log.Error("trainJobGetMetricStatistic(%s) failed:%v", jobID, err.Error()) | |||
return | |||
} | |||
ctx.JSON(http.StatusOK, map[string]interface{}{ | |||
"JobID": jobID, | |||
"Interval": result.Interval, | |||
"MetricsInfo": result.MetricsInfo, | |||
}) | |||
} | |||
func trainJobGetMetricStatistic(jobID string, versionName string) (*models.GetTrainJobMetricStatisticResult, error) { | |||
task, err := models.GetCloudbrainByJobIDAndVersionName(jobID, versionName) | |||
if err != nil { | |||
log.Error("GetCloudbrainByJobIDAndVersionName(%s) failed:%v", jobID, err.Error()) | |||
return nil, err | |||
} | |||
resultLogFile, err := modelarts.GetTrainJobLogFileNames(jobID, strconv.FormatInt(task.VersionID, 10)) | |||
if err != nil { | |||
log.Error("GetTrainJobLogFileNames(%s) failed:%v", jobID, err.Error()) | |||
return nil, err | |||
} | |||
result, err := modelarts.GetTrainJobMetricStatistic(jobID, strconv.FormatInt(task.VersionID, 10), resultLogFile.LogFileList[0]) | |||
if err != nil { | |||
log.Error("GetTrainJobMetricStatistic(%s) failed:%v", jobID, err.Error()) | |||
return nil, err | |||
} | |||
return result, err | |||
} |
@@ -322,6 +322,10 @@ func ExploreDatasets(ctx *context.Context) { | |||
orderBy = models.SearchOrderByStarsReverse | |||
case "feweststars": | |||
orderBy = models.SearchOrderByStars | |||
case "mostusecount": | |||
orderBy = models.SearchOrderByUseCountReverse | |||
case "fewestusecount": | |||
orderBy = models.SearchOrderByUseCount | |||
case "default": | |||
orderBy = models.SearchOrderByDefault | |||
default: | |||
@@ -1150,6 +1150,7 @@ func CloudBrainDownloadModel(ctx *context.Context) { | |||
ctx.ServerError("PresignedGetURL", err) | |||
return | |||
} | |||
ctx.Resp.Header().Set("Cache-Control", "max-age=0") | |||
http.Redirect(ctx.Resp, ctx.Req.Request, url, http.StatusMovedPermanently) | |||
} | |||
@@ -172,6 +172,10 @@ func DatasetIndex(ctx *context.Context) { | |||
for _, attachment := range pageAttachments { | |||
uploader, _ := models.GetUserByID(attachment.UploaderID) | |||
attachment.Uploader = uploader | |||
if !strings.HasSuffix(attachment.Name, ".zip") { | |||
attachment.DecompressState = 3 //非zip文件 | |||
} | |||
} | |||
ctx.Data["Page"] = pager | |||
@@ -2251,7 +2251,6 @@ func ModelDownload(ctx *context.Context) { | |||
versionName := ctx.Query("version_name") | |||
parentDir := ctx.Query("parent_dir") | |||
fileName := ctx.Query("file_name") | |||
log.Info("DownloadSingleModelFile start.") | |||
task, err := models.GetCloudbrainByJobIDAndVersionName(jobID, versionName) | |||
if err != nil { | |||
log.Error("GetCloudbrainByJobID(%s) failed:%v", task.JobName, err.Error()) | |||
@@ -2259,7 +2258,6 @@ func ModelDownload(ctx *context.Context) { | |||
} | |||
path := strings.TrimPrefix(path.Join(setting.TrainJobModelPath, task.JobName, setting.OutPutPath, versionName, parentDir, fileName), "/") | |||
log.Info("Download path is:%s", path) | |||
url, err := storage.GetObsCreateSignedUrlByBucketAndKey(setting.Bucket, path) | |||
if err != nil { | |||
@@ -2267,6 +2265,7 @@ func ModelDownload(ctx *context.Context) { | |||
ctx.ServerError("GetObsCreateSignedUrl", err) | |||
return | |||
} | |||
ctx.Resp.Header().Set("Cache-Control", "max-age=0") | |||
http.Redirect(ctx.Resp, ctx.Req.Request, url, http.StatusMovedPermanently) | |||
} | |||
@@ -2278,13 +2277,11 @@ func ResultDownload(ctx *context.Context) { | |||
versionName := ctx.Query("version_name") | |||
parentDir := ctx.Query("parent_dir") | |||
fileName := ctx.Query("file_name") | |||
log.Info("DownloadResult start.") | |||
task := ctx.Cloudbrain | |||
if err != nil { | |||
ctx.Data["error"] = err.Error() | |||
} | |||
path := strings.TrimPrefix(path.Join(setting.TrainJobModelPath, task.JobName, "result/", versionName, parentDir, fileName), "/") | |||
log.Info("Download path is:%s", path) | |||
url, err := storage.GetObsCreateSignedUrlByBucketAndKey(setting.Bucket, path) | |||
if err != nil { | |||
@@ -2292,6 +2289,7 @@ func ResultDownload(ctx *context.Context) { | |||
ctx.ServerError("GetObsCreateSignedUrl", err) | |||
return | |||
} | |||
ctx.Resp.Header().Set("Cache-Control", "max-age=0") | |||
http.Redirect(ctx.Resp, ctx.Req.Request, url, http.StatusMovedPermanently) | |||
} | |||
func DeleteJobStorage(jobName string) error { | |||
@@ -2390,3 +2388,35 @@ func SetJobCount(ctx *context.Context) { | |||
} | |||
ctx.Data["jobCount"] = jobCount | |||
} | |||
func TrainJobDownloadLogFile(ctx *context.Context) { | |||
var ( | |||
err error | |||
) | |||
var jobID = ctx.Params(":jobid") | |||
versionName := ctx.Query("version_name") | |||
task, err := models.GetCloudbrainByJobIDAndVersionName(jobID, versionName) | |||
if err != nil { | |||
log.Error("GetCloudbrainByJobIDAndVersionName(%s) failed:%v", task.JobName, err.Error(), ctx.Data["msgID"]) | |||
ctx.ServerError("GetCloudbrainByJobIDAndVersionName", err) | |||
return | |||
} | |||
prefix := strings.TrimPrefix(path.Join(setting.TrainJobModelPath, task.JobName, modelarts.LogPath, versionName), "/") + "/job" | |||
key, err := storage.GetObsLogFileName(prefix) | |||
if err != nil { | |||
log.Error("GetObsLogFileName(%s) failed:%v", jobID, err.Error(), ctx.Data["msgID"]) | |||
ctx.ServerError("GetObsLogFileName", err) | |||
return | |||
} | |||
url, err := storage.GetObsCreateSignedUrlByBucketAndKey(setting.Bucket, key) | |||
if err != nil { | |||
log.Error("GetObsCreateSignedUrlByBucketAndKey failed: %v", err.Error(), ctx.Data["msgID"]) | |||
ctx.ServerError("GetObsCreateSignedUrlByBucketAndKey", err) | |||
return | |||
} | |||
ctx.Resp.Header().Set("Cache-Control", "max-age=0") | |||
http.Redirect(ctx.Resp, ctx.Req.Request, url, http.StatusMovedPermanently) | |||
} |
@@ -1136,6 +1136,7 @@ func RegisterRoutes(m *macaron.Macaron) { | |||
m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.TrainJobStop) | |||
m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.TrainJobDel) | |||
m.Get("/model_download", cloudbrain.AdminOrJobCreaterRightForTrain, repo.ModelDownload) | |||
m.Get("/download_log_file", cloudbrain.AdminOrJobCreaterRightForTrain, repo.TrainJobDownloadLogFile) | |||
m.Get("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, repo.TrainJobNewVersion) | |||
m.Post("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreateVersion) | |||
}) | |||
@@ -1,133 +1,164 @@ | |||
{{template "base/head" .}} | |||
<style> | |||
.mg-b-1{ | |||
margin-bottom: 1rem; | |||
} | |||
.mg-b-2{ | |||
margin-bottom: 2rem; | |||
} | |||
.mg-l-1{ | |||
margin-left: 1rem; | |||
} | |||
.text-gray-400 { | |||
--tw-text-opacity: 1; | |||
color: rgba(156,163,175,var(--tw-text-opacity)); | |||
} | |||
.text-sm { | |||
font-size: .875rem; | |||
line-height: 1.25rem; | |||
} | |||
.underline { | |||
text-decoration: underline; | |||
} | |||
.flex{ | |||
display: flex; | |||
} | |||
.font-medium{ | |||
font-weight: 500; | |||
} | |||
.flex-wrap{ | |||
flex-wrap: wrap; | |||
} | |||
.tag { | |||
background-image: linear-gradient(to bottom,var(--tw-gradient-stops)); | |||
border-color: transparent; | |||
border-radius: 0.5rem; | |||
border-width: 1px; | |||
font-size: .875rem; | |||
line-height: 1.25rem; | |||
overflow: hidden; | |||
text-overflow: ellipsis; | |||
white-space: nowrap; | |||
} | |||
.tag-red { | |||
--tw-gradient-from: #fef2f2; | |||
--tw-gradient-stops: var(--tw-gradient-from),var(--tw-gradient-to,hsla(0,86%,97%,0)); | |||
--tw-gradient-to: #fef2f2; | |||
--tw-text-opacity: 1; | |||
color: rgba(153,27,27,var(--tw-text-opacity)); | |||
} | |||
.tag-purple { | |||
--tw-gradient-from: #f5f3ff; | |||
--tw-gradient-stops: var(--tw-gradient-from),var(--tw-gradient-to,rgba(245,243,255,0)); | |||
--tw-gradient-to: #f5f3ff; | |||
--tw-text-opacity: 1; | |||
color: rgba(91,33,182,var(--tw-text-opacity)); | |||
} | |||
.tag-blue { | |||
--tw-gradient-from: #eff6ff; | |||
--tw-gradient-stops: var(--tw-gradient-from),var(--tw-gradient-to,rgba(239,246,255,0)); | |||
--tw-gradient-to: #eff6ff; | |||
--tw-text-opacity: 1; | |||
color: rgba(30,64,175,var(--tw-text-opacity)); | |||
} | |||
.tag.inactive { | |||
filter: grayscale(100%); | |||
opacity: .5; | |||
} | |||
.tag.tag-active{ | |||
background-color: #0366d6; | |||
color: #ffffff; | |||
} | |||
.tag-gray{ | |||
background-color: #f8f9fa; | |||
color: #415058; | |||
} | |||
.tag { | |||
align-items: center; | |||
display: inline-flex; | |||
flex: none; | |||
height: 2rem; | |||
margin-bottom: 0.35rem; | |||
margin-right: 0.35rem; | |||
max-width: 100%; | |||
} | |||
.tag>span { | |||
padding: 0.75rem; | |||
font-size: 14px; | |||
} | |||
.repo_dataset_header{ | |||
font-size: 12px; | |||
color: #3291F8; | |||
} | |||
.heart-stroke{ | |||
stroke: #666; | |||
stroke-width: 2; | |||
fill: #fff | |||
} | |||
.stars_active{ | |||
fill: #FA8C16 !important; | |||
stroke:#FA8C16 !important | |||
} | |||
.mg-b-1 { | |||
margin-bottom: 1rem; | |||
} | |||
.mg-b-2 { | |||
margin-bottom: 2rem; | |||
} | |||
.mg-l-1 { | |||
margin-left: 1rem; | |||
} | |||
.text-gray-400 { | |||
--tw-text-opacity: 1; | |||
color: rgba(156, 163, 175, var(--tw-text-opacity)); | |||
} | |||
.text-sm { | |||
font-size: .875rem; | |||
line-height: 1.25rem; | |||
} | |||
.underline { | |||
text-decoration: underline; | |||
} | |||
.flex { | |||
display: flex; | |||
} | |||
.font-medium { | |||
font-weight: 500; | |||
} | |||
.flex-wrap { | |||
flex-wrap: wrap; | |||
} | |||
.tag { | |||
background-image: linear-gradient(to bottom, var(--tw-gradient-stops)); | |||
border-color: transparent; | |||
border-radius: 0.5rem; | |||
border-width: 1px; | |||
font-size: .875rem; | |||
line-height: 1.25rem; | |||
overflow: hidden; | |||
text-overflow: ellipsis; | |||
white-space: nowrap; | |||
} | |||
.tag-red { | |||
--tw-gradient-from: #fef2f2; | |||
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, hsla(0, 86%, 97%, 0)); | |||
--tw-gradient-to: #fef2f2; | |||
--tw-text-opacity: 1; | |||
color: rgba(153, 27, 27, var(--tw-text-opacity)); | |||
} | |||
.tag-purple { | |||
--tw-gradient-from: #f5f3ff; | |||
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(245, 243, 255, 0)); | |||
--tw-gradient-to: #f5f3ff; | |||
--tw-text-opacity: 1; | |||
color: rgba(91, 33, 182, var(--tw-text-opacity)); | |||
} | |||
.tag-blue { | |||
--tw-gradient-from: #eff6ff; | |||
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(239, 246, 255, 0)); | |||
--tw-gradient-to: #eff6ff; | |||
--tw-text-opacity: 1; | |||
color: rgba(30, 64, 175, var(--tw-text-opacity)); | |||
} | |||
.tag.inactive { | |||
filter: grayscale(100%); | |||
opacity: .5; | |||
} | |||
.tag.tag-active { | |||
background-color: #0366d6; | |||
color: #ffffff; | |||
} | |||
.tag-gray { | |||
background-color: #f8f9fa; | |||
color: #415058; | |||
} | |||
.tag { | |||
align-items: center; | |||
display: inline-flex; | |||
flex: none; | |||
height: 2rem; | |||
margin-bottom: 0.35rem; | |||
margin-right: 0.35rem; | |||
max-width: 100%; | |||
} | |||
.tag>span { | |||
padding: 0.75rem; | |||
font-size: 14px; | |||
} | |||
.repo_dataset_header { | |||
font-size: 12px; | |||
color: #3291F8; | |||
} | |||
.heart-stroke { | |||
stroke: #FA8C16; | |||
stroke-width: 2; | |||
fill: #fff | |||
} | |||
.stars_active { | |||
fill: #FA8C16 !important; | |||
stroke: #FA8C16 !important | |||
} | |||
</style> | |||
<div class="explore repositories"> | |||
{{template "explore/dataset_search" .}} | |||
<div> | |||
<div class="ui container"> | |||
<div class="ui grid"> | |||
{{template "explore/dataset_left" .}} | |||
<div class="ui sixteen wide mobile sixteen wide tablet twelve wide computer column"> | |||
<div class="ui row"> | |||
<h2 class="ui left floated medium header"> | |||
{{.i18n.Tr "datasets"}} | |||
{{.i18n.Tr "datasets"}} | |||
</h2> | |||
<div class="ui right floated secondary filter menu"> | |||
<!-- Sort --> | |||
<div class="ui right dropdown type jump item"> | |||
<span class="text"> | |||
{{.i18n.Tr "repo.issues.filter_sort"}} | |||
<i class="dropdown icon"></i> | |||
{{.i18n.Tr "repo.issues.filter_sort"}} | |||
<i class="dropdown icon"></i> | |||
</span> | |||
<div class="menu"> | |||
<a class="{{if eq .SortType "default"}}active{{end}} item" href="{{$.Link}}?sort=default&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.default"}}</a> | |||
<a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a> | |||
<a class="{{if eq .SortType "oldest"}}active{{end}} item" href="{{$.Link}}?sort=oldest&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a> | |||
<a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a> | |||
<a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a> | |||
<a class="{{if eq .SortType "downloadtimes"}}active{{end}} item" href="{{$.Link}}?sort=downloadtimes&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.downloadtimes"}}</a> | |||
<a class="{{if eq .SortType "moststars"}}active{{end}} item" href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a> | |||
<a class="{{if eq .SortType "default"}}active{{end}} item" | |||
href="{{$.Link}}?sort=default&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.default"}}</a> | |||
<a class="{{if eq .SortType "newest"}}active{{end}} item" | |||
href="{{$.Link}}?sort=newest&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a> | |||
<a class="{{if eq .SortType "oldest"}}active{{end}} item" | |||
href="{{$.Link}}?sort=oldest&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a> | |||
<a class="{{if eq .SortType "recentupdate"}}active{{end}} item" | |||
href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a> | |||
<a class="{{if eq .SortType "leastupdate"}}active{{end}} item" | |||
href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a> | |||
<a class="{{if eq .SortType "downloadtimes"}}active{{end}} item" | |||
href="{{$.Link}}?sort=downloadtimes&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.downloadtimes"}}</a> | |||
<a class="{{if eq .SortType "moststars"}}active{{end}} item" | |||
href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a> | |||
<a class="{{if eq .SortType "mostusecount"}}active{{end}} item" | |||
href="{{$.Link}}?sort=mostusecount&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.mostusecount"}}</a> | |||
<a class="{{if eq .SortType "fewestusecount"}}active{{end}} item" | |||
href="{{$.Link}}?sort=fewestusecount&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.fewestusecount"}}</a> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -141,85 +172,114 @@ | |||
{{end}} | |||
<div class="ui row" style="clear: both;" id="dataset-base"> | |||
<el-checkbox v-model="checked" style="padding: 0.5rem 1rem;" @change="handleCheckedChange" >仅显示平台推荐</el-checkbox> | |||
<el-checkbox v-model="checked" style="padding: 0.5rem 1rem;" @change="handleCheckedChange"> | |||
仅显示平台推荐</el-checkbox> | |||
<div class="ui two cards"> | |||
{{range $k, $v :=.Datasets}} | |||
<div class="ui card" @click="gotoDataset('{{.Repo.Link}}/datasets')" style="cursor: pointer;box-shadow: 0px 4px 4px 0px rgba(232,232,232,0.6);border: 1px solid rgba(232, 232, 232, 1);"> | |||
<div class="ui card" @click="gotoDataset('{{.Repo.Link}}/datasets')" | |||
style="cursor: pointer;box-shadow: 0px 4px 4px 0px rgba(232,232,232,0.6);border: 1px solid rgba(232, 232, 232, 1);"> | |||
<div class="content" style="border-bottom: none;"> | |||
<div class="repo_dataset_header" style="display: flex;align-items: center;justify-content: space-between;"> | |||
<a href="{{.Repo.Link}}/datasets" style="font-size: 12px;color: #3291F8;height: 24px;">{{.Repo.OwnerName}} / {{.Repo.Alias}}</a> | |||
<div | |||
style="font-size: 16px;color:#0366D6;font-family: SourceHanSansSC-medium;height: 34px;font-weight: bold;display: flex;align-items: center"> | |||
<span title="{{.Title}}" class="nowrap" | |||
style="display: inline-block;">{{.Title}}</span>{{if .Recommend}}<img | |||
src="/img/jian.svg" style="margin-left: 0.5rem;">{{end}} | |||
{{if $.IsSigned}} | |||
<span style="display: flex;align-items: center;justify-content: flex-end;cursor: pointer;" @click.stop="postSquareStar({{.ID}},'{{.Repo.Link}}/datasets',{{$k}})"> | |||
<span style="line-height: 1;color: #101010;margin-bottom: -2px;"><i class="ri-download-line" style="font-size: 1.3em;"></i></span> | |||
<span style="line-height: 1;color: #101010;margin-right: 0.6rem;">{{.DownloadTimes}}</span> | |||
<span | |||
style="display: flex;align-items: center;justify-content: flex-end;cursor: pointer;font-size: 12px;font-weight: normal;flex: 1;" | |||
@click.stop="postSquareStar({{.ID}},'{{.Repo.Link}}/datasets',{{$k}})"> | |||
<div style="line-height: 1;margin-right: 4px;margin-bottom: -2px;"> | |||
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke" :class='{stars_active:starActives[{{$k}}]}'><path d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"></path></svg> | |||
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32" | |||
class="heart-stroke" :class='{stars_active:starActives[{{$k}}]}'> | |||
<path | |||
d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"> | |||
</path> | |||
</svg> | |||
</div> | |||
<span style="line-height: 1;color: #101010;">${starItems[{{$k}}]}</span> | |||
</span> | |||
{{else}} | |||
<span style="display: flex;align-items: center;justify-content: flex-end;cursor: pointer;"> | |||
<span style="line-height: 1;color: #101010;margin-bottom: -2px;"><i class="ri-download-line" style="font-size: 1.3em;"></i></span> | |||
<span style="line-height: 1;color: #101010;margin-right: 0.6rem;">{{.DownloadTimes}}</span> | |||
<span | |||
style="display: flex;align-items: center;justify-content: flex-end;cursor: pointer;font-size: 12px;font-weight: normal;flex: 1;"> | |||
<div style="line-height: 1;margin-right: 4px;margin-bottom: -2px;"> | |||
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke" :class='{stars_active:starActives[{{$k}}]}'><path d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"></path></svg> | |||
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32" | |||
class="heart-stroke" :class='{stars_active:starActives[{{$k}}]}'> | |||
<path | |||
d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"> | |||
</path> | |||
</svg> | |||
</div> | |||
<span style="line-height: 1;color: #101010;">${starItems[{{$k}}]}</span> | |||
</span> | |||
{{end}} | |||
</div> | |||
<div style="font-size: 16px;color:#0366D6;font-family: SourceHanSansSC-medium;height: 27px;font-weight: bold;display: flex;align-items: center"><span title="{{.Title}}" class="nowrap" style="display: inline-block;">{{.Title}}</span>{{if .Recommend}}<img src="/img/jian.svg" style="margin-left: 0.5rem;">{{end}}</div> | |||
{{if or (.Category) (.Task) (.License)}} | |||
<div style="font-size: 12px;margin-top: 5px;"> | |||
{{if .Category}} | |||
{{$category := .Category}} | |||
<a class="ui repo-topic label topic" href="{{$.Link}}?sort={{$.SortType}}&q={{$.Keyword}}&tab={{$.TabName}}&category={{.Category}}&task={{$.Task}}&license={{$.License}}">{{$.i18n.Tr (printf "dataset.category.%s" $category)}}</a> | |||
<a class="ui repo-topic label topic" | |||
href="{{$.Link}}?sort={{$.SortType}}&q={{$.Keyword}}&tab={{$.TabName}}&category={{.Category}}&task={{$.Task}}&license={{$.License}}">{{$.i18n.Tr (printf "dataset.category.%s" $category)}}</a> | |||
{{end}} | |||
{{if .Task}} | |||
{{$task := .Task}} | |||
<a class="ui repo-topic label topic" href="{{$.Link}}?sort={{$.SortType}}&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{.Task}}&license={{$.License}}">{{$.i18n.Tr (printf "dataset.task.%s" $task)}}</a> | |||
<a class="ui repo-topic label topic" | |||
href="{{$.Link}}?sort={{$.SortType}}&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{.Task}}&license={{$.License}}">{{$.i18n.Tr (printf "dataset.task.%s" $task)}}</a> | |||
{{end}} | |||
{{if .License}} | |||
<a class="ui repo-topic label topic" href="{{$.Link}}?sort={{$.SortType}}&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{.License}}">{{.License}}</a> | |||
<a class="ui repo-topic label topic" | |||
href="{{$.Link}}?sort={{$.SortType}}&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{.License}}">{{.License}}</a> | |||
{{end}} | |||
</div> | |||
{{end}} | |||
<div class="description" style="-webkit-box-orient: vertical;-webkit-line-clamp: 2;display: -webkit-box;overflow: hidden;color:#999999;font-size: 14px;margin-top: 10px;"> | |||
<div class="description" | |||
style="-webkit-box-orient: vertical;-webkit-line-clamp: 2;display: -webkit-box;overflow: hidden;color:#999999;font-size: 14px;margin-top: 10px;"> | |||
<p>{{.Description}}</p> | |||
</div> | |||
</div> | |||
<div class="extra content" style="border-top: none !important;"> | |||
<div style="display: flex;align-items: center;"> | |||
{{if eq .UserID 0}} | |||
<a href="{{AppSubUrl}}/{{.Repo.OwnerName}}" title="{{.Repo.OwnerName}}"> | |||
<img class="ui avatar image" style="width: 22px;height:22px;" src="/user/avatar/{{.Repo.OwnerName}}/-1"> | |||
<img class="ui avatar image" style="width: 22px;height:22px;" | |||
src="/user/avatar/{{.Repo.OwnerName}}/-1"> | |||
</a> | |||
{{else}} | |||
<a href="{{AppSubUrl}}/{{.User.Name}}" title="{{.User.Name}}"> | |||
<img class="ui avatar image" style="width: 22px;height:22px;" src="/user/avatar/{{.User.Name}}/-1"> | |||
<img class="ui avatar image" style="width: 22px;height:22px;" | |||
src="/user/avatar/{{.User.Name}}/-1"> | |||
</a> | |||
{{end}} | |||
<span style="color: #999999;font-size: 14px;;">创建于:{{TimeSinceUnix1 .CreatedUnix}}</span> | |||
<span | |||
style="color: #999999;font-size: 12px;margin-left: 0.5rem;">{{TimeSinceUnixShort .CreatedUnix}}</span> | |||
<span | |||
style="display: flex;align-items: center;justify-content: center;margin: 0 1rem;"> | |||
<i class="ri-link"></i> | |||
<span | |||
style="color: #101010; font-size: 12px;margin-left: 0.2rem;">{{.UseCount}}</span> | |||
</span> | |||
<span style=" display: flex;align-items: center;justify-content: center;"> | |||
<i class="ri-download-line"></i> | |||
<span | |||
style="color: #101010;font-size: 12px;margin-left: 0.2rem;">{{.DownloadTimes}}</span> | |||
</span> | |||
</div> | |||
</div> | |||
</div> | |||
{{end}} | |||
</div> | |||
</div> | |||
<div id="app" style="margin-top: 2rem;"> | |||
<div class="center"> | |||
<el-pagination | |||
background | |||
@current-change="handleCurrentChange" | |||
:current-page="page" | |||
:page-sizes="[30]" | |||
:page-size="30" | |||
layout="total, sizes, prev, pager, next, jumper" | |||
:total="{{.Page.Paginater.Total}}"> | |||
<el-pagination background @current-change="handleCurrentChange" :current-page="page" | |||
:page-sizes="[30]" :page-size="30" layout="total, sizes, prev, pager, next, jumper" | |||
:total="{{.Page.Paginater.Total}}"> | |||
</el-pagination> | |||
</div> | |||
</div> | |||
@@ -105,7 +105,7 @@ | |||
} | |||
.heart-stroke { | |||
stroke: #666; | |||
stroke: #FA8C16; | |||
stroke-width: 2; | |||
fill: #fff | |||
} | |||
@@ -148,7 +148,7 @@ | |||
<div class="ui mobile reversed stackable grid"> | |||
<div class="row"> | |||
<div class="column thirteen wide"> | |||
<h2>{{.dataset.Title}}</h2> | |||
<h2 class="nowrap">{{.dataset.Title}}</h2> | |||
</div> | |||
<div class="column three wide right aligned"> | |||
<span style="display: flex;align-items: center;justify-content: flex-end;height: 36px;"> | |||
@@ -276,27 +276,34 @@ | |||
<!-- 数据集名称 --> | |||
<div class="four wide column" style="width: 24% !important;display: flex;align-items: center;"> | |||
{{if .Description}} | |||
<el-tooltip class="item" effect="dark" placement="top" popper-class="diy-popper"> | |||
<div slot="content">{{.Description}}</br><span><i | |||
class="ri-download-line"></i>{{$.i18n.Tr "dataset.download"}}:{{.DownloadCount}}</span></div> | |||
<a class="dataset_title title" href="{{.DownloadURL}}" title="{{.Name}}" style="border: none;"> | |||
{{.Name}} | |||
</a> | |||
</el-tooltip> | |||
{{else}} | |||
<el-tooltip class="item" effect="dark" placement="top" popper-class="diy-popper"> | |||
<div slot="content"><span><i | |||
class="ri-download-line"></i>{{$.i18n.Tr "dataset.download"}}:{{.DownloadCount}}</span></div> | |||
<a class="dataset_title title" href="{{.DownloadURL}}" title="{{.Name}}" style="border: none;"> | |||
{{.Name}} | |||
</a> | |||
<div slot="content"><span class="wrap"> | |||
{{if ne .DecompressState 3}}{{$.i18n.Tr "dataset.unzip_status"}}:{{if eq .DecompressState 1}}{{$.i18n.Tr "dataset.unzip_successed"}}{{else if eq .DecompressState 0}}{{$.i18n.Tr "dataset.unzip_stared"}}{{else}}{{$.i18n.Tr "dataset.unzip_failed"}}{{end}} | |||
{{end}}<i | |||
class="ri-download-line"></i>{{$.i18n.Tr "dataset.download"}}:{{.DownloadCount}} | |||
{{if .Description}} {{$.i18n.Tr "dataset.description"}}:{{.Description}}{{end}}</span> | |||
</div> | |||
<div style="border: none;display: flex;align-items: center;max-width: 100%;"> | |||
{{if eq .DecompressState 1}} | |||
<i class="ri-folder-open-line" style="color: #5bb973;" | |||
title='{{$.i18n.Tr "dataset.unzip_successed"}}'></i> | |||
{{else if eq .DecompressState 0}} | |||
<i class="ri-folder-chart-2-line" style="color: #888888;" | |||
title='{{$.i18n.Tr "dataset.unzip_stared"}}'></i> | |||
{{else if eq .DecompressState 2}} | |||
<i class="ri-folder-forbid-line" style="color: #101010;" | |||
title='{{$.i18n.Tr "dataset.unzip_failed"}}'></i> | |||
{{else}} | |||
<i class="ri-folder-forbid-line" style="visibility: hidden;" | |||
title='{{$.i18n.Tr "dataset.unzip_failed"}}'></i> | |||
{{end}} | |||
<a class="dataset_title title" href="{{.DownloadURL}}" title="{{.Name}}"> | |||
{{.Name}} | |||
</a> | |||
<i class="ri-lock-2-line" style="color: #fa8c16;" v-if="privates[{{$k}}]"></i> | |||
</div> | |||
</el-tooltip> | |||
{{end}} | |||
<i class="ri-lock-2-line" style="color: #fa8c16;" v-if="privates[{{$k}}]"></i> | |||
<!-- <i class="COMPLETED" v-if="zipStatus[{{$k}}]==1"></i> | |||
<i class="WAITING" v-if="zipStatus[{{$k}}]==2"></i> | |||
<i class="FAILED" v-if="zipStatus[{{$k}}]==3"></i> --> | |||
</div> | |||
<div class="one wide column text center" style="width: 7.25% !important;"> | |||
{{.Size | FileSize}} | |||
@@ -322,18 +329,6 @@ | |||
{{.CreatedUnix | TimeSinceUnix1}} | |||
</div> | |||
<div class="four wide column text right"> | |||
<!-- <el-button type="text">下载</el-button> | |||
<el-button type="text">预览</el-button> | |||
<el-button type="text">标注</el-button> | |||
<el-button type="text"> | |||
<el-popover | |||
placement="right" | |||
width="400" | |||
trigger="click"> | |||
<span>asdasd</span> | |||
<el-button slot="reference" type="text"><i class="ri-more-line"></i></el-button> | |||
</el-popover> | |||
</el-button> --> | |||
<div class="ui compact buttons"> | |||
<a class="ui basic blue button" href="{{.DownloadURL}}">{{$.i18n.Tr "dataset.download"}}</a> | |||
@@ -350,11 +345,6 @@ | |||
@click="setPrivate('{{.UUID}}',true,{{$k}})" | |||
v-else="privates[{{$k}}]">{{$.i18n.Tr "dataset.set_private"}}</span> | |||
{{end}} | |||
<!-- {{if $.CanRead}} | |||
<a class="ui basic blue button" href="datasets/label/{{.UUID}}?type={{$.Type}}" data-tooltip='{{$.i18n.Tr "dataset.create_label_task"}}'>标注</a> | |||
{{else}} | |||
<a class="ui basic disabled button">标注</a> | |||
{{end}} --> | |||
<a class="ui basic blue button"> | |||
<el-dropdown size="medium"> | |||
<span class="el-dropdown-link"> | |||
@@ -363,7 +353,6 @@ | |||
<el-dropdown-menu slot="dropdown"> | |||
<el-dropdown-item @click.native="copyUrl('{{.DownloadURL}}')">{{$.i18n.Tr "dataset.copy_url"}} | |||
</el-dropdown-item> | |||
<!-- <el-dropdown-item class="clipboard" data-clipboard-text="{{.Md5}}" data-clipboard-action="copy">{{$.i18n.Tr "dataset.copy_md5"}}</el-dropdown-item>--> | |||
{{if and ($.CanWrite) (eq .DecompressState 1) }} | |||
<el-dropdown-item @click.native="gotoAnnotate('{{$.RepoLink}}','{{.UUID}}',{{.Type}})"> | |||
{{$.i18n.Tr "dataset.annotation"}}</el-dropdown-item> | |||
@@ -177,6 +177,12 @@ | |||
border: 1px solid #dfe1e6; | |||
} | |||
.ti-download-file { | |||
display: flex; | |||
align-items: center; | |||
margin: 0.5rem 0; | |||
} | |||
.disabled { | |||
cursor: default; | |||
pointer-events: none; | |||
@@ -220,6 +226,7 @@ | |||
<div class="active section">{{.displayJobName}}</div> | |||
</div> | |||
</h4> | |||
{{range $k ,$v := .version_list_task}} | |||
<div class="ui accordion border-according" id="accordion{{.VersionName}}" | |||
data-repopath="{{$.RepoRelPath}}/modelarts/train-job" data-jobid="{{.JobID}}" | |||
@@ -305,6 +312,7 @@ | |||
data-tab="first{{$k}}">{{$.i18n.Tr "repo.modelarts.train_job.config"}}</a> | |||
<a class="item log_bottom" data-tab="second{{$k}}" | |||
data-version="{{.VersionName}}">{{$.i18n.Tr "repo.modelarts.log"}}</a> | |||
<a class="item metric_chart" data-tab="four{{$k}}" data-version="{{.VersionName}}">资源占用情况</a> | |||
<a class="item" data-tab="third{{$k}}" | |||
onclick="loadModelFile({{.VersionName}},'','','init')">{{$.i18n.Tr "repo.model_download"}}</a> | |||
</div> | |||
@@ -478,7 +486,17 @@ | |||
</div> | |||
</div> | |||
<div class="ui tab" data-tab="second{{$k}}"> | |||
<div style="position: relative;"> | |||
<div> | |||
<a class='{{if eq .Status "KILLED" "FAILED" "START_FAILED" "STOPPED" "COMPLETED"}}ti-download-file{{else}}disabled{{end}}' | |||
href="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/download_log_file?version_name={{.VersionName}}"> | |||
<i class="ri-download-cloud-2-line"></i> | |||
<span style="margin-left: 0.3rem;">{{$.i18n.Tr "repo.modelarts.download_log"}}</span> | |||
</a> | |||
</div> | |||
<div | |||
style="position: relative;border: 1px solid rgba(0,0,0,.2);padding: 0 10px;margin-top: 10px;"> | |||
<span> | |||
<a title="滚动到顶部" style="position: absolute; right: -32px;cursor: pointer;" | |||
class="log_top" data-version="{{.VersionName}}"><i class="icon-to-top"></i></a> | |||
@@ -501,6 +519,13 @@ | |||
</div> | |||
</div> | |||
<div class="ui tab" data-tab="four{{$k}}" style="position: relative;"> | |||
<i class="ri-refresh-line metric_chart" | |||
style="position: absolute;right: 25%;color:#3291f8;z-index:99;cursor: pointer;" | |||
data-version="{{.VersionName}}"></i> | |||
<div id="metric-{{.VersionName}}" style="height: 260px;width: 870px;"> | |||
</div> | |||
</div> | |||
<div class="ui tab" data-tab="third{{$k}}"> | |||
<input type="hidden" name="model{{.VersionName}}" value="-1"> | |||
<input type="hidden" name="modelback{{.VersionName}}" value="-1"> | |||
@@ -5070,3 +5070,100 @@ function initcreateRepo() { | |||
} | |||
initcreateRepo() | |||
function initChartsNpu() { | |||
const url = window.location.href | |||
const urlArr = url.split('/') | |||
let userName = urlArr.slice(-5)[0] | |||
let repoPath = urlArr.slice(-4)[0] | |||
let jobID = urlArr.slice(-1)[0] | |||
let options = { | |||
legend: { | |||
data: [] | |||
}, | |||
grid: { | |||
top: '30%', | |||
bottom: '2%', | |||
containLabel: true | |||
}, | |||
tooltip: { | |||
trigger: 'axis', | |||
backgroundColor: 'rgb(51, 56, 84)', | |||
borderColor: 'rgb(51, 51, 51)', | |||
borderWidth: 0, | |||
textStyle: { | |||
color: '#fff' | |||
}, | |||
axisPointer: { | |||
type: 'line' | |||
} | |||
}, | |||
xAxis: { | |||
type: 'category', | |||
data: [], | |||
boundaryGap: false, | |||
axisLabel: { | |||
interval: 'auto' | |||
}, | |||
name: '时间(min)' | |||
}, | |||
yAxis: { | |||
min: 0, | |||
max: 100, | |||
show: true, | |||
name: '占有率(%)', | |||
axisLine: { | |||
show: true | |||
}, | |||
axisTick: { show: true } | |||
}, | |||
series: [] | |||
}; | |||
$('.metric_chart').click(function (e) { | |||
let versionName = $(this).data('version') | |||
console.log("11111", versionName) | |||
let myCharts = echarts.init(document.getElementById(`metric-${versionName}`)) | |||
$.get(`${window.config.AppSubUrl}/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/metric_statistics?version_name=${versionName}&statistic_type=each`, (res) => { | |||
let filterDta = res.MetricsInfo.filter((item) => { | |||
return !(['recvBytesRate', 'diskWriteRate', 'sendBytesRate', 'diskReadRate'].includes(item.metric)) | |||
}) | |||
let legenData = filterDta.map((item) => { | |||
return item.metric | |||
}) | |||
let seriesData = filterDta.map((item) => { | |||
let seriesOption = { | |||
name: item.metric, | |||
type: 'line', | |||
symbol: 'circle', | |||
symbolSize: 10, | |||
smooth: true, | |||
showSymbol: false, | |||
lineStyle: { | |||
width: 2, | |||
shadowColor: 'rgba(0,0,0,0.3)', | |||
shadowBlur: 10, | |||
shadowOffsetY: 8 | |||
}, | |||
data: item.value | |||
} | |||
return seriesOption | |||
}) | |||
let xLength = res.MetricsInfo[0].value.length | |||
console.log(legenData) | |||
options.xAxis.data = Array.from({ length: xLength }, (_, index) => index + 1) | |||
options.legend.data = legenData | |||
options.series = seriesData | |||
options && myCharts.setOption(options); | |||
}) | |||
options && myCharts.setOption(options); | |||
}) | |||
} | |||
initChartsNpu() |