浏览代码

HUE-8752: [editor] Variable substitution does not use the default value when empty (#814)

Mykhailo Kysliuk 6 年之前
父节点
当前提交
8a1469e
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      desktop/core/src/desktop/js/apps/notebook/snippet.js

+ 3 - 1
desktop/core/src/desktop/js/apps/notebook/snippet.js

@@ -949,9 +949,11 @@ class Snippet {
             const pad =
               variable.type() == 'datetime-local' && variable.value().length == 16 ? ':00' : ''; // Chrome drops the seconds from the timestamp when it's at 0 second.
             const value = variable.value();
+            const isValuePresent = //If value is string there is a need to check whether it is empty
+              typeof value === 'string' ? value : value !== undefined && value !== null;
             return (
               p1 +
-              (value !== undefined && value !== null
+              (isValuePresent
                 ? value + pad
                 : variable.meta.placeholder && variable.meta.placeholder())
             );