Skip to content

Commit

Permalink
Merge pull request #3253 from bamaer/3252
Browse files Browse the repository at this point in the history
variables resolution and i18n fixes in Google Sheets transfroms #3252
  • Loading branch information
bamaer authored Sep 25, 2023
2 parents d254db7 + e8be1f3 commit 385a3f7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public class GoogleSheetsInputDialog extends BaseTransformDialog implements ITra
private TextVar wWorksheetId;
private TextVar wSampleFields;
private TableView wFields;

public GoogleSheetsInputDialog(
Shell parent, IVariables variables, Object in, PipelineMeta pipelineMeta, String name) {
super(parent, variables, (BaseTransformMeta) in, pipelineMeta, name);
Expand Down Expand Up @@ -222,7 +221,7 @@ public String open() {

// Impersonation - Label
Label impersonationLabel = new Label( serviceAccountComposite, SWT.RIGHT );
impersonationLabel.setText( "Inpersonation account :" );
impersonationLabel.setText(BaseMessages.getString(PKG, "GoogleSheetsOutputDialog.ImpersonationAccount"));
props.setLook( impersonationLabel );
FormData impersonationLabelForm = new FormData();
impersonationLabelForm.top = new FormAttachment( wTimeout, margin );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,19 @@ public boolean init() {
.setApplicationName(GoogleSheetsCredentials.APPLICATION_NAME)
.build();

Spreadsheet spreadSheet = data.service.spreadsheets().get(meta.getSpreadsheetKey()).execute();
Spreadsheet spreadSheet = data.service.spreadsheets().get(resolve(meta.getSpreadsheetKey())).execute();
List<Sheet> sheets = spreadSheet.getSheets();
for(Sheet sheet : sheets){
if(sheet.getProperties().getTitle().equals(meta.getWorksheetId())){
if(sheet.getProperties().getTitle().equals(resolve(meta.getWorksheetId()))){
worksheetExists = true;
}
}

if(!worksheetExists){
List<Request> requests = new ArrayList<>();
requests.add(new Request().setAddSheet(new AddSheetRequest().setProperties(new SheetProperties().setTitle(meta.getWorksheetId()))));
requests.add(new Request().setAddSheet(new AddSheetRequest().setProperties(new SheetProperties().setTitle(resolve(meta.getWorksheetId())))));
BatchUpdateSpreadsheetRequest body = new BatchUpdateSpreadsheetRequest().setRequests(requests);
data.service.spreadsheets().batchUpdate(meta.getSpreadsheetKey(), body).execute();
data.service.spreadsheets().batchUpdate(resolve(meta.getSpreadsheetKey()), body).execute();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public String open() {

// Impersonation - Label
Label impersonationLabel = new Label( serviceAccountComposite, SWT.RIGHT );
impersonationLabel.setText( "Inpersonation account :" );
impersonationLabel.setText(BaseMessages.getString(PKG, "GoogleSheetsOutputDialog.ImpersonationAccount"));
props.setLook( impersonationLabel );
FormData impersonationLabelForm = new FormData();
impersonationLabelForm.top = new FormAttachment( wTimeout, margin );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ GoogleSheetsInput.injection.INPUT_NULL_STRING=Null String
GoogleSheetsInput.injection.INPUT_IF_NULL=If Null
GoogleSheetsInput.injection.jsonCrendentialPath=Path to the Google JSON credential file

GoogleSheetsOutput.transform.Name=Google Sheet Output
GoogleSheetsOutputDialog.ImpersonationAccount=Impersonation account :
GoogleSheetsOutput.transform.Name=Google Sheets Output
GoogleSheetsOutputDialog.Create.Label=Create new sheet if it does not exist
GoogleSheetsOutputDialog.Append.Label=Append to sheet
GoogleSheetsOutputDialog.Share.Label=Share Full rights (RW) with
Expand Down

0 comments on commit 385a3f7

Please sign in to comment.