archimatetool / archi-modelrepository-plugin

coArchi - a plug-in to share and collaborate on Archi models.
153 stars 53 forks source link

Feature Request - Render "Views As Images" when a model is published #106

Open PaulComis opened 5 years ago

PaulComis commented 5 years ago

One of my use-cases is to share views with people who are not Archi users.

Currently I have to save the "view as image", and then copypasta into an email (or save to sharepoint or similar).

It would be really helpful, if when a model is published to git(hub) if it would also render the views as images, and then I could send the URLs to those links (with out the need for people to install Archi and the collaboration plugin).

Thanks in advance

Phillipus commented 5 years ago

Sorry, but that's out of scope for the collaboration plug-in, as the repo should only contain model information.

A better way to do this is to generate and publish an online HTML report when a push is done.

jbsarrodie commented 5 years ago

Hi,

One option is simply to export your model as HTML and then send them a ZIP containing the whole export.

If you really don't want to provide them access to the whole model, you can easily create a jArchi script that would take the selected views and deleted anything else before exporting as HTML.

Of course, these html pages can be hosted wherever you want (can) instead of sharing a ZIP file.

WatchTh1 commented 5 years ago

You can export model as html report to git and give a link to a view. But it would be nice if SOME plugin could support such a functionality.

чт, 4 июл. 2019 г. в 14:42, PaulComis notifications@github.com:

One of my use-cases is to share views with people who are not Archi users.

Currently I have to save the "view as image", and then copypasta into an email (or save to sharepoint or similar).

It would be really helpful, if when a model is published to git(hub) if it would also render the views as images, and then I could send the URLs to those links (with out the need for people to install Archi and the collaboration plugin).

Thanks in advance

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/archimatetool/archi-modelrepository-plugin/issues/106?email_source=notifications&email_token=AJJCIQ4JX23RIE5C3B53UPLP5XO3PA5CNFSM4H5YZZ7KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G5LOXPA, or mute the thread https://github.com/notifications/unsubscribe-auth/AJJCIQ6RD3RPCSTSCYJL57LP5XO3PANCNFSM4H5YZZ7A .

PaulComis commented 5 years ago

@Phillipus @jbsarrodie @WatchTh1 appreciate the feedback.

I've got the desired effect by pushing my exported (html) model to a new repo and publishing using gh-pages (and sending the link to my non-archi colleagues so we can discuss the views)

My next experiment is to see if I can do the same, publishing to the gh-pages branch of the repo where the actual model is stored (using the collaboration plug-in).

it would be nice if I could save the model, and do the gh-pages export in one shot though... I will continue to have a play...

jbsarrodie commented 5 years ago

it would be nice if I could save the model, and do the gh-pages export in one shot though... I will continue to have a play...

That's basically the purpose of Archi Collaboration Server on which we have been working of for some months now. Even if there is no official publication asof now, you can join the public beta by droping me a private message on Archi's forum.

Just a remark about gh-pages: these pages are publicly accessible (not sure of the exact visibility if you use GitHub Enterprise though, but I doubt they use access rights defined for the repository).

PaulComis commented 5 years ago

@jbsarrodie - Indeed - for this particular use case I'm using GitHub Enterprise which is not publicly accessible.

As an aside; I'm also trying to promote the use of ArchiMate and Archi within my sphere of influence ... if I can get a handful more like-minded people then the collaboration server may really help.

WatchTh1 commented 5 years ago

it would be nice if I could save the model, and do the gh-pages export in one shot though... I will continue to have a play...

That's basically the purpose of Archi Collaboration Server on which we have been working of for some months now. Even if there is no official publication asof now, you can join the public beta by droping me a private message on Archi's forum.

Just a remark about gh-pages: these pages are publicly accessible (not sure of the exact visibility if you use GitHub Enterprise though, but I doubt they use access rights defined for the repository).

Would it be possible to deploy and instance of a such application in private environment, such as isolated enterprise network segment ?

TitaniumIT commented 1 year ago

for azure devops i created this pipeline.yml to display changed images in the description field of the PullRequest

 steps:
          - pwsh:  | 
              curl --fail --output $(Agent.TempDirectory)/archimate.tgz https://www.archimatetool.com/downloads/archi.php?/5.0.2/Archi-Linux64-5.0.2.tgz
              curl --fail --output $(Agent.TempDirectory)/coArchi.archiplugin https://www.archimatetool.com/downloads/coarchi/coArchi_0.8.8.archiplugin
            displayName: Download
          - pwsh: |
              ls -l
              tar zxvf archimate.tgz
              unzip coArchi.archiplugin -d Archi/plugins/
            displayName: Extact
            workingDirectory: $(Agent.TempDirectory)
          - pwsh: |
              xvfb-run ./Archi -application com.archimatetool.commandline.app -consoleLog -nosplash --modelrepository.loadModel $(Build.Repository.LocalPath) --html.createReport $(Pipeline.Workspace)/html
            displayName: Create Html
            workingDirectory: $(Agent.TempDirectory)/Archi
          - ${{ if ne(variables['Build.SourceBranch'], 'refs/heads/main') }}:
            - pwsh: |
                 $commitsUrl = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/git/repositories/$($env:BUILD_REPOSITORY_ID)/pullRequests/$($env:SYSTEM_PULLREQUEST_PULLREQUESTID)/commits?api-version=7.0"
                 $commits = Invoke-WebRequest -Uri $commitsUrl -Method GET -Headers @{Authorization = "Bearer $(System.AccessToken)"} -ContentType "application/json" | ConvertFrom-Json

                 $changedFiles =@()

                 foreach ( $commit in $commits.value ){
                   $commitId = $commit.commitId 
                   $changesUrl = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/git/repositories/$($env:BUILD_REPOSITORY_ID)/commits/$($commitId)/changes?api-version=7.0"
                   Write-Host "processing commit id" $changesUrl

                   $changes = Invoke-WebRequest -Uri $changesUrl -Method GET -Headers @{Authorization = "Bearer $(System.AccessToken)"} -ContentType "application/json" | ConvertFrom-Json
                   foreach ( $change in $changes.changes ){
                      $changedFiles += $change.item.path
                   }
                 }
                 Write-Host $changedFiles
                 $images = Get-ChildItem -path */images/*
                 $description = ""
                 foreach ( $img in $images ){
                   Write-Host Processing $img.Basename
                   if ( $changedFiles.Where( { $_.contains( $img.Basename) }).count -gt 0 ){
                      $filename = "$(New-Guid)"+$img.Extension
                      $url = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/git/repositories/$($env:BUILD_REPOSITORY_ID)/pullRequests/$($env:SYSTEM_PULLREQUEST_PULLREQUESTID)/attachments/$($filename)?api-version=7.0"

                      Write-Host $url

                      $result = Invoke-WebRequest -Uri $url -Method POST -Headers @{Authorization = "Bearer $(System.AccessToken)"} -InFile $($img.FullName) -ContentType "application/octet-stream" | ConvertFrom-Json

                      Write-Host $result
                      $comment = "![]("+$result.url+")`n"
                      $link = $result.url

                      $description += "![]($link)`n"
                    }
                 }

                 $body = @"
                  { 
                     "description": "$description"
                  }
                 "@ 

                 Write-Host $body
                 $commenturl = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/git/repositories/$($env:BUILD_REPOSITORY_ID)/pullRequests/$($env:SYSTEM_PULLREQUEST_PULLREQUESTID)?api-version=7.0"

                  Invoke-WebRequest -Uri $commenturl -Method PATCH -Headers @{Authorization = "Bearer $(System.AccessToken)"} -body $body -ContentType "application/json"
              displayName: Show Images
              env:
                tempdir: $(Agent.TempDirectory)
                buildid: $(Build.BuildId)

              workingDirectory: $(Pipeline.Workspace)/html

`