diff --git a/Bootstrap.Admin/Bootstrap.Admin.csproj b/Bootstrap.Admin/Bootstrap.Admin.csproj index 66401079..7c66fcef 100644 --- a/Bootstrap.Admin/Bootstrap.Admin.csproj +++ b/Bootstrap.Admin/Bootstrap.Admin.csproj @@ -43,6 +43,7 @@ 4 + diff --git a/Bootstrap.Admin/Content/css/tasks.css b/Bootstrap.Admin/Content/css/tasks.css index 04f5ff67..4df239f6 100644 --- a/Bootstrap.Admin/Content/css/tasks.css +++ b/Bootstrap.Admin/Content/css/tasks.css @@ -163,13 +163,28 @@ } .ui-sortable > li { - padding-left: 35px !important; + padding-left: 35px; position: relative; background: #f5f6f8; margin-bottom: 2px; - border-bottom: none !important; + border-bottom: none; } +.ui-sortable li.title { + font-size: 14px; + color: #0077de; + background-color: #b5f1b6; + padding: 10px 15px; +} + + .ui-sortable li.title:hover { + background-color: #b5f1b6; + } + + .ui-sortable li.title:first-child { + border-radius: 4px 4px 0 0; + } + .ui-sortable li.list-primary { border-left: 3px solid #41CAC0; } diff --git a/Bootstrap.Admin/Controllers/ProfilesController.cs b/Bootstrap.Admin/Controllers/ProfilesController.cs index 12ab1c78..5f506003 100644 --- a/Bootstrap.Admin/Controllers/ProfilesController.cs +++ b/Bootstrap.Admin/Controllers/ProfilesController.cs @@ -1,18 +1,38 @@ using Bootstrap.DataAccess; +using Longbow.Caching.Configuration; using Newtonsoft.Json.Linq; +using System.Collections.Generic; +using System.Linq; using System.Web.Http; - namespace Bootstrap.Admin.Controllers { + /// + /// + /// public class ProfilesController : ApiController { - // POST api/ + /// + /// + /// + /// + /// + [HttpPost] public bool Post([FromBody]JObject value) { //保存个性化设置 dynamic json = value; return DictHelper.SaveProfiles((string)json.name, (string)json.code, (string)json.category); } + /// + /// + /// + /// + [HttpGet] + public IEnumerable Get([FromUri]JObject value) + { + var section = CacheListSection.GetSection(); + return section.Items.Where(item => item.Enabled); + } } } \ No newline at end of file diff --git a/Bootstrap.Admin/Scripts/Profiles.js b/Bootstrap.Admin/Scripts/Profiles.js index de709913..99028c23 100644 --- a/Bootstrap.Admin/Scripts/Profiles.js +++ b/Bootstrap.Admin/Scripts/Profiles.js @@ -57,16 +57,40 @@ } }); - function listCache(options) { - options = $.extend({ url: '../../CacheList.axd' }, options); + var $sortable = $('#sortable'); + var listCacheUrl = function (options) { + options = $.extend({ clear: false }, options); + $sortable.html(''); + $.bc({ + url: Profiles.url, + method: 'GET', + swal: false, + callback: function (result) { + if (result && $.isArray(result)) { + $.each(result, function (index, item) { + listCache($.extend({ item: item, url: item.Url }, options)); + }); + } + } + }); + } + + var listCache = function (options) { + options = $.extend({ clear: false, key: '' }, options); + if (options.key != '') { + options.url = $.format(options.url, options.key); + } + if (options.clear) { + options.url += '&clear=clear'; + } $.bc({ url: options.url, swal: false, callback: function (result) { - if (result) { + if (result && options.key == '') { result = $.parseJSON(result); if ($.isArray(result)) { - var html = '
  • {2}{0}{3}
  • '; + var html = '
  • {2}{0}{3}
  • '; var content = result.sort(function (x, y) { return x.Key > y.Key ? 1 : -1; }).map(function (ele) { @@ -106,19 +130,22 @@ default: break; } - return $.format(html, ele.Interval, ele.Key, ele.Desc, ele.Value, css); + return $.format(html, ele.Interval, ele.Key, ele.Desc, ele.Value, css, options.url); }).join(''); - $('#sortable').html(content); + $sortable.append($.format('
  • {0}-{1}
  • ', options.item.Desc, options.item.Key)); + $sortable.append(content); + $('.tooltips').tooltip('destroy'); $('.tooltips').tooltip(); - $('#sortable .btn').click(function () { - listCache({ url: $.format('../../CacheList.axd?cacheKey={0}', $(this).attr('data-key')) }); - }); } } } }); } - listCache(); - $('#refreshCache').click(function () { listCache(); }); - $('#clearCache').click(function () { listCache({ url: '../../CacheList.axd?clear=clear' }); }); + $('#refreshCache').click(function () { listCacheUrl(); }).trigger('click'); + $('#clearCache').click(function () { listCacheUrl({ clear: true }); }); + $sortable.on('click', '.btn', function () { + console.log($(this).attr('data-key')); + listCache({ key: $(this).attr('data-key'), url: $(this).attr('data-url') }); + listCacheUrl(); + }); }) \ No newline at end of file diff --git a/Bootstrap.Admin/Web.config b/Bootstrap.Admin/Web.config index 4336fbab..af5e8dfc 100644 --- a/Bootstrap.Admin/Web.config +++ b/Bootstrap.Admin/Web.config @@ -54,6 +54,7 @@ +