- Add CloudronStack/output/CloudronPackages-Artifacts/tirreno/ directory and its contents - Includes package manifest, Dockerfile, source code, documentation, and build artifacts - Add tirreno-1761840148.tar.gz as a build artifact - Add tirreno-cloudron-package-1761841304.tar.gz as the Cloudron package - Include all necessary files for the tirreno Cloudron package This adds the complete tirreno Cloudron package artifacts to the repository.
		
			
				
	
	
		
			85 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			85 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import {Loader} from './Loader.js?v=2';
 | 
						|
import {handleAjaxError} from './utils/ErrorHandler.js?v=2';
 | 
						|
import {fireEvent} from './utils/Event.js?v=2';
 | 
						|
 | 
						|
export class DashboardTile {
 | 
						|
 | 
						|
    constructor(tilesParams) {
 | 
						|
        const me = this;
 | 
						|
        this.config = tilesParams;
 | 
						|
 | 
						|
        this.loader = new Loader();
 | 
						|
 | 
						|
        if (!this.config.sequential) {
 | 
						|
            const onDateFilterChanged = this.onDateFilterChanged.bind(this);
 | 
						|
            window.addEventListener('dateFilterChanged', onDateFilterChanged, false);
 | 
						|
 | 
						|
            this.initLoad();
 | 
						|
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    startLoader() {
 | 
						|
        const el = document.querySelector(`.${this.config.mode} .title`);
 | 
						|
        this.loader.start(el);
 | 
						|
    }
 | 
						|
 | 
						|
    loadData() {
 | 
						|
        const me     = this;
 | 
						|
        const token  = document.head.querySelector('[name=\'csrf-token\'][content]').content;
 | 
						|
 | 
						|
        let params   = this.config.getParams().dateRange;
 | 
						|
        params.mode  = this.config.mode;
 | 
						|
 | 
						|
        if (!this.config.sequential) {
 | 
						|
            this.startLoader();
 | 
						|
        }
 | 
						|
 | 
						|
        fireEvent('dateFilterChangedCaught');
 | 
						|
 | 
						|
        $.ajax({
 | 
						|
            url: `/admin/loadDashboardStat?token=${token}`,
 | 
						|
            type: 'get',
 | 
						|
            scope: me,
 | 
						|
            data: params,
 | 
						|
            success: me.onLoad,
 | 
						|
            error: handleAjaxError,
 | 
						|
            complete: function() {
 | 
						|
                fireEvent('dateFilterChangedCompleted');
 | 
						|
            },
 | 
						|
        });
 | 
						|
    }
 | 
						|
 | 
						|
    onLoad(data, status) {
 | 
						|
        if ('success' == status) {
 | 
						|
            this.scope.loader.stop();
 | 
						|
 | 
						|
            const frag = document.createDocumentFragment();
 | 
						|
 | 
						|
            const period = document.createElement('p');
 | 
						|
            if (this.scope.config.mode === 'totalUsersForReview') {
 | 
						|
                period.className = 'periodTotalYellow';
 | 
						|
            } else if (this.scope.config.mode === 'totalBlockedUsers') {
 | 
						|
                period.className = 'periodTotalRed';
 | 
						|
            } else {
 | 
						|
                period.className = 'periodTotal';
 | 
						|
            }
 | 
						|
            period.textContent = data.total;
 | 
						|
 | 
						|
            const total = document.createElement('p');
 | 
						|
            total.className = 'allTimeTotal';
 | 
						|
            total.textContent = data.allTimeTotal;
 | 
						|
 | 
						|
            frag.appendChild(period);
 | 
						|
            frag.appendChild(total);
 | 
						|
 | 
						|
            const el = document.querySelector(`.${this.scope.config.mode} .title`);
 | 
						|
            el.replaceChildren(frag);
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    onDateFilterChanged() {
 | 
						|
        this.loadData();
 | 
						|
    }
 | 
						|
}
 |