Пример #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
Пример #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
Пример #3
0
 def check(self):
     if self.mode == 'matched':
         from tactic.ui.panel import FastTableLayoutWdg
         table = FastTableLayoutWdg(search_type=self.search_type, view=self.view,\
             show_search_limit='false', search_limit=-1, search_view=self.search_view, \
             simple_search_view=self.simple_search_view, search_class=self.search_class)
         table.handle_search()
         search_objs = table.sobjects
         self.search_key_list = SearchKey.get_by_sobjects(search_objs, use_id=True)
         return True
     else:
         self.search_key_list = self.kwargs.get('search_key_list')
         if self.search_key_list and isinstance(self.search_key_list, basestring):
             self.search_key_list = eval(self.search_key_list)
Пример #4
0
 def check(my):
     if my.mode == 'matched':
         from tactic.ui.panel import FastTableLayoutWdg
         table = FastTableLayoutWdg(search_type=my.search_type, view=my.view,\
             show_search_limit='false', search_limit=-1, search_view=my.search_view, \
             simple_search_view=my.simple_search_view, search_class=my.search_class)
         table.handle_search()
         search_objs = table.sobjects
         my.search_key_list = SearchKey.get_by_sobjects(search_objs, use_id=True)
         return True
     else:
         my.search_key_list = my.kwargs.get('search_key_list')
         if my.search_key_list and isinstance(my.search_key_list, basestring):
             my.search_key_list = eval(my.search_key_list)
Пример #5
0
    def get_display(self):
        parent_key = self.kwargs.get("search_key")

        assert (parent_key)

        parent = SearchKey.get_by_search_key(parent_key)

        parent_type = parent.get_base_search_type()

        # this is for backwards compatibility for ProcessSelectWdg
        web = WebContainer.get_web()
        web.set_form_value("parent_search_type", parent_type)

        div = DivWdg()
        if self.kwargs.get("__hidden__"):
            div.add_style("margin-top: -2px")
            div.add_style("margin-left: 0px")

        if parent.get_code() == '-1':
            div.add('You can only add task for an existing item.')
            return div

        from tactic.ui.panel import TableLayoutWdg, FastTableLayoutWdg

        expression = self.kwargs.get('expression')
        if not expression:
            expression = ''
        # title is used for panel refresh overlay
        table = FastTableLayoutWdg(search_type="sthpw/task",
                                   view="inline_add_item",
                                   mode="insert",
                                   search_key=parent_key,
                                   state={'search_key': parent_key},
                                   expression=expression,
                                   title='Task Edit',
                                   __hidden__=self.kwargs.get("__hidden__"))

        div.add(table)

        return div
Пример #6
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()
Пример #7
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()