Unverified Commit c52c92e0 authored by 向偲彪's avatar 向偲彪 Committed by GitHub
Browse files

Resource tree code merge (#2322)

* Change DOM label

* Change name to lowercase

* Limit customization file content to no more than 3000 lines

* dd branch flow node verification

* datax

* datax add custom

* Change normalize.scss import method and animation.scss license modification

* Resource tree code merge
parent eef8bf4e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
    "build:release": "npm run clean && cross-env NODE_ENV=production PUBLIC_PATH=/dolphinscheduler/ui webpack --config ./build/webpack.config.release.js"
  },
  "dependencies": {
    "@riophae/vue-treeselect": "^0.4.0",
    "ans-ui": "1.1.7",
    "axios": "^0.16.2",
    "bootstrap": "3.3.7",
+39 −51
Original line number Diff line number Diff line
@@ -48,19 +48,9 @@
    <m-list-box>
      <div slot="text">{{$t('Main jar package')}}</div>
      <div slot="content">
        <x-select
                style="width: 100%;"
                :placeholder="$t('Please enter main jar package')"
                v-model="mainJar"
                filterable
                :disabled="isDetails">
          <x-option
                  v-for="city in mainJarList"
                  :key="city.code"
                  :value="city.code"
                  :label="city.code">
          </x-option>
        </x-select>
        <treeselect v-model="mainJar" :options="mainJarLists" :disable-branch-nodes="true" :normalizer="normalizer" :placeholder="$t('Please enter main jar package')">
          <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName }}</div>
        </treeselect>
      </div>
    </m-list-box>
    <m-list-box>
@@ -151,12 +141,9 @@
    <m-list-box>
      <div slot="text">{{$t('Resources')}}</div>
      <div slot="content">
        <m-resources
                ref="refResources"
                @on-resourcesData="_onResourcesData"
                @on-cache-resourcesData="_onCacheResourcesData"
                :resource-list="resourceList">
        </m-resources>
        <treeselect v-model="resourceList" :multiple="true" :options="mainJarList" :normalizer="normalizer" :placeholder="$t('Please select resources')">
          <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName }}</div>
        </treeselect>
      </div>
    </m-list-box>
    <m-list-box>
@@ -178,6 +165,8 @@
  import mLocalParams from './_source/localParams'
  import mListBox from './_source/listBox'
  import mResources from './_source/resources'
  import Treeselect from '@riophae/vue-treeselect'
  import '@riophae/vue-treeselect/dist/vue-treeselect.css'
  import disabledState from '@/module/mixin/disabledState'

  export default {
@@ -189,6 +178,7 @@
        // Master jar package
        mainJar: null,
        // Master jar package(List)
        mainJarLists: [],
        mainJarList: [],
        // Deployment method
        deployMode: 'cluster',
@@ -215,7 +205,12 @@
        // Program type
        programType: 'SCALA',
        // Program type(List)
        programTypeList: [{ code: 'JAVA' }, { code: 'SCALA' }, { code: 'PYTHON' }]
        programTypeList: [{ code: 'JAVA' }, { code: 'SCALA' }, { code: 'PYTHON' }],
        normalizer(node) {
          return {
            label: node.name
          }
        }
      }
    },
    props: {
@@ -291,10 +286,6 @@
          return false
        }

        if (!this.$refs.refResources._verifResources()) {
          return false
        }

        // localParams Subcomponent verification
        if (!this.$refs.refLocalParams._verifProp()) {
          return false
@@ -304,10 +295,12 @@
        this.$emit('on-params', {
          mainClass: this.mainClass,
          mainJar: {
            res: this.mainJar
            id: this.mainJar
          },
          deployMode: this.deployMode,
          resourceList: this.resourceList,
          resourceList: _.map(this.resourceList, v => {
            return {id: v}
          }),
          localParams: this.localParams,
          slot: this.slot,
          taskManager: this.taskManager,
@@ -320,24 +313,12 @@
        })
        return true
      },
      /**
       * get resources list
       */
      _getResourcesList () {
        return new Promise((resolve, reject) => {
          let isJar = (alias) => {
            return alias.substring(alias.lastIndexOf('.') + 1, alias.length) !== 'jar'
          }
          this.mainJarList = _.map(_.cloneDeep(this.store.state.dag.resourcesListS), v => {
            return {
              id: v.id,
              code: v.alias,
              disabled: isJar(v.alias)
            }
      diGuiTree(item) {  // Recursive convenience tree structure
        item.forEach(item => {
          item.children === '' || item.children === undefined || item.children === null || item.children.length === 0?        
            delete item.children : this.diGuiTree(item.children);
        })
          resolve()
        })
      }
      },
    },
    watch: {
      // Listening type
@@ -356,10 +337,12 @@
        return {
          mainClass: this.mainClass,
          mainJar: {
            res: this.mainJar
            id: this.mainJar
          },
          deployMode: this.deployMode,
          resourceList: this.cacheResourceList,
          resourceList: _.map(this.resourceList, v => {
            return {id: v}
          }),
          localParams: this.localParams,
          slot: this.slot,
          taskManager: this.taskManager,
@@ -373,13 +356,17 @@
      }
    },
    created () {
      this._getResourcesList().then(() => {
        let item = this.store.state.dag.resourcesListS
        let items = this.store.state.dag.resourcesListJar
        this.diGuiTree(item)
        this.diGuiTree(items)
        this.mainJarList = item
        this.mainJarLists = items
        let o = this.backfillItem

        // Non-null objects represent backfill
        if (!_.isEmpty(o)) {
          this.mainClass = o.params.mainClass || ''
          this.mainJar = o.params.mainJar && o.params.mainJar.res ? o.params.mainJar.res : ''
          this.mainJar = o.params.mainJar && o.params.mainJar.id ? o.params.mainJar.id : ''
          this.deployMode = o.params.deployMode || ''
          this.slot = o.params.slot || 1
          this.taskManager = o.params.taskManager || '2'
@@ -393,7 +380,9 @@
          // backfill resourceList
          let resourceList = o.params.resourceList || []
          if (resourceList.length) {
            this.resourceList = resourceList
            this.resourceList = _.map(resourceList, v => {
              return v.id
            })
            this.cacheResourceList = resourceList
          }

@@ -403,12 +392,11 @@
            this.localParams = localParams
          }
        }
      })
    },
    mounted () {

    },
    components: { mLocalParams, mListBox, mResources }
    components: { mLocalParams, mListBox, mResources, Treeselect }
  }
</script>

+41 −52
Original line number Diff line number Diff line
@@ -44,19 +44,9 @@
    <m-list-box>
      <div slot="text">{{$t('Main jar package')}}</div>
      <div slot="content">
        <x-select
                style="width: 100%;"
                :placeholder="$t('Please enter main jar package')"
                v-model="mainJar"
                filterable
                :disabled="isDetails">
          <x-option
                  v-for="city in mainJarList"
                  :key="city.code"
                  :value="city.code"
                  :label="city.code">
          </x-option>
        </x-select>
        <treeselect v-model="mainJar" :options="mainJarLists" :disable-branch-nodes="true" :normalizer="normalizer" :placeholder="$t('Please enter main jar package')">
          <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName }}</div>
        </treeselect>
      </div>
    </m-list-box>
    <m-list-box>
@@ -88,12 +78,9 @@
    <m-list-box>
      <div slot="text">{{$t('Resources')}}</div>
      <div slot="content">
        <m-resources
                ref="refResources"
                @on-resourcesData="_onResourcesData"
                @on-cache-resourcesData="_onCacheResourcesData"
                :resource-list="resourceList">
        </m-resources>
        <treeselect v-model="resourceList" :multiple="true" :options="mainJarList" :normalizer="normalizer" :placeholder="$t('Please select resources')">
          <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName }}</div>
        </treeselect>
      </div>
    </m-list-box>
    <m-list-box>
@@ -115,6 +102,8 @@
  import mListBox from './_source/listBox'
  import mResources from './_source/resources'
  import mLocalParams from './_source/localParams'
  import Treeselect from '@riophae/vue-treeselect'
  import '@riophae/vue-treeselect/dist/vue-treeselect.css'
  import disabledState from '@/module/mixin/disabledState'
  export default {
    name: 'mr',
@@ -125,6 +114,7 @@
        // Master jar package
        mainJar: null,
        // Main jar package (List)
        mainJarLists: [],
        mainJarList: [],
        // Resource(list)
        resourceList: [],
@@ -139,7 +129,12 @@
        // Program type
        programType: 'JAVA',
        // Program type(List)
        programTypeList: [{ code: 'JAVA' }, { code: 'PYTHON' }]
        programTypeList: [{ code: 'JAVA' }, { code: 'PYTHON' }],
        normalizer(node) {
          return {
            label: node.name
          }
        }
      }
    },
    props: {
@@ -165,6 +160,12 @@
      _onCacheResourcesData (a) {
        this.cacheResourceList = a
      },
      diGuiTree(item) {  // Recursive convenience tree structure
        item.forEach(item => {
          item.children === '' || item.children === undefined || item.children === null || item.children.length === 0?        
            delete item.children : this.diGuiTree(item.children);
        })
      },
      /**
       * verification
       */
@@ -179,22 +180,19 @@
          return false
        }

        if (!this.$refs.refResources._verifResources()) {
          return false
        }

        // localParams Subcomponent verification
        if (!this.$refs.refLocalParams._verifProp()) {
          return false
        }

        // storage
        this.$emit('on-params', {
          mainClass: this.mainClass,
          mainJar: {
            res: this.mainJar
            id: this.mainJar
          },
          resourceList: this.resourceList,
          resourceList: _.map(this.resourceList, v => {
            return {id: v}
          }),
          localParams: this.localParams,
          mainArgs: this.mainArgs,
          others: this.others,
@@ -202,24 +200,7 @@
        })
        return true
      },
      /**
       * Get resource data
       */
      _getResourcesList () {
        return new Promise((resolve, reject) => {
          let isJar = (alias) => {
            return alias.substring(alias.lastIndexOf('.') + 1, alias.length) !== 'jar'
          }
          this.mainJarList = _.map(_.cloneDeep(this.store.state.dag.resourcesListS), v => {
            return {
              id: v.id,
              code: v.alias,
              disabled: isJar(v.alias)
            }
          })
          resolve()
        })
      }
    
    },
    watch: {
      /**
@@ -240,9 +221,11 @@
        return {
          mainClass: this.mainClass,
          mainJar: {
            res: this.mainJar
            id: this.mainJar
          },
          resourceList: this.cacheResourceList,
          resourceList: _.map(this.resourceList, v => {
            return {id: v}
          }),
          localParams: this.localParams,
          mainArgs: this.mainArgs,
          others: this.others,
@@ -251,13 +234,18 @@
      }
    },
    created () {
      this._getResourcesList().then(() => {
        let item = this.store.state.dag.resourcesListS
        let items = this.store.state.dag.resourcesListJar
        this.diGuiTree(item)
        this.diGuiTree(items)
        this.mainJarList = item
        this.mainJarLists = items
        let o = this.backfillItem

        // Non-null objects represent backfill
        if (!_.isEmpty(o)) {
          this.mainClass = o.params.mainClass || ''
          this.mainJar = o.params.mainJar.res || ''
          this.mainJar = o.params.mainJar.id || ''
          this.mainArgs = o.params.mainArgs || ''
          this.others = o.params.others
          this.programType = o.params.programType || 'JAVA'
@@ -265,7 +253,9 @@
          // backfill resourceList
          let resourceList = o.params.resourceList || []
          if (resourceList.length) {
            this.resourceList = resourceList
            this.resourceList = _.map(resourceList, v => {
              return v.id
            })
            this.cacheResourceList = resourceList
          }

@@ -275,12 +265,11 @@
            this.localParams = localParams
          }
        }
      })
    },
    mounted () {

    },
    components: { mLocalParams, mListBox, mResources }
    components: { mLocalParams, mListBox, mResources, Treeselect }
  }
</script>

+14 −36
Original line number Diff line number Diff line
@@ -108,10 +108,6 @@
          return false
        }

        if (!this.$refs.refResources._verifResources()) {
          return false
        }

        // localParams Subcomponent verification
        if (!this.$refs.refLocalParams._verifProp()) {
          return false
@@ -119,7 +115,9 @@

        // storage
        this.$emit('on-params', {
          resourceList: this.resourceList,
          resourceList: _.map(this.resourceList, v => {
            return {id: v}
          }),
          localParams: this.localParams,
          rawScript: editor.getValue()
        })
@@ -129,8 +127,6 @@
       * Processing code highlighting
       */
      _handlerEditor () {
        this._destroyEditor()

        // editor
        editor = codemirror('code-python-mirror', {
          mode: 'python',
@@ -145,45 +141,28 @@
          }
        }

        this.changes = () => {
          this._cacheParams()
        }

        // Monitor keyboard
        editor.on('keypress', this.keypress)

        editor.on('changes', this.changes)

        editor.setValue(this.rawScript)

        return editor
      },
      _cacheParams () {
        this.$emit('on-cache-params', {
          resourceList: this.cacheResourceList,
          localParams: this.localParams,
          rawScript: editor ? editor.getValue() : ''
        });
      },
      _destroyEditor () {
         if (editor) {
          editor.toTextArea() // Uninstall
          editor.off($('.code-python-mirror'), 'keypress', this.keypress)
          editor.off($('.code-python-mirror'), 'changes', this.changes)
        }
      }
    },
    watch: {
      //Watch the cacheParams
      cacheParams (val) {
        this._cacheParams()
        this.$emit('on-cache-params', val);
      }
    },
    computed: {
      cacheParams () {
        return {
          resourceList: this.cacheResourceList,
          localParams: this.localParams
          resourceList: _.map(this.resourceList, v => {
            return {id: v}
          }),
          localParams: this.localParams,
          rawScript: editor ? editor.getValue() : ''
        }
      }
    },
@@ -197,7 +176,9 @@
        // backfill resourceList
        let resourceList = o.params.resourceList || []
        if (resourceList.length) {
          this.resourceList = resourceList
          this.resourceList = _.map(resourceList, v => {
            return v.id
          })
          this.cacheResourceList = resourceList
        }

@@ -214,11 +195,8 @@
      }, 200)
    },
    destroyed () {
      if (editor) {
      editor.toTextArea() // Uninstall
      editor.off($('.code-python-mirror'), 'keypress', this.keypress)
        editor.off($('.code-python-mirror'), 'changes', this.changes)
      }
    },
    components: { mLocalParams, mListBox, mResources }
  }
+44 −36
Original line number Diff line number Diff line
@@ -32,6 +32,14 @@
      </div>
    </m-list-box>
    <m-list-box>
      <div slot="text">{{$t('Resources')}}</div>
      <div slot="content">
        <treeselect v-model="resourceList" :multiple="true" :options="options" :normalizer="normalizer" :placeholder="$t('Please select resources')">
          <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName }}</div>
        </treeselect>
      </div>
    </m-list-box>
    <!-- <m-list-box>
      <div slot="text">{{$t('Resources')}}</div>
      <div slot="content">
        <m-resources
@@ -41,7 +49,7 @@
                :resource-list="resourceList">
        </m-resources>
      </div>
    </m-list-box>
    </m-list-box> -->
    <m-list-box>
      <div slot="text">{{$t('Custom Parameters')}}</div>
      <div slot="content">
@@ -63,6 +71,8 @@
  import mResources from './_source/resources'
  import mLocalParams from './_source/localParams'
  import disabledState from '@/module/mixin/disabledState'
  import Treeselect from '@riophae/vue-treeselect'
  import '@riophae/vue-treeselect/dist/vue-treeselect.css'
  import codemirror from '@/conf/home/pages/resource/pages/file/pages/_source/codemirror'

  let editor
@@ -78,7 +88,14 @@
        // resource(list)
        resourceList: [],
        // Cache ResourceList
        cacheResourceList: []
        cacheResourceList: [],
        // define options
        options: [],
        normalizer(node) {
          return {
            label: node.name
          }
        },
      }
    },
    mixins: [disabledState],
@@ -143,17 +160,19 @@
          return false
        }

        if (!this.$refs.refResources._verifResources()) {
          return false
        }

        // localParams Subcomponent verification
        if (!this.$refs.refLocalParams._verifProp()) {
          return false
        }
        // Process resourcelist
        let dataProcessing= _.map(this.resourceList, v => {
          return {
            id: v
          }
        })
        // storage
        this.$emit('on-params', {
          resourceList: this.resourceList,
          resourceList: dataProcessing,
          localParams: this.localParams,
          rawScript: editor.getValue()
        })
@@ -163,8 +182,6 @@
       * Processing code highlighting
       */
      _handlerEditor () {
        this._destroyEditor()

        // editor
        editor = codemirror('code-shell-mirror', {
          mode: 'shell',
@@ -179,51 +196,41 @@
          }
        }

        this.changes = () => {
          this._cacheParams()
        }

        // Monitor keyboard
        editor.on('keypress', this.keypress)

        editor.on('changes', this.changes)

        editor.setValue(this.rawScript)

        return editor
      },
      _cacheParams () {
        this.$emit('on-cache-params', {
          resourceList: this.cacheResourceList,
          localParams: this.localParams,
          rawScript: editor ? editor.getValue() : ''
        });
      },
      _destroyEditor () {
         if (editor) {
          editor.toTextArea() // Uninstall
          editor.off($('.code-sql-mirror'), 'keypress', this.keypress)
          editor.off($('.code-sql-mirror'), 'changes', this.changes)
        }
      diGuiTree(item) {  // Recursive convenience tree structure
        item.forEach(item => {
          item.children === '' || item.children === undefined || item.children === null || item.children.length === 0?        
            delete item.children : this.diGuiTree(item.children);
        })
      }
    },
    watch: {
      //Watch the cacheParams
      cacheParams (val) {
        this._cacheParams()
        this.$emit('on-cache-params', val);
      }
    },
    computed: {
      cacheParams () {
        return {
          resourceList: this.cacheResourceList,
          localParams: this.localParams
          resourceList: _.map(this.resourceList, v => {
            return {id: v}
          }),
          localParams: this.localParams,
          rawScript: editor ? editor.getValue() : ''
        }
      }
    },
    created () {
      let item = this.store.state.dag.resourcesListS
      this.diGuiTree(item)
      this.options = item
      let o = this.backfillItem

      // Non-null objects represent backfill
      if (!_.isEmpty(o)) {
        this.rawScript = o.params.rawScript || ''
@@ -231,7 +238,9 @@
        // backfill resourceList
        let resourceList = o.params.resourceList || []
        if (resourceList.length) {
          this.resourceList = resourceList
          this.resourceList = _.map(resourceList, v => {
            return v.id
          })
          this.cacheResourceList = resourceList
        }

@@ -251,10 +260,9 @@
      if (editor) {
        editor.toTextArea() // Uninstall
        editor.off($('.code-shell-mirror'), 'keypress', this.keypress)
        editor.off($('.code-shell-mirror'), 'changes', this.changes)
      }
    },
    components: { mLocalParams, mListBox, mResources, mScriptBox }
    components: { mLocalParams, mListBox, mResources, mScriptBox, Treeselect }
  }
</script>
<style lang="scss" rel="stylesheet/scss" scope>
Loading