From a9d631c0dc2f9d3abfb595066283c4fcbd6b7d4f Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Fri, 6 Oct 2017 14:12:55 +0200 Subject: [PATCH 01/16] Remove useless method This method was private and not used so it has been removed Change-Id: I8d4799dfd499fcc6b046ff59b449d79abd28dc40 Issue-ID: CLAMP-54 Signed-off-by: Determe, Sebastien (sd378r) --- .../org/onap/clamp/clds/client/req/SdcReq.java | 40 ---------------------- 1 file changed, 40 deletions(-) diff --git a/src/main/java/org/onap/clamp/clds/client/req/SdcReq.java b/src/main/java/org/onap/clamp/clds/client/req/SdcReq.java index cb8af0a1..640d3b0c 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/SdcReq.java +++ b/src/main/java/org/onap/clamp/clds/client/req/SdcReq.java @@ -94,46 +94,6 @@ public class SdcReq { return updatedBlueprint; } - private static String getUpdatedBlueprintWithConfiguration(RefProp refProp, ModelProperties prop, String yamlValue, - ObjectNode serviceConf) throws IOException { - String blueprint = ""; - Yaml yaml = new Yaml(); - // Serialiaze Yaml file - Map loadedYaml = (Map) yaml.load(yamlValue); - // Get node templates information from Yaml - Map nodeTemplates = loadedYaml.get("node_templates"); - logger.info("value of NodeTemplates:" + nodeTemplates); - // Get Tca Object information from node templates of Yaml - Map tcaObject = nodeTemplates.get("MTCA"); - logger.info("value of Tca:" + tcaObject); - // Get Properties Object information from tca of Yaml - Map propsObject = tcaObject.get("properties"); - logger.info("value of PropsObject:" + propsObject); - String deploymentJsonObject = propsObject.get("deployment_JSON"); - logger.info("value of deploymentJson:" + deploymentJsonObject); - - ObjectMapper mapper = new ObjectMapper(); - - ObjectNode deployJsonNode = (ObjectNode) mapper.readTree(deploymentJsonObject); - - // "policyName":"example_model06.ClosedLoop_FRWL_SIG_0538e6f2_8c1b_4656_9999_3501b3c59ad7_Tca_", - String policyNamePrefix = refProp.getStringValue("policy.ms.policyNamePrefix"); - String policyName = prop.getCurrentPolicyScopeAndFullPolicyName(policyNamePrefix); - serviceConf.put("policyName", policyName); - - deployJsonNode.set("configuration", serviceConf); - propsObject.put("deployment_JSON", deployJsonNode.toString()); - blueprint = yaml.dump(loadedYaml); - // To remove new lines in blueprint for deployment_json - String[] deploymentJson = blueprint.split(" deployment_JSON:"); - String beforeJson = deploymentJson[0]; - String afterJson = deploymentJson[1].replaceAll("\\s+", " "); - blueprint = beforeJson + " deployment_JSON:" + afterJson; - logger.info("value of updated Yaml File:" + blueprint); - - return blueprint; - } - public static String formatSdcLocationsReq(ModelProperties prop, String artifactName) { ObjectMapper objectMapper = new ObjectMapper(); Global global = prop.getGlobal(); -- 2.16.6 From 433d254989ecef089586db6b20da1a68891b6e4d Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Fri, 6 Oct 2017 17:46:08 +0200 Subject: [PATCH 02/16] Fix the bad test This test fails when pnfType is set in the yaml Change-Id: I7ec3996ca0bbf40334063011d9d745155b1ba6e8 Issue-ID: CLAMP-54 Signed-off-by: Determe, Sebastien (sd378r) --- src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java b/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java index 8fba5736..c87bbf62 100644 --- a/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java @@ -76,7 +76,7 @@ public class OperationPolicyReqItCase extends AbstractItCase { yaml = yaml.replaceAll("id: (.*)", "id: "); yaml = yaml.replaceAll("success: (.*)", "success: "); // Remove this field as not always present (depends of policy api) - yaml = yaml.replaceAll(" pnf: null", ""); + yaml = yaml.replaceAll(" pnf: null" + System.lineSeparator(), ""); yaml = yaml.substring(yaml.indexOf("controlLoop:"), yaml.length()); assertEquals(ResourceFileUtil.getResourceAsString("example/operational-policy/yaml-policy-chain-1.yaml"), yaml); @@ -86,7 +86,7 @@ public class OperationPolicyReqItCase extends AbstractItCase { yaml = yaml.replaceAll("id: (.*)", "id: "); yaml = yaml.replaceAll("success: (.*)", "success: "); // Remove this field as not always present (depends of policy api) - yaml = yaml.replaceAll(" pnf: null", ""); + yaml = yaml.replaceAll(" pnf: null" + System.lineSeparator(), ""); yaml = yaml.substring(yaml.indexOf("controlLoop:"), yaml.length()); assertEquals(ResourceFileUtil.getResourceAsString("example/operational-policy/yaml-policy-chain-2.yaml"), yaml); -- 2.16.6 From 5fce1d5e1eaaccdd4fb219d7b370bee9af5b66e5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ana=C3=ABl=20Closson?= Date: Mon, 9 Oct 2017 14:01:27 +0200 Subject: [PATCH 03/16] Inverted patch commited MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The previous patch on this file has been commited with a not up to date codebase and previously made changes were overwritten. Change-Id: I0731a4a228e8bbdff46c09dee757d076eebcc799 Issue-ID: CLAMP-54 Signed-off-by: Anaël Closson --- .../META-INF/resources/designer/scripts/aOnBoot.js | 87 ++++++++-------------- 1 file changed, 31 insertions(+), 56 deletions(-) diff --git a/src/main/resources/META-INF/resources/designer/scripts/aOnBoot.js b/src/main/resources/META-INF/resources/designer/scripts/aOnBoot.js index 89807d62..01a39b62 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/aOnBoot.js +++ b/src/main/resources/META-INF/resources/designer/scripts/aOnBoot.js @@ -112,62 +112,37 @@ function loadPropertyWindow(type) { } function setMultiSelect() { - $("select").each(function(index, mySelect) { - if ($(mySelect).parents(".multiselect-native-select") && - $(mySelect).parents(".multiselect-native-select").length < 1) { - if (!$(mySelect).attr("multiple")) { - if ($(mySelect).attr("enableFilter")) { - $(mySelect).multiselect({ - numberDisplayed: 1, - maxHeight: 200 - }); - } else { - $(mySelect).multiselect({ - numberDisplayed: 1, - enableFiltering: true, - maxHeight: 200 - }); - } - - } else { - $(mySelect).multiselect({ - numberDisplayed: 1, - includeSelectAllOption: true, - enableFiltering: true, - maxHeight: 200, - enableCaseInsensitiveFiltering: true - }); - } - - } else if ($(mySelect).parents(".multiselect-native-select") && - $(mySelect).parents(".multiselect-native-select").length > 0) { - var selectDrop = $(mySelect).parent(".multiselect-native-select").find("select"); - $(mySelect).parent(".multiselect-native-select").parent().html(selectDrop); - if (!$(mySelect).attr("multiple")) { - if ($(mySelect).attr("enableFilter")) { - $(mySelect).multiselect({ - numberDisplayed: 1, - maxHeight: 200 - }); - } else { - $(mySelect).multiselect({ - numberDisplayed: 1, - enableFiltering: true, - maxHeight: 200 - }); - } - } else { - $(mySelect).multiselect({ - numberDisplayed: 1, - includeSelectAllOption: true, - enableFiltering: true, - maxHeight: 200, - enableCaseInsensitiveFiltering: true - }); - } - } - }); - //refeshMultiSelect(); + $("select").each(function(index, mySelect) { + + var mySelectObj = $(mySelect); + if (! mySelectObj.parents(".multiselect-native-select")) { + // keep native for this one + return; + } + + if (mySelectObj.parents(".multiselect-native-select").length > 0) { + var selectDrop = mySelectObj.parent(".multiselect-native-select").find("select"); + mySelectObj.parent(".multiselect-native-select").parent().html(selectDrop); + } + + var options = { + numberDisplayed: 1, + maxHeight: 200 + }; + + if (mySelectObj.attr("multiple") + && mySelectObj.attr("multiple") != 'false') { + options.includeSelectAllOption = true; + } + + if (mySelectObj.attr("enableFilter") + && mySelectObj.attr("enableFilter") != 'false') { + options.enableCaseInsensitiveFiltering = true; + options.enableFiltering = true; + } + + mySelectObj.multiselect(options); + }); } function loadSharedPropertyByService(onChangeUUID, refresh, callBack) { -- 2.16.6 From 993331539bbe8d2e2190c9dd7caf277872246236 Mon Sep 17 00:00:00 2001 From: martial Date: Wed, 11 Oct 2017 13:49:07 +0200 Subject: [PATCH 04/16] Documentation update Change-Id: I74f093304ebfc5f0c77bd880eefd6cfc63c654f7 Signed-off-by: martial Issue-ID: CLAMP-16 --- docs/index.rst | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index d0f004b5..6058420e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,3 +1,7 @@ + + + + .. This work is licensed under a Creative Commons Attribution 4.0 International License. .. http://creativecommons.org/licenses/by/4.0 .. Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -17,7 +21,22 @@ At a higher level, CLAMP is about supporting and managing the broad operational .. toctree:: - :maxdepth: 1 +:maxdepth: 1 + +Offered APIs +------------ +CLAMP offers the following API's: +-) HealthCheck + URL: http://:8080/restservices/clds/v1/clds/healthcheck + if in good health it will return OK: "HTTP/1.1 200", and the following json string content:{"healthCheckComponent":"CLDS-APP","healthCheckStatus":"UP","description":"OK"} + + +Consumed APIs +------------- +CLAMP uses the API's exposed by the following ONAP components: +-) SDC : Rest based interface exposed by the SDC, Distribution of service to DCAE +-) DCAE: Rest based interface exposed by DCAE, Common Controller Framework, DCAE microservices onboarded (TCA, Stringmatch, Holmes (optional)) +-) Policy: Rest based interface (the Policy team provide a "jar" to handle the communication), both XACML and Drools PDP, APIs to App-C/VF-C/SDN-C Delivery @@ -114,7 +133,7 @@ Administration -------------- A user can access CLAMP UI at the following URL : http://localhost:8080/designer/index.html. - +(in this URL 'localhost' must be replaced by the actual host where CLAMP has been installed if it is not your current localhost) Default username : admin Default password : password @@ -124,5 +143,18 @@ Human Interfaces .. Basic info on the interface type, ports/protocols provided over, etc. User Interface (CLAMP Designer) - serve to configure control loop +The following actions are done using the UI: + +• Design a control loop flow by selecting a predefined template from a list + (a template is an orchestration chain of Micro-services, so the template defines how the micro-services of the control loop are chained together) +• Give value to the configuration the parameters of each micro-service of the control loop +• Select the service and VNF(of that service) to which the control loop will be attached +• Configure the operational policy(the actual operation resulting from the control loop) +• Generate the “TOSCA” blueprint that will be used by DCAE to start the control loop + (The blueprint will be sent first to SDC and SDC will publish it to DCAE) +• Trigger the deployment of the Control loop in DCAE +• Control (start/stop) the operation of the control loop in DCAE + + -HealthCheck API - serve to verify CLAMP status \ No newline at end of file +HealthCheck API - serve to verify CLAMP status (see offered API's section) \ No newline at end of file -- 2.16.6 From a6c79acde23a0dead6cab4e32cd6934050df07aa Mon Sep 17 00:00:00 2001 From: xg353y Date: Tue, 10 Oct 2017 15:45:46 +0200 Subject: [PATCH 05/16] Update the TCA blueprint format Change-Id: Ib5b6fe1b46a509bea6c40ebc8ec9058990e5f64d Signed-off-by: xg353y Issue-ID: CLAMP-59 --- .../org/onap/clamp/clds/client/req/OperationalPolicyReq.java | 4 ++-- .../org/onap/clamp/clds/client/req/TcaRequestFormatter.java | 10 ++++++++++ src/main/resources/clds/clds-reference.properties | 1 + .../resources/example/tca-policy-req/blueprint-expected.yaml | 3 +++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/onap/clamp/clds/client/req/OperationalPolicyReq.java b/src/main/java/org/onap/clamp/clds/client/req/OperationalPolicyReq.java index 1d345e9c..a5506da9 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/OperationalPolicyReq.java +++ b/src/main/java/org/onap/clamp/clds/client/req/OperationalPolicyReq.java @@ -178,7 +178,7 @@ public class OperationalPolicyReq { * @throws BuilderException * @throws UnsupportedEncodingException */ - private static String formatYaml(RefProp refProp, ModelProperties prop, String modelElementId, + public static String formatYaml(RefProp refProp, ModelProperties prop, String modelElementId, PolicyChain policyChain) throws BuilderException, UnsupportedEncodingException { // get property objects @@ -253,7 +253,7 @@ public class OperationalPolicyReq { * @throws BuilderException * @throws UnsupportedEncodingException */ - private static String formateNodeBYaml(RefProp refProp, ModelProperties prop, String modelElementId, + public static String formateNodeBYaml(RefProp refProp, ModelProperties prop, String modelElementId, PolicyChain policyChain) throws BuilderException, UnsupportedEncodingException { // get property objects diff --git a/src/main/java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java b/src/main/java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java index 3fbf8739..c2590d76 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java +++ b/src/main/java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java @@ -29,6 +29,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.dataformat.yaml.snakeyaml.Yaml; +import java.util.HashMap; import java.util.Map; import org.onap.clamp.clds.exception.TcaRequestFormatterException; @@ -150,6 +151,15 @@ public class TcaRequestFormatter { Map loadedYaml = (Map) yaml.load(yamlValue); Map nodeTemplates = (Map) loadedYaml.get("node_templates"); + //add policy_0 section in blueprint + Map policyObject = new HashMap (); + Map policyIdObject = new HashMap (); + String policyPrefix = refProp.getStringValue("tca.policyid.prefix"); + policyIdObject.put("policy_id", policyPrefix + modelProperties.getCurrentPolicyScopeAndPolicyName()); + policyObject.put("type", "dcae.nodes.policy"); + policyObject.put("properties", policyIdObject); + nodeTemplates.put("policy_0", policyObject); + Map tcaObject = (Map) nodeTemplates.get("tca_tca"); Map propsObject = (Map) tcaObject.get("properties"); Map appPreferences = (Map) propsObject.get("app_preferences"); diff --git a/src/main/resources/clds/clds-reference.properties b/src/main/resources/clds/clds-reference.properties index eadfb32a..fd7af5ef 100644 --- a/src/main/resources/clds/clds-reference.properties +++ b/src/main/resources/clds/clds-reference.properties @@ -47,6 +47,7 @@ policy.op.policyNamePrefix=Config_BRMS_Param_ # TCA MicroService Policy request build properties # +tca.policyid.prefix=DCAE.Config_ tca.template={"cdap-tca-hi-lo_policy": {"domain": "measurementsForVfScaling","metricsPerEventName": [{"eventName": "???","policyScope": "DCAE","policyName": "???","policyVersion": "v0.0.1","thresholds": []}]}} tca.thresholds.template={"closedLoopControlName": "???", "controlLoopSchema": "VM","version": "1.0.2","fieldPath": "?????", "thresholdValue": 0,"direction": "???","severity": "MAJOR", "closedLoopEventStatus": "???"} diff --git a/src/test/resources/example/tca-policy-req/blueprint-expected.yaml b/src/test/resources/example/tca-policy-req/blueprint-expected.yaml index cd8ebd8f..747d342c 100644 --- a/src/test/resources/example/tca-policy-req/blueprint-expected.yaml +++ b/src/test/resources/example/tca-policy-req/blueprint-expected.yaml @@ -48,3 +48,6 @@ node_templates: streamname: TCASubscriberOutputStream relationships: - {target: cdap_host_host, type: dcae.relationships.component_contained_in} + policy_0: + type: dcae.nodes.policy + properties: {policy_id: nullexample_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4} -- 2.16.6 From 5a4461214580eaefd8d50bbadda9d2356c2ffe32 Mon Sep 17 00:00:00 2001 From: xg353y Date: Tue, 17 Oct 2017 10:39:38 +0200 Subject: [PATCH 06/16] Add Policy dependency Add policy deppendency to solve NoClassFoundException issue. Issue-ID:CLAMP-61 Change-Id: Iaf20852aff0313d3f503773468222113888940e9 Signed-off-by: xg353y --- pom.xml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ac088454..623efec0 100644 --- a/pom.xml +++ b/pom.xml @@ -391,7 +391,25 @@ - + + org.onap.policy.engine + PolicyEngineUtils + 1.1.0 + + + log4j + log4j + + + org.slf4j + slf4j-log4j12 + + + apache-log4j-extras + log4j + + + org.onap.policy.drools-applications policy-yaml -- 2.16.6 From b9fd58d2c664e23d3f8c96dbfdae9cefcc451b3e Mon Sep 17 00:00:00 2001 From: eh552t Date: Tue, 17 Oct 2017 11:08:02 +0200 Subject: [PATCH 07/16] Add config folder to be able to change config Change-Id: Icd0fe1a261370f21ee391aaf3294e84b2b33deb7 Signed-off-by: eh552t Issue-ID: CLAMP-61 --- extra/docker/clamp/docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extra/docker/clamp/docker-compose.yml b/extra/docker/clamp/docker-compose.yml index a4a935ad..28dc83c1 100644 --- a/extra/docker/clamp/docker-compose.yml +++ b/extra/docker/clamp/docker-compose.yml @@ -14,6 +14,8 @@ services: clamp: image: onap/clamp + volumes: + - "./config/:/opt/clamp/config:rw" depends_on: - db env_file: -- 2.16.6 From 8ecddd315559babae58e02d2e9a98da11fe54aa3 Mon Sep 17 00:00:00 2001 From: Eric Debeau Date: Fri, 20 Oct 2017 20:21:57 +0000 Subject: [PATCH 08/16] Corrections to pass doc8 and minor corrections Change-Id: I4ee1613a446ca02b9dc94506f5cf455dd161beb0 Issue-ID: DOC-94 Signed-off-by: Eric Debeau --- docs/index.rst | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 6058420e..1efc5ad5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -25,23 +25,29 @@ At a higher level, CLAMP is about supporting and managing the broad operational Offered APIs ------------ -CLAMP offers the following API's: --) HealthCheck +CLAMP offers the following API: +* HealthCheck URL: http://:8080/restservices/clds/v1/clds/healthcheck - if in good health it will return OK: "HTTP/1.1 200", and the following json string content:{"healthCheckComponent":"CLDS-APP","healthCheckStatus":"UP","description":"OK"} + if in good health it will return OK: "HTTP/1.1 200", and the following json string content: +.. code-block:: json + { + "healthCheckComponent": "CLDS-APP", + "healthCheckStatus": "UP", + "description": "OK" + } Consumed APIs ------------- CLAMP uses the API's exposed by the following ONAP components: --) SDC : Rest based interface exposed by the SDC, Distribution of service to DCAE --) DCAE: Rest based interface exposed by DCAE, Common Controller Framework, DCAE microservices onboarded (TCA, Stringmatch, Holmes (optional)) --) Policy: Rest based interface (the Policy team provide a "jar" to handle the communication), both XACML and Drools PDP, APIs to App-C/VF-C/SDN-C +* SDC : REST based interface exposed by the SDC, Distribution of service to DCAE +* DCAE: REST based interface exposed by DCAE, Common Controller Framework, DCAE microservices onboarded (TCA, Stringmatch, Holmes (optional)) +* Policy: REST based interface (the Policy team provide a "jar" to handle the communication), both XACML and Drools PDP, APIs to App-C/VF-C/SDN-C Delivery -------- -CLAMP component is composed of a UI layer and a BackEND layer and packaged into a single container. +CLAMP component is composed of a UI layer and a BackEnd layer and packaged into a single container. CLAMP also requires a database instance with 2 DB, it uses MariaDB. .. blockdiag:: @@ -67,9 +73,9 @@ CLAMP also requires a database instance with 2 DB, it uses MariaDB. Logging & Diagnostic Information -------------------------------- -Clamp uses logback framework to generate logs. The logback.xml file cand be found under the [src/main/resources/ folder](src/main/resources). +CLAMP uses logback framework to generate logs. The logback.xml file cand be found under the [src/main/resources/ folder](src/main/resources). -With the default log settings, all logs will be generated into console and into root.log file under the Clamp root folder. The root.log file is not allowed to be appended, thus restarting the clamp will result in cleaning of the old log files. +With the default log settings, all logs will be generated into console and into root.log file under the CLAMP root folder. The root.log file is not allowed to be appended, thus restarting the CLAMP will result in cleaning of the old log files. @@ -77,7 +83,7 @@ Installation ------------ A [docker-compose example file](extra/docker/clamp/docker-compose.yml) can be found under the [extra/docker/clamp/ folder](extra/docker/). -Once the image has been built and is available locally, you can use the `docker-compose up` command to deploy a prepopullated database and a clamp instance available on [http://localhost:8080/designer/index.html](http://localhost:8080/designer/index.html). +Once the image has been built and is available locally, you can use the `docker-compose up` command to deploy a prepopullated database and a CLAMP instance available on [http://localhost:8080/designer/index.html](http://localhost:8080/designer/index.html). Configuration ------------- @@ -85,7 +91,7 @@ Configuration .. What are parameters and values? -Currently, the clamp docker image can be deployed with small configuration needs. Though, you might need to make small adjustments to the configuration. As clamp is spring based, you can use the SPRING_APPLICATION_JSON environment variable to update its parameters. +Currently, the CLAMP docker image can be deployed with small configuration needs. Though, you might need to make small adjustments to the configuration. As CLAMP is spring based, you can use the SPRING_APPLICATION_JSON environment variable to update its parameters. .. TODO detail config parameters and the usage @@ -134,8 +140,9 @@ Administration A user can access CLAMP UI at the following URL : http://localhost:8080/designer/index.html. (in this URL 'localhost' must be replaced by the actual host where CLAMP has been installed if it is not your current localhost) -Default username : admin -Default password : password +.. code-block:: + Default username : admin + Default password : password Human Interfaces @@ -151,10 +158,10 @@ The following actions are done using the UI: • Select the service and VNF(of that service) to which the control loop will be attached • Configure the operational policy(the actual operation resulting from the control loop) • Generate the “TOSCA” blueprint that will be used by DCAE to start the control loop - (The blueprint will be sent first to SDC and SDC will publish it to DCAE) + (The blueprint will be sent first to SDC and SDC will publish it to DCAE) • Trigger the deployment of the Control loop in DCAE • Control (start/stop) the operation of the control loop in DCAE -HealthCheck API - serve to verify CLAMP status (see offered API's section) \ No newline at end of file +HealthCheck API - serve to verify CLAMP status (see offered API's section) -- 2.16.6 From 2ed900bc82c87e7b7c08d19e097d68dbf5c31640 Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Tue, 24 Oct 2017 14:13:25 +0200 Subject: [PATCH 09/16] Remove datatable lib Remove datatable lib and its associated designer UI code Change-Id: I328bad242d478a43e3b77716491aa921ade37a64 Issue-ID: CLAMP-63 Signed-off-by: Determe, Sebastien (sd378r) --- .../designer/css/dataTables.bootstrap.css | 233 -- .../designer/css/dataTables.fixedColumns.css | 22 - .../designer/css/dataTables.tableTools.css | 361 --- .../resources/designer/lib/dataTables.bootstrap.js | 245 -- .../designer/lib/dataTables.fixedColumns.js | 1413 --------- .../designer/lib/dataTables.searchHighlight.min.js | 6 - .../designer/lib/dataTables.tableTools.js | 3215 -------------------- .../partials/portfolios/clds_modelling.html | 7 +- .../designer/partials/portfolios/dashboard.html | 2 +- .../resources/designer/scripts/DashboardCtrl.js | 656 +--- 10 files changed, 85 insertions(+), 6075 deletions(-) delete mode 100644 src/main/resources/META-INF/resources/designer/css/dataTables.bootstrap.css delete mode 100644 src/main/resources/META-INF/resources/designer/css/dataTables.fixedColumns.css delete mode 100644 src/main/resources/META-INF/resources/designer/css/dataTables.tableTools.css delete mode 100644 src/main/resources/META-INF/resources/designer/lib/dataTables.bootstrap.js delete mode 100644 src/main/resources/META-INF/resources/designer/lib/dataTables.fixedColumns.js delete mode 100644 src/main/resources/META-INF/resources/designer/lib/dataTables.searchHighlight.min.js delete mode 100644 src/main/resources/META-INF/resources/designer/lib/dataTables.tableTools.js diff --git a/src/main/resources/META-INF/resources/designer/css/dataTables.bootstrap.css b/src/main/resources/META-INF/resources/designer/css/dataTables.bootstrap.css deleted file mode 100644 index c07dac9a..00000000 --- a/src/main/resources/META-INF/resources/designer/css/dataTables.bootstrap.css +++ /dev/null @@ -1,233 +0,0 @@ -div.dataTables_length label { - float: left; - text-align: left; - font-weight: normal; -} - -div.dataTables_length select { - width: 75px; -} - -div.dataTables_filter label { - float: right; - font-weight: normal; -} - -div.dataTables_filter input { - width: 16em; -} - -div.dataTables_info { - padding-top: 8px; -} - -div.dataTables_paginate { - float: right; - margin: 0; -} - -div.dataTables_paginate ul.pagination { - margin: 2px 0; - white-space: nowrap; -} - -table.dataTable, -table.dataTable td, -table.dataTable th { - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; -} - -table.dataTable { - clear: both; - margin-top: 6px !important; - margin-bottom: 6px !important; - max-width: none !important; -} - -table.dataTable thead .sorting, -table.dataTable thead .sorting_asc, -table.dataTable thead .sorting_desc, -table.dataTable thead .sorting_asc_disabled, -table.dataTable thead .sorting_desc_disabled { - cursor: pointer; -} - -table.dataTable thead .sorting { - background: url('../images/sort_both.png') no-repeat center right; -} - -table.dataTable thead .sorting_asc { - background: url('../images/sort_asc.png') no-repeat center right; -} - -table.dataTable thead .sorting_desc { - background: url('../images/sort_desc.png') no-repeat center right; -} - -table.dataTable thead .sorting_asc_disabled { - background: url('../images/sort_asc_disabled.png') no-repeat center right; -} - -table.dataTable thead .sorting_desc_disabled { - background: url('../images/sort_desc_disabled.png') no-repeat center right; -} - -table.dataTable th:active { - outline: none; -} - -/* Scrolling */ - -div.dataTables_scrollHead table { - margin-bottom: 0 !important; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; -} - -div.dataTables_scrollHead table thead tr:last-child th:first-child, -div.dataTables_scrollHead table thead tr:last-child td:first-child { - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.dataTables_scrollBody table { - margin-top: 0 !important; - margin-bottom: 0 !important; - border-top: none; -} - -div.dataTables_scrollBody tbody tr:first-child th, -div.dataTables_scrollBody tbody tr:first-child td { - border-top: none; -} - -div.dataTables_scrollFoot table { - margin-top: 0 !important; - border-top: none; -} - -/* - * TableTools styles - */ - -.table tbody tr.active td, -.table tbody tr.active th { - color: white; - background-color: #08C; -} - -.table tbody tr.active:hover td, -.table tbody tr.active:hover th { - background-color: #0075b0 !important; -} - -.table tbody tr.active a { - color: white; -} - -.table-striped tbody tr.active:nth-child(odd) td, -.table-striped tbody tr.active:nth-child(odd) th { - background-color: #017ebc; -} - -table.DTTT_selectable tbody tr { - cursor: pointer; -} - -div.DTTT .btn { - font-size: 12px; - color: #333 !important; -} - -div.DTTT .btn:hover { - text-decoration: none !important; -} - -ul.DTTT_dropdown.dropdown-menu { - z-index: 2003; -} - -ul.DTTT_dropdown.dropdown-menu a { - color: #333 !important; /* needed only when demo_page.css is included */ -} - -ul.DTTT_dropdown.dropdown-menu li { - position: relative; -} - -ul.DTTT_dropdown.dropdown-menu li:hover a { - color: white !important; - background-color: #0088cc; -} - -div.DTTT_collection_background { - z-index: 2002; -} - -/* TableTools information display */ - -div.DTTT_print_info.modal { - height: 150px; - margin-top: -75px; - text-align: center; -} - -div.DTTT_print_info h6 { - margin: 1em; - font-size: 28px; - font-weight: normal; - line-height: 28px; -} - -div.DTTT_print_info p { - font-size: 14px; - line-height: 20px; -} - -/* - * FixedColumns styles - */ - -div.DTFC_LeftHeadWrapper table, -div.DTFC_LeftFootWrapper table, -div.DTFC_RightHeadWrapper table, -div.DTFC_RightFootWrapper table, -table.DTFC_Cloned tr.even { - background-color: white; -} - -div.DTFC_RightHeadWrapper table, -div.DTFC_LeftHeadWrapper table { - margin-bottom: 0 !important; - border-top-right-radius: 0 !important; - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.DTFC_RightHeadWrapper table thead tr:last-child th:first-child, -div.DTFC_RightHeadWrapper table thead tr:last-child td:first-child, -div.DTFC_LeftHeadWrapper table thead tr:last-child th:first-child, -div.DTFC_LeftHeadWrapper table thead tr:last-child td:first-child { - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.DTFC_RightBodyWrapper table, -div.DTFC_LeftBodyWrapper table { - margin-bottom: 0 !important; - border-top: none; -} - -div.DTFC_RightBodyWrapper tbody tr:first-child th, -div.DTFC_RightBodyWrapper tbody tr:first-child td, -div.DTFC_LeftBodyWrapper tbody tr:first-child th, -div.DTFC_LeftBodyWrapper tbody tr:first-child td { - border-top: none; -} - -div.DTFC_RightFootWrapper table, -div.DTFC_LeftFootWrapper table { - border-top: none; -} diff --git a/src/main/resources/META-INF/resources/designer/css/dataTables.fixedColumns.css b/src/main/resources/META-INF/resources/designer/css/dataTables.fixedColumns.css deleted file mode 100644 index ee75c265..00000000 --- a/src/main/resources/META-INF/resources/designer/css/dataTables.fixedColumns.css +++ /dev/null @@ -1,22 +0,0 @@ -/* Block out what is behind the fixed column's header and footer */ -table.DTFC_Cloned thead, -table.DTFC_Cloned tfoot { - background-color: white; -} - -/* Block out the gap above the scrollbar on the right, when there is a fixed - * right column - */ -div.DTFC_Blocker { - background-color: white; -} - -div.DTFC_LeftWrapper table.dataTable, -div.DTFC_RightWrapper table.dataTable { - margin-bottom: 0; -} - -div.DTFC_LeftWrapper table.dataTable.no-footer, -div.DTFC_RightWrapper table.dataTable.no-footer { - border-bottom: none; -} diff --git a/src/main/resources/META-INF/resources/designer/css/dataTables.tableTools.css b/src/main/resources/META-INF/resources/designer/css/dataTables.tableTools.css deleted file mode 100644 index 844ca421..00000000 --- a/src/main/resources/META-INF/resources/designer/css/dataTables.tableTools.css +++ /dev/null @@ -1,361 +0,0 @@ -/* - * File: TableTools.css - * Description: Styles for TableTools 2 - * Author: Allan Jardine (www.sprymedia.co.uk) - * Language: Javascript - * License: GPL v2 / 3 point BSD - * Project: DataTables - * - * Copyright 2009-2012 Allan Jardine, all rights reserved. - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * CSS name space: - * DTTT DataTables TableTools - * - * Style sheet provides: - * CONTAINER TableTools container element and styles applying to all components - * BUTTON_STYLES Action specific button styles - * SELECTING Row selection styles - * COLLECTIONS Drop down list (collection) styles - * PRINTING Print display styles - */ - - -/* - * CONTAINER - * TableTools container element and styles applying to all components - */ -div.DTTT_container { - position: relative; - float: right; - margin-bottom: 1em; -} - -@media screen and (max-width: 640px) { - div.DTTT_container { - float: none !important; - text-align: center; - } - - div.DTTT_container:after { - visibility: hidden; - display: block; - content: ""; - clear: both; - height: 0; - } -} - - -button.DTTT_button, -div.DTTT_button, -a.DTTT_button { - position: relative; - display: inline-block; - margin-right: 3px; - padding: 5px 8px; - border: 1px solid #999; - cursor: pointer; - *cursor: hand; - font-size: 0.88em; - color: black !important; - - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - -ms-border-radius: 2px; - -o-border-radius: 2px; - border-radius: 2px; - - -webkit-box-shadow: 1px 1px 3px #ccc; - -moz-box-shadow: 1px 1px 3px #ccc; - -ms-box-shadow: 1px 1px 3px #ccc; - -o-box-shadow: 1px 1px 3px #ccc; - box-shadow: 1px 1px 3px #ccc; - - /* Generated by http://www.colorzilla.com/gradient-editor/ */ - background: #ffffff; /* Old browsers */ - background: -webkit-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Chrome10+,Safari5.1+ */ - background: -moz-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* FF3.6+ */ - background: -ms-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* IE10+ */ - background: -o-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Opera 11.10+ */ - background: linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f9f9f9',GradientType=0 ); /* IE6-9 */ -} - - -/* Buttons are cunning border-box sizing - we can't just use that for A and DIV due to IE6/7 */ -button.DTTT_button { - height: 30px; - padding: 3px 8px; -} - -.DTTT_button embed { - outline: none; -} - -button.DTTT_button:hover, -div.DTTT_button:hover, -a.DTTT_button:hover { - border: 1px solid #666; - text-decoration: none !important; - - -webkit-box-shadow: 1px 1px 3px #999; - -moz-box-shadow: 1px 1px 3px #999; - -ms-box-shadow: 1px 1px 3px #999; - -o-box-shadow: 1px 1px 3px #999; - box-shadow: 1px 1px 3px #999; - - background: #f3f3f3; /* Old browsers */ - background: -webkit-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* Chrome10+,Safari5.1+ */ - background: -moz-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* FF3.6+ */ - background: -ms-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* IE10+ */ - background: -o-linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* Opera 11.10+ */ - background: linear-gradient(top, #f3f3f3 0%,#e2e2e2 89%,#f4f4f4 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f3f3f3', endColorstr='#f4f4f4',GradientType=0 ); /* IE6-9 */ -} - -button.DTTT_button:focus, -div.DTTT_button:focus, -a.DTTT_button:focus { - border: 1px solid #426c9e; - text-shadow: 0 1px 0 #c4def1; - outline: none; - - background-color: #a3d0ef 100%; - background-image: -webkit-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%); - background-image: -moz-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%); - background-image: -ms-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%); - background-image: -o-linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%); - background-image: linear-gradient(top, #a3d0ef 0%, #79ace9 65%, #a3d0ef 100%); - filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#a3d0ef', EndColorStr='#a3d0ef'); -} - -button.DTTT_button:active, -div.DTTT_button:active, -a.DTTT_button:active { - -webkit-box-shadow: inset 1px 1px 3px #999999; - -moz-box-shadow: inset 1px 1px 3px #999999; - box-shadow: inset 1px 1px 3px #999999; -} - -button.DTTT_disabled, -div.DTTT_disabled, -a.DTTT_disabled { - color: #999; - border: 1px solid #d0d0d0; - - background: #ffffff; /* Old browsers */ - background: -webkit-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* Chrome10+,Safari5.1+ */ - background: -moz-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* FF3.6+ */ - background: -ms-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* IE10+ */ - background: -o-linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* Opera 11.10+ */ - background: linear-gradient(top, #ffffff 0%,#f9f9f9 89%,#fafafa 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#fafafa',GradientType=0 ); /* IE6-9 */ -} - - - -/* - * BUTTON_STYLES - * Action specific button styles - * If you want images - comment this back in - -a.DTTT_button_csv, -a.DTTT_button_xls, -a.DTTT_button_copy, -a.DTTT_button_pdf, -a.DTTT_button_print { - padding-right: 0px; -} - -a.DTTT_button_csv span, -a.DTTT_button_xls span, -a.DTTT_button_copy span, -a.DTTT_button_pdf span, -a.DTTT_button_print span { - display: inline-block; - height: 24px; - line-height: 24px; - padding-right: 30px; -} - - -a.DTTT_button_csv span { background: url(../images/csv.png) no-repeat bottom right; } -a.DTTT_button_csv:hover span { background: url(../images/csv_hover.png) no-repeat center right; } - -a.DTTT_button_xls span { background: url(../images/xls.png) no-repeat center right; } -a.DTTT_button_xls:hover span { background: #f0f0f0 url(../images/xls_hover.png) no-repeat center right; } - -a.DTTT_button_copy span { background: url(../images/copy.png) no-repeat center right; } -a.DTTT_button_copy:hover span { background: #f0f0f0 url(../images/copy_hover.png) no-repeat center right; } - -a.DTTT_button_pdf span { background: url(../images/pdf.png) no-repeat center right; } -a.DTTT_button_pdf:hover span { background: #f0f0f0 url(../images/pdf_hover.png) no-repeat center right; } - -a.DTTT_button_print span { background: url(../images/print.png) no-repeat center right; } -a.DTTT_button_print:hover span { background: #f0f0f0 url(../images/print_hover.png) no-repeat center right; } - - */ - -button.DTTT_button_collection span { - padding-right: 17px; - background: url(../images/collection.png) no-repeat center right; -} - -button.DTTT_button_collection:hover span { - padding-right: 17px; - background: #f0f0f0 url(../images/collection_hover.png) no-repeat center right; -} - - -/* - * SELECTING - * Row selection styles - */ -table.DTTT_selectable tbody tr { - cursor: pointer; - *cursor: hand; -} - -table.dataTable tr.DTTT_selected.odd { - background-color: #9FAFD1; -} - -table.dataTable tr.DTTT_selected.odd td.sorting_1 { - background-color: #9FAFD1; -} - -table.dataTable tr.DTTT_selected.odd td.sorting_2 { - background-color: #9FAFD1; -} - -table.dataTable tr.DTTT_selected.odd td.sorting_3 { - background-color: #9FAFD1; -} - - -table.dataTable tr.DTTT_selected.even { - background-color: #B0BED9; -} - -table.dataTable tr.DTTT_selected.even td.sorting_1 { - background-color: #B0BED9; -} - -table.dataTable tr.DTTT_selected.even td.sorting_2 { - background-color: #B0BED9; -} - -table.dataTable tr.DTTT_selected.even td.sorting_3 { - background-color: #B0BED9; -} - - -/* - * COLLECTIONS - * Drop down list (collection) styles - */ - -div.DTTT_collection { - width: 150px; - padding: 8px 8px 4px 8px; - border: 1px solid #ccc; - border: 1px solid rgba( 0, 0, 0, 0.4 ); - background-color: #f3f3f3; - background-color: rgba( 255, 255, 255, 0.3 ); - overflow: hidden; - z-index: 2002; - - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - -ms-border-radius: 5px; - -o-border-radius: 5px; - border-radius: 5px; - - -webkit-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); - -moz-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); - -ms-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); - -o-box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); - box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3); -} - -div.DTTT_collection_background { - background: transparent url(../images/background.png) repeat top left; - z-index: 2001; -} - -div.DTTT_collection button.DTTT_button, -div.DTTT_collection div.DTTT_button, -div.DTTT_collection a.DTTT_button { - position: relative; - left: 0; - right: 0; - - display: block; - float: none; - margin-bottom: 4px; - - -webkit-box-shadow: 1px 1px 3px #999; - -moz-box-shadow: 1px 1px 3px #999; - -ms-box-shadow: 1px 1px 3px #999; - -o-box-shadow: 1px 1px 3px #999; - box-shadow: 1px 1px 3px #999; -} - - -/* - * PRINTING - * Print display styles - */ - -.DTTT_print_info { - position: fixed; - top: 50%; - left: 50%; - width: 400px; - height: 150px; - margin-left: -200px; - margin-top: -75px; - text-align: center; - color: #333; - padding: 10px 30px; - - background: #ffffff; /* Old browsers */ - background: -webkit-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Chrome10+,Safari5.1+ */ - background: -moz-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* FF3.6+ */ - background: -ms-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* IE10+ */ - background: -o-linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* Opera 11.10+ */ - background: linear-gradient(top, #ffffff 0%,#f3f3f3 89%,#f9f9f9 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f9f9f9',GradientType=0 ); /* IE6-9 */ - - opacity: 0.95; - - border: 1px solid black; - border: 1px solid rgba(0, 0, 0, 0.5); - - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - -ms-border-radius: 6px; - -o-border-radius: 6px; - border-radius: 6px; - - -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); - -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); - -ms-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); - -o-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); - box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); -} - -.DTTT_print_info h6 { - font-weight: normal; - font-size: 28px; - line-height: 28px; - margin: 1em; -} - -.DTTT_print_info p { - font-size: 14px; - line-height: 20px; -} - diff --git a/src/main/resources/META-INF/resources/designer/lib/dataTables.bootstrap.js b/src/main/resources/META-INF/resources/designer/lib/dataTables.bootstrap.js deleted file mode 100644 index c2fba685..00000000 --- a/src/main/resources/META-INF/resources/designer/lib/dataTables.bootstrap.js +++ /dev/null @@ -1,245 +0,0 @@ -/* Set the defaults for DataTables initialisation */ -$.extend(true, $.fn.dataTable.defaults, { - "sDom": "<'row'<'col-sm-6'l><'col-sm-6'f>r>" + "t" + "<'row'<'col-sm-6'i><'col-sm-6'p>>", - "oLanguage": { - "sLengthMenu": "_MENU_ records per page" - } -}); - - -/* Default class modification */ -$.extend($.fn.dataTableExt.oStdClasses, { - "sWrapper": "dataTables_wrapper form-inline", - "sFilterInput": "form-control input-sm", - "sLengthSelect": "form-control input-sm" -}); - -// In 1.10 we use the pagination renderers to draw the Bootstrap paging, -// rather than custom plug-in -if ($.fn.dataTable.Api) { - $.fn.dataTable.defaults.renderer = 'bootstrap'; - $.fn.dataTable.ext.renderer.pageButton.bootstrap = function(settings, host, idx, buttons, page, pages) { - var api = new $.fn.dataTable.Api(settings); - var classes = settings.oClasses; - var lang = settings.oLanguage.oPaginate; - var btnDisplay, btnClass; - - var attach = function(container, buttons) { - var i, ien, node, button; - var clickHandler = function(e) { - e.preventDefault(); - if (e.data.action !== 'ellipsis') { - api.page(e.data.action).draw(false); - } - }; - - for (i = 0, ien = buttons.length; i < ien; i++) { - button = buttons[i]; - - if ($.isArray(button)) { - attach(container, button); - } else { - btnDisplay = ''; - btnClass = ''; - - switch (button) { - case 'ellipsis': - btnDisplay = '…'; - btnClass = 'disabled'; - break; - - case 'first': - btnDisplay = lang.sFirst; - btnClass = button + (page > 0 ? - '' : ' disabled'); - break; - - case 'previous': - btnDisplay = lang.sPrevious; - btnClass = button + (page > 0 ? - '' : ' disabled'); - break; - - case 'next': - btnDisplay = lang.sNext; - btnClass = button + (page < pages - 1 ? - '' : ' disabled'); - break; - - case 'last': - btnDisplay = lang.sLast; - btnClass = button + (page < pages - 1 ? - '' : ' disabled'); - break; - - default: - btnDisplay = button + 1; - btnClass = page === button ? - 'active' : ''; - break; - } - - if (btnDisplay) { - node = $('
  • ', { - 'class': classes.sPageButton + ' ' + btnClass, - 'aria-controls': settings.sTableId, - 'tabindex': settings.iTabIndex, - 'id': idx === 0 && typeof button === 'string' ? settings.sTableId + '_' + button : null - }) - .append($('', { - 'href': '#' - }) - .html(btnDisplay) - ) - .appendTo(container); - - settings.oApi._fnBindAction( - node, { - action: button - }, clickHandler - ); - } - } - } - }; - - attach( - $(host).empty().html('
      ').children('ul'), - buttons - ); - } -} else { - // Integration for 1.9- - $.fn.dataTable.defaults.sPaginationType = 'bootstrap'; - - /* API method to get paging information */ - $.fn.dataTableExt.oApi.fnPagingInfo = function(oSettings) { - return { - "iStart": oSettings._iDisplayStart, - "iEnd": oSettings.fnDisplayEnd(), - "iLength": oSettings._iDisplayLength, - "iTotal": oSettings.fnRecordsTotal(), - "iFilteredTotal": oSettings.fnRecordsDisplay(), - "iPage": oSettings._iDisplayLength === -1 ? 0 : Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength), - "iTotalPages": oSettings._iDisplayLength === -1 ? 0 : Math.ceil(oSettings.fnRecordsDisplay() / oSettings._iDisplayLength) - }; - }; - - /* Bootstrap style pagination control */ - $.extend($.fn.dataTableExt.oPagination, { - "bootstrap": { - "fnInit": function(oSettings, nPaging, fnDraw) { - var oLang = oSettings.oLanguage.oPaginate; - var fnClickHandler = function(e) { - e.preventDefault(); - if (oSettings.oApi._fnPageChange(oSettings, e.data.action)) { - fnDraw(oSettings); - } - }; - - $(nPaging).append( - '' - ); - var els = $('a', nPaging); - $(els[0]).bind('click.DT', { - action: "previous" - }, fnClickHandler); - $(els[1]).bind('click.DT', { - action: "next" - }, fnClickHandler); - }, - - "fnUpdate": function(oSettings, fnDraw) { - var iListLength = 5; - var oPaging = oSettings.oInstance.fnPagingInfo(); - var an = oSettings.aanFeatures.p; - var i, ien, j, sClass, iStart, iEnd, iHalf = Math.floor(iListLength / 2); - - if (oPaging.iTotalPages < iListLength) { - iStart = 1; - iEnd = oPaging.iTotalPages; - } else if (oPaging.iPage <= iHalf) { - iStart = 1; - iEnd = iListLength; - } else if (oPaging.iPage >= (oPaging.iTotalPages - iHalf)) { - iStart = oPaging.iTotalPages - iListLength + 1; - iEnd = oPaging.iTotalPages; - } else { - iStart = oPaging.iPage - iHalf + 1; - iEnd = iStart + iListLength - 1; - } - - for (i = 0, ien = an.length; i < ien; i++) { - // Remove the middle elements - $('li:gt(0)', an[i]).filter(':not(:last)').remove(); - - // Add the new list items and their event handlers - for (j = iStart; j <= iEnd; j++) { - sClass = (j == oPaging.iPage + 1) ? 'class="active"' : ''; - $('
    • ' + j + '
    • ') - .insertBefore($('li:last', an[i])[0]) - .bind('click', function(e) { - e.preventDefault(); - oSettings._iDisplayStart = (parseInt($('a', this).text(), 10) - 1) * oPaging.iLength; - fnDraw(oSettings); - }); - } - - // Add / remove disabled classes from the static elements - if (oPaging.iPage === 0) { - $('li:first', an[i]).addClass('disabled'); - } else { - $('li:first', an[i]).removeClass('disabled'); - } - - if (oPaging.iPage === oPaging.iTotalPages - 1 || oPaging.iTotalPages === 0) { - $('li:last', an[i]).addClass('disabled'); - } else { - $('li:last', an[i]).removeClass('disabled'); - } - } - } - } - }); -} - - -/* - * TableTools Bootstrap compatibility - * Required TableTools 2.1+ - */ -if ($.fn.DataTable.TableTools) { - // Set the classes that TableTools uses to something suitable for Bootstrap - $.extend(true, $.fn.DataTable.TableTools.classes, { - "container": "DTTT btn-group", - "buttons": { - "normal": "btn btn-default", - "disabled": "disabled" - }, - "collection": { - "container": "DTTT_dropdown dropdown-menu", - "buttons": { - "normal": "", - "disabled": "disabled" - } - }, - "print": { - "info": "DTTT_print_info modal" - }, - "select": { - "row": "active" - } - }); - - // Have the collection use a bootstrap compatible dropdown - $.extend(true, $.fn.DataTable.TableTools.DEFAULTS.oTags, { - "collection": { - "container": "ul", - "button": "li", - "liner": "a" - } - }); -} diff --git a/src/main/resources/META-INF/resources/designer/lib/dataTables.fixedColumns.js b/src/main/resources/META-INF/resources/designer/lib/dataTables.fixedColumns.js deleted file mode 100644 index 0e0ec274..00000000 --- a/src/main/resources/META-INF/resources/designer/lib/dataTables.fixedColumns.js +++ /dev/null @@ -1,1413 +0,0 @@ -/*! FixedColumns 3.0.3 - * ©2010-2014 SpryMedia Ltd - datatables.net/license - */ - -/** - * @summary FixedColumns - * @description Freeze columns in place on a scrolling DataTable - * @version 3.0.3 - * @file dataTables.fixedColumns.js - * @author SpryMedia Ltd (www.sprymedia.co.uk) - * @contact www.sprymedia.co.uk/contact - * @copyright Copyright 2010-2014 SpryMedia Ltd. - * - * This source file is free software, available under the following license: - * MIT license - http://datatables.net/license/mit - * - * This source file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. - * - * For details please refer to: http://www.datatables.net - */ - - -(function(window, document, undefined) { - - -var factory = function( $, DataTable ) { -"use strict"; - -/** - * When making use of DataTables' x-axis scrolling feature, you may wish to - * fix the left most column in place. This plug-in for DataTables provides - * exactly this option (note for non-scrolling tables, please use the - * FixedHeader plug-in, which can fix headers, footers and columns). Key - * features include: - * - * * Freezes the left or right most columns to the side of the table - * * Option to freeze two or more columns - * * Full integration with DataTables' scrolling options - * * Speed - FixedColumns is fast in its operation - * - * @class - * @constructor - * @global - * @param {object} dt DataTables instance. With DataTables 1.10 this can also - * be a jQuery collection, a jQuery selector, DataTables API instance or - * settings object. - * @param {object} [init={}] Configuration object for FixedColumns. Options are - * defined by {@link FixedColumns.defaults} - * - * @requires jQuery 1.7+ - * @requires DataTables 1.8.0+ - * - * @example - * var table = $('#example').dataTable( { - * "scrollX": "100%" - * } ); - * new $.fn.dataTable.fixedColumns( table ); - */ -var FixedColumns = function ( dt, init ) { - var that = this; - - /* Sanity check - you just know it will happen */ - if ( ! ( this instanceof FixedColumns ) ) - { - alert( "FixedColumns warning: FixedColumns must be initialised with the 'new' keyword." ); - return; - } - - if ( typeof init == 'undefined' ) - { - init = {}; - } - - // Use the DataTables Hungarian notation mapping method, if it exists to - // provide forwards compatibility for camel case variables - var camelToHungarian = $.fn.dataTable.camelToHungarian; - if ( camelToHungarian ) { - camelToHungarian( FixedColumns.defaults, FixedColumns.defaults, true ); - camelToHungarian( FixedColumns.defaults, init ); - } - - // v1.10 allows the settings object to be got form a number of sources - var dtSettings = $.fn.dataTable.Api ? - new $.fn.dataTable.Api( dt ).settings()[0] : - dt.fnSettings(); - - /** - * Settings object which contains customisable information for FixedColumns instance - * @namespace - * @extends FixedColumns.defaults - * @private - */ - this.s = { - /** - * DataTables settings objects - * @type object - * @default Obtained from DataTables instance - */ - "dt": dtSettings, - - /** - * Number of columns in the DataTable - stored for quick access - * @type int - * @default Obtained from DataTables instance - */ - "iTableColumns": dtSettings.aoColumns.length, - - /** - * Original outer widths of the columns as rendered by DataTables - used to calculate - * the FixedColumns grid bounding box - * @type array. - * @default [] - */ - "aiOuterWidths": [], - - /** - * Original inner widths of the columns as rendered by DataTables - used to apply widths - * to the columns - * @type array. - * @default [] - */ - "aiInnerWidths": [] - }; - - - /** - * DOM elements used by the class instance - * @namespace - * @private - * - */ - this.dom = { - /** - * DataTables scrolling element - * @type node - * @default null - */ - "scroller": null, - - /** - * DataTables header table - * @type node - * @default null - */ - "header": null, - - /** - * DataTables body table - * @type node - * @default null - */ - "body": null, - - /** - * DataTables footer table - * @type node - * @default null - */ - "footer": null, - - /** - * Display grid elements - * @namespace - */ - "grid": { - /** - * Grid wrapper. This is the container element for the 3x3 grid - * @type node - * @default null - */ - "wrapper": null, - - /** - * DataTables scrolling element. This element is the DataTables - * component in the display grid (making up the main table - i.e. - * not the fixed columns). - * @type node - * @default null - */ - "dt": null, - - /** - * Left fixed column grid components - * @namespace - */ - "left": { - "wrapper": null, - "head": null, - "body": null, - "foot": null - }, - - /** - * Right fixed column grid components - * @namespace - */ - "right": { - "wrapper": null, - "head": null, - "body": null, - "foot": null - } - }, - - /** - * Cloned table nodes - * @namespace - */ - "clone": { - /** - * Left column cloned table nodes - * @namespace - */ - "left": { - /** - * Cloned header table - * @type node - * @default null - */ - "header": null, - - /** - * Cloned body table - * @type node - * @default null - */ - "body": null, - - /** - * Cloned footer table - * @type node - * @default null - */ - "footer": null - }, - - /** - * Right column cloned table nodes - * @namespace - */ - "right": { - /** - * Cloned header table - * @type node - * @default null - */ - "header": null, - - /** - * Cloned body table - * @type node - * @default null - */ - "body": null, - - /** - * Cloned footer table - * @type node - * @default null - */ - "footer": null - } - } - }; - - /* Attach the instance to the DataTables instance so it can be accessed easily */ - dtSettings._oFixedColumns = this; - - /* Let's do it */ - if ( ! dtSettings._bInitComplete ) - { - dtSettings.oApi._fnCallbackReg( dtSettings, 'aoInitComplete', function () { - that._fnConstruct( init ); - }, 'FixedColumns' ); - } - else - { - this._fnConstruct( init ); - } -}; - - - -FixedColumns.prototype = /** @lends FixedColumns.prototype */{ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public methods - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Update the fixed columns - including headers and footers. Note that FixedColumns will - * automatically update the display whenever the host DataTable redraws. - * @returns {void} - * @example - * var table = $('#example').dataTable( { - * "scrollX": "100%" - * } ); - * var fc = new $.fn.dataTable.fixedColumns( table ); - * - * // at some later point when the table has been manipulated.... - * fc.fnUpdate(); - */ - "fnUpdate": function () - { - this._fnDraw( true ); - }, - - - /** - * Recalculate the resizes of the 3x3 grid that FixedColumns uses for display of the table. - * This is useful if you update the width of the table container. Note that FixedColumns will - * perform this function automatically when the window.resize event is fired. - * @returns {void} - * @example - * var table = $('#example').dataTable( { - * "scrollX": "100%" - * } ); - * var fc = new $.fn.dataTable.fixedColumns( table ); - * - * // Resize the table container and then have FixedColumns adjust its layout.... - * $('#content').width( 1200 ); - * fc.fnRedrawLayout(); - */ - "fnRedrawLayout": function () - { - this._fnColCalc(); - this._fnGridLayout(); - this.fnUpdate(); - }, - - - /** - * Mark a row such that it's height should be recalculated when using 'semiauto' row - * height matching. This function will have no effect when 'none' or 'auto' row height - * matching is used. - * @param {Node} nTr TR element that should have it's height recalculated - * @returns {void} - * @example - * var table = $('#example').dataTable( { - * "scrollX": "100%" - * } ); - * var fc = new $.fn.dataTable.fixedColumns( table ); - * - * // manipulate the table - mark the row as needing an update then update the table - * // this allows the redraw performed by DataTables fnUpdate to recalculate the row - * // height - * fc.fnRecalculateHeight(); - * table.fnUpdate( $('#example tbody tr:eq(0)')[0], ["insert date", 1, 2, 3 ... ]); - */ - "fnRecalculateHeight": function ( nTr ) - { - delete nTr._DTTC_iHeight; - nTr.style.height = 'auto'; - }, - - - /** - * Set the height of a given row - provides cross browser compatibility - * @param {Node} nTarget TR element that should have it's height recalculated - * @param {int} iHeight Height in pixels to set - * @returns {void} - * @example - * var table = $('#example').dataTable( { - * "scrollX": "100%" - * } ); - * var fc = new $.fn.dataTable.fixedColumns( table ); - * - * // You may want to do this after manipulating a row in the fixed column - * fc.fnSetRowHeight( $('#example tbody tr:eq(0)')[0], 50 ); - */ - "fnSetRowHeight": function ( nTarget, iHeight ) - { - nTarget.style.height = iHeight+"px"; - }, - - - /** - * Get data index information about a row or cell in the table body. - * This function is functionally identical to fnGetPosition in DataTables, - * taking the same parameter (TH, TD or TR node) and returning exactly the - * the same information (data index information). THe difference between - * the two is that this method takes into account the fixed columns in the - * table, so you can pass in nodes from the master table, or the cloned - * tables and get the index position for the data in the main table. - * @param {node} node TR, TH or TD element to get the information about - * @returns {int} If nNode is given as a TR, then a single index is - * returned, or if given as a cell, an array of [row index, column index - * (visible), column index (all)] is given. - */ - "fnGetPosition": function ( node ) - { - var idx; - var inst = this.s.dt.oInstance; - - if ( ! $(node).parents('.DTFC_Cloned').length ) - { - // Not in a cloned table - return inst.fnGetPosition( node ); - } - else - { - // Its in the cloned table, so need to look up position - if ( node.nodeName.toLowerCase() === 'tr' ) { - idx = $(node).index(); - return inst.fnGetPosition( $('tr', this.s.dt.nTBody)[ idx ] ); - } - else - { - var colIdx = $(node).index(); - idx = $(node.parentNode).index(); - var row = inst.fnGetPosition( $('tr', this.s.dt.nTBody)[ idx ] ); - - return [ - row, - colIdx, - inst.oApi._fnVisibleToColumnIndex( this.s.dt, colIdx ) - ]; - } - } - }, - - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Private methods (they are of course public in JS, but recommended as private) - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Initialisation for FixedColumns - * @param {Object} oInit User settings for initialisation - * @returns {void} - * @private - */ - "_fnConstruct": function ( oInit ) - { - var i, iLen, iWidth, - that = this; - - /* Sanity checking */ - if ( typeof this.s.dt.oInstance.fnVersionCheck != 'function' || - this.s.dt.oInstance.fnVersionCheck( '1.8.0' ) !== true ) - { - alert( "FixedColumns "+FixedColumns.VERSION+" required DataTables 1.8.0 or later. "+ - "Please upgrade your DataTables installation" ); - return; - } - - if ( this.s.dt.oScroll.sX === "" ) - { - this.s.dt.oInstance.oApi._fnLog( this.s.dt, 1, "FixedColumns is not needed (no "+ - "x-scrolling in DataTables enabled), so no action will be taken. Use 'FixedHeader' for "+ - "column fixing when scrolling is not enabled" ); - return; - } - - /* Apply the settings from the user / defaults */ - this.s = $.extend( true, this.s, FixedColumns.defaults, oInit ); - - /* Set up the DOM as we need it and cache nodes */ - var classes = this.s.dt.oClasses; - this.dom.grid.dt = $(this.s.dt.nTable).parents('div.'+classes.sScrollWrapper)[0]; - this.dom.scroller = $('div.'+classes.sScrollBody, this.dom.grid.dt )[0]; - - /* Set up the DOM that we want for the fixed column layout grid */ - this._fnColCalc(); - this._fnGridSetup(); - - /* Event handlers */ - var mouseController; - - // When the body is scrolled - scroll the left and right columns - $(this.dom.scroller) - .on( 'mouseover.DTFC touchstart.DTFC', function () { - mouseController = 'main'; - } ) - .on( 'scroll.DTFC', function () { - if ( mouseController === 'main' ) { - if ( that.s.iLeftColumns > 0 ) { - that.dom.grid.left.liner.scrollTop = that.dom.scroller.scrollTop; - } - if ( that.s.iRightColumns > 0 ) { - that.dom.grid.right.liner.scrollTop = that.dom.scroller.scrollTop; - } - } - } ); - - var wheelType = 'onwheel' in document.createElement('div') ? - 'wheel.DTFC' : - 'mousewheel.DTFC'; - - if ( that.s.iLeftColumns > 0 ) { - // When scrolling the left column, scroll the body and right column - $(that.dom.grid.left.liner) - .on( 'mouseover.DTFC touchstart.DTFC', function () { - mouseController = 'left'; - } ) - .on( 'scroll.DTFC', function () { - if ( mouseController === 'left' ) { - that.dom.scroller.scrollTop = that.dom.grid.left.liner.scrollTop; - if ( that.s.iRightColumns > 0 ) { - that.dom.grid.right.liner.scrollTop = that.dom.grid.left.liner.scrollTop; - } - } - } ) - .on( wheelType, function(e) { // xxx update the destroy as well - // Pass horizontal scrolling through - var xDelta = e.type === 'wheel' ? - -e.originalEvent.deltaX : - e.originalEvent.wheelDeltaX; - that.dom.scroller.scrollLeft -= xDelta; - } ); - } - - if ( that.s.iRightColumns > 0 ) { - // When scrolling the right column, scroll the body and the left column - $(that.dom.grid.right.liner) - .on( 'mouseover.DTFC touchstart.DTFC', function () { - mouseController = 'right'; - } ) - .on( 'scroll.DTFC', function () { - if ( mouseController === 'right' ) { - that.dom.scroller.scrollTop = that.dom.grid.right.liner.scrollTop; - if ( that.s.iLeftColumns > 0 ) { - that.dom.grid.left.liner.scrollTop = that.dom.grid.right.liner.scrollTop; - } - } - } ) - .on( wheelType, function(e) { - // Pass horizontal scrolling through - var xDelta = e.type === 'wheel' ? - -e.originalEvent.deltaX : - e.originalEvent.wheelDeltaX; - that.dom.scroller.scrollLeft -= xDelta; - } ); - } - - $(window).on( 'resize.DTFC', function () { - that._fnGridLayout.call( that ); - } ); - - var bFirstDraw = true; - var jqTable = $(this.s.dt.nTable); - - jqTable - .on( 'draw.dt.DTFC', function () { - that._fnDraw.call( that, bFirstDraw ); - bFirstDraw = false; - } ) - .on( 'column-sizing.dt.DTFC', function () { - that._fnColCalc(); - that._fnGridLayout( that ); - } ) - .on( 'column-visibility.dt.DTFC', function () { - that._fnColCalc(); - that._fnGridLayout( that ); - that._fnDraw( true ); - } ) - .on( 'destroy.dt.DTFC', function () { - jqTable.off( 'column-sizing.dt.DTFC destroy.dt.DTFC draw.dt.DTFC' ); - - $(that.dom.scroller).off( 'scroll.DTFC mouseover.DTFC' ); - $(window).off( 'resize.DTFC' ); - - $(that.dom.grid.left.liner).off( 'scroll.DTFC mouseover.DTFC '+wheelType ); - $(that.dom.grid.left.wrapper).remove(); - - $(that.dom.grid.right.liner).off( 'scroll.DTFC mouseover.DTFC '+wheelType ); - $(that.dom.grid.right.wrapper).remove(); - } ); - - /* Get things right to start with - note that due to adjusting the columns, there must be - * another redraw of the main table. It doesn't need to be a full redraw however. - */ - this._fnGridLayout(); - this.s.dt.oInstance.fnDraw(false); - }, - - - /** - * Calculate the column widths for the grid layout - * @returns {void} - * @private - */ - "_fnColCalc": function () - { - var that = this; - var iLeftWidth = 0; - var iRightWidth = 0; - - this.s.aiInnerWidths = []; - this.s.aiOuterWidths = []; - - $.each( this.s.dt.aoColumns, function (i, col) { - var th = $(col.nTh); - var border; - - if ( ! th.filter(':visible').length ) { - that.s.aiInnerWidths.push( 0 ); - that.s.aiOuterWidths.push( 0 ); - } - else - { - // Inner width is used to assign widths to cells - // Outer width is used to calculate the container - var iWidth = th.outerWidth(); - - // When working with the left most-cell, need to add on the - // table's border to the outerWidth, since we need to take - // account of it, but it isn't in any cell - if ( that.s.aiOuterWidths.length === 0 ) { - border = $(that.s.dt.nTable).css('border-left-width'); - iWidth += typeof border === 'string' ? 1 : parseInt( border, 10 ); - } - - // Likewise with the final column on the right - if ( that.s.aiOuterWidths.length === that.s.dt.aoColumns.length-1 ) { - border = $(that.s.dt.nTable).css('border-right-width'); - iWidth += typeof border === 'string' ? 1 : parseInt( border, 10 ); - } - - that.s.aiOuterWidths.push( iWidth ); - that.s.aiInnerWidths.push( th.width() ); - - if ( i < that.s.iLeftColumns ) - { - iLeftWidth += iWidth; - } - - if ( that.s.iTableColumns-that.s.iRightColumns <= i ) - { - iRightWidth += iWidth; - } - } - } ); - - this.s.iLeftWidth = iLeftWidth; - this.s.iRightWidth = iRightWidth; - }, - - - /** - * Set up the DOM for the fixed column. The way the layout works is to create a 1x3 grid - * for the left column, the DataTable (for which we just reuse the scrolling element DataTable - * puts into the DOM) and the right column. In each of he two fixed column elements there is a - * grouping wrapper element and then a head, body and footer wrapper. In each of these we then - * place the cloned header, body or footer tables. This effectively gives as 3x3 grid structure. - * @returns {void} - * @private - */ - "_fnGridSetup": function () - { - var that = this; - var oOverflow = this._fnDTOverflow(); - var block; - - this.dom.body = this.s.dt.nTable; - this.dom.header = this.s.dt.nTHead.parentNode; - this.dom.header.parentNode.parentNode.style.position = "relative"; - - var nSWrapper = - $('
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      '+ - '
      ')[0]; - var nLeft = nSWrapper.childNodes[0]; - var nRight = nSWrapper.childNodes[1]; - - this.dom.grid.dt.parentNode.insertBefore( nSWrapper, this.dom.grid.dt ); - nSWrapper.appendChild( this.dom.grid.dt ); - - this.dom.grid.wrapper = nSWrapper; - - if ( this.s.iLeftColumns > 0 ) - { - this.dom.grid.left.wrapper = nLeft; - this.dom.grid.left.head = nLeft.childNodes[0]; - this.dom.grid.left.body = nLeft.childNodes[1]; - this.dom.grid.left.liner = $('div.DTFC_LeftBodyLiner', nSWrapper)[0]; - - nSWrapper.appendChild( nLeft ); - } - - if ( this.s.iRightColumns > 0 ) - { - this.dom.grid.right.wrapper = nRight; - this.dom.grid.right.head = nRight.childNodes[0]; - this.dom.grid.right.body = nRight.childNodes[1]; - this.dom.grid.right.liner = $('div.DTFC_RightBodyLiner', nSWrapper)[0]; - - block = $('div.DTFC_RightHeadBlocker', nSWrapper)[0]; - block.style.width = oOverflow.bar+"px"; - block.style.right = -oOverflow.bar+"px"; - this.dom.grid.right.headBlock = block; - - block = $('div.DTFC_RightFootBlocker', nSWrapper)[0]; - block.style.width = oOverflow.bar+"px"; - block.style.right = -oOverflow.bar+"px"; - this.dom.grid.right.footBlock = block; - - nSWrapper.appendChild( nRight ); - } - - if ( this.s.dt.nTFoot ) - { - this.dom.footer = this.s.dt.nTFoot.parentNode; - if ( this.s.iLeftColumns > 0 ) - { - this.dom.grid.left.foot = nLeft.childNodes[2]; - } - if ( this.s.iRightColumns > 0 ) - { - this.dom.grid.right.foot = nRight.childNodes[2]; - } - } - }, - - - /** - * Style and position the grid used for the FixedColumns layout - * @returns {void} - * @private - */ - "_fnGridLayout": function () - { - var oGrid = this.dom.grid; - var iWidth = $(oGrid.wrapper).width(); - var iBodyHeight = $(this.s.dt.nTable.parentNode).outerHeight(); - var iFullHeight = $(this.s.dt.nTable.parentNode.parentNode).outerHeight(); - var oOverflow = this._fnDTOverflow(); - var - iLeftWidth = this.s.iLeftWidth, - iRightWidth = this.s.iRightWidth, - iRight; - var scrollbarAdjust = function ( node, width ) { - if ( ! oOverflow.bar ) { - // If there is no scrollbar (Macs) we need to hide the auto scrollbar - node.style.width = (width+20)+"px"; - node.style.paddingRight = "20px"; - node.style.boxSizing = "border-box"; - } - else { - // Otherwise just overflow by the scrollbar - node.style.width = (width+oOverflow.bar)+"px"; - } - }; - - // When x scrolling - don't paint the fixed columns over the x scrollbar - if ( oOverflow.x ) - { - iBodyHeight -= oOverflow.bar; - } - - oGrid.wrapper.style.height = iFullHeight+"px"; - - if ( this.s.iLeftColumns > 0 ) - { - oGrid.left.wrapper.style.width = iLeftWidth+"px"; - oGrid.left.wrapper.style.height = "1px"; - oGrid.left.body.style.height = iBodyHeight+"px"; - if ( oGrid.left.foot ) { - oGrid.left.foot.style.top = (oOverflow.x ? oOverflow.bar : 0)+"px"; // shift footer for scrollbar - } - - scrollbarAdjust( oGrid.left.liner, iLeftWidth ); - oGrid.left.liner.style.height = iBodyHeight+"px"; - } - - if ( this.s.iRightColumns > 0 ) - { - iRight = iWidth - iRightWidth; - if ( oOverflow.y ) - { - iRight -= oOverflow.bar; - } - - oGrid.right.wrapper.style.width = iRightWidth+"px"; - oGrid.right.wrapper.style.left = iRight+"px"; - oGrid.right.wrapper.style.height = "1px"; - oGrid.right.body.style.height = iBodyHeight+"px"; - if ( oGrid.right.foot ) { - oGrid.right.foot.style.top = (oOverflow.x ? oOverflow.bar : 0)+"px"; - } - - scrollbarAdjust( oGrid.right.liner, iRightWidth ); - oGrid.right.liner.style.height = iBodyHeight+"px"; - - oGrid.right.headBlock.style.display = oOverflow.y ? 'block' : 'none'; - oGrid.right.footBlock.style.display = oOverflow.y ? 'block' : 'none'; - } - }, - - - /** - * Get information about the DataTable's scrolling state - specifically if the table is scrolling - * on either the x or y axis, and also the scrollbar width. - * @returns {object} Information about the DataTables scrolling state with the properties: - * 'x', 'y' and 'bar' - * @private - */ - "_fnDTOverflow": function () - { - var nTable = this.s.dt.nTable; - var nTableScrollBody = nTable.parentNode; - var out = { - "x": false, - "y": false, - "bar": this.s.dt.oScroll.iBarWidth - }; - - if ( nTable.offsetWidth > nTableScrollBody.clientWidth ) - { - out.x = true; - } - - if ( nTable.offsetHeight > nTableScrollBody.clientHeight ) - { - out.y = true; - } - - return out; - }, - - - /** - * Clone and position the fixed columns - * @returns {void} - * @param {Boolean} bAll Indicate if the header and footer should be updated as well (true) - * @private - */ - "_fnDraw": function ( bAll ) - { - this._fnGridLayout(); - this._fnCloneLeft( bAll ); - this._fnCloneRight( bAll ); - - /* Draw callback function */ - if ( this.s.fnDrawCallback !== null ) - { - this.s.fnDrawCallback.call( this, this.dom.clone.left, this.dom.clone.right ); - } - - /* Event triggering */ - $(this).trigger( 'draw.dtfc', { - "leftClone": this.dom.clone.left, - "rightClone": this.dom.clone.right - } ); - }, - - - /** - * Clone the right columns - * @returns {void} - * @param {Boolean} bAll Indicate if the header and footer should be updated as well (true) - * @private - */ - "_fnCloneRight": function ( bAll ) - { - if ( this.s.iRightColumns <= 0 ) { - return; - } - - var that = this, - i, jq, - aiColumns = []; - - for ( i=this.s.iTableColumns-this.s.iRightColumns ; ithead', oClone.header); - jqCloneThead.empty(); - - /* Add the created cloned TR elements to the table */ - for ( i=0, iLen=aoCloneLayout.length ; ithead', oClone.header)[0] ); - - for ( i=0, iLen=aoCloneLayout.length ; itbody>tr', that.dom.body).css('height', 'auto'); - } - - if ( oClone.body !== null ) - { - oClone.body.parentNode.removeChild( oClone.body ); - oClone.body = null; - } - - oClone.body = $(this.dom.body).clone(true)[0]; - oClone.body.className += " DTFC_Cloned"; - oClone.body.style.paddingBottom = this.s.dt.oScroll.iBarWidth+"px"; - oClone.body.style.marginBottom = (this.s.dt.oScroll.iBarWidth*2)+"px"; /* For IE */ - if ( oClone.body.getAttribute('id') !== null ) - { - oClone.body.removeAttribute('id'); - } - - $('>thead>tr', oClone.body).empty(); - $('>tfoot', oClone.body).remove(); - - var nBody = $('tbody', oClone.body)[0]; - $(nBody).empty(); - if ( this.s.dt.aiDisplay.length > 0 ) - { - /* Copy the DataTables' header elements to force the column width in exactly the - * same way that DataTables does it - have the header element, apply the width and - * colapse it down - */ - var nInnerThead = $('>thead>tr', oClone.body)[0]; - for ( iIndex=0 ; iIndextbody>tr', that.dom.body).each( function (z) { - var n = this.cloneNode(false); - n.removeAttribute('id'); - var i = that.s.dt.oFeatures.bServerSide===false ? - that.s.dt.aiDisplay[ that.s.dt._iDisplayStart+z ] : z; - var aTds = $(this).children('td, th'); - - for ( iIndex=0 ; iIndex 0 ) - { - nClone = $( aTds[iColumn] ).clone(true, true)[0]; - n.appendChild( nClone ); - } - } - nBody.appendChild( n ); - } ); - } - else - { - $('>tbody>tr', that.dom.body).each( function (z) { - nClone = this.cloneNode(true); - nClone.className += ' DTFC_NoData'; - $('td', nClone).html(''); - nBody.appendChild( nClone ); - } ); - } - - oClone.body.style.width = "100%"; - oClone.body.style.margin = "0"; - oClone.body.style.padding = "0"; - - if ( bAll ) - { - if ( typeof this.s.dt.oScroller != 'undefined' ) - { - oGrid.liner.appendChild( this.s.dt.oScroller.dom.force.cloneNode(true) ); - } - } - oGrid.liner.appendChild( oClone.body ); - - this._fnEqualiseHeights( 'tbody', that.dom.body, oClone.body ); - - /* - * Footer - */ - if ( this.s.dt.nTFoot !== null ) - { - if ( bAll ) - { - if ( oClone.footer !== null ) - { - oClone.footer.parentNode.removeChild( oClone.footer ); - } - oClone.footer = $(this.dom.footer).clone(true, true)[0]; - oClone.footer.className += " DTFC_Cloned"; - oClone.footer.style.width = "100%"; - oGrid.foot.appendChild( oClone.footer ); - - /* Copy the footer just like we do for the header */ - aoCloneLayout = this._fnCopyLayout( this.s.dt.aoFooter, aiColumns ); - var jqCloneTfoot = $('>tfoot', oClone.footer); - jqCloneTfoot.empty(); - - for ( i=0, iLen=aoCloneLayout.length ; itfoot', oClone.footer)[0] ); - - for ( i=0, iLen=aoCloneLayout.length ; ithead', oClone.header)[0] ); - $(anUnique).each( function (i) { - iColumn = aiColumns[i]; - this.style.width = that.s.aiInnerWidths[iColumn]+"px"; - } ); - - if ( that.s.dt.nTFoot !== null ) - { - anUnique = this.s.dt.oApi._fnGetUniqueThs( this.s.dt, $('>tfoot', oClone.footer)[0] ); - $(anUnique).each( function (i) { - iColumn = aiColumns[i]; - this.style.width = that.s.aiInnerWidths[iColumn]+"px"; - } ); - } - }, - - - /** - * From a given table node (THEAD etc), get a list of TR direct child elements - * @param {Node} nIn Table element to search for TR elements (THEAD, TBODY or TFOOT element) - * @returns {Array} List of TR elements found - * @private - */ - "_fnGetTrNodes": function ( nIn ) - { - var aOut = []; - for ( var i=0, iLen=nIn.childNodes.length ; i'+nodeName+'>tr:eq(0)', original).children(':first'), - iBoxHack = jqBoxHack.outerHeight() - jqBoxHack.height(), - anOriginal = this._fnGetTrNodes( rootOriginal ), - anClone = this._fnGetTrNodes( rootClone ), - heights = []; - - for ( i=0, iLen=anClone.length ; i iHeightOriginal ? iHeightClone : iHeightOriginal; - - if ( this.s.sHeightMatch == 'semiauto' ) - { - anOriginal[i]._DTTC_iHeight = iHeight; - } - - heights.push( iHeight ); - } - - for ( i=0, iLen=anClone.length ; i'; - } - else { - // all other browsers get an EMBED tag - html += ''; - } - return html; - }, - - hide: function() { - // temporarily hide floater offscreen - if (this.div) { - this.div.style.left = '-2000px'; - } - }, - - show: function() { - // show ourselves after a call to hide() - this.reposition(); - }, - - destroy: function() { - // destroy control and floater - if (this.domElement && this.div) { - this.hide(); - this.div.innerHTML = ''; - - var body = document.getElementsByTagName('body')[0]; - try { body.removeChild( this.div ); } catch(e) {} - - this.domElement = null; - this.div = null; - } - }, - - reposition: function(elem) { - // reposition our floating div, optionally to new container - // warning: container CANNOT change size, only position - if (elem) { - this.domElement = ZeroClipboard_TableTools.$(elem); - if (!this.domElement) { - this.hide(); - } - } - - if (this.domElement && this.div) { - var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement); - var style = this.div.style; - style.left = '' + box.left + 'px'; - style.top = '' + box.top + 'px'; - } - }, - - clearText: function() { - // clear the text to be copy / saved - this.clipText = ''; - if (this.ready) { - this.movie.clearText(); - } - }, - - appendText: function(newText) { - // append text to that which is to be copied / saved - this.clipText += newText; - if (this.ready) { this.movie.appendText(newText) ;} - }, - - setText: function(newText) { - // set text to be copied to be copied / saved - this.clipText = newText; - if (this.ready) { this.movie.setText(newText) ;} - }, - - setCharSet: function(charSet) { - // set the character set (UTF16LE or UTF8) - this.charSet = charSet; - if (this.ready) { this.movie.setCharSet(charSet) ;} - }, - - setBomInc: function(bomInc) { - // set if the BOM should be included or not - this.incBom = bomInc; - if (this.ready) { this.movie.setBomInc(bomInc) ;} - }, - - setFileName: function(newText) { - // set the file name - this.fileName = newText; - if (this.ready) { - this.movie.setFileName(newText); - } - }, - - setAction: function(newText) { - // set action (save or copy) - this.action = newText; - if (this.ready) { - this.movie.setAction(newText); - } - }, - - addEventListener: function(eventName, func) { - // add user event listener for event - // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel - eventName = eventName.toString().toLowerCase().replace(/^on/, ''); - if (!this.handlers[eventName]) { - this.handlers[eventName] = []; - } - this.handlers[eventName].push(func); - }, - - setHandCursor: function(enabled) { - // enable hand cursor (true), or default arrow cursor (false) - this.handCursorEnabled = enabled; - if (this.ready) { - this.movie.setHandCursor(enabled); - } - }, - - setCSSEffects: function(enabled) { - // enable or disable CSS effects on DOM container - this.cssEffects = !!enabled; - }, - - receiveEvent: function(eventName, args) { - var self; - - // receive event from flash - eventName = eventName.toString().toLowerCase().replace(/^on/, ''); - - // special behavior for certain events - switch (eventName) { - case 'load': - // movie claims it is ready, but in IE this isn't always the case... - // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function - this.movie = document.getElementById(this.movieId); - if (!this.movie) { - self = this; - setTimeout( function() { self.receiveEvent('load', null); }, 1 ); - return; - } - - // firefox on pc needs a "kick" in order to set these in certain cases - if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) { - self = this; - setTimeout( function() { self.receiveEvent('load', null); }, 100 ); - this.ready = true; - return; - } - - this.ready = true; - this.movie.clearText(); - this.movie.appendText( this.clipText ); - this.movie.setFileName( this.fileName ); - this.movie.setAction( this.action ); - this.movie.setCharSet( this.charSet ); - this.movie.setBomInc( this.incBom ); - this.movie.setHandCursor( this.handCursorEnabled ); - break; - - case 'mouseover': - if (this.domElement && this.cssEffects) { - //this.domElement.addClass('hover'); - if (this.recoverActive) { - this.domElement.addClass('active'); - } - } - break; - - case 'mouseout': - if (this.domElement && this.cssEffects) { - this.recoverActive = false; - if (this.domElement.hasClass('active')) { - this.domElement.removeClass('active'); - this.recoverActive = true; - } - //this.domElement.removeClass('hover'); - } - break; - - case 'mousedown': - if (this.domElement && this.cssEffects) { - this.domElement.addClass('active'); - } - break; - - case 'mouseup': - if (this.domElement && this.cssEffects) { - this.domElement.removeClass('active'); - this.recoverActive = false; - } - break; - } // switch eventName - - if (this.handlers[eventName]) { - for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) { - var func = this.handlers[eventName][idx]; - - if (typeof(func) == 'function') { - // actual function reference - func(this, args); - } - else if ((typeof(func) == 'object') && (func.length == 2)) { - // PHP style object + method, i.e. [myObject, 'myMethod'] - func[0][ func[1] ](this, args); - } - else if (typeof(func) == 'string') { - // name of function - window[func](this, args); - } - } // foreach event handler defined - } // user defined handler for event - } - -}; - -// For the Flash binding to work, ZeroClipboard_TableTools must be on the global -// object list -window.ZeroClipboard_TableTools = ZeroClipboard_TableTools; -//include TableTools.js -/* TableTools - * 2009-2014 SpryMedia Ltd - datatables.net/license - */ - -/*globals TableTools,ZeroClipboard_TableTools*/ - - -(function($, window, document) { - -/** - * TableTools provides flexible buttons and other tools for a DataTables enhanced table - * @class TableTools - * @constructor - * @param {Object} oDT DataTables instance. When using DataTables 1.10 this can - * also be a jQuery collection, jQuery selector, table node, DataTables API - * instance or DataTables settings object. - * @param {Object} oOpts TableTools options - * @param {String} oOpts.sSwfPath ZeroClipboard SWF path - * @param {String} oOpts.sRowSelect Row selection options - 'none', 'single', 'multi' or 'os' - * @param {Function} oOpts.fnPreRowSelect Callback function just prior to row selection - * @param {Function} oOpts.fnRowSelected Callback function just after row selection - * @param {Function} oOpts.fnRowDeselected Callback function when row is deselected - * @param {Array} oOpts.aButtons List of buttons to be used - */ -TableTools = function( oDT, oOpts ) -{ - /* Santiy check that we are a new instance */ - if ( ! this instanceof TableTools ) - { - alert( "Warning: TableTools must be initialised with the keyword 'new'" ); - } - - // In 1.10 we can use the API to get the settings object from a number of - // sources - var dtSettings = $.fn.dataTable.Api ? - new $.fn.dataTable.Api( oDT ).settings()[0] : - oDT.fnSettings(); - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public class variables - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * @namespace Settings object which contains customisable information for TableTools instance - */ - this.s = { - /** - * Store 'this' so the instance can be retrieved from the settings object - * @property that - * @type object - * @default this - */ - "that": this, - - /** - * DataTables settings objects - * @property dt - * @type object - * @default From the oDT init option - */ - "dt": dtSettings, - - /** - * @namespace Print specific information - */ - "print": { - /** - * DataTables draw 'start' point before the printing display was shown - * @property saveStart - * @type int - * @default -1 - */ - "saveStart": -1, - - /** - * DataTables draw 'length' point before the printing display was shown - * @property saveLength - * @type int - * @default -1 - */ - "saveLength": -1, - - /** - * Page scrolling point before the printing display was shown so it can be restored - * @property saveScroll - * @type int - * @default -1 - */ - "saveScroll": -1, - - /** - * Wrapped function to end the print display (to maintain scope) - * @property funcEnd - * @type Function - * @default function () {} - */ - "funcEnd": function () {} - }, - - /** - * A unique ID is assigned to each button in each instance - * @property buttonCounter - * @type int - * @default 0 - */ - "buttonCounter": 0, - - /** - * @namespace Select rows specific information - */ - "select": { - /** - * Select type - can be 'none', 'single' or 'multi' - * @property type - * @type string - * @default "" - */ - "type": "", - - /** - * Array of nodes which are currently selected - * @property selected - * @type array - * @default [] - */ - "selected": [], - - /** - * Function to run before the selection can take place. Will cancel the select if the - * function returns false - * @property preRowSelect - * @type Function - * @default null - */ - "preRowSelect": null, - - /** - * Function to run when a row is selected - * @property postSelected - * @type Function - * @default null - */ - "postSelected": null, - - /** - * Function to run when a row is deselected - * @property postDeselected - * @type Function - * @default null - */ - "postDeselected": null, - - /** - * Indicate if all rows are selected (needed for server-side processing) - * @property all - * @type boolean - * @default false - */ - "all": false, - - /** - * Class name to add to selected TR nodes - * @property selectedClass - * @type String - * @default "" - */ - "selectedClass": "" - }, - - /** - * Store of the user input customisation object - * @property custom - * @type object - * @default {} - */ - "custom": {}, - - /** - * SWF movie path - * @property swfPath - * @type string - * @default "" - */ - "swfPath": "", - - /** - * Default button set - * @property buttonSet - * @type array - * @default [] - */ - "buttonSet": [], - - /** - * When there is more than one TableTools instance for a DataTable, there must be a - * master which controls events (row selection etc) - * @property master - * @type boolean - * @default false - */ - "master": false, - - /** - * Tag names that are used for creating collections and buttons - * @namesapce - */ - "tags": {} - }; - - - /** - * @namespace Common and useful DOM elements for the class instance - */ - this.dom = { - /** - * DIV element that is create and all TableTools buttons (and their children) put into - * @property container - * @type node - * @default null - */ - "container": null, - - /** - * The table node to which TableTools will be applied - * @property table - * @type node - * @default null - */ - "table": null, - - /** - * @namespace Nodes used for the print display - */ - "print": { - /** - * Nodes which have been removed from the display by setting them to display none - * @property hidden - * @type array - * @default [] - */ - "hidden": [], - - /** - * The information display saying telling the user about the print display - * @property message - * @type node - * @default null - */ - "message": null - }, - - /** - * @namespace Nodes used for a collection display. This contains the currently used collection - */ - "collection": { - /** - * The div wrapper containing the buttons in the collection (i.e. the menu) - * @property collection - * @type node - * @default null - */ - "collection": null, - - /** - * Background display to provide focus and capture events - * @property background - * @type node - * @default null - */ - "background": null - } - }; - - /** - * @namespace Name space for the classes that this TableTools instance will use - * @extends TableTools.classes - */ - this.classes = $.extend( true, {}, TableTools.classes ); - if ( this.s.dt.bJUI ) - { - $.extend( true, this.classes, TableTools.classes_themeroller ); - } - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public class methods - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Retreieve the settings object from an instance - * @method fnSettings - * @returns {object} TableTools settings object - */ - this.fnSettings = function () { - return this.s; - }; - - - /* Constructor logic */ - if ( typeof oOpts == 'undefined' ) - { - oOpts = {}; - } - - - TableTools._aInstances.push( this ); - this._fnConstruct( oOpts ); - - return this; -}; - - - -TableTools.prototype = { - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public methods - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Retreieve the settings object from an instance - * @returns {array} List of TR nodes which are currently selected - * @param {boolean} [filtered=false] Get only selected rows which are - * available given the filtering applied to the table. By default - * this is false - i.e. all rows, regardless of filtering are - selected. - */ - "fnGetSelected": function ( filtered ) - { - var - out = [], - data = this.s.dt.aoData, - displayed = this.s.dt.aiDisplay, - i, iLen; - - if ( filtered ) - { - // Only consider filtered rows - for ( i=0, iLen=displayed.length ; i 0 ) - { - sTitle = anTitle[0].innerHTML; - } - } - - /* Strip characters which the OS will object to - checking for UTF8 support in the scripting - * engine - */ - if ( "\u00A1".toString().length < 4 ) { - return sTitle.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g, ""); - } else { - return sTitle.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g, ""); - } - }, - - - /** - * Calculate a unity array with the column width by proportion for a set of columns to be - * included for a button. This is particularly useful for PDF creation, where we can use the - * column widths calculated by the browser to size the columns in the PDF. - * @param {Object} oConfig Button configuration object - * @returns {Array} Unity array of column ratios - */ - "fnCalcColRatios": function ( oConfig ) - { - var - aoCols = this.s.dt.aoColumns, - aColumnsInc = this._fnColumnTargets( oConfig.mColumns ), - aColWidths = [], - iWidth = 0, iTotal = 0, i, iLen; - - for ( i=0, iLen=aColumnsInc.length ; i