Tangerine-Community / Tangerine

Digitize your offline data collection. Create your Forms online with Tangerine Editor, conduct them offline with the Tangerine Android App. All results you collect can be exported as a CSV file, easy for processing in a spreadsheet. Tangerine has been used in over 1 million assessments and surveys in over 60 countries and in 100 languages.
http://www.tangerinecentral.org/
GNU General Public License v3.0
49 stars 29 forks source link

T_ARCHIVE_APKS_TO_DISK and/or T_ARCHIVE_PWAS_TO_DISK setting have no effect #2608

Closed lachko closed 3 years ago

lachko commented 3 years ago

Both settings have no effect in the config file: T_ARCHIVE_APKS_TO_DISK="false" T_ARCHIVE_PWAS_TO_DISK="false"

What is the expected output if those are to be used? We will not see historical links?

chrisekelley commented 3 years ago

We will see the links to historical archives, but it does not generate the file, so nothing downloads.

lachko commented 3 years ago

That's even more confusing ...

chrisekelley commented 3 years ago

We can iterate on this - I agree it is confusing. There is some internal plumbing that needs to be sorted before we can close this gap - exposing T_ARCHIVE_APKS_TO_DISK - which is in node-land on the server- to the Angular client. I'll place this into the 3.18 milestone.

lachko commented 3 years ago

flagging this again and marking it as a blocker for deployment. We cannot ship a screen to clients with links that do not work

lachko commented 3 years ago

@rjsteinert @chrisekelley how can this setting be exposed so that angular does't build those non working links? Can angular check if the file exist and if not print text instead of href

chrisekelley commented 3 years ago

We might be able to do the same approach we did with the CSV sync fix - https://github.com/Tangerine-Community/Tangerine/issues/2635 - and have those vars stored in the group doc instead of in config.sh:

const groupsDb = new DB(`groups`)
    let groupConfigurationDoc
    try {
      groupConfigurationDoc = await groupsDb.get(groupId)
    } catch (err) {
      console.log('Error: ' + JSON.stringify(err))

    }
let archivePWAs = groupConfigurationDoc?groupConfigurationDoc["archivePWAs"] : false

That negative part of this approach is that the group admin would need to add this setting manually, unless we create an upgrade script.

chrisekelley commented 3 years ago

Another way would be to expose the T_ARCHIVE_PWAs node var to the editor Angular context - involving environment.ts like this? https://medium.com/@ferie/how-to-pass-environment-variables-at-building-time-in-an-angular-application-using-env-files-4ae1a80383c. As part of the build process for editor, set-env.ts would run and grab the relevant config settings from process.env such as process.env.T_ARCHIVE_PWAs.

@rjsteinert - Do we currently have a way to get node env vars declared in config.sh into the editor's Angular context? Do you favor either of these approaches I suggested above? (either setting them in. the groups/groupId doc - which places more work on the group admin- or grabbing the process.env.VAR and generating a new environment.ts whenever the app is built.)

chrisekelley commented 3 years ago

Resolved in @evansdianga PR #2659

image