From 9e5bc3c86a68807cc869a4f54073adc684cbd042 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Tue, 15 Feb 2022 10:16:48 +0800 Subject: [PATCH 01/24] s3 download link --- models/attachment.go | 13 +++++++++++++ modules/structs/attachment.go | 7 ++++--- templates/repo/datasets/dataset_list.tmpl | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) mode change 100644 => 100755 modules/structs/attachment.go diff --git a/models/attachment.go b/models/attachment.go index fd1df9e43..715cd0a90 100755 --- a/models/attachment.go +++ b/models/attachment.go @@ -88,6 +88,7 @@ func (a *Attachment) APIFormat() *api.Attachment { Size: a.Size, UUID: a.UUID, DownloadURL: a.DownloadURL(), + S3DownloadURL: a.S3DownloadURL(), } } @@ -96,6 +97,18 @@ func (a *Attachment) DownloadURL() string { return fmt.Sprintf("%sattachments/%s", setting.AppURL, a.UUID) } +// DownloadURL returns the download url of the attached file +func (a *Attachment) S3DownloadURL() string { + url := "" + if a.Type == TypeCloudBrainOne { + url, _ = storage.Attachments.PresignedGetURL(setting.Attachment.Minio.BasePath+AttachmentRelativePath(a.UUID), a.Name) + } else if a.Type == TypeCloudBrainTwo { + + } + + return url +} + // AttachmentRelativePath returns the relative path func AttachmentRelativePath(uuid string) string { return path.Join(uuid[0:1], uuid[1:2], uuid) diff --git a/modules/structs/attachment.go b/modules/structs/attachment.go old mode 100644 new mode 100755 index 7becd9433..0f3c2ed6a --- a/modules/structs/attachment.go +++ b/modules/structs/attachment.go @@ -16,9 +16,10 @@ type Attachment struct { Size int64 `json:"size"` DownloadCount int64 `json:"download_count"` // swagger:strfmt date-time - Created time.Time `json:"created_at"` - UUID string `json:"uuid"` - DownloadURL string `json:"browser_download_url"` + Created time.Time `json:"created_at"` + UUID string `json:"uuid"` + DownloadURL string `json:"browser_download_url"` + S3DownloadURL string } // EditAttachmentOptions options for editing attachments diff --git a/templates/repo/datasets/dataset_list.tmpl b/templates/repo/datasets/dataset_list.tmpl index e0c69c745..765adf391 100755 --- a/templates/repo/datasets/dataset_list.tmpl +++ b/templates/repo/datasets/dataset_list.tmpl @@ -14,7 +14,7 @@
{{svg "octicon-flame" 16}} {{(.DownloadCount | PrettyNumber)}} - + {{svg "octicon-file-binary" 16}}
{{if eq .DecompressState 1}} From 1acb67d85c2f82f1df26647c88cf8bf7847b62a6 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 15 Feb 2022 10:33:48 +0800 Subject: [PATCH 02/24] =?UTF-8?q?=E8=A7=A3=E5=86=B3#1461?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/user/notification.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/user/notification.go b/routers/user/notification.go index 9724c8108..0fd6df007 100644 --- a/routers/user/notification.go +++ b/routers/user/notification.go @@ -132,7 +132,7 @@ func getNotifications(c *context.Context) { } c.Data["Title"] = c.Tr("notifications") - c.Data["Keyword"] = keyword + //c.Data["Keyword"] = keyword c.Data["Status"] = status c.Data["Notifications"] = notifications From 6b0a34ca6e261a06cf2681bae5460c331366a446 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Tue, 15 Feb 2022 11:08:01 +0800 Subject: [PATCH 03/24] obs download link --- models/attachment.go | 2 +- templates/repo/datasets/dataset_list.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/attachment.go b/models/attachment.go index 715cd0a90..a6d4b3715 100755 --- a/models/attachment.go +++ b/models/attachment.go @@ -103,7 +103,7 @@ func (a *Attachment) S3DownloadURL() string { if a.Type == TypeCloudBrainOne { url, _ = storage.Attachments.PresignedGetURL(setting.Attachment.Minio.BasePath+AttachmentRelativePath(a.UUID), a.Name) } else if a.Type == TypeCloudBrainTwo { - + url, _ = storage.ObsGetPreSignedUrl(a.UUID, a.Name) } return url diff --git a/templates/repo/datasets/dataset_list.tmpl b/templates/repo/datasets/dataset_list.tmpl index 765adf391..eed89b709 100755 --- a/templates/repo/datasets/dataset_list.tmpl +++ b/templates/repo/datasets/dataset_list.tmpl @@ -14,7 +14,7 @@
{{svg "octicon-flame" 16}} {{(.DownloadCount | PrettyNumber)}} - + {{svg "octicon-file" 16}} {{svg "octicon-file-binary" 16}}
{{if eq .DecompressState 1}} From 6d2b3062481412a06b7eb0755f1ce99ae223c8d0 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 15 Feb 2022 11:47:36 +0800 Subject: [PATCH 04/24] =?UTF-8?q?#1410=E9=A6=96=E9=A1=B5=E9=80=82=E9=85=8D?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- custom/public/css/git.openi.css | 143 ++++++++++++++++++++++++++++++++++++---- public/home/home.js | 10 ++- templates/home.tmpl | 8 +-- 3 files changed, 144 insertions(+), 17 deletions(-) diff --git a/custom/public/css/git.openi.css b/custom/public/css/git.openi.css index 502ba8d88..c97b48056 100644 --- a/custom/public/css/git.openi.css +++ b/custom/public/css/git.openi.css @@ -44,6 +44,12 @@ -webkit-line-clamp: 2; -webkit-box-orient: vertical; } +.ui.label{ + font-weight: normal; +} +.active { + color: #0366D6 !important; +} .opacity5{ opacity:0.5;} .radius15{ border-radius:1.5rem !important; } @@ -252,6 +258,11 @@ .homeorg-list .card .ui.small.header .content{ width: calc(100% - 3.25em); } +.homepro-tit{ + background: #FFF; + z-index: 9; + position: relative; +} .homepro-list{ position: relative; z-index: 9; @@ -261,8 +272,8 @@ .homepro-list .ui.card{ border-radius: 15px; background-color: #FFF; - box-shadow: 0px 5px 10px 0px rgba(105, 192, 255, 30); - border: 1px solid rgba(105, 192, 255, 40); + box-shadow: 0px 5px 10px 0px rgba(105, 192, 255, .3); + border: 1px solid rgba(105, 192, 255, .4); min-height: 10.8em; } .homepro-list .ui.card>.content>.header{ @@ -277,26 +288,134 @@ position: relative; } +/**seach**/ +/**搜索导航条适配窄屏**/ +.seachnav{ + overflow-x: auto; + overflow-y: hidden; + scrollbar-width: none; /* firefox */ + -ms-overflow-style: none; /* IE 10+ */ +} +.seachnav::-webkit-scrollbar { + display: none; /* Chrome Safari */ +} +.ui.green.button, .ui.green.buttons .button{ + background-color: #5BB973; +} +.seach .repos--seach{ + padding-bottom: 0; + border-bottom: none; +} +.seach .ui.secondary.pointing.menu{ + border-bottom: none; +} +.seach .ui.secondary.pointing.menu .item > i{ + margin-right: 5px; +} +.seach .ui.secondary.pointing.menu .active.item{ + border-bottom-width: 2px; + margin: 0 0 -1px; +} +.seach .ui.menu .active.item>.label { + background: #1684FC; + color: #FFF; +} +.seach .ui.menu .item>.label:not(.active.item>.label) { + background: #e8e8e8; + color: rgba(0,0,0,.6); +} + +.highlight{ + color: red; +} +.ui.list .list>.item>img.image+.content, .ui.list>.item>img.image+.content { + width: calc(100% - 3.0em); + margin-left: 0; +} + +.seach .ui.list .list>.item .header, .seach .ui.list>.item .header{ + margin-bottom: 0.5em; + font-size: 1.4rem !important; + font-weight: normal; +} +.seach .time, .seach .time a{ + font-size: 12px; + color: grey; +} + +.seach .list .item.members .ui.avatar.image { + width: 3.2em; + height: 3.2em; +} +.ui.list .list>.item.members>img.image+.content, .ui.list>.item.members>img.image+.content { + width: calc(100% - 4.0em); + margin-left: 0; +} + @media only screen and (max-width: 767px) { .am-mt-30{ margin-top: 1.5rem !important;} .ui.secondary.hometop.segment{ - margin-bottom: 2.0rem; + margin-bottom: 5.0rem; } - .bannerpic, .i-code-pic{ + .bannerpic{ display: none; } - .i-code h2::before { - left: calc(-5.0rem + 6px); + #homenews{ + bottom: -3em; } - .i-code h2.am-bw::before{ - left: calc(-4.0rem + 6px); + #homenews > p { + margin-left: 1.0em; + } + .homenews{ + padding-left: 1.3em !important; + border-radius: 1.5em; + } + .homenews::before{ + left: 2em; + } + .homeorg{ + padding-left: 3.5em; + } + .homeorg-tit::after { + left: -2.3em; + } + .homeorg-list{ + margin: 0 0 2.0em !important; + } + .homeorg-list > .column{ + width: 3em !important; + margin-left: -0.5em; + padding: 0.5rem 0 0 !important; + } + .homeorg-list .card{ + background: none !important; + } + .homeorg-list .card > .content{ + padding: 0 !important; + } + + .homeorg-list > .column .card .ui.header>img{ + width: 3.0em; + height: 3.0em; + border-radius: 2.0em; + border: 2px solid #FFF; + } + .homeorg-list > .column .card .ui.header > .content{ + display: none; } .leftline01{ - width: calc(50% - 4.0rem); + width: 4.0em; + bottom: 4em; + border-radius: 0 0 0 3.0em; + } + .leftline02, .leftline02-2{ + left: 6.0em; + top: calc(-4.0em - 2px); + border-radius: 0 3.0em 3.0em 0; + width: calc(50% - 6.0em); } - .leftline02{ - left: calc(50% - 1.0rem); - top: calc(-3.5rem - 2px); + .leftline02-2 { + width: calc(50% - 8.0em); } } diff --git a/public/home/home.js b/public/home/home.js index f49c8248b..bc8932642 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -17,7 +17,7 @@ var swiperNewMessage = new Swiper(".newslist", { }, }); var swiperRepo = new Swiper(".homepro-list", { - slidesPerView: 3, + slidesPerView: 1, slidesPerColumn: 2, slidesPerColumnFill:'row', spaceBetween: 30, @@ -29,6 +29,14 @@ var swiperRepo = new Swiper(".homepro-list", { delay: 2500, disableOnInteraction: false, }, + breakpoints: { + 768: { + slidesPerView: 2, + }, + 1024: { + slidesPerView: 3, + }, + }, }); var output = document.getElementById("newmessage"); diff --git a/templates/home.tmpl b/templates/home.tmpl index f43639a14..08893d71e 100755 --- a/templates/home.tmpl +++ b/templates/home.tmpl @@ -20,7 +20,7 @@

* {{.page_only_dynamic}}

-
+
-
+
@@ -78,7 +78,7 @@

{{.page_dev_env}}

{{.page_dev_env_desc}}

-
+
@@ -158,4 +158,4 @@ -{{template "base/footer" .}} \ No newline at end of file +{{template "base/footer" .}} From 9c26f857120fe3ecd7e3b2b4b09e72fda144ee3c Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 16 Feb 2022 15:34:59 +0800 Subject: [PATCH 05/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index e71e8cb3a..d513be5c3 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -16,7 +16,7 @@ import ( ) const ( - PAGE_SIZE = 2000 + PAGE_SIZE = 10 ) func queryUserDataPage(ctx *context.Context, tableName string, queryObj interface{}) { From 98e06e4e14b2691267816f07733d7f7f8dedc82a Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 16 Feb 2022 15:49:28 +0800 Subject: [PATCH 06/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index d513be5c3..7414de426 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -66,8 +66,10 @@ func queryUserDataPage(ctx *context.Context, tableName string, queryObj interfac for { re, _ := models.QueryUserStaticDataByTableName(int(indexTotal), PAGE_SIZE, tableName, queryObj, "") log.Info("return count=" + fmt.Sprint(count)) - for i, userRecord := range re { - rows := fmt.Sprint(i + 2) + row := 1 + for _, userRecord := range re { + row++ + rows := fmt.Sprint(row) xlsx.SetCellValue(sheetName, "A"+rows, userRecord.ID) xlsx.SetCellValue(sheetName, "B"+rows, userRecord.Name) xlsx.SetCellValue(sheetName, "C"+rows, userRecord.CodeMergeCount) From c29769ca904a6fd22d4befe581172e7afaa04bf9 Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 16 Feb 2022 15:57:22 +0800 Subject: [PATCH 07/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 7414de426..2dab5814c 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -63,10 +63,10 @@ func queryUserDataPage(ctx *context.Context, tableName string, queryObj interfac _, count := models.QueryUserStaticDataByTableName(1, 1, tableName, queryObj, userName) var indexTotal int64 indexTotal = 0 + row := 1 for { re, _ := models.QueryUserStaticDataByTableName(int(indexTotal), PAGE_SIZE, tableName, queryObj, "") log.Info("return count=" + fmt.Sprint(count)) - row := 1 for _, userRecord := range re { row++ rows := fmt.Sprint(row) From f898888b6a38f7be0c9bb4745dc2836db233f2ca Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 16 Feb 2022 16:14:04 +0800 Subject: [PATCH 08/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- custom/public/css/git.openi.css | 8 ++++---- public/home/home.js | 32 +++++++++++++++++++++++--------- templates/home.tmpl | 6 +++++- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/custom/public/css/git.openi.css b/custom/public/css/git.openi.css index c97b48056..828e4ee0d 100644 --- a/custom/public/css/git.openi.css +++ b/custom/public/css/git.openi.css @@ -256,14 +256,14 @@ box-shadow: none !important; } .homeorg-list .card .ui.small.header .content{ - width: calc(100% - 3.25em); + width: calc(100% - 3.75em); } .homepro-tit{ background: #FFF; z-index: 9; position: relative; } -.homepro-list{ +.homepro-list, .homeorg-list{ position: relative; z-index: 9; padding: 1.0em 1.0em 3.0em; @@ -280,9 +280,9 @@ line-height: 40px !important; } -.homepro-list .swiper-pagination-bullet-active{ +.homepro-list .swiper-pagination-bullet-active, .homeorg-list .swiper-pagination-bullet-active{ width: 40px; - border-radius: 4px; + border-radius: 4px; } .i-env > div{ position: relative; diff --git a/public/home/home.js b/public/home/home.js index bc8932642..47bee87ad 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -7,26 +7,40 @@ if(isEmpty(token)){ } } -var swiperNewMessage = new Swiper(".newslist", { - direction: "vertical", - slidesPerView: 10, - loop: true, +var swiperRepo = new Swiper(".homepro-list", { + slidesPerView: 1, + slidesPerColumn: 2, + slidesPerColumnFill:'row', + spaceBetween: 30, + pagination: { + el: ".swiper-pagination", + clickable: true, + }, autoplay: { delay: 2500, disableOnInteraction: false, }, + breakpoints: { + 768: { + slidesPerView: 2, + }, + 1024: { + slidesPerView: 3, + }, + }, }); -var swiperRepo = new Swiper(".homepro-list", { + +var swiperOrg = new Swiper(".homeorg-list", { slidesPerView: 1, - slidesPerColumn: 2, + slidesPerColumn: 4, slidesPerColumnFill:'row', - spaceBetween: 30, + spaceBetween: 15, pagination: { el: ".swiper-pagination", clickable: true, }, autoplay: { - delay: 2500, + delay: 4500, disableOnInteraction: false, }, breakpoints: { @@ -400,7 +414,7 @@ function displayOrg(json){ if (json != null && json.length > 0){ for(var i = 0; i < json.length;i++){ var record = json[i] - html += "
"; + html += "
"; html += " "; html += "
"; html += "
-
+
+
+ +
+
From a92f6548105298729b5debc82040d085ac01533c Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 16 Feb 2022 16:17:35 +0800 Subject: [PATCH 09/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/home.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/home/home.js b/public/home/home.js index 47bee87ad..fa5d6fc45 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -6,7 +6,15 @@ if(isEmpty(token)){ token = meta.attr("content"); } } - +var swiperNewMessage = new Swiper(".newslist", { + direction: "vertical", + slidesPerView: 10, + loop: true, + autoplay: { + delay: 2500, + disableOnInteraction: false, + }, +}); var swiperRepo = new Swiper(".homepro-list", { slidesPerView: 1, slidesPerColumn: 2, From c969874a5fc6fdf18542b0676c4ce318fe8efa95 Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 16 Feb 2022 16:23:14 +0800 Subject: [PATCH 10/24] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/home.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/home/home.js b/public/home/home.js index fa5d6fc45..7d5cbe4b1 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -438,4 +438,5 @@ function displayOrg(json){ } } orgDiv.innerHTML = html; + swiperOrg.updateSlides(); } From f1acf29f2da6af2b8b1bfeb380be413afd2a72b3 Mon Sep 17 00:00:00 2001 From: liuzx Date: Wed, 16 Feb 2022 16:24:07 +0800 Subject: [PATCH 11/24] fix-jobid --- routers/repo/cloudbrain.go | 8 ++++---- routers/routes/routes.go | 4 +++- templates/repo/debugjob/index.tmpl | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 0599fb03f..cea87feec 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -351,13 +351,13 @@ func CloudBrainShow(ctx *context.Context) { func cloudBrainShow(ctx *context.Context, tpName base.TplName) { ctx.Data["PageIsCloudBrain"] = true - var jobID = ctx.Params(":jobid") - task, err := models.GetCloudbrainByJobID(jobID) + var jobName = ctx.Params(":jobname") + task, err := models.GetCloudbrainByName(jobName) if err != nil { ctx.Data["error"] = err.Error() } - result, err := cloudbrain.GetJob(jobID) + result, err := cloudbrain.GetJob(task.JobID) if err != nil { ctx.Data["error"] = err.Error() } @@ -422,7 +422,7 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName) { ctx.Data["duration"] = util.AddZero(duration/3600000) + ":" + util.AddZero(duration%3600000/60000) + ":" + util.AddZero(duration%60000/1000) ctx.Data["task"] = task - ctx.Data["jobID"] = jobID + ctx.Data["jobID"] = task.JobID ctx.Data["jobName"] = task.JobName version_list_task := make([]*models.Cloudbrain, 0) version_list_task = append(version_list_task, task) diff --git a/routers/routes/routes.go b/routers/routes/routes.go index aa85b8f2b..de355352f 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -974,8 +974,10 @@ func RegisterRoutes(m *macaron.Macaron) { }, context.RepoRef()) m.Group("/cloudbrain", func() { - m.Group("/:jobid", func() { + m.Group("/:jobname", func() { m.Get("", reqRepoCloudBrainReader, repo.CloudBrainShow) + }) + m.Group("/:jobid", func() { m.Get("/debug", cloudbrain.AdminOrJobCreaterRight, repo.CloudBrainDebug) m.Post("/commit_image", cloudbrain.AdminOrJobCreaterRight, bindIgnErr(auth.CommitImageCloudBrainForm{}), repo.CloudBrainCommitImage) m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.CloudBrainStop) diff --git a/templates/repo/debugjob/index.tmpl b/templates/repo/debugjob/index.tmpl index f7773cf2d..8cf58dc4f 100755 --- a/templates/repo/debugjob/index.tmpl +++ b/templates/repo/debugjob/index.tmpl @@ -287,7 +287,7 @@
From 2cf4fd77254d575ee38e8d94236ac756a32d28df Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 16 Feb 2022 17:12:52 +0800 Subject: [PATCH 12/24] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- custom/public/css/git.openi.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom/public/css/git.openi.css b/custom/public/css/git.openi.css index 828e4ee0d..b849d0cd4 100644 --- a/custom/public/css/git.openi.css +++ b/custom/public/css/git.openi.css @@ -259,7 +259,6 @@ width: calc(100% - 3.75em); } .homepro-tit{ - background: #FFF; z-index: 9; position: relative; } @@ -373,6 +372,9 @@ .homenews::before{ left: 2em; } + .homepro-tit > p{ + background: #FFF; + } .homeorg{ padding-left: 3.5em; } From cd86c87e92f47267972366762f43cae35c7c64b2 Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 16 Feb 2022 17:23:37 +0800 Subject: [PATCH 13/24] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- custom/public/css/git.openi.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/custom/public/css/git.openi.css b/custom/public/css/git.openi.css index b849d0cd4..8e2c25b2d 100644 --- a/custom/public/css/git.openi.css +++ b/custom/public/css/git.openi.css @@ -419,6 +419,9 @@ .leftline02-2 { width: calc(50% - 8.0em); } + .i-env .ui.cards>.card>.content .description{ + display: none; + } } @media only screen and (min-width: 768px) and (max-width: 991px) { From 5b8cbca5c11c6b27e642a6cf61e15a1949f929ec Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 16 Feb 2022 17:30:20 +0800 Subject: [PATCH 14/24] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 2dab5814c..b4adfc347 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -16,7 +16,7 @@ import ( ) const ( - PAGE_SIZE = 10 + PAGE_SIZE = 2000 ) func queryUserDataPage(ctx *context.Context, tableName string, queryObj interface{}) { From ad9494faedbf022987e72d0e3035b803aa9a632f Mon Sep 17 00:00:00 2001 From: liuzx Date: Thu, 17 Feb 2022 14:46:24 +0800 Subject: [PATCH 15/24] fix-bug --- routers/api/v1/api.go | 3 ++- routers/api/v1/repo/cloudbrain.go | 23 +++++++++++------------ routers/api/v1/repo/modelarts.go | 1 + routers/repo/cloudbrain.go | 2 +- routers/repo/modelarts.go | 1 + routers/routes/routes.go | 10 ---------- templates/repo/debugjob/index.tmpl | 30 ++++++++++++++++-------------- 7 files changed, 32 insertions(+), 38 deletions(-) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 72a68a6d3..c6c5703b3 100755 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -878,7 +878,8 @@ func RegisterRoutes(m *macaron.Macaron) { }, reqAdmin()) }, reqAnyRepoReader()) m.Group("/cloudbrain", func() { - m.Get("/:jobid", repo.GetCloudbrainTask) + // m.Get("/:jobid", repo.GetCloudbrainTask) + m.Get("/:jobname", repo.GetCloudbrainTask) m.Get("/:jobid/log", repo.CloudbrainGetLog) }, reqRepoReader(models.UnitTypeCloudBrain)) m.Group("/modelarts", func() { diff --git a/routers/api/v1/repo/cloudbrain.go b/routers/api/v1/repo/cloudbrain.go index dd468783d..35044a894 100755 --- a/routers/api/v1/repo/cloudbrain.go +++ b/routers/api/v1/repo/cloudbrain.go @@ -6,11 +6,12 @@ package repo import ( - "code.gitea.io/gitea/modules/log" "net/http" "sort" "time" + "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/cloudbrain" "code.gitea.io/gitea/modules/context" @@ -48,14 +49,12 @@ func GetCloudbrainTask(ctx *context.APIContext) { err error ) - jobID := ctx.Params(":jobid") - repoID := ctx.Repo.Repository.ID - job, err := models.GetRepoCloudBrainByJobID(repoID, jobID) + jobName := ctx.Params(":jobname") + job, err := models.GetCloudbrainByName(jobName) if err != nil { - ctx.NotFound(err) - return + ctx.Data["error"] = err.Error() } - jobResult, err := cloudbrain.GetJob(jobID) + jobResult, err := cloudbrain.GetJob(job.JobID) if err != nil { ctx.NotFound(err) return @@ -84,7 +83,7 @@ func GetCloudbrainTask(ctx *context.APIContext) { } ctx.JSON(http.StatusOK, map[string]interface{}{ - "JobID": result.Config.JobID, + "JobName": result.Config.JobName, "JobStatus": result.JobStatus.State, "SubState": result.JobStatus.SubState, "CreatedTime": time.Unix(result.JobStatus.CreatedTime/1000, 0).Format("2006-01-02 15:04:05"), @@ -104,7 +103,7 @@ func CloudbrainGetLog(ctx *context.Context) { var hits []models.Hits result, err := cloudbrain.GetJobLog(jobID) - if err != nil{ + if err != nil { log.Error("GetJobLog failed: %v", err, ctx.Data["MsgID"]) ctx.ServerError(err.Error(), err) return @@ -115,7 +114,7 @@ func CloudbrainGetLog(ctx *context.Context) { if len(result.Hits.Hits) >= cloudbrain.LogPageSize { for { resultNext, err := cloudbrain.GetJobAllLog(result.ScrollID) - if err != nil{ + if err != nil { log.Error("GetJobAllLog failed: %v", err, ctx.Data["MsgID"]) } else { for _, hit := range resultNext.Hits.Hits { @@ -142,8 +141,8 @@ func CloudbrainGetLog(ctx *context.Context) { } ctx.JSON(http.StatusOK, map[string]interface{}{ - "JobID": jobID, - "Content": content, + "JobID": jobID, + "Content": content, }) return diff --git a/routers/api/v1/repo/modelarts.go b/routers/api/v1/repo/modelarts.go index c9f8761c9..27df10e16 100755 --- a/routers/api/v1/repo/modelarts.go +++ b/routers/api/v1/repo/modelarts.go @@ -77,6 +77,7 @@ func GetModelArtsNotebook2(ctx *context.APIContext) { ctx.JSON(http.StatusOK, map[string]interface{}{ "JobID": jobID, + "JobName": job.JobName, "JobStatus": result.Status, }) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index cea87feec..cff7f6e94 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -422,7 +422,7 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName) { ctx.Data["duration"] = util.AddZero(duration/3600000) + ":" + util.AddZero(duration%3600000/60000) + ":" + util.AddZero(duration%60000/1000) ctx.Data["task"] = task - ctx.Data["jobID"] = task.JobID + // ctx.Data["jobID"] = task.JobID ctx.Data["jobName"] = task.JobName version_list_task := make([]*models.Cloudbrain, 0) version_list_task = append(version_list_task, task) diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 9dea34c82..a6a7c9d96 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -268,6 +268,7 @@ func NotebookShow(ctx *context.Context) { ctx.Data["task"] = task ctx.Data["jobID"] = jobID + ctx.Data["jobName"] = task.JobName ctx.Data["result"] = result ctx.HTML(200, tplModelArtsNotebookShow) } diff --git a/routers/routes/routes.go b/routers/routes/routes.go index de355352f..840d6cf47 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -1031,7 +1031,6 @@ func RegisterRoutes(m *macaron.Macaron) { m.Group("/modelarts", func() { m.Group("/notebook", func() { - /* v1.0 m.Group("/:jobid", func() { m.Get("", reqRepoCloudBrainReader, repo.NotebookShow) m.Get("/debug", cloudbrain.AdminOrJobCreaterRight, repo.NotebookDebug) @@ -1040,15 +1039,6 @@ func RegisterRoutes(m *macaron.Macaron) { }) m.Get("/create", reqRepoCloudBrainWriter, repo.NotebookNew) m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsNotebookForm{}), repo.NotebookCreate) - */ - m.Group("/:jobid", func() { - m.Get("", reqRepoCloudBrainReader, repo.NotebookShow) - m.Get("/debug", cloudbrain.AdminOrJobCreaterRight, repo.NotebookDebug2) - m.Post("/:action", reqRepoCloudBrainWriter, repo.NotebookManage) - m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.NotebookDel) - }) - m.Get("/create", reqRepoCloudBrainWriter, repo.NotebookNew) - m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsNotebookForm{}), repo.Notebook2Create) }) m.Group("/train-job", func() { diff --git a/templates/repo/debugjob/index.tmpl b/templates/repo/debugjob/index.tmpl index 8cf58dc4f..f093f0258 100755 --- a/templates/repo/debugjob/index.tmpl +++ b/templates/repo/debugjob/index.tmpl @@ -293,7 +293,7 @@
- + {{.Status}}
@@ -607,6 +607,7 @@ function loadJobStatus() { $(".job-status").each((index, job) => { const jobID = job.dataset.jobid; + const jobName = job.dataset.jobname; const repoPath = job.dataset.repopath; const computeResource = job.dataset.resource const initArray = ['STOPPED','FAILED','START_FAILED','CREATE_FAILED','SUCCEEDED','UNAVAILABLE','DELETED','RESIZE_FAILED'] @@ -615,38 +616,39 @@ return } const diffResource = computeResource == "NPU" ? 'modelarts/notebook' : 'cloudbrain' - $.get(`/api/v1/repos/${repoPath}/${diffResource}/${jobID}`, (data) => { - const jobID = data.JobID + const diffApi = computeResource == "NPU" ? jobID : jobName + $.get(`/api/v1/repos/${repoPath}/${diffResource}/${diffApi}`, (data) => { + const jobName = data.JobName const status = data.JobStatus if (status != job.textContent.trim()) { - $('#' + jobID+'-icon').removeClass().addClass(status) - $('#' + jobID+ '-text').text(status) + $('#' + jobName+'-icon').removeClass().addClass(status) + $('#' + jobName+ '-text').text(status) } if(status==="RUNNING"){ - $('#model-debug-'+jobID).removeClass('disabled').addClass('blue').text('调试').css("margin","0 1rem") - $('#model-image-'+jobID).removeClass('disabled').addClass('blue') + $('#model-debug-'+jobName).removeClass('disabled').addClass('blue').text('调试').css("margin","0 1rem") + $('#model-image-'+jobName).removeClass('disabled').addClass('blue') } if(status!=="RUNNING"){ // $('#model-debug-'+jobID).removeClass('blue') // $('#model-debug-'+jobID).addClass('disabled') - $('#model-image-'+jobID).removeClass('blue').addClass('disabled') + $('#model-image-'+jobName).removeClass('blue').addClass('disabled') } if(["CREATING","STOPPING","WAITING","STARTING"].includes(status)){ - $('#model-debug-'+jobID).removeClass('blue').addClass('disabled') + $('#model-debug-'+jobName).removeClass('blue').addClass('disabled') } if(['STOPPED','FAILED','START_FAILED','CREATE_FAILED','SUCCEEDED'].includes(status)){ - $('#model-debug-'+jobID).removeClass('disabled').addClass('blue').text('再次调试').css("margin","0") + $('#model-debug-'+jobName).removeClass('disabled').addClass('blue').text('再次调试').css("margin","0") } if(["RUNNING","WAITING"].includes(status)){ - $('#stop-model-debug-'+jobID).removeClass('disabled').addClass('blue') + $('#stop-model-debug-'+jobName).removeClass('disabled').addClass('blue') } if(["CREATING","STOPPING","STARTING","STOPPED","FAILED","START_FAILED","SUCCEEDED"].includes(status)){ - $('#stop-model-debug-'+jobID).removeClass('blue').addClass('disabled') + $('#stop-model-debug-'+jobName).removeClass('blue').addClass('disabled') } if(status==="STOPPED" || status==="FAILED"|| status==="START_FAILED"){ - $('#model-delete-'+jobID).removeClass('disabled').addClass('blue') + $('#model-delete-'+jobName).removeClass('disabled').addClass('blue') }else{ - $('#model-delete-'+jobID).removeClass('blue').addClass('disabled') + $('#model-delete-'+jobName).removeClass('blue').addClass('disabled') } }).fail(function(err) { console.log(err); From 341e91b2360b866d7261b4c1edf97f62fb614ff6 Mon Sep 17 00:00:00 2001 From: liuzx Date: Thu, 17 Feb 2022 14:59:49 +0800 Subject: [PATCH 16/24] fix-bug --- routers/routes/routes.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 840d6cf47..0f1abe5e8 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -1031,14 +1031,22 @@ func RegisterRoutes(m *macaron.Macaron) { m.Group("/modelarts", func() { m.Group("/notebook", func() { + // m.Group("/:jobid", func() { + // m.Get("", reqRepoCloudBrainReader, repo.NotebookShow) + // m.Get("/debug", cloudbrain.AdminOrJobCreaterRight, repo.NotebookDebug) + // m.Post("/:action", reqRepoCloudBrainWriter, repo.NotebookManage) + // m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.NotebookDel) + // }) + // m.Get("/create", reqRepoCloudBrainWriter, repo.NotebookNew) + // m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsNotebookForm{}), repo.NotebookCreate) m.Group("/:jobid", func() { m.Get("", reqRepoCloudBrainReader, repo.NotebookShow) - m.Get("/debug", cloudbrain.AdminOrJobCreaterRight, repo.NotebookDebug) + m.Get("/debug", cloudbrain.AdminOrJobCreaterRight, repo.NotebookDebug2) m.Post("/:action", reqRepoCloudBrainWriter, repo.NotebookManage) m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.NotebookDel) }) m.Get("/create", reqRepoCloudBrainWriter, repo.NotebookNew) - m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsNotebookForm{}), repo.NotebookCreate) + m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsNotebookForm{}), repo.Notebook2Create) }) m.Group("/train-job", func() { From 84928acefa7d7a504cb0019d3f87376c6c0db5cf Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Thu, 17 Feb 2022 15:03:31 +0800 Subject: [PATCH 17/24] fix 1509 --- routers/repo/cloudbrain.go | 3 ++- routers/repo/modelarts.go | 3 ++- templates/repo/debugjob/index.tmpl | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 0599fb03f..5f9e81901 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -582,12 +582,13 @@ func logErrorAndUpdateJobStatus(err error, taskInfo *models.Cloudbrain) { } func CloudBrainDel(ctx *context.Context) { + var listType = ctx.Query("debugListType") if err := deleteCloudbrainJob(ctx); err != nil { log.Error("deleteCloudbrainJob failed: %v", err, ctx.Data["msgID"]) ctx.ServerError(err.Error(), err) return } - ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=all") + ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=" + listType) } func deleteCloudbrainJob(ctx *context.Context) error { diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 9dea34c82..8d5d03353 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -417,6 +417,7 @@ func NotebookManage(ctx *context.Context) { func NotebookDel(ctx *context.Context) { var jobID = ctx.Params(":jobid") + var listType = ctx.Query("debugListType") task := ctx.Cloudbrain if task.Status != string(models.ModelArtsCreateFailed) && task.Status != string(models.ModelArtsStartFailed) && task.Status != string(models.ModelArtsStopped) { @@ -442,7 +443,7 @@ func NotebookDel(ctx *context.Context) { return } - ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=all") + ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=" + listType) } func TrainJobIndex(ctx *context.Context) { diff --git a/templates/repo/debugjob/index.tmpl b/templates/repo/debugjob/index.tmpl index f7773cf2d..ef06d12b6 100755 --- a/templates/repo/debugjob/index.tmpl +++ b/templates/repo/debugjob/index.tmpl @@ -366,7 +366,7 @@
- + {{$.CsrfTokenHtml}} {{if .CanDel}} From dda9a7ee777ea6c7fedf381b41d06a633b1508d2 Mon Sep 17 00:00:00 2001 From: liuzx Date: Thu, 17 Feb 2022 15:04:53 +0800 Subject: [PATCH 18/24] fix-bug --- routers/routes/routes.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 0f1abe5e8..de355352f 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -1031,14 +1031,16 @@ func RegisterRoutes(m *macaron.Macaron) { m.Group("/modelarts", func() { m.Group("/notebook", func() { - // m.Group("/:jobid", func() { - // m.Get("", reqRepoCloudBrainReader, repo.NotebookShow) - // m.Get("/debug", cloudbrain.AdminOrJobCreaterRight, repo.NotebookDebug) - // m.Post("/:action", reqRepoCloudBrainWriter, repo.NotebookManage) - // m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.NotebookDel) - // }) - // m.Get("/create", reqRepoCloudBrainWriter, repo.NotebookNew) - // m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsNotebookForm{}), repo.NotebookCreate) + /* v1.0 + m.Group("/:jobid", func() { + m.Get("", reqRepoCloudBrainReader, repo.NotebookShow) + m.Get("/debug", cloudbrain.AdminOrJobCreaterRight, repo.NotebookDebug) + m.Post("/:action", reqRepoCloudBrainWriter, repo.NotebookManage) + m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.NotebookDel) + }) + m.Get("/create", reqRepoCloudBrainWriter, repo.NotebookNew) + m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsNotebookForm{}), repo.NotebookCreate) + */ m.Group("/:jobid", func() { m.Get("", reqRepoCloudBrainReader, repo.NotebookShow) m.Get("/debug", cloudbrain.AdminOrJobCreaterRight, repo.NotebookDebug2) From f7b4d218a811846254c8e0d44d00d8bd9672328e Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Thu, 17 Feb 2022 16:53:06 +0800 Subject: [PATCH 19/24] download link --- models/attachment.go | 2 +- templates/repo/datasets/dataset_list.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/attachment.go b/models/attachment.go index a6d4b3715..6ab1f3652 100755 --- a/models/attachment.go +++ b/models/attachment.go @@ -94,7 +94,7 @@ func (a *Attachment) APIFormat() *api.Attachment { // DownloadURL returns the download url of the attached file func (a *Attachment) DownloadURL() string { - return fmt.Sprintf("%sattachments/%s", setting.AppURL, a.UUID) + return fmt.Sprintf("%sattachments/%s?type=%d", setting.AppURL, a.UUID, a.Type) } // DownloadURL returns the download url of the attached file diff --git a/templates/repo/datasets/dataset_list.tmpl b/templates/repo/datasets/dataset_list.tmpl index eed89b709..7ea420fa0 100755 --- a/templates/repo/datasets/dataset_list.tmpl +++ b/templates/repo/datasets/dataset_list.tmpl @@ -14,7 +14,7 @@
{{svg "octicon-flame" 16}} {{(.DownloadCount | PrettyNumber)}} - {{svg "octicon-file" 16}} + {{svg "octicon-file" 16}} {{svg "octicon-file-binary" 16}}
{{if eq .DecompressState 1}} From 11bacb83e24ef682d5186deeca22e7137b9c9786 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Thu, 17 Feb 2022 16:54:38 +0800 Subject: [PATCH 20/24] download link --- models/attachment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/attachment.go b/models/attachment.go index 6ab1f3652..c322d391b 100755 --- a/models/attachment.go +++ b/models/attachment.go @@ -97,7 +97,7 @@ func (a *Attachment) DownloadURL() string { return fmt.Sprintf("%sattachments/%s?type=%d", setting.AppURL, a.UUID, a.Type) } -// DownloadURL returns the download url of the attached file +// S3DownloadURL returns the s3 download url of the attached file func (a *Attachment) S3DownloadURL() string { url := "" if a.Type == TypeCloudBrainOne { From d6c77937eef04e748e644b222441a855ae05564b Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Fri, 18 Feb 2022 08:58:37 +0800 Subject: [PATCH 21/24] fix-1469 --- modules/context/auth.go | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/modules/context/auth.go b/modules/context/auth.go index 61a7b029b..dba2c3269 100755 --- a/modules/context/auth.go +++ b/modules/context/auth.go @@ -6,12 +6,14 @@ package context import ( + "encoding/base64" + "net/http" + "strings" + "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/auth" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" - "encoding/base64" - "net/http" "gitea.com/macaron/csrf" "gitea.com/macaron/macaron" @@ -94,7 +96,14 @@ func Toggle(options *ToggleOptions) macaron.Handler { return } - ctx.SetCookie("redirect_to", setting.AppSubURL+ctx.Req.URL.RequestURI(), 0, setting.AppSubURL) + tempUrl := ctx.Req.URL.RequestURI() + + if strings.Contains(tempUrl, "action/star?") || strings.Contains(tempUrl, "action/watch?") { + redirectForStarAndWatch(ctx, tempUrl) + + } else { + ctx.SetCookie("redirect_to", setting.AppSubURL+ctx.Req.URL.RequestURI(), 0, setting.AppSubURL) + } ctx.Redirect(setting.AppSubURL + "/user/login") return } else if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm { @@ -159,6 +168,17 @@ func Toggle(options *ToggleOptions) macaron.Handler { } } +func redirectForStarAndWatch(ctx *Context, tempUrl string) { + splits := strings.Split(tempUrl, "?") + if len(splits) > 1 { + redirectArguments := strings.Split(splits[1], "=") + + if len(redirectArguments) > 0 && redirectArguments[0] == "redirect_to" { + ctx.SetCookie("redirect_to", setting.AppSubURL+strings.Replace(redirectArguments[1], "%2f", "/", -1), 0, setting.AppSubURL) + } + } +} + func basicAuth(ctx *Context) bool { var siteAuth = base64.StdEncoding.EncodeToString([]byte(setting.CBAuthUser + ":" + setting.CBAuthPassword)) auth := ctx.Req.Header.Get("Authorization") From 45958ca5aab507146730c1d68db92fb927af61da Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Fri, 18 Feb 2022 09:27:18 +0800 Subject: [PATCH 22/24] =?UTF-8?q?fix-1399=E5=90=8E=E7=AB=AF=E9=83=A8?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/repo_statistic.go | 8 ++++++++ routers/api/v1/repo/repo_dashbord.go | 22 +++++++++++----------- routers/repo/repo_statistic.go | 3 ++- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/models/repo_statistic.go b/models/repo_statistic.go index d3eb65c30..809cb26c4 100755 --- a/models/repo_statistic.go +++ b/models/repo_statistic.go @@ -12,6 +12,7 @@ type RepoStatistic struct { ID int64 `xorm:"pk autoincr" json:"-"` RepoID int64 `xorm:"unique(s) NOT NULL" json:"repo_id"` Name string `xorm:"INDEX" json:"name"` + Alias string `xorm:"INDEX" json:"alias"` OwnerName string `json:"ownerName"` IsPrivate bool `json:"isPrivate"` IsMirror bool `json:"isMirror"` @@ -63,6 +64,13 @@ type RepoStatistic struct { UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated" json:"-"` } +func (repo *RepoStatistic) DisplayName() string { + if repo.Alias == "" { + return repo.Name + } + return repo.Alias +} + func DeleteRepoStatDaily(date string) error { sess := xStatistic.NewSession() defer sess.Close() diff --git a/routers/api/v1/repo/repo_dashbord.go b/routers/api/v1/repo/repo_dashbord.go index 46596330f..959fb4c9f 100644 --- a/routers/api/v1/repo/repo_dashbord.go +++ b/routers/api/v1/repo/repo_dashbord.go @@ -297,7 +297,7 @@ func allProjectsPeroidHeader(ctx *context.Context) map[string]string { } func allProjectsPeroidValues(row int, rs *models.RepoStatistic, ctx *context.Context) map[string]string { - return map[string]string{getCellName("A", row): strconv.FormatInt(rs.RepoID, 10), getCellName("B", row): rs.Name, getCellName("C", row): rs.OwnerName, getCellName("D", row): getIsPrivateDisplay(rs.IsPrivate, ctx), getCellName("E", row): strconv.FormatFloat(rs.RadarTotal, 'f', 2, 64), + return map[string]string{getCellName("A", row): strconv.FormatInt(rs.RepoID, 10), getCellName("B", row): rs.DisplayName(), getCellName("C", row): rs.OwnerName, getCellName("D", row): getIsPrivateDisplay(rs.IsPrivate, ctx), getCellName("E", row): strconv.FormatFloat(rs.RadarTotal, 'f', 2, 64), getCellName("F", row): strconv.FormatInt(rs.NumVisits, 10), getCellName("G", row): strconv.FormatInt(rs.NumDownloads, 10), getCellName("H", row): strconv.FormatInt(rs.NumPulls, 10), getCellName("I", row): strconv.FormatInt(rs.NumCommits, 10), getCellName("J", row): strconv.FormatInt(rs.NumWatches, 10), getCellName("K", row): strconv.FormatInt(rs.NumStars, 10), getCellName("L", row): strconv.FormatInt(rs.NumForks, 10), getCellName("M", row): strconv.FormatInt(rs.NumIssues, 10), getCellName("N", row): strconv.FormatInt(rs.NumClosedIssues, 10), getCellName("O", row): strconv.FormatInt(rs.NumContributor, 10), @@ -317,7 +317,7 @@ func allProjectsOpenIHeader() map[string]string { func allProjectsOpenIValues(row int, rs *models.RepoStatistic, ctx *context.Context) map[string]string { - return map[string]string{getCellName("A", row): strconv.FormatInt(rs.RepoID, 10), getCellName("B", row): rs.Name, getCellName("C", row): rs.OwnerName, getCellName("D", row): getIsPrivateDisplay(rs.IsPrivate, ctx), getCellName("E", row): strconv.FormatFloat(rs.RadarTotal, 'f', 2, 64), + return map[string]string{getCellName("A", row): strconv.FormatInt(rs.RepoID, 10), getCellName("B", row): rs.DisplayName(), getCellName("C", row): rs.OwnerName, getCellName("D", row): getIsPrivateDisplay(rs.IsPrivate, ctx), getCellName("E", row): strconv.FormatFloat(rs.RadarTotal, 'f', 2, 64), getCellName("F", row): strconv.FormatFloat(rs.Impact, 'f', 2, 64), getCellName("G", row): strconv.FormatFloat(rs.Completeness, 'f', 2, 64), getCellName("H", row): strconv.FormatFloat(rs.Liveness, 'f', 2, 64), getCellName("I", row): strconv.FormatFloat(rs.ProjectHealth, 'f', 2, 64), getCellName("J", row): strconv.FormatFloat(rs.TeamHealth, 'f', 2, 64), getCellName("K", row): strconv.FormatFloat(rs.Growth, 'f', 2, 64), getCellName("L", row): strconv.FormatInt(rs.NumWatches, 10), getCellName("M", row): strconv.FormatInt(rs.NumStars, 10), getCellName("N", row): strconv.FormatInt(rs.NumForks, 10), getCellName("O", row): strconv.FormatInt(rs.NumDownloads, 10), @@ -466,10 +466,10 @@ func generateCountSql(beginTime time.Time, endTime time.Time, latestDate string, countSql := "SELECT count(*) FROM " + "(SELECT repo_id FROM repo_statistic where created_unix >=" + strconv.FormatInt(beginTime.Unix(), 10) + " and created_unix<" + strconv.FormatInt(endTime.Unix(), 10) + " group by repo_id) A," + - "(SELECT repo_id,name,is_private,radar_total from public.repo_statistic where date='" + latestDate + "') B" + + "(SELECT repo_id,name,alias,is_private,radar_total from public.repo_statistic where date='" + latestDate + "') B" + " where A.repo_id=B.repo_id" if q != "" { - countSql = countSql + " and LOWER(B.name) like '%" + strings.ToLower(q) + "%'" + countSql = countSql + " and LOWER(B.alias) like '%" + strings.ToLower(q) + "%'" } return countSql } @@ -482,22 +482,22 @@ func generateOpenICountSql(latestDate string) string { } func generateTypeAllSql(beginTime time.Time, endTime time.Time, latestDate string, q string, orderBy string, page int, pageSize int) string { - sql := "SELECT A.repo_id,name,owner_name,is_private,radar_total,num_watches,num_visits,num_downloads,num_pulls,num_commits,num_stars,num_forks,num_issues,num_closed_issues,num_contributor FROM " + + sql := "SELECT A.repo_id,name,alias,owner_name,is_private,radar_total,num_watches,num_visits,num_downloads,num_pulls,num_commits,num_stars,num_forks,num_issues,num_closed_issues,num_contributor FROM " + "(SELECT repo_id,sum(num_visits) as num_visits " + " FROM repo_statistic where created_unix >=" + strconv.FormatInt(beginTime.Unix(), 10) + " and created_unix<" + strconv.FormatInt(endTime.Unix(), 10) + " group by repo_id) A," + - "(SELECT repo_id,name,owner_name,is_private,radar_total,num_watches,num_downloads,num_pulls,num_commits,num_stars,num_forks,num_issues,num_closed_issues,num_contributor from public.repo_statistic where date='" + latestDate + "') B" + + "(SELECT repo_id,name,alias,owner_name,is_private,radar_total,num_watches,num_downloads,num_pulls,num_commits,num_stars,num_forks,num_issues,num_closed_issues,num_contributor from public.repo_statistic where date='" + latestDate + "') B" + " where A.repo_id=B.repo_id" if q != "" { - sql = sql + " and LOWER(name) like '%" + strings.ToLower(q) + "%'" + sql = sql + " and LOWER(alias) like '%" + strings.ToLower(q) + "%'" } sql = sql + " order by " + orderBy + " desc,repo_id" + " limit " + strconv.Itoa(pageSize) + " offset " + strconv.Itoa((page-1)*pageSize) return sql } func generateTypeAllOpenISql(latestDate string, page int, pageSize int) string { - sql := "SELECT id, repo_id, date, num_watches, num_stars, num_forks, num_downloads, num_comments, num_visits, num_closed_issues, num_versions, num_dev_months, repo_size, dataset_size, num_models, num_wiki_views, num_commits, num_issues, num_pulls, issue_fixed_rate, num_contributor, num_key_contributor, num_contributors_growth, num_commits_growth, num_commit_lines_growth, num_issues_growth, num_comments_growth, impact, completeness, liveness, project_health, team_health, growth, radar_total, name, is_private, owner_name FROM " + + sql := "SELECT id, repo_id, date, num_watches, num_stars, num_forks, num_downloads, num_comments, num_visits, num_closed_issues, num_versions, num_dev_months, repo_size, dataset_size, num_models, num_wiki_views, num_commits, num_issues, num_pulls, issue_fixed_rate, num_contributor, num_key_contributor, num_contributors_growth, num_commits_growth, num_commit_lines_growth, num_issues_growth, num_comments_growth, impact, completeness, liveness, project_health, team_health, growth, radar_total, name,alias, is_private, owner_name FROM " + " public.repo_statistic where date='" + latestDate + "'" sql = sql + " order by radar_total desc,repo_id" + " limit " + strconv.Itoa(pageSize) + " offset " + strconv.Itoa((page-1)*pageSize) @@ -506,14 +506,14 @@ func generateTypeAllOpenISql(latestDate string, page int, pageSize int) string { func generatePageSql(beginTime time.Time, endTime time.Time, latestDate string, q string, orderBy string, page int, pageSize int) string { - sql := "SELECT A.repo_id,name,owner_name,is_private,radar_total,num_watches,num_visits,num_downloads,num_pulls,num_commits,num_stars,num_forks,num_issues,num_closed_issues,num_contributor FROM " + + sql := "SELECT A.repo_id,name,alias,owner_name,is_private,radar_total,num_watches,num_visits,num_downloads,num_pulls,num_commits,num_stars,num_forks,num_issues,num_closed_issues,num_contributor FROM " + "(SELECT repo_id,sum(num_watches_added) as num_watches,sum(num_visits) as num_visits, sum(num_downloads_added) as num_downloads,sum(num_pulls_added) as num_pulls,sum(num_commits_added) as num_commits,sum(num_stars_added) as num_stars,sum(num_forks_added) num_forks,sum(num_issues_added) as num_issues,sum(num_closed_issues_added) as num_closed_issues,sum(num_contributor_added) as num_contributor " + " FROM repo_statistic where created_unix >=" + strconv.FormatInt(beginTime.Unix(), 10) + " and created_unix<" + strconv.FormatInt(endTime.Unix(), 10) + " group by repo_id) A," + - "(SELECT repo_id,name,owner_name,is_private,radar_total from public.repo_statistic where date='" + latestDate + "') B" + + "(SELECT repo_id,name,alias,owner_name,is_private,radar_total from public.repo_statistic where date='" + latestDate + "') B" + " where A.repo_id=B.repo_id" if q != "" { - sql = sql + " and LOWER(B.name) like '%" + strings.ToLower(q) + "%'" + sql = sql + " and LOWER(B.alias) like '%" + strings.ToLower(q) + "%'" } sql = sql + " order by " + orderBy + " desc,A.repo_id" + " limit " + strconv.Itoa(pageSize) + " offset " + strconv.Itoa((page-1)*pageSize) return sql diff --git a/routers/repo/repo_statistic.go b/routers/repo/repo_statistic.go index d9545f696..06f45e608 100755 --- a/routers/repo/repo_statistic.go +++ b/routers/repo/repo_statistic.go @@ -106,7 +106,8 @@ func RepoStatisticDaily(date string) { repoStat := models.RepoStatistic{ RepoID: repo.ID, Date: date, - Name: repo.Alias, + Name: repo.Name, + Alias: repo.Alias, IsPrivate: repo.IsPrivate, IsMirror: repo.IsMirror, OwnerName: repo.OwnerName, From 400d2b5654cdc4362b38406f48c91846457fd298 Mon Sep 17 00:00:00 2001 From: wangjr Date: Fri, 18 Feb 2022 10:37:06 +0800 Subject: [PATCH 23/24] =?UTF-8?q?fix-1463=E9=A1=B9=E7=9B=AE=E7=AE=80?= =?UTF-8?q?=E4=BB=8B=E6=9C=AA=E7=99=BB=E5=BD=95=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/repo/home.tmpl | 7 ++++--- web_src/js/components/EditAboutInfo.vue | 19 +++++++++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index c9edff0c3..d571f32f8 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -255,9 +255,9 @@ {{end}}
-
-

简介

- +
+

简介

+

{{if .Repository.DescriptionHTML}} {{.Repository.DescriptionHTML}} @@ -356,5 +356,6 @@ // $("#contributorInfo > a:nth-child(n+25)").show(); // }); // }); +console.log("repo-desc::::",document.getElementById("repo-desc").dataset.issigned) {{template "base/footer" .}} diff --git a/web_src/js/components/EditAboutInfo.vue b/web_src/js/components/EditAboutInfo.vue index 425cf4bcc..f9bb872ad 100644 --- a/web_src/js/components/EditAboutInfo.vue +++ b/web_src/js/components/EditAboutInfo.vue @@ -1,7 +1,7 @@