File size: 1,429 Bytes
6b6d936
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
/////////////////////////////////////////////////////////////
//
// pgAdmin 4 - PostgreSQL Tools
//
// Copyright (C) 2013 - 2024, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////

import React from 'react';
import gettext from 'sources/gettext';
import pgAdmin from 'sources/pgadmin';
import AboutComponent from './AboutComponent';
import current_user from 'pgadmin.user_management.current_user';

class About {
  static instance;

  static getInstance(...args) {
    if (!About.instance) {
      About.instance = new About(...args);
    }
    return About.instance;
  }

  init() {
    if (this.initialized)
      return;
    this.initialized = true;
  }

  // This is a callback function to show about dialog.
  about_show() {
    let dlgHeight = 470,
      dlgWidth = 750;

    if(!current_user.is_admin && pgAdmin.server_mode) {
      dlgWidth = pgAdmin.Browser.stdW.md;
      dlgHeight = 300;
    }

    // Render About component
    pgAdmin.Browser.notifier.showModal(gettext('About %s', pgAdmin.Browser.utils.app_name), () => {
      return <AboutComponent />;
    }, { isFullScreen: false, isResizeable: true, showFullScreen: true,
      isFullWidth: true, dialogWidth: dlgWidth, dialogHeight: dlgHeight, minHeight: dlgHeight
    });
  }
}

pgAdmin.About = About.getInstance();

module.exports = {
  About: About,
};