updateStatus_()

in marketing-analytics/activation/sheets-based-installer/src/apps_script/2_base/mojo.js [742:780]


  updateStatus_(rowStatus, rowIndex) {
    if (rowStatus.attributes) {
      rowStatus = Object.assign(rowStatus, rowStatus.attributes[0]);
      if (rowStatus.attributes.length > 1) {
        rowStatus.attributes.slice(1).forEach((attribute, index) => {
          if (attribute.attributeValue_datarange) {
            this.setDropList_('attributeValue', rowIndex + index + 1,
              attribute.attributeValue_datarange);
          }
          this.updateCells_({ attributeValue: attribute.attributeValue },
            rowIndex + index + 1);
        });
      }
    }
    const { status, message = '', value, attributeValue, refreshFn } = rowStatus;
    const cellValues = { status, note: message, value, attributeValue };
    this.updateCells_(cellValues, rowIndex);
    Object.keys(rowStatus)
      .filter((key) => key.endsWith('datarange'))
      .forEach((key) => {
        const columnName = key.split('_')[0];
        this.setDropList_(columnName, rowIndex, rowStatus[key]);
      });
    Object.keys(rowStatus)
      .filter((key) => key.endsWith('link'))
      .forEach((key) => {
        const columnName = key.split('_')[0];
        this.setLink_(columnName, rowIndex, rowStatus[key]);
      });
    if (refreshFn) {
      console.log(`Set row ${rowIndex} refresh Fn`, refreshFn);
      this.longTimeOperations[rowIndex] = refreshFn;
    } else {
      if (this.longTimeOperations[rowIndex]) {
        console.log(`Remove row ${rowIndex} refresh Fn`);
        delete this.longTimeOperations[rowIndex];
      }
    }
  }