| @@ -3,6 +3,9 @@ | |||
| {{template "admin/navbar" .}} | |||
| <div class="ui container"> | |||
| {{template "base/alert" .}} | |||
| <div class="ui negative message" style="display: none;"> | |||
| </div> | |||
| <h4 class="ui top attached header"> | |||
| {{.i18n.Tr "admin.datasets.dataset_manage_panel"}} ({{.i18n.Tr "admin.total" .Total}}) | |||
| </h4> | |||
| @@ -24,7 +27,7 @@ | |||
| {{range .Datasets}} | |||
| <tr> | |||
| <td>{{.ID}}</td> | |||
| <td><a href="{{AppSubUrl}}/">{{.Title}}</a></td> | |||
| <td style="display: flex;align-items: center;"><a href="{{AppSubUrl}}/">{{.Title}}</a>{{if .Recommend}}<img src="/img/jian.svg" style="margin-left: 0.5rem;">{{end}}</td> | |||
| <td><i class="fa fa{{if .IsPrivate}}-check{{end}}-square-o"></i></td> | |||
| <td><span title="{{.CreatedUnix.FormatLong}}">{{.CreatedUnix.FormatShort}}</span></td> | |||
| <td>{{if .Recommend}}<span class="set_dataset" style="color: rgb(250, 140, 22);cursor: pointer;" data-url="{{$.Link}}/{{.ID}}/action/unrecommend">取消推荐</span>{{else}}<span class="set_dataset" style="color: rgb(19, 194, 141);cursor: pointer;" data-url="{{$.Link}}/{{.ID}}/action/recommend">设为推荐</span>{{end}}</td> | |||
| @@ -37,35 +40,4 @@ | |||
| {{template "base/paginate" .}} | |||
| </div> | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| <script> | |||
| console.log({{.Datasets}}) | |||
| $('.set_dataset').on('click', function(){ | |||
| const $this = $(this); | |||
| let link = $this.data('url') | |||
| console.log("111111") | |||
| $.ajax({ | |||
| url:link, | |||
| type:'PUT', | |||
| success:function(res){ | |||
| console.log(res) | |||
| }, | |||
| error: function(xhr){ | |||
| // 隐藏 loading | |||
| // 只有请求不正常(状态码不为200)才会执行 | |||
| // $('.ui.negative.message').html(xhr.responseText).show().delay(1500).fadeOut(); | |||
| console.log(xhr) | |||
| }, | |||
| complete:function(xhr){ | |||
| // $("#mask").css({"display":"none","z-index":"1"}) | |||
| } | |||
| }) | |||
| // $.put($this.data('url'), { | |||
| // }).done((data) => { | |||
| // console.log(data) | |||
| // // window.location.href = data.redirect; | |||
| // }); | |||
| }); | |||
| </script> | |||
| {{template "base/footer" .}} | |||
| @@ -44,7 +44,7 @@ | |||
| <td>{{.NumIssues}}</td> | |||
| <td>{{SizeFmt .Size}}</td> | |||
| <td><span title="{{.CreatedUnix.FormatLong}}">{{.CreatedUnix.FormatShort}}</span></td> | |||
| <td><a class="delete-button1" href="" data-url="{{$.Link}}/delete?page={{$.Page.Paginater.Current}}&sort={{$.SortType}}" data-id="{{.ID}}" data-name="{{.Name}}"><i class="trash icon text red"></i></a></td> | |||
| <td><a class="delete-button" href="" data-url="{{$.Link}}/delete?page={{$.Page.Paginater.Current}}&sort={{$.SortType}}" data-id="{{.ID}}" data-name="{{.Name}}"><i class="trash icon text red"></i></a></td> | |||
| </tr> | |||
| {{end}} | |||
| </tbody> | |||
| @@ -68,38 +68,3 @@ | |||
| {{template "base/delete_modal_actions" .}} | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| <script> | |||
| $('.delete-button1').on('click', showDeletePopup); | |||
| function showDeletePopup() { | |||
| const $this = $(this); | |||
| let filter = ''; | |||
| if ($this.attr('id')) { | |||
| filter += `#${$this.attr('id')}`; | |||
| } | |||
| const dialog = $(`.delete.modal${filter}`); | |||
| console.log(`.delete.modal${filter}`,dialog) | |||
| dialog.find('.name').text($this.data('name')); | |||
| console.log(dialog.find('.name')) | |||
| dialog | |||
| .modal({ | |||
| closable: false, | |||
| onApprove() { | |||
| if ($this.data('type') === 'form') { | |||
| $($this.data('form')).trigger('submit'); | |||
| return; | |||
| } | |||
| $.post($this.data('url'), { | |||
| _csrf: csrf, | |||
| id: $this.data('id') | |||
| }).done((data) => { | |||
| window.location.href = data.redirect; | |||
| }); | |||
| } | |||
| }) | |||
| .modal('show'); | |||
| return false; | |||
| } | |||
| </script> | |||
| @@ -23,7 +23,7 @@ | |||
| <el-tab-pane label="{{.i18n.Tr "dataset.current_project"}}" name="first"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(dataset,index) in currentRepoDataset" :key="index"> | |||
| <div style="width: 90%;"> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias} </span><span class="panel_dataset_name">${dataset.Name} </span></div> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><img v-if="dataset.Recommend" src="/img/jian.svg" style="margin-left: 0.5rem;"><span class="panel_dataset_name">${dataset.Name} </span></div> | |||
| <div style="margin-top: 8px;display: flex;"> | |||
| <a :title="dataset.UserName" style="cursor: default;"> | |||
| <img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="dataset.RelAvatarLink"> | |||
| @@ -49,7 +49,7 @@ | |||
| <el-tab-pane label="{{.i18n.Tr "dataset.owner_dataset"}}" name="second"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(dataset,index) in myDataset" :key="index"> | |||
| <div style="width: 90%;"> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><span class="panel_dataset_name">${dataset.Name}</span></div> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><img v-if="dataset.Recommend" src="/img/jian.svg" style="margin-left: 0.5rem;"><span class="panel_dataset_name">${dataset.Name}</span></div> | |||
| <div style="margin-top: 8px;display: flex;"> | |||
| <a :title="dataset.UserName" style="cursor: default;"> | |||
| <img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="dataset.RelAvatarLink"> | |||
| @@ -74,7 +74,7 @@ | |||
| <el-tab-pane label="{{.i18n.Tr "dataset.public_dataset"}}" name="third"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(dataset,index) in publicDataset" :key="index"> | |||
| <div style="width: 90%;"> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><span class="panel_dataset_name">${dataset.Name}</span></div> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><img v-if="dataset.Recommend" src="/img/jian.svg" style="margin-left: 0.5rem;"><span class="panel_dataset_name">${dataset.Name}</span></div> | |||
| <div style="margin-top: 8px;display: flex;"> | |||
| <a :title="dataset.UserName" style="cursor: default;"> | |||
| <img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="dataset.RelAvatarLink"> | |||
| @@ -99,7 +99,7 @@ | |||
| <el-tab-pane label="{{.i18n.Tr "dataset.I_liked"}}" name="fourth"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(dataset,index) in myFavoriteDataset" :key="index"> | |||
| <div style="width: 90%;"> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><span class="panel_dataset_name">${dataset.Name}</span></div> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><img v-if="dataset.Recommend" src="/img/jian.svg" style="margin-left: 0.5rem;"><span class="panel_dataset_name">${dataset.Name}</span></div> | |||
| <div style="margin-top: 8px;display: flex;"> | |||
| <a :title="dataset.UserName" style="cursor: default;"> | |||
| <img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="dataset.RelAvatarLink"> | |||
| @@ -23,7 +23,7 @@ | |||
| <el-tab-pane label="{{.i18n.Tr "dataset.current_project"}}" name="first"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(dataset,index) in currentRepoDataset" :key="index"> | |||
| <div style="width: 90%;"> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias} </span><span class="panel_dataset_name">${dataset.Name} </span></div> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias} </span><img v-if="dataset.Recommend" src="/img/jian.svg" style="margin-left: 0.5rem;"><span class="panel_dataset_name">${dataset.Name} </span></div> | |||
| <div style="margin-top: 8px;display: flex;"> | |||
| <a :title="dataset.UserName" style="cursor: default;"> | |||
| <img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="dataset.RelAvatarLink"> | |||
| @@ -49,7 +49,7 @@ | |||
| <el-tab-pane label="{{.i18n.Tr "dataset.owner_dataset"}}" name="second"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(dataset,index) in myDataset" :key="index"> | |||
| <div style="width: 90%;"> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><span class="panel_dataset_name">${dataset.Name}</span></div> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><img v-if="dataset.Recommend" src="/img/jian.svg" style="margin-left: 0.5rem;"><span class="panel_dataset_name">${dataset.Name}</span></div> | |||
| <div style="margin-top: 8px;display: flex;"> | |||
| <a :title="dataset.UserName" style="cursor: default;"> | |||
| <img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="dataset.RelAvatarLink"> | |||
| @@ -74,7 +74,7 @@ | |||
| <el-tab-pane label="{{.i18n.Tr "dataset.public_dataset"}}" name="third"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(dataset,index) in publicDataset" :key="index"> | |||
| <div style="width: 90%;"> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><span class="panel_dataset_name">${dataset.Name}</span></div> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><img v-if="dataset.Recommend" src="/img/jian.svg" style="margin-left: 0.5rem;"><span class="panel_dataset_name">${dataset.Name}</span></div> | |||
| <div style="margin-top: 8px;display: flex;"> | |||
| <a :title="dataset.UserName" style="cursor: default;"> | |||
| <img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="dataset.RelAvatarLink"> | |||
| @@ -99,7 +99,7 @@ | |||
| <el-tab-pane label="{{.i18n.Tr "dataset.I_liked"}}" name="fourth"> | |||
| <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(dataset,index) in myFavoriteDataset" :key="index"> | |||
| <div style="width: 90%;"> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><span class="panel_dataset_name">${dataset.Name}</span></div> | |||
| <div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><img v-if="dataset.Recommend" src="/img/jian.svg" style="margin-left: 0.5rem;"><span class="panel_dataset_name">${dataset.Name}</span></div> | |||
| <div style="margin-top: 8px;display: flex;"> | |||
| <a :title="dataset.UserName" style="cursor: default;"> | |||
| <img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="dataset.RelAvatarLink"> | |||
| @@ -145,7 +145,8 @@ | |||
| <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> | |||
| <a href="{{.Repo.Link}}/datasets" style="font-size: 12px;color: #3291F8;height: 24px;">{{.Repo.OwnerName}} / {{.Repo.Alias}}{{if .Recommend}}<img src="/img/jian.svg" style="margin-left: 0.5rem;">{{end}}</a> | |||
| {{if $.IsSigned}} | |||
| <span style="display: flex;align-items: center;justify-content: flex-end;cursor: pointer;" @click.stop="postSquareStar({{.ID}},'{{.Repo.Link}}/datasets',{{$k}})"> | |||
| <div style="line-height: 1;margin-right: 4px;margin-bottom: -2px;"> | |||
| @@ -1,6 +1,7 @@ | |||
| <template> | |||
| <div> | |||
| <div > | |||
| <div class="ui container" style="width: 80%;"> | |||
| <div class="ui grid"> | |||
| <div class="row" style="border: 1px solid #d4d4d5;margin-top: 15px;padding-top: 0;"> | |||
| <div class="ui attached segment"> | |||
| @@ -11,12 +12,10 @@ | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <el-row style="padding: 1rem;"> | |||
| <el-col :span="2" style="margin-right: 1rem;"> | |||
| <el-checkbox v-model="checked" style="padding: 0.5rem 1rem;">仅显示平台推荐</el-checkbox> | |||
| </el-col> | |||
| <el-col :span="6"> | |||
| <el-dropdown @command="handleCommand" trigger="click" style="border: 1px solid rgba(34,36,38,.15);border-radius: 4px;padding: 0.5rem 1rem;"> | |||
| <div class="ui ten wide column" style="margin: 1rem 0;"> | |||
| <el-checkbox v-model="checked" style="padding: 0.5rem 1rem;">仅显示平台推荐</el-checkbox> | |||
| <el-dropdown @command="handleCommand" trigger="click" style="border: 1px solid rgba(34,36,38,.15);border-radius: 4px;padding: 0.5rem 1rem;"> | |||
| <span class="el-dropdown-link"> | |||
| {{dropdownPrivate}}<i class="el-icon-caret-bottom el-icon--right"></i> | |||
| </span> | |||
| @@ -25,10 +24,12 @@ | |||
| <el-dropdown-item :command="{label:'公开',private:false}">公开</el-dropdown-item> | |||
| <el-dropdown-item :command="{label:'公开',private:true}">私有</el-dropdown-item> | |||
| </el-dropdown-menu> | |||
| </el-dropdown> | |||
| </el-col> | |||
| </el-row> | |||
| <el-row> | |||
| </el-dropdown> | |||
| </div> | |||
| <div class="ui six wide column right aligned" style="margin: 1rem 0;"> | |||
| <a class="ui blue small button" href="/admin/images/commit_image">创建云脑镜像</a> | |||
| </div> | |||
| <div class="ui sixteen wide column" style="padding: 0;"> | |||
| <el-table | |||
| :data="tableDataCustom" | |||
| style="width: 100%" | |||
| @@ -138,7 +139,7 @@ | |||
| </template> | |||
| </el-table-column> | |||
| </el-table> | |||
| </el-row> | |||
| </div> | |||
| <div class="ui container" style="padding:2rem 0;text-align:center"> | |||
| <el-pagination | |||
| background | |||
| @@ -152,6 +153,7 @@ | |||
| </el-pagination> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -86,7 +86,7 @@ export default async function initImage(){ | |||
| success:function(res){ | |||
| console.log(res) | |||
| if(res.Code===1){ | |||
| $('.ui.info.message').text(res.Message).show().delay(1500).fadeOut(); | |||
| $('.ui.negative.message').text(res.Message).show().delay(2500).fadeOut(); | |||
| }else if(res.Code==0){ | |||
| if(location.href.indexOf('imageAdmin')!==-1){ | |||
| location.href = `${window.config.AppSubUrl}/admin/images` | |||
| @@ -135,7 +135,6 @@ export default async function initImage(){ | |||
| postData.place = $("input[name='place']").val() | |||
| } | |||
| let formData = $params(postData) | |||
| console.log(formData) | |||
| if($("input[name='edit']").val()=="edit"){ | |||
| postImage(formData) | |||
| } | |||
| @@ -163,7 +162,7 @@ export default async function initImage(){ | |||
| } | |||
| }) | |||
| } | |||
| return false | |||
| }) | |||
| $('#cancel_submit_image').click(()=>{ | |||
| if(link.includes('cloudbrain')){ | |||
| @@ -3702,6 +3702,32 @@ function initVueEditAbout() { | |||
| } | |||
| function initVueDataset() { | |||
| $('.set_dataset').on('click', function(){ | |||
| const $this = $(this); | |||
| let link = $this.data('url') | |||
| $.ajax({ | |||
| url:link, | |||
| type:'PUT', | |||
| success:function(res){ | |||
| console.log(res) | |||
| if(res.Code==0){ | |||
| window.location.href = '/admin/datasets' | |||
| }else{ | |||
| $('.ui.negative.message').text(res.Message).show().delay(1500).fadeOut(); | |||
| } | |||
| }, | |||
| error: function(xhr){ | |||
| // 隐藏 loading | |||
| // 只有请求不正常(状态码不为200)才会执行 | |||
| $('.ui.negative.message').html(xhr.responseText).show().delay(1500).fadeOut(); | |||
| console.log(xhr) | |||
| }, | |||
| complete:function(xhr){ | |||
| // $("#mask").css({"display":"none","z-index":"1"}) | |||
| } | |||
| }) | |||
| }); | |||
| const el = document.getElementById('dataset-base'); | |||
| if (!el) { | |||
| return; | |||