REQ with snippet: GIT Module: URL Shortcut for CopyPaste

Hi, I thought it would be useful to be able to copypaste GIT web-links from the module page, for usage in client apps (like "Tower" in my case). I never did perl, so I hacked it a bit together, but the "print formatting" part should give you a clear idea:

To have these links all together with $https, $user, $sslport, $nonsslport:

In webmin/virtualmin-git/index.cgi, around line 48:

# Build table of repositories
@table = ( );
foreach $r (@reps) {
$dom = $r->{'dom'}->{'dom'};

# MyDirt:
# Scroll down to the "push" for the idea:
 
$MYdom = $r->{'dom'};
@MYreps = @reps;
($MYrep) = grep { $_->{'rep'} eq $r->{'rep'} } @MYreps;
$MYrep || &error($text{'delete_erep'});
@MYusers = &list_rep_users($MYdom, $MYrep);
$MYuser = @MYusers ? $MYusers[0]->{'user'} : "\$username";

@actions = (
&ui_submit($text{'delete'},
   $r->{'rep'}."\@".$r->{'dom'}->{'id'}),
&ui_submit($text{'index_browse'},
   $r->{'rep'}."\@".$r->{'dom'}->{'id'}),
&ui_submit($text{'index_help'},
   $r->{'rep'}."\@".$r->{'dom'}->{'id'}),
);

# I guess this makes it clear:
push(@table, [ $r->{'rep'}, $showd ? ( ) : ( $dom ),
       $r->{'desc'}, $r->{'dir'}.
       "</br></br><strong>Weblinks:</strong>".
       "</br>http://$MYuser\@$r->{'dom'}->{'dom'}:$r->{'dom'}->{'web_port'}/git/$r->{'rep'}.git/".
       "</br>https://$MYuser\@$r->{'dom'}->{'dom'}:$r->{'dom'}->{'web_sslport'}/git/$r->{'rep'}.git/",
       join(" ", @actions) ]);
}

.

I'd be happy if that makes sense to you too, and would take something like this into your build.
Thanks, Best,

Manu

Status: 
Closed (fixed)

Comments

Ok, are you suggesting that the link to gitweb be a proper link rather than a button?

hm, maybe my specifics, but my situation was, that i needed a full url to paste.
especially I needed the written SSL port, because it's non-standard.

so for me a button would make me go to the new window and copy it from the browser's address-bar.
yet the browser would protest for fishing danger, because there is a user@ in the url.
so I'd rather prefer the overview/ or similar.
but for you this button may have another purpose...?

m

btw, first I put the links into the helper CGI page, which was easier, but I thought that an overview would serve better... maybe...

Ok, the next release of the Git plugin for Virtualmin will use links instead of buttons.

Status: Needs review » Fixed
unborn's picture
Submitted by unborn on Fri, 01/13/2017 - 13:19 Pro Licensee

I think maweber is looking for something like this:

image

Live demonstration (hosted on virtualmin) can be found here: https://git.topfreelancer.co.uk/gs/apache-error-pages

I was missing that feature in git plugin as well, and it would be great to have it included. Perhaps there are 3th party apps which could be used for this purpose as well. As webdev and devops I use git almost every day and all the times and this button or link would be great!

I guess a dirty hack could also be to put both data into two very slimmed down, transparent <input type="text" />

Then a double click into it will usually make it ready to copy. m

unborn's picture
Submitted by unborn on Sat, 01/14/2017 - 05:05 Pro Licensee

maweber sure, or I was thinking to add some js on page, like on click select etc.. like on this examle:

<textarea type="text" name="output link" onclick="this.select()"></textarea>

of course we could add another small js which will read current link location and pate this into text area, when user click on it, text become highlighted co just ctrl+c would work. I think that would be simplest solution?

you mean like 1 copy-textarea which is fed by X buttons from the list?
i can just speak for myself, I'm a visually orientated person, and plain visible standardized-repetition of links is very easy to read. first I want to search the REPO name (first TD. should be STRONG), then take my http(s) link.
i think it's about 2 entries per TR here? http and https, right?
i think the this.select() is bullet-proof and sufficient. maybe add a cross-browser copy-button, but at first I think it should be easy to read (more intelligent js is not important to me personally at this point). also: the length of this string is not endless (https.DOMAIN./git/REPONAME.git), and even if it's truncated by the width of the TEXTAREA or INPUT (which looks clearer in repetition lists) the url-nature is clear to understand visually...

just my two cents, i think anyway, it's as far as I can wish just to get these strings...

btw, I'm not sure, but the absolute SYSTEM-ROOT path to the *.git is no use for me... anyone?

edit:
sorry for the slight redundancy in my posts, I was not fully aware that you suggested all of this in #6.
there's a copy mechanism already in your example picture.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.