hongji.li
2023-11-07 1a1ba3ad5ed9e4380185aa1ccad20204a0e5f115
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Quintiq file version 2.0
#parent: #root
Method SetSanityCheckButtonDisplay (
  internal[WebButton] button
) id:Method_ApplicationMacroPlanner_SetSanityCheckButtonDisplay
{
  #keys: '[137862.0.600840475]'
  Body:
  [*
    // Update the sanity check button
    
    badgecolor := ''
    tooltips := Translations::MP_SanityCheck_Passed();
    highestseverity := MacroPlan.SanityCheckHighestSeverity();
    badge := '';
    msgcount := MacroPlan.SanityCheckHighestSeverityMsgCount();
    textcolor := 'White';
    
    if(  msgcount > 0 )
    {
      badge := guard( [String]msgcount , '' );
    }
    
    if( guard( [Number]highestseverity, -1 ) <> 0 )
    {
      //different color for different most severe violation level
      if( highestseverity = SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue() )
      {
        badgecolor := 'Red'
      }
      else if( highestseverity = SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning() )
      {
        badgecolor := 'Purple'
      }
      else if( highestseverity = SanityCheckCategoryLevel::GetSanityCheckCategoryPlanningIssue() )
      {
        badgecolor := 'Orange'
      }
      else if( highestseverity = SanityCheckCategoryLevel::GetSanityCheckCategoryPlanningWarning() )
      {
        badgecolor := 'Yellow'
        textcolor := 'Black'
      }
      else if( highestseverity = SanityCheckCategoryLevel::GetSanityCheckCategoryUnclassifiedError() )
      {
        badgecolor := 'Cyan'
        textcolor := 'Black'
      }
      tooltips := Translations::MP_SanityCheck_Failed( MacroPlan.MostSevereSanityCheckCategoryLevel() );
    }
                     
    button.Tooltip( tooltips );
    button.Badge( badge );
    button.BadgeBackgroundColor( badgecolor );
    button.BadgeTextColor( textcolor );
                            
    ApplicationMacroPlanner.SetOptimizerButtonDisplay();
  *]
}