Project

General

Profile

« Previous | Next » 

Revision 51417

1. Parameter url 'communityId' added (or adjusted) in every page and link to page.
2. loading.gif added in assets folder.
3. Loading and Error Messages added in pages for: Community (not community-edit-form folder), Entity, Page, DivId, PageHelpContent, DivHelpContent and their forms.

View differences:

page-form.component.ts
20 20
    @Input('type')
21 21
    public type: string;
22 22

  
23
    public errorMessage: string;
23
    //public errorMessage: string;
24 24

  
25 25
    public allEntities: Map<Entity, boolean> = new Map<Entity, boolean>();
26 26
    private gotEntities: boolean = false;
27 27
    public properties:EnvProperties = null;
28 28

  
29
    public showLoading: boolean = false;
30
    public errorMessage: string = '';
31

  
29 32
    constructor(private route: ActivatedRoute,public _fb: FormBuilder, private _helpContentService: HelpContentService){}
30 33

  
31 34
    ngOnInit(): void {
......
64 67
    }
65 68

  
66 69
    public getEntities(includedEntities: Set<String>) {
67
      let self = this;
70
      this.showLoading = true;
71
      this.errorMessage = "";
72

  
68 73
      this._helpContentService.getEntities(this.properties.adminToolsAPIURL).subscribe(
69 74
        entities => {
70 75
            for(let entity of entities) {
71 76
              if(includedEntities.has(entity._id)) {
72
                self.allEntities.set(entity, true);
77
                this.allEntities.set(entity, true);
73 78
              } else {
74
                self.allEntities.set(entity, false);
79
                this.allEntities.set(entity, false);
75 80
              }
76 81
            }
82
            this.showLoading = false;
77 83
      },
78 84
      error => this.handleError('System error retrieving community entities', error));
79 85
    }
......
100 106
            name : '',
101 107
            type: '',
102 108
            isEnabled: '',
103
            //entities: this._fb.array([]),
104 109
            _id : '',
105 110
            isCollapsed: [true]
106 111
        });
......
118 123
      this.myForm.setControl('entities', entityFormArray);
119 124
    }
120 125

  
121
    addEntity() {
122
      this.myForm.value.entities.push(this._fb.group(new Entity()));
123
    }
124

  
125 126
    public toggleEntity(status : boolean, id : string, entity: Entity) {
126 127
      let index: number = -1;
127 128
      for(let i=0; i<this.myForm.get('entities').value.length; i++) {
......
130 131
          break;
131 132
        }
132 133
      }
133
      console.info("status: "+status + "   index: "+index);
134 134

  
135 135
      this.allEntities.set(entity, status);
136 136

  
137 137
      if(status && index<0) {
138 138
        this.myForm.value.entities.push(entity);
139
        console.info("push :   "+this.myForm.value.entities.length);
140 139
      } else  if(!status){
141 140
        if(index >= 0) {
142 141
          this.myForm.value.entities.splice(index, 1);
143
          console.info("delete :   "+this.myForm.value.entities.length);
144 142
        }
145 143
      }
146
/*
147
      this._helpContentService.toggleEntityOfPage(this.myForm.value._id,id,status).subscribe(
148
          () => {
149

  
150
          },
151
          error => this.handleError('System error changing the status of the enity of page', error)
152
      );
153
*/
154 144
    }
155 145

  
156 146
    handleError(message: string, error) {
157
        if(error == null) {
158
            this.reset();
159
        }
160
        this.errorMessage = message + ' (Server responded: ' + error + ')';
147
        this.errorMessage = message;
148
        console.log('Server responded: ' + error);
149
        this.showLoading = false;
161 150
    }
162 151
}

Also available in: Unified diff