Skip to content

Commit

Permalink
Dashboards can now be locked as well, fixed option set bug when addin…
Browse files Browse the repository at this point in the history
…g to solution
  • Loading branch information
Florian Krönert authored and Florian Krönert committed Apr 8, 2020
1 parent 157b15f commit aec4763
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/js/Translator/FormHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@
queryParams: "?$filter=objecttypecode eq '" + entityName.toLowerCase() + "' and iscustomizable/Value eq true and formactivationstate eq 1"
};

if (entityName.toLowerCase() === "none") {
if (entityName.toLowerCase() === "dashboard") {
formRequest.queryParams = "?$filter=formactivationstate eq 1 and iscustomizable/Value eq true and (type eq 0 or type eq 10)"
}

Expand Down Expand Up @@ -464,15 +464,15 @@
.then(function (response){
XrmTranslator.LockGrid("Publishing");
var entityName = XrmTranslator.GetEntity();
if (entityName.toLowerCase() === "none") {
if (entityName.toLowerCase() === "dashboard") {
return XrmTranslator.PublishDashboard([{ recid: XrmTranslator.metadata.formid }]);
}
else {
return XrmTranslator.Publish();
}
})
.then(function(response) {
if (XrmTranslator.GetEntity().toLowerCase() === "none") {
if (XrmTranslator.GetEntity().toLowerCase() === "dashboard") {
// Dashboards can't be added with defined componenent settings or DoNotIncludeSubcomponents flag set to true
return XrmTranslator.AddToSolution([XrmTranslator.metadata.formid], XrmTranslator.ComponentType.SystemForm, true, true);
}
Expand Down
6 changes: 3 additions & 3 deletions src/js/Translator/FormMetaHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
queryParams: "?$filter=objecttypecode eq '" + entityName.toLowerCase() + "' and iscustomizable/Value eq true and formactivationstate eq 1"
};

if (entityName.toLowerCase() === "none") {
if (entityName.toLowerCase() === "dashboard") {
formRequest.queryParams = "?$filter=formactivationstate eq 1 and iscustomizable/Value eq true and (type eq 0 or type eq 10)"
}

Expand Down Expand Up @@ -191,15 +191,15 @@
.then(function (response){
XrmTranslator.LockGrid("Publishing");
var entityName = XrmTranslator.GetEntity();
if (entityName.toLowerCase() === "none") {
if (entityName.toLowerCase() === "dashboard") {
return XrmTranslator.PublishDashboard(updates);
}
else {
return XrmTranslator.Publish();
}
})
.then(function(response) {
if (XrmTranslator.GetEntity().toLowerCase() === "none") {
if (XrmTranslator.GetEntity().toLowerCase() === "dashboard") {
return XrmTranslator.AddToSolution(updates.map(u => u.recid), XrmTranslator.ComponentType.SystemForm, true, true);
}
else {
Expand Down
2 changes: 1 addition & 1 deletion src/js/Translator/OptionSetHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
var recordId = GetRecordId(record.recid);
var attribute = XrmTranslator.GetAttributeById (recordId);

if (attribute.GlobalOptionSet) {
if (attribute.GlobalOptionSet && attribute.GlobalOptionSet.IsGlobal) {
if (globalOptionSets.indexOf(attribute.GlobalOptionSet.MetadataId) === -1) {
globalOptionSets.push(attribute.GlobalOptionSet.MetadataId);
globalOptionSetNames.push(attribute.GlobalOptionSet.Name);
Expand Down
10 changes: 5 additions & 5 deletions src/js/Translator/XrmTranslator.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@

const entity = XrmTranslator.GetEntity().toLowerCase();

if (!entity || entity === "none") {
if (!entity) {
return Promise.resolve(null);
}

Expand Down Expand Up @@ -717,7 +717,7 @@
}

function ReleaseLock(entity) {
if (!entity || entity.toLowerCase() === "none") {
if (!entity) {
return Promise.resolve(null);
}

Expand Down Expand Up @@ -784,7 +784,7 @@
}

function LockAndLoad (entity, lock) {
if (XrmTranslator.config.enableLocking && entity && entity.toLowerCase() !== "none") {
if (XrmTranslator.config.enableLocking && entity) {
IsLockedForUser(entity)
.then(function(alreadyLockedByUser) {
if(alreadyLockedByUser || lock || confirm("Do you want to lock this entity for translating? If you do not, it will be readonly.")) {
Expand Down Expand Up @@ -846,7 +846,7 @@
}
},
items: [
{ id: 'none', text: 'Dashboard' },
{ id: 'dashboard', text: 'Dashboard' },
{ text: '--' }
]
},
Expand Down Expand Up @@ -939,7 +939,7 @@
var target = event.target;

if (target.startsWith("entitySelect:")) {
if (target === "entitySelect:none") { //Dashboard click
if (target === "entitySelect:dashboard") { //Dashboard click
w2ui['grid_toolbar'].disable('type:attributes');
w2ui['grid_toolbar'].disable('type:options');
w2ui['grid_toolbar'].disable('type:views');
Expand Down

0 comments on commit aec4763

Please sign in to comment.