Bug 1110627

Summary: RFE: As a command line user I would like to be guided in setting up a project
Product: [Retired] Zanata Reporter: Carlos Munoz <camunoz>
Component: Component-zanata-client, Component-zanata-client-ivyAssignee: Patrick Huang <pahuang>
Status: CLOSED CURRENTRELEASE QA Contact: Ding-Yi Chen <dchen>
Severity: medium Docs Contact:
Priority: unspecified    
Version: developmentCC: dchen, djansen, pahuang, zanata-bugs
Target Milestone: ---   
Target Release: client-3.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: commit 7ab5819cefde4b76a6256cc5ecd5e15435b5df73 Doc Type: Bug Fix
Doc Text:
Story Points: 5
Clone Of: Environment:
Last Closed: 2015-04-20 01:11:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1010132    
Bug Blocks: 1129004    

Description Carlos Munoz 2014-06-18 05:59:43 UTC
command line: $ zanata init

Search for zanata.ini. (If there's none, link them to the help page)
Provide a list of servers to choose from

If there's a zanata.xml, ask the user if they want to proceed, back it up and continue (tell them where it is)

Select or create a project and version
  - If creating, also ask for Project type

The client downloads the zanata.xml config file (new REST endpoint)

## add includes and excludes to zanata.xml

A) Prompt for src dir.
Prompt for includes and excludes
Show a sample of the document names.
Prompt for acceptance or back to A) 

B) Prompt for trans dir, .
Show preview of translated content
Prompt  for acceptance of back to B)

Offer a few useful commands plus urls (what next)

Comment 1 Ding-Yi Chen 2014-06-19 01:07:00 UTC
Without fixing Bug 1010132 first, 
the most reliable way for gettext project maintainers is copy from other working (i.e. correct map-from) and change the project and version, which make this RFE pointless.

Comment 2 Carlos Munoz 2014-06-23 12:09:12 UTC
I don't think it's pointless. There's still a lot of automation going on here which lowers the entry barrier.

Comment 3 Patrick Huang 2014-06-27 04:58:35 UTC
With regards to:
B) Prompt for trans dir, .
Show preview of translated content

I will assume this is similar to src dir, which will show a list of translation file names found. Since the total files will likely be large (number of source files multiply number of locales), only ONE locale (with translation) will be listed as preview.

Any objection to this assumption please add comment in this bug.

Comment 4 Patrick Huang 2014-06-27 05:02:27 UTC
Disregard comment 3
The actual intent is to output the will-be translation file names if user does a pull. 
No need to talk to server and no need to scan local directory.

(In reply to Patrick Huang from comment #3)
> With regards to:
> B) Prompt for trans dir, .
> Show preview of translated content
> 
> I will assume this is similar to src dir, which will show a list of
> translation file names found. Since the total files will likely be large
> (number of source files multiply number of locales), only ONE locale (with
> translation) will be listed as preview.
> 
> Any objection to this assumption please add comment in this bug.

Comment 5 Patrick Huang 2014-08-06 01:27:44 UTC
https://github.com/zanata/zanata-client/pull/27

Comment 6 Ding-Yi Chen 2014-08-20 05:09:10 UTC
Tested with commit 23647ce9e63a117e1cc569fd22070462220cf50e

Test case: wildfly-master

1. When connect to the server that does not support zanata init, it shows following error after the translatable language list:

[!] The server returned this error:
<html><head><title>JBoss Web/7.3.0.Final-redhat-2 - JBWEB000064: Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>JBWEB000065: HTTP Status 404 - Could not find resource for relative : /projects/p/wildfly/iterations/i/master/config of full path: http://zanata-stage.app.eng.bos.redhat.com/seam/resource/restv1/projects/p/wildfly/iterations/i/master/config</h1><HR size="1" noshade="noshade"><p><b>JBWEB000309: type</b> JBWEB000067: Status report</p><p><b>JBWEB000068: message</b> <u>Could not find resource for relative : /projects/p/wildfly/iterations/i/master/config of full path: http://zanata-stage.app.eng.bos.redhat.com/seam/resource/restv1/projects/p/wildfly/iterations/i/master/config</u></p><p><b>JBWEB000069: description</b> <u>JBWEB000124: The requested resource is not available.</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.3.0.Final-redhat-2</h3></body></html>

Expected:
  a. The error message should be simpler, like "Unsupported server version".

  b. It should be shown right after you choose server, not wait until user type a lot of server.

  c. Since the server won't update soon most of the time, there is no point to try again now, so don't ask "Do you want to try again (y/n)?"
  
2. The source dir output is confusing:
[WARNING] Source directory in zanata.xml is set to [.] but is now given as   [/tmp/Wildfly/master/target/classes]
[WARNING] You are overriding your Source directory defined in zanata.xml
[WARNING] Translation directory in zanata.xml is set to [.] but is now given as [/tmp/Wildfly/master/src/main/resources]
[WARNING] You are overriding your Translation directory defined in zanata.xml
[INFO] You can define Includes in zanata.xml now (<includes>**/*.i18n.properties,**/LocalDescriptions.properties</includes>)
[INFO] ignoring setDebug: use mvn -X to control debug logging

The 1st line implies that zanata-init auto-detect the source dir, (which it does not), so better to remove it.

The 3rd line should be removed for same reason.

The 5th line should be moved to the "includes" setting.

3. When
 base directory: y 
 Includes: Local*
 Excludes:

Actual:
  Program quit with error 
  Zanata mojo exception: basedir y does not exist

Expected: 
  Show error message directory "y" does not exist
  And a new question "What's your basedir?"

Comment 7 Ding-Yi Chen 2014-08-20 05:15:30 UTC
See https://github.com/zanata/zanata-client/pull/27#issuecomment-52734771 for checklist.

Comment 8 Ding-Yi Chen 2014-09-24 04:13:04 UTC
VERIFIED with Zanata 3.5.0-SNAPSHOT (git-jenkins-zanata-server-verify-integration-master-3850-SUCCESS-1-g3ba1568)

and zanata-client commit 7ab5819cefde4b76a6256cc5ecd5e15435b5df73