Esempio n. 1
0
    def get_display(my):

        top = my.top

        file_logs = my.kwargs.get("file_logs")
        print "file_logs: ", file_logs

        attrs = [
            'depot', 'action', 'change', 'client', 'desc', 'digest',
            'fileSize', 'rev', 'time', 'type', 'user'
        ]

        # FIXME: depotfile is Perforce specific

        # handle only one file for now
        file_log = file_logs[0]
        file_path = file_log.get("depotFile")

        # find the number of revisions
        my.sobjects = []
        num_sobjects = len(file_log.get("action"))
        for i in range(0, num_sobjects):
            sobject = SearchType.create("sthpw/virtual")
            my.sobjects.append(sobject)
            sobject.set_value("depotFile", file_path)
            sobject.set_value("id", i)

        # go through each attr
        for attr in attrs:
            if attr == 'depot':
                value = file_path.lstrip("//")
                parts = value.split("/")
                value = "//%s" % parts[0]
                for sobject in my.sobjects:
                    sobject.set_value(attr, value)
            else:
                values = file_log.get(attr)
                for i, value in enumerate(values):
                    my.sobjects[i].set_value(attr, value)

        title_wdg = DivWdg()
        top.add(title_wdg)
        title_wdg.add("File Log for [%s]" % file_path)
        title_wdg.add_color("color", "color3")
        title_wdg.add_color("background", "background3")
        title_wdg.add_style("padding: 10px")
        title_wdg.add_style("font-size: 14px")
        title_wdg.add_style("font-weight: bold")

        from tactic.ui.panel import FastTableLayoutWdg
        table = FastTableLayoutWdg(search_type="sthpw/virtual",
                                   view="table",
                                   element_names=attrs,
                                   show_shelf=False)
        table.set_sobjects(my.sobjects)
        top.add(table)

        return top
Esempio n. 2
0
    def get_display(my):

        top = my.top

        file_logs = my.kwargs.get("file_logs")
        print "file_logs: ", file_logs

        attrs = ['depot', 'action','change','client','desc','digest','fileSize','rev','time','type','user']


        # FIXME: depotfile is Perforce specific

        # handle only one file for now
        file_log = file_logs[0]
        file_path = file_log.get("depotFile")

        # find the number of revisions
        my.sobjects = []
        num_sobjects = len(file_log.get("action"))
        for i in range(0, num_sobjects):
            sobject = SearchType.create("sthpw/virtual")
            my.sobjects.append(sobject)
            sobject.set_value("depotFile", file_path)
            sobject.set_value("id", i)

        # go through each attr
        for attr in attrs:
            if attr == 'depot':
                value = file_path.lstrip("//")
                parts = value.split("/")
                value = "//%s" % parts[0]
                for sobject in my.sobjects:
                    sobject.set_value(attr, value)
            else:
                values = file_log.get(attr)
                for i, value in enumerate(values):
                    my.sobjects[i].set_value(attr, value)

        title_wdg = DivWdg()
        top.add(title_wdg)
        title_wdg.add("File Log for [%s]" % file_path)
        title_wdg.add_color("color", "color3")
        title_wdg.add_color("background", "background3")
        title_wdg.add_style("padding: 10px")
        title_wdg.add_style("font-size: 14px")
        title_wdg.add_style("font-weight: bold")



        from tactic.ui.panel import FastTableLayoutWdg
        table = FastTableLayoutWdg(search_type="sthpw/virtual", view="table", element_names=attrs, show_shelf=False)
        table.set_sobjects(my.sobjects)
        top.add(table)


        return top
Esempio n. 3
0
    def get_display(self):

        #WebContainer.register_cmd("pyasm.admin.UndoLogCbk")

        # add a time filter
        div = DivWdg()
        div.add_color('background', 'background', -10)
        div.add_color('color', 'color')
        div.add_style("padding: 15px")
        div.add_border()
        project = ''
        # add a project filter
        if self.all_namespaces_flag:
            span = SpanWdg("Project: ")
            span.add_color('color', 'color')
            project_select = FilterSelectWdg("project")
            project_select.add_empty_option(label="-- All Projects --")
            project_select.set_option("query", "sthpw/project|code|title")
            span.add(project_select)
            div.add(span)

            project = project_select.get_value()
        else:
            from pyasm.biz import Project
            project = Project.get_global_project_code()

        # add a time filter
        from pyasm.prod.web import DateFilterWdg
        select = DateFilterWdg("undo_time_filter",
                               label="Show Transaction Log From: ")
        select.set_label(
            ["1 Hour Ago", "Today", "1 Day Ago", "1 Week Ago", "1 Month Ago"])
        select.set_value(["1 Hour", "today", "1 Day", "1 Week", "1 Month"])
        select.set_option("default", "1 Hour")
        div.add(select)

        time_interval = select.get_value()

        self.add(div)

        if not self.all_users_flag:
            user = Environment.get_user_name()
        else:
            span = SpanWdg(css="med")
            span.add("User: "******"user")
            user_select.set_option("query", "sthpw/login|login|login")
            user_select.add_empty_option()
            span.add(user_select)
            div.add(span)

            user = user_select.get_value()

        transaction_log = TransactionLog.get( user_name=user, \
            namespace=project, time_interval=time_interval)

        from tactic.ui.panel import FastTableLayoutWdg, TableLayoutWdg
        table = FastTableLayoutWdg(search_type="sthpw/transaction_log",
                                   view="table",
                                   show_shelf='false',
                                   show_select="false")
        #table = TableLayoutWdg(search_type="sthpw/transaction_log", view="table", mode='simple', show_row_select="false")
        table.set_sobjects(transaction_log)
        #table.set_refresh_mode("table")
        self.add(table)

        return super(UndoLogWdg, self).get_display()
Esempio n. 4
0
    def get_display(self):

        #WebContainer.register_cmd("pyasm.admin.UndoLogCbk")

        # add a time filter
        div = DivWdg()
        div.add_color('background','background', -10)
        div.add_color('color','color')
        div.add_style("padding: 15px")
        div.add_border()
        project = ''
        # add a project filter
        if self.all_namespaces_flag:
            span = SpanWdg("Project: ")
            span.add_color('color','color')
            project_select = FilterSelectWdg("project")
            project_select.add_empty_option(label="-- All Projects --")
            project_select.set_option("query", "sthpw/project|code|title")
            span.add(project_select)
            div.add(span)

            project = project_select.get_value()
        else:
            from pyasm.biz import Project
            project = Project.get_global_project_code()


        # add a time filter
        from pyasm.prod.web import DateFilterWdg
        select = DateFilterWdg("undo_time_filter", label="Show Transaction Log From: ")
        select.set_label(["1 Hour Ago", "Today", "1 Day Ago", "1 Week Ago", "1 Month Ago"])
        select.set_value(["1 Hour", "today", "1 Day", "1 Week", "1 Month"])
        select.set_option("default", "1 Hour")
        div.add(select)

        time_interval = select.get_value() 

        self.add(div)

        if not self.all_users_flag:
            user = Environment.get_user_name()
        else:
            span = SpanWdg(css="med")
            span.add("User: "******"user")
            user_select.set_option("query", "sthpw/login|login|login")
            user_select.add_empty_option()
            span.add(user_select)
            div.add(span)

            user = user_select.get_value()

        transaction_log = TransactionLog.get( user_name=user, \
            namespace=project, time_interval=time_interval)

        from tactic.ui.panel import FastTableLayoutWdg, TableLayoutWdg
        table = FastTableLayoutWdg(search_type="sthpw/transaction_log", view="table", show_shelf='false', show_select="false")
        #table = TableLayoutWdg(search_type="sthpw/transaction_log", view="table", mode='simple', show_row_select="false")
        table.set_sobjects(transaction_log)
        #table.set_refresh_mode("table")
        self.add(table)

        return super(UndoLogWdg, self).get_display()