GithubHelp home page GithubHelp logo

Comments (14)

MartinBarkerPhilips avatar MartinBarkerPhilips commented on June 26, 2024 1

I think i came up with a fix for the _get_paged_resources function, by changing this section:

            # iterate all the entries
            with Pool() as p:
                resources_list_new = list(
                    filter(
                        None,
                        p.starmap(self._handle_resource_entry,
                                  [(resource_name, entry, pa_url, archived,
                                    filter_rule) for entry in entries])))
                resources_list = resources_list + resources_list_new

So that elements would get concatenated correctly

from rtcclient.

MartinBarkerPhilips avatar MartinBarkerPhilips commented on June 26, 2024

update, I ran myclient.getProjectAreas(archived=False, returned_properties="dc:title,dc:identifier") and this project did not show up, so I think my rtc project area is not setup correctly, or missing an access requirement which this package needs

from rtcclient.

dixudx avatar dixudx commented on June 26, 2024

is there any way I could view all my project areas to see what the name of the project is?

I don't know whether the projectarea (HC) CT AMI FRU will be encoded or not.

I'd suggest listing all the project areas and pick it out with iteration.

from rtcclient.

MartinBarkerPhilips avatar MartinBarkerPhilips commented on June 26, 2024

is there any way I could view all my project areas to see what the name of the project is?

I don't know whether the projectarea (HC) CT AMI FRU will be encoded or not.

I'd suggest listing all the project areas and pick it out with iteration.

I listed all the project areas and mine was missing from the list, like rtcclient cant find it as a project area for some reason.

is there some setting in my rtc project config that needs to be changed in order to allow for the python api to be able to find my project? such as changing the access control setting for my rtc project to 'everyone' instead of 'team members' ?

or maybe the username/password for rtc im using dont have correct permission?

from rtcclient.

dixudx avatar dixudx commented on June 26, 2024

I listed all the project areas and mine was missing from the list, like rtcclient cant find it as a project area for some reason.

is there some setting in my rtc project config that needs to be changed in order to allow for the python api to be able to find my project?

@MartinBarkerPhilips As long as you can get a list of project areas, that means it is okay with the config settings.

I am wondering whether that project area is marked as Archived. Please have a try on it.

myclient.getProjectAreas(archived=True)

such as changing the access control setting for my rtc project to 'everyone' instead of 'team members' ?

or maybe the username/password for rtc im using dont have correct permission?

Are you using a special account for the client?

If you can view that project area from web browser, then the client can access as well.

from rtcclient.

MartinBarkerPhilips avatar MartinBarkerPhilips commented on June 26, 2024

I made a simple script to print all project areas:

from rtcclient.utils import setup_basic_logging
from rtcclient import RTCClient
setup_basic_logging()

myclient = RTCClient("https://rtcemea1.philips.com:9443/ccm", "username", "password", ends_with_jazz=False)
areas = myclient.getProjectAreas(archived=True, returned_properties="dc:title,dc:identifier")
for a in areas:
    print(a.title)

It prints out these:

(HC) IGTS MoS
(HC) IGTS Externals
(HC) IGTS SmartSuite FactoryTooling
(HC) IGTS FSFW
(HC) iXR iEngineCore
(HC) IGTS TAF Scripting
(HC) IGTS Tools
(HC) IGTS SmartSuite TestTooling
(HC) iXR SmartSuiteShared

But the project I need, (HC) CT AMI FRU is not included.

If i run the code with archived=false its the same output

(HC) IGTS MoS
(HC) IGTS Externals
(HC) IGTS SmartSuite FactoryTooling
(HC) IGTS FSFW
(HC) iXR iEngineCore
(HC) IGTS TAF Scripting
(HC) IGTS Tools
(HC) IGTS SmartSuite TestTooling
(HC) iXR SmartSuiteShared

I can see the project I want under 'my projects' online with the same username/password I used in my code
image

Under the 'all other projects' tab i see alot of projects, including the ones my script printed out
image

under the archived project tab there are a couple projects, none of which are the one i am trying to get: (HC) CT AMI FRU

from rtcclient.

MartinBarkerPhilips avatar MartinBarkerPhilips commented on June 26, 2024

I appreciate your help by the way thank you @dixudx

from rtcclient.

dixudx avatar dixudx commented on June 26, 2024

Under the 'all other projects' tab i see alot of projects, including the ones my script printed out

This seems to be a new category for project areas. We may need to add a new parameter to fetch project areas of this category.

@MartinBarkerPhilips Would you please inspect this web page, and refresh the page to see the network requests. I think we could get some clues on All the other projects.

from rtcclient.

MartinBarkerPhilips avatar MartinBarkerPhilips commented on June 26, 2024

Here is some insight on the network connections, there are no new connections when clicking the 'all other projects' tab. only when i refresh the page, which default goes to 'my projects'
image

im talking with people in my org about a potential fix, my script is unable to connect with any project area under a certain group org so were going to try and add admin auth for me there

from rtcclient.

dixudx avatar dixudx commented on June 26, 2024

I saw there was a request on allProjectsAreas. Would you please take a look on the response data and search the desired project areas that were missing.

image

I guess the APIs may get changed.

from rtcclient.

MartinBarkerPhilips avatar MartinBarkerPhilips commented on June 26, 2024

If I click the 'allProjectAreas' in network tab, I can get a URL which I can go to

image

the url leads to an xml file with 29 instances of xsi:type="rest:ProjectAreaDTO"
image

This is way more then when I run my script:

myclient = RTCClient("https://companyurl.com:9443/ccm", "username", "pword", ends_with_jazz=False)
areas = myclient.getProjectAreas()

and only returns these results:

(HC) IGTS MoS
(HC) IGTS Externals
(HC) IGTS SmartSuite FactoryTooling
(HC) IGTS FSFW
(HC) iXR iEngineCore
(HC) IGTS TAF Scripting
(HC) IGTS Tools
(HC) IGTS SmartSuite TestTooling
(HC) iXR SmartSuiteShared

Here is the URL xml value element for (HC) IGTS Tools, which appears above, and is a project area my script can find fine

<values xsi:type="rest:ProjectAreaDTO">
<itemId>abcdabcd</itemId>
<stateId>xyzxyzxz=yz</stateId>
<name>(HC) IGTS Tools</name>
<archived>false</archived>
<initialized>true</initialized>
<accessTime>2022-07-15T14:03:24.501Z</accessTime>
<myProjectArea>false</myProjectArea>
<description/>
<summary>(HC) IGTS Tools</summary>
<locale>en_US</locale>
<publicVisible>true</publicVisible>
<memberVisible>false</memberVisible>
<specificUserVisible>false</specificUserVisible>
<internalIsProcessProvider>false</internalIsProcessProvider>
<webUrl>https://companyurl:9443/ccm/web/projects/%28HC%29%20IGTS%20Tools</webUrl>
</values>

And here is the url xml element value for project area (HC) CT AMI FRU, which my script can not find currently

<values xsi:type="rest:ProjectAreaDTO">
<itemId>abcabcitem id</itemId>
<stateId>xyzxyzid</stateId>
<name>(HC) CT AMI FRU</name>
<archived>false</archived>
<initialized>true</initialized>
<accessTime>2022-07-15T14:03:24.485Z</accessTime>
<myProjectArea>true</myProjectArea>
<description/>
<summary>(HC) CT/AMI FRU</summary>
<locale>en_US</locale>
<publicVisible>false</publicVisible>
<memberVisible>true</memberVisible>
<specificUserVisible>false</specificUserVisible>
<internalIsProcessProvider>false</internalIsProcessProvider>
<webUrl>https://company url.com:9443/ccm/web/projects/%28HC%29%20CT%20AMI%20FRU</webUrl>
</values>

i am using version 0.6 of rtcclient since my company uses an older version of rtc, these above xml results are what appear in my web browser, i wonder if the findings can be replicated in my rtcclient package?

from rtcclient.

MartinBarkerPhilips avatar MartinBarkerPhilips commented on June 26, 2024

I checked the v0.6 code in client.py and followed what happens when i call getProjectAreas, found that it seems to be calling

        print('running request for url: ', resource_url)
        resp = self.get(resource_url,
                        verify=False,
                        proxies=self.proxies,
                        headers=self.headers)

inside

def _get_paged_resources

only once, and in my case its the very end, so its only finding the last 10 for some reason

running request for url:  https://company.com:9443/ccm/oslc/projectareas?oslc_cm.pageSize=10&_startIndex=0

from rtcclient.

MartinBarkerPhilips avatar MartinBarkerPhilips commented on June 26, 2024

I was able to implement a temporary fix by changing page_size="100" in this function (originally it was 10) but ill have to fix the _get_paged_resources pagination

    def _getProjectAreas(self, archived=False, returned_properties=None,
                         projectarea_name=None, projectarea_id=None):
        rp = returned_properties

        filter_rule = None
        if projectarea_name is not None:
            fpaname_rule = ("dc:title", None, projectarea_name)
            filter_rule = self._add_filter_rule(filter_rule, fpaname_rule)

        if projectarea_id is not None:
            paid_url = "/".join([self.url, "oslc/projectareas",
                                 projectarea_id])
            fpaid_rule = ("@rdf:resource", None, paid_url)
            filter_rule = self._add_filter_rule(filter_rule, fpaid_rule)

        return self._get_paged_resources("ProjectArea",

                                         page_size="100",

                                         archived=archived,
                                         returned_properties=rp,
                                         filter_rule=filter_rule)

from rtcclient.

MartinBarkerPhilips avatar MartinBarkerPhilips commented on June 26, 2024

they werent getting concatenated correctly, so the page_size var number of results in resources_list would keep getting overwritten again and again, untill it would finally return the last page_size number of results only

from rtcclient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.