protected updateInternal()

in src/SfxWeb/src/app/Models/DataModels/collections/RepairTaskCollection.ts [30:77]


    protected updateInternal(): Observable<any> {
        let longRunningApprovalRepairTask: RepairTask = null;
        let longRunningExecutingRepairTask: RepairTask = null;

        this.repairTasks = [];
        this.completedRepairTasks = [];

        this.collection.forEach(task => {
            if (task.inProgress) {
                this.repairTasks.push(task);
                const executingPhase = task.getPhase('Executing');
                const approving = task.getPhase('Approved');

                // set the longest approving job if executing has no timestamp but approving does
                // showing that the current phase is in approving
                if (executingPhase.timestamp === '' &&
                    approving.timestamp !== RepairTask.NonStartedTimeStamp &&
                    (!longRunningApprovalRepairTask ||
                        approving.durationMilliseconds > longRunningApprovalRepairTask.getPhase('Approved').durationMilliseconds)) {
                        longRunningApprovalRepairTask = task;
                }

                if (task.raw.State === RepairTask.ExecutingStatus &&
                   (!longRunningExecutingRepairTask ||
                        executingPhase.durationMilliseconds > longRunningExecutingRepairTask.getPhase('Executing').durationMilliseconds)) {
                            longRunningExecutingRepairTask = task;
                }
            } else {
                this.completedRepairTasks.push(task);
            }
        });

        this.longRunningApprovalJob = longRunningApprovalRepairTask;
        this.longestExecutingJob = longRunningExecutingRepairTask;

        if (longRunningApprovalRepairTask && longRunningApprovalRepairTask.getPhase('Approved').durationMilliseconds > RepairTaskCollection.minDurationApprovalbanner) {
            this.data.warnings.addOrUpdateNotification({
                message: `Action Required: There is a repair job (${longRunningApprovalRepairTask.id}) waiting for approval for ${longRunningApprovalRepairTask.displayDuration}. This can block updates to this cluster. Please see aka.ms/sflongapprovingjob for more information. `,
                level: StatusWarningLevel.Warning,
                priority: 4,
                id: RepairTaskCollection.bannerApprovalId,
            }, true);
        } else {
            this.data.warnings.removeNotificationById(RepairTaskCollection.bannerApprovalId);
        }

        return of(null);
    }