U4-7551 New Content type editor dialog to select an editor for a property type needs the "Default" and "Reuse" tab functionality changed
Removes unused/non-required methods from data type controller/service.
This commit is contained in:
@@ -114,28 +114,8 @@ function dataTypeResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
"GetAll")),
|
||||
"Failed to retrieve data");
|
||||
},
|
||||
|
||||
getAllUserConfigured: function () {
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"dataTypeApiBaseUrl",
|
||||
"GetAllUserConfigured")),
|
||||
"Failed to retrieve data");
|
||||
},
|
||||
|
||||
getAllUserPropertyEditors: function () {
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"dataTypeApiBaseUrl",
|
||||
"GetAllUserPropertyEditors")),
|
||||
"Failed to retrieve data");
|
||||
},
|
||||
|
||||
getAllTypesAndEditors : function(){
|
||||
|
||||
getGroupedPropertyEditors : function(){
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
{
|
||||
active: true,
|
||||
id: 1,
|
||||
label: "Default",
|
||||
label: "Available Editors",
|
||||
alias: "Default",
|
||||
typesAndEditors: []
|
||||
},
|
||||
{
|
||||
active: false,
|
||||
id: 2,
|
||||
label: "Reuse",
|
||||
label: "Re-use",
|
||||
alias: "Reuse",
|
||||
userConfigured: []
|
||||
}
|
||||
@@ -41,14 +41,14 @@
|
||||
|
||||
function activate() {
|
||||
|
||||
getAllUserConfiguredDataTypes();
|
||||
getAllTypesAndEditors();
|
||||
getAllDataTypes();
|
||||
getGroupedPropertyEditors();
|
||||
|
||||
}
|
||||
|
||||
function getAllTypesAndEditors() {
|
||||
function getGroupedPropertyEditors() {
|
||||
|
||||
dataTypeResource.getAllTypesAndEditors().then(function(data){
|
||||
dataTypeResource.getGroupedPropertyEditors().then(function(data){
|
||||
vm.tabs[0].typesAndEditors = data;
|
||||
vm.tabsLoaded = vm.tabsLoaded + 1;
|
||||
checkIfTabContentIsLoaded();
|
||||
@@ -56,9 +56,9 @@
|
||||
|
||||
}
|
||||
|
||||
function getAllUserConfiguredDataTypes() {
|
||||
function getAllDataTypes() {
|
||||
|
||||
dataTypeResource.getAllUserConfigured().then(function(data){
|
||||
dataTypeResource.getAll().then(function (data) {
|
||||
vm.tabs[1].userConfigured = data;
|
||||
vm.tabsLoaded = vm.tabsLoaded + 1;
|
||||
checkIfTabContentIsLoaded();
|
||||
|
||||
@@ -285,48 +285,6 @@ namespace Umbraco.Web.Editors
|
||||
.Select(Mapper.Map<IDataTypeDefinition, DataTypeBasic>).Where(x => x.IsSystemDataType == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content json for all data types added by the user
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// Permission is granted to this method if the user has access to any of these sections: Content, media, settings, developer, members
|
||||
/// </remarks>
|
||||
[UmbracoApplicationAuthorize(
|
||||
Constants.Applications.Content, Constants.Applications.Media, Constants.Applications.Members,
|
||||
Constants.Applications.Settings, Constants.Applications.Developer)]
|
||||
public IEnumerable<DataTypeBasic> GetAllUserConfigured()
|
||||
{
|
||||
//find all user configured for re-reference
|
||||
return Services.DataTypeService
|
||||
.GetAllDataTypeDefinitions()
|
||||
//TODO: This is pretty nasty :(
|
||||
.Where(x => x.Id > 1045)
|
||||
.Select(Mapper.Map<IDataTypeDefinition, DataTypeBasic>).Where(x => x.IsSystemDataType == false);
|
||||
|
||||
//find all custom editors added by non-core manifests
|
||||
|
||||
//find the rest
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content json for all user added property editors
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// Permission is granted to this method if the user has access to any of these sections: Content, media, settings, developer, members
|
||||
/// </remarks>
|
||||
[UmbracoTreeAuthorize(
|
||||
Constants.Applications.Content, Constants.Applications.Media, Constants.Applications.Members,
|
||||
Constants.Applications.Settings, Constants.Applications.Developer)]
|
||||
public IEnumerable<PropertyEditorBasic> GetAllUserPropertyEditors()
|
||||
{
|
||||
return PropertyEditorResolver.Current.PropertyEditors
|
||||
.OrderBy(x => x.Name)
|
||||
.Where(x => x.ValueEditor.View.IndexOf("app_plugins", StringComparison.InvariantCultureIgnoreCase) >= 0)
|
||||
.Select(Mapper.Map<PropertyEditorBasic>);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all configured data types and all potential data types that could exist based on unused property editors grouped
|
||||
/// by their property editor defined group.
|
||||
@@ -340,41 +298,17 @@ namespace Umbraco.Web.Editors
|
||||
Constants.Applications.Settings, Constants.Applications.Developer)]
|
||||
public IDictionary<string, IEnumerable<DataTypeBasic>> GetGroupedPropertyEditors()
|
||||
{
|
||||
var datadefs = Services.DataTypeService
|
||||
.GetAllDataTypeDefinitions()
|
||||
.ToArray();
|
||||
|
||||
var datatypes = new List<DataTypeBasic>();
|
||||
|
||||
//this is a very specific map - if a property editor does not have prevalue - and there is a datatype already using this type, return that.
|
||||
//also, we exclude all the system listviews from the list
|
||||
|
||||
var propertyEditors = PropertyEditorResolver.Current.PropertyEditors;
|
||||
foreach (var propertyEditor in propertyEditors)
|
||||
{
|
||||
var hasPrevalues = propertyEditor.PreValueEditor.Fields.Any();
|
||||
|
||||
//check if a data type exists for this property editor
|
||||
var dataDef = datadefs.FirstOrDefault(x => x.PropertyEditorAlias == propertyEditor.Alias);
|
||||
|
||||
//if no prevalues and a datatype exists with this property editor
|
||||
if (hasPrevalues == false && dataDef != null)
|
||||
{
|
||||
//exclude system list views
|
||||
if (dataDef.Name.InvariantStartsWith(Constants.Conventions.DataTypes.ListViewPrefix) == false)
|
||||
{
|
||||
datatypes.Add(Mapper.Map<DataTypeBasic>(dataDef));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//else, just add a clean property editor
|
||||
var basic = Mapper.Map<DataTypeBasic>(propertyEditor);
|
||||
basic.HasPrevalues = hasPrevalues;
|
||||
datatypes.Add(basic);
|
||||
}
|
||||
var basic = Mapper.Map<DataTypeBasic>(propertyEditor);
|
||||
basic.HasPrevalues = hasPrevalues;
|
||||
datatypes.Add(basic);
|
||||
}
|
||||
|
||||
|
||||
var grouped = datatypes
|
||||
.GroupBy(x => x.Group.IsNullOrWhiteSpace() ? "" : x.Group.ToLower())
|
||||
.ToDictionary(group => group.Key, group => group.AsEnumerable());
|
||||
|
||||
Reference in New Issue
Block a user