Skip to content

Commit

Permalink
Merge pull request #15 from delegateas/DisplayNameColumn
Browse files Browse the repository at this point in the history
Display name column
  • Loading branch information
Ahmad Sattar authored Jan 19, 2020
2 parents b40330f + 9724f84 commit 254ca91
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 26 deletions.
6 changes: 3 additions & 3 deletions DeprecationTool/CustomControls/CheckBoxListView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public enum CheckState {
public CheckBoxListView()
{

Bitmap intermediatestate = new Bitmap(16, 16);
CheckBoxRenderer.DrawCheckBox(Graphics.FromImage(intermediatestate), new Point(0, 3), System.Windows.Forms.VisualStyles.CheckBoxState.MixedNormal);
Bitmap indeterminate = new Bitmap(16, 16);
CheckBoxRenderer.DrawCheckBox(Graphics.FromImage(indeterminate), new Point(0, 3), System.Windows.Forms.VisualStyles.CheckBoxState.MixedNormal);

Bitmap uncheckedstate = new Bitmap(16, 16);
CheckBoxRenderer.DrawCheckBox(Graphics.FromImage(uncheckedstate), new Point(0, 3), System.Windows.Forms.VisualStyles.CheckBoxState.UncheckedNormal);
Expand All @@ -33,7 +33,7 @@ public CheckBoxListView()

CheckStates.Images.Add(Deprecate.UNCHECKED, uncheckedstate);
CheckStates.Images.Add(Deprecate.CHECKED, checkedstate);
CheckStates.Images.Add(Deprecate.INDETERMINATE, intermediatestate);
CheckStates.Images.Add(Deprecate.INDETERMINATE, indeterminate);

SmallImageList = CheckStates;
}
Expand Down
2 changes: 1 addition & 1 deletion DeprecationTool/DeprecateControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ private Deprecate.MetaDataWithCheck[] FieldsWithCheckedState()
.Select((item, i) =>
new Deprecate.MetaDataWithCheck(
(Deprecate.MetaData) item.Tag,
(Deprecate.DeprecationState) item.ImageIndex)
Deprecate.CheckBoxLiteralToDeprecationState(item.ImageKey))
)
.ToArray();
return attrWithCheckedState;
Expand Down
19 changes: 8 additions & 11 deletions Lib/Deprecate.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ module Deprecate =
| DeprecationState.Favored -> UNCHECKED
| DeprecationState.Deprecated -> CHECKED
| DeprecationState.Partial -> INDETERMINATE

| _ -> failwith "unexpected state"

let CheckBoxLiteralToDeprecationState = function
| x when x = UNCHECKED -> DeprecationState.Favored
| x when x = CHECKED -> DeprecationState.Deprecated
| x when x = INDETERMINATE -> DeprecationState.Partial
| _ -> failwith "unexpected literal"

type LogicalName = string

let labelToString (label: Label) =
Expand Down Expand Up @@ -70,21 +77,16 @@ module Deprecate =
deprecationState: DeprecationState
}

// type ResDict = IDictionary<String, IDictionary<string, MetaData[]>>

type EntityMetaDataMap = Map<LogicalName, MetaData[]>

type SolutionMetaDataMap = Map<LogicalName, EntityMetaDataMap>


type Action = Deprecate of Data: MetaData
| Favor of Data : MetaData


let deprecationStampPattern =
@"\n(\(Deprecated:)\s(?<date>\d{2,}\/\d{2,}\/\d{4,}\s\d{2,}.\d{2,}.\d{2,})(,\ssearch:\s(?<searchable>1|0))?(\))"


let startsWithPrefix (text: string) prefix =
text.StartsWith(prefix, true, CultureInfo.InvariantCulture)

Expand Down Expand Up @@ -118,7 +120,6 @@ module Deprecate =
| x when (isPartiallyDeprecated x prefix) -> DeprecationState.Partial
| _ -> DeprecationState.Favored


let getResponse<'T when 'T :> OrganizationResponse> (proxy:IOrganizationService) request =
(proxy.Execute(request)) :?> 'T

Expand Down Expand Up @@ -158,7 +159,6 @@ module Deprecate =

(resp.EntityMetadata.LogicalName, filteredMetaData)


let internal retrieveMultiple proxy logicalName (query:QueryExpression) =
query.PageInfo <- PagingInfo()

Expand All @@ -176,7 +176,6 @@ module Deprecate =
}
retrieveMultiple' proxy query 1 null


let internal getEntitiesFilter
proxy (logicalName:string)
(cols:string list) (filter:Map<string,obj>) =
Expand Down Expand Up @@ -262,7 +261,6 @@ module Deprecate =
then displayName.[prefixLength..]
else displayName


let executeRequests (proxy: IOrganizationService) (reqs: OrganizationRequest[]) =
let req = ExecuteMultipleRequest()
req.Requests <- OrganizationRequestCollection()
Expand All @@ -280,7 +278,6 @@ module Deprecate =

resp


(* An attribute is deprecated when
1. The display name has been prepended with a deprecation prefix, such as "zz_"
2. Searchable is set to no (IsValidForAdvancedFind)
Expand Down
19 changes: 8 additions & 11 deletions Lib/deprecate.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ module Deprecate =
| DeprecationState.Favored -> UNCHECKED
| DeprecationState.Deprecated -> CHECKED
| DeprecationState.Partial -> INDETERMINATE

| _ -> failwith "unexpected state"

let CheckBoxLiteralToDeprecationState = function
| x when x = UNCHECKED -> DeprecationState.Favored
| x when x = CHECKED -> DeprecationState.Deprecated
| x when x = INDETERMINATE -> DeprecationState.Partial
| _ -> failwith "unexpected literal"

type LogicalName = string

let labelToString (label: Label) =
Expand Down Expand Up @@ -70,21 +77,16 @@ module Deprecate =
deprecationState: DeprecationState
}

// type ResDict = IDictionary<String, IDictionary<string, MetaData[]>>

type EntityMetaDataMap = Map<LogicalName, MetaData[]>

type SolutionMetaDataMap = Map<LogicalName, EntityMetaDataMap>


type Action = Deprecate of Data: MetaData
| Favor of Data : MetaData


let deprecationStampPattern =
@"\n(\(Deprecated:)\s(?<date>\d{2,}\/\d{2,}\/\d{4,}\s\d{2,}.\d{2,}.\d{2,})(,\ssearch:\s(?<searchable>1|0))?(\))"


let startsWithPrefix (text: string) prefix =
text.StartsWith(prefix, true, CultureInfo.InvariantCulture)

Expand Down Expand Up @@ -118,7 +120,6 @@ module Deprecate =
| x when (isPartiallyDeprecated x prefix) -> DeprecationState.Partial
| _ -> DeprecationState.Favored


let getResponse<'T when 'T :> OrganizationResponse> (proxy:IOrganizationService) request =
(proxy.Execute(request)) :?> 'T

Expand Down Expand Up @@ -158,7 +159,6 @@ module Deprecate =

(resp.EntityMetadata.LogicalName, filteredMetaData)


let internal retrieveMultiple proxy logicalName (query:QueryExpression) =
query.PageInfo <- PagingInfo()

Expand All @@ -176,7 +176,6 @@ module Deprecate =
}
retrieveMultiple' proxy query 1 null


let internal getEntitiesFilter
proxy (logicalName:string)
(cols:string list) (filter:Map<string,obj>) =
Expand Down Expand Up @@ -262,7 +261,6 @@ module Deprecate =
then displayName.[prefixLength..]
else displayName


let executeRequests (proxy: IOrganizationService) (reqs: OrganizationRequest[]) =
let req = ExecuteMultipleRequest()
req.Requests <- OrganizationRequestCollection()
Expand All @@ -280,7 +278,6 @@ module Deprecate =

resp


(* An attribute is deprecated when
1. The display name has been prepended with a deprecation prefix, such as "zz_"
2. Searchable is set to no (IsValidForAdvancedFind)
Expand Down

0 comments on commit 254ca91

Please sign in to comment.