@@ -7249,3 +7249,94 @@ export class WorkitemQueueCtrl extends entityCtrl<WorkitemQueue> {
72497249}
72507250
72517251
7252+ export class MailHistsCtrl extends entitiesCtrl < Role > {
7253+ constructor (
7254+ public $rootScope : ng . IRootScopeService ,
7255+ public $scope : ng . IScope ,
7256+ public $location : ng . ILocationService ,
7257+ public $routeParams : ng . route . IRouteParamsService ,
7258+ public $interval : ng . IIntervalService ,
7259+ public WebSocketClientService : WebSocketClientService ,
7260+ public api : api ,
7261+ public userdata : userdata
7262+ ) {
7263+ super ( $rootScope , $scope , $location , $routeParams , $interval , WebSocketClientService , api , userdata ) ;
7264+ this . autorefresh = true ;
7265+ console . debug ( "MailHistsCtrl" ) ;
7266+ this . basequery = { } ;
7267+ this . collection = "mailhist" ;
7268+ this . postloadData = this . processdata ;
7269+ this . baseprojection = { _type : 1 , name : 1 , _created : 1 , _modified : 1 , read : 1 , readcount : 1 , userid : 1 } ;
7270+ if ( this . userdata . data . MailHistsCtrl ) {
7271+ this . basequery = this . userdata . data . MailHistsCtrl . basequery ;
7272+ this . collection = this . userdata . data . MailHistsCtrl . collection ;
7273+ this . baseprojection = this . userdata . data . MailHistsCtrl . baseprojection ;
7274+ this . orderby = this . userdata . data . MailHistsCtrl . orderby ;
7275+ this . searchstring = this . userdata . data . MailHistsCtrl . searchstring ;
7276+ this . basequeryas = this . userdata . data . MailHistsCtrl . basequeryas ;
7277+ this . skipcustomerfilter = this . userdata . data . MailHistsCtrl . skipcustomerfilter ;
7278+ }
7279+ WebSocketClientService . onSignedin ( ( user : TokenUser ) => {
7280+ this . loadData ( ) ;
7281+ } ) ;
7282+ }
7283+ processdata ( ) {
7284+ if ( ! this . userdata . data . MailHistsCtrl ) this . userdata . data . MailHistsCtrl = { } ;
7285+ this . userdata . data . MailHistsCtrl . basequery = this . basequery ;
7286+ this . userdata . data . MailHistsCtrl . collection = this . collection ;
7287+ this . userdata . data . MailHistsCtrl . baseprojection = this . baseprojection ;
7288+ this . userdata . data . MailHistsCtrl . orderby = this . orderby ;
7289+ this . userdata . data . MailHistsCtrl . searchstring = this . searchstring ;
7290+ this . userdata . data . MailHistsCtrl . basequeryas = this . basequeryas ;
7291+ this . userdata . data . MailHistsCtrl . skipcustomerfilter = this . skipcustomerfilter ;
7292+ if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
7293+ }
7294+ }
7295+
7296+
7297+ export class MailHistCtrl extends entityCtrl < Base > {
7298+ constructor (
7299+ public $rootScope : ng . IRootScopeService ,
7300+ public $scope : ng . IScope ,
7301+ public $location : ng . ILocationService ,
7302+ public $routeParams : ng . route . IRouteParamsService ,
7303+ public $interval : ng . IIntervalService ,
7304+ public WebSocketClientService : WebSocketClientService ,
7305+ public api : api ,
7306+ public userdata : userdata
7307+ ) {
7308+ super ( $rootScope , $scope , $location , $routeParams , $interval , WebSocketClientService , api , userdata ) ;
7309+ console . debug ( "MailHist" ) ;
7310+ this . collection = "mailhist" ;
7311+ this . postloadData = this . processData ;
7312+ WebSocketClientService . onSignedin ( async ( user : TokenUser ) => {
7313+ if ( this . id !== null && this . id !== undefined ) {
7314+ await this . loadData ( ) ;
7315+ } else {
7316+ this . model = new Role ( ) ;
7317+ }
7318+ } ) ;
7319+ }
7320+ async processData ( ) : Promise < void > {
7321+ if ( this . model ) {
7322+ ( this . model as any ) . opened = ( this . model as any ) . opened . reverse ( ) ;
7323+ }
7324+ this . loading = false ;
7325+ if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
7326+ }
7327+
7328+ async submit ( ) : Promise < void > {
7329+ try {
7330+ if ( this . model . _id ) {
7331+ await NoderedUtil . UpdateOne ( { collectionname : this . collection , item : this . model } ) ;
7332+ } else {
7333+ this . model = await NoderedUtil . InsertOne ( { collectionname : this . collection , item : this . model } ) ;
7334+ }
7335+ this . $location . path ( "/MailHists" ) ;
7336+ } catch ( error ) {
7337+ console . error ( error ) ;
7338+ this . errormessage = error . message ? error . message : error ;
7339+ }
7340+ if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
7341+ }
7342+ }
0 commit comments