Esempio n. 1
0
    def get_layout(self):
        '''
        returns:-
            QGridLayout : Anything that needs to be displayed as a screen, this 
            is used in tandom with the screen class to make inheritance of the menu bar
        '''
        # Sets up a top bar and another section underneath
        self.screen = QGridLayout()
        self.screen.setRowStretch(1, 1)

        # Top Bar
        self.screen.addLayout(super().top_bar(), 0, 0)

        # Scrollable area
        scroll = QScrollArea()

        # Table to put into the scroll area
        self.table = QGridLayout()
        self.table.setHorizontalSpacing(10)
        self.table.setVerticalSpacing(0)

        #TODO: Will need to collect data labels if there is variable data fields needed
        data_labels = ['Not Yet Complete']
        dropdown = {}

        # Create a textinput or dropdown for all data_labels
        for index, i in enumerate(data_labels):

            if i not in dropdown.keys():
                label, inputter = self.typer_input(i)
                self.table.addWidget(label, index, 0)
                self.table.addWidget(inputter, index, 1)

            else:
                label, inputter = self.dropdown_input(i, dropdown[i])
                self.table.addWidget(label, index, 0)
                self.table.addWidget(inputter, index, 1)

        # Puts table into scroll area
        scroll.setWidgetResizable(True)
        scroll.setWidget(util.layout_to_QWidget(self.table))

        # Put scroll area into the screen
        self.screen.addWidget(scroll, 1, 0)

        return self.screen
    def get_layout(self):
        '''
        returns:-
            QGridLayout : Anything that needs to be displayed as a popup, this 
            is used in tandom with the popup class for inheritance
        '''
        # Update Button
        update_button = QPushButton('Save&Close')
        update_button.setFixedSize(80, 40)
        update_button.clicked.connect(lambda: self.update())

        # Top bar buttons <- Update Button
        topbar_buttons = QGridLayout()
        topbar_buttons.addWidget(update_button, 0, 0)

        # Preset layout
        data_labels = config.sqlserver_details_screen_layout()
        dropdown = self.get_dropdowns()

        # Gets values with SQL Command
        data_values = self.get_sql_server()

        # Makes table
        table = self.popup_table(data_labels, dropdown, data_values)

        # Scrollable area <- Table
        scroll = QScrollArea()
        scroll.setWidgetResizable(True)
        scroll.setWidget(util.layout_to_QWidget(table))

        # Screen <- Topbar and Scroll Table
        screen = QGridLayout()
        screen.setRowStretch(1, 1)
        screen.addLayout(
            super().top_bar(
                topbar_buttons, data_values[0]['Host Name'] +
                ('\\' + data_values[0]['Instance Name']
                 if data_values[0]['Instance Name'] != 'MSSQLSERVER' else '')),
            0, 0)
        screen.addWidget(scroll, 1, 0)

        return screen
Esempio n. 3
0
    def get_layout(self):
        '''
        returns:-
            QGridLayout : Anything that needs to be displayed as a popup, this 
            is used in tandom with the popup class for inheritance
        '''
        # Top bar buttons <- Update Button
        topbar_buttons = QGridLayout()

        # Preset layout
        data_labels = config.cluster_details_screen_layout()
        dropdown = self.get_dropdowns()

        node_labels = config.cluster_nodes_screen_layout(self)
        node_dropdowns = {}

        # Gets values with SQL Command
        data_values = self.get_cluster()

        # Makes table
        table = QGridLayout()
        for i, node in enumerate(data_values):
            table.addLayout(
                self.popup_table(node_labels, node_dropdowns, [node]), i + 1,
                0)
        table.addLayout(
            self.popup_table(data_labels, dropdown, data_values[:1]), 0, 0)

        # Scrollable area <- Table
        scroll = QScrollArea()
        scroll.setWidgetResizable(True)
        scroll.setWidget(util.layout_to_QWidget(table))

        # Screen <- Topbar and Scroll Table
        screen = QGridLayout()
        screen.setRowStretch(1, 1)
        screen.addLayout(
            super().top_bar(topbar_buttons,
                            data_values[0]['Windows Cluster Name']), 0, 0)
        screen.addWidget(scroll, 1, 0)

        return screen
Esempio n. 4
0
 def change_table(self, table):
     self.scroll.setWidget(util.layout_to_QWidget(table))
Esempio n. 5
0
    def get_layout(self):
        '''
        returns:-
            QGridLayout : Anything that needs to be displayed as a screen, this 
            is used in tandom with the screen class to make inheritance of the menu bar
        '''
        # Sets up a top bar and another section underneath
        self.screen = QGridLayout()
        self.screen.setRowStretch(1, 1)

        # Update Button
        create_host_button = QPushButton('Create&Close')
        create_host_button.setFixedSize(80, 40)
        create_host_button.clicked.connect(lambda: self.create_server_button())

        # Top bar buttons <- Update Button
        topbar_buttons = QGridLayout()
        topbar_buttons.addWidget(create_host_button, 0, 0)

        # Top Bar
        self.screen.addLayout(super().top_bar(topbar_buttons), 0, 0)

        # Scrollable area
        scroll = QScrollArea()

        # Table to put into the scroll area
        self.table = QGridLayout()
        self.table.setHorizontalSpacing(10)
        self.table.setVerticalSpacing(0)

        self.data_labels = [('domain', '', 4, 0, 1, 1, True),
                            ('instanceName', 'MSSQLSERVER', 1, 0, 1, 1, True),
                            ('clusterName', '', 3, 0, 1, 1, False),
                            ('Enviroment', '', 0, 1, 1, 1, True),
                            ('postConfigBy', '', 1, 1, 1, 1, False),
                            ('postConfigByPeerReviewedBy', '', 2, 1, 1, 1,
                             False),
                            ('ServerState', 'Commissioned', 3, 1, 1, 1, True),
                            ('Host Type', 'Cluster', 0, 0, 1, 1, True),
                            ('SQL Host', 'Failed', 5, 1, 1, 1, True),
                            ('Business Unit', '', 6, 1, 1, 1, True),
                            ('thirdPartybackups', '', 7, 1, 1, 1, True),
                            ('SQL Monitoring', '', 8, 1, 1, 1, True),
                            ('Commissioned Date', '', 9, 1, 1, 1, False),
                            ('Decommissioned Date', '', 10, 1, 1, 1, False),
                            ('DNSAlias', '', 11, 1, 1, 1, False)]
        dropdown = {
            'ServerState': ['Commissioned', 'Decommissioned'],
            'Host Type': ['Standalone', 'Cluster'],
            'SQL Host': ['Failed'],
            'hostName': [None] + sqlcommands.get_host_name(),
            'domain': ['.hiscox.com', '.hiscox.nonprod'],
            'Business Unit': sqlcommands.get_business_units(),
            'thirdPartybackups': ['Yes', 'No'],
            'SQL Monitoring': ['Yes', 'No'],
            'Enviroment': sqlcommands.get_enviroments()
        }

        # Create a textinput or dropdown for all data_labels
        for i, default, row, col, row_s, col_s, null_not_allowed in self.data_labels:

            if i not in dropdown.keys():
                label, inputter = self.typer_input(
                    i if not null_not_allowed else str(i) + '*')
                inputter.setText(default)
                self.table.addWidget(label, row, col * 2, row_s, col_s)
                self.table.addWidget(inputter, row, col * 2 + 1, row_s, col_s)

            else:
                label, inputter = self.dropdown_input(
                    i if not null_not_allowed else str(i) + '*', dropdown[i])
                self.table.addWidget(label, row, col * 2, row_s, col_s)
                if i == 'Host Type':
                    temp = inputter
                    temp.currentTextChanged.connect(
                        lambda: self.host_type_changed(temp.currentText()))
                    self.table.addWidget(temp, row, col * 2 + 1, row_s, col_s)
                else:
                    self.table.addWidget(inputter, row, col * 2 + 1, row_s,
                                         col_s)

        # Puts table into scroll area
        scroll.setWidgetResizable(True)
        scroll.setWidget(util.layout_to_QWidget(self.table))

        # Put scroll area into the screen
        self.screen.addWidget(scroll, 1, 0)

        # Update the data field
        self.data_fields['SQL Host*'].clear()
        self.host_type_changed(self.data_fields['Host Type*'].currentText())

        return self.screen
Esempio n. 6
0
    def get_layout(self):
        '''
        returns:-
            QGridLayout : Anything that needs to be displayed as a screen, this 
            is used in tandom with the screen class to make inheritance of the menu bar
        '''

        # Sets up a top bar and another section underneath
        self.screen = QGridLayout()
        self.screen.setRowStretch(1, 1)

        # Update Button
        create_host_button = QPushButton('Create&Close')
        create_host_button.setFixedSize(80, 40)
        create_host_button.clicked.connect(lambda: self.create_host_button())

        # Top bar buttons <- Update Button
        topbar_buttons = QGridLayout()
        topbar_buttons.addWidget(create_host_button, 0, 0)

        # Top Bar
        self.screen.addLayout(super().top_bar(topbar_buttons), 0, 0)

        # Scrollable area
        scroll = QScrollArea()

        # Table to put into the scroll area
        self.table = QGridLayout()
        self.table.setHorizontalSpacing(10)
        self.table.setVerticalSpacing(0)

        self.data_labels = [('domain', '', 0, 0, 1, 1, True),
                            ('hostName', '', 1, 0, 1, 1, True),
                            ('vsr', 'N/A', 2, 0, 1, 1, True),
                            ('region', 'EU', 3, 0, 1, 1, True),
                            ('location', 'LN', 4, 0, 1, 1, True),
                            ('primaryBU', '', 5, 0, 1, 1, True),
                            ('description', '', 0, 1, 1, 1, True),
                            ('maintenanceWindow', '18:00-08:00(GMT)', 1, 1, 1,
                             1, True),
                            ('builtBy', 'Server Team', 2, 1, 1, 1, True),
                            ('builtByPeerReviewedBy', '', 3, 1, 1, 1, False),
                            ('hostState', 'Commissioned', 4, 1, 1, 1, True),
                            ('commissionedDate', '', 5, 1, 1, 1, False),
                            ('temporaryStateExpirydate', '', 6, 1, 1, 1,
                             False), ('DRTier', '', 7, 1, 1, 1, True),
                            ('SentryOne?', '', 8, 1, 1, 1, True),
                            ('Notes', '', 9, 0, 1, 3, False)]
        dropdown = {
            'location': [None] + sqlcommands.get_locations(),
            'primaryBU': [None] + sqlcommands.get_business_units(),
            'hostState': ['Commissioned', 'Decommissioned'],
            'domain': ['.hiscox.com', '.hiscox.nonprod'],
            'region': sqlcommands.get_regions(),
            'DRTier': sqlcommands.get_drtiers(),
            'SentryOne?': ['Yes', 'No']
        }

        # Create a textinput or dropdown for all data_labels
        for i, default, row, col, row_s, col_s, null_not_allowed in self.data_labels:

            if i not in dropdown.keys():
                label, inputter = self.typer_input(
                    i if not null_not_allowed else str(i) + '*')
                inputter.setText(default)
                self.table.addWidget(label, row, col * 2, row_s, col_s)
                self.table.addWidget(inputter, row, col * 2 + 1, row_s, col_s)

            else:
                label, inputter = self.dropdown_input(
                    i if not null_not_allowed else str(i) + '*', dropdown[i])
                self.table.addWidget(label, row, col * 2, row_s, col_s)
                self.table.addWidget(inputter, row, col * 2 + 1, row_s, col_s)

        # Puts table into scroll area
        scroll.setWidgetResizable(True)
        scroll.setWidget(util.layout_to_QWidget(self.table))

        # Put scroll area into the screen
        self.screen.addWidget(scroll, 1, 0)

        return self.screen
Esempio n. 7
0
    def get_layout(self):
        '''
        returns:-
            QGridLayout : Anything that needs to be displayed as a popup, this 
            is used in tandom with the popup class for inheritance
        '''
        # Update Button
        update_button = QPushButton('Update')
        update_button.setFixedSize(80, 40)
        update_button.clicked.connect(lambda: self.update())

        # Top bar buttons <- Update Button
        topbar_buttons = QGridLayout()
        topbar_buttons.addWidget(update_button, 0,0)

        # Gets values with SQL Command
        data_values = self.get_ag()

        if len(data_values) != 0:
            testag = data_values[0]
            diffrent = False

            for ag in data_values:
                for tag in ['AG Name', 'Listener', 'Port', 'AG role']:
                    if ag[tag] != testag[tag]:
                        diffrent = True

        if len(data_values) != 0 and not diffrent:
            # Preset layout
            data_labels = [('serverID', 0,0, 1,1, False, False), ('AG Name', 0,1, 1,1,False, False), ('Listener', 1,1, 1,1, False, False), ('Port', 2,1, 1,1, False, False), ('AG role', 3,1, 1,1, False, False)]
            dropdown = self.get_dropdowns()

            databases_labels = [('Database Name', 0,0, 1,1, False, False)]
            databases_dropdowns = {}
        else:
            # Preset layout
            data_labels = [('serverID', 0,0, 1,1, False, False)]
            dropdown = self.get_dropdowns()

            databases_labels = [('Database Name', 0,1, 1,1, False, False), ('AG Name', 0,0, 1,1, False, False), ('Listener', 1,0, 1,1, False, False), ('Port', 2,0, 1,1, False, False), ('AG role', 3,0, 1,1, False, False)]
            databases_dropdowns = {}

        # Makes table
        table = QGridLayout()
        for i, node in enumerate(data_values):
            table.addLayout(self.popup_table(databases_labels, databases_dropdowns, [node]), i+1, 0)

        table.addLayout(self.popup_table(data_labels, dropdown, data_values[:1]), 0, 0)

        # Scrollable area <- Table
        scroll = QScrollArea()
        scroll.setWidgetResizable(True)
        scroll.setWidget(util.layout_to_QWidget(table))

        # Screen <- Topbar and Scroll Table
        screen = QGridLayout()
        screen.setRowStretch(1, 1)
        screen.addLayout(super().top_bar(topbar_buttons, data_values[0]['Server Name']), 0,0)
        screen.addWidget(scroll, 1, 0)

        return screen
Esempio n. 8
0
 def change_table(self, table, headers=QGridLayout()):
     self.scroll.setWidget(util.layout_to_QWidget(table))
     self.headers.setWidget(util.layout_to_QWidget(headers))
Esempio n. 9
0
    def get_layout(self):
        '''
        returns:-
            QGridLayout : Anything that needs to be displayed as a screen, this 
            is used in tandom with the screen class to make inheritance of the menu bar
        '''

        # Sets up a top bar and another section underneath
        self.screen = QGridLayout()
        self.screen.setRowStretch(1, 1)

        # Update Button
        create_cluster_button = QPushButton('Create&Close')
        create_cluster_button.setFixedSize(80, 40)
        create_cluster_button.clicked.connect(
            lambda: self.create_cluster_button())

        # Top bar buttons <- Update Button
        topbar_buttons = QGridLayout()
        topbar_buttons.addWidget(create_cluster_button, 0, 0)

        # Top Bar
        self.screen.addLayout(super().top_bar(topbar_buttons), 0, 0)

        # Scrollable area
        scroll = QScrollArea()

        # Table to put into the scroll area
        self.table = QGridLayout()
        self.table.setHorizontalSpacing(10)
        self.table.setVerticalSpacing(0)

        self.data_labels = [('domain', '', 0, 0, 1, 1, True),
                            ('SQL Acess Point', '', 1, 0, 1, 1, True),
                            ('Windows Cluster Name', '', 2, 0, 1, 1, True),
                            ('Clustering Method', '', 3, 0, 1, 1, True),
                            ('Number of Nodes', '', 0, 1, 1, 1, True),
                            ('Notes', '', 5, 0, 1, 1, True),
                            ('Cluster Node 1', '', 1, 1, 1, 1, False),
                            ('Related SQL Server 1', '', 2, 1, 1, 1, False),
                            ('Cluster Node 2', '', 3, 1, 1, 1, False),
                            ('Related SQL Server 2', '', 4, 1, 1, 1, False),
                            ('Cluster Node 3', '', 5, 1, 1, 1, False),
                            ('Related SQL Server 3', '', 6, 1, 1, 1, False),
                            ('Cluster Node 4', '', 7, 1, 1, 1, False),
                            ('Related SQL Server 4', '', 8, 1, 1, 1, False)]
        node_options = [None] + sqlcommands.get_host_name()
        sql_options = [None] + sqlcommands.get_instance_name()
        dropdown = {
            'domain': ['.hiscox.com', '.hiscox.nonprod'],
            'Related SQL Server 1': sql_options,
            'Related SQL Server 2': sql_options,
            'Related SQL Server 3': sql_options,
            'Related SQL Server 4': sql_options,
            'Clustering Method': ['MSCS', 'AlwaysOn'],
            'Number of Nodes': ['1', '2', '3', '4'],
            'Cluster Node 1': node_options,
            'Cluster Node 2': node_options,
            'Cluster Node 3': node_options,
            'Cluster Node 4': node_options
        }

        # Create a textinput or dropdown for all data_labels
        for i, default, row, col, row_s, col_s, null_not_allowed in self.data_labels:

            if i not in dropdown.keys():
                label, inputter = self.typer_input(
                    i if not null_not_allowed else str(i) + '*')
                inputter.setText(default)
                self.table.addWidget(label, row, col * 2, row_s, col_s)
                self.table.addWidget(inputter, row, col * 2 + 1, row_s, col_s)

            else:
                label, inputter = self.dropdown_input(
                    i if not null_not_allowed else str(i) + '*', dropdown[i])
                self.table.addWidget(label, row, col * 2, row_s, col_s)
                if i == 'Number of Nodes':
                    self.temp = inputter
                    self.temp.currentTextChanged.connect(
                        lambda: self.num_nodes_changed(
                            int(self.temp.currentText())))
                    self.table.addWidget(self.temp, row, col * 2 + 1, row_s,
                                         col_s)
                else:
                    self.table.addWidget(inputter, row, col * 2 + 1, row_s,
                                         col_s)

        # Puts table into scroll area
        scroll.setWidgetResizable(True)
        scroll.setWidget(util.layout_to_QWidget(self.table))

        # Put scroll area into the screen
        self.screen.addWidget(scroll, 1, 0)

        # Make sure things changed
        self.num_nodes_changed(int(self.temp.currentText()))

        return self.screen