[18/50] [abbrv] hadoop git commit: YARN-4733. [YARN-3368] Initial commit of new YARN web UI. (wangda)
http://git-wip-us.apache.org/repos/asf/hadoop/blob/596acc5a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js new file mode 100644 index 000..d39885e --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js @@ -0,0 +1,29 @@ +import DS from 'ember-data'; + +export default DS.JSONAPISerializer.extend({ +normalizeSingleResponse(store, primaryModelClass, payload, id, + requestType) { + var fixedPayload = { +id: id, +type: primaryModelClass.modelName, +attributes: payload + }; + + return this._super(store, primaryModelClass, fixedPayload, id, +requestType); +}, + +normalizeArrayResponse(store, primaryModelClass, payload, id, + requestType) { + // return expected is { data: [ {}, {} ] } + var normalizedArrayResponse = {}; + + // payload has apps : { app: [ {},{},{} ] } + // need some error handling for ex apps or app may not be defined. + normalizedArrayResponse.data = [ +this.normalizeSingleResponse(store, primaryModelClass, + payload.clusterMetrics, 1, requestType) + ]; + return normalizedArrayResponse; +} +}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hadoop/blob/596acc5a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js new file mode 100644 index 000..c5394d0 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js @@ -0,0 +1,49 @@ +import DS from 'ember-data'; +import Converter from 'yarn-ui/utils/converter'; + +export default DS.JSONAPISerializer.extend({ +internalNormalizeSingleResponse(store, primaryModelClass, payload, id, + requestType) { + + if (payload.appAttempt) { +payload = payload.appAttempt; + } + + var fixedPayload = { +id: payload.appAttemptId, +type: primaryModelClass.modelName, // yarn-app +attributes: { + startTime: Converter.timeStampToDate(payload.startTime), + finishedTime: Converter.timeStampToDate(payload.finishedTime), + containerId: payload.containerId, + nodeHttpAddress: payload.nodeHttpAddress, + nodeId: payload.nodeId, + state: payload.nodeId, + logsLink: payload.logsLink +} + }; + + return fixedPayload; +}, + +normalizeSingleResponse(store, primaryModelClass, payload, id, + requestType) { + var p = this.internalNormalizeSingleResponse(store, +primaryModelClass, payload, id, requestType); + return { data: p }; +}, + +normalizeArrayResponse(store, primaryModelClass, payload, id, + requestType) { + // return expected is { data: [ {}, {} ] } + var normalizedArrayResponse = {}; + + // payload has apps : { app: [ {},{},{} ] } + // need some error handling for ex apps or app may not be defined. + normalizedArrayResponse.data = payload.appAttempts.appAttempt.map(singleApp => { +return this.internalNormalizeSingleResponse(store, primaryModelClass, + singleApp, singleApp.id, requestType); + }, this); + return normalizedArrayResponse; +} +}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hadoop/blob/596acc5a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js new file mode 100644 index 000..a038fff --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js @@ -0,0 +1,66 @@ +import DS from 'ember-data'; +import Converter from 'yarn-ui/utils/converter'; + +export default DS.JSONAPISerializer.extend({ +internalNormalizeSingleResponse(store, primaryModelClass, payload, id, + requestType) { + if (payload.app) { +payload = payload.app; + } + + var fixedPayload = { +id: id, +type: primaryModelClass.modelName, // yarn-app +attributes: { + appName: payload.name, + user: payload.user, + queue: payload.queue, + state: payload.state, + startTime: Converter.timeStampToDate(payload.startedTime), + elapsedTime: Conver
[18/50] [abbrv] hadoop git commit: YARN-4733. [YARN-3368] Initial commit of new YARN web UI. (wangda)
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c04d7e55/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js new file mode 100644 index 000..d39885e --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/cluster-metric.js @@ -0,0 +1,29 @@ +import DS from 'ember-data'; + +export default DS.JSONAPISerializer.extend({ +normalizeSingleResponse(store, primaryModelClass, payload, id, + requestType) { + var fixedPayload = { +id: id, +type: primaryModelClass.modelName, +attributes: payload + }; + + return this._super(store, primaryModelClass, fixedPayload, id, +requestType); +}, + +normalizeArrayResponse(store, primaryModelClass, payload, id, + requestType) { + // return expected is { data: [ {}, {} ] } + var normalizedArrayResponse = {}; + + // payload has apps : { app: [ {},{},{} ] } + // need some error handling for ex apps or app may not be defined. + normalizedArrayResponse.data = [ +this.normalizeSingleResponse(store, primaryModelClass, + payload.clusterMetrics, 1, requestType) + ]; + return normalizedArrayResponse; +} +}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hadoop/blob/c04d7e55/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js new file mode 100644 index 000..c5394d0 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app-attempt.js @@ -0,0 +1,49 @@ +import DS from 'ember-data'; +import Converter from 'yarn-ui/utils/converter'; + +export default DS.JSONAPISerializer.extend({ +internalNormalizeSingleResponse(store, primaryModelClass, payload, id, + requestType) { + + if (payload.appAttempt) { +payload = payload.appAttempt; + } + + var fixedPayload = { +id: payload.appAttemptId, +type: primaryModelClass.modelName, // yarn-app +attributes: { + startTime: Converter.timeStampToDate(payload.startTime), + finishedTime: Converter.timeStampToDate(payload.finishedTime), + containerId: payload.containerId, + nodeHttpAddress: payload.nodeHttpAddress, + nodeId: payload.nodeId, + state: payload.nodeId, + logsLink: payload.logsLink +} + }; + + return fixedPayload; +}, + +normalizeSingleResponse(store, primaryModelClass, payload, id, + requestType) { + var p = this.internalNormalizeSingleResponse(store, +primaryModelClass, payload, id, requestType); + return { data: p }; +}, + +normalizeArrayResponse(store, primaryModelClass, payload, id, + requestType) { + // return expected is { data: [ {}, {} ] } + var normalizedArrayResponse = {}; + + // payload has apps : { app: [ {},{},{} ] } + // need some error handling for ex apps or app may not be defined. + normalizedArrayResponse.data = payload.appAttempts.appAttempt.map(singleApp => { +return this.internalNormalizeSingleResponse(store, primaryModelClass, + singleApp, singleApp.id, requestType); + }, this); + return normalizedArrayResponse; +} +}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hadoop/blob/c04d7e55/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js new file mode 100644 index 000..a038fff --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/app/serializers/yarn-app.js @@ -0,0 +1,66 @@ +import DS from 'ember-data'; +import Converter from 'yarn-ui/utils/converter'; + +export default DS.JSONAPISerializer.extend({ +internalNormalizeSingleResponse(store, primaryModelClass, payload, id, + requestType) { + if (payload.app) { +payload = payload.app; + } + + var fixedPayload = { +id: id, +type: primaryModelClass.modelName, // yarn-app +attributes: { + appName: payload.name, + user: payload.user, + queue: payload.queue, + state: payload.state, + startTime: Converter.timeStampToDate(payload.startedTime), + elapsedTime: Conver